@chayns-components/date 5.0.0-beta.998 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/lib/cjs/components/calendar/Calendar.js +9 -22
  2. package/lib/cjs/components/calendar/Calendar.js.map +1 -1
  3. package/lib/cjs/components/calendar/Calendar.styles.js +7 -1
  4. package/lib/cjs/components/calendar/Calendar.styles.js.map +1 -1
  5. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js +9 -4
  6. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js.map +1 -1
  7. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js +2 -2
  8. package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -1
  9. package/lib/cjs/components/calendar/month-wrapper/month/Month.js +64 -32
  10. package/lib/cjs/components/calendar/month-wrapper/month/Month.js.map +1 -1
  11. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +5 -4
  12. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -1
  13. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +7 -4
  14. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -1
  15. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +17 -3
  16. package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -1
  17. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +1 -2
  18. package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -1
  19. package/lib/cjs/components/calendar/month-year-pickers/MonthYearPickers.js +4 -3
  20. package/lib/cjs/components/calendar/month-year-pickers/MonthYearPickers.js.map +1 -1
  21. package/lib/cjs/components/date-info/DateInfo.js +4 -3
  22. package/lib/cjs/components/date-info/DateInfo.js.map +1 -1
  23. package/lib/cjs/components/opening-times/OpeningTimes.js +12 -15
  24. package/lib/cjs/components/opening-times/OpeningTimes.js.map +1 -1
  25. package/lib/cjs/components/opening-times/hint-text/HintText.js +1 -2
  26. package/lib/cjs/components/opening-times/hint-text/HintText.js.map +1 -1
  27. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js +16 -17
  28. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -1
  29. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js +3 -4
  30. package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -1
  31. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js +1 -2
  32. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -1
  33. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +2 -2
  34. package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -1
  35. package/lib/cjs/hooks/useDateInfo.js +3 -1
  36. package/lib/cjs/hooks/useDateInfo.js.map +1 -1
  37. package/lib/cjs/index.js +6 -0
  38. package/lib/cjs/index.js.map +1 -1
  39. package/lib/cjs/types/calendar.js.map +1 -1
  40. package/lib/cjs/types/dateinfo.js +4 -0
  41. package/lib/cjs/types/dateinfo.js.map +1 -1
  42. package/lib/cjs/types/openingTimes.js.map +1 -1
  43. package/lib/cjs/utils/calendar.js.map +1 -1
  44. package/lib/cjs/utils/date.js.map +1 -1
  45. package/lib/cjs/utils/dateInfo.js +52 -28
  46. package/lib/cjs/utils/dateInfo.js.map +1 -1
  47. package/lib/esm/components/calendar/Calendar.js +26 -39
  48. package/lib/esm/components/calendar/Calendar.js.map +1 -1
  49. package/lib/esm/components/calendar/Calendar.styles.js +12 -12
  50. package/lib/esm/components/calendar/Calendar.styles.js.map +1 -1
  51. package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js +28 -23
  52. package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js.map +1 -1
  53. package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js +7 -13
  54. package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -1
  55. package/lib/esm/components/calendar/month-wrapper/month/Month.js +51 -25
  56. package/lib/esm/components/calendar/month-wrapper/month/Month.js.map +1 -1
  57. package/lib/esm/components/calendar/month-wrapper/month/Month.styles.js +3 -6
  58. package/lib/esm/components/calendar/month-wrapper/month/Month.styles.js.map +1 -1
  59. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +20 -19
  60. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -1
  61. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +22 -19
  62. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -1
  63. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +51 -53
  64. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -1
  65. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +5 -8
  66. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -1
  67. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +3 -6
  68. package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -1
  69. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +4 -5
  70. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -1
  71. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +3 -6
  72. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -1
  73. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +3 -6
  74. package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -1
  75. package/lib/esm/components/calendar/month-year-pickers/MonthYearPickers.js +13 -12
  76. package/lib/esm/components/calendar/month-year-pickers/MonthYearPickers.js.map +1 -1
  77. package/lib/esm/components/date-info/DateInfo.js +12 -11
  78. package/lib/esm/components/date-info/DateInfo.js.map +1 -1
  79. package/lib/esm/components/opening-times/OpeningTimes.js +34 -44
  80. package/lib/esm/components/opening-times/OpeningTimes.js.map +1 -1
  81. package/lib/esm/components/opening-times/OpeningTimes.styles.js +3 -6
  82. package/lib/esm/components/opening-times/OpeningTimes.styles.js.map +1 -1
  83. package/lib/esm/components/opening-times/hint-text/HintText.js +3 -4
  84. package/lib/esm/components/opening-times/hint-text/HintText.js.map +1 -1
  85. package/lib/esm/components/opening-times/hint-text/HintText.styles.js +6 -12
  86. package/lib/esm/components/opening-times/hint-text/HintText.styles.js.map +1 -1
  87. package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.js +21 -26
  88. package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -1
  89. package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.styles.js +8 -14
  90. package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -1
  91. package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.js +11 -12
  92. package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -1
  93. package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +7 -13
  94. package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -1
  95. package/lib/esm/hooks/useDateInfo.js +13 -12
  96. package/lib/esm/hooks/useDateInfo.js.map +1 -1
  97. package/lib/esm/index.js +1 -1
  98. package/lib/esm/index.js.map +1 -1
  99. package/lib/esm/types/calendar.js.map +1 -1
  100. package/lib/esm/types/dateinfo.js +1 -1
  101. package/lib/esm/types/dateinfo.js.map +1 -1
  102. package/lib/esm/types/openingTimes.js.map +1 -1
  103. package/lib/esm/utils/calendar.js +10 -12
  104. package/lib/esm/utils/calendar.js.map +1 -1
  105. package/lib/esm/utils/date.js.map +1 -1
  106. package/lib/esm/utils/dateInfo.js +65 -45
  107. package/lib/esm/utils/dateInfo.js.map +1 -1
  108. package/lib/types/components/calendar/Calendar.d.ts +5 -1
  109. package/lib/types/components/calendar/Calendar.styles.d.ts +1 -0
  110. package/lib/types/components/calendar/month-wrapper/MonthWrapper.d.ts +5 -2
  111. package/lib/types/components/calendar/month-wrapper/MonthWrapper.styles.d.ts +2 -263
  112. package/lib/types/components/calendar/month-wrapper/month/Month.d.ts +5 -2
  113. package/lib/types/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.d.ts +2 -1
  114. package/lib/types/components/calendar/month-wrapper/month/day-wrapper/day/Day.d.ts +2 -1
  115. package/lib/types/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.d.ts +5 -1
  116. package/lib/types/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.d.ts +1 -1
  117. package/lib/types/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.d.ts +1 -1
  118. package/lib/types/components/calendar/month-year-pickers/MonthYearPickers.d.ts +1 -1
  119. package/lib/types/components/opening-times/OpeningTimes.d.ts +2 -6
  120. package/lib/types/components/opening-times/OpeningTimes.styles.d.ts +1 -1
  121. package/lib/types/components/opening-times/hint-text/HintText.styles.d.ts +1 -1
  122. package/lib/types/components/opening-times/opening-inputs/OpeningInputs.styles.d.ts +3 -264
  123. package/lib/types/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.d.ts +2 -263
  124. package/lib/types/hooks/useDateInfo.d.ts +1 -1
  125. package/lib/types/index.d.ts +3 -3
  126. package/lib/types/types/dateinfo.d.ts +14 -5
  127. package/lib/types/types/openingTimes.d.ts +2 -0
  128. package/lib/types/utils/calendar.d.ts +1 -1
  129. package/lib/types/utils/dateInfo.d.ts +6 -1
  130. package/package.json +18 -17
