@capillarytech/blaze-ui 5.1.19 → 5.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/blaze-ui",
3
- "version": "5.1.19",
3
+ "version": "5.2.0",
4
4
  "description": "Capillary UI component library with Ant Design v6",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/utils/dayjs.d.ts CHANGED
@@ -34,7 +34,6 @@ export declare const FORMAT_TOKENS: {
34
34
  readonly MONTH_FULL: "MMMM";
35
35
  readonly YEAR: "YYYY";
36
36
  readonly YEAR_SHORT: "YY";
37
- readonly DATE_TIME: "DD-MM-YYYY | HH:mm";
38
37
  readonly DATE_LOCALIZED_SHORT: "l";
39
38
  readonly DATETIME_LOCALIZED_SHORT: "ll";
40
39
  readonly DATETIME_LOCALIZED_SHORT_TIME: "lll";
@@ -46,7 +45,6 @@ export declare const FORMAT_TOKENS: {
46
45
  };
47
46
  export type TimeUnit = (typeof TIME_UNITS)[keyof typeof TIME_UNITS];
48
47
  export type FormatToken = (typeof FORMAT_TOKENS)[keyof typeof FORMAT_TOKENS];
49
- export declare const DEFAULT_TIMEZONE = "Asia/Kolkata";
50
48
  export declare function normalizeDateValue(isConsumerUsingMoment: boolean, parsedValue: dayjs.Dayjs | Moment | null | undefined): dayjs.Dayjs | Moment | null | undefined;
51
49
  export declare function isDayjsObject(value: unknown): value is dayjs.Dayjs;
52
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dayjs.d.ts","sourceRoot":"","sources":["../../components/utils/dayjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAqB1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA2HhC,eAAO,MAAM,UAAU;;;;;;;;;;;;CAYb,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;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X,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoChB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AACpE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAQ7E,wBAAgB,kBAAkB,CAChC,qBAAqB,EAAE,OAAO,EAC9B,WAAW,EAAE,KAAK,CAAC,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,2CAKrD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC,KAAK,CAElE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAC7D,KAAK,CAAC,KAAK,GAAG,IAAI,CAiFpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAqD3F;AAED,eAAe,KAAK,CAAC"}
package/.DS_Store DELETED
Binary file
@@ -1,136 +0,0 @@
1
- # CapDateTimePicker
2
-
3
- A wrapper around Ant Design's DatePicker with `showTime` support, timezone-aware date parsing, and a consistent API for datetime selection in Capillary applications.
4
-
5
- ## Migration from Ant Design v3 to v6
6
-
7
- ### Breaking Changes
8
-
9
- #### 1. API Changes
10
-
11
- | v3 API | v6 API | Status | Migration Guide |
12
- |--------|--------|--------|-----------------|
13
- | `dateRender` | `cellRender` | Deprecated | Replace `dateRender` with `cellRender`. Backward compatibility maintained. |
14
- | `dropdownClassName` | `popupClassName` | Deprecated | Replace `dropdownClassName` with `popupClassName`. Backward compatibility maintained. |
15
- | `dropdownStyle` | `popupStyle` | Deprecated | Replace `dropdownStyle` with `popupStyle`. Backward compatibility maintained. |
16
- | `getCalendarContainer` | `getPopupContainer` | Deprecated | Replace `getCalendarContainer` with `getPopupContainer`. Backward compatibility maintained. |
17
- | `open` | `popupOpen` | Deprecated | Replace `open` with `popupOpen`. Backward compatibility maintained. |
18
- | `onOpenChange` | `onPopupOpenChange` | Deprecated | Replace `onOpenChange` with `onPopupOpenChange`. Backward compatibility maintained. |
19
- | `showToday` | N/A | Deprecated | This prop is deprecated. Today button behavior is now handled internally by Ant Design. Backward compatibility maintained but discouraged. |
20
- | `renderExtraFooter` | Custom Panel | Deprecated | This prop is discouraged. Consider using custom panel components instead. Backward compatibility maintained but discouraged. |
21
-
22
- #### 2. Date Library Migration
23
-
24
- The component continues to support both Moment.js and Day.js objects for backward compatibility:
25
-
26
- - **Props accepting dates**: `value` now accepts `Dayjs | Moment | string | null`
27
- - **Callbacks returning dates**: `onChange` returns the same type as the input (`Dayjs` if `Dayjs` was passed, `Moment` if `Moment` was passed)
28
-
29
- **Migration Path for Consumers:**
30
- ```javascript
31
- // Before (moment) - still works
32
- import moment from 'moment-timezone';
33
- <CapDateTimePicker
34
- value={moment('2024-01-15 10:30')}
35
- onChange={(momentObj) => console.log(momentObj.format())}
36
- />
37
-
38
- // After (dayjs) - preferred
39
- import dayjs from '@dayjs';
40
- <CapDateTimePicker
41
- value={dayjs('2024-01-15 10:30')}
42
- onChange={(dayjsObj) => console.log(dayjsObj.format())}
43
- />
44
- ```
45
-
46
- ### Backward Compatibility
47
-
48
- All deprecated props still work but log a warning in development:
49
-
50
- - **`dateRender`**: Still works but mapped to `cellRender` internally. Use `cellRender` instead.
51
- - **`dropdownClassName`**: Still works. Use `popupClassName` instead.
52
- - **`dropdownStyle`**: Still works. Use `popupStyle` instead.
53
- - **`getCalendarContainer`**: Still works. Use `getPopupContainer` instead.
54
- - **`open`**: Still works. Use `popupOpen` instead.
55
- - **`onOpenChange`**: Still works. Use `onPopupOpenChange` instead.
56
- - **`showToday`**: Still works but is deprecated.
57
- - **`renderExtraFooter`**: Still works but is discouraged.
58
-
59
- ### Style Changes
60
-
61
- The SCSS file (`styles.scss`) targets v3 class names (`.ant-calendar-*`) and is preserved as-is in this migration pass. Full SCSS migration to v6 class names (`.ant-picker-*`) will be done in a subsequent pass.
62
-
63
- **Theme config**: `DatePicker.cellHoverBg` added to `getCapThemeConfig.ts` to control date cell hover background color.
64
-
65
- ### Code Improvements
66
-
67
- 1. **Removed PropTypes**: Replaced with TypeScript interfaces in `types.ts`
68
- 2. **Removed defaultProps**: Default values moved to function argument destructuring
69
- 3. **Using deprecation warning utility**: `logDeprecationWarning` for consistent warnings
70
- 4. **Type safety**: Full TypeScript support with proper Dayjs/Moment union types
71
- 5. **Backward compatibility**: All deprecated props mapped using nullish coalescing (`??`)
72
-
73
- ### What Stayed the Same
74
-
75
- - `injectIntl` HOC pattern for i18n (no consumer-facing change)
76
- - Timezone-aware date parsing logic
77
- - Internal open/close state management for OK button behavior
78
- - `showTime` config with timezone-aware `defaultValue`
79
- - Calendar icon suffix
80
- - `okText` from i18n messages
81
-
82
- ### What Changed
83
-
84
- - **Updated**: Import from `antd-v5` (v6 compatible)
85
- - **Removed**: `import 'antd/lib/date-picker/style/css'`
86
- - **Removed**: PropTypes dependency
87
- - **Removed**: `defaultProps` assignment
88
- - **Updated**: Multiple deprecated props migrated to v6 API (with backward compatibility)
89
- - **Added**: `cellRender` support (v6 replacement for `dateRender`)
90
- - **Added**: `popupClassName`, `popupStyle`, `getPopupContainer`, `popupOpen`, `onPopupOpenChange`
91
-
92
- ## Usage
93
-
94
- ```tsx
95
- import CapDateTimePicker from '@capillarytech/blaze-ui/components/CapDateTimePicker';
96
- import dayjs from '@dayjs';
97
-
98
- function MyComponent() {
99
- const [date, setDate] = useState(null);
100
-
101
- return (
102
- <CapDateTimePicker
103
- value={date}
104
- onChange={(newDate) => setDate(newDate)}
105
- timezone="Asia/Kolkata"
106
- showTime={{ format: 'HH:mm' }}
107
- format="DD-MM-YYYY | HH:mm"
108
- popupClassName="my-custom-popup"
109
- />
110
- );
111
- }
112
- ```
113
-
114
- ## Props
115
-
116
- See `types.ts` for complete prop definitions. Key props:
117
-
118
- - `value`: `Dayjs | Moment | string | null`
119
- - `onChange`: `(value: Dayjs | Moment | null, dateString: string) => void`
120
- - `timezone`: Timezone string (default: `'Asia/Kolkata'`)
121
- - `showTime`: `boolean | { format?: string }` (default: `{ format: 'HH:mm' }`)
122
- - `format`: Date format string (default: `'DD-MM-YYYY | HH:mm'`)
123
- - `cellRender`: Custom cell renderer (v6 API)
124
- - `popupClassName`: Custom class for popup (v6 API)
125
- - `popupStyle`: Custom style for popup (v6 API)
126
- - `getPopupContainer`: Container for popup (v6 API)
127
- - `popupOpen`: Whether popup is open (v6 API)
128
- - `onPopupOpenChange`: Callback when popup open state changes (v6 API)
129
- - `dateRender`: Deprecated — use `cellRender` instead
130
- - `dropdownClassName`: Deprecated — use `popupClassName` instead
131
- - `dropdownStyle`: Deprecated — use `popupStyle` instead
132
- - `getCalendarContainer`: Deprecated — use `getPopupContainer` instead
133
- - `open`: Deprecated — use `popupOpen` instead
134
- - `onOpenChange`: Deprecated — use `onPopupOpenChange` instead
135
- - `showToday`: Deprecated — handled internally by Ant Design
136
- - `renderExtraFooter`: Deprecated — consider custom panel components
@@ -1,13 +0,0 @@
1
- /**
2
- *
3
- * CapDateTimePicker
4
- *
5
- */
6
- import React from 'react';
7
- import type { InternalProps } from './types';
8
- declare const _default: React.FC<import("react-intl").WithIntlProps<InternalProps>> & {
9
- WrappedComponent: React.ComponentType<InternalProps>;
10
- };
11
- export default _default;
12
- export type { CapDateTimePickerProps } from './types';
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAoC,MAAM,OAAO,CAAC;AAiBzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;AA8K7C,wBAA6C;AAC7C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
@@ -1,17 +0,0 @@
1
- export declare const scope = "app.commonUtils.capUiLibrary.capDateTimePicker";
2
- declare const _default: {
3
- selectDateTimePlaceHolder: {
4
- id: string;
5
- defaultMessage: string;
6
- };
7
- selectLabel: {
8
- id: string;
9
- defaultMessage: string;
10
- };
11
- todayLabel: {
12
- id: string;
13
- defaultMessage: string;
14
- };
15
- };
16
- export default _default;
17
- //# sourceMappingURL=messages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,mDAAmD,CAAC;;;;;;;;;;;;;;;AAEtE,wBAaG"}
@@ -1,89 +0,0 @@
1
- import type { DatePickerProps } from 'antd-v5';
2
- import type { Dayjs } from 'dayjs';
3
- import type { Moment } from 'moment';
4
- import React from 'react';
5
- import type { WrappedComponentProps } from 'react-intl';
6
- export interface CapDateTimePickerProps extends Omit<DatePickerProps<Dayjs>, 'value' | 'onChange' | 'cellRender' | 'popupClassName' | 'popupStyle' | 'getPopupContainer' | 'popupOpen' | 'onPopupOpenChange'> {
7
- /**
8
- * Selected datetime value (Dayjs, Moment, or ISO string)
9
- */
10
- value?: Dayjs | Moment | string | null;
11
- /**
12
- * Callback when datetime changes
13
- * @param value - Dayjs or Moment object (matches input type) or null
14
- * @param dateString - Formatted date string
15
- */
16
- onChange?: (value: Dayjs | Moment | null, dateString: string) => void;
17
- /**
18
- * Custom cell renderer for calendar cells (v6 API)
19
- */
20
- cellRender?: DatePickerProps<Dayjs>['cellRender'];
21
- /**
22
- * Timezone string (e.g., 'Asia/Kolkata')
23
- * @default 'Asia/Kolkata'
24
- */
25
- timezone?: string;
26
- /**
27
- * Custom class name for the popup/dropdown (v6 API)
28
- */
29
- popupClassName?: string;
30
- /**
31
- * Custom style for the popup/dropdown (v6 API)
32
- */
33
- popupStyle?: React.CSSProperties;
34
- /**
35
- * Container for the popup (v6 API)
36
- */
37
- getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
38
- /**
39
- * Whether the popup is open (v6 API)
40
- */
41
- popupOpen?: boolean;
42
- /**
43
- * Callback when popup open state changes (v6 API)
44
- */
45
- onPopupOpenChange?: (open: boolean) => void;
46
- /**
47
- * Custom cell renderer for calendar cells
48
- * @deprecated Use `cellRender` instead. Will be removed in next major version.
49
- */
50
- dateRender?: (currentDate: Dayjs, today: Dayjs) => React.ReactNode;
51
- /**
52
- * Custom class name for the popup/dropdown
53
- * @deprecated Use `popupClassName` instead. Will be removed in next major version.
54
- */
55
- dropdownClassName?: string;
56
- /**
57
- * Custom style for the popup/dropdown
58
- * @deprecated Use `popupStyle` instead. Will be removed in next major version.
59
- */
60
- dropdownStyle?: React.CSSProperties;
61
- /**
62
- * Container for the calendar dropdown
63
- * @deprecated Use `getPopupContainer` instead. Will be removed in next major version.
64
- */
65
- getCalendarContainer?: (triggerNode: HTMLElement) => HTMLElement;
66
- /**
67
- * Whether the dropdown is open
68
- * @deprecated Use `popupOpen` instead. Will be removed in next major version.
69
- */
70
- open?: boolean;
71
- /**
72
- * Callback when dropdown open state changes
73
- * @deprecated Use `onPopupOpenChange` instead. Will be removed in next major version.
74
- */
75
- onOpenChange?: (open: boolean) => void;
76
- /**
77
- * Whether to show today button
78
- * @deprecated This prop is deprecated. Today button behavior is now handled internally by Ant Design.
79
- */
80
- showToday?: boolean;
81
- /**
82
- * Render extra footer in calendar panel
83
- * @deprecated This prop is discouraged. Consider using custom panel components instead.
84
- */
85
- renderExtraFooter?: () => React.ReactNode;
86
- }
87
- /** Internal-only: adds react-intl's injected `intl` prop to the public props */
88
- export type InternalProps = CapDateTimePickerProps & WrappedComponentProps;
89
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,sBACf,SAAQ,IAAI,CACV,eAAe,CAAC,KAAK,CAAC,EACpB,OAAO,GACP,UAAU,GACV,YAAY,GACZ,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,WAAW,GACX,mBAAmB,CACtB;IACD;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtE;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC;IAElD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAEjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,WAAW,CAAC;IAE9D;;O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