@capillarytech/blaze-ui 4.2.0 → 4.3.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/CapAskAira/index.js +111 -7
- package/dist/CapAskAira/index.js.map +1 -1
- package/dist/CapCollapsibleLeftNavigation/index.js +111 -7
- package/dist/CapCollapsibleLeftNavigation/index.js.map +1 -1
- package/dist/CapCollapsibleNavbar/index.js +111 -7
- package/dist/CapCollapsibleNavbar/index.js.map +1 -1
- package/dist/CapDivider/README.md +122 -0
- package/dist/CapDivider/index.d.ts +2 -17
- package/dist/CapDivider/index.d.ts.map +1 -1
- package/dist/CapDivider/index.js +521 -8
- package/dist/CapDivider/index.js.map +1 -1
- package/dist/CapDivider/tests/__snapshots__/index.test.tsx.snap +57 -7
- package/dist/CapDivider/types.d.ts +32 -0
- package/dist/CapDivider/types.d.ts.map +1 -0
- package/dist/CapDragReorder/index.js +111 -7
- package/dist/CapDragReorder/index.js.map +1 -1
- package/dist/CapEventCalendar/index.js +290 -8
- package/dist/CapEventCalendar/index.js.map +1 -1
- package/dist/CapIllustration/index.js +290 -8
- package/dist/CapIllustration/index.js.map +1 -1
- package/dist/CapMobileDateRangePicker/index.js +111 -7
- package/dist/CapMobileDateRangePicker/index.js.map +1 -1
- package/dist/CapNavigation/index.js +111 -7
- package/dist/CapNavigation/index.js.map +1 -1
- package/dist/CapNotificationDropdown/index.js +111 -7
- package/dist/CapNotificationDropdown/index.js.map +1 -1
- package/dist/CapSecondaryTopBar/index.js +111 -7
- package/dist/CapSecondaryTopBar/index.js.map +1 -1
- package/dist/CapStatisticCard/README.md +138 -0
- package/dist/CapStatisticCard/index.d.ts +6 -0
- package/dist/CapStatisticCard/index.d.ts.map +1 -0
- package/dist/CapStatisticCard/index.js +143 -259
- package/dist/CapStatisticCard/index.js.map +1 -1
- package/dist/CapStatisticCard/types.d.ts +12 -0
- package/dist/CapStatisticCard/types.d.ts.map +1 -0
- package/dist/CapTimeline/index.js +111 -7
- package/dist/CapTimeline/index.js.map +1 -1
- package/dist/CapTimelineNested/index.js +111 -7
- package/dist/CapTimelineNested/index.js.map +1 -1
- package/dist/CapTopBar/index.js +111 -7
- package/dist/CapTopBar/index.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +290 -8
- package/dist/index.js.map +1 -1
- package/package.json +19 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# CapStatisticCard
|
|
2
|
+
|
|
3
|
+
A component for displaying statistics in a card layout with optional headers and dividers.
|
|
4
|
+
|
|
5
|
+
## Migration from cap-ui-library
|
|
6
|
+
|
|
7
|
+
This component has been migrated from `@capillarytech/cap-ui-library` to `@capillarytech/blaze-ui` with the following changes:
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
**No breaking changes** - The component maintains full backward compatibility with the previous version.
|
|
12
|
+
|
|
13
|
+
### Prop Changes
|
|
14
|
+
|
|
15
|
+
| Prop | Status | Type | Description |
|
|
16
|
+
|------|--------|------|-------------|
|
|
17
|
+
| `statsItems` | ✅ Unchanged | `CapStatisticCardItem[]` | Array of statistic items to display |
|
|
18
|
+
| `width` | ✅ Unchanged | `string` | Width for each statistic item (default: '20%') |
|
|
19
|
+
| `type` | ✅ Unchanged | `string` | Optional type label displayed in the first column |
|
|
20
|
+
| `showHeader` | ✅ Unchanged | `boolean` | Whether to show header row with item text labels |
|
|
21
|
+
|
|
22
|
+
### TypeScript Interfaces
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
export interface CapStatisticCardItem {
|
|
26
|
+
text: string;
|
|
27
|
+
value: string | number;
|
|
28
|
+
subText?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CapStatisticCardProps {
|
|
32
|
+
statsItems: CapStatisticCardItem[];
|
|
33
|
+
width?: string;
|
|
34
|
+
type?: string;
|
|
35
|
+
showHeader?: boolean;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### API Changes
|
|
40
|
+
|
|
41
|
+
- **TypeScript Support:** Full TypeScript support with exported `CapStatisticCardProps` and `CapStatisticCardItem` interfaces
|
|
42
|
+
- **Styling:** Migrated from global SCSS to SCSS modules for better encapsulation
|
|
43
|
+
- **Spacing:** Converted inline spacing values to use SCSS variables from `blaze-ui/components/styled/variables.scss`
|
|
44
|
+
- **Pixel Values:** Converted pixel values to rem units (base: 14px = 1rem)
|
|
45
|
+
|
|
46
|
+
### Behavioral Changes
|
|
47
|
+
|
|
48
|
+
- **Class Names:** Now uses SCSS module class names (e.g., `styles['stats-card']`) instead of global class names
|
|
49
|
+
- **Spacing Constants:** Uses SCSS variables (`$cap-space-04`, `$cap-space-08`, `$cap-space-12`) instead of JavaScript constants
|
|
50
|
+
- **Pixel Conversion:** All pixel values converted to rem:
|
|
51
|
+
- `10px` → `0.714rem`
|
|
52
|
+
- `-4px` → `-0.286rem`
|
|
53
|
+
- `12px` → `0.857rem` (via `$cap-space-12`)
|
|
54
|
+
|
|
55
|
+
### Usage Examples
|
|
56
|
+
|
|
57
|
+
#### Basic Usage
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { CapStatisticCard } from '@capillarytech/blaze-ui';
|
|
61
|
+
|
|
62
|
+
const stats = [
|
|
63
|
+
{ text: 'Total Users', value: 1234 },
|
|
64
|
+
{ text: 'Active Users', value: 856 },
|
|
65
|
+
{ text: 'Revenue', value: '$12,345', subText: '+12% from last month' },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
<CapStatisticCard statsItems={stats} />
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### With Type Label
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<CapStatisticCard
|
|
75
|
+
statsItems={stats}
|
|
76
|
+
type="Monthly Stats"
|
|
77
|
+
showHeader
|
|
78
|
+
/>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### Custom Width
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<CapStatisticCard
|
|
85
|
+
statsItems={stats}
|
|
86
|
+
width="25%"
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### With Subtext
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
const statsWithSubtext = [
|
|
94
|
+
{ text: 'Revenue', value: '$12,345', subText: '+12% from last month' },
|
|
95
|
+
{ text: 'Users', value: 1234, subText: '+5% growth' },
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
<CapStatisticCard statsItems={statsWithSubtext} />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Migration Steps for Consumers
|
|
102
|
+
|
|
103
|
+
1. **Update Import:**
|
|
104
|
+
```tsx
|
|
105
|
+
// Before
|
|
106
|
+
import CapStatisticCard from '@capillarytech/cap-ui-library/components/CapStatisticCard';
|
|
107
|
+
|
|
108
|
+
// After
|
|
109
|
+
import { CapStatisticCard } from '@capillarytech/blaze-ui';
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
2. **No prop changes required** - All props work exactly as before.
|
|
113
|
+
|
|
114
|
+
3. **TypeScript Support:** If using TypeScript, you can now import types:
|
|
115
|
+
```tsx
|
|
116
|
+
import { CapStatisticCard, CapStatisticCardProps, CapStatisticCardItem } from '@capillarytech/blaze-ui';
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### TypeScript
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { CapStatisticCard, CapStatisticCardProps, CapStatisticCardItem } from '@capillarytech/blaze-ui';
|
|
123
|
+
|
|
124
|
+
const stats: CapStatisticCardItem[] = [
|
|
125
|
+
{ text: 'Total Users', value: 1234 },
|
|
126
|
+
{ text: 'Active Users', value: 856 },
|
|
127
|
+
{ text: 'Revenue', value: '$12,345', subText: '+12% from last month' },
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
const props: CapStatisticCardProps = {
|
|
131
|
+
statsItems: stats,
|
|
132
|
+
type: 'Monthly Stats',
|
|
133
|
+
showHeader: true,
|
|
134
|
+
width: '20%',
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
<CapStatisticCard {...props} />
|
|
138
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CapStatisticCardProps } from './types';
|
|
3
|
+
export declare const renderCustomDivider: (type?: string) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
declare const CapStatisticCard: React.FC<CapStatisticCardProps>;
|
|
5
|
+
export default CapStatisticCard;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapStatisticCard/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,mBAAmB,GAAI,OAAM,MAAW,mDAEpD,CAAC;AAEF,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqErD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|