@@ -1,24 +1,17 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  export const StyledDay = styled.div`
3
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;
4
+ cursor: ${({
5
+ $isSameMonth,
6
+ $isDisabled
7
+ }) => $isSameMonth && !$isDisabled ? 'pointer' : 'default'};
8
+ color: ${({
9
+ theme
10
+ }) => theme.text};
11
+ opacity: ${({
12
+ $isSameMonth,
13
+ $isDisabled
14
+ }) => {
22
15
  if ($isSameMonth && !$isDisabled) {
23
16
  return '1';
24
17
  }
@@ -32,24 +25,18 @@ export const StyledDay = styled.div`
32
25
  align-items: center;
33
26
  justify-content: center;
34
27
  aspect-ratio: 1;
35
- pointer-events: ${_ref4 => {
36
- let {
37
- $isSameMonth,
38
- $isDisabled
39
- } = _ref4;
40
- return $isSameMonth && !$isDisabled ? 'auto' : 'none';
41
- }};
28
+ pointer-events: ${({
29
+ $isSameMonth,
30
+ $isDisabled
31
+ }) => $isSameMonth && !$isDisabled ? 'auto' : 'none'};
42
32
 
43
- ${_ref5 => {
44
- let {
45
- $backgroundColor,
46
- $textColor
47
- } = _ref5;
48
- return $backgroundColor && $textColor && css`
33
+ ${({
34
+ $backgroundColor,
35
+ $textColor
36
+ }) => $backgroundColor && $textColor && css`
49
37
  color: ${$textColor};
50
38
  background-color: ${$backgroundColor};
51
- `;
52
- }}
39
+ `}
53
40
  `;
54
41
  export const StyledDayNumber = styled.div`
55
42
  border-radius: 50%;
@@ -59,30 +46,27 @@ export const StyledDayNumber = styled.div`
59
46
  width: 80%;
60
47
  height: 80%;
61
48
  font-size: 90%;
49
+ z-index: 2;
62
50
 
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`
51
+ ${({
52
+ $isSelected,
53
+ $isIntervalEnd,
54
+ $isIntervalStart,
55
+ $isWithinIntervalSelection,
56
+ $customThumbColors,
57
+ theme
58
+ }) => !!($isSelected || $isIntervalStart || $isIntervalEnd || $isWithinIntervalSelection) && css`
73
59
  background-color: ${$customThumbColors?.mainBackgroundColor ?? theme['404']};
74
60
  color: ${$customThumbColors?.mainTextColor ?? theme['409']};
75
- `;
76
- }}
61
+ `}
77
62
 
78
- ${_ref7 => {
79
- let {
80
- $isIntervalStart,
81
- $isIntervalEnd,
82
- $isWithinIntervalSelection,
83
- $customThumbColors,
84
- theme
85
- } = _ref7;
63
+ ${({
64
+ $isIntervalStart,
65
+ $isIntervalEnd,
66
+ $isWithinIntervalSelection,
67
+ $customThumbColors,
68
+ theme
69
+ }) => {
86
70
  if ($isIntervalStart && $isIntervalEnd) {
87
71
  return css`
88
72
  border-radius: 5px;
@@ -120,4 +104,18 @@ export const StyledDayCategoryWrapper = styled.div`
120
104
  position: absolute;
121
105
  bottom: 2px;
122
106
  `;
107
+ export const StyledCurrentDay = styled.div`
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ gap: 6%;
112
+ width: 90%;
113
+ height: 90%;
114
+ position: absolute;
115
+ z-index: 1;
116
+ border-radius: 50%;
117
+ background-color: ${({
118
+ $backgroundColor
119
+ }) => $backgroundColor};
120
+ `;
123
121
  //# sourceMappingURL=Day.styles.js.map
