@capillarytech/blaze-ui 5.21.0 → 5.22.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.
Files changed (177) hide show
  1. package/CapLanguageProvider/actions.js +125 -0
  2. package/CapLanguageProvider/actions.js.map +1 -0
  3. package/CapLanguageProvider/constants.js +37 -0
  4. package/CapLanguageProvider/constants.js.map +1 -0
  5. package/package.json +1 -1
  6. package/CapActionBar/README.md +0 -11
  7. package/CapAdvancedIcon/README.md +0 -185
  8. package/CapAdvancedIcon/use-cases.md +0 -44
  9. package/CapAlert/README.md +0 -144
  10. package/CapAppNotEnabled/README.md +0 -84
  11. package/CapAskAira/README.md +0 -328
  12. package/CapBanner/README.md +0 -4
  13. package/CapBlock/README.md +0 -175
  14. package/CapBorderedBox/Status.md +0 -40
  15. package/CapCSVFileUploader/README.md +0 -124
  16. package/CapCSVFileUploader/Status.md +0 -47
  17. package/CapCard/README.md +0 -85
  18. package/CapCard/Status.md +0 -41
  19. package/CapCardBox/README.md +0 -169
  20. package/CapCardBox/Status.md +0 -52
  21. package/CapCarousel/README.md +0 -190
  22. package/CapCarousel/Status.md +0 -73
  23. package/CapCheckbox/README.md +0 -254
  24. package/CapCheckbox/Status.md +0 -41
  25. package/CapColorPicker/README.md +0 -112
  26. package/CapColorPicker/Status.md +0 -52
  27. package/CapColorPicker/tests/USE_CASES_ANALYSIS.md +0 -92
  28. package/CapColoredTag/README.md +0 -167
  29. package/CapColoredTag/Status.md +0 -49
  30. package/CapConditionPreview/MIGRATION_ANALYSIS.md +0 -70
  31. package/CapConditionPreview/README.md +0 -40
  32. package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +0 -65
  33. package/CapCustomCard/README.md +0 -182
  34. package/CapCustomCard/Status.md +0 -40
  35. package/CapCustomCarousel/Status.md +0 -69
  36. package/CapCustomCheckboxList/README.md +0 -178
  37. package/CapCustomCheckboxList/Status.md +0 -52
  38. package/CapCustomCheckboxList/tests/USE_CASES_ANALYSIS.md +0 -174
  39. package/CapCustomList/README.md +0 -117
  40. package/CapCustomList/Status.md +0 -77
  41. package/CapCustomList/tests/USE_CASES_ANALYSIS.md +0 -124
  42. package/CapCustomSelect/README.md +0 -38
  43. package/CapDatePicker/README.md +0 -139
  44. package/CapDateRangePicker/README.md +0 -159
  45. package/CapDateTimePicker/README.md +0 -136
  46. package/CapDateTimeRangePicker/README.md +0 -243
  47. package/CapDivider/README.md +0 -122
  48. package/CapDrawer/README.md +0 -207
  49. package/CapDrawer/Status.md +0 -52
  50. package/CapDrawer/tests/MISSING_USE_CASES.md +0 -170
  51. package/CapDropdown/README.md +0 -515
  52. package/CapDropdown/Status.md +0 -45
  53. package/CapDropdown/tests/USE_CASES_ANALYSIS.md +0 -137
  54. package/CapError/README.md +0 -88
  55. package/CapErrorBoundary/CapErrorBoundary-use-cases.md +0 -89
  56. package/CapErrorBoundary/README.md +0 -150
  57. package/CapErrorStateIllustration/README.md +0 -222
  58. package/CapErrorStateIllustration/USE_CASES.md +0 -33
  59. package/CapExpressionEditor/README.md +0 -32
  60. package/CapForm/README.md +0 -132
  61. package/CapForm/Status.md +0 -40
  62. package/CapForm/tests/PHASE1_UNFULFILLED_USE_CASES.md +0 -113
  63. package/CapForm/tests/USE_CASES_ANALYSIS.md +0 -119
  64. package/CapFormItem/README.md +0 -320
  65. package/CapFormItem/Status.md +0 -73
  66. package/CapFormItem/tests/USE_CASES_ANALYSIS.md +0 -84
  67. package/CapGraph/README.md +0 -69
  68. package/CapGraph/USE_CASES.md +0 -66
  69. package/CapHamburgerMenu/README.md +0 -234
  70. package/CapHamburgerMenu/USE_CASES.md +0 -48
  71. package/CapHeader/Status.md +0 -41
  72. package/CapHeading/README.md +0 -220
  73. package/CapHeading/Status.md +0 -41
  74. package/CapIcon/README.md +0 -207
  75. package/CapIllustration/Status.md +0 -41
  76. package/CapImage/README.md +0 -50
  77. package/CapImportMFEComponent/README.md +0 -121
  78. package/CapInfoNote/Status.md +0 -40
  79. package/CapInfoNote/tests/USE_CASES_ANALYSIS.md +0 -114
  80. package/CapInput/README.md +0 -196
  81. package/CapInput/Status.md +0 -123
  82. package/CapInput/tests/USE_CASES_ANALYSIS.md +0 -169
  83. package/CapLanguageProvider/CapLanguageProvider-use-cases.md +0 -56
  84. package/CapLanguageProvider/README.md +0 -206
  85. package/CapLevelGraphRenderer/CapLevelGraphRenderer-test-cases.md +0 -50
  86. package/CapLevelGraphRenderer/README.md +0 -123
  87. package/CapLevelGraphRenderer/Tooltip_MIGRATION_ANALYSIS.md +0 -120
  88. package/CapLink/README.md +0 -203
  89. package/CapLink/Status.md +0 -32
  90. package/CapLink/tests/CapLink.missingUseCases.md +0 -95
  91. package/CapList/README.md +0 -129
  92. package/CapList/Status.md +0 -69
  93. package/CapListLayout/README.md +0 -7
  94. package/CapLogin/README.md +0 -7
  95. package/CapMenu/README.md +0 -86
  96. package/CapModal/README.md +0 -357
  97. package/CapModal/Status.md +0 -52
  98. package/CapModal/tests/USE_CASES_GAPS.md +0 -207
  99. package/CapMultiSelect/README.md +0 -170
  100. package/CapMultiSelect/tests/USE_CASES_ANALYSIS.md +0 -29
  101. package/CapMultiSelectDatePicker/README.md +0 -11
  102. package/CapNavigation/README.md +0 -72
  103. package/CapNotification/README.md +0 -228
  104. package/CapNotificationDropdown/README.md +0 -5
  105. package/CapPopover/README.md +0 -234
  106. package/CapProgress/Status.md +0 -40
  107. package/CapRadio/Status.md +0 -54
  108. package/CapRadioButton/README.md +0 -152
  109. package/CapRadioButton/Status.md +0 -70
  110. package/CapRadioButton/tests/USE_CASES_ANALYSIS.md +0 -120
  111. package/CapRadioCard/README.md +0 -161
  112. package/CapRadioCard/Status.md +0 -78
  113. package/CapRadioGroup/README.md +0 -141
  114. package/CapRadioGroup/Status.md +0 -59
  115. package/CapReorderComponent/README.md +0 -179
  116. package/CapReorderComponent/Status.md +0 -41
  117. package/CapRoadMap/README.md +0 -126
  118. package/CapRoadMap/Status.md +0 -53
  119. package/CapRoadMap/tests/USE_CASE_GAPS.md +0 -92
  120. package/CapRow/README.md +0 -424
  121. package/CapSKUUploader/README.md +0 -189
  122. package/CapSKUUploader/Status.md +0 -66
  123. package/CapSecondaryTopBar/README.md +0 -7
  124. package/CapSelect/README.md +0 -243
  125. package/CapSelectFilter/README.md +0 -121
  126. package/CapShape/README.md +0 -96
  127. package/CapShape/Status.md +0 -36
  128. package/CapShape/tests/USE_CASES_ANALYSIS.md +0 -120
  129. package/CapSideBar/README.md +0 -298
  130. package/CapSideBar/Status.md +0 -5
  131. package/CapSlideBox/README.md +0 -68
  132. package/CapSlider/README.md +0 -423
  133. package/CapSlider/Status.md +0 -48
  134. package/CapSlider/tests/TEST_COVERAGE.md +0 -118
  135. package/CapSnackBar/README.md +0 -222
  136. package/CapSnackBar/Status.md +0 -41
  137. package/CapSomethingWentWrong/README.md +0 -97
  138. package/CapSplit/README.md +0 -19
  139. package/CapStatisticCard/README.md +0 -138
  140. package/CapStatus/README.md +0 -148
  141. package/CapStatus/Status.md +0 -40
  142. package/CapSteps/Status.md +0 -40
  143. package/CapStepsAccordian/README.md +0 -305
  144. package/CapStepsAccordian/Status.md +0 -48
  145. package/CapSupportVideosWrapper/README.md +0 -14
  146. package/CapSwitch/README.md +0 -351
  147. package/CapTab/README.md +0 -406
  148. package/CapTab/Status.md +0 -104
  149. package/CapTab/tests/USE_CASE_GAPS.md +0 -143
  150. package/CapTabV3/ANALYSIS.md +0 -60
  151. package/CapTabV3/README.md +0 -156
  152. package/CapTabV3/Status.md +0 -52
  153. package/CapTabV3/tests/USE_CASE_GAPS.md +0 -149
  154. package/CapTable/README.md +0 -160
  155. package/CapTable/Status.md +0 -41
  156. package/CapTag/README.md +0 -16
  157. package/CapTagDropdown/README.md +0 -171
  158. package/CapTagDropdown/Status.md +0 -55
  159. package/CapTimePicker/README.md +0 -170
  160. package/CapTooltip/README.md +0 -336
  161. package/CapTooltipWithInfo/Status.md +0 -75
  162. package/CapTopBar/README.md +0 -146
  163. package/CapTree/README.md +0 -124
  164. package/CapTree/Status.md +0 -48
  165. package/CapTree/tests/STATUS.md +0 -154
  166. package/CapTreeSelect/README.md +0 -217
  167. package/CapTreeSelect/Status.md +0 -52
  168. package/CapTruncateList/README.md +0 -13
  169. package/CapUnifiedSelect/README.md +0 -40
  170. package/CapUploader/README.md +0 -313
  171. package/CapUploader/Status.md +0 -76
  172. package/CapUploader/tests/USE_CASES_ANALYSIS.md +0 -225
  173. package/CapUserProfile/README.md +0 -105
  174. package/CapUserProfile/Status.md +0 -95
  175. package/CapVirtualList/README.md +0 -162
  176. package/CapVirtualList/Status.md +0 -71
  177. package/assets/HOCs/ComponentWithLabelHOC/README.md +0 -230
