@dotss/ui 0.0.10 → 0.0.12
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/Accordion/Accordion.cjs +13 -7
- package/Accordion/Accordion.d.ts +2 -0
- package/Accordion/Accordion.es.js +86 -65
- package/Autocomplete/Autocomplete.cjs +1 -1
- package/Autocomplete/Autocomplete.d.ts +1 -1
- package/Autocomplete/Autocomplete.es.js +235 -80
- package/BottomSheet/BottomSheet.cjs +5 -5
- package/BottomSheet/BottomSheet.d.ts +3 -0
- package/BottomSheet/BottomSheet.es.js +88 -70
- package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
- package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
- package/Button/Button.cjs +6 -6
- package/Button/Button.es.js +35 -29
- package/ChainPicker/ChainPicker.cjs +16 -6
- package/ChainPicker/ChainPicker.d.ts +4 -2
- package/ChainPicker/ChainPicker.es.js +155 -110
- package/ChainPicker/ChainPicker.stories.d.ts +1 -1
- package/Checkbox/Checkbox.cjs +3 -3
- package/Checkbox/Checkbox.es.js +12 -10
- package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
- package/CircularProgressIndicator/CircularProgressIndicator.es.js +25 -22
- package/DatePicker/DatePicker.cjs +37 -20
- package/DatePicker/DatePicker.d.ts +2 -1
- package/DatePicker/DatePicker.es.js +345 -320
- package/DatePicker/DatePicker.stories.d.ts +1 -0
- package/DatePicker/EventDot/EventDot.cjs +8 -0
- package/DatePicker/EventDot/EventDot.d.ts +8 -0
- package/DatePicker/EventDot/EventDot.es.js +19 -0
- package/DatePicker/EventDot/index.cjs +1 -0
- package/DatePicker/EventDot/index.d.ts +3 -0
- package/DatePicker/EventDot/index.es.js +4 -0
- package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
- package/DatePicker/EventDotGroup/index.cjs +1 -0
- package/DatePicker/EventDotGroup/index.d.ts +3 -0
- package/DatePicker/EventDotGroup/index.es.js +4 -0
- package/DatePicker/index.cjs +1 -1
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.es.js +6 -2
- package/Dialog/Dialog.cjs +2 -2
- package/Dialog/Dialog.d.ts +2 -0
- package/Dialog/Dialog.es.js +45 -40
- package/Dialog/Dialog.stories.d.ts +10 -0
- package/Dialog/DialogText/DialogText.cjs +1 -1
- package/Dialog/DialogText/DialogText.es.js +1 -1
- package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
- package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
- package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
- package/FocusBoundary/FocusBoundary.cjs +1 -1
- package/FocusBoundary/FocusBoundary.d.ts +3 -1
- package/FocusBoundary/FocusBoundary.es.js +49 -42
- package/FormControlText/FormControlText.cjs +7 -5
- package/FormControlText/FormControlText.d.ts +2 -0
- package/FormControlText/FormControlText.es.js +50 -40
- package/Icon/Icon.cjs +1 -1
- package/Icon/Icon.es.js +1 -1
- package/IconButton/IconButton.cjs +8 -8
- package/IconButton/IconButton.es.js +32 -25
- package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
- package/LineProgressIndicator/LineProgressIndicator.es.js +34 -22
- package/Menu/Menu.cjs +16 -16
- package/Menu/Menu.d.ts +3 -2
- package/Menu/Menu.es.js +115 -81
- package/Menu/Menu.stories.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.cjs +14 -7
- package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.es.js +47 -35
- package/Menu/MenuButton/MenuButton.cjs +1 -0
- package/Menu/MenuButton/MenuButton.d.ts +10 -0
- package/Menu/MenuButton/MenuButton.es.js +44 -0
- package/Menu/MenuButton/index.cjs +1 -0
- package/Menu/MenuButton/index.d.ts +3 -0
- package/Menu/MenuButton/index.es.js +4 -0
- package/Menu/index.cjs +1 -1
- package/Menu/index.d.ts +1 -0
- package/Menu/index.es.js +4 -2
- package/NumberKeypad/NumberKeypad.cjs +2 -2
- package/NumberKeypad/NumberKeypad.es.js +18 -16
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
- package/PageControl/PageControl.cjs +16 -5
- package/PageControl/PageControl.d.ts +3 -0
- package/PageControl/PageControl.es.js +77 -24
- package/PageControl/PageControl.stories.d.ts +1 -0
- package/Radio/Radio.cjs +3 -3
- package/Radio/Radio.es.js +22 -20
- package/RadioGroup/RadioGroup.cjs +1 -0
- package/RadioGroup/RadioGroup.d.ts +8 -0
- package/RadioGroup/RadioGroup.es.js +28 -0
- package/RadioGroup/RadioGroup.stories.d.ts +14 -0
- package/RadioGroup/index.cjs +1 -0
- package/RadioGroup/index.d.ts +3 -0
- package/RadioGroup/index.es.js +4 -0
- package/SegmentedButton/SegmentedButton.cjs +14 -3
- package/SegmentedButton/SegmentedButton.es.js +108 -34
- package/Select/Select.cjs +4 -4
- package/Select/Select.es.js +95 -86
- package/Slider/Slider.cjs +27 -12
- package/Slider/Slider.d.ts +1 -0
- package/Slider/Slider.es.js +177 -90
- package/Switch/Switch.cjs +28 -11
- package/Switch/Switch.d.ts +2 -0
- package/Switch/Switch.es.js +185 -65
- package/Switch/Switch.stories.d.ts +1 -0
- package/Tab/Tab.es.js +2 -4
- package/TextArea/TextArea.cjs +42 -34
- package/TextArea/TextArea.es.js +116 -82
- package/TextArea/TextArea.stories.d.ts +1 -1
- package/TextField/TextField.cjs +29 -13
- package/TextField/TextField.d.ts +2 -1
- package/TextField/TextField.es.js +122 -79
- package/TextField/TextField.stories.d.ts +1 -0
- package/Tooltip/Tooltip.cjs +7 -6
- package/Tooltip/Tooltip.d.ts +8 -3
- package/Tooltip/Tooltip.es.js +248 -146
- package/Tooltip/Tooltip.stories.d.ts +1 -0
- package/hooks/index.cjs +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.es.js +7 -1
- package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
- package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
- package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
- package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
- package/index.cjs +1 -1
- package/index.d.ts +2 -1
- package/index.es.js +97 -90
- package/package.json +3 -3
- package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
- package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
- package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
- package/resources/tictoccroc/icons/line/index.d.ts +4 -0
- package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
- package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
- package/utils/getIconLabel/getIconLabel.cjs +1 -1
- package/utils/getIconLabel/getIconLabel.es.js +8 -1
- package/utils/getSibling/getSibling.es.js +1 -2
- package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
- package/resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@emotion/react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@emotion/react/jsx-runtime"),d=require("react"),st=require("../IconButton/IconButton.cjs"),Ct=require("../Menu/Menu.cjs"),Jt=require("../Menu/MenuBlock/MenuBlock.cjs");require("../Menu/MenuButton/MenuButton.cjs");const Pt=require("../core/useTheme.cjs"),Qt=require("@emotion/styled"),J=require("../utils/getContrastingTextColor/getContrastingTextColor.cjs"),Zt=t=>t&&t.__esModule?t:{default:t},S=Zt(Qt),te=S.default.div`
|
|
2
|
+
position: relative;
|
|
2
3
|
display: flex;
|
|
3
4
|
flex-direction: column;
|
|
4
5
|
gap: ${({theme:{spacing:t}})=>t.content(2)}px;
|
|
5
|
-
`,
|
|
6
|
+
`,ee=S.default.div`
|
|
6
7
|
display: inline-flex;
|
|
7
8
|
align-items: center;
|
|
8
9
|
justify-content: flex-start;
|
|
@@ -11,63 +12,79 @@
|
|
|
11
12
|
cursor: ${({clickable:t})=>t?"pointer":"default"};
|
|
12
13
|
|
|
13
14
|
${({theme:{typography:{h4B:t}}})=>({fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing})};
|
|
14
|
-
`,
|
|
15
|
+
`,ne=S.default.div`
|
|
15
16
|
display: flex;
|
|
16
17
|
align-items: center;
|
|
17
18
|
justify-content: center;
|
|
18
19
|
gap: ${({theme:{spacing:t}})=>t.content(4)}px;
|
|
19
20
|
|
|
20
21
|
${({theme:{typography:{h2B:t}}})=>({fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing})};
|
|
21
|
-
`,
|
|
22
|
+
`,re=S.default.div`
|
|
22
23
|
display: flex;
|
|
23
24
|
align-items: center;
|
|
24
|
-
padding: 0 ${({theme:{spacing:t},edgeSpacing:
|
|
25
|
+
padding: 0 ${({theme:{spacing:t},edgeSpacing:n})=>t.content(n||0)}px;
|
|
25
26
|
|
|
26
27
|
& > span {
|
|
27
28
|
margin: 5px 0;
|
|
28
29
|
flex-grow: 1;
|
|
29
30
|
text-align: center;
|
|
30
|
-
${({theme:{palette:{grey:t},typography:{b4M:
|
|
31
|
+
${({theme:{palette:{grey:t},typography:{b4M:n}}})=>({fontSize:n.size,fontWeight:n.weight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,color:t[50]})};
|
|
31
32
|
}
|
|
32
|
-
`,
|
|
33
|
+
`,se=S.default.div`
|
|
33
34
|
overflow: hidden;
|
|
34
|
-
`,
|
|
35
|
+
`,ie=S.default.div`
|
|
35
36
|
display: flex;
|
|
36
37
|
transform: translate3d(0, 0, 0);
|
|
37
|
-
`,
|
|
38
|
+
`,bt=S.default.div`
|
|
38
39
|
display: flex;
|
|
39
40
|
flex-direction: column;
|
|
40
41
|
min-width: 100%;
|
|
41
42
|
gap: ${({theme:{spacing:t}})=>t.content(2)}px;
|
|
42
43
|
padding: ${({theme:{spacing:t}})=>t.content(2)}px
|
|
43
|
-
${({theme:{spacing:t},edgeSpacing:
|
|
44
|
-
`,
|
|
44
|
+
${({theme:{spacing:t},edgeSpacing:n})=>t.content(n||0)}px;
|
|
45
|
+
`,zt=S.default.div`
|
|
45
46
|
display: flex;
|
|
46
47
|
width: 100%;
|
|
47
|
-
`,
|
|
48
|
+
`,It=S.default.div`
|
|
48
49
|
position: relative;
|
|
49
50
|
display: inline-flex;
|
|
50
51
|
align-items: center;
|
|
51
52
|
justify-content: center;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: ${({theme:{spacing:t}})=>t.content(1)}px;
|
|
52
55
|
flex: 1;
|
|
53
|
-
min-width: 30px;
|
|
54
|
-
min-height: 30px;
|
|
55
|
-
max-height: 30px;
|
|
56
56
|
cursor: ${({disabled:t})=>t?"not-allowed":"pointer"};
|
|
57
57
|
pointer-events: ${({disabled:t})=>t?"none":"auto"};
|
|
58
|
-
|
|
58
|
+
min-width: 30px;
|
|
59
|
+
|
|
60
|
+
& > div:nth-of-type(1) {
|
|
61
|
+
position: relative;
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
width: 100%;
|
|
66
|
+
min-height: 30px;
|
|
59
67
|
z-index: 1;
|
|
68
|
+
|
|
69
|
+
& > span {
|
|
70
|
+
z-index: 2;
|
|
71
|
+
}
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
${({theme:{typography:{b2R:t}}})=>({fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing})};
|
|
63
75
|
|
|
64
|
-
${({theme:{palette:{brand:t,grey:
|
|
76
|
+
${({theme:{palette:{brand:t,grey:n}},variant:r,today:s,selected:o,disabled:u})=>{if(o){let i={fontWeight:700,color:J.default(t.primary.main,[n.white,n[100]]),"& > div:nth-of-type(1):before":{content:'""',position:"absolute",top:"50%",left:"50%",width:30,height:30,transform:"translate(-50%, -50%)",backgroundColor:u?t.primary.disable:t.primary.main,borderRadius:"50%"}};return r==="start"&&(i={fontWeight:700,color:J.default(t.primary.main,[n.white,n[100]]),overflow:"hidden","& > div:nth-of-type(1):before":{content:'""',position:"absolute",top:"50%",left:"50%",width:30,height:30,transform:"translate(-50%, -50%)",backgroundColor:u?t.primary.disable:t.primary.main,borderTopLeftRadius:100,borderBottomLeftRadius:100},"& > div:nth-of-type(1):after":{content:'""',position:"absolute",top:"50%",left:30,width:"100%",height:30,transform:"translateY(-50%)",backgroundColor:u?t.primary.disable:t.primary.main}}),r==="end"&&(i={fontWeight:700,color:J.default(t.primary.main,[n.white,n[100]]),overflow:"hidden","& > div:nth-of-type(1):before":{content:'""',position:"absolute",top:"50%",left:"50%",width:30,height:30,transform:"translate(-50%, -50%)",backgroundColor:u?t.primary.disable:t.primary.main,borderTopRightRadius:100,borderBottomRightRadius:100},"& > div:nth-of-type(1):after":{content:'""',position:"absolute",top:"50%",right:"50%",width:"100%",height:30,transform:"translateY(-50%)",backgroundColor:u?t.primary.disable:t.primary.main}}),r==="middle"&&(i={fontWeight:700,color:J.default(t.primary.main,[n.white,n[100]]),overflow:"hidden","& > div:nth-of-type(1):after":{content:'""',position:"absolute",top:"50%",left:"50%",width:"calc(100% + 1px)",height:30,transform:"translate(-50%, -50%)",backgroundColor:u?t.primary.disable:t.primary.main}}),i}return s?{"& > div:nth-of-type(1):after":{content:'""',position:"absolute",top:"50%",left:"50%",width:30,height:30,transform:"translate(-50%, -50%)",border:`1px solid ${t.primary.main}`,borderRadius:"50%"}}:null}};
|
|
65
77
|
|
|
66
|
-
${({theme:{palette:{grey:t,pink:
|
|
67
|
-
`,
|
|
78
|
+
${({theme:{palette:{grey:t,pink:n,brand:r}},holiday:s,disabled:o,selected:u})=>{let i=null;return s&&(i={color:J.default(u?r.primary.main:"transparent",[n[30],n[100]])}),o&&(i={color:t[30]}),o&&s&&(i={color:n[30]}),i}}
|
|
79
|
+
`,oe=S.default.div`
|
|
68
80
|
display: flex;
|
|
69
81
|
align-items: center;
|
|
70
82
|
justify-content: center;
|
|
71
83
|
|
|
72
84
|
cursor: ${({clickable:t})=>t?"pointer":"default"};
|
|
73
|
-
`,
|
|
85
|
+
`,Lt=S.default.span`
|
|
86
|
+
width: 100%;
|
|
87
|
+
min-width: 100%;
|
|
88
|
+
height: 6px;
|
|
89
|
+
min-height: 6px;
|
|
90
|
+
`,ce=30,ae=d.forwardRef(function({children:n,onChange:r,value:s,date:o,minDate:u,maxDate:i,holidayDates:p,disableDates:N,showWeekHead:it=!1,multiple:j=!1,period:P=!1,enableMonthSelect:W=!1,showToday:wt=!1,edgeSpacing:ot=0,renderEvent:H,inlineCSS:_t,...qt},Ot){const{spacing:St}=Pt.default(),[Y,ct]=d.useState((typeof o=="string"||typeof o=="number"?new Date(o):o)||new Date),[D,G]=d.useState(()=>Array.isArray(s)&&s.length>0?x(s[0]):x(s)),[b,Q]=d.useState(()=>Array.isArray(s)&&s.length>1?x(s[s.length-1]):null),[M,Mt]=d.useState(0),[w,F]=d.useState(1),[jt,Tt]=d.useState(!1),[at,At]=d.useState(!1),lt=d.useRef(null),m=d.useRef(null),Z=d.useRef(0),v=d.useRef(0),T=d.useRef(!1),K=d.useRef(w),ut=d.useRef(),ft=d.useRef(null),dt=d.useRef(null),k=Y.getFullYear(),tt=Y.getMonth(),Rt=xt(k,tt),U=L(tt),_=x(s),q=x(p),O=x(N),ht=X(Y,u)||Yt(Y,u),pt=I(Y,i)||Yt(Y,i),et=new Date(k,tt-1),nt=new Date(k,tt+1),V=`${k}. ${U}`,E=P&&!!D&&!!b,vt=[{year:et.getFullYear(),month:L(et.getMonth()),weeks:xt(et.getFullYear(),et.getMonth())},{year:k,month:U,weeks:Rt},{year:nt.getFullYear(),month:L(nt.getMonth()),weeks:xt(nt.getFullYear(),nt.getMonth())}],mt=typeof H=="function",Et=vt[1].weeks.length*(ce+(mt?10:0)+St.content(2))+St.content(2),kt=e=>()=>{j&&(m.current&&(m.current.style.transition="none",m.current.style.cursor="grabbing"),Z.current=e,T.current=!0)},z=d.useCallback(()=>{if(!T.current)return;const e=M-v.current,f=Math.abs(M-e),l=M*.1;m.current&&(m.current.style.transform=`translate3d(-${M*w}px, 0, 0)`,m.current.style.cursor="grab",m.current.style.transition="transform 0.2s"),Z.current=0,v.current=0,T.current=!1,!(f<=l)&&(M<e?F(y=>y+1):M>e&&F(y=>y-1))},[M,w]),Wt=e=>()=>{if(!(T.current||w!==1)){if(!P){r==null||r(e,x);return}if(R(e,D)&&Array.isArray(s)&&s.length===1){G(null),Q(null),r==null||r([],x);return}else if(R(e,D)&&!Array.isArray(s)&&R(e,s)){G(null),Q(null),r==null||r([],x);return}if(!D){G(e),r==null||r(e,x);return}if(!b&&D){const[f,l]=I(e,D)?[D,e]:[e,D];G(f),Q(l);const y=Ft([f,l],N);r==null||r(y,x);return}D&&b&&(G(e),Q(null),r==null||r(e,x))}},Xt=e=>kt(e.clientX)(),Bt=e=>kt(e.touches[0].clientX)(),Nt=()=>{jt||(m.current&&(m.current.style.transition="transform 0.2s"),F(e=>e-1))},Gt=()=>{jt||(m.current&&(m.current.style.transition="transform 0.2s"),F(e=>e+1))},yt=()=>At(e=>!e),Kt=e=>{if(!e)return;const[f,l]=e.toString().split(".").map(Number);ct(new Date(f,l-1)),At(!1)};return d.useLayoutEffect(()=>{var e;Mt(((e=lt.current)==null?void 0:e.clientWidth)||0)},[j]),d.useEffect(()=>{const e=()=>{var f;Mt(((f=lt.current)==null?void 0:f.clientWidth)||0)};return window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}},[j]),d.useEffect(()=>{const e=m.current,f=(a,g,$)=>{if(!e||!T.current)return;v.current=a-Z.current;const h=g-Z.current,A=5;if(T.current=T.current||Math.abs(v.current)>A&&Math.abs(h)<A*2,$.cancelable&&$.preventDefault(),T.current){if(ht&&v.current>0){z();return}if(pt&&v.current<0){z();return}Math.abs(v.current)>=10&&(e.style.transform=`translate3d(${v.current-M*w}px, 0, 0)`,e.style.cursor="grabbing")}},l=a=>f(a.touches[0].clientX,a.touches[0].clientY,a),y=a=>{T.current&&f(a.clientX,a.clientY,a)};return e==null||e.addEventListener("mousemove",y),e==null||e.addEventListener("touchmove",l),()=>{e==null||e.removeEventListener("mousemove",y),e==null||e.removeEventListener("touchmove",l)}},[M,w,z,pt,ht]),d.useEffect(()=>{Tt(!0),ut.current=setTimeout(()=>{m.current&&(m.current.style.transition="none"),w>K.current?(F(1),ct(e=>new Date(e.setMonth(e.getMonth()+1))),K.current=1):w<K.current?(ct(e=>new Date(e.setMonth(e.getMonth()-1))),F(1),K.current=1):K.current=w,Tt(!1)},200)},[w]),d.useLayoutEffect(()=>{if(!P||!Array.isArray(s))return;const e=Ft(s,N);s.length<e.length&&(r==null||r(e,x))},[P,s,r,N]),d.useEffect(()=>{let e;return at&&(e=setTimeout(()=>{if(dt.current){const f=dt.current.querySelector("ul"),l=f==null?void 0:f.querySelector(`[data-value="${V}"]`);l==null||l.scrollIntoView({block:"start"})}},200)),()=>{clearTimeout(e)}},[at,V]),d.useEffect(()=>()=>{ut.current&&clearTimeout(ut.current)},[]),c.jsxs(te,{ref:Ot,...qt,css:_t,children:[j?c.jsxs(ne,{children:[c.jsx(st.default,{name:"ChevronLeftLine",size:"small",onClick:Nt,disabled:ht}),c.jsxs(oe,{ref:ft,clickable:!!W,onClick:W?yt:void 0,children:[V,W&&c.jsx(st.default,{name:"ArrowDownFill",size:"xSmall"})]}),c.jsx(st.default,{name:"ChevronRightLine",size:"small",onClick:Gt,disabled:pt})]}):c.jsxs(ee,{ref:ft,clickable:!!W,onClick:W?yt:void 0,children:[V,W&&c.jsx(st.default,{name:"ArrowDownFill",size:"xSmall"})]}),W&&c.jsx(Ct.default,{anchorRef:ft,ref:dt,open:at,onClose:yt,onChange:Kt,value:V,placement:j?"bottom-center":"bottom-left",width:160,fitToAnchorWidth:!1,maxHeight:368,children:Array.from({length:130},(e,f)=>{const l=1970+f;return Array.from({length:12},(y,a)=>{const g=a+1,$=g<10?`0${g}`:g,h=new Date(l,a+1,0).getDate(),A=`${l}-${$}-${h}`,C=`${l}-${$}-01`;return X(A,u)||I(C,i)?null:c.jsx(Jt.default,{value:`${l}. ${$}`,children:`${l}. ${$}`},`${l}-${$}`)})})}),it&&c.jsxs(re,{edgeSpacing:ot,children:[c.jsx("span",{children:"일"}),c.jsx("span",{children:"월"}),c.jsx("span",{children:"화"}),c.jsx("span",{children:"수"}),c.jsx("span",{children:"목"}),c.jsx("span",{children:"금"}),c.jsx("span",{children:"토"})]}),c.jsx(se,{ref:lt,children:c.jsxs(ie,{ref:m,onMouseDown:Xt,onMouseUp:z,onMouseLeave:z,onTouchStart:Bt,onTouchEnd:z,onTouchCancel:z,style:{transform:j?`translate3d(-${M*w}px, 0, 0)`:void 0,cursor:j?"grab":void 0,maxHeight:Et},children:[j&&vt.map(({year:e,month:f,weeks:l})=>c.jsx(bt,{edgeSpacing:ot,children:l.map((y,a)=>c.jsx(zt,{children:y.map((g,$)=>{const h=`${e}-${f}-${B(g||0)}`,A=!g,C=R(h,new Date),gt=Array.isArray(q)?q.includes(h):q===h,Dt=Array.isArray(_)?_.includes(h):_===h,$t=!g||(Array.isArray(O)?O.includes(h):O===h)||I(h,i)||X(h,u),rt=E&&R(h,D),Ut=E&&R(h,b),Vt=E&&I(h,D)&&X(h,b),Ht=H==null?void 0:H(h);return c.jsxs(It,{variant:rt?"start":Ut?"end":Vt?"middle":void 0,onClick:Wt(h),today:wt&&C,holiday:gt,selected:Dt,disabled:$t,children:[c.jsx("div",{children:c.jsx("span",{children:g})}),!A&&Ht,!A&&mt&&!Ht&&c.jsx(Lt,{})]},`${e}-${f}-week-row-${$}-${g?h:`${a}-${$}`}`)})},`${e}-${f}-week-row-${String(y)}`))},`week-body-${e}-${f}`)),!j&&c.jsx(bt,{edgeSpacing:ot,children:Rt.map((e,f)=>c.jsx(zt,{children:e.map((l,y)=>{const a=`${k}-${U}-${B(l||0)}`,g=!l,$=R(a,new Date),h=Array.isArray(q)?q.includes(a):q===a,A=Array.isArray(_)?_.includes(a):_===a,C=!l||(Array.isArray(O)?O.includes(a):O===a)||I(a,i)||X(a,u),gt=E&&R(a,D),Dt=E&&R(a,b),$t=E&&I(a,D)&&X(a,b),rt=H==null?void 0:H(a);return c.jsxs(It,{variant:gt?"start":Dt?"end":$t?"middle":void 0,onClick:Wt(a),today:wt&&$,holiday:h,selected:A,disabled:C,children:[c.jsx("div",{children:c.jsx("span",{children:l})}),!g&&rt,!g&&mt&&!rt&&c.jsx(Lt,{})]},`${k}-${U}-week-row-${e}-${l?a:`${f}-${y}`}`)})},`${k}-${U}-week-row-${String(e)}`))})]})}),n]})});function xt(t,n){let r=[];const s=new Date(t,n,1),o=new Date(t,n+1,0).getDate(),u=s.getDay();let i=Array.from({length:u}).fill(null);for(let p=1;p<=o;p+=1)i.push(p),(i.length===7||p===o)&&(r.push(i),i=[]);return r=r.map(p=>Array.from({length:7}).map((N,it)=>p[it]||null)),r}function L(t){return String(t+1).length===1?`0${t+1}`:t+1}function B(t){return String(t).length===1?`0${t}`:t}function x(t){if(Array.isArray(t))return t.map(n=>n instanceof Date?`${n.getFullYear()}-${L(n.getMonth())}-${B(n.getDate())}`:n);if(t instanceof Date)return`${t.getFullYear()}-${L(t.getMonth())}-${B(t.getDate())}`;if(typeof t=="number"){const n=new Date(t);return`${n.getFullYear()}-${L(n.getMonth())}-${B(n.getDate())}`}return t}function I(t,n){if(!t||!n)return!1;const r=t instanceof Date?t:new Date(t);r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0);const s=r.getTime(),o=n instanceof Date?n:new Date(n);o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0);const u=o.getTime();return s>u}function X(t,n){if(!t||!n)return!1;const r=t instanceof Date?t:new Date(t);r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0);const s=r.getTime(),o=n instanceof Date?n:new Date(n);o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0);const u=o.getTime();return s<u}function Yt(t,n){if(!t||!n)return!1;const r=t instanceof Date?t:new Date(t),s=n instanceof Date?n:new Date(n);return`${r.getFullYear()}-${r.getMonth()}`==`${s.getFullYear()}-${s.getMonth()}`}function R(t,n){if(!t||!n)return!1;const r=t instanceof Date?t:new Date(t);r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0);const s=r.getTime(),o=n instanceof Date?n:new Date(n);o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0);const u=o.getTime();return s===u}function Ft(t,n){if(!t||!Array.isArray(t)||t.length===0)return[];const r=t.map(p=>p instanceof Date?p:p===null?new Date:new Date(p)),s=new Date(Math.min(...r.map(p=>p.getTime()))),o=new Date(Math.max(...r.map(p=>p.getTime()))),u=[],i=new Date(s);for(;i<=o;){if(Array.isArray(n)&&n.includes(i)){i.setDate(i.getDate()+1);continue}else if(n===i){i.setDate(i.getDate()+1);continue}u.push(`${i.getFullYear()}-${L(i.getMonth())}-${B(i.getDate())}`),i.setDate(i.getDate()+1)}return u}exports.default=ae;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { GeneralComponentProps } from '../typings/component';
|
|
3
3
|
|
|
4
4
|
export type DateValue = string | number | Date | null;
|
|
@@ -18,6 +18,7 @@ export interface DatePickerProps extends GeneralComponentProps<Omit<HTMLAttribut
|
|
|
18
18
|
enableMonthSelect?: boolean;
|
|
19
19
|
showToday?: boolean;
|
|
20
20
|
edgeSpacing?: number;
|
|
21
|
+
renderEvent?: (date: string) => ReactNode;
|
|
21
22
|
}
|
|
22
23
|
declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
23
24
|
export default DatePicker;
|