@chayns-components/date 5.0.0-beta.1000
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 +21 -0
- package/README.md +34 -0
- package/lib/cjs/components/calendar/Calendar.js +314 -0
- package/lib/cjs/components/calendar/Calendar.js.map +1 -0
- package/lib/cjs/components/calendar/Calendar.styles.js +34 -0
- package/lib/cjs/components/calendar/Calendar.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js +158 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js +23 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.js +65 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.styles.js +26 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +129 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +16 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +63 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +114 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +17 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +18 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +42 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +16 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +15 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +17 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-year-pickers/MonthYearPickers.js +86 -0
- package/lib/cjs/components/calendar/month-year-pickers/MonthYearPickers.js.map +1 -0
- package/lib/cjs/components/date-info/DateInfo.js +35 -0
- package/lib/cjs/components/date-info/DateInfo.js.map +1 -0
- package/lib/cjs/components/opening-times/OpeningTimes.js +246 -0
- package/lib/cjs/components/opening-times/OpeningTimes.js.map +1 -0
- package/lib/cjs/components/opening-times/OpeningTimes.styles.js +28 -0
- package/lib/cjs/components/opening-times/OpeningTimes.styles.js.map +1 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.js +19 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.js.map +1 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.styles.js +24 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.styles.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js +153 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js +24 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js +106 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +41 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
- package/lib/cjs/hooks/useDateInfo.js +63 -0
- package/lib/cjs/hooks/useDateInfo.js.map +1 -0
- package/lib/cjs/index.js +177 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types/calendar.js +28 -0
- package/lib/cjs/types/calendar.js.map +1 -0
- package/lib/cjs/types/dateinfo.js +2 -0
- package/lib/cjs/types/dateinfo.js.map +1 -0
- package/lib/cjs/types/openingTimes.js +18 -0
- package/lib/cjs/types/openingTimes.js.map +1 -0
- package/lib/cjs/utils/calendar.js +73 -0
- package/lib/cjs/utils/calendar.js.map +1 -0
- package/lib/cjs/utils/date.js +114 -0
- package/lib/cjs/utils/date.js.map +1 -0
- package/lib/cjs/utils/dateInfo.js +126 -0
- package/lib/cjs/utils/dateInfo.js.map +1 -0
- package/lib/esm/components/calendar/Calendar.js +306 -0
- package/lib/esm/components/calendar/Calendar.js.map +1 -0
- package/lib/esm/components/calendar/Calendar.styles.js +33 -0
- package/lib/esm/components/calendar/Calendar.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js +150 -0
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js +22 -0
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/Month.js +61 -0
- package/lib/esm/components/calendar/month-wrapper/month/Month.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/Month.styles.js +22 -0
- package/lib/esm/components/calendar/month-wrapper/month/Month.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +121 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +9 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +54 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +123 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +13 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +14 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +34 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +9 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +11 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +13 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-year-pickers/MonthYearPickers.js +79 -0
- package/lib/esm/components/calendar/month-year-pickers/MonthYearPickers.js.map +1 -0
- package/lib/esm/components/date-info/DateInfo.js +28 -0
- package/lib/esm/components/date-info/DateInfo.js.map +1 -0
- package/lib/esm/components/opening-times/OpeningTimes.js +240 -0
- package/lib/esm/components/opening-times/OpeningTimes.js.map +1 -0
- package/lib/esm/components/opening-times/OpeningTimes.styles.js +24 -0
- package/lib/esm/components/opening-times/OpeningTimes.styles.js.map +1 -0
- package/lib/esm/components/opening-times/hint-text/HintText.js +12 -0
- package/lib/esm/components/opening-times/hint-text/HintText.js.map +1 -0
- package/lib/esm/components/opening-times/hint-text/HintText.styles.js +23 -0
- package/lib/esm/components/opening-times/hint-text/HintText.styles.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.js +149 -0
- package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.styles.js +22 -0
- package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.js +99 -0
- package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +40 -0
- package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
- package/lib/esm/hooks/useDateInfo.js +57 -0
- package/lib/esm/hooks/useDateInfo.js.map +1 -0
- package/lib/esm/index.js +15 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types/calendar.js +22 -0
- package/lib/esm/types/calendar.js.map +1 -0
- package/lib/esm/types/dateinfo.js +2 -0
- package/lib/esm/types/dateinfo.js.map +1 -0
- package/lib/esm/types/openingTimes.js +12 -0
- package/lib/esm/types/openingTimes.js.map +1 -0
- package/lib/esm/utils/calendar.js +63 -0
- package/lib/esm/utils/calendar.js.map +1 -0
- package/lib/esm/utils/date.js +89 -0
- package/lib/esm/utils/date.js.map +1 -0
- package/lib/esm/utils/dateInfo.js +120 -0
- package/lib/esm/utils/dateInfo.js.map +1 -0
- package/lib/types/components/calendar/Calendar.d.ts +97 -0
- package/lib/types/components/calendar/Calendar.styles.d.ts +8 -0
- package/lib/types/components/calendar/month-wrapper/MonthWrapper.d.ts +26 -0
- package/lib/types/components/calendar/month-wrapper/MonthWrapper.styles.d.ts +274 -0
- package/lib/types/components/calendar/month-wrapper/month/Month.d.ts +26 -0
- package/lib/types/components/calendar/month-wrapper/month/Month.styles.d.ts +8 -0
- package/lib/types/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.d.ts +20 -0
- package/lib/types/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.d.ts +1 -0
- package/lib/types/components/calendar/month-wrapper/month/day-wrapper/day/Day.d.ts +19 -0
- package/lib/types/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.d.ts +20 -0
- package/lib/types/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.d.ts +6 -0
- package/lib/types/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.d.ts +7 -0
- package/lib/types/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.d.ts +7 -0
- package/lib/types/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.d.ts +1 -0
- package/lib/types/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.d.ts +6 -0
- package/lib/types/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.d.ts +3 -0
- package/lib/types/components/calendar/month-year-pickers/MonthYearPickers.d.ts +19 -0
- package/lib/types/components/date-info/DateInfo.d.ts +5 -0
- package/lib/types/components/opening-times/OpeningTimes.d.ts +51 -0
- package/lib/types/components/opening-times/OpeningTimes.styles.d.ts +11 -0
- package/lib/types/components/opening-times/hint-text/HintText.d.ts +6 -0
- package/lib/types/components/opening-times/hint-text/HintText.styles.d.ts +3 -0
- package/lib/types/components/opening-times/opening-inputs/OpeningInputs.d.ts +46 -0
- package/lib/types/components/opening-times/opening-inputs/OpeningInputs.styles.d.ts +272 -0
- package/lib/types/components/opening-times/opening-inputs/opening-input/OpeningInput.d.ts +15 -0
- package/lib/types/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.d.ts +273 -0
- package/lib/types/hooks/useDateInfo.d.ts +2 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/types/calendar.d.ts +55 -0
- package/lib/types/types/dateinfo.d.ts +34 -0
- package/lib/types/types/openingTimes.d.ts +33 -0
- package/lib/types/utils/calendar.d.ts +18 -0
- package/lib/types/utils/date.d.ts +27 -0
- package/lib/types/utils/dateInfo.d.ts +14 -0
- package/package.json +86 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _WeekdayWrapper = require("./WeekdayWrapper.styles");
|
|
9
|
+
var _Weekday = _interopRequireDefault(require("./weekday/Weekday"));
|
|
10
|
+
var _date = require("../../../../../utils/date");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
const WeekdayWrapper = ({
|
|
15
|
+
locale
|
|
16
|
+
}) => {
|
|
17
|
+
const monday = (0, _date.startOfWeek)(new Date());
|
|
18
|
+
const sunday = (0, _date.endOfWeek)(new Date());
|
|
19
|
+
const weekdays = (0, _date.eachDayOfInterval)({
|
|
20
|
+
start: monday,
|
|
21
|
+
end: sunday
|
|
22
|
+
});
|
|
23
|
+
const weekdayElements = (0, _react.useMemo)(() => {
|
|
24
|
+
const items = [];
|
|
25
|
+
weekdays.forEach(day => {
|
|
26
|
+
const options = {
|
|
27
|
+
weekday: 'short'
|
|
28
|
+
};
|
|
29
|
+
const formatter = new Intl.DateTimeFormat(locale, options);
|
|
30
|
+
const formattedDay = formatter.format(day);
|
|
31
|
+
items.push(/*#__PURE__*/_react.default.createElement(_Weekday.default, {
|
|
32
|
+
key: `weekday-${formattedDay}`,
|
|
33
|
+
name: formattedDay
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
return items;
|
|
37
|
+
}, [locale, weekdays]);
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_WeekdayWrapper.StyledWeekdayWrapper, null, weekdayElements);
|
|
39
|
+
};
|
|
40
|
+
WeekdayWrapper.displayName = 'WeekdayWrapper';
|
|
41
|
+
var _default = exports.default = WeekdayWrapper;
|
|
42
|
+
//# sourceMappingURL=WeekdayWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeekdayWrapper.js","names":["_react","_interopRequireWildcard","require","_WeekdayWrapper","_Weekday","_interopRequireDefault","_date","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","WeekdayWrapper","locale","monday","startOfWeek","Date","sunday","endOfWeek","weekdays","eachDayOfInterval","start","end","weekdayElements","useMemo","items","forEach","day","options","weekday","formatter","Intl","DateTimeFormat","formattedDay","format","push","createElement","key","name","StyledWeekdayWrapper","displayName","_default","exports"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useMemo } from 'react';\nimport { StyledWeekdayWrapper } from './WeekdayWrapper.styles';\nimport Weekday from './weekday/Weekday';\nimport {Language} from \"chayns-api\";\nimport {eachDayOfInterval, endOfWeek, startOfWeek} from \"../../../../../utils/date\";\n\nexport type WeekdayWrapperProps = {\n locale?: Language;\n};\n\nconst WeekdayWrapper: FC<WeekdayWrapperProps> = ({ locale }) => {\n const monday = startOfWeek(new Date());\n const sunday = endOfWeek(new Date());\n const weekdays = eachDayOfInterval({ start: monday, end: sunday });\n\n const weekdayElements = useMemo(() => {\n const items: ReactElement[] = [];\n\n weekdays.forEach((day) => {\n const options: Intl.DateTimeFormatOptions = { weekday: 'short' };\n const formatter = new Intl.DateTimeFormat(locale, options);\n const formattedDay = formatter.format(day);\n\n items.push(<Weekday key={`weekday-${formattedDay}`} name={formattedDay} />);\n });\n\n return items;\n }, [locale, weekdays]);\n\n return <StyledWeekdayWrapper>{weekdayElements}</StyledWeekdayWrapper>;\n};\n\nWeekdayWrapper.displayName = 'WeekdayWrapper';\n\nexport default WeekdayWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAAoF,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,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EC,KAAK,EAAEP,MAAM;IAAEQ,GAAG,EAAEL;EAAO,CAAC,CAAC;EAElE,MAAMM,eAAe,GAAG,IAAAC,cAAO,EAAC,MAAM;IAClC,MAAMC,KAAqB,GAAG,EAAE;IAEhCN,QAAQ,CAACO,OAAO,CAAEC,GAAG,IAAK;MACtB,MAAMC,OAAmC,GAAG;QAAEC,OAAO,EAAE;MAAQ,CAAC;MAChE,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,cAAc,CAACnB,MAAM,EAAEe,OAAO,CAAC;MAC1D,MAAMK,YAAY,GAAGH,SAAS,CAACI,MAAM,CAACP,GAAG,CAAC;MAE1CF,KAAK,CAACU,IAAI,cAAClD,MAAA,CAAAS,OAAA,CAAA0C,aAAA,CAAC/C,QAAA,CAAAK,OAAO;QAAC2C,GAAG,EAAE,WAAWJ,YAAY,EAAG;QAACK,IAAI,EAAEL;MAAa,CAAE,CAAC,CAAC;IAC/E,CAAC,CAAC;IAEF,OAAOR,KAAK;EAChB,CAAC,EAAE,CAACZ,MAAM,EAAEM,QAAQ,CAAC,CAAC;EAEtB,oBAAOlC,MAAA,CAAAS,OAAA,CAAA0C,aAAA,CAAChD,eAAA,CAAAmD,oBAAoB,QAAEhB,eAAsC,CAAC;AACzE,CAAC;AAEDX,cAAc,CAAC4B,WAAW,GAAG,gBAAgB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhD,OAAA,GAE/BkB,cAAc","ignoreList":[]}
|
package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledWeekdayWrapper = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const StyledWeekdayWrapper = exports.StyledWeekdayWrapper = _styledComponents.default.div`
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-rows: repeat(1, 1fr);
|
|
12
|
+
grid-template-columns: repeat(7, 1fr);
|
|
13
|
+
padding-top: 6px;
|
|
14
|
+
margin: 0 15px;
|
|
15
|
+
`;
|
|
16
|
+
//# sourceMappingURL=WeekdayWrapper.styles.js.map
|
package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeekdayWrapper.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledWeekdayWrapper","exports","styled","div"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledWeekdayWrapper = styled.div`\n display: grid;\n grid-template-rows: repeat(1, 1fr);\n grid-template-columns: repeat(7, 1fr);\n padding-top: 6px;\n margin: 0 15px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGE,yBAAM,CAACC,GAAG;AAC9C;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Weekday = require("./Weekday.styles");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const Weekday = ({
|
|
11
|
+
name
|
|
12
|
+
}) => /*#__PURE__*/_react.default.createElement(_Weekday.StyledWeekday, null, name);
|
|
13
|
+
Weekday.displayName = 'Weekday';
|
|
14
|
+
var _default = exports.default = Weekday;
|
|
15
|
+
//# sourceMappingURL=Weekday.js.map
|
package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Weekday.js","names":["_react","_interopRequireDefault","require","_Weekday","e","__esModule","default","Weekday","name","createElement","StyledWeekday","displayName","_default","exports"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyledWeekday } from './Weekday.styles';\n\nexport type WeekdayProps = {\n name: string;\n};\n\nconst Weekday: FC<WeekdayProps> = ({ name }) => <StyledWeekday>{name}</StyledWeekday>;\n\nWeekday.displayName = 'Weekday';\n\nexport default Weekday;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAAiD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMjD,MAAMG,OAAyB,GAAGA,CAAC;EAAEC;AAAK,CAAC,kBAAKR,MAAA,CAAAM,OAAA,CAAAG,aAAA,CAACN,QAAA,CAAAO,aAAa,QAAEF,IAAoB,CAAC;AAErFD,OAAO,CAACI,WAAW,GAAG,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAP,OAAA,GAEjBC,OAAO","ignoreList":[]}
|
package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledWeekday = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const StyledWeekday = exports.StyledWeekday = _styledComponents.default.div`
|
|
10
|
+
color: ${({
|
|
11
|
+
theme
|
|
12
|
+
}) => theme.headline};
|
|
13
|
+
cursor: default;
|
|
14
|
+
font-size: 90%;
|
|
15
|
+
text-align: center;
|
|
16
|
+
`;
|
|
17
|
+
//# sourceMappingURL=Weekday.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Weekday.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledWeekday","exports","styled","div","theme","headline"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledWeekdayProps = WithTheme<unknown>;\n\nexport const StyledWeekday = styled.div<StyledWeekdayProps>`\n color: ${({ theme }: StyledWeekdayProps) => theme.headline};\n cursor: default;\n font-size: 90%;\n text-align: center;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIhC,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,yBAAM,CAACC,GAAuB;AAC3D,aAAa,CAAC;EAAEC;AAA0B,CAAC,KAAKA,KAAK,CAACC,QAAQ;AAC9D;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.MonthYearPickerType = void 0;
|
|
7
|
+
var _core = require("@chayns-components/core");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _calendar = require("../../../utils/calendar");
|
|
10
|
+
var _Month = require("../month-wrapper/month/Month.styles");
|
|
11
|
+
var _date = require("../../../utils/date");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
let MonthYearPickerType = exports.MonthYearPickerType = /*#__PURE__*/function (MonthYearPickerType) {
|
|
15
|
+
MonthYearPickerType["Month"] = "month";
|
|
16
|
+
MonthYearPickerType["Year"] = "year";
|
|
17
|
+
return MonthYearPickerType;
|
|
18
|
+
}({});
|
|
19
|
+
const MonthYearPickers = ({
|
|
20
|
+
month,
|
|
21
|
+
year,
|
|
22
|
+
locale,
|
|
23
|
+
minDate,
|
|
24
|
+
maxDate,
|
|
25
|
+
setCurrentDate,
|
|
26
|
+
displayIndex = 0,
|
|
27
|
+
showMonthYearPickers
|
|
28
|
+
}) => {
|
|
29
|
+
const [currentYear] = (0, _react.useState)(new Date().getFullYear());
|
|
30
|
+
const months = (0, _react.useMemo)(() => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map(tempMonth => ({
|
|
31
|
+
text: (0, _calendar.formatMonth)({
|
|
32
|
+
month: tempMonth,
|
|
33
|
+
locale
|
|
34
|
+
}),
|
|
35
|
+
value: tempMonth
|
|
36
|
+
})), [locale]);
|
|
37
|
+
const hasMultipleMonths = (0, _react.useMemo)(() => (0, _date.differenceInCalendarMonths)(maxDate, minDate) > 0, [minDate, maxDate]);
|
|
38
|
+
const years = (0, _react.useMemo)(() => (0, _calendar.getYearsBetween)(minDate, maxDate).map(tempYear => ({
|
|
39
|
+
text: tempYear.toString(),
|
|
40
|
+
value: tempYear
|
|
41
|
+
})), [minDate, maxDate]);
|
|
42
|
+
const hasMultipleYears = (0, _react.useMemo)(() => years.length > 1, [years]);
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showMonthYearPickers && hasMultipleMonths ? /*#__PURE__*/_react.default.createElement(_core.ComboBox, {
|
|
44
|
+
onSelect: selectedItem => {
|
|
45
|
+
const tempSelectedDate = (0, _calendar.isDateInRange)({
|
|
46
|
+
minDate,
|
|
47
|
+
maxDate,
|
|
48
|
+
currentDate: new Date(year, selectedItem.value - 1 - displayIndex, 1)
|
|
49
|
+
});
|
|
50
|
+
setCurrentDate(tempSelectedDate);
|
|
51
|
+
},
|
|
52
|
+
lists: [{
|
|
53
|
+
list: months
|
|
54
|
+
}],
|
|
55
|
+
selectedItem: {
|
|
56
|
+
text: (0, _calendar.formatMonth)({
|
|
57
|
+
month,
|
|
58
|
+
locale
|
|
59
|
+
}),
|
|
60
|
+
value: month
|
|
61
|
+
},
|
|
62
|
+
placeholder: ""
|
|
63
|
+
}) : /*#__PURE__*/_react.default.createElement(_Month.StyledMonthName, null, (0, _calendar.formatMonth)({
|
|
64
|
+
locale,
|
|
65
|
+
month
|
|
66
|
+
})), showMonthYearPickers && hasMultipleYears ? /*#__PURE__*/_react.default.createElement(_core.ComboBox, {
|
|
67
|
+
onSelect: selectedItem => {
|
|
68
|
+
const tempSelectedDate = (0, _calendar.isDateInRange)({
|
|
69
|
+
minDate,
|
|
70
|
+
maxDate,
|
|
71
|
+
currentDate: new Date(selectedItem.value, month - 1 - displayIndex, 1)
|
|
72
|
+
});
|
|
73
|
+
setCurrentDate(tempSelectedDate);
|
|
74
|
+
},
|
|
75
|
+
lists: [{
|
|
76
|
+
list: years
|
|
77
|
+
}],
|
|
78
|
+
selectedItem: {
|
|
79
|
+
text: year.toString(),
|
|
80
|
+
value: year
|
|
81
|
+
},
|
|
82
|
+
placeholder: ""
|
|
83
|
+
}) : /*#__PURE__*/_react.default.createElement(_Month.StyledMonthName, null, currentYear !== year ? year : ''));
|
|
84
|
+
};
|
|
85
|
+
var _default = exports.default = MonthYearPickers;
|
|
86
|
+
//# sourceMappingURL=MonthYearPickers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonthYearPickers.js","names":["_core","require","_react","_interopRequireWildcard","_calendar","_Month","_date","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MonthYearPickerType","exports","MonthYearPickers","month","year","locale","minDate","maxDate","setCurrentDate","displayIndex","showMonthYearPickers","currentYear","useState","Date","getFullYear","months","useMemo","map","tempMonth","text","formatMonth","value","hasMultipleMonths","differenceInCalendarMonths","years","getYearsBetween","tempYear","toString","hasMultipleYears","length","createElement","Fragment","ComboBox","onSelect","selectedItem","tempSelectedDate","isDateInRange","currentDate","lists","list","placeholder","StyledMonthName","_default"],"sources":["../../../../../src/components/calendar/month-year-pickers/MonthYearPickers.tsx"],"sourcesContent":["import { ComboBox } from '@chayns-components/core';\nimport React, { FC, useMemo, useState } from 'react';\nimport { EMonth } from '../../../types/calendar';\nimport { formatMonth, getYearsBetween, isDateInRange } from '../../../utils/calendar';\nimport { StyledMonthName } from '../month-wrapper/month/Month.styles';\nimport {Language} from \"chayns-api\";\nimport {differenceInCalendarMonths} from \"../../../utils/date\";\n\nexport enum MonthYearPickerType {\n Month = 'month',\n Year = 'year',\n}\n\ntype MonthYearPickerProps = {\n month: EMonth;\n year: number;\n locale: Language;\n minDate: Date;\n maxDate: Date;\n setCurrentDate: (date: Date) => void;\n displayIndex?: number;\n showMonthYearPickers: boolean;\n};\n\nconst MonthYearPickers: FC<MonthYearPickerProps> = ({\n month,\n year,\n locale,\n minDate,\n maxDate,\n setCurrentDate,\n displayIndex = 0,\n showMonthYearPickers,\n}) => {\n const [currentYear] = useState(new Date().getFullYear());\n\n const months = useMemo(\n () =>\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((tempMonth) => ({\n text: formatMonth({ month: tempMonth, locale }),\n value: tempMonth,\n })),\n [locale],\n );\n\n const hasMultipleMonths = useMemo(\n () => differenceInCalendarMonths(maxDate, minDate) > 0,\n [minDate, maxDate],\n );\n\n const years = useMemo(\n () =>\n getYearsBetween(minDate, maxDate).map((tempYear) => ({\n text: tempYear.toString(),\n value: tempYear,\n })),\n [minDate, maxDate],\n );\n\n const hasMultipleYears = useMemo(() => years.length > 1, [years]);\n\n return (\n <>\n {showMonthYearPickers && hasMultipleMonths ? (\n <ComboBox\n onSelect={(selectedItem) => {\n const tempSelectedDate = isDateInRange({\n minDate,\n maxDate,\n currentDate: new Date(\n year,\n (selectedItem.value as number) - 1 - displayIndex,\n 1,\n ),\n });\n\n setCurrentDate(tempSelectedDate);\n }}\n lists={[\n {\n list: months,\n },\n ]}\n selectedItem={{\n text: formatMonth({ month, locale }),\n value: month,\n }}\n placeholder=\"\"\n />\n ) : (\n <StyledMonthName>{formatMonth({ locale, month })}</StyledMonthName>\n )}\n {showMonthYearPickers && hasMultipleYears ? (\n <ComboBox\n onSelect={(selectedItem) => {\n const tempSelectedDate = isDateInRange({\n minDate,\n maxDate,\n currentDate: new Date(\n selectedItem.value as number,\n month - 1 - displayIndex,\n 1,\n ),\n });\n\n setCurrentDate(tempSelectedDate);\n }}\n lists={[\n {\n list: years,\n },\n ]}\n selectedItem={{\n text: year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C,YAAY,IAAK;MACxB,MAAMC,gBAAgB,GAAG,IAAAC,uBAAa,EAAC;QACnC9B,OAAO;QACPC,OAAO;QACP8B,WAAW,EAAE,IAAIxB,IAAI,CACjBqB,YAAY,CAACb,KAAK,EAClBlB,KAAK,GAAG,CAAC,GAAGM,YAAY,EACxB,CACJ;MACJ,CAAC,CAAC;MAEFD,cAAc,CAAC2B,gBAAgB,CAAC;IACpC,CAAE;IACFG,KAAK,EAAE,CACH;MACIC,IAAI,EAAEf;IACV,CAAC,CACH;IACFU,YAAY,EAAE;MACVf,IAAI,EAAEf,IAAI,CAACuB,QAAQ,CAAC,CAAC;MACrBN,KAAK,EAAEjB;IACX,CAAE;IACFoC,WAAW,EAAC;EAAE,CACjB,CAAC,gBAEFjE,MAAA,CAAAW,OAAA,CAAA4C,aAAA,CAACpD,MAAA,CAAA+D,eAAe,QAAE9B,WAAW,KAAKP,IAAI,GAAGA,IAAI,GAAG,EAAoB,CAE1E,CAAC;AAEX,CAAC;AAAC,IAAAsC,QAAA,GAAAzC,OAAA,CAAAf,OAAA,GAEagB,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _useDateInfo = require("../../hooks/useDateInfo");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
const DateInfo = ({
|
|
12
|
+
date,
|
|
13
|
+
preText = '',
|
|
14
|
+
shouldShowYear,
|
|
15
|
+
shouldShowTime,
|
|
16
|
+
shouldShowRelativeDayOfWeek,
|
|
17
|
+
shouldUseShortText,
|
|
18
|
+
shouldShowDayOfWeek,
|
|
19
|
+
shouldShowDateToNowDifference
|
|
20
|
+
}) => {
|
|
21
|
+
const formattedDate = (0, _useDateInfo.useDateInfo)({
|
|
22
|
+
date,
|
|
23
|
+
preText,
|
|
24
|
+
shouldShowYear,
|
|
25
|
+
shouldShowTime,
|
|
26
|
+
shouldUseShortText,
|
|
27
|
+
shouldShowDayOfWeek,
|
|
28
|
+
shouldShowRelativeDayOfWeek,
|
|
29
|
+
shouldShowDateToNowDifference
|
|
30
|
+
});
|
|
31
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement("span", null, formattedDate), [formattedDate]);
|
|
32
|
+
};
|
|
33
|
+
DateInfo.displayName = 'DateInfo';
|
|
34
|
+
var _default = exports.default = DateInfo;
|
|
35
|
+
//# sourceMappingURL=DateInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateInfo.js","names":["_react","_interopRequireWildcard","require","_useDateInfo","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DateInfo","date","preText","shouldShowYear","shouldShowTime","shouldShowRelativeDayOfWeek","shouldUseShortText","shouldShowDayOfWeek","shouldShowDateToNowDifference","formattedDate","useDateInfo","useMemo","createElement","displayName","_default","exports"],"sources":["../../../../src/components/date-info/DateInfo.tsx"],"sourcesContent":["import React, { FC, useMemo } from 'react';\nimport { useDateInfo } from '../../hooks/useDateInfo';\nimport { UseDateInfoOptions } from '../../types/dateinfo';\n\nexport type DateInfoProps = UseDateInfoOptions;\n\nconst DateInfo: FC<DateInfoProps> = ({\n date,\n preText = '',\n shouldShowYear,\n shouldShowTime,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowDateToNowDifference,\n}) => {\n const formattedDate = useDateInfo({\n date,\n preText,\n shouldShowYear,\n shouldShowTime,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowDateToNowDifference,\n });\n\n return useMemo(() => <span>{formattedDate}</span>, [formattedDate]);\n};\n\nDateInfo.displayName = 'DateInfo';\n\nexport default DateInfo;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAsD,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAKtD,MAAMW,QAA2B,GAAGA,CAAC;EACjCC,IAAI;EACJC,OAAO,GAAG,EAAE;EACZC,cAAc;EACdC,cAAc;EACdC,2BAA2B;EAC3BC,kBAAkB;EAClBC,mBAAmB;EACnBC;AACJ,CAAC,KAAK;EACF,MAAMC,aAAa,GAAG,IAAAC,wBAAW,EAAC;IAC9BT,IAAI;IACJC,OAAO;IACPC,cAAc;IACdC,cAAc;IACdE,kBAAkB;IAClBC,mBAAmB;IACnBF,2BAA2B;IAC3BG;EACJ,CAAC,CAAC;EAEF,OAAO,IAAAG,cAAO,EAAC,mBAAMnC,MAAA,CAAAU,OAAA,CAAA0B,aAAA,eAAOH,aAAoB,CAAC,EAAE,CAACA,aAAa,CAAC,CAAC;AACvE,CAAC;AAEDT,QAAQ,CAACa,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7B,OAAA,GAEnBc,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _core = require("@chayns-components/core");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _openingTimes = require("../../types/openingTimes");
|
|
10
|
+
var _HintText = _interopRequireDefault(require("./hint-text/HintText"));
|
|
11
|
+
var _OpeningInputs = _interopRequireDefault(require("./opening-inputs/OpeningInputs"));
|
|
12
|
+
var _OpeningTimes = require("./OpeningTimes.styles");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
const OpeningTimes = ({
|
|
17
|
+
closedText = 'closed',
|
|
18
|
+
currentDayId,
|
|
19
|
+
editMode = false,
|
|
20
|
+
hintText,
|
|
21
|
+
hintTextPosition = _openingTimes.HintTextPosition.Bottom,
|
|
22
|
+
openingTimes,
|
|
23
|
+
weekdays,
|
|
24
|
+
onChange,
|
|
25
|
+
onTimeAdd,
|
|
26
|
+
onTimeRemove,
|
|
27
|
+
shouldNotValidate = false
|
|
28
|
+
}) => {
|
|
29
|
+
const [newOpeningTimes, setNewOpeningTimes] = (0, _react.useState)();
|
|
30
|
+
const [invalidOpeningTimes, setInvalidOpeningTimes] = (0, _react.useState)([]);
|
|
31
|
+
const [isPopupOpen, setIsPopupOpen] = (0, _react.useState)(false);
|
|
32
|
+
const ref = (0, _react.useRef)(null);
|
|
33
|
+
const popupRef = (0, _react.useRef)(null);
|
|
34
|
+
(0, _react.useEffect)(() => {
|
|
35
|
+
setNewOpeningTimes(openingTimes);
|
|
36
|
+
}, [openingTimes]);
|
|
37
|
+
const validateTime = (0, _react.useCallback)((newTime, dayId) => {
|
|
38
|
+
var _newOpeningTimes$find;
|
|
39
|
+
if (newTime.start === newTime.end) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const dayTimes = (newOpeningTimes === null || newOpeningTimes === void 0 || (_newOpeningTimes$find = newOpeningTimes.find(day => day.id === dayId)) === null || _newOpeningTimes$find === void 0 ? void 0 : _newOpeningTimes$find.times) || [];
|
|
43
|
+
return dayTimes.every(time => time.id === newTime.id || newTime.end <= time.start || newTime.start >= time.end);
|
|
44
|
+
}, [newOpeningTimes]);
|
|
45
|
+
const handleCheckBoxChange = (0, _react.useCallback)(id => {
|
|
46
|
+
setNewOpeningTimes(prevOpeningTimes => {
|
|
47
|
+
const updatedOpeningTimes = (prevOpeningTimes ?? []).map(openingTime => {
|
|
48
|
+
if (openingTime.id === id) {
|
|
49
|
+
return {
|
|
50
|
+
...openingTime,
|
|
51
|
+
isDisabled: !openingTime.isDisabled
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return openingTime;
|
|
55
|
+
});
|
|
56
|
+
if (typeof onChange === 'function') {
|
|
57
|
+
onChange({
|
|
58
|
+
enabledDays: updatedOpeningTimes.filter(item => !item.isDisabled).map(item => item.id)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return updatedOpeningTimes;
|
|
62
|
+
});
|
|
63
|
+
}, [onChange]);
|
|
64
|
+
const handleChange = (0, _react.useCallback)((newTime, id) => {
|
|
65
|
+
const isValid = shouldNotValidate || validateTime(newTime, id);
|
|
66
|
+
if (!isValid) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setNewOpeningTimes(prevOpeningTimes => {
|
|
70
|
+
const updatedOpeningTimes = (prevOpeningTimes ?? []).map(openingTime => {
|
|
71
|
+
if (openingTime.id === id) {
|
|
72
|
+
const newTimes = openingTime.times.map(time => {
|
|
73
|
+
if (time.id === newTime.id) {
|
|
74
|
+
return newTime;
|
|
75
|
+
}
|
|
76
|
+
return time;
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
...openingTime,
|
|
80
|
+
times: newTimes
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return openingTime;
|
|
84
|
+
});
|
|
85
|
+
const changedOpeningTime = updatedOpeningTimes.find(updatedOpeningTime => updatedOpeningTime.id === id);
|
|
86
|
+
if (isValid && typeof onChange === 'function') {
|
|
87
|
+
onChange({
|
|
88
|
+
dayId: changedOpeningTime === null || changedOpeningTime === void 0 ? void 0 : changedOpeningTime.id,
|
|
89
|
+
time: newTime
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return updatedOpeningTimes;
|
|
93
|
+
});
|
|
94
|
+
}, [onChange, shouldNotValidate, validateTime]);
|
|
95
|
+
const handleAdd = (0, _react.useCallback)((time, id) => {
|
|
96
|
+
const isValid = shouldNotValidate || validateTime(time, id);
|
|
97
|
+
if (isValid && typeof onTimeAdd === 'function') {
|
|
98
|
+
onTimeAdd({
|
|
99
|
+
time,
|
|
100
|
+
dayId: id
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
setNewOpeningTimes(prevOpeningTimes => (prevOpeningTimes ?? []).map(openingTime => {
|
|
104
|
+
if (openingTime.id === id) {
|
|
105
|
+
return {
|
|
106
|
+
...openingTime,
|
|
107
|
+
times: [...openingTime.times, time]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return openingTime;
|
|
111
|
+
}));
|
|
112
|
+
}, [onTimeAdd, shouldNotValidate, validateTime]);
|
|
113
|
+
const handleUpdateInvalidIds = (0, _react.useCallback)((openingTimeId, invalidTimeIds) => {
|
|
114
|
+
setInvalidOpeningTimes(prevState => {
|
|
115
|
+
const updatedInvalidOpeningTimes = prevState.map(invalidOpeningTime => {
|
|
116
|
+
if (invalidOpeningTime.openingTimeId === openingTimeId) {
|
|
117
|
+
return {
|
|
118
|
+
openingTimeId,
|
|
119
|
+
invalidTimeIds
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return invalidOpeningTime;
|
|
123
|
+
});
|
|
124
|
+
if (!updatedInvalidOpeningTimes.some(({
|
|
125
|
+
openingTimeId: updatedInvalidOpeningId
|
|
126
|
+
}) => updatedInvalidOpeningId === openingTimeId) && invalidTimeIds.length > 0) {
|
|
127
|
+
updatedInvalidOpeningTimes.push({
|
|
128
|
+
openingTimeId,
|
|
129
|
+
invalidTimeIds
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return updatedInvalidOpeningTimes.filter(updatedInvalidOpeningTime => updatedInvalidOpeningTime.invalidTimeIds.length !== 0);
|
|
133
|
+
});
|
|
134
|
+
}, []);
|
|
135
|
+
const handleRemove = (0, _react.useCallback)(id => {
|
|
136
|
+
setNewOpeningTimes(prevOpeningTimes => (prevOpeningTimes ?? []).map(openingTime => {
|
|
137
|
+
const newTimes = openingTime.times.filter(time => time.id !== id);
|
|
138
|
+
return {
|
|
139
|
+
...openingTime,
|
|
140
|
+
times: newTimes
|
|
141
|
+
};
|
|
142
|
+
}));
|
|
143
|
+
if (typeof onTimeRemove === 'function') {
|
|
144
|
+
onTimeRemove(id);
|
|
145
|
+
}
|
|
146
|
+
}, [onTimeRemove]);
|
|
147
|
+
const content = (0, _react.useMemo)(() => {
|
|
148
|
+
const items = [];
|
|
149
|
+
if (!newOpeningTimes) {
|
|
150
|
+
return items;
|
|
151
|
+
}
|
|
152
|
+
newOpeningTimes.forEach(({
|
|
153
|
+
times,
|
|
154
|
+
id,
|
|
155
|
+
weekdayId,
|
|
156
|
+
isDisabled
|
|
157
|
+
}) => {
|
|
158
|
+
var _weekdays$find;
|
|
159
|
+
const weekday = (_weekdays$find = weekdays.find(weekDay => weekDay.id === weekdayId)) === null || _weekdays$find === void 0 ? void 0 : _weekdays$find.name;
|
|
160
|
+
if (!weekday) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
items.push(/*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimesWrapper, {
|
|
164
|
+
key: `openingTimes__${id}`
|
|
165
|
+
}, editMode ? /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
|
|
166
|
+
isChecked: !isDisabled,
|
|
167
|
+
onChange: () => handleCheckBoxChange(id)
|
|
168
|
+
}, weekday) : /*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimesWeekDay, null, weekday), /*#__PURE__*/_react.default.createElement(_OpeningInputs.default, {
|
|
169
|
+
closedText: closedText,
|
|
170
|
+
currentDayId: currentDayId,
|
|
171
|
+
id: id,
|
|
172
|
+
times: times,
|
|
173
|
+
isDisabled: isDisabled,
|
|
174
|
+
onInvalid: handleUpdateInvalidIds,
|
|
175
|
+
onChange: newTime => handleChange(newTime, id),
|
|
176
|
+
onRemove: handleRemove,
|
|
177
|
+
onAdd: handleAdd,
|
|
178
|
+
editMode: editMode
|
|
179
|
+
})));
|
|
180
|
+
});
|
|
181
|
+
return items;
|
|
182
|
+
}, [closedText, currentDayId, editMode, handleAdd, handleChange, handleCheckBoxChange, handleRemove, handleUpdateInvalidIds, newOpeningTimes, weekdays]);
|
|
183
|
+
const size = (0, _core.useElementSize)(ref);
|
|
184
|
+
const hidePopup = (0, _react.useCallback)(() => {
|
|
185
|
+
var _popupRef$current;
|
|
186
|
+
setIsPopupOpen(false);
|
|
187
|
+
(_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 || _popupRef$current.hide();
|
|
188
|
+
}, []);
|
|
189
|
+
const showPopup = (0, _react.useCallback)(() => {
|
|
190
|
+
var _popupRef$current2;
|
|
191
|
+
setIsPopupOpen(true);
|
|
192
|
+
(_popupRef$current2 = popupRef.current) === null || _popupRef$current2 === void 0 || _popupRef$current2.show();
|
|
193
|
+
}, []);
|
|
194
|
+
const displayedContent = (0, _react.useMemo)(() => {
|
|
195
|
+
var _weekdays$find2;
|
|
196
|
+
if (!currentDayId || editMode) {
|
|
197
|
+
return content;
|
|
198
|
+
}
|
|
199
|
+
const singleDay = newOpeningTimes === null || newOpeningTimes === void 0 ? void 0 : newOpeningTimes.find(({
|
|
200
|
+
id
|
|
201
|
+
}) => id === currentDayId);
|
|
202
|
+
if (!singleDay) {
|
|
203
|
+
return content;
|
|
204
|
+
}
|
|
205
|
+
const {
|
|
206
|
+
id,
|
|
207
|
+
times,
|
|
208
|
+
weekdayId
|
|
209
|
+
} = singleDay;
|
|
210
|
+
const weekday = (_weekdays$find2 = weekdays.find(weekDay => weekDay.id === weekdayId)) === null || _weekdays$find2 === void 0 ? void 0 : _weekdays$find2.name;
|
|
211
|
+
return /*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimesWrapper, {
|
|
212
|
+
key: `currentDay__${currentDayId}`,
|
|
213
|
+
style: size && {
|
|
214
|
+
width: size.width
|
|
215
|
+
},
|
|
216
|
+
onMouseEnter: showPopup,
|
|
217
|
+
onMouseLeave: hidePopup,
|
|
218
|
+
onClick: () => isPopupOpen ? hidePopup() : showPopup()
|
|
219
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Popup, {
|
|
220
|
+
onShow: () => setIsPopupOpen(true),
|
|
221
|
+
onHide: () => setIsPopupOpen(false),
|
|
222
|
+
ref: popupRef,
|
|
223
|
+
content: /*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimesTooltipContent, {
|
|
224
|
+
key: "opening-time-tooltip"
|
|
225
|
+
}, content)
|
|
226
|
+
}, /*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimesWeekDay, null, weekday)), /*#__PURE__*/_react.default.createElement(_OpeningInputs.default, {
|
|
227
|
+
closedText: closedText,
|
|
228
|
+
currentDayId: currentDayId,
|
|
229
|
+
onInvalid: handleUpdateInvalidIds,
|
|
230
|
+
id: id,
|
|
231
|
+
times: times,
|
|
232
|
+
editMode: editMode
|
|
233
|
+
}));
|
|
234
|
+
}, [currentDayId, editMode, newOpeningTimes, weekdays, size, showPopup, hidePopup, content, closedText, handleUpdateInvalidIds, isPopupOpen]);
|
|
235
|
+
const shouldShowHint = (0, _react.useMemo)(() => invalidOpeningTimes.length > 0, [invalidOpeningTimes.length]);
|
|
236
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimes, {
|
|
237
|
+
ref: ref
|
|
238
|
+
}, shouldShowHint && hintText && hintTextPosition === _openingTimes.HintTextPosition.Top && /*#__PURE__*/_react.default.createElement(_HintText.default, {
|
|
239
|
+
text: hintText
|
|
240
|
+
}), displayedContent, shouldShowHint && hintText && hintTextPosition === _openingTimes.HintTextPosition.Bottom && /*#__PURE__*/_react.default.createElement(_HintText.default, {
|
|
241
|
+
text: hintText
|
|
242
|
+
})), [displayedContent, hintText, hintTextPosition, shouldShowHint]);
|
|
243
|
+
};
|
|
244
|
+
OpeningTimes.displayName = 'OpeningTimes';
|
|
245
|
+
var _default = exports.default = OpeningTimes;
|
|
246
|
+
//# sourceMappingURL=OpeningTimes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpeningTimes.js","names":["_core","require","_react","_interopRequireWildcard","_openingTimes","_HintText","_interopRequireDefault","_OpeningInputs","_OpeningTimes","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","OpeningTimes","closedText","currentDayId","editMode","hintText","hintTextPosition","HintTextPosition","Bottom","openingTimes","weekdays","onChange","onTimeAdd","onTimeRemove","shouldNotValidate","newOpeningTimes","setNewOpeningTimes","useState","invalidOpeningTimes","setInvalidOpeningTimes","isPopupOpen","setIsPopupOpen","ref","useRef","popupRef","useEffect","validateTime","useCallback","newTime","dayId","_newOpeningTimes$find","start","end","dayTimes","find","day","id","times","every","time","handleCheckBoxChange","prevOpeningTimes","updatedOpeningTimes","map","openingTime","isDisabled","enabledDays","filter","item","handleChange","isValid","newTimes","changedOpeningTime","updatedOpeningTime","handleAdd","handleUpdateInvalidIds","openingTimeId","invalidTimeIds","prevState","updatedInvalidOpeningTimes","invalidOpeningTime","some","updatedInvalidOpeningId","length","push","updatedInvalidOpeningTime","handleRemove","content","useMemo","items","forEach","weekdayId","_weekdays$find","weekday","weekDay","name","createElement","StyledOpeningTimesWrapper","key","Checkbox","isChecked","StyledOpeningTimesWeekDay","onInvalid","onRemove","onAdd","size","useElementSize","hidePopup","_popupRef$current","current","hide","showPopup","_popupRef$current2","show","displayedContent","_weekdays$find2","singleDay","style","width","onMouseEnter","onMouseLeave","onClick","Popup","onShow","onHide","StyledOpeningTimesTooltipContent","shouldShowHint","StyledOpeningTimes","Top","text","displayName","_default","exports"],"sources":["../../../../src/components/opening-times/OpeningTimes.tsx"],"sourcesContent":["import { Checkbox, Popup, useElementSize, type PopupRef } from '@chayns-components/core';\nimport React, {\n FC,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n} from 'react';\nimport {\n HintTextPosition,\n type OnChange,\n type OnTimeAdd,\n type OpeningTime,\n type Time,\n type Weekday,\n} from '../../types/openingTimes';\nimport HintText from './hint-text/HintText';\nimport OpeningInputs from './opening-inputs/OpeningInputs';\nimport {\n StyledOpeningTimes,\n StyledOpeningTimesTooltipContent,\n StyledOpeningTimesWeekDay,\n StyledOpeningTimesWrapper,\n} from './OpeningTimes.styles';\n\nexport type OpeningTimesProps = {\n /**\n * The text that should be displayed when a day is closed.\n */\n closedText?: string;\n /**\n * If set just the current day is displayed and the whole week in a tooltip.\n */\n currentDayId?: OpeningTime['id'];\n /**\n * Whether the opening times can be edited.\n */\n editMode?: boolean;\n /**\n * The text that should be displayed if times are colliding.\n */\n hintText?: string;\n /**\n * The position of the hint text.\n */\n hintTextPosition?: HintTextPosition;\n /**\n * Function to be executed when a time is changed or a day is enabled/disabled.\n * @param openingTimes\n */\n onChange?: ({ time, enabledDays, dayId }: OnChange) => void;\n /**\n * Function to be executed when a time is added.\n */\n onTimeAdd?: ({ time, dayId }: OnTimeAdd) => void;\n /**\n * Function to be executed when a time is removed.\n */\n onTimeRemove?: (id: string) => void;\n /**\n * The opening times corresponding to its weekday.\n */\n openingTimes: OpeningTime[];\n /**\n * The weekdays that should be displayed.\n */\n weekdays: Weekday[];\n /**\n * When set to true, events are triggered without validation.\n */\n shouldNotValidate?: boolean;\n};\n\nconst OpeningTimes: FC<OpeningTimesProps> = ({\n closedText = 'closed',\n currentDayId,\n editMode = false,\n hintText,\n hintTextPosition = HintTextPosition.Bottom,\n openingTimes,\n weekdays,\n onChange,\n onTimeAdd,\n onTimeRemove,\n shouldNotValidate = false,\n}) => {\n const [newOpeningTimes, setNewOpeningTimes] = useState<OpeningTime[]>();\n const [invalidOpeningTimes, setInvalidOpeningTimes] = useState<\n { openingTimeId: string; invalidTimeIds: string[] }[]\n >([]);\n const [isPopupOpen, setIsPopupOpen] = useState(false);\n\n const ref = useRef<HTMLDivElement>(null);\n const popupRef = useRef<PopupRef>(null);\n\n useEffect(() => {\n setNewOpeningTimes(openingTimes);\n }, [openingTimes]);\n\n const validateTime = useCallback(\n (newTime: Time, dayId: string): boolean => {\n if (newTime.start === newTime.end) {\n return false;\n }\n const dayTimes = newOpeningTimes?.find((day) => day.id === dayId)?.times || [];\n\n return dayTimes.every(\n (time) =>\n time.id === newTime.id ||\n newTime.end <= time.start ||\n newTime.start >= time.end,\n );\n },\n [newOpeningTimes],\n );\n\n const handleCheckBoxChange = useCallback(\n (id: string) => {\n setNewOpeningTimes((prevOpeningTimes) => {\n const updatedOpeningTimes = (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n return { ...openingTime, isDisabled: !openingTime.isDisabled };\n }\n return openingTime;\n });\n\n if (typeof onChange === 'function') {\n onChange({\n enabledDays: updatedOpeningTimes\n .filter((item) => !item.isDisabled)\n .map((item) => item.id),\n });\n }\n\n return updatedOpeningTimes;\n });\n },\n [onChange],\n );\n\n const handleChange = useCallback(\n (newTime: Time, id: string) => {\n const isValid = shouldNotValidate || validateTime(newTime, id);\n if (!isValid) {\n return;\n }\n\n setNewOpeningTimes((prevOpeningTimes) => {\n const updatedOpeningTimes = (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n const newTimes = openingTime.times.map((time) => {\n if (time.id === newTime.id) {\n return newTime;\n }\n return time;\n });\n return { ...openingTime, times: newTimes };\n }\n return openingTime;\n });\n\n const changedOpeningTime = updatedOpeningTimes.find(\n (updatedOpeningTime) => updatedOpeningTime.id === id,\n );\n\n if (isValid && typeof onChange === 'function') {\n onChange({\n dayId: changedOpeningTime?.id,\n time: newTime,\n });\n }\n\n return updatedOpeningTimes;\n });\n },\n [onChange, shouldNotValidate, validateTime],\n );\n\n const handleAdd = useCallback(\n (time: Time, id: string) => {\n const isValid = shouldNotValidate || validateTime(time, id);\n\n if (isValid && typeof onTimeAdd === 'function') {\n onTimeAdd({ time, dayId: id });\n }\n\n setNewOpeningTimes((prevOpeningTimes) =>\n (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n return { ...openingTime, times: [...openingTime.times, time] };\n }\n return openingTime;\n }),\n );\n },\n [onTimeAdd, shouldNotValidate, validateTime],\n );\n\n const handleUpdateInvalidIds = useCallback(\n (openingTimeId: string, invalidTimeIds: string[]) => {\n setInvalidOpeningTimes((prevState) => {\n const updatedInvalidOpeningTimes = prevState.map((invalidOpeningTime) => {\n if (invalidOpeningTime.openingTimeId === openingTimeId) {\n return {\n openingTimeId,\n invalidTimeIds,\n };\n }\n return invalidOpeningTime;\n });\n\n if (\n !updatedInvalidOpeningTimes.some(\n ({ openingTimeId: updatedInvalidOpeningId }) =>\n updatedInvalidOpeningId === openingTimeId,\n ) &&\n invalidTimeIds.length > 0\n ) {\n updatedInvalidOpeningTimes.push({ openingTimeId, invalidTimeIds });\n }\n\n return updatedInvalidOpeningTimes.filter(\n (updatedInvalidOpeningTime) =>\n updatedInvalidOpeningTime.invalidTimeIds.length !== 0,\n );\n });\n },\n [],\n );\n\n const handleRemove = useCallback(\n (id: string) => {\n setNewOpeningTimes((prevOpeningTimes) =>\n (prevOpeningTimes ?? []).map((openingTime) => {\n const newTimes = openingTime.times.filter((time) => time.id !== id);\n\n return { ...openingTime, times: newTimes };\n }),\n );\n\n if (typeof onTimeRemove === 'function') {\n onTimeRemove(id);\n }\n },\n [onTimeRemove],\n );\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!newOpeningTimes) {\n return items;\n }\n\n newOpeningTimes.forEach(({ times, id, weekdayId, isDisabled }) => {\n const weekday = weekdays.find((weekDay) => weekDay.id === weekdayId)?.name;\n\n if (!weekday) {\n return;\n }\n\n items.push(\n <StyledOpeningTimesWrapper key={`openingTimes__${id}`}>\n {editMode ? (\n <Checkbox isChecked={!isDisabled} onChange={() => handleCheckBoxChange(id)}>\n {weekday}\n </Checkbox>\n ) : (\n <StyledOpeningTimesWeekDay>{weekday}</StyledOpeningTimesWeekDay>\n )}\n <OpeningInputs\n closedText={closedText}\n currentDayId={currentDayId}\n id={id}\n times={times}\n isDisabled={isDisabled}\n onInvalid={handleUpdateInvalidIds}\n onChange={(newTime) => handleChange(newTime, id)}\n onRemove={handleRemove}\n onAdd={handleAdd}\n editMode={editMode}\n />\n </StyledOpeningTimesWrapper>,\n );\n });\n\n return items;\n }, [\n closedText,\n currentDayId,\n editMode,\n handleAdd,\n handleChange,\n handleCheckBoxChange,\n handleRemove,\n handleUpdateInvalidIds,\n newOpeningTimes,\n weekdays,\n ]);\n\n const size = useElementSize(ref);\n\n const hidePopup = useCallback(() => {\n setIsPopupOpen(false);\n popupRef.current?.hide();\n }, []);\n\n const showPopup = useCallback(() => {\n setIsPopupOpen(true);\n popupRef.current?.show();\n }, []);\n\n const displayedContent = useMemo(() => {\n if (!currentDayId || editMode) {\n return content;\n }\n\n const singleDay = newOpeningTimes?.find(({ id }) => id === currentDayId);\n\n if (!singleDay) {\n return content;\n }\n\n const { id, times, weekdayId } = singleDay;\n\n const weekday = weekdays.find((weekDay) => weekDay.id === weekdayId)?.name;\n\n return (\n <StyledOpeningTimesWrapper\n key={`currentDay__${currentDayId}`}\n style={size && { width: size.width }}\n onMouseEnter={showPopup}\n onMouseLeave={hidePopup}\n onClick={() => (isPopupOpen ? hidePopup() : showPopup())}\n >\n <Popup\n onShow={() => setIsPopupOpen(true)}\n onHide={() => setIsPopupOpen(false)}\n ref={popupRef}\n content={\n <StyledOpeningTimesTooltipContent key=\"opening-time-tooltip\">\n {content}\n </StyledOpeningTimesTooltipContent>\n }\n >\n <StyledOpeningTimesWeekDay>{weekday}</StyledOpeningTimesWeekDay>\n </Popup>\n <OpeningInputs\n closedText={closedText}\n currentDayId={currentDayId}\n onInvalid={handleUpdateInvalidIds}\n id={id}\n times={times}\n editMode={editMode}\n />\n </StyledOpeningTimesWrapper>\n );\n }, [\n currentDayId,\n editMode,\n newOpeningTimes,\n weekdays,\n size,\n showPopup,\n hidePopup,\n content,\n closedText,\n handleUpdateInvalidIds,\n isPopupOpen,\n ]);\n\n const shouldShowHint = useMemo(\n () => invalidOpeningTimes.length > 0,\n [invalidOpeningTimes.length],\n );\n\n return useMemo(\n () => (\n <StyledOpeningTimes ref={ref}>\n {shouldShowHint && hintText && hintTextPosition === HintTextPosition.Top && (\n <HintText text={hintText} />\n )}\n {displayedContent}\n {shouldShowHint && hintText && hintTextPosition === HintTextPosition.Bottom && (\n <HintText text={hintText} />\n )}\n </StyledOpeningTimes>\n ),\n [displayedContent, hintText, hintTextPosition, shouldShowHint],\n );\n};\n\nOpeningTimes.displayName = 'OpeningTimes';\n\nexport default OpeningTimes;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AASA,IAAAG,aAAA,GAAAH,OAAA;AAQA,IAAAI,SAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,cAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAK+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perty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledOpeningTimesWrapper = exports.StyledOpeningTimesWeekDay = exports.StyledOpeningTimesTooltipContent = exports.StyledOpeningTimes = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const StyledOpeningTimes = exports.StyledOpeningTimes = _styledComponents.default.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 8px;
|
|
13
|
+
`;
|
|
14
|
+
const StyledOpeningTimesWrapper = exports.StyledOpeningTimesWrapper = _styledComponents.default.div`
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: baseline;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
min-width: 300px;
|
|
19
|
+
`;
|
|
20
|
+
const StyledOpeningTimesTooltipContent = exports.StyledOpeningTimesTooltipContent = _styledComponents.default.div`
|
|
21
|
+
padding: 8px;
|
|
22
|
+
`;
|
|
23
|
+
const StyledOpeningTimesWeekDay = exports.StyledOpeningTimesWeekDay = _styledComponents.default.div`
|
|
24
|
+
color: ${({
|
|
25
|
+
theme
|
|
26
|
+
}) => theme.text};
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=OpeningTimes.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpeningTimes.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledOpeningTimes","exports","styled","div","StyledOpeningTimesWrapper","StyledOpeningTimesTooltipContent","StyledOpeningTimesWeekDay","theme","text"],"sources":["../../../../src/components/opening-times/OpeningTimes.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledSliderButtonProps = WithTheme<{ $isDisabled?: boolean }>;\n\nexport const StyledOpeningTimes = styled.div<StyledSliderButtonProps>`\n display: flex;\n flex-direction: column;\n gap: 8px;\n`;\n\nexport const StyledOpeningTimesWrapper = styled.div`\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n min-width: 300px;\n`;\n\nexport const StyledOpeningTimesTooltipContent = styled.div`\n padding: 8px;\n`;\n\ntype StyledOpeningTimesWeekDayProps = WithTheme<unknown>;\n\nexport const StyledOpeningTimesWeekDay = styled.div<StyledOpeningTimesWeekDayProps>`\n color: ${({ theme }: StyledOpeningTimesWeekDayProps) => theme.text};\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAA4B;AACrE;AACA;AACA;AACA,CAAC;AAEM,MAAMC,yBAAyB,GAAAH,OAAA,CAAAG,yBAAA,GAAGF,yBAAM,CAACC,GAAG;AACnD;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAME,gCAAgC,GAAAJ,OAAA,CAAAI,gCAAA,GAAGH,yBAAM,CAACC,GAAG;AAC1D;AACA,CAAC;AAIM,MAAMG,yBAAyB,GAAAL,OAAA,CAAAK,yBAAA,GAAGJ,yBAAM,CAACC,GAAmC;AACnF,aAAa,CAAC;EAAEI;AAAsC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACtE,CAAC","ignoreList":[]}
|