@capillarytech/blaze-ui 1.2.8-beta.2 → 2.0.3
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/README.md +60 -198
- package/dist/CapAlert/CapAlert.d.ts +7 -0
- package/dist/CapAlert/CapAlert.d.ts.map +1 -1
- package/dist/CapAlert/__snapshots__/CapAlert.test.tsx.snap +265 -0
- package/dist/CapAlert/index.js +8 -3
- package/dist/CapAlert/index.js.map +1 -1
- package/dist/CapButton/CapButton.d.ts +1 -1
- package/dist/CapButton/CapButton.d.ts.map +1 -1
- package/dist/CapButton/__snapshots__/CapButton.test.tsx.snap +199 -0
- package/dist/CapButton/index.js +25 -25
- package/dist/CapButton/index.js.map +1 -1
- package/dist/CapCard/__snapshots__/CapCard.test.tsx.snap +122 -0
- package/dist/CapCheckbox/__snapshots__/CapCheckbox.test.tsx.snap +275 -0
- package/dist/CapColumn/__snapshots__/CapColumn.test.tsx.snap +83 -0
- package/dist/CapDivider/CapDivider.d.ts +14 -1
- package/dist/CapDivider/CapDivider.d.ts.map +1 -1
- package/dist/CapDivider/__snapshots__/CapDivider.test.tsx.snap +172 -0
- package/dist/CapDivider/index.js +19 -489
- package/dist/CapDivider/index.js.map +1 -1
- package/dist/CapDropdown/CapDropdown.d.ts +31 -6
- package/dist/CapDropdown/CapDropdown.d.ts.map +1 -1
- package/dist/CapDropdown/__snapshots__/CapDropdown.test.tsx.snap +52 -0
- package/dist/CapDropdown/index.js +77 -19
- package/dist/CapDropdown/index.js.map +1 -1
- package/dist/CapForm/__snapshots__/CapForm.test.tsx.snap +103 -0
- package/dist/CapFormItem/__snapshots__/CapFormItem.test.tsx.snap +368 -0
- package/dist/CapHeading/CapHeading.d.ts +37 -0
- package/dist/CapHeading/CapHeading.d.ts.map +1 -0
- package/dist/CapHeading/CapHeading.test.d.ts +2 -0
- package/dist/CapHeading/CapHeading.test.d.ts.map +1 -0
- package/dist/CapHeading/README.md +220 -0
- package/dist/CapHeading/__snapshots__/CapHeading.test.tsx.snap +263 -0
- package/dist/CapHeading/index.d.ts +3 -0
- package/dist/CapHeading/index.d.ts.map +1 -0
- package/dist/CapHeading/index.js +740 -0
- package/dist/CapHeading/index.js.map +1 -0
- package/dist/CapIcon/__snapshots__/CapIcon.test.tsx.snap +366 -0
- package/dist/CapInput/Number.d.ts +1 -2
- package/dist/CapInput/Number.d.ts.map +1 -1
- package/dist/CapInput/__snapshots__/CapInput.test.tsx.snap +156 -0
- package/dist/CapInput/__snapshots__/Number.test.tsx.snap +557 -0
- package/dist/CapInput/__snapshots__/Search.test.tsx.snap +284 -0
- package/dist/CapInput/__snapshots__/TextArea.test.tsx.snap +100 -0
- package/dist/CapInput/index.js +1 -1
- package/dist/CapInput/index.js.map +1 -1
- package/dist/CapLabel/__snapshots__/CapLabel.test.tsx.snap +135 -0
- package/dist/CapMenu/__snapshots__/CapMenu.test.tsx.snap +653 -0
- package/dist/CapRadio/__snapshots__/CapRadio.test.tsx.snap +387 -0
- package/dist/CapRow/__snapshots__/CapRow.test.tsx.snap +149 -0
- package/dist/CapSkeleton/__snapshots__/CapSkeleton.test.tsx.snap +212 -0
- package/dist/CapSpin/__snapshots__/CapSpin.test.tsx.snap +245 -0
- package/dist/CapSwitch/CapSwitch.d.ts.map +1 -1
- package/dist/CapSwitch/__snapshots__/CapSwitch.test.tsx.snap +178 -0
- package/dist/CapSwitch/index.js +7 -489
- package/dist/CapSwitch/index.js.map +1 -1
- package/dist/CapTab/CapTab.d.ts +11 -1
- package/dist/CapTab/CapTab.d.ts.map +1 -1
- package/dist/CapTab/__snapshots__/CapTab.test.tsx.snap +1508 -0
- package/dist/CapTab/index.js +29 -19
- package/dist/CapTab/index.js.map +1 -1
- package/dist/CapTable/__snapshots__/CapTable.test.tsx.snap +993 -0
- package/dist/CapTooltip/CapTooltip.d.ts +32 -1
- package/dist/CapTooltip/CapTooltip.d.ts.map +1 -1
- package/dist/CapTooltip/__snapshots__/CapTooltip.test.tsx.snap +121 -0
- package/dist/CapTooltip/index.js +25 -7
- package/dist/CapTooltip/index.js.map +1 -1
- package/dist/CapTooltipWithInfo/__snapshots__/CapTooltipWithInfo.test.tsx.snap +388 -0
- package/dist/CapTooltipWithInfo/index.js +25 -7
- package/dist/CapTooltipWithInfo/index.js.map +1 -1
- package/dist/CapUnifiedSelect/__snapshots__/CapUnifiedSelect.test.tsx.snap +898 -0
- package/dist/CapUnifiedSelect/index.js +28 -8
- package/dist/CapUnifiedSelect/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +264 -274
- package/dist/index.js.map +1 -1
- package/dist/utils/fonts.d.ts +8 -8
- package/dist/utils/fonts.d.ts.map +1 -1
- package/dist/utils/getCapThemeConfig.d.ts +7 -0
- package/dist/utils/getCapThemeConfig.d.ts.map +1 -1
- package/dist/utils/index.d.ts +10 -10
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +17391 -214
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/styles.d.ts +2 -2
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -104,18 +104,31 @@ To customize when the GitHub Action runs:
|
|
|
104
104
|
- Modify the `.github/workflows/gitleaks_secret_scan.yml` file.
|
|
105
105
|
- Adjust the `on` section to trigger scans on additional events or branches.
|
|
106
106
|
|
|
107
|
-
#
|
|
107
|
+
# Cap UI
|
|
108
108
|
|
|
109
|
-
A modern React component library built with Ant Design
|
|
109
|
+
A modern React component library built with Ant Design v6, providing enhanced UI components for Capillary applications.
|
|
110
110
|
|
|
111
111
|
## Features
|
|
112
112
|
|
|
113
|
-
- 🎨 Built on top of Ant Design
|
|
113
|
+
- 🎨 Built on top of Ant Design v6 (latest)
|
|
114
114
|
- 📦 Tree-shakeable ES modules
|
|
115
115
|
- 🎯 Full TypeScript support with type definitions
|
|
116
116
|
- 🌐 Internationalization ready
|
|
117
117
|
- 💅 Styled with SCSS and CSS Modules
|
|
118
118
|
- ⚡ Optimized bundle size
|
|
119
|
+
- ✅ Fully compliant with Ant Design v6 APIs
|
|
120
|
+
|
|
121
|
+
## Ant Design v6 Migration (Complete ✅)
|
|
122
|
+
|
|
123
|
+
This library has been upgraded from Ant Design v5 to **v6.1.0**. All critical components are fully compliant with the new v6 APIs.
|
|
124
|
+
|
|
125
|
+
| Package | Version |
|
|
126
|
+
|---------|---------|
|
|
127
|
+
| `antd` | 6.1.0 |
|
|
128
|
+
| `@ant-design/icons` | 6.1.0 |
|
|
129
|
+
| React (required) | ≥18.0.0 |
|
|
130
|
+
|
|
131
|
+
> 📄 **For detailed migration information, see [docs/ANTD_V6_MIGRATION.md](./docs/ANTD_V6_MIGRATION.md)**
|
|
119
132
|
|
|
120
133
|
## Installation
|
|
121
134
|
|
|
@@ -136,17 +149,44 @@ yarn add @capillarytech/blaze-ui
|
|
|
136
149
|
Load fonts and base styles in your application entry point:
|
|
137
150
|
|
|
138
151
|
```jsx
|
|
139
|
-
import {
|
|
152
|
+
import { loadCapUI } from '@capillarytech/blaze-ui/utils';
|
|
140
153
|
|
|
141
154
|
// Load fonts (Roboto, Material Icons) and base styles (sanitize.css)
|
|
142
|
-
|
|
155
|
+
loadCapUI();
|
|
156
|
+
|
|
157
|
+
// Load with custom base font size (default: '14px')
|
|
158
|
+
loadCapUI({
|
|
159
|
+
baseFontSize: '16px'
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Configuration Options
|
|
164
|
+
|
|
165
|
+
The `loadCapUI` function accepts the following configuration options:
|
|
166
|
+
|
|
167
|
+
| Option | Type | Default | Description |
|
|
168
|
+
|--------|------|---------|-------------|
|
|
169
|
+
| `baseFontSize` | `string` | `'14px'` | Base font size for rem calculations. Sets `document.documentElement.style.fontSize` globally. |
|
|
170
|
+
| `loadRoboto` | `boolean` | `true` | Whether to load the Roboto font family. |
|
|
171
|
+
| `loadMaterialIcons` | `boolean` | `true` | Whether to load Material Icons font. |
|
|
172
|
+
| `robotoWeights` | `number[]` | `[400, 500]` | Array of font weights to load for Roboto (e.g., `[300, 400, 500, 700]`). |
|
|
173
|
+
|
|
174
|
+
**Example with all options:**
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
loadCapUI({
|
|
178
|
+
baseFontSize: '16px',
|
|
179
|
+
loadRoboto: true,
|
|
180
|
+
loadMaterialIcons: true,
|
|
181
|
+
robotoWeights: [300, 400, 500, 700]
|
|
182
|
+
});
|
|
143
183
|
```
|
|
144
184
|
|
|
145
185
|
**Note:** If your app already imports `sanitize.css` directly, webpack will deduplicate it if both resolve to the same module path. To avoid duplication, you can load fonts separately:
|
|
146
186
|
|
|
147
187
|
```jsx
|
|
148
|
-
import {
|
|
149
|
-
|
|
188
|
+
import { loadCapUIFonts } from '@capillarytech/blaze-ui/utils';
|
|
189
|
+
loadCapUIFonts();
|
|
150
190
|
```
|
|
151
191
|
|
|
152
192
|
### Using Components
|
|
@@ -181,7 +221,7 @@ This will start the Storybook development server at `http://localhost:6006`, whe
|
|
|
181
221
|
|
|
182
222
|
## Theming
|
|
183
223
|
|
|
184
|
-
|
|
224
|
+
Cap UI provides a comprehensive theming system using Ant Design v6's token-based architecture. This eliminates the need for SCSS color overrides and provides consistent theming across all components.
|
|
185
225
|
|
|
186
226
|
### Quick Start
|
|
187
227
|
|
|
@@ -200,192 +240,7 @@ function App() {
|
|
|
200
240
|
}
|
|
201
241
|
```
|
|
202
242
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
The `getCapThemeConfig()` function maps all Capillary design tokens to Ant Design tokens, ensuring consistent theming:
|
|
206
|
-
|
|
207
|
-
```tsx
|
|
208
|
-
import { ConfigProvider } from 'antd-v5';
|
|
209
|
-
import { getCapThemeConfig } from '@capillarytech/blaze-ui';
|
|
210
|
-
|
|
211
|
-
const App = () => (
|
|
212
|
-
<ConfigProvider theme={getCapThemeConfig()}>
|
|
213
|
-
<YourApp />
|
|
214
|
-
</ConfigProvider>
|
|
215
|
-
);
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Dark/Light Mode Support
|
|
219
|
-
|
|
220
|
-
Ant Design v5 supports built-in dark/light mode switching. Use the `algorithm` prop to enable theme switching:
|
|
221
|
-
|
|
222
|
-
```tsx
|
|
223
|
-
import { ConfigProvider, theme as antdTheme } from 'antd-v5';
|
|
224
|
-
import { getCapThemeConfig } from '@capillarytech/blaze-ui';
|
|
225
|
-
|
|
226
|
-
const App = ({ themeMode = 'light' }) => {
|
|
227
|
-
const themeConfig = getCapThemeConfig({
|
|
228
|
-
algorithm: themeMode === 'dark'
|
|
229
|
-
? antdTheme.darkAlgorithm
|
|
230
|
-
: antdTheme.defaultAlgorithm,
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
return (
|
|
234
|
-
<ConfigProvider theme={themeConfig}>
|
|
235
|
-
<YourApp />
|
|
236
|
-
</ConfigProvider>
|
|
237
|
-
);
|
|
238
|
-
};
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
**Example with theme toggle:**
|
|
242
|
-
|
|
243
|
-
```tsx
|
|
244
|
-
import React, { useState } from 'react';
|
|
245
|
-
import { ConfigProvider, theme as antdTheme } from 'antd-v5';
|
|
246
|
-
import { getCapThemeConfig } from '@capillarytech/blaze-ui';
|
|
247
|
-
import { Button } from 'antd-v5';
|
|
248
|
-
|
|
249
|
-
const App = () => {
|
|
250
|
-
const [isDark, setIsDark] = useState(false);
|
|
251
|
-
|
|
252
|
-
const themeConfig = getCapThemeConfig({
|
|
253
|
-
algorithm: isDark ? antdTheme.darkAlgorithm : antdTheme.defaultAlgorithm,
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
return (
|
|
257
|
-
<ConfigProvider theme={themeConfig}>
|
|
258
|
-
<Button onClick={() => setIsDark(!isDark)}>
|
|
259
|
-
Toggle {isDark ? 'Light' : 'Dark'} Mode
|
|
260
|
-
</Button>
|
|
261
|
-
<YourApp />
|
|
262
|
-
</ConfigProvider>
|
|
263
|
-
);
|
|
264
|
-
};
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### Custom Theme Overrides
|
|
268
|
-
|
|
269
|
-
You can override specific tokens while keeping the base Capillary theme:
|
|
270
|
-
|
|
271
|
-
```tsx
|
|
272
|
-
import { ConfigProvider } from 'antd-v5';
|
|
273
|
-
import { getCapThemeConfig } from '@capillarytech/blaze-ui';
|
|
274
|
-
|
|
275
|
-
const App = () => {
|
|
276
|
-
const themeConfig = getCapThemeConfig({
|
|
277
|
-
token: {
|
|
278
|
-
colorPrimary: '#custom-color', // Override primary color
|
|
279
|
-
borderRadius: 12, // Override border radius
|
|
280
|
-
},
|
|
281
|
-
components: {
|
|
282
|
-
Button: {
|
|
283
|
-
borderRadius: 8, // Override button border radius
|
|
284
|
-
controlHeight: 40, // Override button height
|
|
285
|
-
},
|
|
286
|
-
Input: {
|
|
287
|
-
colorBorder: '#custom-border', // Override input border color
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
return (
|
|
293
|
-
<ConfigProvider theme={themeConfig}>
|
|
294
|
-
<YourApp />
|
|
295
|
-
</ConfigProvider>
|
|
296
|
-
);
|
|
297
|
-
};
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### What Gets Themed
|
|
301
|
-
|
|
302
|
-
The `getCapThemeConfig()` function configures tokens for:
|
|
303
|
-
|
|
304
|
-
**Global Tokens:**
|
|
305
|
-
- Primary, success, warning, error, info colors
|
|
306
|
-
- Text colors (primary, secondary, tertiary, quaternary)
|
|
307
|
-
- Background colors (container, elevated, layout, spotlight)
|
|
308
|
-
- Border colors
|
|
309
|
-
- Typography (font family, sizes)
|
|
310
|
-
- Border radius
|
|
311
|
-
- Spacing/padding
|
|
312
|
-
|
|
313
|
-
**Component-Specific Tokens:**
|
|
314
|
-
- **Alert**: Background colors for success/info/warning/error states
|
|
315
|
-
- **Button**: Primary colors, hover states, disabled states, default button styles
|
|
316
|
-
- **Input**: Border colors, hover/focus states, error states, disabled states
|
|
317
|
-
- **Table**: Header colors, row hover states, text colors
|
|
318
|
-
- **Checkbox**: Checked colors, disabled states
|
|
319
|
-
- **Radio**: Checked colors, disabled states
|
|
320
|
-
- **Switch**: Checked colors, hover states
|
|
321
|
-
- **Tab**: Text colors, active states, ink bar color
|
|
322
|
-
- **Dropdown**: Hover states
|
|
323
|
-
- **Tooltip**: Background and text colors
|
|
324
|
-
- **Divider**: Border colors
|
|
325
|
-
- **Select**: Border, hover, disabled states
|
|
326
|
-
|
|
327
|
-
### Benefits of Token-Based Theming
|
|
328
|
-
|
|
329
|
-
✅ **No SCSS Overrides Needed**: Colors are handled via tokens, eliminating the need for SCSS color overrides
|
|
330
|
-
✅ **Consistent Theming**: All Ant Design components automatically use the configured tokens
|
|
331
|
-
✅ **Dark/Light Mode**: Built-in support for theme switching
|
|
332
|
-
✅ **Type-Safe**: Full TypeScript support with proper types
|
|
333
|
-
✅ **Easy Customization**: Override specific tokens without affecting others
|
|
334
|
-
✅ **Future-Proof**: Uses Ant Design v5's modern token system
|
|
335
|
-
|
|
336
|
-
### Migration from SCSS Overrides
|
|
337
|
-
|
|
338
|
-
If you're currently using SCSS overrides for Ant Design components, you can migrate to the token system:
|
|
339
|
-
|
|
340
|
-
**Before (SCSS overrides):**
|
|
341
|
-
```scss
|
|
342
|
-
.ant-btn-primary {
|
|
343
|
-
background-color: $cap-primary-base;
|
|
344
|
-
|
|
345
|
-
&:hover {
|
|
346
|
-
background-color: $cap-primary-hover;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
**After (Token-based):**
|
|
352
|
-
```tsx
|
|
353
|
-
import { ConfigProvider } from 'antd-v5';
|
|
354
|
-
import { getCapThemeConfig } from '@capillarytech/blaze-ui';
|
|
355
|
-
|
|
356
|
-
<ConfigProvider theme={getCapThemeConfig()}>
|
|
357
|
-
{/* Button colors are automatically themed */}
|
|
358
|
-
</ConfigProvider>
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
The `getCapThemeConfig()` function already maps all Capillary colors to Ant Design tokens, so you can remove SCSS color overrides and rely on the token system.
|
|
362
|
-
|
|
363
|
-
### Advanced: Multiple Theme Instances
|
|
364
|
-
|
|
365
|
-
You can create multiple theme instances for different parts of your application:
|
|
366
|
-
|
|
367
|
-
```tsx
|
|
368
|
-
import { ConfigProvider } from 'antd-v5';
|
|
369
|
-
import { getCapThemeConfig } from '@capillarytech/blaze-ui';
|
|
370
|
-
|
|
371
|
-
const App = () => {
|
|
372
|
-
const defaultTheme = getCapThemeConfig();
|
|
373
|
-
const customTheme = getCapThemeConfig({
|
|
374
|
-
token: { colorPrimary: '#ff6b6b' },
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
return (
|
|
378
|
-
<>
|
|
379
|
-
<ConfigProvider theme={defaultTheme}>
|
|
380
|
-
<DefaultSection />
|
|
381
|
-
</ConfigProvider>
|
|
382
|
-
<ConfigProvider theme={customTheme}>
|
|
383
|
-
<CustomSection />
|
|
384
|
-
</ConfigProvider>
|
|
385
|
-
</>
|
|
386
|
-
);
|
|
387
|
-
};
|
|
388
|
-
```
|
|
243
|
+
> 📄 **For complete theming documentation, see [docs/THEMING.md](./docs/THEMING.md)**
|
|
389
244
|
|
|
390
245
|
## Styling
|
|
391
246
|
|
|
@@ -393,7 +248,7 @@ The library uses CSS Modules with SCSS and automatically embeds styles in the Ja
|
|
|
393
248
|
|
|
394
249
|
### Using Design Tokens and Variables
|
|
395
250
|
|
|
396
|
-
|
|
251
|
+
Cap UI provides a comprehensive set of design tokens (colors, spacing, typography, etc.) in the `styled` folder that you can use in your application to maintain consistency with the component library.
|
|
397
252
|
|
|
398
253
|
#### For SCSS/SASS Projects
|
|
399
254
|
|
|
@@ -563,12 +418,20 @@ bash scripts/publish.sh beta
|
|
|
563
418
|
|
|
564
419
|
## Migration from cap-ui-library
|
|
565
420
|
|
|
566
|
-
This library is designed as a modern replacement for `@capillarytech/cap-ui-library`, migrated from Ant Design v3 to
|
|
421
|
+
This library is designed as a modern replacement for `@capillarytech/cap-ui-library`, migrated from Ant Design v3 to v6. Key changes include:
|
|
567
422
|
|
|
568
|
-
1. **Updated Ant Design APIs**: All components now use Ant Design
|
|
423
|
+
1. **Updated Ant Design APIs**: All components now use Ant Design v6 APIs (latest)
|
|
569
424
|
2. **Modern React patterns**: Functional components with hooks instead of class components
|
|
570
425
|
3. **Full TypeScript support**: Complete type definitions for all components and utilities
|
|
571
426
|
4. **Better tree-shaking**: Optimized bundle size with proper ES modules
|
|
427
|
+
5. **v6 Compliance**: All deprecated v5 APIs have been updated to use the new v6 equivalents
|
|
428
|
+
|
|
429
|
+
## Documentation
|
|
430
|
+
|
|
431
|
+
| Document | Description |
|
|
432
|
+
|----------|-------------|
|
|
433
|
+
| [ANTD_V6_MIGRATION.md](./docs/ANTD_V6_MIGRATION.md) | Detailed Ant Design v5 → v6 migration report |
|
|
434
|
+
| [THEMING.md](./docs/THEMING.md) | Complete theming guide with examples |
|
|
572
435
|
|
|
573
436
|
## Contributing
|
|
574
437
|
|
|
@@ -577,4 +440,3 @@ Please read our contributing guidelines before submitting PRs.
|
|
|
577
440
|
## License
|
|
578
441
|
|
|
579
442
|
ISC © Capillary Technologies
|
|
580
|
-
|
|
@@ -2,6 +2,13 @@ import React from 'react';
|
|
|
2
2
|
export interface CapAlertProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
type?: 'success' | 'info' | 'warning' | 'error';
|
|
5
|
+
/**
|
|
6
|
+
* Title/message content of the alert. Maps to Ant Design v6's `message` prop internally.
|
|
7
|
+
*/
|
|
8
|
+
title?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `title` instead. Will be removed in next major version.
|
|
11
|
+
*/
|
|
5
12
|
message?: React.ReactNode;
|
|
6
13
|
description?: React.ReactNode;
|
|
7
14
|
showIcon?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CapAlert.d.ts","sourceRoot":"","sources":["../../components/CapAlert/CapAlert.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"CapAlert.d.ts","sourceRoot":"","sources":["../../components/CapAlert/CapAlert.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAoBrC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`CapAlert Snapshots should match snapshot with custom className 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="cap-alert-wrapper"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="ant-alert ant-alert-info ant-alert-no-icon cap-alert-v2 custom-alert-class css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
10
|
+
data-show="true"
|
|
11
|
+
role="alert"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
class="ant-alert-section"
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
17
|
+
class="ant-alert-title"
|
|
18
|
+
>
|
|
19
|
+
Custom Alert
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`CapAlert Snapshots should match snapshot with default props 1`] = `
|
|
28
|
+
<div>
|
|
29
|
+
<div
|
|
30
|
+
class="cap-alert-wrapper"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
class="ant-alert ant-alert-info ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
34
|
+
data-show="true"
|
|
35
|
+
role="alert"
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
class="ant-alert-section"
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
class="ant-alert-title"
|
|
42
|
+
>
|
|
43
|
+
Default Alert
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
exports[`CapAlert Snapshots should match snapshot with description 1`] = `
|
|
52
|
+
<div>
|
|
53
|
+
<div
|
|
54
|
+
class="cap-alert-wrapper"
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
class="ant-alert ant-alert-info ant-alert-with-description ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
58
|
+
data-show="true"
|
|
59
|
+
role="alert"
|
|
60
|
+
>
|
|
61
|
+
<div
|
|
62
|
+
class="ant-alert-section"
|
|
63
|
+
>
|
|
64
|
+
<div
|
|
65
|
+
class="ant-alert-title"
|
|
66
|
+
>
|
|
67
|
+
Alert Title
|
|
68
|
+
</div>
|
|
69
|
+
<div
|
|
70
|
+
class="ant-alert-description"
|
|
71
|
+
>
|
|
72
|
+
This is the alert description
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
exports[`CapAlert Snapshots should match snapshot with error type 1`] = `
|
|
81
|
+
<div>
|
|
82
|
+
<div
|
|
83
|
+
class="cap-alert-wrapper"
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
class="ant-alert ant-alert-error ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
87
|
+
data-show="true"
|
|
88
|
+
role="alert"
|
|
89
|
+
>
|
|
90
|
+
<div
|
|
91
|
+
class="ant-alert-section"
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
class="ant-alert-title"
|
|
95
|
+
>
|
|
96
|
+
Error Alert
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
exports[`CapAlert Snapshots should match snapshot with info type 1`] = `
|
|
105
|
+
<div>
|
|
106
|
+
<div
|
|
107
|
+
class="cap-alert-wrapper"
|
|
108
|
+
>
|
|
109
|
+
<div
|
|
110
|
+
class="ant-alert ant-alert-info ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
111
|
+
data-show="true"
|
|
112
|
+
role="alert"
|
|
113
|
+
>
|
|
114
|
+
<div
|
|
115
|
+
class="ant-alert-section"
|
|
116
|
+
>
|
|
117
|
+
<div
|
|
118
|
+
class="ant-alert-title"
|
|
119
|
+
>
|
|
120
|
+
Info Alert
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
exports[`CapAlert Snapshots should match snapshot with showIcon 1`] = `
|
|
129
|
+
<div>
|
|
130
|
+
<div
|
|
131
|
+
class="cap-alert-wrapper"
|
|
132
|
+
>
|
|
133
|
+
<div
|
|
134
|
+
class="ant-alert ant-alert-info cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
135
|
+
data-show="true"
|
|
136
|
+
role="alert"
|
|
137
|
+
>
|
|
138
|
+
<span
|
|
139
|
+
aria-label="info-circle"
|
|
140
|
+
class="anticon anticon-info-circle ant-alert-icon"
|
|
141
|
+
role="img"
|
|
142
|
+
>
|
|
143
|
+
<svg
|
|
144
|
+
aria-hidden="true"
|
|
145
|
+
data-icon="info-circle"
|
|
146
|
+
fill="currentColor"
|
|
147
|
+
focusable="false"
|
|
148
|
+
height="1em"
|
|
149
|
+
viewBox="64 64 896 896"
|
|
150
|
+
width="1em"
|
|
151
|
+
>
|
|
152
|
+
<path
|
|
153
|
+
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"
|
|
154
|
+
/>
|
|
155
|
+
</svg>
|
|
156
|
+
</span>
|
|
157
|
+
<div
|
|
158
|
+
class="ant-alert-section"
|
|
159
|
+
>
|
|
160
|
+
<div
|
|
161
|
+
class="ant-alert-title"
|
|
162
|
+
>
|
|
163
|
+
Alert with Icon
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
`;
|
|
170
|
+
|
|
171
|
+
exports[`CapAlert Snapshots should match snapshot with success type 1`] = `
|
|
172
|
+
<div>
|
|
173
|
+
<div
|
|
174
|
+
class="cap-alert-wrapper"
|
|
175
|
+
>
|
|
176
|
+
<div
|
|
177
|
+
class="ant-alert ant-alert-success ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
178
|
+
data-show="true"
|
|
179
|
+
role="alert"
|
|
180
|
+
>
|
|
181
|
+
<div
|
|
182
|
+
class="ant-alert-section"
|
|
183
|
+
>
|
|
184
|
+
<div
|
|
185
|
+
class="ant-alert-title"
|
|
186
|
+
>
|
|
187
|
+
Success Alert
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
`;
|
|
194
|
+
|
|
195
|
+
exports[`CapAlert Snapshots should match snapshot with title prop 1`] = `
|
|
196
|
+
<div>
|
|
197
|
+
<div
|
|
198
|
+
class="cap-alert-wrapper"
|
|
199
|
+
>
|
|
200
|
+
<div
|
|
201
|
+
class="ant-alert ant-alert-info ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
202
|
+
data-show="true"
|
|
203
|
+
role="alert"
|
|
204
|
+
>
|
|
205
|
+
<div
|
|
206
|
+
class="ant-alert-section"
|
|
207
|
+
>
|
|
208
|
+
<div
|
|
209
|
+
class="ant-alert-title"
|
|
210
|
+
>
|
|
211
|
+
Title Alert
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
`;
|
|
218
|
+
|
|
219
|
+
exports[`CapAlert Snapshots should match snapshot with title prop taking precedence over message 1`] = `
|
|
220
|
+
<div>
|
|
221
|
+
<div
|
|
222
|
+
class="cap-alert-wrapper"
|
|
223
|
+
>
|
|
224
|
+
<div
|
|
225
|
+
class="ant-alert ant-alert-info ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
226
|
+
data-show="true"
|
|
227
|
+
role="alert"
|
|
228
|
+
>
|
|
229
|
+
<div
|
|
230
|
+
class="ant-alert-section"
|
|
231
|
+
>
|
|
232
|
+
<div
|
|
233
|
+
class="ant-alert-title"
|
|
234
|
+
>
|
|
235
|
+
Title
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
`;
|
|
242
|
+
|
|
243
|
+
exports[`CapAlert Snapshots should match snapshot with warning type 1`] = `
|
|
244
|
+
<div>
|
|
245
|
+
<div
|
|
246
|
+
class="cap-alert-wrapper"
|
|
247
|
+
>
|
|
248
|
+
<div
|
|
249
|
+
class="ant-alert ant-alert-warning ant-alert-no-icon cap-alert-v2 css-var-root css-dev-only-do-not-override-dbp7pc"
|
|
250
|
+
data-show="true"
|
|
251
|
+
role="alert"
|
|
252
|
+
>
|
|
253
|
+
<div
|
|
254
|
+
class="ant-alert-section"
|
|
255
|
+
>
|
|
256
|
+
<div
|
|
257
|
+
class="ant-alert-title"
|
|
258
|
+
>
|
|
259
|
+
Warning Alert
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
`;
|
package/dist/CapAlert/index.js
CHANGED
|
@@ -62,7 +62,7 @@ var _classnames = _interopRequireDefault(__webpack_require__(6942));
|
|
|
62
62
|
var _react = _interopRequireDefault(__webpack_require__(9206));
|
|
63
63
|
var _styles = _interopRequireDefault(__webpack_require__(4107));
|
|
64
64
|
var _jsxRuntime = __webpack_require__(4848);
|
|
65
|
-
const _excluded = ["className", "type"];
|
|
65
|
+
const _excluded = ["className", "type", "title", "message"];
|
|
66
66
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
67
67
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
68
68
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
@@ -70,14 +70,19 @@ const clsPrefix = 'cap-alert-v2';
|
|
|
70
70
|
const CapAlert = _ref => {
|
|
71
71
|
let {
|
|
72
72
|
className,
|
|
73
|
-
type = 'info'
|
|
73
|
+
type = 'info',
|
|
74
|
+
title,
|
|
75
|
+
message
|
|
74
76
|
} = _ref,
|
|
75
77
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
78
|
+
// Support both new `title` and deprecated `message` props
|
|
79
|
+
const alertTitle = title || message;
|
|
76
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
77
81
|
className: _styles.default['cap-alert-wrapper'],
|
|
78
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Alert, _extends({
|
|
79
83
|
className: (0, _classnames.default)(_styles.default[clsPrefix], className),
|
|
80
|
-
type: type
|
|
84
|
+
type: type,
|
|
85
|
+
message: alertTitle
|
|
81
86
|
}, rest))
|
|
82
87
|
});
|
|
83
88
|
};
|