@pezeshk-book/modules 0.0.4 → 0.0.5
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/dist/modules/calendar/calendar.d.ts +2 -2
- package/dist/modules/calendar/calendar.js +10 -8
- package/dist/modules/calendar/calendar.js.map +1 -1
- package/dist/modules/calendar/calendar.props.d.ts +4 -0
- package/dist/modules/calendar/sub-components/day/day.d.ts +2 -2
- package/dist/modules/calendar/sub-components/day/day.js +8 -5
- package/dist/modules/calendar/sub-components/day/day.js.map +1 -1
- package/dist/modules/calendar/sub-components/day/day.props.d.ts +1 -0
- package/dist/modules/calendar/sub-components/day/day.style.d.ts +1 -1
- package/dist/modules/calendar/sub-components/day/day.style.js +1 -1
- package/dist/modules/calendar/sub-components/day/day.style.js.map +1 -1
- package/dist/modules/calendar/sub-components/days/days.d.ts +2 -2
- package/dist/modules/calendar/sub-components/days/days.js +4 -4
- package/dist/modules/calendar/sub-components/days/days.js.map +1 -1
- package/dist/modules/calendar/sub-components/days/days.props.d.ts +5 -0
- package/dist/modules/calendar/sub-components/days-head/days-head.d.ts +2 -2
- package/dist/modules/calendar/sub-components/days-head/days-head.js +5 -9
- package/dist/modules/calendar/sub-components/days-head/days-head.js.map +1 -1
- package/dist/modules/calendar/sub-components/days-head/days-head.props.d.ts +2 -2
- package/dist/modules/slider/slider.d.ts +2 -2
- package/dist/stories/calendar/calendar.d.ts +2 -2
- package/dist/stories/calendar/calendar.stories.d.ts +3 -3
- package/dist/stories/slider.stories.d.ts +3 -3
- package/dist/stories/wrapper.d.ts +2 -2
- package/package.json +2 -3
- package/dist/utils/time-helper.d.ts +0 -5
- package/dist/utils/time-helper.js +0 -31
- package/dist/utils/time-helper.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { CalendarProps } from "./calendar.props";
|
|
3
|
-
declare const Calender: ({ selectedDate, onChange }: CalendarProps) =>
|
|
3
|
+
declare const Calender: ({ selectedDate, disablePreviousMonths, disableSubsequentMonths, disablePreviousDays, disableSubsequentDays, onChange }: CalendarProps) => JSX.Element;
|
|
4
4
|
export default Calender;
|
|
@@ -6,17 +6,17 @@ import formatDate from './shared/formatDate';
|
|
|
6
6
|
import { Div } from '@pezeshk-book/ui-kit';
|
|
7
7
|
import DateObject from "react-date-object";
|
|
8
8
|
var Calender = function (_a) {
|
|
9
|
-
var _b = _a.selectedDate, selectedDate = _b === void 0 ? new Date() : _b, onChange = _a.onChange;
|
|
10
|
-
var date = new DateObject(
|
|
11
|
-
var
|
|
12
|
-
var
|
|
9
|
+
var _b = _a.selectedDate, selectedDate = _b === void 0 ? new Date() : _b, _c = _a.disablePreviousMonths, disablePreviousMonths = _c === void 0 ? false : _c, _d = _a.disableSubsequentMonths, disableSubsequentMonths = _d === void 0 ? false : _d, _e = _a.disablePreviousDays, disablePreviousDays = _e === void 0 ? false : _e, _f = _a.disableSubsequentDays, disableSubsequentDays = _f === void 0 ? false : _f, onChange = _a.onChange;
|
|
10
|
+
var date = new DateObject({ date: selectedDate });
|
|
11
|
+
var _g = useState(''), startDate = _g[0], setStartDate = _g[1];
|
|
12
|
+
var _h = useState({
|
|
13
13
|
value: formatDate(selectedDate, 'YYYY/MM/DD'),
|
|
14
14
|
cloneDays: date,
|
|
15
15
|
monthName: "",
|
|
16
16
|
month: "",
|
|
17
17
|
year: "",
|
|
18
18
|
days: []
|
|
19
|
-
}), datepicker =
|
|
19
|
+
}), datepicker = _h[0], setDatepicker = _h[1];
|
|
20
20
|
useEffect(function () {
|
|
21
21
|
var _a = daysInMonth(datepicker.cloneDays), monthName = _a.monthName, month = _a.month, days = _a.days, year = _a.year;
|
|
22
22
|
setDatepicker(__assign(__assign({}, datepicker), { year: year, monthName: monthName, month: month, days: days, initialValue: null }));
|
|
@@ -40,10 +40,12 @@ var Calender = function (_a) {
|
|
|
40
40
|
else {
|
|
41
41
|
setStartDate('');
|
|
42
42
|
}
|
|
43
|
-
onChange(startDate);
|
|
44
43
|
};
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
onChange(startDate);
|
|
46
|
+
}, [startDate]);
|
|
47
|
+
return (React.createElement(Div, { dir: 'rtl', className: "items-center flex flex-col justify-center bg-white rounded py-4 !w-full" },
|
|
48
|
+
React.createElement(Days, { days: datepicker.days, monthName: datepicker.monthName, year: datepicker.year, selectedDay: datepicker.value, disablePreviousMonths: disablePreviousMonths, disableSubsequentMonths: disableSubsequentMonths, disablePreviousDays: disablePreviousDays, disableSubsequentDays: disableSubsequentDays, daysEventListeners: daysEventListeners, selectStartDateHandler: startDateHandler, startDate: startDate, date: date, increaseMonth: function () { return changeMonths(1); }, decreaseMonth: function () { return changeMonths(-1); }, isDatePicker: true })));
|
|
47
49
|
};
|
|
48
50
|
export default Calender;
|
|
49
51
|
//# sourceMappingURL=calendar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../modules/calendar/calendar.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,4BAA4B,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AACxC,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAY3C,IAAM,QAAQ,GAAG,UAAC,
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../modules/calendar/calendar.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,4BAA4B,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAC,MAAM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AAC,CAAC,EAAf,CAAe,EACpC,aAAa,EAAE,cAAM,OAAA,YAAY,CAAC,CAAC,CAAC,CAAC,EAAhB,CAAgB,EACrC,YAAY,SACZ,CACE,CACP,CAAC;AACJ,CAAC,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { DayProps } from "./day.props";
|
|
3
|
-
export declare const Day: (props: DayProps) =>
|
|
3
|
+
export declare const Day: (props: DayProps) => JSX.Element;
|
|
@@ -4,22 +4,25 @@ import { DAY_CONTAINER } from "./day.style";
|
|
|
4
4
|
import classNames from '../../../../utils/class-names';
|
|
5
5
|
import { Button } from '@pezeshk-book/ui-kit';
|
|
6
6
|
export var Day = function (props) {
|
|
7
|
-
var children = props.children, disabledDay = props.disabledDay, holidays = props.holidays, passedDay = props.passedDay, selectedDay = props.selectedDay, startDate = props.startDate, handleDay = props.handleDay;
|
|
7
|
+
var children = props.children, disabledDay = props.disabledDay, holidays = props.holidays, passedDay = props.passedDay, comingDay = props.comingDay, selectedDay = props.selectedDay, startDate = props.startDate, handleDay = props.handleDay;
|
|
8
8
|
if (!children) {
|
|
9
9
|
return React.createElement(Button, __assign({ variant: 'text', size: 'tiny', shape: 'square', className: classNames(DAY_CONTAINER, 'cursor-default') }, props));
|
|
10
10
|
}
|
|
11
11
|
if (passedDay) {
|
|
12
|
-
return React.createElement(Button, __assign({ size: 'tiny', variant: '
|
|
12
|
+
return React.createElement(Button, __assign({ size: 'tiny', variant: 'filled', color: 'control', shape: 'square', className: classNames(DAY_CONTAINER, 'cursor-not-allowed') }, props));
|
|
13
|
+
}
|
|
14
|
+
if (comingDay) {
|
|
15
|
+
return React.createElement(Button, __assign({ size: 'tiny', variant: 'filled', color: 'control', shape: 'square', className: classNames(DAY_CONTAINER, 'cursor-not-allowed') }, props));
|
|
13
16
|
}
|
|
14
17
|
if (startDate) {
|
|
15
|
-
return React.createElement(Button, __assign({ size: 'tiny', variant: '
|
|
18
|
+
return React.createElement(Button, __assign({ size: 'tiny', variant: 'filled', color: 'success', shape: 'square', className: classNames(DAY_CONTAINER, 'cursor-pointer'), onClick: handleDay }, props));
|
|
16
19
|
}
|
|
17
20
|
if (disabledDay || holidays) {
|
|
18
21
|
return React.createElement(Button, __assign({ size: 'tiny', color: 'danger', shape: 'square', className: classNames(DAY_CONTAINER, 'cursor-pointer'), onClick: handleDay }, props));
|
|
19
22
|
}
|
|
20
23
|
if (selectedDay) {
|
|
21
|
-
return React.createElement(Button, __assign({ size: 'tiny', variant: '
|
|
24
|
+
return React.createElement(Button, __assign({ size: 'tiny', variant: 'filled', color: 'primary', shape: 'square', className: classNames(DAY_CONTAINER, 'cursor-pointer'), onClick: handleDay }, props));
|
|
22
25
|
}
|
|
23
|
-
return React.createElement(Button, __assign({ variant: 'text', size: 'tiny', shape: 'square', color: '
|
|
26
|
+
return React.createElement(Button, __assign({ variant: 'text', size: 'tiny', shape: 'square', color: 'control', className: classNames(DAY_CONTAINER), onClick: handleDay }, props));
|
|
24
27
|
};
|
|
25
28
|
//# sourceMappingURL=day.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"day.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/day/day.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,UAAU,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAA;AAE3C,MAAM,CAAC,IAAM,GAAG,GAAG,UAAC,KAAe;IAC1B,IAAA,QAAQ,
|
|
1
|
+
{"version":3,"file":"day.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/day/day.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,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SAAS,EAAE,UAAU,CACnB,aAAa,EACb,gBAAgB,CACjB,EACD,OAAO,EAAE,SAAS,IACd,KAAK,EAAG,CAAA;KACf;IACD,IAAI,WAAW,IAAI,QAAQ,EAAE;QAC3B,OAAO,oBAAC,MAAM,aACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,UAAU,CACnB,aAAa,EACb,gBAAgB,CACjB,EACD,OAAO,EAAE,SAAS,IACd,KAAK,EAAG,CAAC;KAChB;IACD,IAAI,WAAW,EAAE;QACf,OAAO,oBAAC,MAAM,aACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,UAAU,CACnB,aAAa,EACb,gBAAgB,CACjB,EACD,OAAO,EAAE,SAAS,IACd,KAAK,EAAG,CAAC;KAChB;IACD,OAAO,oBAAC,MAAM,aACZ,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,UAAU,CACnB,aAAa,CACd,EACD,OAAO,EAAE,SAAS,IACd,KAAK,EAAG,CAAA;AAChB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const DAY_CONTAINER = "flex justify-center mx-2.5 md:mx-5 items-center my-2 text-center relative rounded-full font-family-medium";
|
|
1
|
+
export declare const DAY_CONTAINER = "w-full flex justify-center mx-2.5 md:mx-5 items-center my-2 text-center relative rounded-full font-family-medium";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var DAY_CONTAINER = 'flex justify-center mx-2.5 md:mx-5 items-center my-2 text-center relative rounded-full font-family-medium';
|
|
1
|
+
export var DAY_CONTAINER = 'w-full flex justify-center mx-2.5 md:mx-5 items-center my-2 text-center relative rounded-full font-family-medium';
|
|
2
2
|
//# sourceMappingURL=day.style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"day.style.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/day/day.style.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"day.style.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/day/day.style.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,aAAa,GAAG,kHAAkH,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { DaysProps } from './days.props';
|
|
3
3
|
declare const Days: {
|
|
4
|
-
(props: DaysProps):
|
|
4
|
+
(props: DaysProps): JSX.Element | null;
|
|
5
5
|
defaultProps: {
|
|
6
6
|
monthName: string;
|
|
7
7
|
disableDays: never[];
|
|
@@ -16,20 +16,20 @@ var boolDataset = function (arg) {
|
|
|
16
16
|
};
|
|
17
17
|
var tempHolidays = ['2023-05-15', '2022-09-25', '2022-09-27', '2022-10-05', '2022-12-27', '2023-02-04', '2023-02-11', '2023-02-18', '2023-03-08', '2023-03-20'];
|
|
18
18
|
var Days = function (props) {
|
|
19
|
-
var days = props.days, startDate = props.startDate, selectStartDateHandler = props.selectStartDateHandler, monthName = props.monthName, increaseMonth = props.increaseMonth, decreaseMonth = props.decreaseMonth, selectedDay = props.selectedDay, year = props.year;
|
|
19
|
+
var days = props.days, startDate = props.startDate, selectStartDateHandler = props.selectStartDateHandler, monthName = props.monthName, disablePreviousMonths = props.disablePreviousMonths, disableSubsequentMonths = props.disableSubsequentMonths, disablePreviousDays = props.disablePreviousDays, disableSubsequentDays = props.disableSubsequentDays, increaseMonth = props.increaseMonth, decreaseMonth = props.decreaseMonth, selectedDay = props.selectedDay, year = props.year, date = props.date;
|
|
20
20
|
var handleDayClick = function (day) {
|
|
21
21
|
selectStartDateHandler(day);
|
|
22
22
|
};
|
|
23
23
|
var weeks = chunk(days, 7);
|
|
24
|
-
var
|
|
24
|
+
var dates = new DateObject({ date: date, calendar: persian }).format("YYYY/MM/DD");
|
|
25
25
|
if (!days.length) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
return (React.createElement(Div, { className: 'flex-1 w-[390px] md:w-[560px] px-9 flex-col self-center relative overflow-auto mx-1 bg-white' },
|
|
29
|
-
React.createElement(DaysHead, { year: year, monthName: monthName, increaseMonth: increaseMonth, decreaseMonth: decreaseMonth }),
|
|
29
|
+
React.createElement(DaysHead, { year: year, monthName: monthName, disablePreviousMonths: disablePreviousMonths, disableSubsequentMonths: disableSubsequentMonths, increaseMonth: increaseMonth, decreaseMonth: decreaseMonth }),
|
|
30
30
|
React.createElement(Div, { className: 'flex-col items-center flex-1 border-separate border-spacing-x-2', "data-testid": "days-wrapper" },
|
|
31
31
|
React.createElement(Div, { className: 'items-center self-center w-full justify-between h-[29px] text-white border-b border-tertiary pb-2 mb-2 px-5 md:px-3 md:pr-6 !flex-row' }, weekDayNames.map(function (name) { return (React.createElement(Text, { type: "regular", typography: "lg", color: "black", key: name }, name)); })),
|
|
32
|
-
weeks.map(function (week, idx) { return (React.createElement("ul", { className: 'flex m-0 md:px-0 list-none w-full last:justify-start items-end justify-between self-center ', "data-testid": "days", key: "rdp-weeks-".concat(idx) }, week.map(function (day, id) { return (React.createElement(Day, __assign({ key: day.utc, passedDay: day.faDate <
|
|
32
|
+
weeks.map(function (week, idx) { return (React.createElement("ul", { className: 'flex m-0 md:px-0 list-none w-full last:justify-start items-end justify-between self-center ', "data-testid": "days", key: "rdp-weeks-".concat(idx) }, week.map(function (day, id) { return (React.createElement(Day, __assign({ key: day.utc, passedDay: disablePreviousDays && day.faDate < dates, comingDay: disableSubsequentDays && day.faDate > dates, holidays: tempHolidays.indexOf(day.utc) !== -1, "data-testid": "day-".concat(idx * 7 + id + 1), "data-fadate": "".concat(day.faDate), disabledDay: week.length === 7 && id === 6, selectedDay: selectedDay === day.faDate, startDate: startDate === day.faDate, handleDay: function () { return handleDayClick(day); } }, boolDataset(day.disabled)), !day.disabled ? fa(day.day) : null)); }))); }))));
|
|
33
33
|
};
|
|
34
34
|
Days.defaultProps = {
|
|
35
35
|
monthName: "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"days.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/days/days.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,QAAQ,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAC,KAAK,EAAE,EAAE,EAAS,YAAY,EAAC,MAAM,cAAc,CAAA;AAC3D,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,OAAO,MAAM,qCAAqC,CAAC;AAC1D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,sBAAsB,CAAA;AAE9C,IAAM,WAAW,GAAG,UAAC,GAAY;IAC/B,IAAI,GAAG,EAAE;QACP,OAAO;YACL,cAAc,EAAE,GAAG;SACpB,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,IAAM,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;AAEjK,IAAM,IAAI,GAAG,UAAC,KAAgB;IAE1B,IAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"days.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/days/days.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,QAAQ,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAC,KAAK,EAAE,EAAE,EAAS,YAAY,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AAI,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAC1C,WAAW,EAAE,WAAW,KAAK,GAAG,CAAC,MAAM,EACvC,SAAS,EAAE,SAAS,KAAK,GAAG,CAAC,MAAM,EACnC,SAAS,EAAE,cAAM,OAAA,cAAc,CAAC,GAAG,CAAC,EAAnB,CAAmB,IAChC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,GAC5B,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC/B,CACP,EAfkC,CAelC,CAAC,CACC,CACN,EAnByB,CAmBzB,CAAC,CACE,CACF,CACP,CAAA;AACH,CAAC,CAAA;AAGD,IAAI,CAAC,YAAY,GAAG;IAClB,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,EAAE;CAChB,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -2,6 +2,10 @@ export interface DaysProps {
|
|
|
2
2
|
days: Array<object>;
|
|
3
3
|
monthName: string;
|
|
4
4
|
selectedDay: string;
|
|
5
|
+
disablePreviousMonths: boolean;
|
|
6
|
+
disableSubsequentMonths: boolean;
|
|
7
|
+
disablePreviousDays: boolean;
|
|
8
|
+
disableSubsequentDays: boolean;
|
|
5
9
|
daysEventListeners: any;
|
|
6
10
|
increaseMonth: any;
|
|
7
11
|
decreaseMonth: any;
|
|
@@ -9,4 +13,5 @@ export interface DaysProps {
|
|
|
9
13
|
startDate: string;
|
|
10
14
|
selectStartDateHandler: any;
|
|
11
15
|
year: string;
|
|
16
|
+
date: any;
|
|
12
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { DaysHeadProps } from "./days-head.props";
|
|
3
|
-
declare const DaysHead: (props: DaysHeadProps) =>
|
|
3
|
+
declare const DaysHead: (props: DaysHeadProps) => JSX.Element;
|
|
4
4
|
export default DaysHead;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import moment from "jalali-moment";
|
|
3
|
-
import { fa } from "../../config";
|
|
4
2
|
import { Button, Div, Text } from '@pezeshk-book/ui-kit';
|
|
5
3
|
import { ArrowLeftIcon, ArrowRightIcon, CalendarIcon } from '../../icons';
|
|
6
4
|
var DaysHead = function (props) {
|
|
7
|
-
var decreaseMonth = props.decreaseMonth, increaseMonth = props.increaseMonth, monthName = props.monthName,
|
|
8
|
-
var backDisable = "".concat(moment(startDate).locale("fa").format("jMMMM"), " ").concat(fa(moment(startDate).format("jYYYY"))) === monthName;
|
|
9
|
-
var forward = "".concat(moment(endDate).locale("fa").format("jMMMM"), " ").concat(fa(moment(endDate).format("jYYYY"))) === monthName;
|
|
5
|
+
var decreaseMonth = props.decreaseMonth, increaseMonth = props.increaseMonth, monthName = props.monthName, year = props.year, disablePreviousMonths = props.disablePreviousMonths, disableSubsequentMonths = props.disableSubsequentMonths;
|
|
10
6
|
return (React.createElement(Div, { className: 'flex-wrap justify-center items-center bg-white w-[318px] md:w-[488px] self-center mb-5' },
|
|
11
7
|
React.createElement(Div, { className: 'w-full items-center justify-between h-12 px-4' },
|
|
12
8
|
React.createElement(Div, null,
|
|
@@ -14,13 +10,13 @@ var DaysHead = function (props) {
|
|
|
14
10
|
"\u0633\u0627\u0644 ",
|
|
15
11
|
year)),
|
|
16
12
|
React.createElement(Div, { className: 'items-center mr-8' },
|
|
17
|
-
React.createElement(Button, { variant: "text", size: 'small', className: 'flex items-center', onClick:
|
|
13
|
+
React.createElement(Button, { variant: "text", size: 'small', className: 'flex items-center', onClick: decreaseMonth, shape: 'square', disabled: disablePreviousMonths },
|
|
18
14
|
React.createElement(Div, { className: 'h-3 w-[6px] relative' },
|
|
19
|
-
React.createElement("img", { src:
|
|
15
|
+
React.createElement("img", { src: ArrowRightIcon, className: 'w-full h-full object-contain', alt: 'ماه قبل' }))),
|
|
20
16
|
React.createElement(Text, { className: 'mx-1', color: "grey.900", type: 'bold', typography: "xxl" }, monthName),
|
|
21
|
-
React.createElement(Button, { variant: "text", size: 'small', className: 'flex items-center', onClick:
|
|
17
|
+
React.createElement(Button, { variant: "text", size: 'small', className: 'flex items-center', onClick: increaseMonth, shape: 'square', disabled: disableSubsequentMonths },
|
|
22
18
|
React.createElement(Div, { className: 'h-3 w-[6px] relative' },
|
|
23
|
-
React.createElement("img", { src:
|
|
19
|
+
React.createElement("img", { src: ArrowLeftIcon, className: 'w-full h-full object-contain', alt: 'ماه بعد' })))),
|
|
24
20
|
React.createElement(Div, { className: 'relative w-[19px] h-[22px]' },
|
|
25
21
|
React.createElement("img", { src: CalendarIcon, alt: 'تقویم' })))));
|
|
26
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"days-head.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/days-head/days-head.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,
|
|
1
|
+
{"version":3,"file":"days-head.js","sourceRoot":"","sources":["../../../../../modules/calendar/sub-components/days-head/days-head.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,YAAY,EAAC,MAAM,aAAa,CAAA;AAEvE,IAAM,QAAQ,GAAG,UAAC,KAAoB;IAC7B,IAAA,aAAa,GAAoF,KAAK,cAAzF,EAAE,aAAa,GAAqE,KAAK,cAA1E,EAAE,SAAS,GAA0D,KAAK,UAA/D,EAAE,IAAI,GAAoD,KAAK,KAAzD,EAAE,qBAAqB,GAA6B,KAAK,sBAAlC,EAAE,uBAAuB,GAAI,KAAK,wBAAT,CAAU;IAE9G,OAAO,CACL,oBAAC,GAAG,IAAC,SAAS,EAAE,wFAAwF;QACt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|
+
/// <reference types="react" />
|
|
2
2
|
import { SliderProps } from './slider.props';
|
|
3
|
-
declare const Slider: ({ children, delay, spaceBetween, slides, infiniteLoop, pauseOnMouseOver, autoMove, indicatorActiveColor, indicator, navigation, prevNavigation, nextNavigation, }: SliderProps) =>
|
|
3
|
+
declare const Slider: ({ children, delay, spaceBetween, slides, infiniteLoop, pauseOnMouseOver, autoMove, indicatorActiveColor, indicator, navigation, prevNavigation, nextNavigation, }: SliderProps) => JSX.Element;
|
|
4
4
|
export default Slider;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { CalendarProps } from "../../modules/calendar/calendar.props";
|
|
3
3
|
/**
|
|
4
4
|
* Primary UI component for user interaction
|
|
5
5
|
*/
|
|
6
|
-
export declare const Calendar: ({ ...props }: CalendarProps) =>
|
|
6
|
+
export declare const Calendar: ({ ...props }: CalendarProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
|
3
3
|
import { CalendarProps } from "../../modules/calendar/calendar.props";
|
|
4
|
-
declare const _default: ComponentMeta<({ ...props }: CalendarProps) =>
|
|
4
|
+
declare const _default: ComponentMeta<({ ...props }: CalendarProps) => JSX.Element>;
|
|
5
5
|
export default _default;
|
|
6
|
-
export declare const Default: ComponentStory<({ ...props }: CalendarProps) =>
|
|
6
|
+
export declare const Default: ComponentStory<({ ...props }: CalendarProps) => JSX.Element>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
|
3
3
|
import { SliderProps } from "../modules/slider/slider.props";
|
|
4
|
-
declare const _default: ComponentMeta<({ children, delay, spaceBetween, slides, infiniteLoop, pauseOnMouseOver, autoMove, indicatorActiveColor, indicator, navigation, prevNavigation, nextNavigation, }: SliderProps) =>
|
|
4
|
+
declare const _default: ComponentMeta<({ children, delay, spaceBetween, slides, infiniteLoop, pauseOnMouseOver, autoMove, indicatorActiveColor, indicator, navigation, prevNavigation, nextNavigation, }: SliderProps) => JSX.Element>;
|
|
5
5
|
export default _default;
|
|
6
|
-
export declare const Default: ComponentStory<({ children, delay, spaceBetween, slides, infiniteLoop, pauseOnMouseOver, autoMove, indicatorActiveColor, indicator, navigation, prevNavigation, nextNavigation, }: SliderProps) =>
|
|
6
|
+
export declare const Default: ComponentStory<({ children, delay, spaceBetween, slides, infiniteLoop, pauseOnMouseOver, autoMove, indicatorActiveColor, indicator, navigation, prevNavigation, nextNavigation, }: SliderProps) => JSX.Element>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
export declare const Wrapper: ({ title, children, className, titleColor }: {
|
|
3
3
|
title: string;
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
className?: string | undefined;
|
|
6
6
|
titleColor?: string | undefined;
|
|
7
|
-
}) =>
|
|
7
|
+
}) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pezeshk-book/modules",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"main": "./dist/index.ts",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"autoprefixer": "^10.4.13",
|
|
29
29
|
"postcss": "^8.4.20",
|
|
30
30
|
"tailwindcss": "^3.2.4",
|
|
31
|
-
"
|
|
32
|
-
"@pezeshk-book/ui-kit": "^0.1.64"
|
|
31
|
+
"@pezeshk-book/ui-kit": "^0.2.64"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
34
|
"react": "^18.2.0",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const addDays: (date: any, number: number) => Date;
|
|
2
|
-
export declare const timeDifference: (date: Date) => number;
|
|
3
|
-
export declare const timeIsAfter: (date: string | Date, timeDestination?: string | Date) => any;
|
|
4
|
-
export declare const momentFormat: (format: string) => any;
|
|
5
|
-
export declare const timePassed: (date: Date) => any;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export var addDays = function (date, number) {
|
|
2
|
-
var newDate = new Date(date);
|
|
3
|
-
return new Date(newDate.setDate(newDate.getDate() + number));
|
|
4
|
-
};
|
|
5
|
-
export var timeDifference = function (date) {
|
|
6
|
-
if (date) {
|
|
7
|
-
var moment = require('jalali-moment');
|
|
8
|
-
return Math.abs(moment().diff(date, 'seconds'));
|
|
9
|
-
}
|
|
10
|
-
return 0;
|
|
11
|
-
};
|
|
12
|
-
export var timeIsAfter = function (date, timeDestination) {
|
|
13
|
-
if (timeDestination === void 0) { timeDestination = new Date(); }
|
|
14
|
-
if (date) {
|
|
15
|
-
var moment = require('moment');
|
|
16
|
-
return moment(date).isAfter(timeDestination);
|
|
17
|
-
}
|
|
18
|
-
return false;
|
|
19
|
-
};
|
|
20
|
-
export var momentFormat = function (format) {
|
|
21
|
-
var moment = require('moment');
|
|
22
|
-
return (moment(new Date().getTime()).format(format));
|
|
23
|
-
};
|
|
24
|
-
export var timePassed = function (date) {
|
|
25
|
-
if (date) {
|
|
26
|
-
var moment = require('jalali-moment');
|
|
27
|
-
return moment(date).locale("fa").fromNow();
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=time-helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time-helper.js","sourceRoot":"","sources":["../../utils/time-helper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,UAAC,IAAS,EAAE,MAAc;IAC/C,IAAM,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,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