@chayns-components/date 5.0.0-beta.577 → 5.0.0-beta.582

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.
Files changed (187) hide show
  1. package/lib/cjs/components/calendar/Calendar.js +140 -0
  2. package/lib/cjs/components/calendar/Calendar.js.map +1 -0
  3. package/lib/cjs/components/calendar/Calendar.styles.js +20 -0
  4. package/lib/cjs/components/calendar/Calendar.styles.js.map +1 -0
  5. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js +153 -0
  6. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js.map +1 -0
  7. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js +21 -0
  8. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -0
  9. package/lib/cjs/components/calendar/month-wrapper/month/Month.js +42 -0
  10. package/lib/cjs/components/calendar/month-wrapper/month/Month.js.map +1 -0
  11. package/lib/cjs/components/calendar/month-wrapper/month/Month.styles.js +23 -0
  12. package/lib/cjs/components/calendar/month-wrapper/month/Month.styles.js.map +1 -0
  13. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +59 -0
  14. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -0
  15. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +17 -0
  16. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -0
  17. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +66 -0
  18. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -0
  19. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +60 -0
  20. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -0
  21. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +17 -0
  22. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -0
  23. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +18 -0
  24. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -0
  25. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +44 -0
  26. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -0
  27. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +16 -0
  28. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -0
  29. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +15 -0
  30. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -0
  31. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +16 -0
  32. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -0
  33. package/lib/cjs/components/date-info/DateInfo.js +109 -0
  34. package/lib/cjs/components/date-info/DateInfo.js.map +1 -0
  35. package/lib/cjs/components/opening-times/OpeningTimes.js +212 -0
  36. package/lib/cjs/components/opening-times/OpeningTimes.js.map +1 -0
  37. package/lib/cjs/components/opening-times/OpeningTimes.styles.js +28 -0
  38. package/lib/cjs/components/opening-times/OpeningTimes.styles.js.map +1 -0
  39. package/lib/cjs/components/opening-times/hint-text/HintText.js +19 -0
  40. package/lib/cjs/components/opening-times/hint-text/HintText.js.map +1 -0
  41. package/lib/cjs/components/opening-times/hint-text/HintText.styles.js +26 -0
  42. package/lib/cjs/components/opening-times/hint-text/HintText.styles.js.map +1 -0
  43. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js +145 -0
  44. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
  45. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js +16 -0
  46. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
  47. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js +106 -0
  48. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
  49. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +41 -0
  50. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
  51. package/lib/cjs/constants/dateInfo.js +629 -0
  52. package/lib/cjs/constants/dateInfo.js.map +1 -0
  53. package/lib/cjs/index.js +28 -0
  54. package/lib/cjs/index.js.map +1 -0
  55. package/lib/cjs/types/calendar.js +22 -0
  56. package/lib/cjs/types/calendar.js.map +1 -0
  57. package/lib/cjs/types/openingTimes.js +18 -0
  58. package/lib/cjs/types/openingTimes.js.map +1 -0
  59. package/lib/cjs/utils/calendar.js +54 -0
  60. package/lib/cjs/utils/calendar.js.map +1 -0
  61. package/lib/cjs/utils/dateInfo.js +368 -0
  62. package/lib/cjs/utils/dateInfo.js.map +1 -0
  63. package/lib/esm/components/calendar/Calendar.js.map +1 -0
  64. package/lib/esm/components/calendar/Calendar.styles.js.map +1 -0
  65. package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js.map +1 -0
  66. package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -0
  67. package/lib/esm/components/calendar/month-wrapper/month/Month.js.map +1 -0
  68. package/lib/esm/components/calendar/month-wrapper/month/Month.styles.js.map +1 -0
  69. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -0
  70. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -0
  71. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -0
  72. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -0
  73. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -0
  74. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -0
  75. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -0
  76. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -0
  77. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -0
  78. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -0
  79. package/lib/esm/components/date-info/DateInfo.js.map +1 -0
  80. package/lib/esm/components/opening-times/OpeningTimes.js.map +1 -0
  81. package/lib/esm/components/opening-times/OpeningTimes.styles.js.map +1 -0
  82. package/lib/esm/components/opening-times/hint-text/HintText.js.map +1 -0
  83. package/lib/esm/components/opening-times/hint-text/HintText.styles.js.map +1 -0
  84. package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
  85. package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
  86. package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
  87. package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
  88. package/lib/esm/constants/dateInfo.js.map +1 -0
  89. package/lib/esm/index.js.map +1 -0
  90. package/lib/esm/types/calendar.js.map +1 -0
  91. package/lib/esm/types/openingTimes.js.map +1 -0
  92. package/lib/esm/utils/calendar.js.map +1 -0
  93. package/lib/{utils → esm/utils}/dateInfo.js +11 -2
  94. package/lib/esm/utils/dateInfo.js.map +1 -0
  95. package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.d.ts +1 -1
  96. package/lib/{components → types/components}/opening-times/OpeningTimes.styles.d.ts +1 -1
  97. package/lib/{components → types/components}/opening-times/hint-text/HintText.styles.d.ts +1 -1
  98. package/package.json +17 -7
  99. package/lib/components/calendar/Calendar.js.map +0 -1
  100. package/lib/components/calendar/Calendar.styles.js.map +0 -1
  101. package/lib/components/calendar/month-wrapper/MonthWrapper.js.map +0 -1
  102. package/lib/components/calendar/month-wrapper/MonthWrapper.styles.js.map +0 -1
  103. package/lib/components/calendar/month-wrapper/month/Month.js.map +0 -1
  104. package/lib/components/calendar/month-wrapper/month/Month.styles.js.map +0 -1
  105. package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +0 -1
  106. package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +0 -1
  107. package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +0 -1
  108. package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +0 -1
  109. package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +0 -1
  110. package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +0 -1
  111. package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +0 -1
  112. package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +0 -1
  113. package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +0 -1
  114. package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +0 -1
  115. package/lib/components/date-info/DateInfo.js.map +0 -1
  116. package/lib/components/opening-times/OpeningTimes.js.map +0 -1
  117. package/lib/components/opening-times/OpeningTimes.styles.js.map +0 -1
  118. package/lib/components/opening-times/hint-text/HintText.js.map +0 -1
  119. package/lib/components/opening-times/hint-text/HintText.styles.js.map +0 -1
  120. package/lib/components/opening-times/opening-inputs/OpeningInputs.js.map +0 -1
  121. package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +0 -1
  122. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +0 -1
  123. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +0 -1
  124. package/lib/constants/dateInfo.js.map +0 -1
  125. package/lib/index.js.map +0 -1
  126. package/lib/types/calendar.js.map +0 -1
  127. package/lib/types/openingTimes.js.map +0 -1
  128. package/lib/utils/calendar.js.map +0 -1
  129. package/lib/utils/dateInfo.js.map +0 -1
  130. /package/lib/{components → esm/components}/calendar/Calendar.js +0 -0
  131. /package/lib/{components → esm/components}/calendar/Calendar.styles.js +0 -0
  132. /package/lib/{components → esm/components}/calendar/month-wrapper/MonthWrapper.js +0 -0
  133. /package/lib/{components → esm/components}/calendar/month-wrapper/MonthWrapper.styles.js +0 -0
  134. /package/lib/{components → esm/components}/calendar/month-wrapper/month/Month.js +0 -0
  135. /package/lib/{components → esm/components}/calendar/month-wrapper/month/Month.styles.js +0 -0
  136. /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +0 -0
  137. /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +0 -0
  138. /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/Day.js +0 -0
  139. /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +0 -0
  140. /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +0 -0
  141. /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +0 -0
  142. /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +0 -0
  143. /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +0 -0
  144. /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +0 -0
  145. /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +0 -0
  146. /package/lib/{components → esm/components}/date-info/DateInfo.js +0 -0
  147. /package/lib/{components → esm/components}/opening-times/OpeningTimes.js +0 -0
  148. /package/lib/{components → esm/components}/opening-times/OpeningTimes.styles.js +0 -0
  149. /package/lib/{components → esm/components}/opening-times/hint-text/HintText.js +0 -0
  150. /package/lib/{components → esm/components}/opening-times/hint-text/HintText.styles.js +0 -0
  151. /package/lib/{components → esm/components}/opening-times/opening-inputs/OpeningInputs.js +0 -0
  152. /package/lib/{components → esm/components}/opening-times/opening-inputs/OpeningInputs.styles.js +0 -0
  153. /package/lib/{components → esm/components}/opening-times/opening-inputs/opening-input/OpeningInput.js +0 -0
  154. /package/lib/{components → esm/components}/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +0 -0
  155. /package/lib/{constants → esm/constants}/dateInfo.js +0 -0
  156. /package/lib/{index.js → esm/index.js} +0 -0
  157. /package/lib/{types → esm/types}/calendar.js +0 -0
  158. /package/lib/{types → esm/types}/openingTimes.js +0 -0
  159. /package/lib/{utils → esm/utils}/calendar.js +0 -0
  160. /package/lib/{components → types/components}/calendar/Calendar.d.ts +0 -0
  161. /package/lib/{components → types/components}/calendar/Calendar.styles.d.ts +0 -0
  162. /package/lib/{components → types/components}/calendar/month-wrapper/MonthWrapper.d.ts +0 -0
  163. /package/lib/{components → types/components}/calendar/month-wrapper/MonthWrapper.styles.d.ts +0 -0
  164. /package/lib/{components → types/components}/calendar/month-wrapper/month/Month.d.ts +0 -0
  165. /package/lib/{components → types/components}/calendar/month-wrapper/month/Month.styles.d.ts +0 -0
  166. /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.d.ts +0 -0
  167. /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.d.ts +0 -0
  168. /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/Day.d.ts +0 -0
  169. /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/Day.styles.d.ts +0 -0
  170. /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.d.ts +0 -0
  171. /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.d.ts +0 -0
  172. /package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.d.ts +0 -0
  173. /package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.d.ts +0 -0
  174. /package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.d.ts +0 -0
  175. /package/lib/{components → types/components}/date-info/DateInfo.d.ts +0 -0
  176. /package/lib/{components → types/components}/opening-times/OpeningTimes.d.ts +0 -0
  177. /package/lib/{components → types/components}/opening-times/hint-text/HintText.d.ts +0 -0
  178. /package/lib/{components → types/components}/opening-times/opening-inputs/OpeningInputs.d.ts +0 -0
  179. /package/lib/{components → types/components}/opening-times/opening-inputs/OpeningInputs.styles.d.ts +0 -0
  180. /package/lib/{components → types/components}/opening-times/opening-inputs/opening-input/OpeningInput.d.ts +0 -0
  181. /package/lib/{components → types/components}/opening-times/opening-inputs/opening-input/OpeningInput.styles.d.ts +0 -0
  182. /package/lib/{constants → types/constants}/dateInfo.d.ts +0 -0
  183. /package/lib/{index.d.ts → types/index.d.ts} +0 -0
  184. /package/lib/types/{calendar.d.ts → types/calendar.d.ts} +0 -0
  185. /package/lib/types/{openingTimes.d.ts → types/openingTimes.d.ts} +0 -0
  186. /package/lib/{utils → types/utils}/calendar.d.ts +0 -0
  187. /package/lib/{utils → types/utils}/dateInfo.d.ts +0 -0
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _dateFns = require("date-fns");
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _Category = _interopRequireDefault(require("./category/Category"));
10
+ var _Day = require("./Day.styles");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 Day = ({
15
+ date,
16
+ highlightedDates,
17
+ categories,
18
+ isSameMonth,
19
+ isSelected,
20
+ onClick
21
+ }) => {
22
+ const [fontSize, setFontSize] = (0, _react.useState)();
23
+ const dayRef = (0, _react.useRef)(null);
24
+ const styles = (0, _react.useMemo)(() => {
25
+ var _highlightedDates$fin;
26
+ if (!highlightedDates || !isSameMonth) {
27
+ return undefined;
28
+ }
29
+ return (_highlightedDates$fin = highlightedDates.find(highlightedDate => highlightedDate.dates.some(highlighted => (0, _dateFns.isSameDay)(highlighted, date)))) === null || _highlightedDates$fin === void 0 ? void 0 : _highlightedDates$fin.style;
30
+ }, [date, highlightedDates, isSameMonth]);
31
+ const categoryElements = (0, _react.useMemo)(() => {
32
+ if (!categories) return [];
33
+ return categories.flatMap(category => category.dates.filter(day => (0, _dateFns.isSameDay)(day, date)).map(day => /*#__PURE__*/_react.default.createElement(_Category.default, {
34
+ key: day.getTime() * Math.random(),
35
+ color: category.color
36
+ })));
37
+ }, [categories, date]);
38
+ (0, _react.useEffect)(() => {
39
+ if (dayRef.current) {
40
+ const resizeObserver = new ResizeObserver(entries => {
41
+ if (entries && entries[0]) {
42
+ const observedWidth = entries[0].contentRect.width;
43
+ setFontSize(`${observedWidth / 2}px`);
44
+ }
45
+ });
46
+ resizeObserver.observe(dayRef.current);
47
+ return () => {
48
+ resizeObserver.disconnect();
49
+ };
50
+ }
51
+ return () => {};
52
+ }, []);
53
+ return /*#__PURE__*/_react.default.createElement(_Day.StyledDay, {
54
+ ref: dayRef,
55
+ onClick: () => onClick(date, isSameMonth),
56
+ $isSameMonth: isSameMonth,
57
+ $backgroundColor: styles === null || styles === void 0 ? void 0 : styles.backgroundColor,
58
+ $textColor: styles === null || styles === void 0 ? void 0 : styles.textColor
59
+ }, /*#__PURE__*/_react.default.createElement(_Day.StyledDayNumber, {
60
+ $isSelected: isSelected,
61
+ $fontSize: fontSize
62
+ }, date.getDate()), categoryElements && /*#__PURE__*/_react.default.createElement(_Day.StyledDayCategoryWrapper, null, categoryElements));
63
+ };
64
+ Day.displayName = 'Day';
65
+ var _default = exports.default = Day;
66
+ //# sourceMappingURL=Day.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Day.js","names":["_dateFns","require","_react","_interopRequireWildcard","_Category","_interopRequireDefault","_Day","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Day","date","highlightedDates","categories","isSameMonth","isSelected","onClick","fontSize","setFontSize","useState","dayRef","useRef","styles","useMemo","_highlightedDates$fin","undefined","find","highlightedDate","dates","some","highlighted","isSameDay","style","categoryElements","flatMap","category","filter","day","map","createElement","key","getTime","Math","random","color","useEffect","current","resizeObserver","ResizeObserver","entries","observedWidth","contentRect","width","observe","disconnect","StyledDay","ref","$isSameMonth","$backgroundColor","backgroundColor","$textColor","textColor","StyledDayNumber","$isSelected","$fontSize","getDate","StyledDayCategoryWrapper","displayName","_default","exports"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/Day.tsx"],"sourcesContent":["import { isSameDay } from 'date-fns';\nimport React, { FC, useEffect, useMemo, useRef, useState, type CSSProperties } from 'react';\nimport type {\n Categories,\n HighlightedDates,\n HighlightedDateStyles,\n} from '../../../../../../types/calendar';\nimport Category from './category/Category';\nimport { StyledDay, StyledDayCategoryWrapper, StyledDayNumber } from './Day.styles';\n\nexport type DayProps = {\n date: Date;\n isSameMonth: boolean;\n isSelected: boolean;\n onClick: (date: Date, isSameMonth: boolean) => void;\n highlightedDates?: HighlightedDates[];\n categories?: Categories[];\n};\n\nconst Day: FC<DayProps> = ({\n date,\n highlightedDates,\n categories,\n isSameMonth,\n isSelected,\n onClick,\n}) => {\n const [fontSize, setFontSize] = useState<CSSProperties['fontSize']>();\n\n const dayRef = useRef<HTMLDivElement>(null);\n\n const styles: HighlightedDateStyles | undefined = useMemo(() => {\n if (!highlightedDates || !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]);\n\n const categoryElements = useMemo(() => {\n if (!categories) 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]);\n\n useEffect(() => {\n if (dayRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n if (entries && entries[0]) {\n const observedWidth = entries[0].contentRect.width;\n\n setFontSize(`${observedWidth / 2}px`);\n }\n });\n\n resizeObserver.observe(dayRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n return () => {};\n }, []);\n\n return (\n <StyledDay\n ref={dayRef}\n onClick={() => onClick(date, isSameMonth)}\n $isSameMonth={isSameMonth}\n $backgroundColor={styles?.backgroundColor}\n $textColor={styles?.textColor}\n >\n <StyledDayNumber $isSelected={isSelected} $fontSize={fontSize}>\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,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MA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AAwB,QAAEjC,gBAA2C,CAEnE,CAAC;AAEpB,CAAC;AAEDvB,GAAG,CAACyD,WAAW,GAAG,KAAK;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9E,OAAA,GAETmB,GAAG","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledDayNumber = exports.StyledDayCategoryWrapper = exports.StyledDay = void 0;
7
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ 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); }
9
+ 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; }
10
+ const StyledDay = exports.StyledDay = _styledComponents.default.div`
11
+ position: relative;
12
+ cursor: ${({
13
+ $isSameMonth
14
+ }) => $isSameMonth ? 'pointer' : 'default'};
15
+ color: ${({
16
+ $isSameMonth,
17
+ theme
18
+ }) => $isSameMonth ? theme.text : `rgba(${theme['text-rgb'] ?? ''}, 0.5)`};
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ aspect-ratio: 1;
23
+
24
+ ${({
25
+ $backgroundColor,
26
+ $textColor
27
+ }) => $backgroundColor && $textColor && (0, _styledComponents.css)`
28
+ color: ${$textColor};
29
+ background-color: ${$backgroundColor};
30
+ `}
31
+ `;
32
+ const StyledDayNumber = exports.StyledDayNumber = _styledComponents.default.div`
33
+ border-radius: 50%;
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+ width: 80%;
38
+ height: 80%;
39
+ font-size: ${({
40
+ $fontSize
41
+ }) => $fontSize};
42
+
43
+ ${({
44
+ $isSelected,
45
+ theme
46
+ }) => $isSelected && (0, _styledComponents.css)`
47
+ background-color: ${theme['404']};
48
+ color: ${theme['409']};
49
+ `}
50
+ `;
51
+ const StyledDayCategoryWrapper = exports.StyledDayCategoryWrapper = _styledComponents.default.div`
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ gap: 6%;
56
+ width: 100%;
57
+ position: absolute;
58
+ bottom: 2px;
59
+ `;
60
+ //# sourceMappingURL=Day.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Day.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledDay","exports","styled","div","$isSameMonth","theme","text","$backgroundColor","$textColor","css","StyledDayNumber","$fontSize","$isSelected","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';\n\ntype StyledDayProps = WithTheme<{\n $isSameMonth: boolean;\n $backgroundColor?: CSSProperties['backgroundColor'];\n $textColor?: CSSProperties['color'];\n}>;\n\nexport const StyledDay = styled.div<StyledDayProps>`\n position: relative;\n cursor: ${({ $isSameMonth }) => ($isSameMonth ? 'pointer' : 'default')};\n color: ${({ $isSameMonth, theme }: StyledDayProps) =>\n $isSameMonth ? theme.text : `rgba(${theme['text-rgb'] ?? ''}, 0.5)`};\n display: flex;\n align-items: center;\n justify-content: center;\n aspect-ratio: 1;\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 $fontSize: CSSProperties['fontSize'];\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: ${({ $fontSize }) => $fontSize};\n\n ${({ $isSelected, theme }) =>\n $isSelected &&\n css`\n background-color: ${theme['404']};\n color: ${theme['409']};\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,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAC,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,SAAAH,wBAAAG,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,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,OAAA,CAAAY,wBAAA,GAAGX,yBAAM,CAACC,GAAI;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,17 @@
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 _Category = require("./Category.styles");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const Category = ({
11
+ color
12
+ }) => /*#__PURE__*/_react.default.createElement(_Category.StyledCategory, {
13
+ $color: color
14
+ });
15
+ Category.displayName = 'Category';
16
+ var _default = exports.default = Category;
17
+ //# sourceMappingURL=Category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Category.js","names":["_react","_interopRequireDefault","require","_Category","obj","__esModule","default","Category","color","createElement","StyledCategory","$color","displayName","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAAmD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMnD,MAAMG,QAA2B,GAAGA,CAAC;EAAEC;AAAM,CAAC,kBAAKR,MAAA,CAAAM,OAAA,CAAAG,aAAA,CAACN,SAAA,CAAAO,cAAc;EAACC,MAAM,EAAEH;AAAM,CAAE,CAAC;AAEpFD,QAAQ,CAACK,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEnBC,QAAQ","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledCategory = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledCategory = exports.StyledCategory = _styledComponents.default.div`
10
+ border-radius: 50%;
11
+ width: 24%;
12
+ aspect-ratio: 1;
13
+ background-color: ${({
14
+ $color
15
+ }) => $color};
16
+ border: 1px solid white;
17
+ `;
18
+ //# sourceMappingURL=Category.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Category.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledCategory","exports","styled","div","$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,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIhC,MAAMG,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAGE,yBAAM,CAACC,GAAyB;AAC9D;AACA;AACA;AACA,wBAAwB,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAO;AAC/C;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,44 @@
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 _dateFns = require("date-fns");
9
+ var _WeekdayWrapper = require("./WeekdayWrapper.styles");
10
+ var _Weekday = _interopRequireDefault(require("./weekday/Weekday"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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, _dateFns.startOfWeek)(new Date(), {
18
+ weekStartsOn: 1
19
+ });
20
+ const sunday = (0, _dateFns.endOfWeek)(new Date(), {
21
+ weekStartsOn: 1
22
+ });
23
+ const weekdays = (0, _dateFns.eachDayOfInterval)({
24
+ start: monday,
25
+ end: sunday
26
+ });
27
+ const weekdayElements = (0, _react.useMemo)(() => {
28
+ const items = [];
29
+ weekdays.forEach(day => {
30
+ const formattedDay = (0, _dateFns.format)(day, 'EE', {
31
+ locale
32
+ });
33
+ items.push( /*#__PURE__*/_react.default.createElement(_Weekday.default, {
34
+ key: `weekday-${formattedDay}`,
35
+ name: formattedDay
36
+ }));
37
+ });
38
+ return items;
39
+ }, [locale, weekdays]);
40
+ return /*#__PURE__*/_react.default.createElement(_WeekdayWrapper.StyledWeekdayWrapper, null, weekdayElements);
41
+ };
42
+ WeekdayWrapper.displayName = 'WeekdayWrapper';
43
+ var _default = exports.default = WeekdayWrapper;
44
+ //# sourceMappingURL=WeekdayWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WeekdayWrapper.js","names":["_react","_interopRequireWildcard","require","_dateFns","_WeekdayWrapper","_Weekday","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","WeekdayWrapper","locale","monday","startOfWeek","Date","weekStartsOn","sunday","endOfWeek","weekdays","eachDayOfInterval","start","end","weekdayElements","useMemo","items","forEach","day","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 { startOfWeek, endOfWeek, eachDayOfInterval, format } from 'date-fns';\nimport { StyledWeekdayWrapper } from './WeekdayWrapper.styles';\nimport Weekday from './weekday/Weekday';\nimport type { Locale } from 'date-fns';\n\nexport type WeekdayWrapperProps = {\n locale?: Locale;\n};\n\nconst WeekdayWrapper: FC<WeekdayWrapperProps> = ({ locale }) => {\n const monday = startOfWeek(new Date(), { weekStartsOn: 1 });\n const sunday = endOfWeek(new Date(), { weekStartsOn: 1 });\n const weekdays = eachDayOfInterval({ start: monday, end: sunday });\n\n const weekdayElements = useMemo(() => {\n const items: ReactElement[] = [];\n\n weekdays.forEach((day) => {\n const formattedDay = format(day, 'EE', { locale });\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,GAA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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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WeekdayWrapper.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC/C;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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Weekday.js","names":["_react","_interopRequireDefault","require","_Weekday","obj","__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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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":[]}
@@ -0,0 +1,16 @@
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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledWeekday = exports.StyledWeekday = _styledComponents.default.div`
10
+ text-align: center;
11
+ color: ${({
12
+ theme
13
+ }) => theme.headline};
14
+ cursor: default;
15
+ `;
16
+ //# sourceMappingURL=Weekday.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Weekday.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledWeekday","exports","styled","div","theme","headline"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport type { WithTheme } from '@chayns-components/core';\n\ntype StyledWeekdayProps = WithTheme<unknown>;\n\nexport const StyledWeekday = styled.div<StyledWeekdayProps>`\n text-align: center;\n color: ${({ theme }: StyledWeekdayProps) => theme.headline};\n cursor: default;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAKhC,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,yBAAM,CAACC,GAAwB;AAC5D;AACA,aAAa,CAAC;EAAEC;AAA0B,CAAC,KAAKA,KAAK,CAACC,QAAS;AAC/D;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _dateFns = require("date-fns");
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _dateInfo = require("../../utils/dateInfo");
10
+ 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); }
11
+ 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; }
12
+ const DateInfo = ({
13
+ date,
14
+ preText = '',
15
+ shouldShowThisYear,
16
+ shouldShowTime,
17
+ shouldShowRelativeDayOfWeek,
18
+ shouldUseShortText,
19
+ shouldShowDayOfWeek,
20
+ shouldShowDateToNowDifference
21
+ }) => {
22
+ const [formattedDate, setFormattedDate] = (0, _react.useState)(new Date(date));
23
+ const [formattedDateString, setFormattedDateString] = (0, _react.useState)('');
24
+ const [language] = (0, _react.useState)((0, _dateInfo.getLanguage)());
25
+ (0, _react.useEffect)(() => {
26
+ // This useEffect is used for normal date formation
27
+ if (shouldShowDateToNowDifference) {
28
+ return;
29
+ }
30
+ let newFormattedDateString = (0, _dateInfo.getFormattedDayOfWeek)({
31
+ shouldShowDayOfWeek,
32
+ shouldShowRelativeDayOfWeek,
33
+ shouldUseShortText,
34
+ date: formattedDate,
35
+ language
36
+ });
37
+ let formatString = 'dd. ';
38
+ formatString += `${(0, _dateInfo.getMonthFormat)({
39
+ shouldUseShortText
40
+ })}`;
41
+ formatString += `${(0, _dateInfo.getYearFormat)({
42
+ date: formattedDate,
43
+ shouldShowThisYear
44
+ })}`;
45
+ newFormattedDateString += (0, _dateFns.format)(formattedDate, formatString, {
46
+ locale: language
47
+ });
48
+ newFormattedDateString += (0, _dateInfo.getFormattedTime)({
49
+ date: formattedDate,
50
+ shouldShowTime,
51
+ language
52
+ });
53
+ setFormattedDateString(newFormattedDateString);
54
+ }, [date, formattedDate, language, shouldShowDateToNowDifference, shouldShowDayOfWeek, shouldShowRelativeDayOfWeek, shouldShowThisYear, shouldShowTime, shouldUseShortText]);
55
+
56
+ // Calculate remaining time till next minute to update time according to time left
57
+ const [currentDate, setCurrentDate] = (0, _react.useState)(new Date());
58
+ (0, _react.useEffect)(() => {
59
+ // This useEffect is for calculating the current date for shouldShowDateToNowDifference option
60
+ if (!shouldShowDateToNowDifference) {
61
+ return () => {};
62
+ }
63
+ let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();
64
+
65
+ // If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently
66
+ if (timeoutTime < 0) {
67
+ timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();
68
+ }
69
+
70
+ // initialized with remaining time
71
+ let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();
72
+
73
+ // set to elapsed time
74
+ if ((0, _dateFns.isPast)(formattedDate)) {
75
+ timeDiffInMs = currentDate.getTime() - formattedDate.getTime();
76
+ }
77
+
78
+ // time difference is less than a minute, time should be updated every second
79
+ if (timeDiffInMs < 60000) {
80
+ timeoutTime = 1;
81
+ }
82
+
83
+ // Set timeoutTime to at least 1000ms
84
+ timeoutTime = Math.max(timeoutTime * 1000, 1000);
85
+ const timeout = setTimeout(() => {
86
+ setCurrentDate(new Date());
87
+ }, timeoutTime);
88
+ return () => {
89
+ clearTimeout(timeout);
90
+ };
91
+ }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);
92
+ (0, _react.useEffect)(() => {
93
+ // This useEffect is for showing the difference of the date to now
94
+ if (shouldShowDateToNowDifference) {
95
+ setFormattedDateString((0, _dateInfo.getTimeTillNow)({
96
+ date: formattedDate,
97
+ currentDate,
98
+ language
99
+ }));
100
+ }
101
+ }, [currentDate, date, formattedDate, language, shouldShowDateToNowDifference]);
102
+ (0, _react.useEffect)(() => {
103
+ setFormattedDate(new Date(date));
104
+ }, [date]);
105
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement("span", null, preText.trim(), " ", formattedDateString), [formattedDateString, preText]);
106
+ };
107
+ DateInfo.displayName = 'DateInfo';
108
+ var _default = exports.default = DateInfo;
109
+ //# sourceMappingURL=DateInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateInfo.js","names":["_dateFns","require","_react","_interopRequireWildcard","_dateInfo","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DateInfo","date","preText","shouldShowThisYear","shouldShowTime","shouldShowRelativeDayOfWeek","shouldUseShortText","shouldShowDayOfWeek","shouldShowDateToNowDifference","formattedDate","setFormattedDate","useState","Date","formattedDateString","setFormattedDateString","language","getLanguage","useEffect","newFormattedDateString","getFormattedDayOfWeek","formatString","getMonthFormat","getYearFormat","format","locale","getFormattedTime","currentDate","setCurrentDate","timeoutTime","getSeconds","timeDiffInMs","getTime","isPast","Math","max","timeout","setTimeout","clearTimeout","getTimeTillNow","useMemo","createElement","trim","displayName","_default","exports"],"sources":["../../../../src/components/date-info/DateInfo.tsx"],"sourcesContent":["import { format, isPast } from 'date-fns';\nimport React, { FC, useEffect, useMemo, useState } from 'react';\nimport {\n getFormattedDayOfWeek,\n getFormattedTime,\n getLanguage,\n getMonthFormat,\n getTimeTillNow,\n getYearFormat,\n} from '../../utils/dateInfo';\n\nexport type DateInfoProps = {\n /**\n * The date, that should be displayed\n */\n date: Date | string;\n /**\n * Additional text for \"shouldShowDateToNowDifference\" prop. Writes a text before the calculated time\n */\n preText?: string;\n /**\n * Adds the current year to the display\n */\n shouldShowThisYear?: boolean;\n /**\n * Adds the time to the display.\n */\n shouldShowTime?: boolean;\n /**\n * Whether the relative day of week to today should be shown (today, yesterday or tomorrow).\n */\n shouldShowRelativeDayOfWeek?: boolean;\n /**\n * Shortens the day and month text to maximum three digits\n */\n shouldUseShortText?: boolean;\n /**\n * Adds the day of week to the display\n */\n shouldShowDayOfWeek?: boolean;\n /**\n * Shows the difference from the date to now. The component handles updates itself.\n */\n shouldShowDateToNowDifference?: boolean;\n};\n\nconst DateInfo: FC<DateInfoProps> = ({\n date,\n preText = '',\n shouldShowThisYear,\n shouldShowTime,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowDateToNowDifference,\n}) => {\n const [formattedDate, setFormattedDate] = useState(new Date(date));\n const [formattedDateString, setFormattedDateString] = useState<string>('');\n const [language] = useState(getLanguage());\n\n useEffect(() => {\n // This useEffect is used for normal date formation\n if (shouldShowDateToNowDifference) {\n return;\n }\n\n let newFormattedDateString = getFormattedDayOfWeek({\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n date: formattedDate,\n language,\n });\n\n let formatString = 'dd. ';\n\n formatString += `${getMonthFormat({ shouldUseShortText })}`;\n\n formatString += `${getYearFormat({\n date: formattedDate,\n shouldShowThisYear,\n })}`;\n\n newFormattedDateString += format(formattedDate, formatString, { locale: language });\n\n newFormattedDateString += getFormattedTime({\n date: formattedDate,\n shouldShowTime,\n language,\n });\n\n setFormattedDateString(newFormattedDateString);\n }, [\n date,\n formattedDate,\n language,\n shouldShowDateToNowDifference,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowThisYear,\n shouldShowTime,\n shouldUseShortText,\n ]);\n\n // Calculate remaining time till next minute to update time according to time left\n const [currentDate, setCurrentDate] = useState(new Date());\n\n useEffect(() => {\n // This useEffect is for calculating the current date for shouldShowDateToNowDifference option\n if (!shouldShowDateToNowDifference) {\n return () => {};\n }\n\n let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();\n\n // If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently\n if (timeoutTime < 0) {\n timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();\n }\n\n // initialized with remaining time\n let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();\n\n // set to elapsed time\n if (isPast(formattedDate)) {\n timeDiffInMs = currentDate.getTime() - formattedDate.getTime();\n }\n\n // time difference is less than a minute, time should be updated every second\n if (timeDiffInMs < 60000) {\n timeoutTime = 1;\n }\n\n // Set timeoutTime to at least 1000ms\n timeoutTime = Math.max(timeoutTime * 1000, 1000);\n\n const timeout = setTimeout(() => {\n setCurrentDate(new Date());\n }, timeoutTime);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n // This useEffect is for showing the difference of the date to now\n if (shouldShowDateToNowDifference) {\n setFormattedDateString(getTimeTillNow({ date: formattedDate, currentDate, language }));\n }\n }, [currentDate, date, formattedDate, language, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n setFormattedDate(new Date(date));\n }, [date]);\n\n return useMemo(\n () => (\n <span>\n {preText.trim()} {formattedDateString}\n </span>\n ),\n [formattedDateString, preText],\n );\n};\n\nDateInfo.displayName = 'DateInfo';\n\nexport default DateInfo;\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAO8B,SAAAI,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,SAAAH,wBAAAG,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,CA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