@@ -1 +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,IAAA;EAAA,OACpCC,YAAY,IAAI,CAACC,WAAW,GAAG,SAAS,GAAG,SAAS;AAAA;AAC5D,aAAaC,KAAA;EAAA,IAAC;IAAEC;EAAsB,CAAC,GAAAD,KAAA;EAAA,OAAKC,KAAK,CAACC,IAAI;AAAA;AACtD,eAAeC,KAAA,IAAmC;EAAA,IAAlC;IAAEL,YAAY;IAAEC;EAAY,CAAC,GAAAI,KAAA;EACrC,IAAIL,YAAY,IAAI,CAACC,WAAW,EAAE;IAC9B,OAAO,GAAG;EACd;EACA,IAAIA,WAAW,EAAE;IACb,OAAO,KAAK;EAChB;EACA,OAAO,KAAK;AAChB,CAAC;AACL;AACA;AACA;AACA;AACA;AACA,sBAAsBK,KAAA;EAAA,IAAC;IAAEN,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AAoCoB,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":[]}
1
+ {"version":3,"file":"Day.styles.js","names":["styled","css","StyledDay","div","$isSameMonth","$isDisabled","theme","text","$backgroundColor","$textColor","StyledDayNumber","$isSelected","$isIntervalEnd","$isIntervalStart","$isWithinIntervalSelection","$customThumbColors","mainBackgroundColor","mainTextColor","secondaryBackgroundColor","StyledDayCategoryWrapper","StyledCurrentDay"],"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 z-index: 2;\n\n ${({\n $isSelected,\n $isIntervalEnd,\n $isIntervalStart,\n $isWithinIntervalSelection,\n $customThumbColors,\n theme,\n }) =>\n !!($isSelected || $isIntervalStart || $isIntervalEnd || $isWithinIntervalSelection) &&\n css`\n background-color: ${$customThumbColors?.mainBackgroundColor ?? theme['404']};\n color: ${$customThumbColors?.mainTextColor ?? theme['409']};\n `}\n\n ${({\n $isIntervalStart,\n $isIntervalEnd,\n $isWithinIntervalSelection,\n $customThumbColors,\n theme,\n }) => {\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\ntype StyledCurrentDayProps = {\n $backgroundColor: CSSProperties['backgroundColor'];\n};\n\nexport const StyledCurrentDay = styled.div<StyledCurrentDayProps>`\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6%;\n width: 90%;\n height: 90%;\n position: absolute;\n z-index: 1;\n border-radius: 50%;\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n`;\n"],"mappings":"AAEA,OAAOA,MA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BAAgB;EAChBD,cAAc;EACdE,0BAA0B;EAC1BC,kBAAkB;EAClBT;AACJ,CAAC,KAAK;EACF,IAAIO,gBAAgB,IAAID,cAAc,EAAE;IACpC,OAAOX,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,IAAIY,gBAAgB,EAAE;IAClB,OAAOZ,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,IAAIW,cAAc,EAAE;IAChB,OAAOX,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,IAAIa,0BAA0B,EAAE;IAC5B,OAAOb,GAAG;AACtB;AACA;AACA,oCAAoCc,kBAAkB,EAAEG,wBAAwB,IAAIZ,KAAK,CAAC,KAAK,CAAC;AAChG,aAAa;EACL;EAEA,OAAO,EAAE;AACb,CAAC;AACL,CAAC;AAED,OAAO,MAAMa,wBAAwB,GAAGnB,MAAM,CAACG,GAAG;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAMD,OAAO,MAAMiB,gBAAgB,GAAGpB,MAAM,CAACG,GAA0B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEK;AAAiB,CAAC,KAAKA,gBAAgB;AAClE,CAAC","ignoreList":[]}
@@ -1,13 +1,10 @@
1
1
  import React from 'react';
2
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
- };
3
+ const Category = ({
4
+ color
5
+ }) => /*#__PURE__*/React.createElement(StyledCategory, {
6
+ $color: color
7
+ });
11
8
  Category.displayName = 'Category';
12
9
  export default Category;
13
10
  //# sourceMappingURL=Category.js.map
