@capillarytech/blaze-ui 5.18.9 → 5.18.12
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/CapRadioCard/index.d.ts.map +1 -1
- package/CapRadioCard/index.js +41 -32
- package/CapRadioCard/index.js.map +1 -1
- package/CapRadioCard/types.d.ts +20 -0
- package/CapRadioCard/types.d.ts.map +1 -1
- package/CapStaticTemplates/README.md +212 -0
- package/CapStaticTemplates/constants.d.ts +3 -0
- package/CapStaticTemplates/constants.d.ts.map +1 -0
- package/CapStaticTemplates/index.d.ts +11 -0
- package/CapStaticTemplates/index.d.ts.map +1 -0
- package/CapStaticTemplates/index.js +331 -617
- package/CapStaticTemplates/index.js.map +1 -1
- package/CapStaticTemplates/messages.d.ts +32 -0
- package/CapStaticTemplates/messages.d.ts.map +1 -0
- package/CapStaticTemplates/types.d.ts +97 -0
- package/CapStaticTemplates/types.d.ts.map +1 -0
- package/CapStaticTemplates/use-cases.md +367 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +644 -34
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CapRadioCard/types.d.ts
CHANGED
|
@@ -20,6 +20,26 @@ export interface CapRadioCardPane {
|
|
|
20
20
|
}
|
|
21
21
|
export interface CapRadioCardProps extends Omit<React.ComponentProps<typeof Radio.Group>, 'size'> {
|
|
22
22
|
className?: string;
|
|
23
|
+
/** Root (RadioGroup) */
|
|
24
|
+
rootClassName?: string;
|
|
25
|
+
/** RadioButton wrapper */
|
|
26
|
+
radioButtonWrapperClassName?: string;
|
|
27
|
+
/** Checked icon */
|
|
28
|
+
checkedIconClassName?: string;
|
|
29
|
+
/** Icon wrapper div */
|
|
30
|
+
iconWrapperClassName?: string;
|
|
31
|
+
/** Icon container div */
|
|
32
|
+
iconContainerClassName?: string;
|
|
33
|
+
/** Div wrapping icon content */
|
|
34
|
+
divIconClassName?: string;
|
|
35
|
+
/** Content container */
|
|
36
|
+
contentContainerClassName?: string;
|
|
37
|
+
/** Header div */
|
|
38
|
+
headerClassName?: string;
|
|
39
|
+
/** Content div */
|
|
40
|
+
contentClassName?: string;
|
|
41
|
+
/** Info icon wrapper */
|
|
42
|
+
infoIconWrapperClassName?: string;
|
|
23
43
|
panes?: CapRadioCardPane[];
|
|
24
44
|
cardHeight?: number | string;
|
|
25
45
|
cardWidth?: number | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapRadioCard/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE;QACb,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,KAAK,CA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|
|
5
|
+
CapStaticTemplates has been migrated from `cap-ui-library` to `blaze-ui` with the following changes:
|
|
6
|
+
|
|
7
|
+
- Converted from JavaScript to TypeScript
|
|
8
|
+
- Removed PropTypes and defaultProps (using TypeScript types and destructuring defaults)
|
|
9
|
+
- Uses SCSS modules for styling (imported as `import styles from './styles.scss'`)
|
|
10
|
+
- Migrated to Ant Design v6 APIs
|
|
11
|
+
- Converted from styled-components to CSS Modules
|
|
12
|
+
- Added TypeScript interfaces for props
|
|
13
|
+
- Maintained backward compatibility with the existing API
|
|
14
|
+
|
|
15
|
+
## Breaking Changes
|
|
16
|
+
|
|
17
|
+
**No breaking changes from cap-ui-library v8.x**
|
|
18
|
+
|
|
19
|
+
The component maintains backward compatibility with all existing props. However, deprecated Ant Design Modal APIs (`visible` prop) have been migrated to v6 APIs (`open` prop) internally.
|
|
20
|
+
|
|
21
|
+
## Prop Changes
|
|
22
|
+
|
|
23
|
+
### All Props Maintained
|
|
24
|
+
|
|
25
|
+
All props from the original component are maintained with the same API:
|
|
26
|
+
|
|
27
|
+
| Prop | Type | Default | Description |
|
|
28
|
+
|------|------|---------|-------------|
|
|
29
|
+
| `categories` | `Category[]` | `[]` | Array of category objects |
|
|
30
|
+
| `className` | `string` | `undefined` | Additional CSS class name |
|
|
31
|
+
| `cardWidth` | `string` | `'278px'` | Width of template cards |
|
|
32
|
+
| `cardHeight` | `string` | `'104px'` | Height of template cards |
|
|
33
|
+
| `blankCardWidth` | `string` | `'278px'` | Width of blank template card |
|
|
34
|
+
| `blankCardHeight` | `string` | `'80px'` | Height of blank template card |
|
|
35
|
+
| `selectedCategory` | `string` | `undefined` | Currently selected category value |
|
|
36
|
+
| `onSelectCategory` | `(value: string) => void` | `undefined` | Callback when category is selected |
|
|
37
|
+
| `selectedStrategyTemplate` | `string` | `undefined` | Currently selected template key |
|
|
38
|
+
| `onSelectStrategyTemplate` | `(value: string) => void` | `undefined` | Callback when template is selected |
|
|
39
|
+
| `isBlankTemplateRequired` | `boolean` | `false` | Whether to show blank template option |
|
|
40
|
+
| `templatesContainerWidth` | `string` | `'990px'` | Width of templates container |
|
|
41
|
+
| `templatesContainerMaxHeight` | `string` | `'400px'` | Maximum height of templates container |
|
|
42
|
+
| `modalContent` | `ModalContent` | `undefined` | Modal content configuration |
|
|
43
|
+
| `searchPlaceholder` | `string` | `undefined` | Custom search placeholder text |
|
|
44
|
+
| `showComingSoon` | `boolean` | `true` | Whether to show "Coming Soon" tags |
|
|
45
|
+
|
|
46
|
+
### Locale Messages (Injected by LocaleHoc)
|
|
47
|
+
|
|
48
|
+
The following props are automatically injected by `LocaleHoc`:
|
|
49
|
+
|
|
50
|
+
- `strategyTitleMsg` - Strategy title message
|
|
51
|
+
- `strategyDescriptionMsg` - Strategy description message
|
|
52
|
+
- `comingSoonMsg` - Coming soon message
|
|
53
|
+
- `blankCategoryLabel` - Blank category label
|
|
54
|
+
- `blankTemplateLabel` - Blank template label
|
|
55
|
+
- `blankTemplateDescription` - Blank template description
|
|
56
|
+
- `searchPlaceholderMsg` - Search placeholder message
|
|
57
|
+
|
|
58
|
+
## Type Definitions
|
|
59
|
+
|
|
60
|
+
### Category
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
interface Category {
|
|
64
|
+
key: string;
|
|
65
|
+
label: string;
|
|
66
|
+
value: string;
|
|
67
|
+
color?: string;
|
|
68
|
+
premium?: boolean;
|
|
69
|
+
panes?: TemplatePane[];
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### TemplatePane
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
interface TemplatePane {
|
|
77
|
+
key: string;
|
|
78
|
+
label: string;
|
|
79
|
+
value: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
icon?: string;
|
|
82
|
+
isAvailable?: boolean;
|
|
83
|
+
isBlankTemplate?: boolean;
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### ModalContent
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
interface ModalContent {
|
|
92
|
+
title: string;
|
|
93
|
+
description: string;
|
|
94
|
+
iconsAndMessages?: IconMessage[];
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Migration from Ant Design v3 to v6
|
|
99
|
+
|
|
100
|
+
### Internal Changes
|
|
101
|
+
|
|
102
|
+
The component internally uses Ant Design v6 APIs:
|
|
103
|
+
|
|
104
|
+
- **Modal**: Uses `open` prop instead of deprecated `visible` prop (handled internally)
|
|
105
|
+
- **Input.Search**: Uses v6 Input component with Search functionality
|
|
106
|
+
- **RadioCard**: Uses CapRadioCard which wraps Ant Design Radio.Group
|
|
107
|
+
|
|
108
|
+
### Style Changes
|
|
109
|
+
|
|
110
|
+
**Approach**: The component uses CSS Modules with SCSS for styling. Most Ant Design component styling is handled through:
|
|
111
|
+
|
|
112
|
+
1. **Design Tokens**: Modal body padding uses `components.Modal.contentPadding` token
|
|
113
|
+
2. **CSS Modules**: Component-specific styles use CSS Modules with `styles[classname]` pattern
|
|
114
|
+
3. **CSS Variables**: Dynamic values (container width, max height, border colors) use CSS custom properties
|
|
115
|
+
4. **:global Overrides**: Complex nested Ant Design component styling uses `:global` blocks with `// OVERRIDE:` comments
|
|
116
|
+
|
|
117
|
+
### Non-Tokenizable Overrides
|
|
118
|
+
|
|
119
|
+
The following styles use `:global` blocks with `// OVERRIDE:` comments because they cannot be tokenized:
|
|
120
|
+
|
|
121
|
+
1. **RadioCard Complex Nesting**: Radio.Group and Card component nested styling for template cards
|
|
122
|
+
2. **Modal Fixed Dimensions**: Fixed modal width (737px) and height (274px) - no tokens available
|
|
123
|
+
3. **Modal Footer Display**: Hiding modal footer requires CSS override
|
|
124
|
+
4. **Custom Card Layout**: Fixed card dimensions (92x86px) for modal icon cards
|
|
125
|
+
|
|
126
|
+
## Code Improvements
|
|
127
|
+
|
|
128
|
+
1. **TypeScript Support**: Full TypeScript definitions with proper prop types
|
|
129
|
+
2. **Removed PropTypes**: All PropTypes removed, using TypeScript types only
|
|
130
|
+
3. **Removed defaultProps**: All default values use destructuring assignment in function arguments
|
|
131
|
+
4. **CSS Modules**: Converted from styled-components to CSS Modules with SCSS
|
|
132
|
+
5. **Function Syntax**: Converted from `function Component(props)` to destructured `({ prop1 = defaultValue })`
|
|
133
|
+
6. **Type Safety**: All function parameters and return types properly typed
|
|
134
|
+
|
|
135
|
+
## Usage Example
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import CapStaticTemplates from '@capillarytech/blaze-ui';
|
|
139
|
+
|
|
140
|
+
const categories = [
|
|
141
|
+
{
|
|
142
|
+
key: 'boostSales',
|
|
143
|
+
label: 'Boost sales',
|
|
144
|
+
value: 'boostSales',
|
|
145
|
+
color: '#91e5e5',
|
|
146
|
+
panes: [
|
|
147
|
+
{
|
|
148
|
+
key: 'browseAbandonNew',
|
|
149
|
+
label: 'Browse abandon new',
|
|
150
|
+
value: 'browseAbandonNew',
|
|
151
|
+
description: 'Target contacts who have visited your product pages',
|
|
152
|
+
icon: 'basket',
|
|
153
|
+
isAvailable: true,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
const modalContent = {
|
|
160
|
+
title: 'Journey templates',
|
|
161
|
+
description: 'Pre-defined strategy driven marketing use-cases',
|
|
162
|
+
iconsAndMessages: [
|
|
163
|
+
{ iconType: 'communication', message: 'Content personalisation' },
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
function MyComponent() {
|
|
168
|
+
const [selectedCategory, setSelectedCategory] = useState('boostSales');
|
|
169
|
+
const [selectedTemplate, setSelectedTemplate] = useState('browseAbandonNew');
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<CapStaticTemplates
|
|
173
|
+
categories={categories}
|
|
174
|
+
modalContent={modalContent}
|
|
175
|
+
selectedCategory={selectedCategory}
|
|
176
|
+
onSelectCategory={setSelectedCategory}
|
|
177
|
+
selectedStrategyTemplate={selectedTemplate}
|
|
178
|
+
onSelectStrategyTemplate={setSelectedTemplate}
|
|
179
|
+
isBlankTemplateRequired={true}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## What Stayed the Same
|
|
186
|
+
|
|
187
|
+
- All component props and API
|
|
188
|
+
- Component behavior and functionality
|
|
189
|
+
- Search functionality with debounce
|
|
190
|
+
- Modal display for unavailable templates
|
|
191
|
+
- Blank template feature
|
|
192
|
+
- Premium category indicators
|
|
193
|
+
- Tooltip for long labels
|
|
194
|
+
- Category selection and scroll behavior
|
|
195
|
+
|
|
196
|
+
## What Changed
|
|
197
|
+
|
|
198
|
+
- **Removed**: PropTypes and defaultProps
|
|
199
|
+
- **Removed**: styled-components dependency
|
|
200
|
+
- **Removed**: Old function syntax with props parameter
|
|
201
|
+
- **Added**: TypeScript types and interfaces
|
|
202
|
+
- **Added**: CSS Modules with SCSS
|
|
203
|
+
- **Added**: Design token support for Modal padding
|
|
204
|
+
- **Changed**: Modal uses `open` prop internally (backward compatible)
|
|
205
|
+
|
|
206
|
+
## Theme Configuration
|
|
207
|
+
|
|
208
|
+
The following design tokens have been added to `getCapThemeConfig`:
|
|
209
|
+
|
|
210
|
+
- `components.Modal.contentPadding`: 24px for modal body padding
|
|
211
|
+
|
|
212
|
+
These tokens are automatically applied when using `getCapThemeConfig()` in your application's ConfigProvider.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../components/CapStaticTemplates/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,mBAAmB,QAAQ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* CapStaticTemplates
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { WrappedComponentProps } from 'react-intl';
|
|
8
|
+
import type { CapStaticTemplatesProps } from './types';
|
|
9
|
+
declare const _default: React.FC<Omit<CapStaticTemplatesProps, keyof WrappedComponentProps>>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapStaticTemplates/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAc,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAsB/D,OAAO,KAAK,EAAE,uBAAuB,EAA0B,MAAM,SAAS,CAAC;wBAwYnB,KAAK,CAAC,EAAE,CAClE,IAAI,CAAC,uBAAuB,EAAE,MAAM,qBAAqB,CAAC,CAC3D;AAFD,wBAEE"}
|