@@ -1,170 +0,0 @@
1
- # CapDrawer - Missing Use Cases Analysis
2
-
3
- ## Phase 1: Use Cases NOT Fulfilled by Component
4
-
5
- **Note**: Unable to access Google Sheets spreadsheet. Analysis based on component code review, Ant Design Drawer API, and common drawer use cases.
6
-
7
- ### 1. **Footer Support**
8
- - ❌ **No footer prop** - Ant Design Drawer supports `footer` prop, but CapDrawer doesn't expose it
9
- - ❌ **No footer slot** - Cannot add footer content (e.g., action buttons) without custom content manipulation
10
- - **Impact**: Users must manually add footer elements to content prop
11
- - **Workaround**: Add footer elements to `content` prop
12
-
13
- ### 2. **Extra Actions/Header Actions**
14
- - ❌ **No extra prop** - Ant Design Drawer supports `extra` prop for header actions, but CapDrawer doesn't expose it
15
- - ❌ **No header actions slot** - Cannot add custom header buttons/icons without modifying title
16
- - **Impact**: Limited header customization options
17
- - **Workaround**: Include extra actions in `title` prop as React node
18
-
19
- ### 3. **Force Render**
20
- - ❌ **No forceRender prop** - Ant Design Drawer supports `forceRender` to render drawer content even when closed
21
- - **Impact**: Cannot pre-render drawer content for performance optimization
22
- - **Workaround**: None - would need to add prop passthrough
23
-
24
- ### 4. **Get Container**
25
- - ❌ **No getContainer prop** - Ant Design Drawer supports `getContainer` to control portal container
26
- - **Impact**: Drawer always renders in document.body portal, cannot be scoped to specific container
27
- - **Workaround**: None - would need to add prop passthrough
28
-
29
- ### 5. **Keyboard Support**
30
- - ⚠️ **Limited keyboard handling** - ESC key support exists but not explicitly tested or documented
31
- - ❌ **No keyboard prop** - Cannot disable keyboard shortcuts
32
- - ❌ **No custom keyboard handlers** - Cannot override default keyboard behavior
33
- - **Impact**: Limited control over keyboard interactions
34
-
35
- ### 6. **Z-Index Control**
36
- - ❌ **No zIndex prop** - Ant Design Drawer supports `zIndex` prop, but CapDrawer doesn't expose it
37
- - **Impact**: Cannot control drawer stacking order when multiple drawers are present
38
- - **Workaround**: Use CSS to override z-index, but not ideal
39
-
40
- ### 7. **Auto Focus**
41
- - ❌ **No autoFocus prop** - Ant Design Drawer supports `autoFocus` to control focus behavior
42
- - **Impact**: Cannot prevent auto-focus on open (may interfere with form inputs)
43
- - **Workaround**: None - would need to add prop passthrough
44
-
45
- ### 8. **Root Class Name**
46
- - ❌ **No rootClassName prop** - Ant Design Drawer v6 supports `rootClassName` for root element styling
47
- - **Impact**: Limited styling options for drawer wrapper
48
- - **Workaround**: Use `className` prop, but may not target root element
49
-
50
- ### 9. **Styles API**
51
- - ❌ **No styles prop** - Ant Design Drawer v6 supports `styles` prop for body/header/footer styling
52
- - **Impact**: Cannot customize individual drawer sections without CSS overrides
53
- - **Workaround**: Use CSS classes, but less flexible than styles API
54
-
55
- ### 10. **Class Names API**
56
- - ❌ **No classNames prop** - Ant Design Drawer v6 supports `classNames` prop for body/header/footer classes
57
- - **Impact**: Limited ability to target specific drawer sections with CSS
58
- - **Workaround**: Use `className` prop, but may not target specific sections
59
-
60
- ### 11. **After Open/Close Callbacks**
61
- - ❌ **No afterOpenChange callback** - Ant Design Drawer supports `afterOpenChange` for post-animation callbacks
62
- - **Impact**: Cannot execute logic after drawer animation completes
63
- - **Workaround**: Use `onOpenChange` with timeout, but not ideal
64
-
65
- ### 12. **Drawer Content Loading States**
66
- - ❌ **No loading prop** - Cannot show loading state within drawer
67
- - ❌ **No loading indicator** - No built-in loading spinner support
68
- - **Impact**: Must manually handle loading states in content
69
- - **Workaround**: Add loading components to `content` prop
70
-
71
- ### 13. **Drawer Content Error States**
72
- - ❌ **No error prop** - Cannot display error messages or error states
73
- - ❌ **No error styling** - No built-in error state support
74
- - **Impact**: Must manually handle error states in content
75
- - **Workaround**: Add error components to `content` prop
76
-
77
- ### 14. **Drawer Size Presets Limitations**
78
- - ⚠️ **Limited size options** - Only supports 's', 'r', 'l' presets (25vw, 50vw, 75vw)
79
- - ❌ **No extra-small or extra-large** - Cannot use 'xs' or 'xl' sizes
80
- - ❌ **No custom preset sizes** - Cannot define custom size presets
81
- - **Impact**: Limited size options, must use `width` prop for other sizes
82
-
83
- ### 15. **Drawer Content Validation**
84
- - ❌ **No content validation** - Doesn't validate content prop type
85
- - ❌ **No empty state handling** - No built-in empty state support
86
- - **Impact**: Must manually handle empty/null content cases
87
-
88
- ### 16. **Drawer Animation Control**
89
- - ❌ **No motion customization** - Cannot customize open/close animations
90
- - ❌ **No animation duration control** - Cannot adjust animation speed
91
- - **Impact**: Limited animation customization options
92
-
93
- ### 17. **Drawer Resize Support**
94
- - ❌ **No resizable prop** - Ant Design Drawer doesn't support resizing, but some use cases may require it
95
- - **Impact**: Cannot allow users to resize drawer width
96
- - **Workaround**: Would need custom implementation
97
-
98
- ### 18. **Multiple Drawers**
99
- - ⚠️ **No multi-drawer coordination** - No built-in support for managing multiple drawers
100
- - ❌ **No drawer stack management** - Cannot control which drawer is on top
101
- - **Impact**: Complex scenarios with multiple drawers require manual management
102
-
103
- ### 19. **Drawer State Persistence**
104
- - ❌ **No state persistence** - Cannot persist drawer open state across page reloads
105
- - ❌ **No localStorage integration** - No built-in state persistence
106
- - **Impact**: Must manually implement state persistence if needed
107
-
108
- ### 20. **Drawer Content Scrolling**
109
- - ⚠️ **Limited scroll control** - Ant Design Drawer handles scrolling, but no custom scroll behavior
110
- - ❌ **No scroll restoration** - Cannot restore scroll position on reopen
111
- - **Impact**: Scroll position resets when drawer closes/reopens
112
-
113
- ### 21. **Drawer Content Lazy Loading**
114
- - ❌ **No lazy loading** - Content always renders when drawer is open
115
- - ❌ **No code splitting support** - Cannot lazy load drawer content
116
- - **Impact**: All drawer content loads immediately, may affect performance
117
-
118
- ### 22. **Drawer Form Integration**
119
- - ❌ **No form integration helpers** - No built-in Form.Item wrapper or validation
120
- - ❌ **No form state management** - Must manually handle form state
121
- - **Impact**: Forms in drawers require manual setup
122
-
123
- ### 23. **Drawer Content Preloading**
124
- - ❌ **No preload prop** - Cannot preload drawer content before opening
125
- - **Impact**: Content loads only when drawer opens, may cause delay
126
-
127
- ### 24. **Drawer Accessibility Enhancements**
128
- - ⚠️ **Basic accessibility** - Relies on Ant Design defaults
129
- - ❌ **No aria-label prop** - Cannot provide custom aria-label
130
- - ❌ **No aria-describedby** - Cannot link to descriptive text
131
- - ❌ **No focus trap customization** - Cannot customize focus trap behavior
132
- - **Impact**: Limited accessibility customization options
133
-
134
- ### 25. **Drawer Content Templates**
135
- - ❌ **No content templates** - No built-in templates for common drawer patterns
136
- - ❌ **No drawer types** - No preset drawer types (form, list, detail, etc.)
137
- - **Impact**: Must build drawer content from scratch each time
138
-
139
- ## Recommendations
140
-
141
- ### High Priority
142
- 1. Add `footer` prop passthrough for action buttons
143
- 2. Add `extra` prop passthrough for header actions
144
- 3. Add `getContainer` prop passthrough for portal control
145
- 4. Add `zIndex` prop passthrough for stacking control
146
- 5. Add `afterOpenChange` callback for post-animation logic
147
-
148
- ### Medium Priority
149
- 1. Add `forceRender` prop for performance optimization
150
- 2. Add `autoFocus` prop for focus control
151
- 3. Add `rootClassName`, `styles`, and `classNames` props (Ant Design v6 API)
152
- 4. Add `keyboard` prop for keyboard control
153
- 5. Improve accessibility props (aria-label, aria-describedby)
154
-
155
- ### Low Priority
156
- 1. Add more size presets (xs, xl)
157
- 2. Add drawer content loading state helpers
158
- 3. Add drawer state persistence helpers
159
- 4. Add drawer content templates
160
- 5. Add resizable drawer support (custom feature)
161
-
162
- ## Current Component Strengths
163
- ✅ Backward compatibility with `visible` and `onVisibleChange` props
164
- ✅ Custom `content` prop mapping to children
165
- ✅ Custom `size` prop for width presets
166
- ✅ Custom `width` prop for explicit width values
167
- ✅ Comprehensive Ant Design Drawer prop passthrough (most props)
168
- ✅ Deprecation warnings for legacy props
169
- ✅ TypeScript support with proper types
170
- ✅ Clean API with sensible defaults
@@ -1,515 +0,0 @@
1
- # CapDropdown Migration Guide
2
-
3
- ## Summary
4
-
5
- CapDropdown has been migrated from `cap-ui-library` to `blaze-ui` with the following changes:
6
-
7
- - Converted from JavaScript to TypeScript
8
- - Converted from styled-components to SCSS modules
9
- - Migrated to Ant Design v6 APIs
10
- - Added backward compatibility for deprecated props
11
- - Added TypeScript interfaces for props
12
- - Maintained backward compatibility with the existing API
13
-
14
- ## Breaking Changes
15
-
16
- **No breaking changes from cap-ui-library v8.x**
17
-
18
- The component maintains backward compatibility with deprecated props. However, deprecated props will show console warnings in development mode and should be migrated to the new API.
19
-
20
- ## Prop Changes
21
-
22
- ### New Props (v6 API)
23
-
24
- | Prop | Type | Default | Description |
25
- |------|------|---------|-------------|
26
- | `open` | `boolean` | `undefined` | Whether the dropdown menu is open (v6 API) |
27
- | `onOpenChange` | `(open: boolean) => void` | `undefined` | Callback when dropdown open state changes (v6 API) |
28
- | `classNames` | `DropdownProps['classNames']` | `undefined` | Custom class names for dropdown parts (v6 API) |
29
-
30
- ### Deprecated Props (Still Supported)
31
-
32
- | Prop | Type | Status | Migration |
33
- |------|------|--------|-----------|
34
- | `visible` | `boolean` | ⚠️ Deprecated | Use `open` instead |
35
- | `onVisibleChange` | `(visible: boolean) => void` | ⚠️ Deprecated | Use `onOpenChange` instead |
36
- | `overlayClassName` | `string` | ⚠️ Deprecated | Use `classNames.root` instead |
37
- | `overlayStyle` | `React.CSSProperties` | ⚠️ Deprecated | Use `styles.root` instead |
38
- | `overlay` | `React.ReactNode` | ⚠️ Deprecated | Use `menu` prop for menu configurations or `dropdownRender` for custom ReactNodes |
39
- | `placement` (topCenter/bottomCenter) | `string` | ⚠️ Deprecated | Use `top`/`bottom` instead |
40
-
41
- ### Placement Values
42
-
43
- **Deprecated placements:**
44
- - `topCenter` → Use `top` instead
45
- - `bottomCenter` → Use `bottom` instead
46
-
47
- **Valid placements:**
48
- - `topLeft`, `top`, `topRight`
49
- - `bottomLeft`, `bottom`, `bottomRight`
50
-
51
- ### Other Props
52
-
53
- | Prop | Type | Default | Description |
54
- |------|------|---------|-------------|
55
- | `className` | `string` | `undefined` | Additional CSS class name |
56
- | `menu` | `DropdownProps['menu']` | `undefined` | Menu configuration object |
57
- | `trigger` | `Array<'click' \| 'hover' \| 'contextMenu'>` | `['hover']` | Trigger actions |
58
- | `placement` | `DeprecatedPlacement \| V6Placement` | `'bottomLeft'` | Dropdown placement |
59
- | `disabled` | `boolean` | `false` | Whether dropdown is disabled |
60
- | `children` | `React.ReactNode` | - | Trigger element |
61
-
62
- ## CapDropdown.Button
63
-
64
- CapDropdown includes a `Button` subcomponent that replaces the deprecated `Dropdown.Button` from Ant Design v3.
65
-
66
- ### CapDropdown.Button Props
67
-
68
- | Prop | Type | Default | Description |
69
- |------|------|---------|-------------|
70
- | `children` | `React.ReactNode` | - | Button content |
71
- | `onClick` | `ButtonProps['onClick']` | `undefined` | Click handler for main button |
72
- | `type` | `ButtonProps['type']` | `'default'` | Button type |
73
- | `size` | `ButtonProps['size']` | `undefined` | Button size |
74
- | `danger` | `boolean` | `false` | Danger button style |
75
- | `loading` | `boolean` | `false` | Loading state |
76
- | `icon` | `React.ReactNode` | `'▼'` | Icon for dropdown trigger button |
77
- | `menu` | `DropdownProps['menu']` | `undefined` | Dropdown menu configuration |
78
- | `disabled` | `boolean` | `false` | Disabled state |
79
- | `buttonsRender` | `(buttons: [React.ReactNode, React.ReactNode]) => [React.ReactNode, React.ReactNode]` | `undefined` | Custom render function for buttons |
80
- | `...dropdownProps` | `CapDropdownProps` | - | All other CapDropdown props |
81
-
82
- ## API Changes
83
-
84
- ### Controlled Open State (v6 API)
85
-
86
- ```tsx
87
- // New v6 API (recommended)
88
- const [open, setOpen] = useState(false);
89
-
90
- <CapDropdown
91
- open={open}
92
- onOpenChange={setOpen}
93
- menu={menu}
94
- >
95
- <Button>Hover me</Button>
96
- </CapDropdown>
97
-
98
- // Old API (deprecated, still works)
99
- const [visible, setVisible] = useState(false);
100
-
101
- <CapDropdown
102
- visible={visible}
103
- onVisibleChange={setVisible}
104
- menu={menu}
105
- >
106
- <Button>Hover me</Button>
107
- </CapDropdown>
108
- ```
109
-
110
- ### Overlay Class Names (v6 API)
111
-
112
- ```tsx
113
- // New v6 API (recommended)
114
- <CapDropdown
115
- classNames={{
116
- root: 'custom-overlay-class'
117
- }}
118
- menu={menu}
119
- >
120
- <Button>Hover me</Button>
121
- </CapDropdown>
122
-
123
- // Old API (deprecated, still works)
124
- <CapDropdown
125
- overlayClassName="custom-overlay-class"
126
- menu={menu}
127
- >
128
- <Button>Hover me</Button>
129
- </CapDropdown>
130
- ```
131
-
132
- ### Placement Values
133
-
134
- ```tsx
135
- // New v6 API (recommended)
136
- <CapDropdown placement="top" menu={menu}>
137
- <Button>Hover me</Button>
138
- </CapDropdown>
139
-
140
- // Old API (deprecated, still works but mapped to new values)
141
- <CapDropdown placement="topCenter" menu={menu}>
142
- <Button>Hover me</Button>
143
- </CapDropdown>
144
- ```
145
-
146
- ## Behavioral Changes
147
-
148
- ### Development Warnings
149
-
150
- When using deprecated props in development mode, console warnings will be displayed:
151
-
152
- ```
153
- [CapDropdown] "visible" prop is deprecated. Use "open" instead.
154
- [CapDropdown] "onVisibleChange" prop is deprecated. Use "onOpenChange" instead.
155
- ```
156
-
157
- ### CapDropdown.Button Implementation
158
-
159
- The `CapDropdown.Button` component uses the `Space.Compact` pattern recommended by Ant Design v6, replacing the deprecated `Dropdown.Button` component.
160
-
161
- ## Migration Steps
162
-
163
- ### 1. Update Import
164
-
165
- ```tsx
166
- // Before (cap-ui-library)
167
- import CapDropdown from '@capillarytech/cap-ui-library/CapDropdown';
168
-
169
- // After (blaze-ui)
170
- import { CapDropdown } from '@capillarytech/blaze-ui';
171
- // or
172
- import CapDropdown from '@capillarytech/blaze-ui/CapDropdown';
173
- ```
174
-
175
- ### 2. Update Controlled State Props
176
-
177
- ```tsx
178
- // Before (deprecated)
179
- const [visible, setVisible] = useState(false);
180
-
181
- <CapDropdown
182
- visible={visible}
183
- onVisibleChange={setVisible}
184
- menu={menu}
185
- >
186
- <Button>Hover me</Button>
187
- </CapDropdown>
188
-
189
- // After (v6 API)
190
- const [open, setOpen] = useState(false);
191
-
192
- <CapDropdown
193
- open={open}
194
- onOpenChange={setOpen}
195
- menu={menu}
196
- >
197
- <Button>Hover me</Button>
198
- </CapDropdown>
199
- ```
200
-
201
- ### 3. Update Overlay Class Names
202
-
203
- ```tsx
204
- // Before (deprecated)
205
- <CapDropdown overlayClassName="custom-class" menu={menu}>
206
- <Button>Hover me</Button>
207
- </CapDropdown>
208
-
209
- // After (v6 API)
210
- <CapDropdown classNames={{ root: 'custom-class' }} menu={menu}>
211
- <Button>Hover me</Button>
212
- </CapDropdown>
213
- ```
214
-
215
- ### 4. Update Placement Values
216
-
217
- ```tsx
218
- // Before (deprecated)
219
- <CapDropdown placement="topCenter" menu={menu}>
220
- <Button>Hover me</Button>
221
- </CapDropdown>
222
-
223
- // After (v6 API)
224
- <CapDropdown placement="top" menu={menu}>
225
- <Button>Hover me</Button>
226
- </CapDropdown>
227
- ```
228
-
229
- ### 5. Migrate from `overlay` Prop to `menu` Prop
230
-
231
- The `overlay` prop is deprecated but still supported for backward compatibility. It will show deprecation warnings in development mode.
232
-
233
- ```tsx
234
- // Before (deprecated - using overlay with CapMenu)
235
- import { CapDropdown, CapMenu, CapIcon } from '@capillarytech/blaze-ui';
236
-
237
- <CapDropdown
238
- overlay={
239
- <CapMenu>
240
- <CapMenu.Item onClick={handleEdit}>Edit</CapMenu.Item>
241
- <CapMenu.Item onClick={handleRemove}>Remove</CapMenu.Item>
242
- </CapMenu>
243
- }
244
- placement="bottomRight"
245
- >
246
- <CapIcon type="more" />
247
- </CapDropdown>
248
-
249
- // After (v6 API - recommended)
250
- import { CapDropdown, CapIcon } from '@capillarytech/blaze-ui';
251
- import type { MenuProps } from 'antd-v5';
252
-
253
- const menu: MenuProps = {
254
- items: [
255
- {
256
- key: 'edit',
257
- label: 'Edit',
258
- onClick: handleEdit,
259
- },
260
- {
261
- key: 'remove',
262
- label: 'Remove',
263
- onClick: handleRemove,
264
- },
265
- ],
266
- };
267
-
268
- <CapDropdown menu={menu} placement="bottomRight">
269
- <CapIcon type="more" />
270
- </CapDropdown>
271
- ```
272
-
273
- **Note**: The `overlay` prop is still functional and will continue to work, but it uses the deprecated `dropdownRender` API internally. For custom ReactNodes that don't fit the menu structure, consider using `dropdownRender` directly or migrating to `Popover` component for more flexibility.
274
-
275
- ### 5. TypeScript Support (New Benefit)
276
-
277
- If using TypeScript, you now get full type checking:
278
-
279
- ```tsx
280
- import { CapDropdown, CapDropdownProps, CapDropdownButtonProps } from '@capillarytech/blaze-ui';
281
-
282
- // Type-safe props
283
- const props: CapDropdownProps = {
284
- open: true,
285
- onOpenChange: (open) => console.log(open),
286
- menu: { items: [{ key: '1', label: 'Item 1' }] }
287
- };
288
-
289
- // Type-safe button props
290
- const buttonProps: CapDropdownButtonProps = {
291
- children: 'Actions',
292
- onClick: () => console.log('clicked'),
293
- menu: { items: [{ key: '1', label: 'Item 1' }] }
294
- };
295
- ```
296
-
297
- ## Examples
298
-
299
- ### Basic Usage
300
-
301
- ```tsx
302
- import { CapDropdown } from '@capillarytech/blaze-ui';
303
- import { Button } from 'antd-v5';
304
-
305
- const menu = {
306
- items: [
307
- { key: '1', label: 'Item 1' },
308
- { key: '2', label: 'Item 2' },
309
- { key: '3', label: 'Item 3' },
310
- ],
311
- };
312
-
313
- function App() {
314
- return (
315
- <CapDropdown menu={menu}>
316
- <Button>Hover me</Button>
317
- </CapDropdown>
318
- );
319
- }
320
- ```
321
-
322
- ### Controlled Open State
323
-
324
- ```tsx
325
- import { CapDropdown } from '@capillarytech/blaze-ui';
326
- import { Button } from 'antd-v5';
327
- import { useState } from 'react';
328
-
329
- function App() {
330
- const [open, setOpen] = useState(false);
331
- const menu = {
332
- items: [
333
- { key: '1', label: 'Item 1' },
334
- { key: '2', label: 'Item 2' },
335
- ],
336
- };
337
-
338
- return (
339
- <CapDropdown
340
- open={open}
341
- onOpenChange={setOpen}
342
- menu={menu}
343
- trigger={['click']}
344
- >
345
- <Button>Click me</Button>
346
- </CapDropdown>
347
- );
348
- }
349
- ```
350
-
351
- ### CapDropdown.Button Usage
352
-
353
- ```tsx
354
- import { CapDropdown } from '@capillarytech/blaze-ui';
355
-
356
- function App() {
357
- const menu = {
358
- items: [
359
- { key: '1', label: 'Action 1' },
360
- { key: '2', label: 'Action 2' },
361
- ],
362
- };
363
-
364
- return (
365
- <CapDropdown.Button
366
- onClick={() => console.log('Main button clicked')}
367
- menu={menu}
368
- >
369
- Actions
370
- </CapDropdown.Button>
371
- );
372
- }
373
- ```
374
-
375
- ### With Custom Overlay Styling
376
-
377
- ```tsx
378
- import { CapDropdown } from '@capillarytech/blaze-ui';
379
- import { Button } from 'antd-v5';
380
-
381
- function App() {
382
- const menu = {
383
- items: [
384
- { key: '1', label: 'Item 1' },
385
- { key: '2', label: 'Item 2' },
386
- ],
387
- };
388
-
389
- return (
390
- <CapDropdown
391
- menu={menu}
392
- classNames={{
393
- root: 'custom-dropdown-overlay'
394
- }}
395
- >
396
- <Button>Hover me</Button>
397
- </CapDropdown>
398
- );
399
- }
400
- ```
401
-
402
- ### With Menu Item Handlers
403
-
404
- ```tsx
405
- import { CapDropdown } from '@capillarytech/blaze-ui';
406
- import { Button } from 'antd-v5';
407
- import type { MenuProps } from 'antd-v5';
408
-
409
- function App() {
410
- const menu: MenuProps = {
411
- items: [
412
- {
413
- key: '1',
414
- label: 'Item 1',
415
- onClick: () => console.log('Item 1 clicked'),
416
- },
417
- {
418
- key: '2',
419
- label: 'Item 2',
420
- onClick: () => console.log('Item 2 clicked'),
421
- },
422
- ],
423
- };
424
-
425
- return (
426
- <CapDropdown menu={menu}>
427
- <Button>Hover me</Button>
428
- </CapDropdown>
429
- );
430
- }
431
- ```
432
-
433
- ### Legacy Overlay Prop (Deprecated)
434
-
435
- The `overlay` prop is supported for backward compatibility but is deprecated. It will show console warnings in development mode.
436
-
437
- ```tsx
438
- import { CapDropdown, CapMenu, CapIcon } from '@capillarytech/blaze-ui';
439
-
440
- function App() {
441
- const handleEdit = () => {
442
- console.log('Edit clicked');
443
- };
444
-
445
- const handleRemove = () => {
446
- console.log('Remove clicked');
447
- };
448
-
449
- return (
450
- <CapDropdown
451
- overlay={
452
- <CapMenu>
453
- <CapMenu.Item onClick={handleEdit}>Edit</CapMenu.Item>
454
- <CapMenu.Item onClick={handleRemove}>Remove</CapMenu.Item>
455
- </CapMenu>
456
- }
457
- placement="bottomRight"
458
- trigger={['click']}
459
- >
460
- <CapIcon type="more" />
461
- </CapDropdown>
462
- );
463
- }
464
- ```
465
-
466
- **Migration**: Convert `overlay` with `CapMenu` to the `menu` prop format shown in the "With Menu Item Handlers" example above.
467
-
468
- ## TypeScript Types
469
-
470
- ```typescript
471
- import type {
472
- CapDropdownProps,
473
- CapDropdownButtonProps,
474
- DeprecatedPlacement,
475
- V6Placement,
476
- } from '@capillarytech/blaze-ui/CapDropdown';
477
-
478
- // Main component props
479
- interface CapDropdownProps extends Omit<DropdownProps, 'menu' | 'visible' | 'onVisibleChange' | 'overlayClassName' | 'placement' | 'overlay' | 'overlayStyle'> {
480
- className?: string;
481
- classNames?: DropdownProps['classNames'];
482
- styles?: DropdownProps['styles'];
483
- overlayClassName?: string; // @deprecated
484
- overlayStyle?: React.CSSProperties; // @deprecated
485
- menu?: DropdownProps['menu'];
486
- overlay?: React.ReactNode; // @deprecated - Use menu prop for menu configurations or dropdownRender for custom ReactNodes
487
- trigger?: Array<'click' | 'hover' | 'contextMenu'>;
488
- placement?: DeprecatedPlacement | V6Placement;
489
- open?: boolean;
490
- onOpenChange?: (open: boolean) => void;
491
- visible?: boolean; // @deprecated
492
- onVisibleChange?: (visible: boolean) => void; // @deprecated
493
- disabled?: boolean;
494
- }
495
-
496
- // Button subcomponent props
497
- interface CapDropdownButtonProps extends Omit<CapDropdownProps, 'children'> {
498
- children?: React.ReactNode;
499
- onClick?: ButtonProps['onClick'];
500
- type?: ButtonProps['type'];
501
- size?: ButtonProps['size'];
502
- danger?: boolean;
503
- loading?: boolean;
504
- icon?: React.ReactNode;
505
- buttonsRender?: (buttons: [React.ReactNode, React.ReactNode]) => [React.ReactNode, React.ReactNode];
506
- }
507
- ```
508
-
509
- ## Notes
510
-
511
- - The component uses SCSS modules for styling to avoid style conflicts
512
- - All deprecated props are backward compatible but will show console warnings in development
513
- - The component uses Ant Design v6 APIs internally
514
- - `CapDropdown.Button` replaces the deprecated `Dropdown.Button` pattern
515
- - Placement values `topCenter` and `bottomCenter` are automatically mapped to `top` and `bottom`