@@ -1 +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":[]}
1
+ {"version":3,"file":"Category.js","names":["React","StyledCategory","Category","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,GAAGA,CAAC;EAAEC;AAAM,CAAC,kBAAKH,KAAA,CAAAI,aAAA,CAACH,cAAc;EAACI,MAAM,EAAEF;AAAM,CAAE,CAAC;AAEpFD,QAAQ,CAACI,WAAW,GAAG,UAAU;AAEjC,eAAeJ,QAAQ","ignoreList":[]}
@@ -3,12 +3,9 @@ export const StyledCategory = styled.div`
3
3
  border-radius: 50%;
4
4
  width: 24%;
5
5
  aspect-ratio: 1;
6
- background-color: ${_ref => {
7
- let {
8
- $color
9
- } = _ref;
10
- return $color;
11
- }};
6
+ background-color: ${({
7
+ $color
8
+ }) => $color};
12
9
  border: 1px solid white;
13
10
  `;
14
11
  //# sourceMappingURL=Category.styles.js.map
@@ -1 +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":[]}
1
+ {"version":3,"file":"Category.styles.js","names":["styled","StyledCategory","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,OAAOA,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,cAAc,GAAGD,MAAM,CAACE,GAAwB;AAC7D;AACA;AACA;AACA,wBAAwB,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AAC9C;AACA,CAAC","ignoreList":[]}
@@ -1,11 +1,10 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { StyledWeekdayWrapper } from './WeekdayWrapper.styles';
3
3
  import Weekday from './weekday/Weekday';
4
- import { eachDayOfInterval, endOfWeek, startOfWeek } from "../../../../../utils/date";
5
- const WeekdayWrapper = _ref => {
6
- let {
7
- locale
8
- } = _ref;
4
+ import { eachDayOfInterval, endOfWeek, startOfWeek } from '../../../../../utils/date';
5
+ const WeekdayWrapper = ({
6
+ locale
7
+ }) => {
9
8
  const monday = startOfWeek(new Date());
10
9
  const sunday = endOfWeek(new Date());
11
10
  const weekdays = eachDayOfInterval({
@@ -1 +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 <Sty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AA4B,aAAA,CAAC1B,oBAAoB,QAAEc,eAAsC,CAAC;AACzE,CAAC;AAEDT,cAAc,CAACwB,WAAW,GAAG,gBAAgB;AAE7C,eAAexB,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"WeekdayWrapper.js","names":["React","useMemo","StyledWeekdayWrapper","Weekday","eachDayOfInterval","endOfWeek","startOfWeek","WeekdayWrapper","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,SAASC,iBAAiB,EAAEC,SAAS,EAAEC,WAAW,QAAQ,2BAA2B;AAMrF,MAAMC,cAAuC,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EAC5D,MAAMC,MAAM,GAAGH,WAAW,CAAC,IAAII,IAAI,CAAC,CAAC,CAAC;EACtC,MAAMC,MAAM,GAAGN,SAAS,CAAC,IAAIK,IAAI,CAAC,CAAC,CAAC;EACpC,MAAME,QAAQ,GAAGR,iBAAiB,CAAC;IAAES,KAAK,EAAEJ,MAAM;IAAEK,GAAG,EAAEH;EAAO,CAAC,CAAC;EAElE,MAAMI,eAAe,GAAGd,OAAO,CAAC,MAAM;IAClC,MAAMe,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,cAAC1B,KAAA,CAAA2B,aAAA,CAACxB,OAAO;QAACyB,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,oBAAOZ,KAAA,CAAA2B,aAAA,CAACzB,oBAAoB,QAAEa,eAAsC,CAAC;AACzE,CAAC;AAEDR,cAAc,CAACuB,WAAW,GAAG,gBAAgB;AAE7C,eAAevB,cAAc","ignoreList":[]}
@@ -1,11 +1,8 @@
1
1
  import React from 'react';
2
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
- };
3
+ const Weekday = ({
4
+ name
5
+ }) => /*#__PURE__*/React.createElement(StyledWeekday, null, name);
9
6
  Weekday.displayName = 'Weekday';
10
7
  export default Weekday;
11
8
  //# sourceMappingURL=Weekday.js.map
@@ -1 +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":[]}
1
+ {"version":3,"file":"Weekday.js","names":["React","StyledWeekday","Weekday","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,GAAGA,CAAC;EAAEC;AAAK,CAAC,kBAAKH,KAAA,CAAAI,aAAA,CAACH,aAAa,QAAEE,IAAoB,CAAC;AAErFD,OAAO,CAACG,WAAW,GAAG,SAAS;AAE/B,eAAeH,OAAO","ignoreList":[]}
@@ -1,11 +1,8 @@
1
1
  import styled from 'styled-components';
2
2
  export const StyledWeekday = styled.div`
3
- color: ${_ref => {
4
- let {
5
- theme
6
- } = _ref;
7
- return theme.headline;
8
- }};
3
+ color: ${({
4
+ theme
5
+ }) => theme.headline};
9
6
  cursor: default;
10
7
  font-size: 90%;
11
8
  text-align: center;
@@ -1 +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":[]}
1
+ {"version":3,"file":"Weekday.styles.js","names":["styled","StyledWeekday","div","theme","headline"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledWeekdayProps = WithTheme<unknown>;\n\nexport const StyledWeekday = styled.div<StyledWeekdayProps>`\n color: ${({ theme }: StyledWeekdayProps) => theme.headline};\n cursor: default;\n font-size: 90%;\n text-align: center;\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,aAAa,GAAGD,MAAM,CAACE,GAAuB;AAC3D,aAAa,CAAC;EAAEC;AAA0B,CAAC,KAAKA,KAAK,CAACC,QAAQ;AAC9D;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,24 +1,23 @@
1
1
  import { ComboBox } from '@chayns-components/core';
2
2
  import React, { useMemo, useState } from 'react';
3
3
  import { formatMonth, getYearsBetween, isDateInRange } from '../../../utils/calendar';
4
+ import { differenceInCalendarMonths } from '../../../utils/date';
4
5
  import { StyledMonthName } from '../month-wrapper/month/Month.styles';
5
- import { differenceInCalendarMonths } from "../../../utils/date";
6
6
  export let MonthYearPickerType = /*#__PURE__*/function (MonthYearPickerType) {
7
7
  MonthYearPickerType["Month"] = "month";
8
8
  MonthYearPickerType["Year"] = "year";
9
9
  return MonthYearPickerType;
10
10
  }({});
11
- const MonthYearPickers = _ref => {
12
- let {
13
- month,
14
- year,
15
- locale,
16
- minDate,
17
- maxDate,
18
- setCurrentDate,
19
- displayIndex = 0,
20
- showMonthYearPickers
21
- } = _ref;
11
+ const MonthYearPickers = ({
12
+ month,
13
+ year,
14
+ locale,
15
+ minDate,
16
+ maxDate,
17
+ setCurrentDate,
18
+ displayIndex = 0,
19
+ showMonthYearPickers
20
+ }) => {
22
21
  const [currentYear] = useState(new Date().getFullYear());
23
22
  const months = useMemo(() => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map(tempMonth => ({
24
23
  text: formatMonth({
@@ -35,6 +34,7 @@ const MonthYearPickers = _ref => {
35
34
  const hasMultipleYears = useMemo(() => years.length > 1, [years]);
36
35
  return /*#__PURE__*/React.createElement(React.Fragment, null, showMonthYearPickers && hasMultipleMonths ? /*#__PURE__*/React.createElement(ComboBox, {
37
36
  onSelect: selectedItem => {
37
+ if (!selectedItem) return;
38
38
  const tempSelectedDate = isDateInRange({
39
39
  minDate,
40
40
  maxDate,
@@ -58,6 +58,7 @@ const MonthYearPickers = _ref => {
58
58
  month
59
59
  })), showMonthYearPickers && hasMultipleYears ? /*#__PURE__*/React.createElement(ComboBox, {
60
60
  onSelect: selectedItem => {
61
+ if (!selectedItem) return;
61
62
  const tempSelectedDate = isDateInRange({
62
63
  minDate,
63
64
  maxDate,
@@ -1 +1 @@
1
- {"version":3,"file":"MonthYearPickers.js","names":["ComboBox","React","useMemo","useState","formatMonth","getYearsBetween","isDateInRange","StyledMonthName","differenceInCalendarMonths","MonthYearPickerType","MonthYearPickers","_ref","month","year","locale","minDate","maxDate","setCurrentDate","displayIndex","showMonthYearPickers","currentYear","Date","getFullYear","months","map","tempMonth","text","value","hasMultipleMonths","years","tempYear","toString","hasMultipleYears","length","createElement","Fragment","onSelect","selectedItem","tempSelectedDate","currentDate","lists","list","placeholder"],"sources":["../../../../../src/components/calendar/month-year-pickers/MonthYearPickers.tsx"],"sourcesContent":["import { ComboBox } from '@chayns-components/core';\nimport React, { FC, useMemo, useState } from 'react';\nimport { EMonth } from '../../../types/calendar';\nimport { formatMonth, getYearsBetween, isDateInRange } from '../../../utils/calendar';\nimport { StyledMonthName } from '../month-wrapper/month/Month.styles';\nimport {Language} from \"chayns-api\";\nimport {differenceInCalendarMonths} from \"../../../utils/date\";\n\nexport enum MonthYearPickerType {\n Month = 'month',\n Year = 'year',\n}\n\ntype MonthYearPickerProps = {\n month: EMonth;\n year: number;\n locale: Language;\n minDate: Date;\n maxDate: Date;\n setCurrentDate: (date: Date) => void;\n displayIndex?: number;\n showMonthYearPickers: boolean;\n};\n\nconst MonthYearPickers: FC<MonthYearPickerProps> = ({\n month,\n year,\n locale,\n minDate,\n maxDate,\n setCurrentDate,\n displayIndex = 0,\n showMonthYearPickers,\n}) => {\n const [currentYear] = useState(new Date().getFullYear());\n\n const months = useMemo(\n () =>\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((tempMonth) => ({\n text: formatMonth({ month: tempMonth, locale }),\n value: tempMonth,\n })),\n [locale],\n );\n\n const hasMultipleMonths = useMemo(\n () => differenceInCalendarMonths(maxDate, minDate) > 0,\n [minDate, maxDate],\n );\n\n const years = useMemo(\n () =>\n getYearsBetween(minDate, maxDate).map((tempYear) => ({\n text: tempYear.toString(),\n value: tempYear,\n })),\n [minDate, maxDate],\n );\n\n const hasMultipleYears = useMemo(() => years.length > 1, [years]);\n\n return (\n <>\n {showMonthYearPickers && hasMultipleMonths ? (\n <ComboBox\n onSelect={(selectedItem) => {\n const tempSelectedDate = isDateInRange({\n minDate,\n maxDate,\n currentDate: new Date(\n year,\n (selectedItem.value as number) - 1 - displayIndex,\n 1,\n ),\n });\n\n setCurrentDate(tempSelectedDate);\n }}\n lists={[\n {\n list: months,\n },\n ]}\n selectedItem={{\n text: formatMonth({ month, locale }),\n value: month,\n }}\n placeholder=\"\"\n />\n ) : (\n <StyledMonthName>{formatMonth({ locale, month })}</StyledMonthName>\n )}\n {showMonthYearPickers && hasMultipleYears ? (\n <ComboBox\n onSelect={(selectedItem) => {\n const tempSelectedDate = isDateInRange({\n minDate,\n maxDate,\n currentDate: new Date(\n selectedItem.value as number,\n month - 1 - displayIndex,\n 1,\n ),\n });\n\n setCurrentDate(tempSelectedDate);\n }}\n lists={[\n {\n list: years,\n },\n ]}\n selectedItem={{\n text: year.toString(),\n value: year,\n }}\n placeholder=\"\"\n />\n ) : (\n <StyledMonthName>{currentYear !== year ? year : ''}</StyledMonthName>\n )}\n </>\n );\n};\n\nexport default MonthYearPickers;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,yBAAyB;AAClD,OAAOC,KAAK,IAAQC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,SAASC,WAAW,EAAEC,eAAe,EAAEC,aAAa,QAAQ,yBAAyB;AACrF,SAASC,eAAe,QAAQ,qCAAqC;AAErE,SAAQC,0BAA0B,QAAO,qBAAqB;AAE9D,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAn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AAE;IACF6B,WAAW,EAAC;EAAE,CACjB,CAAC,gBAEFzC,KAAA,CAAAiC,aAAA,CAAC3B,eAAe,QAAEa,WAAW,KAAKP,IAAI,GAAGA,IAAI,GAAG,EAAoB,CAE1E,CAAC;AAEX,CAAC;AAED,eAAeH,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"MonthYearPickers.js","names":["ComboBox","React","useMemo","useState","formatMonth","getYearsBetween","isDateInRange","differenceInCalendarMonths","StyledMonthName","MonthYearPickerType","MonthYearPickers","month","year","locale","minDate","maxDate","setCurrentDate","displayIndex","showMonthYearPickers","currentYear","Date","getFullYear","months","map","tempMonth","text","value","hasMultipleMonths","years","tempYear","toString","hasMultipleYears","length","createElement","Fragment","onSelect","selectedItem","tempSelectedDate","currentDate","lists","list","placeholder"],"sources":["../../../../../src/components/calendar/month-year-pickers/MonthYearPickers.tsx"],"sourcesContent":["import { ComboBox } from '@chayns-components/core';\nimport { Language } from 'chayns-api';\nimport React, { FC, useMemo, useState } from 'react';\nimport { EMonth } from '../../../types/calendar';\nimport { formatMonth, getYearsBetween, isDateInRange } from '../../../utils/calendar';\nimport { differenceInCalendarMonths } from '../../../utils/date';\nimport { StyledMonthName } from '../month-wrapper/month/Month.styles';\n\nexport enum MonthYearPickerType {\n Month = 'month',\n Year = 'year',\n}\n\ntype MonthYearPickerProps = {\n month: EMonth;\n year: number;\n locale: Language;\n minDate: Date;\n maxDate: Date;\n setCurrentDate: (date: Date) => void;\n displayIndex?: number;\n showMonthYearPickers: boolean;\n};\n\nconst MonthYearPickers: FC<MonthYearPickerProps> = ({\n month,\n year,\n locale,\n minDate,\n maxDate,\n setCurrentDate,\n displayIndex = 0,\n showMonthYearPickers,\n}) => {\n const [currentYear] = useState(new Date().getFullYear());\n\n const months = useMemo(\n () =>\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((tempMonth) => ({\n text: formatMonth({ month: tempMonth, locale }),\n value: tempMonth,\n })),\n [locale],\n );\n\n const hasMultipleMonths = useMemo(\n () => differenceInCalendarMonths(maxDate, minDate) > 0,\n [minDate, maxDate],\n );\n\n const years = useMemo(\n () =>\n getYearsBetween(minDate, maxDate).map((tempYear) => ({\n text: tempYear.toString(),\n value: tempYear,\n })),\n [minDate, maxDate],\n );\n\n const hasMultipleYears = useMemo(() => years.length > 1, [years]);\n\n return (\n <>\n {showMonthYearPickers && hasMultipleMonths ? (\n <ComboBox\n onSelect={(selectedItem) => {\n if (!selectedItem) return;\n\n const tempSelectedDate = isDateInRange({\n minDate,\n maxDate,\n currentDate: new Date(\n year,\n (selectedItem.value as number) - 1 - displayIndex,\n 1,\n ),\n });\n\n setCurrentDate(tempSelectedDate);\n }}\n lists={[\n {\n list: months,\n },\n ]}\n selectedItem={{\n text: formatMonth({ month, locale }),\n value: month,\n }}\n placeholder=\"\"\n />\n ) : (\n <StyledMonthName>{formatMonth({ locale, month })}</StyledMonthName>\n )}\n {showMonthYearPickers && hasMultipleYears ? (\n <ComboBox\n onSelect={(selectedItem) => {\n if (!selectedItem) return;\n\n const tempSelectedDate = isDateInRange({\n minDate,\n maxDate,\n currentDate: new Date(\n selectedItem.value as number,\n month - 1 - displayIndex,\n 1,\n ),\n });\n\n setCurrentDate(tempSelectedDate);\n }}\n lists={[\n {\n list: years,\n },\n ]}\n selectedItem={{\n text: year.toString(),\n value: year,\n }}\n placeholder=\"\"\n />\n ) : (\n <StyledMonthName>{currentYear !== year ? year : ''}</StyledMonthName>\n )}\n </>\n );\n};\n\nexport default MonthYearPickers;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,yBAAyB;AAElD,OAAOC,KAAK,IAAQC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,SAASC,WAAW,EAAEC,eAAe,EAAEC,aAAa,QAAQ,yBAAyB;AACrF,SAASC,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,eAAe,QAAQ,qCAAqC;AAErE,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAm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,IAAI,CAACkB,QAAQ,CAAC,CAAC;MACrBJ,KAAK,EAAEd;IACX,CAAE;IACF6B,WAAW,EAAC;EAAE,CACjB,CAAC,gBAEFxC,KAAA,CAAAgC,aAAA,CAACzB,eAAe,QAAEW,WAAW,KAAKP,IAAI,GAAGA,IAAI,GAAG,EAAoB,CAE1E,CAAC;AAEX,CAAC;AAED,eAAeF,gBAAgB","ignoreList":[]}
@@ -1,20 +1,21 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { useDateInfo } from '../../hooks/useDateInfo';
3
- const DateInfo = _ref => {
4
- let {
5
- date,
6
- preText = '',
7
- shouldShowYear,
8
- shouldShowTime,
9
- shouldShowRelativeDayOfWeek,
10
- shouldUseShortText,
11
- shouldShowDayOfWeek,
12
- shouldShowDateToNowDifference
13
- } = _ref;
3
+ const DateInfo = ({
4
+ date,
5
+ preText = '',
6
+ shouldShowYear,
7
+ shouldShowTime,
8
+ shouldShowRelativeDayOfWeek,
9
+ shouldUseShortText,
10
+ shouldShowDayOfWeek,
11
+ shouldShowDateToNowDifference,
12
+ shouldShowOnlyTime
13
+ }) => {
14
14
  const formattedDate = useDateInfo({
15
15
  date,
16
16
  preText,
17
17
  shouldShowYear,
18
+ shouldShowOnlyTime,
18
19
  shouldShowTime,
19
20
  shouldUseShortText,
20
21
  shouldShowDayOfWeek,
@@ -1 +1 @@
1
- {"version":3,"file":"DateInfo.js","names":["React","useMemo","useDateInfo","DateInfo","_ref","date","preText","shouldShowYear","shouldShowTime","shouldShowRelativeDayOfWeek","shouldUseShortText","shouldShowDayOfWeek","shouldShowDateToNowDifference","formattedDate","createElement","displayName"],"sources":["../../../../src/components/date-info/DateInfo.tsx"],"sourcesContent":["import React, { FC, useMemo } from 'react';\nimport { useDateInfo } from '../../hooks/useDateInfo';\nimport { UseDateInfoOptions } from '../../types/dateinfo';\n\nexport type DateInfoProps = UseDateInfoOptions;\n\nconst DateInfo: FC<DateInfoProps> = ({\n date,\n preText = '',\n shouldShowYear,\n shouldShowTime,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowDateToNowDifference,\n}) => {\n const formattedDate = useDateInfo({\n date,\n preText,\n shouldShowYear,\n shouldShowTime,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowDateToNowDifference,\n });\n\n return useMemo(() => <span>{formattedDate}</span>, [formattedDate]);\n};\n\nDateInfo.displayName = 'DateInfo';\n\nexport default DateInfo;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,OAAO,QAAQ,OAAO;AAC1C,SAASC,WAAW,QAAQ,yBAAyB;AAKrD,MAAMC,QAA2B,GAAGC,IAAA,IAS9B;EAAA,IAT+B;IACjCC,IAAI;IACJC,OAAO,GAAG,EAAE;IACZC,cAAc;IACdC,cAAc;IACdC,2BAA2B;IAC3BC,kBAAkB;IAClBC,mBAAmB;IACnBC;EACJ,CAAC,GAAAR,IAAA;EACG,MAAMS,aAAa,GAAGX,WAAW,CAAC;IAC9BG,IAAI;IACJC,OAAO;IACPC,cAAc;IACdC,cAAc;IACdE,kBAAkB;IAClBC,mBAAmB;IACnBF,2BAA2B;IAC3BG;EACJ,CAAC,CAAC;EAEF,OAAOX,OAAO,CAAC,mBAAMD,KAAA,CAAAc,aAAA,eAAOD,aAAoB,CAAC,EAAE,CAACA,aAAa,CAAC,CAAC;AACvE,CAAC;AAEDV,QAAQ,CAACY,WAAW,GAAG,UAAU;AAEjC,eAAeZ,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"DateInfo.js","names":["React","useMemo","useDateInfo","DateInfo","date","preText","shouldShowYear","shouldShowTime","shouldShowRelativeDayOfWeek","shouldUseShortText","shouldShowDayOfWeek","shouldShowDateToNowDifference","shouldShowOnlyTime","formattedDate","createElement","displayName"],"sources":["../../../../src/components/date-info/DateInfo.tsx"],"sourcesContent":["import React, { FC, useMemo } from 'react';\nimport { useDateInfo } from '../../hooks/useDateInfo';\nimport { UseDateInfoOptions } from '../../types/dateinfo';\n\nexport type DateInfoProps = UseDateInfoOptions;\n\nconst DateInfo: FC<DateInfoProps> = ({\n date,\n preText = '',\n shouldShowYear,\n shouldShowTime,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowDateToNowDifference,\n shouldShowOnlyTime,\n}) => {\n const formattedDate = useDateInfo({\n date,\n preText,\n shouldShowYear,\n shouldShowOnlyTime,\n shouldShowTime,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowDateToNowDifference,\n });\n\n return useMemo(() => <span>{formattedDate}</span>, [formattedDate]);\n};\n\nDateInfo.displayName = 'DateInfo';\n\nexport default DateInfo;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,OAAO,QAAQ,OAAO;AAC1C,SAASC,WAAW,QAAQ,yBAAyB;AAKrD,MAAMC,QAA2B,GAAGA,CAAC;EACjCC,IAAI;EACJC,OAAO,GAAG,EAAE;EACZC,cAAc;EACdC,cAAc;EACdC,2BAA2B;EAC3BC,kBAAkB;EAClBC,mBAAmB;EACnBC,6BAA6B;EAC7BC;AACJ,CAAC,KAAK;EACF,MAAMC,aAAa,GAAGX,WAAW,CAAC;IAC9BE,IAAI;IACJC,OAAO;IACPC,cAAc;IACdM,kBAAkB;IAClBL,cAAc;IACdE,kBAAkB;IAClBC,mBAAmB;IACnBF,2BAA2B;IAC3BG;EACJ,CAAC,CAAC;EAEF,OAAOV,OAAO,CAAC,mBAAMD,KAAA,CAAAc,aAAA,eAAOD,aAAoB,CAAC,EAAE,CAACA,aAAa,CAAC,CAAC;AACvE,CAAC;AAEDV,QAAQ,CAACY,WAAW,GAAG,UAAU;AAEjC,eAAeZ,QAAQ","ignoreList":[]}
@@ -4,20 +4,18 @@ import { HintTextPosition } from '../../types/openingTimes';
4
4
  import HintText from './hint-text/HintText';
5
5
  import OpeningInputs from './opening-inputs/OpeningInputs';
6
6
  import { StyledOpeningTimes, StyledOpeningTimesTooltipContent, StyledOpeningTimesWeekDay, StyledOpeningTimesWrapper } from './OpeningTimes.styles';
7
- const OpeningTimes = _ref => {
8
- let {
9
- closedText = 'closed',
10
- currentDayId,
11
- editMode = false,
12
- hintText,
13
- hintTextPosition = HintTextPosition.Bottom,
14
- openingTimes,
15
- weekdays,
16
- onChange,
17
- onTimeAdd,
18
- onTimeRemove,
19
- shouldNotValidate = false
20
- } = _ref;
7
+ const OpeningTimes = ({
8
+ closedText = 'closed',
9
+ currentDayId,
10
+ editMode = false,
11
+ hintText,
12
+ hintTextPosition = HintTextPosition.Bottom,
13
+ openingTimes,
14
+ weekdays,
15
+ onChange,
16
+ onTimeAdd,
17
+ onTimeRemove
18
+ }) => {
21
19
  const [newOpeningTimes, setNewOpeningTimes] = useState();
22
20
  const [invalidOpeningTimes, setInvalidOpeningTimes] = useState([]);
23
21
  const [isPopupOpen, setIsPopupOpen] = useState(false);
@@ -27,7 +25,7 @@ const OpeningTimes = _ref => {
27
25
  setNewOpeningTimes(openingTimes);
28
26
  }, [openingTimes]);
29
27
  const validateTime = useCallback((newTime, dayId) => {
30
- if (newTime.start === newTime.end) {
28
+ if (newTime.start === newTime.end || newTime.start >= newTime.end) {
31
29
  return false;
32
30
  }
33
31
  const dayTimes = newOpeningTimes?.find(day => day.id === dayId)?.times || [];
@@ -53,10 +51,7 @@ const OpeningTimes = _ref => {
53
51
  });
54
52
  }, [onChange]);
55
53
  const handleChange = useCallback((newTime, id) => {
56
- const isValid = shouldNotValidate || validateTime(newTime, id);
57
- if (!isValid) {
58
- return;
59
- }
54
+ const isValid = validateTime(newTime, id);
60
55
  setNewOpeningTimes(prevOpeningTimes => {
61
56
  const updatedOpeningTimes = (prevOpeningTimes ?? []).map(openingTime => {
62
57
  if (openingTime.id === id) {
@@ -74,21 +69,23 @@ const OpeningTimes = _ref => {
74
69
  return openingTime;
75
70
  });
76
71
  const changedOpeningTime = updatedOpeningTimes.find(updatedOpeningTime => updatedOpeningTime.id === id);
77
- if (isValid && typeof onChange === 'function') {
72
+ if (typeof onChange === 'function') {
78
73
  onChange({
74
+ isValid,
79
75
  dayId: changedOpeningTime?.id,
80
76
  time: newTime
81
77
  });
82
78
  }
83
79
  return updatedOpeningTimes;
84
80
  });
85
- }, [onChange, shouldNotValidate, validateTime]);
81
+ }, [onChange, validateTime]);
86
82
  const handleAdd = useCallback((time, id) => {
87
- const isValid = shouldNotValidate || validateTime(time, id);
88
- if (isValid && typeof onTimeAdd === 'function') {
83
+ const isValid = validateTime(time, id);
84
+ if (typeof onTimeAdd === 'function') {
89
85
  onTimeAdd({
90
86
  time,
91
- dayId: id
87
+ dayId: id,
88
+ isValid
92
89
  });
93
90
  }
94
91
  setNewOpeningTimes(prevOpeningTimes => (prevOpeningTimes ?? []).map(openingTime => {
@@ -100,7 +97,7 @@ const OpeningTimes = _ref => {
100
97
  }
101
98
  return openingTime;
102
99
  }));
103
- }, [onTimeAdd, shouldNotValidate, validateTime]);
100
+ }, [onTimeAdd, validateTime]);
104
101
  const handleUpdateInvalidIds = useCallback((openingTimeId, invalidTimeIds) => {
105
102
  setInvalidOpeningTimes(prevState => {
106
103
  const updatedInvalidOpeningTimes = prevState.map(invalidOpeningTime => {
@@ -112,12 +109,9 @@ const OpeningTimes = _ref => {
112
109
  }
113
110
  return invalidOpeningTime;
114
111
  });
115
- if (!updatedInvalidOpeningTimes.some(_ref2 => {
116
- let {
117
- openingTimeId: updatedInvalidOpeningId
118
- } = _ref2;
119
- return updatedInvalidOpeningId === openingTimeId;
120
- }) && invalidTimeIds.length > 0) {
112
+ if (!updatedInvalidOpeningTimes.some(({
113
+ openingTimeId: updatedInvalidOpeningId
114
+ }) => updatedInvalidOpeningId === openingTimeId) && invalidTimeIds.length > 0) {
121
115
  updatedInvalidOpeningTimes.push({
122
116
  openingTimeId,
123
117
  invalidTimeIds
@@ -143,13 +137,12 @@ const OpeningTimes = _ref => {
143
137
  if (!newOpeningTimes) {
144
138
  return items;
145
139
  }
146
- newOpeningTimes.forEach(_ref3 => {
147
- let {
148
- times,
149
- id,
150
- weekdayId,
151
- isDisabled
152
- } = _ref3;
140
+ newOpeningTimes.forEach(({
141
+ times,
142
+ id,
143
+ weekdayId,
144
+ isDisabled
145
+ }) => {
153
146
  const weekday = weekdays.find(weekDay => weekDay.id === weekdayId)?.name;
154
147
  if (!weekday) {
155
148
  return;
@@ -187,12 +180,9 @@ const OpeningTimes = _ref => {
187
180
  if (!currentDayId || editMode) {
188
181
  return content;
189
182
  }
190
- const singleDay = newOpeningTimes?.find(_ref4 => {
191
- let {
192
- id
193
- } = _ref4;
194
- return id === currentDayId;
195
- });
183
+ const singleDay = newOpeningTimes?.find(({
184
+ id
185
+ }) => id === currentDayId);
196
186
  if (!singleDay) {
197
187
  return content;
198
188
  }