@pezeshk-book/modules 0.0.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.
- package/LICENSE +22 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/calender/calender.d.ts +4 -0
- package/dist/modules/calender/calender.js +46 -0
- package/dist/modules/calender/calender.js.map +1 -0
- package/dist/modules/calender/calender.props.d.ts +4 -0
- package/dist/modules/calender/calender.props.js +2 -0
- package/dist/modules/calender/calender.props.js.map +1 -0
- package/dist/modules/calender/config/chunk.d.ts +1 -0
- package/dist/modules/calender/config/chunk.js +39 -0
- package/dist/modules/calender/config/chunk.js.map +1 -0
- package/dist/modules/calender/config/daysIn-month.d.ts +15 -0
- package/dist/modules/calender/config/daysIn-month.js +32 -0
- package/dist/modules/calender/config/daysIn-month.js.map +1 -0
- package/dist/modules/calender/config/index.d.ts +5 -0
- package/dist/modules/calender/config/index.js +5 -0
- package/dist/modules/calender/config/index.js.map +1 -0
- package/dist/modules/calender/config/week-day.d.ts +4 -0
- package/dist/modules/calender/config/week-day.js +18 -0
- package/dist/modules/calender/config/week-day.js.map +1 -0
- package/dist/modules/calender/icons/index.d.ts +4 -0
- package/dist/modules/calender/icons/index.js +5 -0
- package/dist/modules/calender/icons/index.js.map +1 -0
- package/dist/modules/calender/index.d.ts +2 -0
- package/dist/modules/calender/index.js +3 -0
- package/dist/modules/calender/index.js.map +1 -0
- package/dist/modules/calender/sub-components/day/day.d.ts +3 -0
- package/dist/modules/calender/sub-components/day/day.js +21 -0
- package/dist/modules/calender/sub-components/day/day.js.map +1 -0
- package/dist/modules/calender/sub-components/day/day.props.d.ts +9 -0
- package/dist/modules/calender/sub-components/day/day.props.js +2 -0
- package/dist/modules/calender/sub-components/day/day.props.js.map +1 -0
- package/dist/modules/calender/sub-components/day/day.style.d.ts +2 -0
- package/dist/modules/calender/sub-components/day/day.style.js +8 -0
- package/dist/modules/calender/sub-components/day/day.style.js.map +1 -0
- package/dist/modules/calender/sub-components/days/days.d.ts +10 -0
- package/dist/modules/calender/sub-components/days/days.js +35 -0
- package/dist/modules/calender/sub-components/days/days.js.map +1 -0
- package/dist/modules/calender/sub-components/days/days.props.d.ts +10 -0
- package/dist/modules/calender/sub-components/days/days.props.js +2 -0
- package/dist/modules/calender/sub-components/days/days.props.js.map +1 -0
- package/dist/modules/calender/sub-components/days-head/days-head.d.ts +4 -0
- package/dist/modules/calender/sub-components/days-head/days-head.js +28 -0
- package/dist/modules/calender/sub-components/days-head/days-head.js.map +1 -0
- package/dist/modules/calender/sub-components/days-head/days-head.props.d.ts +8 -0
- package/dist/modules/calender/sub-components/days-head/days-head.props.js +2 -0
- package/dist/modules/calender/sub-components/days-head/days-head.props.js.map +1 -0
- package/dist/modules/slider/index.d.ts +2 -0
- package/dist/modules/slider/index.js +3 -0
- package/dist/modules/slider/index.js.map +1 -0
- package/dist/modules/slider/slider.d.ts +4 -0
- package/dist/modules/slider/slider.js +135 -0
- package/dist/modules/slider/slider.js.map +1 -0
- package/dist/modules/slider/slider.props.d.ts +14 -0
- package/dist/modules/slider/slider.props.js +2 -0
- package/dist/modules/slider/slider.props.js.map +1 -0
- package/dist/utils/class-names.d.ts +2 -0
- package/dist/utils/class-names.js +9 -0
- package/dist/utils/class-names.js.map +1 -0
- package/dist/utils/time-helper.d.ts +6 -0
- package/dist/utils/time-helper.js +39 -0
- package/dist/utils/time-helper.js.map +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Pezeshkbook "PezeshkBook" Xu <info@pezeshkbook.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAA;AACrC,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AAEzC,OAAO,EACL,MAAM,EACN,QAAQ,EACT,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __assign, __spreadArray } from "tslib";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import moment from "jalali-moment";
|
|
4
|
+
import Days from "./sub-components/days/days";
|
|
5
|
+
import { daysInMonth } from './config';
|
|
6
|
+
import { convertDate } from '../../utils/time-helper';
|
|
7
|
+
import { Div } from '@pezeshk-book/ui-kit';
|
|
8
|
+
var Calender = function (props) {
|
|
9
|
+
var selectedDate = props.selectedDate, selectedDayCallback = props.selectedDayCallback;
|
|
10
|
+
var _a = useState({
|
|
11
|
+
value: convertDate(selectedDate, 'YYYY/MM/DD'),
|
|
12
|
+
cloneDays: moment(selectedDate),
|
|
13
|
+
monthName: "",
|
|
14
|
+
year: "",
|
|
15
|
+
days: []
|
|
16
|
+
}), state = _a[0], setState = _a[1];
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var _a = daysInMonth(state.cloneDays), monthName = _a.monthName, days = _a.days, year = _a.year;
|
|
19
|
+
setState(__assign(__assign({}, state), { days: days, monthName: monthName, initialValue: null, year: year }));
|
|
20
|
+
}, []);
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
if (state.cloneDays.isSame(state.cloneDays)) {
|
|
23
|
+
var _a = daysInMonth(state.cloneDays), monthName = _a.monthName, days = _a.days, year = _a.year;
|
|
24
|
+
setState(__assign(__assign({}, state), { days: __spreadArray(__spreadArray([], state.days.slice(state.days.length), true), days, true), monthName: monthName, year: year }));
|
|
25
|
+
}
|
|
26
|
+
}, [state.cloneDays]);
|
|
27
|
+
var changeMonth = function (amount) {
|
|
28
|
+
setState(__assign(__assign({}, state), { cloneDays: state.cloneDays.clone().add(amount, "month") }));
|
|
29
|
+
};
|
|
30
|
+
var selectDay = function (e) {
|
|
31
|
+
var faDate = e.target.dataset.fadate;
|
|
32
|
+
if (faDate) {
|
|
33
|
+
selectedDayCallback(faDate);
|
|
34
|
+
}
|
|
35
|
+
setState(__assign(__assign({}, state), { value: faDate }));
|
|
36
|
+
};
|
|
37
|
+
var daysEventListeners = function () {
|
|
38
|
+
return {
|
|
39
|
+
onClick: selectDay
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
return (React.createElement(Div, { dir: 'rtl', className: "items-center justify-center bg-white rounded py-4" },
|
|
43
|
+
React.createElement(Days, { days: state.days, monthName: state.monthName, year: state.year, selectedDay: state.value, daysEventListeners: daysEventListeners, increaseMonth: function () { return changeMonth(1); }, decreaseMonth: function () { return changeMonth(-1); }, isDatePicker: true })));
|
|
44
|
+
};
|
|
45
|
+
export default Calender;
|
|
46
|
+
//# sourceMappingURL=calender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calender.js","sourceRoot":"","sources":["../../../modules/calender/calender.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,IAAI,MAAM,4BAA4B,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAQ,MAAM,UAAU,CAAA;AAE3C,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AAWxC,IAAM,QAAQ,GAAG,UAAC,KAAoB;IAE7B,IAAA,YAAY,GAAyB,KAAK,aAA9B,EAAE,mBAAmB,GAAI,KAAK,oBAAT,CAAU;IAE5C,IAAA,KAAoB,QAAQ,CAAS;QACzC,KAAK,EAAE,WAAW,CAAC,YAAY,EAAE,YAAY,CAAC;QAC9C,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;QAC/B,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;KACT,CAAC,EANK,KAAK,QAAA,EAAE,QAAQ,QAMpB,CAAC;IAEH,SAAS,CAAC;QACF,IAAA,KAA0B,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,EAArD,SAAS,eAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAgC,CAAC;QAC7D,QAAQ,uBACH,KAAK,KACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,IAAI,EAClB,IAAI,EAAE,IAAI,IACV,CAAA;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC;QACR,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CA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C,CAAC,EAAd,CAAc,EACnC,aAAa,EAAE,cAAM,OAAA,WAAW,CAAC,CAAC,CAAC,CAAC,EAAf,CAAe,EACpC,YAAY,SACZ,CACE,CACP,CAAC;AAEJ,CAAC,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calender.props.js","sourceRoot":"","sources":["../../../modules/calender/calender.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function chunk(array: any, size: any): any[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function slice(array, start, end) {
|
|
2
|
+
var length = array == null ? 0 : array.length;
|
|
3
|
+
if (!length) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
start = start == null ? 0 : start;
|
|
7
|
+
end = end === undefined ? length : end;
|
|
8
|
+
if (start < 0) {
|
|
9
|
+
start = -start > length ? 0 : length + start;
|
|
10
|
+
}
|
|
11
|
+
end = end > length ? length : end;
|
|
12
|
+
if (end < 0) {
|
|
13
|
+
end += length;
|
|
14
|
+
}
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
length = start > end ? 0 : (end - start) >>> 0;
|
|
17
|
+
start >>>= 0;
|
|
18
|
+
var index = -1;
|
|
19
|
+
var result = new Array(length);
|
|
20
|
+
while (++index < length) {
|
|
21
|
+
result[index] = array[index + start];
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
export function chunk(array, size) {
|
|
26
|
+
size = Math.max(size, 0);
|
|
27
|
+
var length = array == null ? 0 : array.length;
|
|
28
|
+
if (!length || size < 1) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
var index = 0;
|
|
32
|
+
var resIndex = 0;
|
|
33
|
+
var result = new Array(Math.ceil(length / size));
|
|
34
|
+
while (index < length) {
|
|
35
|
+
result[resIndex++] = slice(array, index, (index += size));
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|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AG,KAAK,CAAC,CAAC;KACtC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AACD,MAAM,UAAU,KAAK,CAAC,KAAU,EAAE,IAAS;IACzC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACzB,IAAM,MAAM,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAChD,IAAI,CAAC,MAAM,IAAI,IAAI,GAAG,CAAC,EAAE;QACvB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAM,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAEnD,OAAO,KAAK,GAAG,MAAM,EAAE;QACrB,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC;KAC3D;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Moment } from "jalali-moment";
|
|
2
|
+
export interface IDays {
|
|
3
|
+
day: string;
|
|
4
|
+
utc: string;
|
|
5
|
+
faDate: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IDaysInMonth {
|
|
9
|
+
days: IDays[];
|
|
10
|
+
monthName: string;
|
|
11
|
+
month: number;
|
|
12
|
+
today?: string;
|
|
13
|
+
year: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const daysInMonth: (date: Moment) => IDaysInMonth;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import jalaiMoment from "jalali-moment";
|
|
3
|
+
import moment from 'moment';
|
|
4
|
+
var checkDateMonth = function (date, current) { return current.jMonth() < date.jMonth(); };
|
|
5
|
+
var checkCurrentMonth = function (date) {
|
|
6
|
+
return jalaiMoment().format("jYYYY/jMM") === date.format("jYYYY/jMM");
|
|
7
|
+
};
|
|
8
|
+
export var daysInMonth = function (date) {
|
|
9
|
+
var days = [];
|
|
10
|
+
var clonedDate = date.clone();
|
|
11
|
+
var monthName = "".concat(clonedDate.locale("fa").format("jMMMM"));
|
|
12
|
+
var year = "".concat(clonedDate.locale("fa").format("jYYYY"));
|
|
13
|
+
var month = Number(date
|
|
14
|
+
.clone()
|
|
15
|
+
.locale("fa")
|
|
16
|
+
.format("jM"));
|
|
17
|
+
var firstDayOfWeek = date.clone().startOf("jMonth");
|
|
18
|
+
var lastDayOfWeek = date.clone().endOf("jMonth");
|
|
19
|
+
var today = checkCurrentMonth(date) ? { today: date.format("jDD") } : null;
|
|
20
|
+
firstDayOfWeek.subtract((firstDayOfWeek.day() + 1) % 7, "days");
|
|
21
|
+
while (firstDayOfWeek.isBefore(lastDayOfWeek)) {
|
|
22
|
+
days.push({
|
|
23
|
+
day: firstDayOfWeek.format("jDD"),
|
|
24
|
+
utc: moment(new Date(firstDayOfWeek.toString())).format("YYYY-MM-DD"),
|
|
25
|
+
faDate: firstDayOfWeek.format("jYYYY/jMM/jDD"),
|
|
26
|
+
disabled: checkDateMonth(date, firstDayOfWeek)
|
|
27
|
+
});
|
|
28
|
+
firstDayOfWeek.add(1, "days");
|
|
29
|
+
}
|
|
30
|
+
return __assign({ monthName: monthName, month: month, days: days, year: year }, today);
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=daysIn-month.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daysIn-month.js","sourceRoot":"","sources":["../../../../modules/calender/config/daysIn-month.ts"],"names":[],"mappings":";AAAA,OAAO,WAAqB,MAAM,eAAe,CAAC;AAClD,OAAO,MAAM,MAAM,QAAQ,CAAA;AAiB3B,IAAM,cAAc,G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AAQ,CAAC,aAAa,CAAC,EAAE;QAC7C,IAAI,CAAC,IAAI,CAAC;YACR,GAAG,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC;YACjC,GAAG,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;YACrE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,eAAe,CAAC;YAC9C,QAAQ,EAAE,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC;SAC/C,CAAC,CAAC;QACH,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;KAC/B;IACD,kBAAQ,SAAS,WAAA,EAAE,KAAK,OAAA,EAAE,IAAI,MAAA,EAAE,IAAI,MAAA,IAAK,KAAK,EAAE;AAClD,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { fa, formatJalaliDate, weekDayNames } from "./week-day";
|
|
2
|
+
import { chunk } from './chunk';
|
|
3
|
+
import { daysInMonth, IDays, IDaysInMonth } from './daysIn-month';
|
|
4
|
+
export { daysInMonth, fa, formatJalaliDate, weekDayNames, chunk };
|
|
5
|
+
export type { IDaysInMonth, IDays, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/calender/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAE,gBAAgB,EAAE,YAAY,EAAC,MAAM,YAAY,CAAA;AAC7D,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAC,WAAW,EAAsB,MAAM,gBAAgB,CAAA;AAE/D,OAAO,EACL,WAAW,EACX,EAAE,EACF,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACN,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import moment from "jalali-moment";
|
|
2
|
+
export var fa = function (n) {
|
|
3
|
+
if (process.env.NODE_ENV === "test") {
|
|
4
|
+
return n;
|
|
5
|
+
}
|
|
6
|
+
return Number(n).toLocaleString("fa", {
|
|
7
|
+
useGrouping: false
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export var weekDayNames = ["ش", "ی", "د", "س", "چ", "پ", "ج"];
|
|
11
|
+
export var formatJalaliDate = function (date) {
|
|
12
|
+
var formattedDate = moment("".concat(date), "jYYYY/jMM/jDD");
|
|
13
|
+
if (formattedDate.isValid()) {
|
|
14
|
+
return formattedDate;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=week-day.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"week-day.js","sourceRoot":"","sources":["../../../../modules/calender/config/week-day.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AAEnC,MAAM,CAAC,IAAM,EAAE,GAAG,UAAC,CAAM;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;QACnC,OAAO,CAAC,CAAC;KACV;IACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE;QACpC,WAAW,EAAE,KAAK;KACnB,CAAC,CAAC;AACL,CAAC,CAAC;AACF,MAAM,CAAC,IAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAChE,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,IAAS;IACxC,IAAM,aAAa,GAAG,MAAM,CAAC,UAAG,IAAI,CAAE,EAAE,eAAe,CAAC,CAAC;IACzD,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE;QAC3B,OAAO,aAAa,CAAC;KACtB;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/calender/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAC5C,OAAO,cAAc,MAAM,mBAAmB,CAAA;AAC9C,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EACL,YAAY,EACZ,aAAa,EACb,cAAc,EACf,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../modules/calender/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAA;AAEjC,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DAY_CONTAINER, NORMAL_DAY } from "./day.style";
|
|
4
|
+
import classNames from '../../../../utils/class-names';
|
|
5
|
+
import { Button } from '@pezeshk-book/ui-kit';
|
|
6
|
+
export var Day = function (props) {
|
|
7
|
+
var daysEvent = props.daysEvent, children = props.children, disabledDay = props.disabledDay, holidays = props.holidays, passedDay = props.passedDay, selectedDay = props.selectedDay;
|
|
8
|
+
if (!children) {
|
|
9
|
+
return React.createElement(Button, __assign({ variant: 'text', size: 'tiny', shape: 'circle', className: classNames(DAY_CONTAINER, 'cursor-default') }, props));
|
|
10
|
+
}
|
|
11
|
+
if (passedDay) {
|
|
12
|
+
return React.createElement(Button, __assign({ size: 'tiny', variant: 'text', color: 'tertiary', shape: 'circle', className: classNames(DAY_CONTAINER, 'hover:text-secondary-dark cursor-default') }, props));
|
|
13
|
+
}
|
|
14
|
+
if (disabledDay || holidays) {
|
|
15
|
+
return React.createElement(Button, __assign({ size: 'tiny', color: 'danger', shape: 'circle', className: classNames(DAY_CONTAINER, 'cursor-default') }, props));
|
|
16
|
+
}
|
|
17
|
+
return React.createElement(Button, __assign({ variant: selectedDay ? 'contained' : 'text', size: 'tiny', shape: 'circle', color: 'purple', className: classNames(DAY_CONTAINER, NORMAL_DAY(selectedDay)
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
) }, props, daysEvent ? daysEvent() : null));
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=day.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day.js","sourceRoot":"","sources":["../../../../../modules/calender/sub-components/day/day.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,UAAU,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAA;AAE3C,MAAM,CAAC,IAAM,GAAG,GAAG,UAAC,KAAe;IAC1B,IAAA,SAAS,GAA6D,KAAK,UAAlE,EAAE,QAAQ,GAAmD,KAAK,SAAxD,EAAE,WAAW,GAAsC,KAAK,YAA3C,EAAE,QAAQ,GAA4B,KAAK,SAAjC,EAAE,SAAS,GAAiB,KAAK,UAAtB,EAAE,WAAW,GAAI,KAAK,YAAT,CAAU;IAEnF,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,oBAAC,MAAM,aAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAClF,aAAa,EACb,gBAAgB,CACjB,IAAM,KAAK,EAAI,CAAA;KACjB;IACD,IAAI,SAAS,EAAE;QACb,OAAO,oBAAC,MAAM,aAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CACrG,aAAa,EACb,0CAA0C,CAC3C,IAAM,KAAK,EAAI,CAAA;KACjB;IACD,IAAI,WAAW,IAAI,QAAQ,EAAE;QAC3B,OAAO,oBAAC,MAAM,aAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAClF,aAAa,EACb,gBAAgB,CACjB,IAAM,KAAK,EAAI,CAAC;KAClB;IACD,OAAO,oBAAC,MAAM,aAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAC/H,aAAa,EACb,UAAU,CAAC,WAAW,CAAC;QACvB,aAAa;SACd,IAAM,KAAK,EAAM,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,EAAI,CAAA;AACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day.props.js","sourceRoot":"","sources":["../../../../../modules/calender/sub-components/day/day.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 text-m-lg';
|
|
2
|
+
export var NORMAL_DAY = function (selectedDay) {
|
|
3
|
+
if (selectedDay) {
|
|
4
|
+
return 'text-white';
|
|
5
|
+
}
|
|
6
|
+
return 'text-black hover:text-black';
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=day.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day.style.js","sourceRoot":"","sources":["../../../../../modules/calender/sub-components/day/day.style.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,aAAa,GAAG,qHAAqH,CAAA;AAGlJ,MAAM,CAAC,IAAM,UAAU,GAAG,UAAC,WAAqB;IAC9C,IAAI,WAAW,EAAE;QACf,OAAO,YAAY,CAAA;KACpB;IAED,OAAO,6BAA6B,CAAA;AACtC,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import DaysHead from "../days-head/days-head";
|
|
4
|
+
import { Day } from "../day/day";
|
|
5
|
+
import { chunk, fa, weekDayNames } from '../../config';
|
|
6
|
+
import moment from "jalali-moment";
|
|
7
|
+
import { convertDate } from "../../../../utils/time-helper";
|
|
8
|
+
import { Div, Text } from '@pezeshk-book/ui-kit';
|
|
9
|
+
var boolDataset = function (arg) {
|
|
10
|
+
if (arg) {
|
|
11
|
+
return {
|
|
12
|
+
"data-disable": arg
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
var tempHolidays = ['2022-09-17', '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
|
+
var Days = function (props) {
|
|
19
|
+
var days = props.days, daysEventListeners = props.daysEventListeners, monthName = props.monthName, increaseMonth = props.increaseMonth, decreaseMonth = props.decreaseMonth, selectedDay = props.selectedDay, year = props.year;
|
|
20
|
+
if (!days.length) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
var weeks = chunk(days, 7);
|
|
24
|
+
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' },
|
|
25
|
+
React.createElement(DaysHead, { year: year, monthName: monthName, increaseMonth: increaseMonth, decreaseMonth: decreaseMonth }),
|
|
26
|
+
React.createElement(Div, { className: 'flex-col items-center flex-1 border-separate border-spacing-x-2', "data-testid": "days-wrapper" },
|
|
27
|
+
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: "grey.300", key: name }, name)); })),
|
|
28
|
+
weeks.map(function (week, idx) { return (React.createElement("ul", { className: 'flex m-0 px-2 md:px-0 list-none w-full items-end justify-start self-center', "data-testid": "days", key: "rdp-weeks-".concat(idx) }, week.map(function (day, id) { return (React.createElement(Day, __assign({ key: day.utc, passedDay: convertDate(Date.now(), 'YYYY/MM/DD') === day.faDate ? false : !moment(day.faDate).isAfter(convertDate(Date.now(), 'YYYY/MM/DD')), holidays: tempHolidays.indexOf(day.utc) !== -1, "data-testid": "day-".concat(idx * 7 + id + 1), "data-fadate": "".concat(day.faDate), daysEvent: daysEventListeners, disabledDay: week.length === 7 && id === 6, selectedDay: selectedDay === day.faDate }, boolDataset(day.disabled)), !day.disabled ? fa(day.day) : null)); }))); }))));
|
|
29
|
+
};
|
|
30
|
+
Days.defaultProps = {
|
|
31
|
+
monthName: "",
|
|
32
|
+
disableDays: []
|
|
33
|
+
};
|
|
34
|
+
export default Days;
|
|
35
|
+
//# sourceMappingURL=days.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"days.js","sourceRoot":"","sources":["../../../../../modules/calender/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,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,sBAAsB,CAAA;AAG9C,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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O,IAAK,OAAA,CACjC,oBAAC,GAAG,aACF,GAAG,EAAE,GAAG,CAAC,GAAG,EACZ,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC,EAC5I,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,iBACjC,cAAO,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAE,iBACzB,UAAG,GAAG,CAAC,MAAM,CAAE,EAC5B,SAAS,EAAE,kBAAkB,EAC7B,WAAW,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAC1C,WAAW,EAAE,WAAW,KAAK,GAAG,CAAC,MAAM,IACnC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,GAE5B,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC/B,CACP,EAdkC,CAclC,CAAC,CACC,CACN,EAlByB,CAkBzB,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"days.props.js","sourceRoot":"","sources":["../../../../../modules/calender/sub-components/days/days.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import moment from "jalali-moment";
|
|
3
|
+
import { fa } from "../../config";
|
|
4
|
+
import { Button, Div, Text } from '@pezeshk-book/ui-kit';
|
|
5
|
+
import { ArrowLeftIcon, ArrowRightIcon, CalendarIcon } from '../../icons';
|
|
6
|
+
var DaysHead = function (props) {
|
|
7
|
+
var decreaseMonth = props.decreaseMonth, increaseMonth = props.increaseMonth, monthName = props.monthName, endDate = props.endDate, startDate = props.startDate, year = props.year;
|
|
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;
|
|
10
|
+
return (React.createElement(Div, { className: 'flex-wrap justify-center items-center bg-white w-[318px] md:w-[488px] self-center mb-5' },
|
|
11
|
+
React.createElement(Div, { className: 'w-full items-center justify-between h-12 px-4' },
|
|
12
|
+
React.createElement(Div, null,
|
|
13
|
+
React.createElement(Text, { color: 'grey.900', typography: 'lg', type: "medium" },
|
|
14
|
+
"\u0633\u0627\u0644 ",
|
|
15
|
+
year)),
|
|
16
|
+
React.createElement(Div, { className: 'items-center mr-8' },
|
|
17
|
+
React.createElement(Button, { variant: "text", size: 'small', className: 'flex items-center', onClick: increaseMonth, shape: 'circle', disabled: forward },
|
|
18
|
+
React.createElement(Div, { className: 'h-3 w-[6px] relative' },
|
|
19
|
+
React.createElement("img", { src: ArrowLeftIcon, className: 'w-full h-full object-contain', alt: 'ماه بعد' }))),
|
|
20
|
+
React.createElement(Text, { className: 'mx-1', color: "grey.900", type: 'bold', typography: "xxxl" }, monthName),
|
|
21
|
+
React.createElement(Button, { variant: "text", size: 'small', className: 'flex items-center', onClick: decreaseMonth, shape: 'circle', disabled: backDisable },
|
|
22
|
+
React.createElement(Div, { className: 'h-3 w-[6px] relative' },
|
|
23
|
+
React.createElement("img", { src: ArrowRightIcon, className: 'w-full h-full object-contain', alt: 'ماه قبل' })))),
|
|
24
|
+
React.createElement(Div, { className: 'relative w-[19px] h-[22px]' },
|
|
25
|
+
React.createElement("img", { src: CalendarIcon, alt: 'تقویم' })))));
|
|
26
|
+
};
|
|
27
|
+
export default DaysHead;
|
|
28
|
+
//# sourceMappingURL=days-head.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"days-head.js","sourceRoot":"","sources":["../../../../../modules/calender/sub-components/days-head/days-head.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAChC,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,GAAwD,KAAK,cAA7D,EAAE,aAAa,GAAyC,KAAK,cAA9C,EAAE,SAAS,GAA8B,KAAK,UAAnC,EAAE,OAAO,GAAqB,KAAK,QAA1B,EAAE,SAAS,GAAU,KAAK,UAAf,EAAE,IAAI,GAAI,KAAK,KAAT,CAAU;IAElF,IAAM,WAAW,GAAG,UAAG,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,cAAI,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAE,KAAK,SAAS,CAAA;IAE9H,IAAM,OAAO,GAAG,UAAG,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,cAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAE,KAAK,SAAS,CAAA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CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"days-head.props.js","sourceRoot":"","sources":["../../../../../modules/calender/sub-components/days-head/days-head.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../modules/slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAA;AAE7B,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SliderProps } from './slider.props';
|
|
3
|
+
declare const Slider: ({ children, delay, spaceBetween, slides, infiniteLoop, pauseOnMouseOver, autoMove, indicatorActiveColor, indicator, navigation, prevNavigation, nextNavigation, }: SliderProps) => JSX.Element;
|
|
4
|
+
export default Slider;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
var Slider = function (_a) {
|
|
3
|
+
var children = _a.children, _b = _a.delay, delay = _b === void 0 ? 2500 : _b, _c = _a.spaceBetween, spaceBetween = _c === void 0 ? 0 : _c, _d = _a.slides, slides = _d === void 0 ? 1 : _d, _e = _a.infiniteLoop, infiniteLoop = _e === void 0 ? false : _e, _f = _a.pauseOnMouseOver, pauseOnMouseOver = _f === void 0 ? false : _f, _g = _a.autoMove, autoMove = _g === void 0 ? true : _g, _h = _a.indicatorActiveColor, indicatorActiveColor = _h === void 0 ? 'info' : _h, _j = _a.indicator, indicator = _j === void 0 ? true : _j, _k = _a.navigation, navigation = _k === void 0 ? true : _k, prevNavigation = _a.prevNavigation, nextNavigation = _a.nextNavigation;
|
|
4
|
+
var _l = React.useState(infiniteLoop ? slides : 0), currentIndex = _l[0], setCurrentIndex = _l[1];
|
|
5
|
+
var _m = useState(children.length), length = _m[0], setLength = _m[1];
|
|
6
|
+
var _o = useState(infiniteLoop && children.length > slides), isRepeating = _o[0], setIsRepeating = _o[1];
|
|
7
|
+
var _p = useState(true), transitionEnabled = _p[0], setTransitionEnabled = _p[1];
|
|
8
|
+
var _q = useState(null), touchPosition = _q[0], setTouchPosition = _q[1];
|
|
9
|
+
var _r = useState(false), pause = _r[0], setPause = _r[1];
|
|
10
|
+
var timeoutRef = React.useRef(null);
|
|
11
|
+
var ref = React.useRef(null);
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
setLength(children.length);
|
|
14
|
+
setIsRepeating(infiniteLoop && children.length > slides);
|
|
15
|
+
}, [children, infiniteLoop, slides]);
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
if (isRepeating) {
|
|
18
|
+
if (currentIndex === slides || currentIndex === length) {
|
|
19
|
+
setTransitionEnabled(true);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, [currentIndex, isRepeating, slides, length]);
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
if (!pause && autoMove) {
|
|
26
|
+
resetTimeout();
|
|
27
|
+
timeoutRef.current = setTimeout(function () { return next(); }, delay);
|
|
28
|
+
return function () {
|
|
29
|
+
resetTimeout();
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}, [currentIndex, delay, pause]);
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
if (ref.current) {
|
|
35
|
+
for (var _i = 0, _a = ref.current.children; _i < _a.length; _i++) {
|
|
36
|
+
var arg = _a[_i];
|
|
37
|
+
arg.style.width = "calc((100% / ".concat(slides, ") - (").concat(spaceBetween, "px))");
|
|
38
|
+
arg.style.marginLeft = "".concat(spaceBetween / 2, "px");
|
|
39
|
+
arg.style.marginRight = "".concat(spaceBetween / 2, "px");
|
|
40
|
+
arg.style.flexShrink = 0;
|
|
41
|
+
arg.style.flexGrow = 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [slides, spaceBetween]);
|
|
45
|
+
var resetTimeout = function () {
|
|
46
|
+
if (timeoutRef.current) {
|
|
47
|
+
clearTimeout(timeoutRef.current);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var next = function () {
|
|
51
|
+
if (isRepeating || currentIndex < (length - slides) + 1) {
|
|
52
|
+
setCurrentIndex(function (prevState) { return prevState + 1; });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var prev = function () {
|
|
56
|
+
if (isRepeating || currentIndex > 0) {
|
|
57
|
+
setCurrentIndex(function (prevState) { return prevState - 1; });
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var handleTouchStart = function (e) {
|
|
61
|
+
var touchDown = e.touches[0].clientX;
|
|
62
|
+
setTouchPosition(touchDown);
|
|
63
|
+
};
|
|
64
|
+
var handleTouchMove = function (e) {
|
|
65
|
+
var touchDown = touchPosition;
|
|
66
|
+
if (touchDown === null) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
var currentTouch = e.touches[0].clientX;
|
|
70
|
+
var diff = touchDown - currentTouch;
|
|
71
|
+
if (diff > 5) {
|
|
72
|
+
next();
|
|
73
|
+
}
|
|
74
|
+
if (diff < -5) {
|
|
75
|
+
prev();
|
|
76
|
+
}
|
|
77
|
+
setTouchPosition(null);
|
|
78
|
+
};
|
|
79
|
+
var handleTransitionEnd = function () {
|
|
80
|
+
if (isRepeating) {
|
|
81
|
+
if (currentIndex === 0) {
|
|
82
|
+
setTransitionEnabled(false);
|
|
83
|
+
setCurrentIndex(length);
|
|
84
|
+
}
|
|
85
|
+
else if (currentIndex === length + slides) {
|
|
86
|
+
setTransitionEnabled(false);
|
|
87
|
+
setCurrentIndex(slides);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var renderExtraPrev = function () {
|
|
92
|
+
var output = [];
|
|
93
|
+
for (var index = 0; index < slides; index++) {
|
|
94
|
+
output.push(children[length - 1 - index]);
|
|
95
|
+
}
|
|
96
|
+
output.reverse();
|
|
97
|
+
return output;
|
|
98
|
+
};
|
|
99
|
+
var renderExtraNext = function () {
|
|
100
|
+
var output = [];
|
|
101
|
+
for (var index = 0; index < slides; index++) {
|
|
102
|
+
output.push(children[index]);
|
|
103
|
+
}
|
|
104
|
+
return output;
|
|
105
|
+
};
|
|
106
|
+
var handlePauseAutoMove = function (state) {
|
|
107
|
+
if (pauseOnMouseOver) {
|
|
108
|
+
setPause(state);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return (React.createElement("div", { className: 'w-full flex flex-col', onMouseOver: function () { return handlePauseAutoMove(true); }, onMouseLeave: function () { return handlePauseAutoMove(false); } },
|
|
112
|
+
React.createElement("div", { className: 'flex w-full relative' },
|
|
113
|
+
(isRepeating || currentIndex > 0) && navigation && !prevNavigation ? (React.createElement("button", { onClick: prev, className: 'absolute top-1/2 z-10 w-12 h-12 rounded-full bg-white border border-grey-200 left-6' }, "<")) : null,
|
|
114
|
+
prevNavigation && (isRepeating || currentIndex > 0) ? (React.createElement(React.Fragment, null, prevNavigation(prev))) : null,
|
|
115
|
+
React.createElement("div", { className: 'overflow-hidden w-full h-full', onTouchStart: handleTouchStart, onTouchMove: handleTouchMove },
|
|
116
|
+
React.createElement("div", { className: "flex transition ease-linear duration-300 shrink-0 grow w-full", style: {
|
|
117
|
+
transform: "translateX(-".concat(currentIndex * (100 / slides), "%)"),
|
|
118
|
+
transition: !transitionEnabled ? 'none' : undefined
|
|
119
|
+
}, onTransitionEnd: handleTransitionEnd, ref: ref },
|
|
120
|
+
(length > slides && isRepeating) &&
|
|
121
|
+
renderExtraPrev(),
|
|
122
|
+
children,
|
|
123
|
+
(length > slides && isRepeating) &&
|
|
124
|
+
renderExtraNext())),
|
|
125
|
+
(isRepeating || currentIndex < (length - slides)) && navigation && !nextNavigation ? (React.createElement("button", { onClick: next, className: "absolute top-1/2 z-10 w-12 h-12 rounded-full bg-white border border-grey-200 right-6" }, ">")) : null,
|
|
126
|
+
nextNavigation && (isRepeating || currentIndex < (length - slides)) ? (React.createElement(React.Fragment, null, nextNavigation(next))) : null),
|
|
127
|
+
indicator ? (React.createElement("div", { className: 'flex self-center items-center justify-center' }, children.map(function (_, idx) {
|
|
128
|
+
var indicatorClass = "inline-block w-5 h-5 rounded-full cursor-pointer mt-20 mx-2 mb-0 ".concat(infiniteLoop ? currentIndex === idx + slides ? "bg-".concat(indicatorActiveColor) : "bg-grey-100" : currentIndex === idx ? "bg-".concat(indicatorActiveColor) : "bg-grey-100");
|
|
129
|
+
return (React.createElement("div", { key: idx, className: indicatorClass, onClick: function () {
|
|
130
|
+
setCurrentIndex(infiniteLoop ? idx + 1 : idx);
|
|
131
|
+
} }));
|
|
132
|
+
}))) : null));
|
|
133
|
+
};
|
|
134
|
+
export default Slider;
|
|
135
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../modules/slider/slider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAGhD,IAAM,MAAM,GAAG,UACb,EAac;QAZZ,QAAQ,cAAA,EACR,aAAY,EAAZ,KAAK,mBAAG,IAAI,KAAA,EACZ,oBAAgB,EAAhB,YAAY,mBAAG,CAAC,KAAA,EAChB,cAAU,EAAV,MAAM,mBAAG,CAAC,KAAA,EACV,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA,EACpB,wBAAwB,EAAxB,gBAAgB,mBAAG,KAAK,KAAA,EACxB,gBAAe,EAAf,QAAQ,mBAAG,IAAI,KAAA,EACf,4BAA6B,EAA7B,oBAAoB,mBAAG,MAAM,KAAA,EAC7B,iBAAgB,EAAhB,SAAS,mBAAG,IAAI,KAAA,EAChB,kBAAiB,EAAjB,UAAU,mBAAG,IAAI,KAAA,EACjB,cAAc,oBAAA,EACd,cAAc,oBAAA;IAGV,IAAA,KAAkC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,E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AE;oBACP,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAChD,CAAC,GACD,CACH,CAAA;QACH,CAAC,CAAC,CACE,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SliderProps {
|
|
2
|
+
children: any;
|
|
3
|
+
delay?: number;
|
|
4
|
+
spaceBetween?: number;
|
|
5
|
+
slides?: number;
|
|
6
|
+
infiniteLoop?: boolean;
|
|
7
|
+
pauseOnMouseOver?: boolean;
|
|
8
|
+
autoMove?: boolean;
|
|
9
|
+
indicator?: boolean;
|
|
10
|
+
indicatorActiveColor?: 'primary' | 'secondary' | 'tertiary' | "info" | 'success' | 'warning' | 'danger' | 'purple' | 'control';
|
|
11
|
+
navigation?: boolean;
|
|
12
|
+
nextNavigation?: (onClick: any) => any;
|
|
13
|
+
prevNavigation?: (onClick: any) => any;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.props.js","sourceRoot":"","sources":["../../../modules/slider/slider.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-names.js","sourceRoot":"","sources":["../../utils/class-names.ts"],"names":[],"mappings":"AAAA,IAAM,UAAU,GAAG;IAAC,iBAAiD;SAAjD,UAAiD,EAAjD,qBAAiD,EAAjD,IAAiD;QAAjD,4BAAiD;;IACnE,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC,CAAA;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const addDays: (date: any, number: number) => Date;
|
|
2
|
+
export declare const convertDate: (date: string | number | Date, format?: string) => any;
|
|
3
|
+
export declare const timeDifference: (date: Date) => number;
|
|
4
|
+
export declare const timeIsAfter: (date: string | Date, timeDestination?: string | Date) => any;
|
|
5
|
+
export declare const momentFormat: (format: string) => any;
|
|
6
|
+
export declare const timePassed: (date: Date) => any;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 convertDate = function (date, format) {
|
|
6
|
+
if (format === void 0) { format = "YYYY-MM-DD"; }
|
|
7
|
+
if (date) {
|
|
8
|
+
var moment_1 = require('jalali-moment');
|
|
9
|
+
return moment_1(date).locale('fa').format(format);
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
};
|
|
13
|
+
export var timeDifference = function (date) {
|
|
14
|
+
if (date) {
|
|
15
|
+
var moment_2 = require('jalali-moment');
|
|
16
|
+
return Math.abs(moment_2().diff(date, 'seconds'));
|
|
17
|
+
}
|
|
18
|
+
return 0;
|
|
19
|
+
};
|
|
20
|
+
export var timeIsAfter = function (date, timeDestination) {
|
|
21
|
+
if (timeDestination === void 0) { timeDestination = new Date(); }
|
|
22
|
+
if (date) {
|
|
23
|
+
var moment_3 = require('moment');
|
|
24
|
+
return moment_3(date).isAfter(timeDestination);
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
export var momentFormat = function (format) {
|
|
29
|
+
var moment = require('moment');
|
|
30
|
+
return (moment(new Date().getTime()).format(format));
|
|
31
|
+
};
|
|
32
|
+
export var timePassed = function (date) {
|
|
33
|
+
if (date) {
|
|
34
|
+
var moment_4 = require('jalali-moment');
|
|
35
|
+
return moment_4(date).locale("fa").fromNow();
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=time-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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G,UAAC,MAAc;IACzC,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,UAAU,GAAG,UAAC,IAAU;IACnC,IAAI,IAAI,EAAE;QACR,IAAI,QAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;QACtC,OAAO,QAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;KAC5C;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pezeshk-book/modules",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "./dist/index.ts",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"author": "Armin Shapouri, PezeshkBook Company",
|
|
8
|
+
"description": "Slider Module for use in React or Next.js.",
|
|
9
|
+
"homepage": "https://pbkit.pezeshkbook.com",
|
|
10
|
+
"babel": {
|
|
11
|
+
"presets": [
|
|
12
|
+
"@babel/preset-react"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"calendar",
|
|
21
|
+
"react",
|
|
22
|
+
"nextjs",
|
|
23
|
+
"react-component",
|
|
24
|
+
"tailwind"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@babel/polyfill": "^7.12.1",
|
|
28
|
+
"autoprefixer": "^10.4.13",
|
|
29
|
+
"postcss": "^8.4.20",
|
|
30
|
+
"tailwindcss": "^3.2.4",
|
|
31
|
+
"@pezeshk-book/ui-kit": "^0.1.64"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": "^18.2.0",
|
|
35
|
+
"react-dom": "^18.2.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/jest": "^27.5.2",
|
|
39
|
+
"@types/node": "^16.18.10",
|
|
40
|
+
"@types/react": "^18.0.26",
|
|
41
|
+
"@types/react-dom": "^18.0.10",
|
|
42
|
+
"prop-types": "^15.8.1",
|
|
43
|
+
"react": "^18.2.0",
|
|
44
|
+
"react-dom": "^18.2.0",
|
|
45
|
+
"react-scripts": "5.0.1",
|
|
46
|
+
"typescript": "^4.9.4"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"start": "react-scripts start",
|
|
50
|
+
"test": "react-scripts test",
|
|
51
|
+
"eject": "react-scripts eject"
|
|
52
|
+
},
|
|
53
|
+
"eslintConfig": {
|
|
54
|
+
"extends": [
|
|
55
|
+
"react-app",
|
|
56
|
+
"react-app/jest"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"browserslist": [
|
|
60
|
+
">0.2%",
|
|
61
|
+
"not dead",
|
|
62
|
+
"not op_mini all"
|
|
63
|
+
]
|
|
64
|
+
}
|