@capillarytech/blaze-ui 2.4.0 → 2.4.1-beta.1

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.
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { CapSelectFilterMenuItem, CapSelectFilterProps } from './CapSelectFilter.interfaces';
3
+ export declare const renderMenuItem: (items: CapSelectFilterMenuItem[], selectedValue?: string) => {
4
+ key: string;
5
+ label: import("react/jsx-runtime").JSX.Element;
6
+ className: string;
7
+ 'data-value': string;
8
+ }[];
9
+ export declare const renderDropdownMenu: (menu: React.ReactNode, dropdownMaxHeight?: string, dropdownWidth?: string) => import("react/jsx-runtime").JSX.Element;
10
+ declare const CapSelectFilter: React.FC<CapSelectFilterProps>;
11
+ export default CapSelectFilter;
12
+ //# sourceMappingURL=CapSelectFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CapSelectFilter.d.ts","sourceRoot":"","sources":["../../components/CapSelectFilter/CapSelectFilter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAOlG,eAAO,MAAM,cAAc,GAAI,OAAO,uBAAuB,EAAE,EAAE,gBAAgB,MAAM;;;;;GAStF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,KAAK,CAAC,SAAS,EACrB,oBAAoB,MAAM,EAC1B,gBAAgB,MAAM,4CAcvB,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0DnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { DropdownProps } from 'antd-v5';
2
+ import React from 'react';
3
+ export interface CapSelectFilterMenuItem {
4
+ key: string;
5
+ value: string;
6
+ label: string | React.ReactNode;
7
+ }
8
+ export interface CapSelectFilterProps extends Omit<DropdownProps, 'menu' | 'overlay' | 'overlayStyle' | 'onOpenChange'> {
9
+ className?: string;
10
+ overlayClassName?: string;
11
+ onSelect?: (event: React.MouseEvent<HTMLElement>) => void;
12
+ onOpenChange?: (open: boolean) => void;
13
+ selectedValue?: string;
14
+ placeholder?: string | React.ReactNode;
15
+ placement?: 'bottomLeft' | 'bottom' | 'bottomRight' | 'topLeft' | 'top' | 'topRight';
16
+ width?: string;
17
+ dropdownMaxHeight?: string;
18
+ dropdownWidth?: string;
19
+ data?: CapSelectFilterMenuItem[];
20
+ showBadge?: boolean;
21
+ }
22
+ //# sourceMappingURL=CapSelectFilter.interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CapSelectFilter.interfaces.d.ts","sourceRoot":"","sources":["../../components/CapSelectFilter/CapSelectFilter.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;CACjC;AAED,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,cAAc,CAAC;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC1D,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,YAAY,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,121 @@
1
+ # CapSelectFilter
2
+
3
+ A dropdown select filter component with badge support.
4
+
5
+ ## Migration from cap-ui-library to blaze-ui
6
+
7
+ ### Summary of Changes
8
+
9
+ This component has been migrated from `cap-ui-library` to `blaze-ui` with the following updates:
10
+
11
+ 1. **Converted to TypeScript** - Full type safety with proper interfaces
12
+ 2. **Functional Component** - Migrated from functional component (no changes needed)
13
+ 3. **SCSS Modules** - Replaced styled-components with SCSS modules
14
+ 4. **Ant Design v6** - Updated to use Ant Design v6 compatible APIs:
15
+ - Changed from `overlay` prop to `menu={{ items }}` API
16
+ - Used `dropdownRender` to wrap menu with custom styling
17
+ - Removed direct usage of `CapMenu` components in favor of menu items array
18
+ 5. **CSS Units** - Converted all pixel values to rem units (base: 14px = 1rem)
19
+ 6. **SCSS Variables** - Replaced hardcoded colors/spacing with SCSS variables
20
+ 7. **React Hooks** - Added `useMemo` to optimize menu items generation
21
+
22
+ ### Breaking Changes
23
+
24
+ **No breaking changes from cap-ui-library v8.x**
25
+
26
+ All props remain the same and work identically to the cap-ui-library version.
27
+
28
+ ### Props
29
+
30
+ | Prop | Type | Default | Description |
31
+ |------|------|---------|-------------|
32
+ | `className` | `string` | - | Additional CSS class for the dropdown wrapper |
33
+ | `overlayClassName` | `string` | - | Additional CSS class for the dropdown overlay |
34
+ | `onSelect` | `(event: React.MouseEvent<HTMLElement>) => void` | - | Callback when a menu item is selected |
35
+ | `selectedValue` | `string` | - | Currently selected value |
36
+ | `placeholder` | `React.ReactNode` | - | Placeholder text or node |
37
+ | `placement` | `'bottomLeft' \| 'bottom' \| 'bottomRight' \| 'topLeft' \| 'top' \| 'topRight'` | `'bottomLeft'` | Dropdown placement |
38
+ | `width` | `string` | `'80px'` | Width of the trigger element |
39
+ | `dropdownMaxHeight` | `string` | `'320px'` | Maximum height of dropdown menu |
40
+ | `dropdownWidth` | `string` | `'228px'` | Width of dropdown menu |
41
+ | `data` | `CapSelectFilterMenuItem[]` | `[]` | Array of menu items |
42
+ | `showBadge` | `boolean` | `false` | Whether to show a badge with count |
43
+
44
+ ### Data Item Structure
45
+
46
+ ```typescript
47
+ interface CapSelectFilterMenuItem {
48
+ key: string; // Unique key for React
49
+ value: string; // Value to match against selectedValue
50
+ label: React.ReactNode; // Display label
51
+ }
52
+ ```
53
+
54
+ ### API Changes
55
+
56
+ None - all APIs remain backward compatible.
57
+
58
+ ### Behavioral Changes
59
+
60
+ None - component behaves identically to cap-ui-library version.
61
+
62
+ ### Migration Guide for Consumers
63
+
64
+ No migration needed! Simply update your import path:
65
+
66
+ **Before (cap-ui-library):**
67
+ ```javascript
68
+ import CapSelectFilter from '@capillarytech/cap-ui-library/components/CapSelectFilter';
69
+ ```
70
+
71
+ **After (blaze-ui):**
72
+ ```javascript
73
+ import CapSelectFilter from '@capillarytech/blaze-ui/components/CapSelectFilter';
74
+ // Or from the main export
75
+ import { CapSelectFilter } from '@capillarytech/blaze-ui';
76
+ ```
77
+
78
+ ### Usage Example
79
+
80
+ ```tsx
81
+ import React, { useState } from 'react';
82
+ import CapSelectFilter from '@capillarytech/blaze-ui/components/CapSelectFilter';
83
+
84
+ const MyComponent = () => {
85
+ const [selectedValue, setSelectedValue] = useState('option1');
86
+
87
+ const data = [
88
+ { key: '1', value: 'option1', label: 'Option 1' },
89
+ { key: '2', value: 'option2', label: 'Option 2' },
90
+ { key: '3', value: 'option3', label: 'Option 3' },
91
+ ];
92
+
93
+ const handleSelect = (e: React.MouseEvent<HTMLElement>) => {
94
+ const target = e.currentTarget;
95
+ const value = target.getAttribute('value');
96
+ if (value) {
97
+ setSelectedValue(value);
98
+ }
99
+ };
100
+
101
+ return (
102
+ <CapSelectFilter
103
+ placeholder="Select an option"
104
+ data={data}
105
+ selectedValue={selectedValue}
106
+ onSelect={handleSelect}
107
+ showBadge
108
+ />
109
+ );
110
+ };
111
+ ```
112
+
113
+ ### Internal Implementation Notes
114
+
115
+ - Uses `CapDropdown` with Ant Design v6 `menu` API (not the old `overlay` API)
116
+ - Menu items are generated as an array of objects with `key`, `label`, `className`, and `onClick`
117
+ - Uses `dropdownRender` to wrap the menu with custom styling (border and scrolling)
118
+ - Styled with SCSS modules instead of styled-components
119
+ - All spacing and colors use SCSS variables from `components/styled/variables.scss`
120
+ - Badge count is calculated as `[selectedValue].length` (always shows 1 for single selection)
121
+ - Uses `useMemo` to optimize menu items generation and prevent unnecessary re-renders
@@ -0,0 +1,3 @@
1
+ export { default } from './CapSelectFilter';
2
+ export type { CapSelectFilterProps, CapSelectFilterMenuItem } from './CapSelectFilter.interfaces';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapSelectFilter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}