@capillarytech/blaze-ui 6.1.2 → 6.1.3
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/CapMobileDatePicker/index.d.ts +5 -15
- package/CapMobileDatePicker/index.d.ts.map +1 -1
- package/CapMobileDatePicker/index.js +40 -22
- package/CapMobileDatePicker/messages.d.ts +9 -0
- package/CapMobileDatePicker/messages.d.ts.map +1 -0
- package/CapMobileDatePicker/messages.js +12 -0
- package/CapMobileDatePicker/styles.css +28 -11
- package/CapMobileDatePicker/styles.module.scss.js +10 -0
- package/CapMobileDatePicker/styles.scss +37 -16
- package/CapMobileDatePicker/tests/CapMobileDatePicker.mockData.d.ts +41 -0
- package/CapMobileDatePicker/tests/CapMobileDatePicker.mockData.d.ts.map +1 -0
- package/CapMobileDatePicker/types.d.ts +23 -0
- package/CapMobileDatePicker/types.d.ts.map +1 -0
- package/CapProductSelection/index.d.ts +29 -7
- package/CapProductSelection/index.d.ts.map +1 -1
- package/CapProductSelection/index.js +89 -52
- package/CapProductSelection/style.d.ts +3 -0
- package/CapProductSelection/style.d.ts.map +1 -0
- package/CapProductSelection/style.js +38 -0
- package/CapProductSelection/styles.scss +40 -82
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +12 -12
- package/package.json +1 -1
- package/utils/dayjs.d.ts +1 -0
- package/utils/dayjs.d.ts.map +1 -1
- package/utils/dayjs.js +1 -0
- package/.npmrc +0 -3
- package/CapProductSelection/messages.d.ts +0 -76
- package/CapProductSelection/messages.d.ts.map +0 -1
- package/CapProductSelection/messages.js +0 -79
- package/CapProductSelection/styles.css +0 -81
- package/CapProductSelection/styles.module.scss.js +0 -8
- package/CapProductSelection/tests/CapProductSelection.mockData.d.ts +0 -36
- package/CapProductSelection/tests/CapProductSelection.mockData.d.ts.map +0 -1
- package/CapProductSelection/types.d.ts +0 -34
- package/CapProductSelection/types.d.ts.map +0 -1
- /package/{CapProductSelection → CapMobileDatePicker}/types.js +0 -0
|
@@ -3,19 +3,9 @@
|
|
|
3
3
|
* MobileDatePicker
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
7
|
-
import './
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
lastSyncDate: any;
|
|
12
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
declare namespace CapMobileDatePicker {
|
|
14
|
-
var propTypes: {
|
|
15
|
-
value: PropTypes.Requireable<object>;
|
|
16
|
-
lastSyncDate: PropTypes.Requireable<object>;
|
|
17
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export default CapMobileDatePicker;
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { CapMobileDatePickerProps } from './types';
|
|
8
|
+
declare const _default: React.ComponentType<Omit<CapMobileDatePickerProps, "intl">>;
|
|
9
|
+
export default _default;
|
|
10
|
+
export type { CapMobileDatePickerProps } from './types';
|
|
21
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapMobileDatePicker/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapMobileDatePicker/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;;AAyExD,wBAAyE;AACzE,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,63 +1,81 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import moment from "moment";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
3
|
import { useState } from "react";
|
|
4
|
+
import { injectIntl } from "react-intl";
|
|
5
|
+
import { FORMAT_TOKENS } from "../utils/dayjs.js";
|
|
5
6
|
import CapCalendarDatePicker from "../CapCalendarDatePicker/index.js";
|
|
6
7
|
import CapIcon from "../CapIcon/index.js";
|
|
7
8
|
import InputFinal from "../CapInput/index.js";
|
|
8
9
|
import CapModalWithHoc from "../CapModal/index.js";
|
|
9
|
-
import
|
|
10
|
+
import messages from "./messages.js";
|
|
11
|
+
import styles from "./styles.module.scss.js";
|
|
10
12
|
const INCEPTION_DATE = "2000-01-01";
|
|
11
|
-
const DATE_CALC_FORMAT =
|
|
12
|
-
const DATE_DISPLAY_FORMAT =
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const DATE_CALC_FORMAT = FORMAT_TOKENS.ISO_8601_DATE;
|
|
14
|
+
const DATE_DISPLAY_FORMAT = FORMAT_TOKENS.DATE_DISPLAY_FULL;
|
|
15
|
+
const clsPrefix = "cap-mobile-date-picker";
|
|
16
|
+
function CapMobileDatePicker({
|
|
17
|
+
intl: { formatMessage },
|
|
18
|
+
onChange,
|
|
19
|
+
value,
|
|
20
|
+
lastSyncDate,
|
|
21
|
+
placeholderLabel
|
|
22
|
+
}) {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
15
24
|
const handleDateChange = (date) => {
|
|
16
|
-
onChange(moment(date));
|
|
17
|
-
|
|
25
|
+
onChange == null ? void 0 : onChange(moment(date));
|
|
26
|
+
setOpen(false);
|
|
27
|
+
};
|
|
28
|
+
const handleModalOpen = () => {
|
|
29
|
+
setOpen(true);
|
|
30
|
+
};
|
|
31
|
+
const handleModalClose = () => {
|
|
32
|
+
setOpen(false);
|
|
18
33
|
};
|
|
19
34
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
35
|
/* @__PURE__ */ jsx(
|
|
21
36
|
InputFinal,
|
|
22
37
|
{
|
|
23
38
|
suffix: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(CapIcon, { type: "calendar", style: { color: "rgb(9, 30, 66)" }, size: "m" }) }),
|
|
24
|
-
onClick:
|
|
25
|
-
value: moment(value).format(DATE_DISPLAY_FORMAT)
|
|
39
|
+
onClick: handleModalOpen,
|
|
40
|
+
value: value ? moment(value).format(DATE_DISPLAY_FORMAT) : void 0,
|
|
41
|
+
size: "large",
|
|
42
|
+
placeholder: placeholderLabel || formatMessage(messages.selectDate)
|
|
26
43
|
}
|
|
27
44
|
),
|
|
28
45
|
/* @__PURE__ */ jsx(
|
|
29
46
|
CapModalWithHoc,
|
|
30
47
|
{
|
|
31
|
-
|
|
48
|
+
open,
|
|
32
49
|
centered: true,
|
|
33
|
-
onCancel:
|
|
34
|
-
className:
|
|
50
|
+
onCancel: handleModalClose,
|
|
51
|
+
className: styles[`${clsPrefix}-modal`],
|
|
52
|
+
classNames: {
|
|
53
|
+
root: styles[`${clsPrefix}-modal-root`],
|
|
54
|
+
body: styles[`${clsPrefix}-modal-body`],
|
|
55
|
+
container: styles[`${clsPrefix}-modal-container`],
|
|
56
|
+
footer: styles[`${clsPrefix}-modal-footer`]
|
|
57
|
+
},
|
|
35
58
|
closable: false,
|
|
36
59
|
footer: /* @__PURE__ */ jsx(Fragment, {}),
|
|
37
60
|
children: /* @__PURE__ */ jsx(
|
|
38
61
|
CapCalendarDatePicker,
|
|
39
62
|
{
|
|
40
63
|
inline: true,
|
|
64
|
+
className: styles[`${clsPrefix}-calendar`],
|
|
41
65
|
minDate: moment(INCEPTION_DATE, DATE_CALC_FORMAT).toDate(),
|
|
42
66
|
maxDate: lastSyncDate.toDate(),
|
|
43
67
|
dropdownMode: "select",
|
|
44
68
|
showMonthDropdown: true,
|
|
45
69
|
showYearDropdown: true,
|
|
46
|
-
readOnly: true,
|
|
47
70
|
onChange: handleDateChange,
|
|
48
|
-
selected: moment(value).toDate()
|
|
49
|
-
disabledDate: (currentDate) => currentDate.isAfter(lastSyncDate) || currentDate.isBefore(moment(INCEPTION_DATE))
|
|
71
|
+
selected: value ? moment(value).toDate() : void 0
|
|
50
72
|
}
|
|
51
73
|
)
|
|
52
74
|
}
|
|
53
75
|
)
|
|
54
76
|
] });
|
|
55
77
|
}
|
|
56
|
-
|
|
57
|
-
value: PropTypes.object,
|
|
58
|
-
lastSyncDate: PropTypes.object,
|
|
59
|
-
onChange: PropTypes.func
|
|
60
|
-
};
|
|
78
|
+
const index = injectIntl(CapMobileDatePicker);
|
|
61
79
|
export {
|
|
62
|
-
|
|
80
|
+
index as default
|
|
63
81
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapMobileDatePicker/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,qDAAqD,CAAC;;;;;;;AAExE,wBAKG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineMessages } from "react-intl";
|
|
2
|
+
const scope = "app.commonUtils.capUiLibrary.CapMobileDatePicker";
|
|
3
|
+
const messages = defineMessages({
|
|
4
|
+
selectDate: {
|
|
5
|
+
id: `${scope}.selectDate`,
|
|
6
|
+
defaultMessage: "Select date"
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
messages as default,
|
|
11
|
+
scope
|
|
12
|
+
};
|
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* Color Palette */
|
|
2
|
+
/* Fonts */
|
|
3
|
+
/* Backward Compatibility Aliases */
|
|
4
|
+
/* Component Heights */
|
|
5
|
+
/* Border Radius */
|
|
6
|
+
/* Border Width */
|
|
7
|
+
/* Transition */
|
|
8
|
+
/* Timezones Footer */
|
|
9
|
+
.cap-mobile-date-picker-modal-root {
|
|
10
|
+
min-width: 22.857rem;
|
|
3
11
|
width: unset !important;
|
|
4
12
|
}
|
|
5
|
-
.mobile-date-picker-modal
|
|
6
|
-
|
|
13
|
+
.cap-mobile-date-picker-modal-body {
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
7
17
|
}
|
|
8
|
-
.mobile-date-picker-modal
|
|
9
|
-
background-color:
|
|
10
|
-
color: #
|
|
18
|
+
.cap-mobile-date-picker-modal-body .react-datepicker__day--keyboard-selected {
|
|
19
|
+
background-color: #2466ea;
|
|
20
|
+
color: #ffffff !important;
|
|
11
21
|
border-radius: 50%;
|
|
12
22
|
}
|
|
13
|
-
.
|
|
23
|
+
.cap-mobile-date-picker-modal-container {
|
|
24
|
+
padding: 0 !important;
|
|
25
|
+
}
|
|
26
|
+
.cap-mobile-date-picker-modal-footer {
|
|
14
27
|
display: none !important;
|
|
15
28
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
.cap-mobile-date-picker-calendar {
|
|
30
|
+
box-shadow: none;
|
|
31
|
+
height: 100%;
|
|
32
|
+
width: 100%;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
19
36
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './styles.css';const styles = {
|
|
2
|
+
"cap-mobile-date-picker-modal-root": "cap-mobile-date-picker-modal-root",
|
|
3
|
+
"cap-mobile-date-picker-modal-body": "cap-mobile-date-picker-modal-body",
|
|
4
|
+
"cap-mobile-date-picker-modal-container": "cap-mobile-date-picker-modal-container",
|
|
5
|
+
"cap-mobile-date-picker-modal-footer": "cap-mobile-date-picker-modal-footer",
|
|
6
|
+
"cap-mobile-date-picker-calendar": "cap-mobile-date-picker-calendar"
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
styles as default
|
|
10
|
+
};
|
|
@@ -1,20 +1,41 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
1
|
+
@import '../styles/_variables.scss';
|
|
2
|
+
|
|
3
|
+
$clsPrefix: 'cap-mobile-date-picker';
|
|
4
|
+
|
|
5
|
+
.#{$clsPrefix}-modal {
|
|
6
|
+
&-root {
|
|
7
|
+
min-width: 22.857rem;
|
|
3
8
|
width: unset !important;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-body {
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
|
|
16
|
+
:global {
|
|
17
|
+
.react-datepicker__day--keyboard-selected {
|
|
18
|
+
background-color: $cap-secondary-base;
|
|
19
|
+
color: $cap-white !important;
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
}
|
|
16
22
|
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-container {
|
|
26
|
+
padding: 0 !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-footer {
|
|
30
|
+
display: none !important;
|
|
31
|
+
}
|
|
17
32
|
}
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
|
|
34
|
+
.#{$clsPrefix}-calendar {
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
height: 100%;
|
|
37
|
+
width: 100%;
|
|
38
|
+
display: flex;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
align-items: center;
|
|
20
41
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
export declare const mockDates: {
|
|
3
|
+
inception: moment.Moment;
|
|
4
|
+
midRange: moment.Moment;
|
|
5
|
+
midRange2: moment.Moment;
|
|
6
|
+
midRange3: moment.Moment;
|
|
7
|
+
lastSync: moment.Moment;
|
|
8
|
+
lastSyncMidYear: moment.Moment;
|
|
9
|
+
boundarySame: moment.Moment;
|
|
10
|
+
beforeInception: moment.Moment;
|
|
11
|
+
afterLastSync: moment.Moment;
|
|
12
|
+
differentYear: moment.Moment;
|
|
13
|
+
};
|
|
14
|
+
export declare const mockProps: {
|
|
15
|
+
default: {
|
|
16
|
+
value: moment.Moment;
|
|
17
|
+
lastSyncDate: moment.Moment;
|
|
18
|
+
};
|
|
19
|
+
withOnChange: {
|
|
20
|
+
value: moment.Moment;
|
|
21
|
+
lastSyncDate: moment.Moment;
|
|
22
|
+
onChange: jest.Mock<any, any, any>;
|
|
23
|
+
};
|
|
24
|
+
boundaryDates: {
|
|
25
|
+
value: moment.Moment;
|
|
26
|
+
lastSyncDate: moment.Moment;
|
|
27
|
+
};
|
|
28
|
+
nullValue: {
|
|
29
|
+
value: unknown;
|
|
30
|
+
lastSyncDate: moment.Moment;
|
|
31
|
+
};
|
|
32
|
+
undefinedValue: {
|
|
33
|
+
value: any;
|
|
34
|
+
lastSyncDate: moment.Moment;
|
|
35
|
+
};
|
|
36
|
+
midYearSync: {
|
|
37
|
+
value: moment.Moment;
|
|
38
|
+
lastSyncDate: moment.Moment;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=CapMobileDatePicker.mockData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CapMobileDatePicker.mockData.d.ts","sourceRoot":"","sources":["../../../components/CapMobileDatePicker/tests/CapMobileDatePicker.mockData.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,SAAS;;;;;;;;;;;CAWrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;eAeH,OAAO;;;;;;;;;;;CAWzB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Moment } from 'moment';
|
|
2
|
+
import type { IntlShape } from 'react-intl';
|
|
3
|
+
export interface CapMobileDatePickerProps {
|
|
4
|
+
intl: IntlShape;
|
|
5
|
+
/**
|
|
6
|
+
* Selected date value (moment object)
|
|
7
|
+
*/
|
|
8
|
+
value?: Moment;
|
|
9
|
+
/**
|
|
10
|
+
* Last sync date - maximum selectable date (moment object)
|
|
11
|
+
*/
|
|
12
|
+
lastSyncDate: Moment;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when date changes
|
|
15
|
+
* @param date - Selected moment object
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (date: Moment) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Placeholder label for the input field
|
|
20
|
+
*/
|
|
21
|
+
placeholderLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapMobileDatePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
declare const _default: React.ComponentType<Omit<{
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
treeData: any;
|
|
5
|
+
target: any;
|
|
6
|
+
trigger?: string;
|
|
7
|
+
placement: any;
|
|
8
|
+
overlayClassName: any;
|
|
9
|
+
selectedAttributes?: any[];
|
|
10
|
+
handleSelect?: () => void;
|
|
11
|
+
isProductMandatory: any;
|
|
12
|
+
lineItem: any;
|
|
13
|
+
selectAttribute: any;
|
|
14
|
+
brand: any;
|
|
15
|
+
brandInfo: any;
|
|
16
|
+
category: any;
|
|
17
|
+
categoryInfo: any;
|
|
18
|
+
product: any;
|
|
19
|
+
productInfo: any;
|
|
20
|
+
SKU: any;
|
|
21
|
+
uploadSKU: any;
|
|
22
|
+
uploadSKUInfo: any;
|
|
23
|
+
comingSoon: any;
|
|
24
|
+
changeSelection: any;
|
|
25
|
+
description: any;
|
|
26
|
+
okText: any;
|
|
27
|
+
cancelText: any;
|
|
28
|
+
selectValues: any;
|
|
29
|
+
atleast1Attribute: any;
|
|
30
|
+
} & import("react-intl").WrappedComponentProps, "intl">>;
|
|
8
31
|
export default _default;
|
|
9
|
-
export type { CapProductSelectionProps, TreeNodeItem } from './types';
|
|
10
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapProductSelection/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapProductSelection/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoZnD,wBAA8E"}
|