@chayns-components/date 5.0.0-beta.663 → 5.0.0-beta.665
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/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js +3 -6
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js.map +1 -1
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js +3 -1
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -1
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js +4 -7
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js.map +1 -1
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js +8 -3
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -1
- package/lib/types/components/calendar/month-wrapper/MonthWrapper.styles.d.ts +1 -0
- package/package.json +3 -3
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _core = require("@chayns-components/core");
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _calendar = require("../../../utils/calendar");
|
|
10
9
|
var _Month = _interopRequireDefault(require("./month/Month"));
|
|
@@ -26,9 +25,7 @@ const MonthWrapper = ({
|
|
|
26
25
|
}) => {
|
|
27
26
|
const [content, setContent] = (0, _react.useState)();
|
|
28
27
|
const [prevSelectedDate, setPrevSelectedDate] = (0, _react.useState)();
|
|
29
|
-
const
|
|
30
|
-
const monthWrapperSize = (0, _core.useElementSize)(monthWrapperRef);
|
|
31
|
-
const monthHeight = (0, _react.useMemo)(() => monthWrapperSize ? monthWrapperSize.width / (shouldRenderTwo ? 2 : 1) : 0, [monthWrapperSize, shouldRenderTwo]);
|
|
28
|
+
const monthHeight = (0, _react.useMemo)(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);
|
|
32
29
|
(0, _react.useEffect)(() => {
|
|
33
30
|
setContent(undefined);
|
|
34
31
|
}, [monthHeight]);
|
|
@@ -148,8 +145,8 @@ const MonthWrapper = ({
|
|
|
148
145
|
}
|
|
149
146
|
}, [direction, shouldRenderTwo]);
|
|
150
147
|
return /*#__PURE__*/_react.default.createElement(_MonthWrapper.StyledMonthWrapper, {
|
|
151
|
-
$height:
|
|
152
|
-
|
|
148
|
+
$height: monthHeight,
|
|
149
|
+
$width: width
|
|
153
150
|
}, /*#__PURE__*/_react.default.createElement(_MonthWrapper.StyledMotionWrapper, {
|
|
154
151
|
animate: animate,
|
|
155
152
|
transition: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.js","names":["_core","require","_react","_interopRequireWildcard","_calendar","_Month","_interopRequireDefault","_MonthWrapper","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MonthWrapper","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","content","setContent","useState","prevSelectedDate","setPrevSelectedDate","monthWrapperRef","useRef","monthWrapperSize","useElementSize","monthHeight","useMemo","useEffect","undefined","prevState","items","date","getNewDate","month","year","getMonthAndYear","push","createElement","height","key","unshift","pop","shift","map","element","props","animate","x","StyledMonthWrapper","$height","ref","StyledMotionWrapper","transition","type","duration","onAnimationComplete","displayName","_default","exports"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import { useElementSize } from '@chayns-components/core';\nimport type { Locale } from 'date-fns';\nimport type { MotionProps } from 'framer-motion';\nimport React, { FC, useEffect, useMemo, useRef, useState, type ReactElement } from 'react';\nimport type { Categories, HighlightedDates } from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Locale;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n const [prevSelectedDate, setPrevSelectedDate] = useState<Date>();\n\n const monthWrapperRef = useRef<HTMLDivElement>(null);\n\n const monthWrapperSize = useElementSize(monthWrapperRef);\n\n const monthHeight = useMemo(\n () => (monthWrapperSize ? monthWrapperSize.width / (shouldRenderTwo ? 2 : 1) : 0),\n [monthWrapperSize, shouldRenderTwo],\n );\n\n useEffect(() => {\n setContent(undefined);\n }, [monthHeight]);\n\n useEffect(() => {\n if (prevSelectedDate !== selectedDate) {\n setPrevSelectedDate(selectedDate);\n }\n }, [prevSelectedDate, selectedDate]);\n\n useEffect(() => {\n setContent((prevState) => {\n // Initial render of months\n if (!prevState) {\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n }\n\n return items;\n }\n\n if (direction === 'left') {\n const date = getNewDate(-1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.unshift(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.pop();\n }\n\n if (direction === 'right') {\n const date = getNewDate(2, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.shift();\n }\n\n return prevState;\n });\n }, [\n categories,\n currentDate,\n direction,\n highlightedDates,\n locale,\n monthHeight,\n onSelect,\n prevSelectedDate,\n selectedDate,\n ]);\n\n useEffect(() => {\n if (selectedDate) {\n setContent((prevState) =>\n (prevState ?? []).map((element) => ({\n ...element,\n props: { ...element.props, selectedDate } as ReactElement,\n })),\n );\n }\n }, [selectedDate]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={shouldRenderTwo ? width / 2 : width} ref={monthWrapperRef}>\n <StyledMotionWrapper\n animate={animate}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrapper';\n\nexport default MonthWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAAgF,SAAAK,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,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M;UACrB,OAAO;YAAEmC,CAAC,EAAE;UAAK,CAAC;QACtB,KAAKnC,SAAS,KAAK,OAAO;UACtB,OAAO;YAAEmC,CAAC,EAAE;UAAQ,CAAC;QACzB;UACI,OAAO;YAAEA,CAAC,EAAE;UAAQ,CAAC;MAC7B;IACJ;EACJ,CAAC,EAAE,CAACnC,SAAS,EAAEE,eAAe,CAAC,CAAC;EAEhC,oBACInC,MAAA,CAAAQ,OAAA,CAAAkD,aAAA,CAACrD,aAAA,CAAAgE,kBAAkB;IAACC,OAAO,EAAEnC,eAAe,GAAGC,KAAK,GAAG,CAAC,GAAGA,KAAM;IAACmC,GAAG,EAAE7B;EAAgB,gBACnF1C,MAAA,CAAAQ,OAAA,CAAAkD,aAAA,CAACrD,aAAA,CAAAmE,mBAAmB;IAChBL,OAAO,EAAEA,OAAQ;IACjBM,UAAU,EAAE;MACRC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAE,CAAC1C,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACF2C,mBAAmB,EAAE1C;EAAoB,GAExCG,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDX,YAAY,CAACmD,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvE,OAAA,GAE3BkB,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MonthWrapper.js","names":["_react","_interopRequireWildcard","require","_calendar","_Month","_interopRequireDefault","_MonthWrapper","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MonthWrapper","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","content","setContent","useState","prevSelectedDate","setPrevSelectedDate","monthHeight","useMemo","useEffect","undefined","prevState","items","date","getNewDate","month","year","getMonthAndYear","push","createElement","height","key","unshift","pop","shift","map","element","props","animate","x","StyledMonthWrapper","$height","$width","StyledMotionWrapper","transition","type","duration","onAnimationComplete","displayName","_default","exports"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import type { Locale } from 'date-fns';\nimport type { MotionProps } from 'framer-motion';\nimport React, { FC, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport type { Categories, HighlightedDates } from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Locale;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n const [prevSelectedDate, setPrevSelectedDate] = useState<Date>();\n\n const monthHeight = useMemo(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);\n\n useEffect(() => {\n setContent(undefined);\n }, [monthHeight]);\n\n useEffect(() => {\n if (prevSelectedDate !== selectedDate) {\n setPrevSelectedDate(selectedDate);\n }\n }, [prevSelectedDate, selectedDate]);\n\n useEffect(() => {\n setContent((prevState) => {\n // Initial render of months\n if (!prevState) {\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n }\n\n return items;\n }\n\n if (direction === 'left') {\n const date = getNewDate(-1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.unshift(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.pop();\n }\n\n if (direction === 'right') {\n const date = getNewDate(2, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.shift();\n }\n\n return prevState;\n });\n }, [\n categories,\n currentDate,\n direction,\n highlightedDates,\n locale,\n monthHeight,\n onSelect,\n prevSelectedDate,\n selectedDate,\n ]);\n\n useEffect(() => {\n if (selectedDate) {\n setContent((prevState) =>\n (prevState ?? []).map((element) => ({\n ...element,\n props: { ...element.props, selectedDate } as ReactElement,\n })),\n );\n }\n }, [selectedDate]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={monthHeight} $width={width}>\n <StyledMotionWrapper\n animate={animate}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrapper';\n\nexport default MonthWrapper;\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA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;UAAK,CAAC;QACtB,KAAK/B,SAAS,KAAK,OAAO;UACtB,OAAO;YAAE+B,CAAC,EAAE;UAAQ,CAAC;QACzB;UACI,OAAO;YAAEA,CAAC,EAAE;UAAQ,CAAC;MAC7B;IACJ;EACJ,CAAC,EAAE,CAAC/B,SAAS,EAAEE,eAAe,CAAC,CAAC;EAEhC,oBACIpC,MAAA,CAAAS,OAAA,CAAA8C,aAAA,CAACjD,aAAA,CAAA4D,kBAAkB;IAACC,OAAO,EAAExB,WAAY;IAACyB,MAAM,EAAE/B;EAAM,gBACpDrC,MAAA,CAAAS,OAAA,CAAA8C,aAAA,CAACjD,aAAA,CAAA+D,mBAAmB;IAChBL,OAAO,EAAEA,OAAQ;IACjBM,UAAU,EAAE;MACRC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAE,CAACtC,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACFuC,mBAAmB,EAAEtC;EAAoB,GAExCG,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDX,YAAY,CAAC+C,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnE,OAAA,GAE3BkB,YAAY","ignoreList":[]}
|
|
@@ -8,7 +8,9 @@ var _framerMotion = require("framer-motion");
|
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const StyledMonthWrapper = exports.StyledMonthWrapper = _styledComponents.default.div`
|
|
11
|
-
width:
|
|
11
|
+
width: ${({
|
|
12
|
+
$width
|
|
13
|
+
}) => $width}px;
|
|
12
14
|
overflow-x: clip;
|
|
13
15
|
height: ${({
|
|
14
16
|
$height
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","e","__esModule","default","StyledMonthWrapper","exports","styled","div","$height","StyledMotionWrapper","motion"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\ntype StyledMonthWrapperProps = WithTheme<{ $height: number }>;\n\nexport const StyledMonthWrapper = styled.div<StyledMonthWrapperProps>`\n width:
|
|
1
|
+
{"version":3,"file":"MonthWrapper.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","e","__esModule","default","StyledMonthWrapper","exports","styled","div","$width","$height","StyledMotionWrapper","motion"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\ntype StyledMonthWrapperProps = WithTheme<{ $height: number; $width: number }>;\n\nexport const StyledMonthWrapper = styled.div<StyledMonthWrapperProps>`\n width: ${({ $width }) => $width}px;\n overflow-x: clip;\n height: ${({ $height }) => $height}px;\n`;\n\nexport const StyledMotionWrapper = styled(motion.div)`\n display: flex;\n height: 100%;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAA4B;AACrE,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AACnC;AACA,cAAc,CAAC;EAAEC;AAAQ,CAAC,KAAKA,OAAO;AACtC,CAAC;AAEM,MAAMC,mBAAmB,GAAAL,OAAA,CAAAK,mBAAA,GAAG,IAAAJ,yBAAM,EAACK,oBAAM,CAACJ,GAAG,CAAC;AACrD;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
2
|
import { getMonthAndYear, getNewDate } from '../../../utils/calendar';
|
|
4
3
|
import Month from './month/Month';
|
|
5
4
|
import { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';
|
|
@@ -18,9 +17,7 @@ const MonthWrapper = _ref => {
|
|
|
18
17
|
} = _ref;
|
|
19
18
|
const [content, setContent] = useState();
|
|
20
19
|
const [prevSelectedDate, setPrevSelectedDate] = useState();
|
|
21
|
-
const
|
|
22
|
-
const monthWrapperSize = useElementSize(monthWrapperRef);
|
|
23
|
-
const monthHeight = useMemo(() => monthWrapperSize ? monthWrapperSize.width / (shouldRenderTwo ? 2 : 1) : 0, [monthWrapperSize, shouldRenderTwo]);
|
|
20
|
+
const monthHeight = useMemo(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);
|
|
24
21
|
useEffect(() => {
|
|
25
22
|
setContent(undefined);
|
|
26
23
|
}, [monthHeight]);
|
|
@@ -140,8 +137,8 @@ const MonthWrapper = _ref => {
|
|
|
140
137
|
}
|
|
141
138
|
}, [direction, shouldRenderTwo]);
|
|
142
139
|
return /*#__PURE__*/React.createElement(StyledMonthWrapper, {
|
|
143
|
-
$height:
|
|
144
|
-
|
|
140
|
+
$height: monthHeight,
|
|
141
|
+
$width: width
|
|
145
142
|
}, /*#__PURE__*/React.createElement(StyledMotionWrapper, {
|
|
146
143
|
animate: animate,
|
|
147
144
|
transition: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.js","names":["useElementSize","React","useEffect","useMemo","useRef","useState","getMonthAndYear","getNewDate","Month","StyledMonthWrapper","StyledMotionWrapper","MonthWrapper","_ref","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","content","setContent","prevSelectedDate","setPrevSelectedDate","monthWrapperRef","monthWrapperSize","monthHeight","undefined","prevState","items","i","date","month","year","push","createElement","height","key","unshift","pop","shift","map","element","props","animate","x","$height","ref","transition","type","duration","onAnimationComplete","displayName"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import { useElementSize } from '@chayns-components/core';\nimport type { Locale } from 'date-fns';\nimport type { MotionProps } from 'framer-motion';\nimport React, { FC, useEffect, useMemo, useRef, useState, type ReactElement } from 'react';\nimport type { Categories, HighlightedDates } from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Locale;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n const [prevSelectedDate, setPrevSelectedDate] = useState<Date>();\n\n const monthWrapperRef = useRef<HTMLDivElement>(null);\n\n const monthWrapperSize = useElementSize(monthWrapperRef);\n\n const monthHeight = useMemo(\n () => (monthWrapperSize ? monthWrapperSize.width / (shouldRenderTwo ? 2 : 1) : 0),\n [monthWrapperSize, shouldRenderTwo],\n );\n\n useEffect(() => {\n setContent(undefined);\n }, [monthHeight]);\n\n useEffect(() => {\n if (prevSelectedDate !== selectedDate) {\n setPrevSelectedDate(selectedDate);\n }\n }, [prevSelectedDate, selectedDate]);\n\n useEffect(() => {\n setContent((prevState) => {\n // Initial render of months\n if (!prevState) {\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n }\n\n return items;\n }\n\n if (direction === 'left') {\n const date = getNewDate(-1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.unshift(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.pop();\n }\n\n if (direction === 'right') {\n const date = getNewDate(2, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.shift();\n }\n\n return prevState;\n });\n }, [\n categories,\n currentDate,\n direction,\n highlightedDates,\n locale,\n monthHeight,\n onSelect,\n prevSelectedDate,\n selectedDate,\n ]);\n\n useEffect(() => {\n if (selectedDate) {\n setContent((prevState) =>\n (prevState ?? []).map((element) => ({\n ...element,\n props: { ...element.props, selectedDate } as ReactElement,\n })),\n );\n }\n }, [selectedDate]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={shouldRenderTwo ? width / 2 : width} ref={monthWrapperRef}>\n <StyledMotionWrapper\n animate={animate}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrapper';\n\nexport default MonthWrapper;\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AAGxD,OAAOC,KAAK,IAAQC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAA2B,OAAO;AAE1F,SAASC,eAAe,EAAEC,UAAU,QAAQ,yBAAyB;AACrE,OAAOC,KAAK,MAAM,eAAe;AACjC,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,uBAAuB;AAe/E,MAAMC,YAAmC,GAAGC,IAAA,IAWtC;EAAA,IAXuC;IACzCC,MAAM;IACNC,WAAW;IACXC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,UAAU;IACVC,SAAS;IACTC,mBAAmB;IACnBC,eAAe;IACfC;EACJ,CAAC,GAAAV,IAAA;EACG,MAAM,CAACW,OAAO,EAAEC,UAAU,CAAC,GAAGnB,QAAQ,CAAiB,CAAC;EACxD,MAAM,CAACoB,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGrB,QAAQ,CAAO,CAAC;EAEhE,MAAMsB,eAAe,GAAGvB,MAAM,CAAiB,IAAI,CAAC;EAEpD,MAAMwB,gBAAgB,GAAG5B,cAAc,CAAC2B,eAAe,CAAC;EAExD,MAAME,WAAW,GAAG1B,OAAO,CACvB,MAAOyB,gBAAgB,GAAGA,gBAAgB,CAACN,KAAK,IAAID,eAAe,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAE,EACjF,CAACO,gBAAgB,EAAEP,eAAe,CACtC,CAAC;EAEDnB,SAAS,CAAC,MAAM;IACZsB,UAAU,CAACM,SAAS,CAAC;EACzB,CAAC,EAAE,CAACD,WAAW,CAAC,CAAC;EAEjB3B,SAAS,CAAC,MAAM;IACZ,IAAIuB,gBAAgB,KAAKT,YAAY,EAAE;MACnCU,mBAAmB,CAAC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CAACA,YAAY,CAAC,CAAC;EAElB,MAAM+B,OAA+B,GAAG5C,OAAO,CAAC,MAAM;IAClD,IAAIkB,eAAe,EAAE;MACjB,QAAQ,IAAI;QACR,KAAKF,SAAS,KAAK,MAAM;UACrB,OAAO;YAAE6B,CAAC,EAAE;UAAK,CAAC;QACtB,KAAK7B,SAAS,KAAK,OAAO;UACtB,OAAO;YAAE6B,CAAC,EAAE;UAAQ,CAAC;QACzB;UACI,OAAO;YAAEA,CAAC,EAAE;UAAO,CAAC;MAC5B;IACJ,CAAC,MAAM;MACH,QAAQ,IAAI;QACR,KAAK7B,SAAS,KAAK,MAAM;UACrB,OAAO;YAAE6B,CAAC,EAAE;UAAK,CAAC;QACtB,KAAK7B,SAAS,KAAK,OAAO;UACtB,OAAO;YAAE6B,CAAC,EAAE;UAAQ,CAAC;QACzB;UACI,OAAO;YAAEA,CAAC,EAAE;UAAQ,CAAC;MAC7B;IACJ;EACJ,CAAC,EAAE,CAAC7B,SAAS,EAAEE,eAAe,CAAC,CAAC;EAEhC,oBACIpB,KAAA,CAAAqC,aAAA,CAAC7B,kBAAkB;IAACwC,OAAO,EAAE5B,eAAe,GAAGC,KAAK,GAAG,CAAC,GAAGA,KAAM;IAAC4B,GAAG,EAAEvB;EAAgB,gBACnF1B,KAAA,CAAAqC,aAAA,CAAC5B,mBAAmB;IAChBqC,OAAO,EAAEA,OAAQ;IACjBI,UAAU,EAAE;MACRC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAE,CAAClC,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACFmC,mBAAmB,EAAElC;EAAoB,GAExCG,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDZ,YAAY,CAAC4C,WAAW,GAAG,cAAc;AAEzC,eAAe5C,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MonthWrapper.js","names":["React","useEffect","useMemo","useState","getMonthAndYear","getNewDate","Month","StyledMonthWrapper","StyledMotionWrapper","MonthWrapper","_ref","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","content","setContent","prevSelectedDate","setPrevSelectedDate","monthHeight","undefined","prevState","items","i","date","month","year","push","createElement","height","key","unshift","pop","shift","map","element","props","animate","x","$height","$width","transition","type","duration","onAnimationComplete","displayName"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import type { Locale } from 'date-fns';\nimport type { MotionProps } from 'framer-motion';\nimport React, { FC, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport type { Categories, HighlightedDates } from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Locale;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n const [prevSelectedDate, setPrevSelectedDate] = useState<Date>();\n\n const monthHeight = useMemo(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);\n\n useEffect(() => {\n setContent(undefined);\n }, [monthHeight]);\n\n useEffect(() => {\n if (prevSelectedDate !== selectedDate) {\n setPrevSelectedDate(selectedDate);\n }\n }, [prevSelectedDate, selectedDate]);\n\n useEffect(() => {\n setContent((prevState) => {\n // Initial render of months\n if (!prevState) {\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n }\n\n return items;\n }\n\n if (direction === 'left') {\n const date = getNewDate(-1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.unshift(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.pop();\n }\n\n if (direction === 'right') {\n const date = getNewDate(2, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.shift();\n }\n\n return prevState;\n });\n }, [\n categories,\n currentDate,\n direction,\n highlightedDates,\n locale,\n monthHeight,\n onSelect,\n prevSelectedDate,\n selectedDate,\n ]);\n\n useEffect(() => {\n if (selectedDate) {\n setContent((prevState) =>\n (prevState ?? []).map((element) => ({\n ...element,\n props: { ...element.props, selectedDate } as ReactElement,\n })),\n );\n }\n }, [selectedDate]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={monthHeight} $width={width}>\n <StyledMotionWrapper\n animate={animate}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWr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,EAAE;UAAO,CAAC;MAC5B;IACJ,CAAC,MAAM;MACH,QAAQ,IAAI;QACR,KAAK3B,SAAS,KAAK,MAAM;UACrB,OAAO;YAAE2B,CAAC,EAAE;UAAK,CAAC;QACtB,KAAK3B,SAAS,KAAK,OAAO;UACtB,OAAO;YAAE2B,CAAC,EAAE;UAAQ,CAAC;QACzB;UACI,OAAO;YAAEA,CAAC,EAAE;UAAQ,CAAC;MAC7B;IACJ;EACJ,CAAC,EAAE,CAAC3B,SAAS,EAAEE,eAAe,CAAC,CAAC;EAEhC,oBACInB,KAAA,CAAAkC,aAAA,CAAC3B,kBAAkB;IAACsC,OAAO,EAAEpB,WAAY;IAACqB,MAAM,EAAE1B;EAAM,gBACpDpB,KAAA,CAAAkC,aAAA,CAAC1B,mBAAmB;IAChBmC,OAAO,EAAEA,OAAQ;IACjBI,UAAU,EAAE;MACRC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAE,CAAChC,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACFiC,mBAAmB,EAAEhC;EAAoB,GAExCG,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDZ,YAAY,CAAC0C,WAAW,GAAG,cAAc;AAEzC,eAAe1C,YAAY","ignoreList":[]}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { motion } from 'framer-motion';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
export const StyledMonthWrapper = styled.div`
|
|
4
|
-
width:
|
|
4
|
+
width: ${_ref => {
|
|
5
|
+
let {
|
|
6
|
+
$width
|
|
7
|
+
} = _ref;
|
|
8
|
+
return $width;
|
|
9
|
+
}}px;
|
|
5
10
|
overflow-x: clip;
|
|
6
|
-
height: ${
|
|
11
|
+
height: ${_ref2 => {
|
|
7
12
|
let {
|
|
8
13
|
$height
|
|
9
|
-
} =
|
|
14
|
+
} = _ref2;
|
|
10
15
|
return $height;
|
|
11
16
|
}}px;
|
|
12
17
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.styles.js","names":["motion","styled","StyledMonthWrapper","div","_ref","$height","StyledMotionWrapper"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\ntype StyledMonthWrapperProps = WithTheme<{ $height: number }>;\n\nexport const StyledMonthWrapper = styled.div<StyledMonthWrapperProps>`\n width:
|
|
1
|
+
{"version":3,"file":"MonthWrapper.styles.js","names":["motion","styled","StyledMonthWrapper","div","_ref","$width","_ref2","$height","StyledMotionWrapper"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\ntype StyledMonthWrapperProps = WithTheme<{ $height: number; $width: number }>;\n\nexport const StyledMonthWrapper = styled.div<StyledMonthWrapperProps>`\n width: ${({ $width }) => $width}px;\n overflow-x: clip;\n height: ${({ $height }) => $height}px;\n`;\n\nexport const StyledMotionWrapper = styled(motion.div)`\n display: flex;\n height: 100%;\n`;\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,eAAe;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,kBAAkB,GAAGD,MAAM,CAACE,GAA4B;AACrE,aAAaC,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAKC,MAAM;AAAA;AACnC;AACA,cAAcC,KAAA;EAAA,IAAC;IAAEC;EAAQ,CAAC,GAAAD,KAAA;EAAA,OAAKC,OAAO;AAAA;AACtC,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAGP,MAAM,CAACD,MAAM,CAACG,GAAG,CAAC;AACrD;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { WithTheme } from '@chayns-components/core';
|
|
4
4
|
type StyledMonthWrapperProps = WithTheme<{
|
|
5
5
|
$height: number;
|
|
6
|
+
$width: number;
|
|
6
7
|
}>;
|
|
7
8
|
export declare const StyledMonthWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledMonthWrapperProps>> & string;
|
|
8
9
|
export declare const StyledMotionWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/date",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.665",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typescript": "^5.4.5"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@chayns-components/core": "^5.0.0-beta.
|
|
70
|
+
"@chayns-components/core": "^5.0.0-beta.665",
|
|
71
71
|
"date-fns": "^2.30.0",
|
|
72
72
|
"uuid": "^9.0.1"
|
|
73
73
|
},
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "b569f93e6647f42356ae1a71beb681c67b647945"
|
|
85
85
|
}
|