@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,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MonthYearPickers from '../../month-year-pickers/MonthYearPickers';
|
|
3
|
+
import DayWrapper from './day-wrapper/DayWrapper';
|
|
4
|
+
import { StyledMonth, StyledMonthHead } from './Month.styles';
|
|
5
|
+
import WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';
|
|
6
|
+
const Month = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
month,
|
|
9
|
+
year,
|
|
10
|
+
locale,
|
|
11
|
+
highlightedDates,
|
|
12
|
+
selectedDate,
|
|
13
|
+
onSelect,
|
|
14
|
+
categories,
|
|
15
|
+
height,
|
|
16
|
+
minDate,
|
|
17
|
+
maxDate,
|
|
18
|
+
customThumbColors,
|
|
19
|
+
shouldShowHighlightsInMonthOverlay,
|
|
20
|
+
type,
|
|
21
|
+
hoveringDay,
|
|
22
|
+
setHoveringDay,
|
|
23
|
+
disabledDates,
|
|
24
|
+
setCurrentDate,
|
|
25
|
+
displayIndex,
|
|
26
|
+
showMonthYearPickers
|
|
27
|
+
} = _ref;
|
|
28
|
+
return /*#__PURE__*/React.createElement(StyledMonth, {
|
|
29
|
+
$height: height
|
|
30
|
+
}, /*#__PURE__*/React.createElement(StyledMonthHead, null, /*#__PURE__*/React.createElement(MonthYearPickers, {
|
|
31
|
+
month: month,
|
|
32
|
+
year: year,
|
|
33
|
+
locale: locale,
|
|
34
|
+
minDate: minDate,
|
|
35
|
+
maxDate: maxDate,
|
|
36
|
+
setCurrentDate: setCurrentDate,
|
|
37
|
+
displayIndex: displayIndex,
|
|
38
|
+
showMonthYearPickers: showMonthYearPickers
|
|
39
|
+
})), /*#__PURE__*/React.createElement(WeekdayWrapper, {
|
|
40
|
+
locale: locale
|
|
41
|
+
}), /*#__PURE__*/React.createElement(DayWrapper, {
|
|
42
|
+
key: `day-wrapper-${month}`,
|
|
43
|
+
categories: categories,
|
|
44
|
+
selectedDate: selectedDate,
|
|
45
|
+
customThumbColors: customThumbColors,
|
|
46
|
+
month: month,
|
|
47
|
+
year: year,
|
|
48
|
+
onSelect: onSelect,
|
|
49
|
+
shouldShowHighlightsInMonthOverlay: shouldShowHighlightsInMonthOverlay,
|
|
50
|
+
highlightedDates: highlightedDates,
|
|
51
|
+
minDate: minDate,
|
|
52
|
+
maxDate: maxDate,
|
|
53
|
+
type: type,
|
|
54
|
+
hoveringDay: hoveringDay,
|
|
55
|
+
setHoveringDay: setHoveringDay,
|
|
56
|
+
disabledDates: disabledDates
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
Month.displayName = 'Month';
|
|
60
|
+
export default Month;
|
|
61
|
+
//# sourceMappingURL=Month.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Month.js","names":["React","MonthYearPickers","DayWrapper","StyledMonth","StyledMonthHead","WeekdayWrapper","Month","_ref","month","year","locale","highlightedDates","selectedDate","onSelect","categories","height","minDate","maxDate","customThumbColors","shouldShowHighlightsInMonthOverlay","type","hoveringDay","setHoveringDay","disabledDates","setCurrentDate","displayIndex","showMonthYearPickers","createElement","$height","key","displayName"],"sources":["../../../../../../src/components/calendar/month-wrapper/month/Month.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport {\n CalendarType,\n Categories, CustomThumbColors,\n DateInterval,\n EMonth,\n HighlightedDates,\n} from '../../../../types/calendar';\nimport MonthYearPickers from '../../month-year-pickers/MonthYearPickers';\nimport DayWrapper from './day-wrapper/DayWrapper';\nimport { StyledMonth, StyledMonthHead } from './Month.styles';\nimport WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';\nimport {Language} from \"chayns-api\";\n\nexport type MonthProps = {\n month: EMonth;\n year: number;\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n height: number;\n minDate: Date;\n maxDate: Date;\n type: CalendarType;\n hoveringDay: Date | null;\n setHoveringDay: (date: Date | null) => void;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n displayIndex?: number;\n shouldShowHighlightsInMonthOverlay: boolean;\n customThumbColors?: CustomThumbColors;\n showMonthYearPickers: boolean;\n};\n\nconst Month: FC<MonthProps> = ({\n month,\n year,\n locale,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n height,\n minDate,\n maxDate,customThumbColors,\n shouldShowHighlightsInMonthOverlay,\n type,\n hoveringDay,\n setHoveringDay,\n disabledDates,\n setCurrentDate,\n displayIndex,\n showMonthYearPickers,\n}) => (\n <StyledMonth $height={height}>\n <StyledMonthHead>\n <MonthYearPickers\n month={month}\n year={year}\n locale={locale}\n minDate={minDate}\n maxDate={maxDate}\n setCurrentDate={setCurrentDate}\n displayIndex={displayIndex}\n showMonthYearPickers={showMonthYearPickers}\n />\n </StyledMonthHead>\n <WeekdayWrapper locale={locale} />\n <DayWrapper\n key={`day-wrapper-${month}`}\n categories={categories}\n selectedDate={selectedDate}\n customThumbColors={customThumbColors}\n month={month}\n year={year}\n onSelect={onSelect}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n highlightedDates={highlightedDates}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n hoveringDay={hoveringDay}\n setHoveringDay={setHoveringDay}\n disabledDates={disabledDates}\n />\n </StyledMonth>\n);\n\nMonth.displayName = 'Month';\n\nexport default Month;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAc,OAAO;AAQjC,OAAOC,gBAAgB,MAAM,2CAA2C;AACxE,OAAOC,UAAU,MAAM,0BAA0B;AACjD,SAASC,WAAW,EAAEC,eAAe,QAAQ,gBAAgB;AAC7D,OAAOC,cAAc,MAAM,kCAAkC;AAyB7D,MAAMC,KAAqB,GAAGC,IAAA;EAAA,IAAC;IAC3BC,KAAK;IACLC,IAAI;IACJC,MAAM;IACNC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,UAAU;IACVC,MAAM;IACNC,OAAO;IACPC,OAAO;IAACC,iBAAiB;IACzBC,kCAAkC;IAClCC,IAAI;IACJC,WAAW;IACXC,cAAc;IACdC,aAAa;IACbC,cAAc;IACdC,YAAY;IACZC;EACJ,CAAC,GAAAnB,IAAA;EAAA,oBACGP,KAAA,CAAA2B,aAAA,CAACxB,WAAW;IAACyB,OAAO,EAAEb;EAAO,gBACzBf,KAAA,CAAA2B,aAAA,CAACvB,eAAe,qBACZJ,KAAA,CAAA2B,aAAA,CAAC1B,gBAAgB;IACbO,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXC,MAAM,EAAEA,MAAO;IACfM,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBO,cAAc,EAAEA,cAAe;IAC/BC,YAAY,EAAEA,YAAa;IAC3BC,oBAAoB,EAAEA;EAAqB,CAC9C,CACY,CAAC,eAClB1B,KAAA,CAAA2B,aAAA,CAACtB,cAAc;IAACK,MAAM,EAAEA;EAAO,CAAE,CAAC,eAClCV,KAAA,CAAA2B,aAAA,CAACzB,UAAU;IACP2B,GAAG,EAAE,eAAerB,KAAK,EAAG;IAC5BM,UAAU,EAAEA,UAAW;IACvBF,YAAY,EAAEA,YAAa;IAC3BM,iBAAiB,EAAEA,iBAAkB;IACrCV,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXI,QAAQ,EAAEA,QAAS;IACnBM,kCAAkC,EAAEA,kCAAmC;IACvER,gBAAgB,EAAEA,gBAAiB;IACnCK,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBG,IAAI,EAAEA,IAAK;IACXC,WAAW,EAAEA,WAAY;IACzBC,cAAc,EAAEA,cAAe;IAC/BC,aAAa,EAAEA;EAAc,CAChC,CACQ,CAAC;AAAA,CACjB;AAEDjB,KAAK,CAACwB,WAAW,GAAG,OAAO;AAE3B,eAAexB,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledMonth = styled.div`
|
|
3
|
+
height: ${_ref => {
|
|
4
|
+
let {
|
|
5
|
+
$height
|
|
6
|
+
} = _ref;
|
|
7
|
+
return $height;
|
|
8
|
+
}}px;
|
|
9
|
+
aspect-ratio: 1;
|
|
10
|
+
`;
|
|
11
|
+
export const StyledMonthHead = styled.div`
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
column-gap: 7px;
|
|
16
|
+
`;
|
|
17
|
+
export const StyledMonthName = styled.div`
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
text-align: center;
|
|
20
|
+
user-select: none;
|
|
21
|
+
`;
|
|
22
|
+
//# sourceMappingURL=Month.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Month.styles.js","names":["styled","StyledMonth","div","_ref","$height","StyledMonthHead","StyledMonthName"],"sources":["../../../../../../src/components/calendar/month-wrapper/month/Month.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledMonthProps = WithTheme<{ $height: number }>;\n\nexport const StyledMonth = styled.div<StyledMonthProps>`\n height: ${({ $height }) => $height}px;\n aspect-ratio: 1;\n`;\n\nexport const StyledMonthHead = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n column-gap: 7px;\n`;\n\nexport const StyledMonthName = styled.div`\n font-weight: bold;\n text-align: center;\n user-select: none;\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,WAAW,GAAGD,MAAM,CAACE,GAAqB;AACvD,cAAcC,IAAA;EAAA,IAAC;IAAEC;EAAQ,CAAC,GAAAD,IAAA;EAAA,OAAKC,OAAO;AAAA;AACtC;AACA,CAAC;AAED,OAAO,MAAMC,eAAe,GAAGL,MAAM,CAACE,GAAG;AACzC;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMI,eAAe,GAAGN,MAAM,CAACE,GAAG;AACzC;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { CalendarType } from '../../../../../types/calendar';
|
|
3
|
+
import { findNextDate } from '../../../../../utils/calendar';
|
|
4
|
+
import Day from './day/Day';
|
|
5
|
+
import { StyledDayWrapper } from './DayWrapper.styles';
|
|
6
|
+
import { addDays, isAfter, isSameDay, isSameMonth, isWithinInterval, startOfMonth, startOfWeek } from "../../../../../utils/date";
|
|
7
|
+
const DayWrapper = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
month,
|
|
10
|
+
year,
|
|
11
|
+
highlightedDates,
|
|
12
|
+
onSelect,
|
|
13
|
+
selectedDate,
|
|
14
|
+
categories,
|
|
15
|
+
minDate,
|
|
16
|
+
maxDate,
|
|
17
|
+
customThumbColors,
|
|
18
|
+
type,
|
|
19
|
+
hoveringDay,
|
|
20
|
+
shouldShowHighlightsInMonthOverlay,
|
|
21
|
+
setHoveringDay,
|
|
22
|
+
disabledDates
|
|
23
|
+
} = _ref;
|
|
24
|
+
const dayOfCurrentMonth = useMemo(() => new Date(year, month - 1, 13), [month, year]);
|
|
25
|
+
const days = useMemo(() => {
|
|
26
|
+
const dateArray = [];
|
|
27
|
+
const currentDate = startOfMonth(dayOfCurrentMonth);
|
|
28
|
+
const startDay = startOfWeek(currentDate);
|
|
29
|
+
for (let i = 0; i < 42; i++) {
|
|
30
|
+
const newDate = addDays(startDay, i);
|
|
31
|
+
dateArray.push(newDate);
|
|
32
|
+
}
|
|
33
|
+
return dateArray;
|
|
34
|
+
}, [dayOfCurrentMonth]);
|
|
35
|
+
const handleDayClick = useCallback((date, shouldFireEvent) => {
|
|
36
|
+
if (shouldFireEvent) {
|
|
37
|
+
onSelect(date);
|
|
38
|
+
}
|
|
39
|
+
}, [onSelect]);
|
|
40
|
+
const dayElements = useMemo(() => {
|
|
41
|
+
const items = [];
|
|
42
|
+
const {
|
|
43
|
+
start,
|
|
44
|
+
end
|
|
45
|
+
} = selectedDate || {};
|
|
46
|
+
const firstDisabledDateAfterStart = findNextDate(start, disabledDates);
|
|
47
|
+
days.forEach(day => {
|
|
48
|
+
let isSelected = false;
|
|
49
|
+
let isIntervalStart = false;
|
|
50
|
+
let isIntervalEnd = false;
|
|
51
|
+
let isWithinIntervalSelection = false;
|
|
52
|
+
const showHoverEffect = false;
|
|
53
|
+
let isDisabled =
|
|
54
|
+
// Disables dates, that are not between minDate and maxDate.
|
|
55
|
+
!isWithinInterval(day, {
|
|
56
|
+
start: minDate,
|
|
57
|
+
end: maxDate
|
|
58
|
+
}) ||
|
|
59
|
+
// Disables
|
|
60
|
+
disabledDates.some(disabledDate => isSameDay(disabledDate, day));
|
|
61
|
+
if (type === CalendarType.Single && selectedDate instanceof Date) {
|
|
62
|
+
isSelected = isSameDay(selectedDate, day);
|
|
63
|
+
} else if (type === CalendarType.Multiple && Array.isArray(selectedDate)) {
|
|
64
|
+
isSelected = selectedDate.some(date => isSameDay(date, day));
|
|
65
|
+
} else if (type === CalendarType.Interval && start) {
|
|
66
|
+
isIntervalStart = isSameDay(start, day);
|
|
67
|
+
if (end) {
|
|
68
|
+
isIntervalEnd = isSameDay(end, day);
|
|
69
|
+
isWithinIntervalSelection = isWithinInterval(day, {
|
|
70
|
+
start,
|
|
71
|
+
end
|
|
72
|
+
});
|
|
73
|
+
} else if (firstDisabledDateAfterStart && !isDisabled && isAfter(day, firstDisabledDateAfterStart)) {
|
|
74
|
+
// Ensures, that the interval end can't be set in a way, that the interval includes disabled dates.
|
|
75
|
+
isDisabled = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (type === CalendarType.Interval && hoveringDay && !isIntervalStart && !isIntervalEnd && !isWithinIntervalSelection) {
|
|
79
|
+
if (!start) {
|
|
80
|
+
isIntervalStart = isSameDay(day, hoveringDay);
|
|
81
|
+
} else if (start && !end) {
|
|
82
|
+
if (start > day) {
|
|
83
|
+
isIntervalStart = isSameDay(day, hoveringDay);
|
|
84
|
+
} else {
|
|
85
|
+
isWithinIntervalSelection = isWithinInterval(day, {
|
|
86
|
+
start,
|
|
87
|
+
end: hoveringDay
|
|
88
|
+
});
|
|
89
|
+
isIntervalEnd = isSameDay(hoveringDay, day);
|
|
90
|
+
}
|
|
91
|
+
} else if (start && end && isSameDay(hoveringDay, day)) {
|
|
92
|
+
isIntervalStart = !isWithinInterval(day, {
|
|
93
|
+
start,
|
|
94
|
+
end
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
items.push(/*#__PURE__*/React.createElement(Day, {
|
|
99
|
+
key: `single-day-${day.toDateString()}`,
|
|
100
|
+
categories: categories,
|
|
101
|
+
date: day,
|
|
102
|
+
isSelected: isSelected,
|
|
103
|
+
customThumbColors: customThumbColors,
|
|
104
|
+
isIntervalStart: isIntervalStart,
|
|
105
|
+
isIntervalEnd: isIntervalEnd,
|
|
106
|
+
isWithinIntervalSelection: isWithinIntervalSelection,
|
|
107
|
+
isDisabled: isDisabled,
|
|
108
|
+
shouldShowHighlightsInMonthOverlay: shouldShowHighlightsInMonthOverlay,
|
|
109
|
+
isSameMonth: isSameMonth(day, dayOfCurrentMonth),
|
|
110
|
+
onClick: handleDayClick,
|
|
111
|
+
highlightedDates: highlightedDates,
|
|
112
|
+
setHoveringDay: setHoveringDay
|
|
113
|
+
}));
|
|
114
|
+
});
|
|
115
|
+
return items;
|
|
116
|
+
}, [selectedDate, disabledDates, days, minDate, maxDate, type, hoveringDay, categories, customThumbColors, shouldShowHighlightsInMonthOverlay, dayOfCurrentMonth, handleDayClick, highlightedDates, setHoveringDay]);
|
|
117
|
+
return /*#__PURE__*/React.createElement(StyledDayWrapper, null, dayElements);
|
|
118
|
+
};
|
|
119
|
+
DayWrapper.displayName = 'DayWrapper';
|
|
120
|
+
export default DayWrapper;
|
|
121
|
+
//# sourceMappingURL=DayWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayWrapper.js","names":["React","useCallback","useMemo","CalendarType","findNextDate","Day","StyledDayWrapper","addDays","isAfter","isSameDay","isSameMonth","isWithinInterval","startOfMonth","startOfWeek","DayWrapper","_ref","month","year","highlightedDates","onSelect","selectedDate","categories","minDate","maxDate","customThumbColors","type","hoveringDay","shouldShowHighlightsInMonthOverlay","setHoveringDay","disabledDates","dayOfCurrentMonth","Date","days","dateArray","currentDate","startDay","i","newDate","push","handleDayClick","date","shouldFireEvent","dayElements","items","start","end","firstDisabledDateAfterStart","forEach","day","isSelected","isIntervalStart","isIntervalEnd","isWithinIntervalSelection","showHoverEffect","isDisabled","some","disabledDate","Single","Multiple","Array","isArray","Interval","createElement","key","toDateString","onClick","displayName"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.tsx"],"sourcesContent":["import React, { FC, useCallback, useMemo, type ReactElement } from 'react';\nimport {\n CalendarType,\n type Categories, CustomThumbColors,\n type DateInterval,\n type EMonth,\n type HighlightedDates,\n} from '../../../../../types/calendar';\nimport { findNextDate } from '../../../../../utils/calendar';\nimport Day from './day/Day';\nimport { StyledDayWrapper } from './DayWrapper.styles';\nimport {\n addDays,\n isAfter,\n isSameDay,\n isSameMonth,\n isWithinInterval,\n startOfMonth,\n startOfWeek\n} from \"../../../../../utils/date\";\n\nexport type DayWrapperProps = {\n month: EMonth;\n year: number;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n minDate: Date;\n maxDate: Date;\n type: CalendarType;\n hoveringDay: Date | null;\n setHoveringDay: (date: Date | null) => void;\n disabledDates: Date[];\n customThumbColors?: CustomThumbColors;\n shouldShowHighlightsInMonthOverlay: boolean;\n};\n\nconst DayWrapper: FC<DayWrapperProps> = ({\n month,\n year,\n highlightedDates,\n onSelect,\n selectedDate,\n categories,\n minDate,\n maxDate,customThumbColors,\n type,\n hoveringDay,\n shouldShowHighlightsInMonthOverlay,\n setHoveringDay,\n disabledDates,\n}) => {\n const dayOfCurrentMonth = useMemo(() => new Date(year, month - 1, 13), [month, year]);\n\n const days = useMemo(() => {\n const dateArray: Date[] = [];\n\n const currentDate = startOfMonth(dayOfCurrentMonth);\n\n const startDay = startOfWeek(currentDate);\n\n for (let i = 0; i < 42; i++) {\n const newDate = addDays(startDay, i);\n dateArray.push(newDate);\n }\n\n return dateArray;\n }, [dayOfCurrentMonth]);\n\n const handleDayClick = useCallback(\n (date: Date, shouldFireEvent: boolean) => {\n if (shouldFireEvent) {\n onSelect(date);\n }\n },\n [onSelect],\n );\n\n const dayElements = useMemo(() => {\n const items: ReactElement[] = [];\n\n const { start, end } = (selectedDate || {}) as DateInterval;\n const firstDisabledDateAfterStart = findNextDate(start, disabledDates);\n\n days.forEach((day) => {\n let isSelected = false;\n let isIntervalStart = false;\n let isIntervalEnd = false;\n let isWithinIntervalSelection = false;\n const showHoverEffect = false;\n\n let isDisabled =\n // Disables dates, that are not between minDate and maxDate.\n !isWithinInterval(day, { start: minDate, end: maxDate }) ||\n // Disables\n disabledDates.some((disabledDate) => isSameDay(disabledDate, day));\n\n if (type === CalendarType.Single && selectedDate instanceof Date) {\n isSelected = isSameDay(selectedDate, day);\n } else if (type === CalendarType.Multiple && Array.isArray(selectedDate)) {\n isSelected = selectedDate.some((date) => isSameDay(date, day));\n } else if (type === CalendarType.Interval && start) {\n isIntervalStart = isSameDay(start, day);\n if (end) {\n isIntervalEnd = isSameDay(end, day);\n\n isWithinIntervalSelection = isWithinInterval(day, {\n start,\n end,\n });\n } else if (\n firstDisabledDateAfterStart &&\n !isDisabled &&\n isAfter(day, firstDisabledDateAfterStart)\n ) {\n // Ensures, that the interval end can't be set in a way, that the interval includes disabled dates.\n isDisabled = true;\n }\n }\n\n if (\n type === CalendarType.Interval &&\n hoveringDay &&\n !isIntervalStart &&\n !isIntervalEnd &&\n !isWithinIntervalSelection\n ) {\n if (!start) {\n isIntervalStart = isSameDay(day, hoveringDay);\n } else if (start && !end) {\n if (start > day) {\n isIntervalStart = isSameDay(day, hoveringDay);\n } else {\n isWithinIntervalSelection = isWithinInterval(day, {\n start,\n end: hoveringDay,\n });\n isIntervalEnd = isSameDay(hoveringDay, day);\n }\n } else if (start && end && isSameDay(hoveringDay, day)) {\n isIntervalStart = !isWithinInterval(day, { start, end });\n }\n }\n\n items.push(\n <Day\n key={`single-day-${day.toDateString()}`}\n categories={categories}\n date={day}\n isSelected={isSelected}\n customThumbColors={customThumbColors}\n isIntervalStart={isIntervalStart}\n isIntervalEnd={isIntervalEnd}\n isWithinIntervalSelection={isWithinIntervalSelection}\n isDisabled={isDisabled}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n isSameMonth={isSameMonth(day, dayOfCurrentMonth)}\n onClick={handleDayClick}\n highlightedDates={highlightedDates}\n setHoveringDay={setHoveringDay}\n />,\n );\n });\n\n return items;\n }, [selectedDate, disabledDates, days, minDate, maxDate, type, hoveringDay, categories, customThumbColors, shouldShowHighlightsInMonthOverlay, dayOfCurrentMonth, handleDayClick, highlightedDates, setHoveringDay]);\n\n return <StyledDayWrapper>{dayElements}</StyledDayWrapper>;\n};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D;MACJ;MAEAF,KAAK,CAACL,IAAI,cACNtC,KAAA,CAAA8D,aAAA,CAACzD,GAAG;QACA0D,GAAG,EAAE,cAAcf,GAAG,CAACgB,YAAY,CAAC,CAAC,EAAG;QACxC3C,UAAU,EAAEA,UAAW;QACvBmB,IAAI,EAAEQ,GAAI;QACVC,UAAU,EAAEA,UAAW;QACvBzB,iBAAiB,EAAEA,iBAAkB;QACrC0B,eAAe,EAAEA,eAAgB;QACjCC,aAAa,EAAEA,aAAc;QAC7BC,yBAAyB,EAAEA,yBAA0B;QACrDE,UAAU,EAAEA,UAAW;QACvB3B,kCAAkC,EAAEA,kCAAmC;QACvEjB,WAAW,EAAEA,WAAW,CAACsC,GAAG,EAAElB,iBAAiB,CAAE;QACjDmC,OAAO,EAAE1B,cAAe;QACxBrB,gBAAgB,EAAEA,gBAAiB;QACnCU,cAAc,EAAEA;MAAe,CAClC,CACL,CAAC;IACL,CAAC,CAAC;IAEF,OAAOe,KAAK;EAChB,CAAC,EAAE,CAACvB,YAAY,EAAES,aAAa,EAAEG,IAAI,EAAEV,OAAO,EAAEC,OAAO,EAAEE,IAAI,EAAEC,WAAW,EAAEL,UAAU,EAAEG,iBAAiB,EAAEG,kCAAkC,EAAEG,iBAAiB,EAAES,cAAc,EAAErB,gBAAgB,EAAEU,cAAc,CAAC,CAAC;EAEpN,oBAAO5B,KAAA,CAAA8D,aAAA,CAACxD,gBAAgB,QAAEoC,WAA8B,CAAC;AAC7D,CAAC;AAED5B,UAAU,CAACoD,WAAW,GAAG,YAAY;AAErC,eAAepD,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledDayWrapper = styled.div`
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-rows: repeat(6, 1fr);
|
|
5
|
+
grid-template-columns: repeat(7, 1fr);
|
|
6
|
+
padding-top: 6px;
|
|
7
|
+
margin: 0 15px;
|
|
8
|
+
`;
|
|
9
|
+
//# sourceMappingURL=DayWrapper.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayWrapper.styles.js","names":["styled","StyledDayWrapper","div"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledDayWrapper = styled.div`\n display: grid;\n grid-template-rows: repeat(6, 1fr);\n grid-template-columns: repeat(7, 1fr);\n padding-top: 6px;\n margin: 0 15px;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,gBAAgB,GAAGD,MAAM,CAACE,GAAG;AAC1C;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useMemo, useRef } from 'react';
|
|
2
|
+
import Category from './category/Category';
|
|
3
|
+
import { StyledDay, StyledDayCategoryWrapper, StyledDayNumber } from './Day.styles';
|
|
4
|
+
import { isSameDay } from "../../../../../../utils/date";
|
|
5
|
+
const Day = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
date,
|
|
8
|
+
highlightedDates,
|
|
9
|
+
categories,
|
|
10
|
+
isSameMonth,
|
|
11
|
+
isSelected,
|
|
12
|
+
onClick,
|
|
13
|
+
isDisabled,
|
|
14
|
+
isIntervalStart,
|
|
15
|
+
isIntervalEnd,
|
|
16
|
+
customThumbColors,
|
|
17
|
+
isWithinIntervalSelection,
|
|
18
|
+
shouldShowHighlightsInMonthOverlay,
|
|
19
|
+
setHoveringDay
|
|
20
|
+
} = _ref;
|
|
21
|
+
const dayRef = useRef(null);
|
|
22
|
+
const styles = useMemo(() => {
|
|
23
|
+
if (!highlightedDates || !shouldShowHighlightsInMonthOverlay && !isSameMonth) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return highlightedDates.find(highlightedDate => highlightedDate.dates.some(highlighted => isSameDay(highlighted, date)))?.style;
|
|
27
|
+
}, [date, highlightedDates, isSameMonth, shouldShowHighlightsInMonthOverlay]);
|
|
28
|
+
const categoryElements = useMemo(() => {
|
|
29
|
+
if (!categories || !shouldShowHighlightsInMonthOverlay && !isSameMonth) return [];
|
|
30
|
+
return categories.flatMap(category => category.dates.filter(day => isSameDay(day, date)).map(day => /*#__PURE__*/React.createElement(Category, {
|
|
31
|
+
key: day.getTime() * Math.random(),
|
|
32
|
+
color: category.color
|
|
33
|
+
})));
|
|
34
|
+
}, [categories, date, isSameMonth, shouldShowHighlightsInMonthOverlay]);
|
|
35
|
+
return /*#__PURE__*/React.createElement(StyledDay, {
|
|
36
|
+
ref: dayRef,
|
|
37
|
+
onClick: () => onClick(date, isSameMonth && !isDisabled),
|
|
38
|
+
$isSameMonth: isSameMonth,
|
|
39
|
+
$isDisabled: isDisabled,
|
|
40
|
+
$backgroundColor: styles?.backgroundColor,
|
|
41
|
+
$textColor: styles?.textColor,
|
|
42
|
+
onMouseEnter: () => setHoveringDay(date),
|
|
43
|
+
onMouseLeave: () => setHoveringDay(null)
|
|
44
|
+
}, /*#__PURE__*/React.createElement(StyledDayNumber, {
|
|
45
|
+
$customThumbColors: customThumbColors,
|
|
46
|
+
$isSelected: shouldShowHighlightsInMonthOverlay ? isSelected : isSelected && isSameMonth,
|
|
47
|
+
$isIntervalStart: shouldShowHighlightsInMonthOverlay ? isIntervalStart : isIntervalStart && isSameMonth,
|
|
48
|
+
$isIntervalEnd: shouldShowHighlightsInMonthOverlay ? isIntervalEnd : isIntervalEnd && isSameMonth,
|
|
49
|
+
$isWithinIntervalSelection: shouldShowHighlightsInMonthOverlay ? isWithinIntervalSelection : isWithinIntervalSelection && isSameMonth
|
|
50
|
+
}, date.getDate()), categoryElements && /*#__PURE__*/React.createElement(StyledDayCategoryWrapper, null, categoryElements));
|
|
51
|
+
};
|
|
52
|
+
Day.displayName = 'Day';
|
|
53
|
+
export default Day;
|
|
54
|
+
//# sourceMappingURL=Day.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Day.js","names":["React","useMemo","useRef","Category","StyledDay","StyledDayCategoryWrapper","StyledDayNumber","isSameDay","Day","_ref","date","highlightedDates","categories","isSameMonth","isSelected","onClick","isDisabled","isIntervalStart","isIntervalEnd","customThumbColors","isWithinIntervalSelection","shouldShowHighlightsInMonthOverlay","setHoveringDay","dayRef","styles","undefined","find","highlightedDate","dates","some","highlighted","style","categoryElements","flatMap","category","filter","day","map","createElement","key","getTime","Math","random","color","ref","$isSameMonth","$isDisabled","$backgroundColor","backgroundColor","$textColor","textColor","onMouseEnter","onMouseLeave","$customThumbColors","$isSelected","$isIntervalStart","$isIntervalEnd","$isWithinIntervalSelection","getDate","displayName"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/Day.tsx"],"sourcesContent":["import React, { FC, useMemo, useRef } from 'react';\nimport {\n Categories, CustomThumbColors,\n HighlightedDates,\n HighlightedDateStyles,\n} from '../../../../../../types/calendar';\nimport Category from './category/Category';\nimport { StyledDay, StyledDayCategoryWrapper, StyledDayNumber } from './Day.styles';\nimport {isSameDay} from \"../../../../../../utils/date\";\n\nexport type DayProps = {\n date: Date;\n isSameMonth: boolean;\n isSelected: boolean;\n onClick: (date: Date, shouldFireEvent: boolean) => void;\n highlightedDates?: HighlightedDates[];\n categories?: Categories[];\n isDisabled: boolean;\n isIntervalStart: boolean;\n isIntervalEnd: boolean;\n isWithinIntervalSelection: boolean;\n setHoveringDay: (date: Date | null) => void;\n shouldShowHighlightsInMonthOverlay: boolean;\n customThumbColors?: CustomThumbColors;\n};\n\nconst Day: FC<DayProps> = ({\n date,\n highlightedDates,\n categories,\n isSameMonth,\n isSelected,\n onClick,\n isDisabled,\n isIntervalStart,\n isIntervalEnd,customThumbColors,\n isWithinIntervalSelection,\n shouldShowHighlightsInMonthOverlay,\n setHoveringDay,\n}) => {\n const dayRef = useRef<HTMLDivElement>(null);\n\n const styles: HighlightedDateStyles | undefined = useMemo(() => {\n if (!highlightedDates || (!shouldShowHighlightsInMonthOverlay && !isSameMonth)) {\n return undefined;\n }\n\n return highlightedDates.find((highlightedDate) =>\n highlightedDate.dates.some((highlighted) => isSameDay(highlighted, date)),\n )?.style;\n }, [date, highlightedDates, isSameMonth, shouldShowHighlightsInMonthOverlay]);\n\n const categoryElements = useMemo(() => {\n if (!categories || (!shouldShowHighlightsInMonthOverlay && !isSameMonth)) return [];\n\n return categories.flatMap((category) =>\n category.dates\n .filter((day) => isSameDay(day, date))\n .map((day) => (\n <Category key={day.getTime() * Math.random()} color={category.color} />\n )),\n );\n }, [categories, date, isSameMonth, shouldShowHighlightsInMonthOverlay]);\n\n return (\n <StyledDay\n ref={dayRef}\n onClick={() => onClick(date, isSameMonth && !isDisabled)}\n $isSameMonth={isSameMonth}\n $isDisabled={isDisabled}\n $backgroundColor={styles?.backgroundColor}\n $textColor={styles?.textColor}\n onMouseEnter={() => setHoveringDay(date)}\n onMouseLeave={() => setHoveringDay(null)}\n >\n <StyledDayNumber\n $customThumbColors={customThumbColors}\n $isSelected={\n shouldShowHighlightsInMonthOverlay ? isSelected : isSelected && isSameMonth\n }\n $isIntervalStart={\n shouldShowHighlightsInMonthOverlay\n ? isIntervalStart\n : isIntervalStart && isSameMonth\n }\n $isIntervalEnd={\n shouldShowHighlightsInMonthOverlay\n ? isIntervalEnd\n : isIntervalEnd && isSameMonth\n }\n $isWithinIntervalSelection={\n shouldShowHighlightsInMonthOverlay\n ? isWithinIntervalSelection\n : isWithinIntervalSelection && isSameMonth\n }\n >\n {date.getDate()}\n </StyledDayNumber>\n {categoryElements && (\n <StyledDayCategoryWrapper>{categoryElements}</StyledDayCategoryWrapper>\n )}\n </StyledDay>\n );\n};\n\nDay.displayName = 'Day';\n\nexport default Day;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAMlD,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAASC,SAAS,EAAEC,wBAAwB,EAA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`
|
|
3
|
+
position: relative;
|
|
4
|
+
cursor: ${_ref => {
|
|
5
|
+
let {
|
|
6
|
+
$isSameMonth,
|
|
7
|
+
$isDisabled
|
|
8
|
+
} = _ref;
|
|
9
|
+
return $isSameMonth && !$isDisabled ? 'pointer' : 'default';
|
|
10
|
+
}};
|
|
11
|
+
color: ${_ref2 => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref2;
|
|
15
|
+
return theme.text;
|
|
16
|
+
}};
|
|
17
|
+
opacity: ${_ref3 => {
|
|
18
|
+
let {
|
|
19
|
+
$isSameMonth,
|
|
20
|
+
$isDisabled
|
|
21
|
+
} = _ref3;
|
|
22
|
+
if ($isSameMonth && !$isDisabled) {
|
|
23
|
+
return '1';
|
|
24
|
+
}
|
|
25
|
+
if ($isDisabled) {
|
|
26
|
+
return '0.2';
|
|
27
|
+
}
|
|
28
|
+
return '0.5';
|
|
29
|
+
}};
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
aspect-ratio: 1;
|
|
35
|
+
pointer-events: ${_ref4 => {
|
|
36
|
+
let {
|
|
37
|
+
$isSameMonth,
|
|
38
|
+
$isDisabled
|
|
39
|
+
} = _ref4;
|
|
40
|
+
return $isSameMonth && !$isDisabled ? 'auto' : 'none';
|
|
41
|
+
}};
|
|
42
|
+
|
|
43
|
+
${_ref5 => {
|
|
44
|
+
let {
|
|
45
|
+
$backgroundColor,
|
|
46
|
+
$textColor
|
|
47
|
+
} = _ref5;
|
|
48
|
+
return $backgroundColor && $textColor && css`
|
|
49
|
+
color: ${$textColor};
|
|
50
|
+
background-color: ${$backgroundColor};
|
|
51
|
+
`;
|
|
52
|
+
}}
|
|
53
|
+
`;
|
|
54
|
+
export const StyledDayNumber = styled.div`
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
width: 80%;
|
|
60
|
+
height: 80%;
|
|
61
|
+
font-size: 90%;
|
|
62
|
+
|
|
63
|
+
${_ref6 => {
|
|
64
|
+
let {
|
|
65
|
+
$isSelected,
|
|
66
|
+
$isIntervalEnd,
|
|
67
|
+
$isIntervalStart,
|
|
68
|
+
$isWithinIntervalSelection,
|
|
69
|
+
$customThumbColors,
|
|
70
|
+
theme
|
|
71
|
+
} = _ref6;
|
|
72
|
+
return !!($isSelected || $isIntervalStart || $isIntervalEnd || $isWithinIntervalSelection) && css`
|
|
73
|
+
background-color: ${$customThumbColors?.mainBackgroundColor ?? theme['404']};
|
|
74
|
+
color: ${$customThumbColors?.mainTextColor ?? theme['409']};
|
|
75
|
+
`;
|
|
76
|
+
}}
|
|
77
|
+
|
|
78
|
+
${_ref7 => {
|
|
79
|
+
let {
|
|
80
|
+
$isIntervalStart,
|
|
81
|
+
$isIntervalEnd,
|
|
82
|
+
$isWithinIntervalSelection,
|
|
83
|
+
$customThumbColors,
|
|
84
|
+
theme
|
|
85
|
+
} = _ref7;
|
|
86
|
+
if ($isIntervalStart && $isIntervalEnd) {
|
|
87
|
+
return css`
|
|
88
|
+
border-radius: 5px;
|
|
89
|
+
width: 100%;
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
if ($isIntervalStart) {
|
|
93
|
+
return css`
|
|
94
|
+
border-radius: 5px 0 0 5px;
|
|
95
|
+
width: 100%;
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
if ($isIntervalEnd) {
|
|
99
|
+
return css`
|
|
100
|
+
border-radius: 0 5px 5px 0;
|
|
101
|
+
width: 100%;
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
if ($isWithinIntervalSelection) {
|
|
105
|
+
return css`
|
|
106
|
+
border-radius: 0;
|
|
107
|
+
width: 100%;
|
|
108
|
+
background-color: ${$customThumbColors?.secondaryBackgroundColor ?? theme['403']};
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
return '';
|
|
112
|
+
}}
|
|
113
|
+
`;
|
|
114
|
+
export const StyledDayCategoryWrapper = styled.div`
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
gap: 6%;
|
|
119
|
+
width: 100%;
|
|
120
|
+
position: absolute;
|
|
121
|
+
bottom: 2px;
|
|
122
|
+
`;
|
|
123
|
+
//# sourceMappingURL=Day.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Day.styles.js","names":["styled","css","StyledDay","div","_ref","$isSameMonth","$isDisabled","_ref2","theme","text","_ref3","_ref4","_ref5","$backgroundColor","$textColor","StyledDayNumber","_ref6","$isSelected","$isIntervalEnd","$isIntervalStart","$isWithinIntervalSelection","$customThumbColors","mainBackgroundColor","mainTextColor","_ref7","secondaryBackgroundColor","StyledDayCategoryWrapper"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport {CustomThumbColors} from \"../../../../../../types/calendar\";\n\ntype StyledDayProps = WithTheme<{\n $isSameMonth: boolean;\n $backgroundColor?: CSSProperties['backgroundColor'];\n $textColor?: CSSProperties['color'];\n $isDisabled: boolean;\n}>;\n\nexport const StyledDay = styled.div<StyledDayProps>`\n position: relative;\n cursor: ${({ $isSameMonth, $isDisabled }) =>\n $isSameMonth && !$isDisabled ? 'pointer' : 'default'};\n color: ${({ theme }: StyledDayProps) => theme.text};\n opacity: ${({ $isSameMonth, $isDisabled }) => {\n if ($isSameMonth && !$isDisabled) {\n return '1';\n }\n if ($isDisabled) {\n return '0.2';\n }\n return '0.5';\n }};\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n aspect-ratio: 1;\n pointer-events: ${({ $isSameMonth, $isDisabled }) =>\n $isSameMonth && !$isDisabled ? 'auto' : 'none'};\n\n ${({ $backgroundColor, $textColor }) =>\n $backgroundColor &&\n $textColor &&\n css`\n color: ${$textColor};\n background-color: ${$backgroundColor};\n `}\n`;\n\ntype StyledDayNumberProps = WithTheme<{\n $isSelected: boolean;\n $isIntervalEnd: boolean;\n $isIntervalStart: boolean;\n $isWithinIntervalSelection: boolean;\n $customThumbColors?: CustomThumbColors;\n}>;\n\nexport const StyledDayNumber = styled.div<StyledDayNumberProps>`\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 80%;\n height: 80%;\n font-size: 90%;\n\n ${({ $isSelected, $isIntervalEnd, $isIntervalStart, $isWithinIntervalSelection, $customThumbColors, theme }) =>\n !!($isSelected || $isIntervalStart || $isIntervalEnd || $isWithinIntervalSelection) &&\n css`\n background-color: ${$customThumbColors?.mainBackgroundColor ?? theme['404']};\n color: ${$customThumbColors?.mainTextColor ?? theme['409']};\n `}\n\n ${({ $isIntervalStart, $isIntervalEnd, $isWithinIntervalSelection, $customThumbColors, theme }) => {\n if ($isIntervalStart && $isIntervalEnd) {\n return css`\n border-radius: 5px;\n width: 100%;\n `;\n }\n if ($isIntervalStart) {\n return css`\n border-radius: 5px 0 0 5px;\n width: 100%;\n `;\n }\n if ($isIntervalEnd) {\n return css`\n border-radius: 0 5px 5px 0;\n width: 100%;\n `;\n }\n if ($isWithinIntervalSelection) {\n return css`\n border-radius: 0;\n width: 100%;\n background-color: ${$customThumbColors?.secondaryBackgroundColor ?? theme['403']};\n `;\n }\n\n return '';\n }}\n`;\n\nexport const StyledDayCategoryWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6%;\n width: 100%;\n position: absolute;\n bottom: 2px;\n`;\n"],"mappings":"AAEA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAU/C,OAAO,MAAMC,SAAS,GAAGF,MAAM,CAACG,GAAmB;AACnD;AACA,cAAcC,IAAA;EAAA,IAAC;IAAEC,YAAY;IAAEC;EAAY,CAAC,GAAAF,IAA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AK,CAAC;AACtE,SAAS;AAAA;AACT;AACA,MAAMgB,KAAA,IAAiG;EAAA,IAAhG;IAAEL,gBAAgB;IAAED,cAAc;IAAEE,0BAA0B;IAAEC,kBAAkB;IAAEb;EAAM,CAAC,GAAAgB,KAAA;EAC1F,IAAIL,gBAAgB,IAAID,cAAc,EAAE;IACpC,OAAOjB,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,IAAIkB,gBAAgB,EAAE;IAClB,OAAOlB,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,IAAIiB,cAAc,EAAE;IAChB,OAAOjB,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,IAAImB,0BAA0B,EAAE;IAC5B,OAAOnB,GAAG;AACtB;AACA;AACA,oCAAoCoB,kBAAkB,EAAEI,wBAAwB,IAAIjB,KAAK,CAAC,KAAK,CAAC;AAChG,aAAa;EACL;EAEA,OAAO,EAAE;AACb,CAAC;AACL,CAAC;AAED,OAAO,MAAMkB,wBAAwB,GAAG1B,MAAM,CAACG,GAAG;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledCategory } from './Category.styles';
|
|
3
|
+
const Category = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
color
|
|
6
|
+
} = _ref;
|
|
7
|
+
return /*#__PURE__*/React.createElement(StyledCategory, {
|
|
8
|
+
$color: color
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Category.displayName = 'Category';
|
|
12
|
+
export default Category;
|
|
13
|
+
//# sourceMappingURL=Category.js.map
|
package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Category.js","names":["React","StyledCategory","Category","_ref","color","createElement","$color","displayName"],"sources":["../../../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.tsx"],"sourcesContent":["import React, { FC, type CSSProperties } from 'react';\nimport { StyledCategory } from './Category.styles';\n\nexport type CategoryProps = {\n color: CSSProperties['color'];\n};\n\nconst Category: FC<CategoryProps> = ({ color }) => <StyledCategory $color={color} />;\n\nCategory.displayName = 'Category';\n\nexport default Category;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAkC,OAAO;AACrD,SAASC,cAAc,QAAQ,mBAAmB;AAMlD,MAAMC,QAA2B,GAAGC,IAAA;EAAA,IAAC;IAAEC;EAAM,CAAC,GAAAD,IAAA;EAAA,oBAAKH,KAAA,CAAAK,aAAA,CAACJ,cAAc;IAACK,MAAM,EAAEF;EAAM,CAAE,CAAC;AAAA;AAEpFF,QAAQ,CAACK,WAAW,GAAG,UAAU;AAEjC,eAAeL,QAAQ","ignoreList":[]}
|
package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledCategory = styled.div`
|
|
3
|
+
border-radius: 50%;
|
|
4
|
+
width: 24%;
|
|
5
|
+
aspect-ratio: 1;
|
|
6
|
+
background-color: ${_ref => {
|
|
7
|
+
let {
|
|
8
|
+
$color
|
|
9
|
+
} = _ref;
|
|
10
|
+
return $color;
|
|
11
|
+
}};
|
|
12
|
+
border: 1px solid white;
|
|
13
|
+
`;
|
|
14
|
+
//# sourceMappingURL=Category.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Category.styles.js","names":["styled","StyledCategory","div","_ref","$color"],"sources":["../../../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport type { CSSProperties } from 'react';\nimport styled from 'styled-components';\n\ntype StyledCategoryProps = WithTheme<{ $color: CSSProperties['color'] }>;\n\nexport const StyledCategory = styled.div<StyledCategoryProps>`\n border-radius: 50%;\n width: 24%;\n aspect-ratio: 1;\n background-color: ${({ $color }) => $color};\n border: 1px solid white;\n`;\n"],"mappings":"AAEA,OAAOA,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,cAAc,GAAGD,MAAM,CAACE,GAAwB;AAC7D;AACA;AACA;AACA,wBAAwBC,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAKC,MAAM;AAAA;AAC9C;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { StyledWeekdayWrapper } from './WeekdayWrapper.styles';
|
|
3
|
+
import Weekday from './weekday/Weekday';
|
|
4
|
+
import { eachDayOfInterval, endOfWeek, startOfWeek } from "../../../../../utils/date";
|
|
5
|
+
const WeekdayWrapper = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
locale
|
|
8
|
+
} = _ref;
|
|
9
|
+
const monday = startOfWeek(new Date());
|
|
10
|
+
const sunday = endOfWeek(new Date());
|
|
11
|
+
const weekdays = eachDayOfInterval({
|
|
12
|
+
start: monday,
|
|
13
|
+
end: sunday
|
|
14
|
+
});
|
|
15
|
+
const weekdayElements = useMemo(() => {
|
|
16
|
+
const items = [];
|
|
17
|
+
weekdays.forEach(day => {
|
|
18
|
+
const options = {
|
|
19
|
+
weekday: 'short'
|
|
20
|
+
};
|
|
21
|
+
const formatter = new Intl.DateTimeFormat(locale, options);
|
|
22
|
+
const formattedDay = formatter.format(day);
|
|
23
|
+
items.push(/*#__PURE__*/React.createElement(Weekday, {
|
|
24
|
+
key: `weekday-${formattedDay}`,
|
|
25
|
+
name: formattedDay
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
28
|
+
return items;
|
|
29
|
+
}, [locale, weekdays]);
|
|
30
|
+
return /*#__PURE__*/React.createElement(StyledWeekdayWrapper, null, weekdayElements);
|
|
31
|
+
};
|
|
32
|
+
WeekdayWrapper.displayName = 'WeekdayWrapper';
|
|
33
|
+
export default WeekdayWrapper;
|
|
34
|
+
//# sourceMappingURL=WeekdayWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeekdayWrapper.js","names":["React","useMemo","StyledWeekdayWrapper","Weekday","eachDayOfInterval","endOfWeek","startOfWeek","WeekdayWrapper","_ref","locale","monday","Date","sunday","weekdays","start","end","weekdayElements","items","forEach","day","options","weekday","formatter","Intl","DateTimeFormat","formattedDay","format","push","createElement","key","name","displayName"],"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,OAAOA,KAAK,IAA2BC,OAAO,QAAQ,OAAO;AAC7D,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,OAAOC,OAAO,MAAM,mBAAmB;AAEvC,SAAQC,iBAAiB,EAAEC,SAAS,EAAEC,WAAW,QAAO,2BAA2B;AAMnF,MAAMC,cAAuC,GAAGC,IAAA,IAAgB;EAAA,IAAf;IAAEC;EAAO,CAAC,GAAAD,IAAA;EACvD,MAAME,MAAM,GAAGJ,WAAW,CAAC,IAAIK,IAAI,CAAC,CAAC,CAAC;EACtC,MAAMC,MAAM,GAAGP,SAAS,CAAC,IAAIM,IAAI,CAAC,CAAC,CAAC;EACpC,MAAME,QAAQ,GAAGT,iBAAiB,CAAC;IAAEU,KAAK,EAAEJ,MAAM;IAAEK,GAAG,EAAEH;EAAO,CAAC,CAAC;EAElE,MAAMI,eAAe,GAAGf,OAAO,CAAC,MAAM;IAClC,MAAMgB,KAAqB,GAAG,EAAE;IAEhCJ,QAAQ,CAACK,OAAO,CAAEC,GAAG,IAAK;MACtB,MAAMC,OAAmC,GAAG;QAAEC,OAAO,EAAE;MAAQ,CAAC;MAChE,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,cAAc,CAACf,MAAM,EAAEW,OAAO,CAAC;MAC1D,MAAMK,YAAY,GAAGH,SAAS,CAACI,MAAM,CAACP,GAAG,CAAC;MAE1CF,KAAK,CAACU,IAAI,cAAC3B,KAAA,CAAA4B,aAAA,CAACzB,OAAO;QAAC0B,GAAG,EAAE,WAAWJ,YAAY,EAAG;QAACK,IAAI,EAAEL;MAAa,CAAE,CAAC,CAAC;IAC/E,CAAC,CAAC;IAEF,OAAOR,KAAK;EAChB,CAAC,EAAE,CAACR,MAAM,EAAEI,QAAQ,CAAC,CAAC;EAEtB,oBAAOb,KAAA,CAAA4B,aAAA,CAAC1B,oBAAoB,QAAEc,eAAsC,CAAC;AACzE,CAAC;AAEDT,cAAc,CAACwB,WAAW,GAAG,gBAAgB;AAE7C,eAAexB,cAAc","ignoreList":[]}
|
package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledWeekdayWrapper = styled.div`
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-rows: repeat(1, 1fr);
|
|
5
|
+
grid-template-columns: repeat(7, 1fr);
|
|
6
|
+
padding-top: 6px;
|
|
7
|
+
margin: 0 15px;
|
|
8
|
+
`;
|
|
9
|
+
//# sourceMappingURL=WeekdayWrapper.styles.js.map
|
package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeekdayWrapper.styles.js","names":["styled","StyledWeekdayWrapper","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,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,oBAAoB,GAAGD,MAAM,CAACE,GAAG;AAC9C;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledWeekday } from './Weekday.styles';
|
|
3
|
+
const Weekday = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
name
|
|
6
|
+
} = _ref;
|
|
7
|
+
return /*#__PURE__*/React.createElement(StyledWeekday, null, name);
|
|
8
|
+
};
|
|
9
|
+
Weekday.displayName = 'Weekday';
|
|
10
|
+
export default Weekday;
|
|
11
|
+
//# sourceMappingURL=Weekday.js.map
|
package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Weekday.js","names":["React","StyledWeekday","Weekday","_ref","name","createElement","displayName"],"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,OAAOA,KAAK,MAAc,OAAO;AACjC,SAASC,aAAa,QAAQ,kBAAkB;AAMhD,MAAMC,OAAyB,GAAGC,IAAA;EAAA,IAAC;IAAEC;EAAK,CAAC,GAAAD,IAAA;EAAA,oBAAKH,KAAA,CAAAK,aAAA,CAACJ,aAAa,QAAEG,IAAoB,CAAC;AAAA;AAErFF,OAAO,CAACI,WAAW,GAAG,SAAS;AAE/B,eAAeJ,OAAO","ignoreList":[]}
|
package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledWeekday = styled.div`
|
|
3
|
+
color: ${_ref => {
|
|
4
|
+
let {
|
|
5
|
+
theme
|
|
6
|
+
} = _ref;
|
|
7
|
+
return theme.headline;
|
|
8
|
+
}};
|
|
9
|
+
cursor: default;
|
|
10
|
+
font-size: 90%;
|
|
11
|
+
text-align: center;
|
|
12
|
+
`;
|
|
13
|
+
//# sourceMappingURL=Weekday.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Weekday.styles.js","names":["styled","StyledWeekday","div","_ref","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,OAAOA,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,aAAa,GAAGD,MAAM,CAACE,GAAuB;AAC3D,aAAaC,IAAA;EAAA,IAAC;IAAEC;EAA0B,CAAC,GAAAD,IAAA;EAAA,OAAKC,KAAK,CAACC,QAAQ;AAAA;AAC9D;AACA;AACA;AACA,CAAC","ignoreList":[]}
|