@chayns-components/date 5.0.0-beta.433
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +34 -0
- package/lib/components/calendar/Calendar.d.ts +36 -0
- package/lib/components/calendar/Calendar.js +141 -0
- package/lib/components/calendar/Calendar.js.map +1 -0
- package/lib/components/calendar/Calendar.styles.d.ts +4 -0
- package/lib/components/calendar/Calendar.styles.js +20 -0
- package/lib/components/calendar/Calendar.styles.js.map +1 -0
- package/lib/components/calendar/month-wrapper/MonthWrapper.d.ts +17 -0
- package/lib/components/calendar/month-wrapper/MonthWrapper.js +137 -0
- package/lib/components/calendar/month-wrapper/MonthWrapper.js.map +1 -0
- package/lib/components/calendar/month-wrapper/MonthWrapper.styles.d.ts +271 -0
- package/lib/components/calendar/month-wrapper/MonthWrapper.styles.js +24 -0
- package/lib/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/Month.d.ts +14 -0
- package/lib/components/calendar/month-wrapper/month/Month.js +43 -0
- package/lib/components/calendar/month-wrapper/month/Month.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/Month.styles.d.ts +4 -0
- package/lib/components/calendar/month-wrapper/month/Month.styles.js +23 -0
- package/lib/components/calendar/month-wrapper/month/Month.styles.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.d.ts +12 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +60 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.d.ts +2 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +17 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.d.ts +12 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +66 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.d.ts +15 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +75 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.d.ts +6 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +20 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.d.ts +7 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +21 -0
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.d.ts +7 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +45 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.d.ts +2 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +16 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.d.ts +6 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +18 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.d.ts +4 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +19 -0
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -0
- package/lib/components/date-info/DateInfo.d.ts +37 -0
- package/lib/components/date-info/DateInfo.js +110 -0
- package/lib/components/date-info/DateInfo.js.map +1 -0
- package/lib/components/opening-times/OpeningTimes.d.ts +27 -0
- package/lib/components/opening-times/OpeningTimes.js +135 -0
- package/lib/components/opening-times/OpeningTimes.js.map +1 -0
- package/lib/components/opening-times/OpeningTimes.styles.d.ts +8 -0
- package/lib/components/opening-times/OpeningTimes.styles.js +19 -0
- package/lib/components/opening-times/OpeningTimes.styles.js.map +1 -0
- package/lib/components/opening-times/opening-inputs/OpeningInputs.d.ts +12 -0
- package/lib/components/opening-times/opening-inputs/OpeningInputs.js +94 -0
- package/lib/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
- package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.d.ts +2 -0
- package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js +13 -0
- package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.d.ts +14 -0
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js +100 -0
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.d.ts +274 -0
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +46 -0
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
- package/lib/constants/dateInfo.d.ts +22 -0
- package/lib/constants/dateInfo.js +629 -0
- package/lib/constants/dateInfo.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +28 -0
- package/lib/index.js.map +1 -0
- package/lib/types/calendar.d.ts +32 -0
- package/lib/types/calendar.js +22 -0
- package/lib/types/calendar.js.map +1 -0
- package/lib/types/openingTimes.d.ts +28 -0
- package/lib/types/openingTimes.js +13 -0
- package/lib/types/openingTimes.js.map +1 -0
- package/lib/utils/calendar.d.ts +15 -0
- package/lib/utils/calendar.js +58 -0
- package/lib/utils/calendar.js.map +1 -0
- package/lib/utils/dateInfo.d.ts +55 -0
- package/lib/utils/dateInfo.js +364 -0
- package/lib/utils/dateInfo.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Day.js","names":["_react","_interopRequireWildcard","require","_dateFns","_Day","_Category","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Day","_ref","date","highlightedDates","categories","isSameMonth","isSelected","onClick","fontSize","setFontSize","useState","dayRef","useRef","styles","useMemo","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","backgroundColor","textColor","StyledDayNumber","getDate","StyledDayCategoryWrapper","displayName","_default","exports"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/Day.tsx"],"sourcesContent":["import React, { type CSSProperties, FC, useEffect, useMemo, useRef, useState } from 'react';\nimport { isSameDay } from 'date-fns';\nimport { StyledDay, StyledDayCategoryWrapper, StyledDayNumber } from './Day.styles';\nimport type {\n Categories,\n HighlightedDates,\n HighlightedDateStyles,\n} from '../../../../../../types/calendar';\nimport Category from './category/Category';\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,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AAMA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA2C,SAAAI,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF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CAAC,CAAC,CAACE,WAAW,CAACC,KAAK;UAElDjC,WAAW,CAAE,GAAE+B,aAAa,GAAG,CAAE,IAAG,CAAC;QACzC;MACJ,CAAC,CAAC;MAEFH,cAAc,CAACM,OAAO,CAAChC,MAAM,CAACyB,OAAO,CAAC;MAEtC,OAAO,MAAM;QACTC,cAAc,CAACO,UAAU,CAAC,CAAC;MAC/B,CAAC;IACL;IAEA,OAAO,MAAM,CAAC,CAAC;EACnB,CAAC,EAAE,EAAE,CAAC;EAEN,oBACIzE,MAAA,CAAAS,OAAA,CAAAiD,aAAA,CAACtD,IAAA,CAAAsE,SAAS;IACNC,GAAG,EAAEnC,MAAO;IACZJ,OAAO,EAAEA,CAAA,KAAMA,OAAO,CAACL,IAAI,EAAEG,WAAW,CAAE;IAC1CA,WAAW,EAAEA,WAAY;IACzB0C,eAAe,EAAElC,MAAM,EAAEkC,eAAgB;IACzCC,SAAS,EAAEnC,MAAM,EAAEmC;EAAU,gBAE7B7E,MAAA,CAAAS,OAAA,CAAAiD,aAAA,CAACtD,IAAA,CAAA0E,eAAe;IAAC3C,UAAU,EAAEA,UAAW;IAACE,QAAQ,EAAEA;EAAS,GACvDN,IAAI,CAACgD,OAAO,CAAC,CACD,CAAC,EACjB3B,gBAAgB,iBACbpD,MAAA,CAAAS,OAAA,CAAAiD,aAAA,CAACtD,IAAA,CAAA4E,wBAAwB,QAAE5B,gBAA2C,CAEnE,CAAC;AAEpB,CAAC;AAEDvB,GAAG,CAACoD,WAAW,GAAG,KAAK;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1E,OAAA,GAEToB,GAAG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WithTheme } from '@chayns-components/core';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
type StyledDayProps = WithTheme<{
|
|
4
|
+
isSameMonth: boolean;
|
|
5
|
+
backgroundColor?: CSSProperties['backgroundColor'];
|
|
6
|
+
textColor?: CSSProperties['color'];
|
|
7
|
+
}>;
|
|
8
|
+
export declare const StyledDay: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledDayProps>>;
|
|
9
|
+
type StyledDayNumberProps = WithTheme<{
|
|
10
|
+
isSelected: boolean;
|
|
11
|
+
fontSize: CSSProperties['fontSize'];
|
|
12
|
+
}>;
|
|
13
|
+
export declare const StyledDayNumber: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledDayNumberProps>>;
|
|
14
|
+
export declare const StyledDayCategoryWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
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 && Object.prototype.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: ${_ref => {
|
|
13
|
+
let {
|
|
14
|
+
isSameMonth
|
|
15
|
+
} = _ref;
|
|
16
|
+
return isSameMonth ? 'pointer' : 'default';
|
|
17
|
+
}};
|
|
18
|
+
color: ${_ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
isSameMonth,
|
|
21
|
+
theme
|
|
22
|
+
} = _ref2;
|
|
23
|
+
return isSameMonth ? theme.text : `rgba(${theme['text-rgb'] ?? ''}, 0.5)`;
|
|
24
|
+
}};
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
aspect-ratio: 1;
|
|
29
|
+
|
|
30
|
+
${_ref3 => {
|
|
31
|
+
let {
|
|
32
|
+
backgroundColor,
|
|
33
|
+
textColor
|
|
34
|
+
} = _ref3;
|
|
35
|
+
return backgroundColor && textColor && (0, _styledComponents.css)`
|
|
36
|
+
color: ${textColor};
|
|
37
|
+
background-color: ${backgroundColor};
|
|
38
|
+
`;
|
|
39
|
+
}}
|
|
40
|
+
`;
|
|
41
|
+
const StyledDayNumber = exports.StyledDayNumber = _styledComponents.default.div`
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
width: 80%;
|
|
47
|
+
height: 80%;
|
|
48
|
+
font-size: ${_ref4 => {
|
|
49
|
+
let {
|
|
50
|
+
fontSize
|
|
51
|
+
} = _ref4;
|
|
52
|
+
return fontSize;
|
|
53
|
+
}};
|
|
54
|
+
|
|
55
|
+
${_ref5 => {
|
|
56
|
+
let {
|
|
57
|
+
isSelected,
|
|
58
|
+
theme
|
|
59
|
+
} = _ref5;
|
|
60
|
+
return isSelected && (0, _styledComponents.css)`
|
|
61
|
+
background-color: ${theme['404']};
|
|
62
|
+
color: ${theme['409']};
|
|
63
|
+
`;
|
|
64
|
+
}}
|
|
65
|
+
`;
|
|
66
|
+
const StyledDayCategoryWrapper = exports.StyledDayCategoryWrapper = _styledComponents.default.div`
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
gap: 6%;
|
|
71
|
+
width: 100%;
|
|
72
|
+
position: absolute;
|
|
73
|
+
bottom: 2px;
|
|
74
|
+
`;
|
|
75
|
+
//# 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","prototype","hasOwnProperty","call","i","set","StyledDay","exports","styled","div","_ref","isSameMonth","_ref2","theme","text","_ref3","backgroundColor","textColor","css","StyledDayNumber","_ref4","fontSize","_ref5","isSelected","StyledDayCategoryWrapper"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '@chayns-components/core';\nimport type { CSSProperties } from 'react';\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":";;;;;;AAAA,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,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IA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CAAgCL,KAAK,CAAC,KAAK,CAAE;AAC7C,qBAAqBA,KAAK,CAAC,KAAK,CAAE;AAClC,SAAS;AAAA,CAAC;AACV,CAAC;AAEM,MAAMW,wBAAwB,GAAAjB,OAAA,CAAAiB,wBAAA,GAAGhB,yBAAM,CAACC,GAAI;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
color
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement(_Category.StyledCategory, {
|
|
15
|
+
color: color
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
Category.displayName = 'Category';
|
|
19
|
+
var _default = exports.default = Category;
|
|
20
|
+
//# sourceMappingURL=Category.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Category.js","names":["_react","_interopRequireDefault","require","_Category","obj","__esModule","default","Category","_ref","color","createElement","StyledCategory","displayName","_default","exports"],"sources":["../../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.tsx"],"sourcesContent":["import React, { type CSSProperties, FC } 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,GAAGC,IAAA;EAAA,IAAC;IAAEC;EAAM,CAAC,GAAAD,IAAA;EAAA,oBAAKR,MAAA,CAAAM,OAAA,CAAAI,aAAA,CAACP,SAAA,CAAAQ,cAAc;IAACF,KAAK,EAAEA;EAAM,CAAE,CAAC;AAAA;AAEnFF,QAAQ,CAACK,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEnBC,QAAQ"}
|
package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WithTheme } from '@chayns-components/core';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
type StyledCategoryProps = WithTheme<{
|
|
4
|
+
color: CSSProperties['color'];
|
|
5
|
+
}>;
|
|
6
|
+
export declare const StyledCategory: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledCategoryProps>>;
|
|
7
|
+
export {};
|
package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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: ${_ref => {
|
|
14
|
+
let {
|
|
15
|
+
color
|
|
16
|
+
} = _ref;
|
|
17
|
+
return color;
|
|
18
|
+
}};
|
|
19
|
+
border: 1px solid white;
|
|
20
|
+
`;
|
|
21
|
+
//# sourceMappingURL=Category.styles.js.map
|
package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Category.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledCategory","exports","styled","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,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,wBAAwBC,IAAA;EAAA,IAAC;IAAEC;EAAM,CAAC,GAAAD,IAAA;EAAA,OAAKC,KAAK;AAAA,CAAC;AAC7C;AACA,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 && Object.prototype.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 = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
locale
|
|
17
|
+
} = _ref;
|
|
18
|
+
const monday = (0, _dateFns.startOfWeek)(new Date(), {
|
|
19
|
+
weekStartsOn: 1
|
|
20
|
+
});
|
|
21
|
+
const sunday = (0, _dateFns.endOfWeek)(new Date(), {
|
|
22
|
+
weekStartsOn: 1
|
|
23
|
+
});
|
|
24
|
+
const weekdays = (0, _dateFns.eachDayOfInterval)({
|
|
25
|
+
start: monday,
|
|
26
|
+
end: sunday
|
|
27
|
+
});
|
|
28
|
+
const weekdayElements = (0, _react.useMemo)(() => {
|
|
29
|
+
const items = [];
|
|
30
|
+
weekdays.forEach(day => {
|
|
31
|
+
const formattedDay = (0, _dateFns.format)(day, 'EE', {
|
|
32
|
+
locale
|
|
33
|
+
});
|
|
34
|
+
items.push( /*#__PURE__*/_react.default.createElement(_Weekday.default, {
|
|
35
|
+
key: `weekday-${formattedDay}`,
|
|
36
|
+
name: formattedDay
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
return items;
|
|
40
|
+
}, [locale, weekdays]);
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_WeekdayWrapper.StyledWeekdayWrapper, null, weekdayElements);
|
|
42
|
+
};
|
|
43
|
+
WeekdayWrapper.displayName = 'WeekdayWrapper';
|
|
44
|
+
var _default = exports.default = WeekdayWrapper;
|
|
45
|
+
//# 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","prototype","hasOwnProperty","call","i","set","WeekdayWrapper","_ref","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,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAwC,SAAAI,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,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,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAZ,CAAA,oBAAAY,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAY,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAA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,EAAEO,QAAQ,CAAC,CAAC;EAEtB,oBAAOtC,MAAA,CAAAS,OAAA,CAAAyC,aAAA,CAAC9C,eAAA,CAAAiD,oBAAoB,QAAEX,eAAsC,CAAC;AACzE,CAAC;AAEDb,cAAc,CAACyB,WAAW,GAAG,gBAAgB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA/C,OAAA,GAE/BoB,cAAc"}
|
package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledWeekdayWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledWeekdayWrapper = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(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
|
package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeekdayWrapper.styles.js","names":["_styledComponents","_interopRequireDefault","require","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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
name
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement(_Weekday.StyledWeekday, null, name);
|
|
15
|
+
};
|
|
16
|
+
Weekday.displayName = 'Weekday';
|
|
17
|
+
var _default = exports.default = Weekday;
|
|
18
|
+
//# sourceMappingURL=Weekday.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Weekday.js","names":["_react","_interopRequireDefault","require","_Weekday","obj","__esModule","default","Weekday","_ref","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,GAAGC,IAAA;EAAA,IAAC;IAAEC;EAAK,CAAC,GAAAD,IAAA;EAAA,oBAAKR,MAAA,CAAAM,OAAA,CAAAI,aAAA,CAACP,QAAA,CAAAQ,aAAa,QAAEF,IAAoB,CAAC;AAAA;AAErFF,OAAO,CAACK,WAAW,GAAG,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEjBC,OAAO"}
|
package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledWeekday: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
theme: import("@chayns-components/core/lib/components/color-scheme-provider/ColorSchemeProvider").Theme;
|
|
4
|
+
}>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
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: ${_ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
return theme.headline;
|
|
16
|
+
}};
|
|
17
|
+
cursor: default;
|
|
18
|
+
`;
|
|
19
|
+
//# sourceMappingURL=Weekday.styles.js.map
|
package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Weekday.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledWeekday","exports","styled","div","_ref","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,aAAaC,IAAA;EAAA,IAAC;IAAEC;EAA0B,CAAC,GAAAD,IAAA;EAAA,OAAKC,KAAK,CAACC,QAAQ;AAAA,CAAC;AAC/D;AACA,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export type DateInfoProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The date, that should be displayed
|
|
5
|
+
*/
|
|
6
|
+
date: Date | string;
|
|
7
|
+
/**
|
|
8
|
+
* Additional text for "shouldShowDateToNowDifference" prop. Writes a text before the calculated time
|
|
9
|
+
*/
|
|
10
|
+
preText?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Adds the current year to the display
|
|
13
|
+
*/
|
|
14
|
+
shouldShowThisYear?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Adds the time to the display.
|
|
17
|
+
*/
|
|
18
|
+
shouldShowTime?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the relative day of week to today should be shown (today, yesterday or tomorrow).
|
|
21
|
+
*/
|
|
22
|
+
shouldShowRelativeDayOfWeek?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Shortens the day and month text to maximum three digits
|
|
25
|
+
*/
|
|
26
|
+
shouldUseShortText?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Adds the day of week to the display
|
|
29
|
+
*/
|
|
30
|
+
shouldShowDayOfWeek?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Shows the difference from the date to now. The component handles updates itself.
|
|
33
|
+
*/
|
|
34
|
+
shouldShowDateToNowDifference?: boolean;
|
|
35
|
+
};
|
|
36
|
+
declare const DateInfo: FC<DateInfoProps>;
|
|
37
|
+
export default DateInfo;
|
|
@@ -0,0 +1,110 @@
|
|
|
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 && Object.prototype.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 = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
date,
|
|
15
|
+
preText = '',
|
|
16
|
+
shouldShowThisYear,
|
|
17
|
+
shouldShowTime,
|
|
18
|
+
shouldShowRelativeDayOfWeek,
|
|
19
|
+
shouldUseShortText,
|
|
20
|
+
shouldShowDayOfWeek,
|
|
21
|
+
shouldShowDateToNowDifference
|
|
22
|
+
} = _ref;
|
|
23
|
+
const [formattedDate, setFormattedDate] = (0, _react.useState)(new Date(date));
|
|
24
|
+
const [formattedDateString, setFormattedDateString] = (0, _react.useState)('');
|
|
25
|
+
const [language] = (0, _react.useState)((0, _dateInfo.getLanguage)());
|
|
26
|
+
(0, _react.useEffect)(() => {
|
|
27
|
+
// This useEffect is used for normal date formation
|
|
28
|
+
if (shouldShowDateToNowDifference) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let newFormattedDateString = (0, _dateInfo.getFormattedDayOfWeek)({
|
|
32
|
+
shouldShowDayOfWeek,
|
|
33
|
+
shouldShowRelativeDayOfWeek,
|
|
34
|
+
shouldUseShortText,
|
|
35
|
+
date: formattedDate,
|
|
36
|
+
language
|
|
37
|
+
});
|
|
38
|
+
let formatString = 'dd. ';
|
|
39
|
+
formatString += `${(0, _dateInfo.getMonthFormat)({
|
|
40
|
+
shouldUseShortText
|
|
41
|
+
})}`;
|
|
42
|
+
formatString += `${(0, _dateInfo.getYearFormat)({
|
|
43
|
+
date: formattedDate,
|
|
44
|
+
shouldShowThisYear
|
|
45
|
+
})}`;
|
|
46
|
+
newFormattedDateString += (0, _dateFns.format)(formattedDate, formatString, {
|
|
47
|
+
locale: language
|
|
48
|
+
});
|
|
49
|
+
newFormattedDateString += (0, _dateInfo.getFormattedTime)({
|
|
50
|
+
date: formattedDate,
|
|
51
|
+
shouldShowTime,
|
|
52
|
+
language
|
|
53
|
+
});
|
|
54
|
+
setFormattedDateString(newFormattedDateString);
|
|
55
|
+
}, [date, formattedDate, language, shouldShowDateToNowDifference, shouldShowDayOfWeek, shouldShowRelativeDayOfWeek, shouldShowThisYear, shouldShowTime, shouldUseShortText]);
|
|
56
|
+
|
|
57
|
+
// Calculate remaining time till next minute to update time according to time left
|
|
58
|
+
const [currentDate, setCurrentDate] = (0, _react.useState)(new Date());
|
|
59
|
+
(0, _react.useEffect)(() => {
|
|
60
|
+
// This useEffect is for calculating the current date for shouldShowDateToNowDifference option
|
|
61
|
+
if (!shouldShowDateToNowDifference) {
|
|
62
|
+
return () => {};
|
|
63
|
+
}
|
|
64
|
+
let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();
|
|
65
|
+
|
|
66
|
+
// If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently
|
|
67
|
+
if (timeoutTime < 0) {
|
|
68
|
+
timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// initialized with remaining time
|
|
72
|
+
let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();
|
|
73
|
+
|
|
74
|
+
// set to elapsed time
|
|
75
|
+
if ((0, _dateFns.isPast)(formattedDate)) {
|
|
76
|
+
timeDiffInMs = currentDate.getTime() - formattedDate.getTime();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// time difference is less than a minute, time should be updated every second
|
|
80
|
+
if (timeDiffInMs < 60000) {
|
|
81
|
+
timeoutTime = 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Set timeoutTime to at least 1000ms
|
|
85
|
+
timeoutTime = Math.max(timeoutTime * 1000, 1000);
|
|
86
|
+
const timeout = setTimeout(() => {
|
|
87
|
+
setCurrentDate(new Date());
|
|
88
|
+
}, timeoutTime);
|
|
89
|
+
return () => {
|
|
90
|
+
clearTimeout(timeout);
|
|
91
|
+
};
|
|
92
|
+
}, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);
|
|
93
|
+
(0, _react.useEffect)(() => {
|
|
94
|
+
// This useEffect is for showing the difference of the date to now
|
|
95
|
+
if (shouldShowDateToNowDifference) {
|
|
96
|
+
setFormattedDateString((0, _dateInfo.getTimeTillNow)({
|
|
97
|
+
date: formattedDate,
|
|
98
|
+
currentDate,
|
|
99
|
+
language
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
}, [currentDate, date, formattedDate, language, shouldShowDateToNowDifference]);
|
|
103
|
+
(0, _react.useEffect)(() => {
|
|
104
|
+
setFormattedDate(new Date(date));
|
|
105
|
+
}, [date]);
|
|
106
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement("span", null, preText.trim(), " ", formattedDateString), [formattedDateString, preText]);
|
|
107
|
+
};
|
|
108
|
+
DateInfo.displayName = 'DateInfo';
|
|
109
|
+
var _default = exports.default = DateInfo;
|
|
110
|
+
//# 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","prototype","hasOwnProperty","call","i","set","DateInfo","_ref","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\nDate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S,YAAY,CAACF,OAAO,CAAC;IACzB,CAAC;EACL,CAAC,EAAE,CAACT,WAAW,EAAEzB,IAAI,EAAEQ,aAAa,EAAED,6BAA6B,CAAC,CAAC;EAErE,IAAAS,gBAAS,EAAC,MAAM;IACZ;IACA,IAAIT,6BAA6B,EAAE;MAC/BM,sBAAsB,CAAC,IAAAwB,wBAAc,EAAC;QAAErC,IAAI,EAAEQ,aAAa;QAAEiB,WAAW;QAAEX;MAAS,CAAC,CAAC,CAAC;IAC1F;EACJ,CAAC,EAAE,CAACW,WAAW,EAAEzB,IAAI,EAAEQ,aAAa,EAAEM,QAAQ,EAAEP,6BAA6B,CAAC,CAAC;EAE/E,IAAAS,gBAAS,EAAC,MAAM;IACZP,gBAAgB,CAAC,IAAIE,IAAI,CAACX,IAAI,CAAC,CAAC;EACpC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEV,OAAO,IAAAsC,cAAO,EACV,mBACIhE,MAAA,CAAAS,OAAA,CAAAwD,aAAA,eACKtC,OAAO,CAACuC,IAAI,CAAC,CAAC,EAAC,GAAC,EAAC5B,mBAChB,CACT,EACD,CAACA,mBAAmB,EAAEX,OAAO,CACjC,CAAC;AACL,CAAC;AAEDH,QAAQ,CAAC2C,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEnBe,QAAQ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import type { OnChange, OnTimeAdd, OpeningTime, Weekday } from '../../types/openingTimes';
|
|
3
|
+
export type OpeningTimesProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Function to be executed when a time is changed or a day is enabled/disabled.
|
|
6
|
+
* @param openingTimes
|
|
7
|
+
*/
|
|
8
|
+
onChange?: ({ time, enabledDays }: OnChange) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Function to be executed when a time is added.
|
|
11
|
+
*/
|
|
12
|
+
onTimeAdd?: ({ time, dayId }: OnTimeAdd) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Function to be executed when a time is removed.
|
|
15
|
+
*/
|
|
16
|
+
onTimeRemove?: (id: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The opening times corresponding to its weekday.
|
|
19
|
+
*/
|
|
20
|
+
openingTimes: OpeningTime[];
|
|
21
|
+
/**
|
|
22
|
+
* The weekdays that should be displayed.
|
|
23
|
+
*/
|
|
24
|
+
weekdays: Weekday[];
|
|
25
|
+
};
|
|
26
|
+
declare const OpeningTimes: FC<OpeningTimesProps>;
|
|
27
|
+
export default OpeningTimes;
|