master-components-react-ts 1.0.11 → 1.0.13
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/dist/assets/Icons/index.d.ts +23 -0
- package/dist/master-components-react-ts.es.js +3137 -30
- package/package.json +4 -4
- package/dist/master-components-react-ts.cjs.js +0 -10
- package/dist/master-components-react-ts.cjs10.js +0 -30
- package/dist/master-components-react-ts.cjs11.js +0 -5
- package/dist/master-components-react-ts.cjs12.js +0 -24
- package/dist/master-components-react-ts.cjs13.js +0 -65
- package/dist/master-components-react-ts.cjs14.js +0 -55
- package/dist/master-components-react-ts.cjs15.js +0 -4
- package/dist/master-components-react-ts.cjs16.js +0 -30
- package/dist/master-components-react-ts.cjs17.js +0 -4
- package/dist/master-components-react-ts.cjs18.js +0 -14
- package/dist/master-components-react-ts.cjs19.js +0 -13
- package/dist/master-components-react-ts.cjs2.js +0 -21
- package/dist/master-components-react-ts.cjs20.js +0 -11
- package/dist/master-components-react-ts.cjs21.js +0 -17
- package/dist/master-components-react-ts.cjs22.js +0 -9
- package/dist/master-components-react-ts.cjs23.js +0 -12
- package/dist/master-components-react-ts.cjs24.js +0 -9
- package/dist/master-components-react-ts.cjs25.js +0 -7
- package/dist/master-components-react-ts.cjs26.js +0 -7
- package/dist/master-components-react-ts.cjs27.js +0 -9
- package/dist/master-components-react-ts.cjs28.js +0 -7
- package/dist/master-components-react-ts.cjs29.js +0 -5
- package/dist/master-components-react-ts.cjs3.js +0 -40
- package/dist/master-components-react-ts.cjs30.js +0 -24
- package/dist/master-components-react-ts.cjs31.js +0 -5
- package/dist/master-components-react-ts.cjs32.js +0 -13
- package/dist/master-components-react-ts.cjs33.js +0 -8
- package/dist/master-components-react-ts.cjs34.js +0 -5
- package/dist/master-components-react-ts.cjs35.js +0 -14
- package/dist/master-components-react-ts.cjs36.js +0 -11
- package/dist/master-components-react-ts.cjs37.js +0 -13
- package/dist/master-components-react-ts.cjs38.js +0 -11
- package/dist/master-components-react-ts.cjs39.js +0 -10
- package/dist/master-components-react-ts.cjs4.js +0 -44
- package/dist/master-components-react-ts.cjs40.js +0 -12
- package/dist/master-components-react-ts.cjs41.js +0 -8
- package/dist/master-components-react-ts.cjs42.js +0 -8
- package/dist/master-components-react-ts.cjs43.js +0 -8
- package/dist/master-components-react-ts.cjs44.js +0 -35
- package/dist/master-components-react-ts.cjs45.js +0 -24
- package/dist/master-components-react-ts.cjs46.js +0 -19
- package/dist/master-components-react-ts.cjs47.js +0 -66
- package/dist/master-components-react-ts.cjs48.js +0 -8
- package/dist/master-components-react-ts.cjs49.js +0 -183
- package/dist/master-components-react-ts.cjs5.js +0 -8
- package/dist/master-components-react-ts.cjs50.js +0 -14
- package/dist/master-components-react-ts.cjs51.js +0 -7
- package/dist/master-components-react-ts.cjs52.js +0 -11
- package/dist/master-components-react-ts.cjs53.js +0 -3
- package/dist/master-components-react-ts.cjs54.js +0 -12
- package/dist/master-components-react-ts.cjs55.js +0 -68
- package/dist/master-components-react-ts.cjs56.js +0 -9
- package/dist/master-components-react-ts.cjs57.js +0 -9
- package/dist/master-components-react-ts.cjs58.js +0 -5
- package/dist/master-components-react-ts.cjs59.js +0 -3
- package/dist/master-components-react-ts.cjs6.js +0 -11
- package/dist/master-components-react-ts.cjs60.js +0 -18
- package/dist/master-components-react-ts.cjs61.js +0 -8
- package/dist/master-components-react-ts.cjs62.js +0 -8
- package/dist/master-components-react-ts.cjs63.js +0 -3
- package/dist/master-components-react-ts.cjs64.js +0 -3
- package/dist/master-components-react-ts.cjs7.js +0 -112
- package/dist/master-components-react-ts.cjs8.js +0 -11
- package/dist/master-components-react-ts.cjs9.js +0 -42
- package/dist/master-components-react-ts.es10.js +0 -116
- package/dist/master-components-react-ts.es11.js +0 -10
- package/dist/master-components-react-ts.es12.js +0 -57
- package/dist/master-components-react-ts.es13.js +0 -172
- package/dist/master-components-react-ts.es14.js +0 -211
- package/dist/master-components-react-ts.es15.js +0 -8
- package/dist/master-components-react-ts.es16.js +0 -74
- package/dist/master-components-react-ts.es17.js +0 -12
- package/dist/master-components-react-ts.es18.js +0 -56
- package/dist/master-components-react-ts.es19.js +0 -36
- package/dist/master-components-react-ts.es2.js +0 -72
- package/dist/master-components-react-ts.es20.js +0 -26
- package/dist/master-components-react-ts.es21.js +0 -62
- package/dist/master-components-react-ts.es22.js +0 -15
- package/dist/master-components-react-ts.es23.js +0 -41
- package/dist/master-components-react-ts.es24.js +0 -15
- package/dist/master-components-react-ts.es25.js +0 -29
- package/dist/master-components-react-ts.es26.js +0 -26
- package/dist/master-components-react-ts.es27.js +0 -15
- package/dist/master-components-react-ts.es28.js +0 -7
- package/dist/master-components-react-ts.es29.js +0 -7
- package/dist/master-components-react-ts.es3.js +0 -144
- package/dist/master-components-react-ts.es30.js +0 -74
- package/dist/master-components-react-ts.es31.js +0 -15
- package/dist/master-components-react-ts.es32.js +0 -31
- package/dist/master-components-react-ts.es33.js +0 -13
- package/dist/master-components-react-ts.es34.js +0 -8
- package/dist/master-components-react-ts.es35.js +0 -19
- package/dist/master-components-react-ts.es36.js +0 -16
- package/dist/master-components-react-ts.es37.js +0 -19
- package/dist/master-components-react-ts.es38.js +0 -16
- package/dist/master-components-react-ts.es39.js +0 -35
- package/dist/master-components-react-ts.es4.js +0 -149
- package/dist/master-components-react-ts.es40.js +0 -41
- package/dist/master-components-react-ts.es41.js +0 -16
- package/dist/master-components-react-ts.es42.js +0 -16
- package/dist/master-components-react-ts.es43.js +0 -16
- package/dist/master-components-react-ts.es44.js +0 -66
- package/dist/master-components-react-ts.es45.js +0 -59
- package/dist/master-components-react-ts.es46.js +0 -50
- package/dist/master-components-react-ts.es47.js +0 -129
- package/dist/master-components-react-ts.es48.js +0 -17
- package/dist/master-components-react-ts.es49.js +0 -437
- package/dist/master-components-react-ts.es5.js +0 -20
- package/dist/master-components-react-ts.es50.js +0 -32
- package/dist/master-components-react-ts.es51.js +0 -20
- package/dist/master-components-react-ts.es52.js +0 -29
- package/dist/master-components-react-ts.es53.js +0 -4
- package/dist/master-components-react-ts.es54.js +0 -41
- package/dist/master-components-react-ts.es55.js +0 -274
- package/dist/master-components-react-ts.es56.js +0 -15
- package/dist/master-components-react-ts.es57.js +0 -15
- package/dist/master-components-react-ts.es58.js +0 -8
- package/dist/master-components-react-ts.es59.js +0 -4
- package/dist/master-components-react-ts.es6.js +0 -54
- package/dist/master-components-react-ts.es60.js +0 -83
- package/dist/master-components-react-ts.es61.js +0 -13
- package/dist/master-components-react-ts.es62.js +0 -13
- package/dist/master-components-react-ts.es63.js +0 -4
- package/dist/master-components-react-ts.es64.js +0 -4
- package/dist/master-components-react-ts.es7.js +0 -336
- package/dist/master-components-react-ts.es8.js +0 -46
- package/dist/master-components-react-ts.es9.js +0 -153
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
const e=require("./master-components-react-ts.cjs17.js"),t=require("react"),r=require("./master-components-react-ts.cjs26.js"),s=require("./master-components-react-ts.cjs27.js"),c=require("./master-components-react-ts.cjs28.js"),o=require("./master-components-react-ts.cjs29.js")
|
|
3
|
-
module.exports=({checked:n,change:a,type:i="default",disabled:u=!1,required:d=!1,multipleChecked:l=!1,activeStyle:m,checkBoxStyle:h,theme:p="light"})=>{
|
|
4
|
-
const j=o.useNamespace(),q=t.useRef(null),[k,y]=t.useState(!1)
|
|
5
|
-
return e.jsxRuntimeExports.jsxs("div",{style:k?u?{boxShadow:"none"}:m??{}:h??{},
|
|
6
|
-
className:`${"dark"===p?r.default.dark:""} ${r.default[j]} ${r.default.checkboxWrapper} ${"error"===i?r.default.error:""} ${n?r.default.checked:r.default.unChecked} ${u?r.default.disabled:""}`,
|
|
7
|
-
onMouseDown:()=>y(!0),onMouseUp:()=>y(!1),onMouseLeave:()=>y(!1),onClick:()=>{
|
|
8
|
-
u||a&&"function"==typeof a&&a(!n)},children:[e.jsxRuntimeExports.jsx("input",{
|
|
9
|
-
ref:q,type:"checkbox",disabled:u,checked:n??!1,hidden:!0,readOnly:!0,
|
|
10
|
-
required:d??!1}),n?e.jsxRuntimeExports.jsx(l?c.IconMinus:s.IconCheckmark,{}):""]
|
|
11
|
-
})}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
Object.defineProperties(exports,{o:{value:!0},[Symbol.toStringTag]:{
|
|
3
|
-
value:"Module"}})
|
|
4
|
-
const e="Calendar-module__datePicker",a="Calendar-module__dualCalendar",r="Calendar-module__dualCalendarWithQuick",d="Calendar-module__border",o="Calendar-module__calendarWrapper",l="Calendar-module__quickPick",t="Calendar-module__datePickerHeader",n="Calendar-module__div",_="Calendar-module__currentDateHeader",u="Calendar-module__left",p="Calendar-module__right",s="Calendar-module__singleIcon",m="Calendar-module__doubleIcon",C="Calendar-module__spacerRow",x="Calendar-module__day",c="Calendar-module__today",i="Calendar-module__inRange",h="Calendar-module__selected",k="Calendar-module__startDate",b="Calendar-module__endDate",W="Calendar-module__disabled",g="Calendar-module__otherMonth",D="Calendar-module__monthsWrapper",M="Calendar-module__month",P="Calendar-module__pickedMonth",y="Calendar-module__buttonWrapper",v={
|
|
5
|
-
datePicker:e,dualCalendar:a,dualCalendarWithQuick:r,border:d,calendarWrapper:o,
|
|
6
|
-
quickPick:l,datePickerHeader:t,div:n,currentDateHeader:_,left:u,right:p,
|
|
7
|
-
singleIcon:s,doubleIcon:m,spacerRow:C,day:x,today:c,inRange:i,selected:h,
|
|
8
|
-
startDate:k,endDate:b,disabled:W,otherMonth:g,monthsWrapper:D,month:M,
|
|
9
|
-
pickedMonth:P,buttonWrapper:y}
|
|
10
|
-
exports.border=d,exports.buttonWrapper=y,exports.calendarWrapper=o,exports.currentDateHeader=_,
|
|
11
|
-
exports.datePicker=e,exports.datePickerHeader=t,exports.day=x,exports.default=v,
|
|
12
|
-
exports.disabled=W,
|
|
13
|
-
exports.div=n,exports.doubleIcon=m,exports.dualCalendar=a,exports.dualCalendarWithQuick=r,
|
|
14
|
-
exports.endDate=b,
|
|
15
|
-
exports.inRange=i,exports.left=u,exports.month=M,exports.monthsWrapper=D,
|
|
16
|
-
exports.otherMonth=g,
|
|
17
|
-
exports.pickedMonth=P,exports.quickPick=l,exports.right=p,exports.selected=h,
|
|
18
|
-
exports.singleIcon=s,exports.spacerRow=C,exports.startDate=k,exports.today=c
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})
|
|
3
|
-
const e=require("./master-components-react-ts.cjs17.js")
|
|
4
|
-
exports.IconLeft=({size:t="20",color:s="#131314"})=>e.jsxRuntimeExports.jsx("svg",{
|
|
5
|
-
xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 20 20",
|
|
6
|
-
fill:"none",children:e.jsxRuntimeExports.jsx("path",{
|
|
7
|
-
d:"M9.00081 10.0039L12.2508 13.2539C12.4036 13.4067 12.48 13.6012 12.48 13.8373C12.48 14.0734 12.4036 14.2678 12.2508 14.4206C12.098 14.5734 11.9036 14.6498 11.6675 14.6498C11.4314 14.6498 11.2369 14.5734 11.0841 14.4206L7.25081 10.5873C7.16748 10.5039 7.10845 10.4137 7.07373 10.3164C7.03901 10.2192 7.02165 10.1151 7.02165 10.0039C7.02165 9.89284 7.03901 9.78867 7.07373 9.69145C7.10845 9.59422 7.16748 9.50395 7.25081 9.42061L11.0841 5.58728C11.2369 5.4345 11.4314 5.35811 11.6675 5.35811C11.9036 5.35811 12.098 5.4345 12.2508 5.58728C12.4036 5.74006 12.48 5.9345 12.48 6.17061C12.48 6.40672 12.4036 6.60117 12.2508 6.75395L9.00081 10.0039Z",
|
|
8
|
-
fill:s})})
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})
|
|
3
|
-
const e=require("./master-components-react-ts.cjs17.js")
|
|
4
|
-
exports.IconRight=({size:t="20",color:s="#131314"})=>e.jsxRuntimeExports.jsx("svg",{
|
|
5
|
-
xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 20 20",
|
|
6
|
-
fill:"none",children:e.jsxRuntimeExports.jsx("path",{
|
|
7
|
-
d:"M10.5007 10.004L7.25065 6.75399C7.09787 6.60121 7.02148 6.40677 7.02148 6.17065C7.02148 5.93454 7.09787 5.7401 7.25065 5.58732C7.40343 5.43454 7.59787 5.35815 7.83398 5.35815C8.0701 5.35815 8.26454 5.43454 8.41732 5.58732L12.2507 9.42065C12.334 9.50399 12.393 9.59427 12.4277 9.69149C12.4625 9.78871 12.4798 9.89288 12.4798 10.004C12.4798 10.1151 12.4625 10.2193 12.4277 10.3165C12.393 10.4137 12.334 10.504 12.2507 10.5873L8.41732 14.4207C8.26454 14.5734 8.0701 14.6498 7.83398 14.6498C7.59787 14.6498 7.40343 14.5734 7.25065 14.4207C7.09787 14.2679 7.02148 14.0734 7.02148 13.8373C7.02148 13.6012 7.09787 13.4068 7.25065 13.254L10.5007 10.004Z",
|
|
8
|
-
fill:s})})
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
const e=require("./master-components-react-ts.cjs17.js"),t=require("react"),l=require("./master-components-react-ts.cjs30.js"),s=require("./master-components-react-ts.cjs3.js"),n=require("./master-components-react-ts.cjs6.js"),c=require("./master-components-react-ts.cjs31.js"),o=require("./master-components-react-ts.cjs32.js"),r=require("./master-components-react-ts.cjs33.js"),i=require("./master-components-react-ts.cjs22.js")
|
|
3
|
-
module.exports=({data:a,withFilter:d=!0,withClose:u=!0,disableAll:m=!1,withMultiselect:p=!1,selectedOptionID:h,withInput:w=!1,dropdownType:S="country",onSelect:y,onFocus:L,onBlur:C,onValueChange:N,customInputSlot:v,dropdownWrapperStyle:E,dropdownInputWrapperStyle:f,dropdownInputSlotStyle:j,dropdownInputSlotItemStyle:I,dropdownInputSlotItemLabelStyle:g,dropdownInputSlotItemCloseStyle:A,dropdownInputSlotItemMoreStyle:k,dropdownItemStyle:$,dropdownItemLabelStyle:T,itemCheckboxStyle:_,dropdownItemLabelTextStyle:q,dropdownListStyle:x,...b})=>{
|
|
4
|
-
const[F,O]=t.useState(!1),[z,B]=t.useState(""),[D,M]=t.useState(!1),[W,J]=t.useState(!1),[V,G]=t.useState(!1),H=t.useRef(null),K=t.useRef(null),P=t.useRef(null),Q=t.useRef(null),[R,U]=t.useState([]),X=t.useRef([]),Y=t.useRef(0),[Z,ee]=t.useState(""),[te,le]=t.useState(null),se=e=>`https://flagsapi.com/${e}/flat/64.png`,ne=e=>{
|
|
5
|
-
e.selected=!e.selected,
|
|
6
|
-
p?(X.current=[...X.current,...R.filter((e=>1==e.selected)),...R.filter((t=>t.id===e.id))],
|
|
7
|
-
X.current=c.t(X.current,"id").filter((e=>e.selected)).filter((e=>"SELECT_ALL"!==e.id)),
|
|
8
|
-
"SELECT_ALL"===e.id?(M(e.selected),
|
|
9
|
-
J(!0)):(M(!1),y?.(X.current),J(!1)),O((e=>!e))):y?.(e)},ce=()=>{
|
|
10
|
-
const e=K.current,t=H.current
|
|
11
|
-
if(!t||!e)return
|
|
12
|
-
const l=e.getBoundingClientRect(),s=window.innerHeight
|
|
13
|
-
t.style.position="fixed",t.style.width=l.width+"px",t.style.left=l.left+window.pageXOffset+"px",
|
|
14
|
-
l.bottom+t.offsetHeight>s?(t.style.top=window.scrollY+l.top-t.offsetHeight+18+"px",
|
|
15
|
-
t.style.bottom="unset"):(t.style.top=window.scrollY+l.bottom+8+"px",
|
|
16
|
-
t.style.bottom="unset")}
|
|
17
|
-
t.useEffect((()=>{ce()}),[H,V]),t.useEffect((()=>{
|
|
18
|
-
if(X.current=a.filter((e=>e.selected)),!p)return void U(a)
|
|
19
|
-
const e=a.some((e=>"selected"in e)),t={id:"SELECT_ALL",label:"Select All",
|
|
20
|
-
selected:D}
|
|
21
|
-
e||a.forEach((e=>{e.selected=!1})),U([t,...a])
|
|
22
|
-
}),[JSON.stringify(a)]),t.useEffect((()=>{p&&(a.every((e=>e.selected))||M(!1))
|
|
23
|
-
}),[X.current.length]),t.useEffect((()=>{!p&&h&&le(a.find((e=>e.id===h)))
|
|
24
|
-
}),[h]),t.useEffect((()=>{if(p&&R.length>0&&W){
|
|
25
|
-
const e=R.map((e=>"SELECT_ALL"===e.id?{...e,selected:D}:e.disabled?e:{...e,
|
|
26
|
-
selected:D}))
|
|
27
|
-
U(e),a.forEach((e=>{"SELECT_ALL"===e.id?e.selected=D:e.disabled||(e.selected=D)
|
|
28
|
-
})),X.current=e.filter((e=>e.selected&&"SELECT_ALL"!==e.id)),y?.(X.current)}
|
|
29
|
-
}),[F]),t.useEffect((()=>{const e=e=>{
|
|
30
|
-
K.current&&(e.composedPath().includes(K.current)||G(!1))},t=e=>{
|
|
31
|
-
K.current&&P.current&&(P.current.contains(e.target)||G(!1))}
|
|
32
|
-
return document.addEventListener("click",e),document.addEventListener("wheel",t),
|
|
33
|
-
()=>{
|
|
34
|
-
document.removeEventListener("click",e),document.removeEventListener("wheel",t)}
|
|
35
|
-
}),[]),t.useEffect((()=>{if(!p)return
|
|
36
|
-
const e=()=>{const e=K.current?.getBoundingClientRect()
|
|
37
|
-
if(!e)return
|
|
38
|
-
const t=e.width
|
|
39
|
-
Y.current=t>150?t>250?t>350?t>450?4:3:2:1:0}
|
|
40
|
-
return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)
|
|
41
|
-
}),[])
|
|
42
|
-
const oe=t.useRef(!0)
|
|
43
|
-
return t.useEffect((()=>{oe.current?oe.current=!1:V||C?.()
|
|
44
|
-
}),[V]),e.jsxRuntimeExports.jsxs("div",{className:""+l.default.dropdownWrapper,
|
|
45
|
-
style:E??{},children:[e.jsxRuntimeExports.jsx("div",{ref:K,
|
|
46
|
-
className:l.default.dropdownInputWrapper,style:f??{},
|
|
47
|
-
onClick:()=>(G((e=>!e)),ce()),onFocus:()=>{L?.()},
|
|
48
|
-
children:e.jsxRuntimeExports.jsx(s,{...b,onFocusChange:e=>G(e),customFocus:V,
|
|
49
|
-
withActive:!1,value:w?z:te?.label??"",onChange:e=>{B(e),N?.(e)},toggleFocus:!0,
|
|
50
|
-
formInputStyle:{cursor:w?"text":"pointer"},
|
|
51
|
-
leftSlot:w&&e.jsxRuntimeExports.jsxs("div",{
|
|
52
|
-
className:l.default.dropdownInputSlot,
|
|
53
|
-
children:["currency"===S?e.jsxRuntimeExports.jsx("p",{children:te?.label
|
|
54
|
-
}):e.jsxRuntimeExports.jsx("img",{src:se(te?.code),alt:"flag"
|
|
55
|
-
}),e.jsxRuntimeExports.jsx("div",{
|
|
56
|
-
className:`${l.default.dropdownRightIconArrow} ${V?l.default.focused:""}`,
|
|
57
|
-
children:e.jsxRuntimeExports.jsx(r.IconArrowUp,{})})]}),
|
|
58
|
-
rightSlot:e.jsxRuntimeExports.jsxs("div",{
|
|
59
|
-
className:`${l.default.dropdownRightIcon} ${V?l.default.focused:""}`,
|
|
60
|
-
children:[(w?z:!p&&te)&&e.jsxRuntimeExports.jsx("div",{onClick:e=>{
|
|
61
|
-
e.stopPropagation(),w?(B(""),G(!1)):le(null)},
|
|
62
|
-
className:l.default.dropdownRightIconClose,
|
|
63
|
-
children:e.jsxRuntimeExports.jsx(i.IconCloseCircle,{})
|
|
64
|
-
}),!w&&e.jsxRuntimeExports.jsx("div",{
|
|
65
|
-
className:l.default.dropdownRightIconArrow,
|
|
66
|
-
children:e.jsxRuntimeExports.jsx(r.IconArrowUp,{})})]}),readOnly:!w,
|
|
67
|
-
forDropdown:!0,inputSlotStyle:{width:"100%"},
|
|
68
|
-
inputSlot:p&&X.current.length>0?v||e.jsxRuntimeExports.jsxs("ul",{
|
|
69
|
-
className:l.default.dropdownInputSlot,style:j??{},
|
|
70
|
-
children:[X.current.slice(0,Y.current).map(((t,s)=>e.jsxRuntimeExports.jsxs("li",{
|
|
71
|
-
ref:Q,className:l.default.dropdownInputSlotItem,style:I??{},
|
|
72
|
-
onClick:e=>e.stopPropagation(),children:[e.jsxRuntimeExports.jsx("p",{
|
|
73
|
-
title:t.label,className:l.default.dropdownInputSlotItemLabel,style:g??{},
|
|
74
|
-
children:t.customLabel?t.customLabel(t):t.label
|
|
75
|
-
}),e.jsxRuntimeExports.jsx("div",{style:A??{},
|
|
76
|
-
className:l.default.dropdownInputSlotItemClose,onClick:e=>{
|
|
77
|
-
e.stopPropagation(),ne(t)},children:e.jsxRuntimeExports.jsx(o.IconClose,{
|
|
78
|
-
width:"16",height:"16",viewBox:"0 0 16 16",stroke:"#95969C"})})]
|
|
79
|
-
},s))),X.current.length>Y.current&&e.jsxRuntimeExports.jsx("li",{
|
|
80
|
-
className:`${l.default.dropdownInputSlotItem} ${l.default.dropdownInputSlotItemMore}`,
|
|
81
|
-
style:k??{},children:e.jsxRuntimeExports.jsx("p",{
|
|
82
|
-
className:l.default.dropdownInputSlotItemLabel,style:g??{},
|
|
83
|
-
children:"+"+(X.current.length-Y.current)})})]}):null})
|
|
84
|
-
}),a&&a.length>0&&V&&e.jsxRuntimeExports.jsxs("div",{ref:H,
|
|
85
|
-
onClick:e=>e.stopPropagation(),className:l.default.dropdownListContainer,
|
|
86
|
-
children:[d&&e.jsxRuntimeExports.jsx(s,{placeholder:"Search",searchComponent:!0,
|
|
87
|
-
withFocus:!1,withActive:!1,value:Z,onChange:e=>ee(e)
|
|
88
|
-
}),e.jsxRuntimeExports.jsx("ul",{onClick:e=>e.stopPropagation(),
|
|
89
|
-
className:l.default.dropdownList,ref:P,style:x??{},
|
|
90
|
-
children:R.filter((e=>e?.label?.toLowerCase().includes(Z.toLowerCase()))).map(((t,s)=>e.jsxRuntimeExports.jsxs("li",{
|
|
91
|
-
style:{...$,cursor:!p&&t?.disabled?"not-allowed":"pointer"},
|
|
92
|
-
className:`${l.default.dropdownItem} ${p||te?.id!==t.id?"":l.default.selected} ${!t?.label||void 0===t.label||m||t?.disabled?l.default.disabled:""} ${p||t?.disabled?"":l.default.hovered}`,
|
|
93
|
-
onClick:e=>{var l
|
|
94
|
-
e.stopPropagation(),p||t?.disabled||(le(l=t),y?.(l),G(!1))},
|
|
95
|
-
children:[p&&e.jsxRuntimeExports.jsx("div",{className:l.default.itemCheckbox,
|
|
96
|
-
style:_??{},children:e.jsxRuntimeExports.jsx(n,{
|
|
97
|
-
multipleChecked:"SELECT_ALL"===t.id,disabled:m||t?.disabled,checked:t?.selected,
|
|
98
|
-
change:()=>ne(t)})}),e.jsxRuntimeExports.jsxs("div",{
|
|
99
|
-
className:l.default.dropdownItemLabel,style:T??{},
|
|
100
|
-
children:[w?e.jsxRuntimeExports.jsxs("div",{
|
|
101
|
-
className:l.default.dropdownItemLabelInput,
|
|
102
|
-
children:[e.jsxRuntimeExports.jsx("img",{src:se(t.code),style:{width:"1.375rem",
|
|
103
|
-
height:"1.375rem",objectFit:"contain"},alt:t.name
|
|
104
|
-
}),e.jsxRuntimeExports.jsx("span",{title:t.name,className:l.default.countryName,
|
|
105
|
-
children:t.name||t.label}),e.jsxRuntimeExports.jsx("span",{
|
|
106
|
-
className:l.default.countryDialCode,children:"country"===S?t.dialCode:t?.label
|
|
107
|
-
})]}):e.jsxRuntimeExports.jsx("p",{title:"string"==typeof t.label?t.label:"",
|
|
108
|
-
className:""+("SELECT_ALL"===t.id?l.default.selectAll:""),style:q??{},
|
|
109
|
-
children:t.customLabel?t.customLabel():t.label
|
|
110
|
-
}),p&&e.jsxRuntimeExports.jsx("p",{
|
|
111
|
-
children:"SELECT_ALL"===t.id?`${R.filter((e=>"SELECT_ALL"!==e.id&&e.selected)).length}/${a.length}`:""
|
|
112
|
-
})]})]},s)))},R.length)]})]})}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
const e=require("./master-components-react-ts.cjs17.js"),r=require("./master-components-react-ts.cjs34.js"),s=require("react"),t=require("./master-components-react-ts.cjs29.js"),c=require("./master-components-react-ts.cjs35.js"),n=require("./master-components-react-ts.cjs36.js"),o=require("./master-components-react-ts.cjs37.js"),a=require("./master-components-react-ts.cjs38.js")
|
|
3
|
-
module.exports=({checked:i,change:d,disabled:u,required:m,withUncheckState:l=!1,radioType:j="default"})=>{
|
|
4
|
-
t.useNamespace()
|
|
5
|
-
const[p,q]=s.useState(!1)
|
|
6
|
-
return e.jsxRuntimeExports.jsxs("div",{className:r.default.radioWrapper,style:{
|
|
7
|
-
cursor:u?"not-allowed":"pointer"},onClick:()=>{u||d?.(!l||!i)},
|
|
8
|
-
children:[e.jsxRuntimeExports.jsx("input",{type:"radio",checked:!0,readOnly:!0,
|
|
9
|
-
hidden:!0,disabled:u??!1,required:m}),(()=>{let r=null
|
|
10
|
-
return r=e.jsxRuntimeExports.jsx(i?u?o.IconRadioCheckedDisabled:c.IconRadioChecked:u?a.IconRadioUncheckedDisabled:n.IconRadioUnchecked,{
|
|
11
|
-
color:u?"#95969C":"error"===j?"#E3292F":"#0058FF"}),r})()]})}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
const t=require("./master-components-react-ts.cjs17.js"),e=require("react"),o=require("./master-components-react-ts.cjs39.js")
|
|
3
|
-
module.exports=({children:s,tooltipSlot:c,delay:l=400,placement:r="top",trigger:i="hover",title:n,text:a,customText:m,tooltipContentStyle:p,tooltipTitlestyle:u,tooltipTextStyle:f,tooltipContainerStyle:d,pointerPosition:h="10%",withPointer:y=!1,theme:x,topCustomOffset:k=0,bottomCustomOffset:C=0,leftCustomOffset:g=0,rightCustomOffset:v=0,forceClose:T=!1,onClick:$})=>{
|
|
4
|
-
const b=e.useRef(null),N=e.useRef(null)
|
|
5
|
-
let j
|
|
6
|
-
const[O,S]=e.useState(!1),q=c||n||a||m
|
|
7
|
-
return e.useEffect((()=>{(()=>{const t=b.current,e=N.current
|
|
8
|
-
if(!e||!t)return
|
|
9
|
-
const o=t.getBoundingClientRect()
|
|
10
|
-
switch(e.style.position="fixed",r){case"top":
|
|
11
|
-
e.style.top=o.top-e.offsetHeight-8+"px",e.style.left=o.left+k+"px"
|
|
12
|
-
break
|
|
13
|
-
case"bottom":e.style.top=o.bottom+8+"px",e.style.left=o.left+C+"px"
|
|
14
|
-
break
|
|
15
|
-
case"left":
|
|
16
|
-
e.style.top=o.top+o.height/2-e.offsetHeight/2+"px",e.style.left=o.left-e.offsetWidth-8+g+"px"
|
|
17
|
-
break
|
|
18
|
-
case"right":
|
|
19
|
-
e.style.top=o.top+o.height/2-e.offsetHeight/2+"px",e.style.left=o.right+8+v+"px"
|
|
20
|
-
}})()}),[b,O,s,r,c,m,n,a]),e.useEffect((()=>{const t=t=>{
|
|
21
|
-
const e=b.current?.contains(t.target)
|
|
22
|
-
e||S(!1)},e=t=>{t.composedPath().includes(b.current)||S(!1)}
|
|
23
|
-
return document.addEventListener("click",e),document.addEventListener("scroll",t,!0),
|
|
24
|
-
()=>{
|
|
25
|
-
document.removeEventListener("scroll",t,!0),document.removeEventListener("click",e)
|
|
26
|
-
}}),[]),e.useEffect((()=>{T&&S(!1)}),[T]),e.useEffect((()=>{const t=N.current
|
|
27
|
-
t&&(t.style.setProperty("--pointer-position",""+h),y||t.classList.add(o.default.withoutPointer))
|
|
28
|
-
}),[O]),t.jsxRuntimeExports.jsxs("div",{ref:b,
|
|
29
|
-
className:`${"dark"===x?o.default.dark:""} ${o.default.tooltipContainer}`,
|
|
30
|
-
onClick:()=>{"click"===i&&($?.(),S((t=>!t)))},onMouseEnter:()=>{
|
|
31
|
-
"hover"===i&&q&&(j=setTimeout((()=>{S(!0)}),l))},onMouseLeave:()=>{
|
|
32
|
-
"hover"===i&&(clearTimeout(j),setTimeout((()=>{S(!1)}),l))},style:d??{},
|
|
33
|
-
children:[s,O&&c?t.jsxRuntimeExports.jsx("div",{style:p??{},
|
|
34
|
-
onClick:t=>t.stopPropagation(),ref:N,
|
|
35
|
-
className:`${o.default.tooltipContent} ${r?o.default[r]:o.default.bottom}`,
|
|
36
|
-
children:c}):O&&t.jsxRuntimeExports.jsxs("div",{style:p??{},
|
|
37
|
-
onClick:t=>t.stopPropagation(),ref:N,
|
|
38
|
-
className:`${o.default.tooltipContent} ${r?o.default[r]:o.default.bottom}`,
|
|
39
|
-
children:[m&&"string"==typeof m&&m,n&&n.length>0&&"string"==typeof n&&t.jsxRuntimeExports.jsx("h2",{
|
|
40
|
-
className:o.default.tooltipTitle,style:u??{},children:n
|
|
41
|
-
}),a&&a.length>0&&"string"==typeof a&&t.jsxRuntimeExports.jsx("p",{
|
|
42
|
-
className:o.default.tooltipText,style:f??{},children:a})]})]})}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./master-components-react-ts.es17.js";
|
|
2
|
-
import style from "./master-components-react-ts.es40.js";
|
|
3
|
-
import { IconCheckCircle } from "./master-components-react-ts.es41.js";
|
|
4
|
-
import { IconSave } from "./master-components-react-ts.es42.js";
|
|
5
|
-
import { IconTrash } from "./master-components-react-ts.es43.js";
|
|
6
|
-
import { useRef, useEffect } from "react";
|
|
7
|
-
import { IconCloseBlack } from "./master-components-react-ts.es32.js";
|
|
8
|
-
const Popup = ({
|
|
9
|
-
visible,
|
|
10
|
-
template,
|
|
11
|
-
options,
|
|
12
|
-
children,
|
|
13
|
-
onClickOutside,
|
|
14
|
-
onClose,
|
|
15
|
-
widthType,
|
|
16
|
-
// "horizontal"
|
|
17
|
-
modalOverlayStyle,
|
|
18
|
-
popupContainerStyle,
|
|
19
|
-
templateWrapperStyle,
|
|
20
|
-
popupHeaderStyle,
|
|
21
|
-
popupTitleStyle,
|
|
22
|
-
closeButtonStyle
|
|
23
|
-
}) => {
|
|
24
|
-
const _getType = () => {
|
|
25
|
-
if (!options || !options?.type) return;
|
|
26
|
-
switch (String(options?.type)) {
|
|
27
|
-
case "delete": {
|
|
28
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(IconTrash, {});
|
|
29
|
-
}
|
|
30
|
-
case "unsaved": {
|
|
31
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(IconSave, {});
|
|
32
|
-
}
|
|
33
|
-
case "success": {
|
|
34
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(IconCheckCircle, {});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const ClickClose = () => {
|
|
39
|
-
if (onClose && typeof onClose === "function") {
|
|
40
|
-
onClose();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const componentRef = useRef(null);
|
|
44
|
-
const handleClick = (event) => {
|
|
45
|
-
const clickedElement = event.target;
|
|
46
|
-
if (clickedElement === componentRef.current) {
|
|
47
|
-
if (onClickOutside && typeof onClickOutside === "function") {
|
|
48
|
-
onClickOutside();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
document.addEventListener("click", handleClick);
|
|
54
|
-
return () => {
|
|
55
|
-
document.removeEventListener("click", handleClick);
|
|
56
|
-
};
|
|
57
|
-
}, []);
|
|
58
|
-
return visible && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
59
|
-
"div",
|
|
60
|
-
{
|
|
61
|
-
ref: componentRef,
|
|
62
|
-
style: modalOverlayStyle ?? {},
|
|
63
|
-
className: `
|
|
64
|
-
${style.modalOverlay}
|
|
65
|
-
${options && options?.mode === "drawer" ? style.popupDrawerMode : ""}
|
|
66
|
-
`,
|
|
67
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
68
|
-
"div",
|
|
69
|
-
{
|
|
70
|
-
style: popupContainerStyle ?? {},
|
|
71
|
-
className: `
|
|
72
|
-
mcPopup_global
|
|
73
|
-
${style.popupContainer}
|
|
74
|
-
${options?.type ? style.withOptions : ""}
|
|
75
|
-
${widthType === "horizontal" ? style.horizontal : ""}
|
|
76
|
-
`,
|
|
77
|
-
children: [
|
|
78
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.closeButton, style: closeButtonStyle ?? {}, onClick: ClickClose, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
79
|
-
IconCloseBlack,
|
|
80
|
-
{
|
|
81
|
-
color: "#131314"
|
|
82
|
-
}
|
|
83
|
-
) }),
|
|
84
|
-
(options?.title || options?.description || options?.type) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${style.popupHeader}`, style: popupHeaderStyle ?? {}, children: [
|
|
85
|
-
_getType() && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.typeIcon, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
86
|
-
"div",
|
|
87
|
-
{
|
|
88
|
-
style: { backgroundColor: options?.type === "success" ? "#DCFAE6" : options?.type === "unsaved" ? "#FEF0C7" : "#FEE4E2" },
|
|
89
|
-
className: style.icon,
|
|
90
|
-
children: _getType()
|
|
91
|
-
}
|
|
92
|
-
) }),
|
|
93
|
-
options && options?.title && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.popupTitle, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { style: popupTitleStyle ?? {}, children: [
|
|
94
|
-
" ",
|
|
95
|
-
options?.title ?? "",
|
|
96
|
-
" "
|
|
97
|
-
] }) }),
|
|
98
|
-
options && options?.description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.popupDescription, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [
|
|
99
|
-
" ",
|
|
100
|
-
options?.description ?? "",
|
|
101
|
-
" "
|
|
102
|
-
] }) })
|
|
103
|
-
] }),
|
|
104
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.templateWrapper, style: templateWrapperStyle ?? {}, children: [
|
|
105
|
-
template && template,
|
|
106
|
-
children && children
|
|
107
|
-
] })
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
export {
|
|
115
|
-
Popup as default
|
|
116
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ToastContext } from "./master-components-react-ts.es12.js";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
const createNotificationToast = () => {
|
|
4
|
-
const context = useContext(ToastContext);
|
|
5
|
-
if (!context) throw new Error("createNotificationToast must be used within ToastProvider");
|
|
6
|
-
return context.showToast;
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
createNotificationToast as default
|
|
10
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./master-components-react-ts.es17.js";
|
|
2
|
-
import { createContext, useState, useCallback } from "react";
|
|
3
|
-
import NotificationToast from "./master-components-react-ts.es44.js";
|
|
4
|
-
import style from "./master-components-react-ts.es45.js";
|
|
5
|
-
const ToastContext = createContext(null);
|
|
6
|
-
let idCounter = 0;
|
|
7
|
-
const ToastProvider = ({ children }) => {
|
|
8
|
-
const [toasts, setToasts] = useState([]);
|
|
9
|
-
const showToast = (props) => {
|
|
10
|
-
setToasts((prev) => {
|
|
11
|
-
const max = props.max ?? Infinity;
|
|
12
|
-
if (prev.length >= max) return prev;
|
|
13
|
-
const id = idCounter++;
|
|
14
|
-
setTimeout(() => {
|
|
15
|
-
setToasts((prev2) => prev2.filter((t) => t.id !== id));
|
|
16
|
-
}, props.timeout || 4e3);
|
|
17
|
-
return [...prev, { id, props }];
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
const getPosition = useCallback(() => {
|
|
21
|
-
if (toasts.length > 0) {
|
|
22
|
-
switch (toasts[0]?.props?.position) {
|
|
23
|
-
case "top-left":
|
|
24
|
-
return { top: "20px", left: "20px" };
|
|
25
|
-
case "top-right":
|
|
26
|
-
return { top: "20px", right: "20px" };
|
|
27
|
-
case "bottom-left":
|
|
28
|
-
return { bottom: "20px", left: "20px" };
|
|
29
|
-
case "bottom-right":
|
|
30
|
-
return { bottom: "20px", right: "20px" };
|
|
31
|
-
case "top-center":
|
|
32
|
-
return { top: "20px", left: "50%", transform: "translateX(-50%)" };
|
|
33
|
-
case "bottom-center":
|
|
34
|
-
return { bottom: "20px", left: "50%", transform: "translateX(-50%)" };
|
|
35
|
-
default:
|
|
36
|
-
return {};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, [toasts.length]);
|
|
40
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(ToastContext.Provider, { value: { showToast }, children: [
|
|
41
|
-
children,
|
|
42
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.toastContainer, style: getPosition(), children: toasts.map(({ id, props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43
|
-
NotificationToast,
|
|
44
|
-
{
|
|
45
|
-
...props,
|
|
46
|
-
onClose: () => {
|
|
47
|
-
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
id
|
|
51
|
-
)) })
|
|
52
|
-
] });
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
ToastContext,
|
|
56
|
-
ToastProvider as default
|
|
57
|
-
};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./master-components-react-ts.es17.js";
|
|
2
|
-
import { useRef, useState, useEffect } from "react";
|
|
3
|
-
import style from "./master-components-react-ts.es46.js";
|
|
4
|
-
import FormInput from "./master-components-react-ts.es3.js";
|
|
5
|
-
import { IconArrowUp } from "./master-components-react-ts.es33.js";
|
|
6
|
-
import { IconCloseCircle } from "./master-components-react-ts.es22.js";
|
|
7
|
-
import customParseFormat from "./master-components-react-ts.es47.js";
|
|
8
|
-
import dayjs from "dayjs";
|
|
9
|
-
import MainButton from "./master-components-react-ts.es2.js";
|
|
10
|
-
dayjs.extend(customParseFormat);
|
|
11
|
-
const TimePicker = ({
|
|
12
|
-
value,
|
|
13
|
-
defaultTimeType = "24",
|
|
14
|
-
defaultAmPm = "AM",
|
|
15
|
-
withConfirm = true,
|
|
16
|
-
mode = "single",
|
|
17
|
-
onChange,
|
|
18
|
-
onFocus,
|
|
19
|
-
onBlur,
|
|
20
|
-
...rest
|
|
21
|
-
}) => {
|
|
22
|
-
const ComponentRef = useRef(null);
|
|
23
|
-
const DropdownRef = useRef(null);
|
|
24
|
-
const [IsFocused, setIsFocused] = useState(false);
|
|
25
|
-
const [TimeType, setTimeType] = useState(defaultTimeType);
|
|
26
|
-
const hours12 = Array.from({ length: 12 }, (_, index) => index < 10 ? `0${index}` : `${index}`);
|
|
27
|
-
const hours24 = Array.from({ length: 24 }, (_, index) => index < 10 ? `0${index}` : `${index}`);
|
|
28
|
-
const minutes = Array.from({ length: 60 }, (_, index) => index < 10 ? `0${index}` : `${index}`);
|
|
29
|
-
const [Value, setValue] = useState("");
|
|
30
|
-
const [Minutes, setMinutes] = useState(null);
|
|
31
|
-
const [Hours, setHours] = useState(null);
|
|
32
|
-
const [AmPm, setAmPm] = useState(defaultAmPm);
|
|
33
|
-
const CalculatePos = () => {
|
|
34
|
-
const componentEl = ComponentRef.current;
|
|
35
|
-
const dropdownEl = DropdownRef.current;
|
|
36
|
-
if (!dropdownEl || !componentEl) return;
|
|
37
|
-
const componentRect = componentEl.getBoundingClientRect();
|
|
38
|
-
const windowHeight = window.innerHeight;
|
|
39
|
-
dropdownEl.style.position = "fixed";
|
|
40
|
-
dropdownEl.style.left = `${componentRect.left + window.pageXOffset}px`;
|
|
41
|
-
if (componentRect.bottom + dropdownEl.offsetHeight > windowHeight) {
|
|
42
|
-
dropdownEl.style.top = `${window.scrollY + componentRect.top - dropdownEl.offsetHeight + 18}px`;
|
|
43
|
-
dropdownEl.style.bottom = "unset";
|
|
44
|
-
} else {
|
|
45
|
-
dropdownEl.style.top = `${window.scrollY + componentRect.bottom + 8}px`;
|
|
46
|
-
dropdownEl.style.bottom = "unset";
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const Focus = () => {
|
|
50
|
-
onFocus?.();
|
|
51
|
-
};
|
|
52
|
-
const Clear = () => {
|
|
53
|
-
setValue("");
|
|
54
|
-
setHours(null);
|
|
55
|
-
setMinutes(null);
|
|
56
|
-
setAmPm("AM");
|
|
57
|
-
};
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (value && value.length > 0) {
|
|
60
|
-
setValue(value);
|
|
61
|
-
}
|
|
62
|
-
}, [value]);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (!Hours && !Minutes) return;
|
|
65
|
-
const hour = parseInt(Hours ?? "0", 10);
|
|
66
|
-
const minute = parseInt(Minutes ?? "0", 10);
|
|
67
|
-
const adjustedHour = TimeType === "12" ? AmPm === "PM" && hour < 12 ? hour + 12 : AmPm === "AM" && hour === 12 ? 0 : hour : hour;
|
|
68
|
-
const formattedTime = dayjs().hour(adjustedHour).minute(minute).format(TimeType === "12" ? "hh:mm A" : "HH:mm");
|
|
69
|
-
setValue(formattedTime);
|
|
70
|
-
if (!withConfirm) {
|
|
71
|
-
onChange?.(formattedTime);
|
|
72
|
-
}
|
|
73
|
-
}, [Hours, Minutes, AmPm, TimeType]);
|
|
74
|
-
const isInitialRender = useRef(true);
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (isInitialRender.current) {
|
|
77
|
-
isInitialRender.current = false;
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (!IsFocused) {
|
|
81
|
-
onBlur?.();
|
|
82
|
-
}
|
|
83
|
-
}, [IsFocused]);
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
CalculatePos();
|
|
86
|
-
}, [ComponentRef, IsFocused]);
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
const ClickHandler = (event) => {
|
|
89
|
-
if (!ComponentRef.current || !DropdownRef.current) return;
|
|
90
|
-
if (event.composedPath().includes(ComponentRef.current) || event.composedPath().includes(DropdownRef.current)) return;
|
|
91
|
-
setIsFocused(false);
|
|
92
|
-
};
|
|
93
|
-
const ScrollHandler = (event) => {
|
|
94
|
-
if (!ComponentRef.current || DropdownRef.current) return;
|
|
95
|
-
setIsFocused(false);
|
|
96
|
-
};
|
|
97
|
-
document.addEventListener("click", ClickHandler);
|
|
98
|
-
document.addEventListener("wheel", ScrollHandler);
|
|
99
|
-
return () => {
|
|
100
|
-
document.removeEventListener("click", ClickHandler);
|
|
101
|
-
document.removeEventListener("wheel", ScrollHandler);
|
|
102
|
-
};
|
|
103
|
-
}, []);
|
|
104
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${style.timepickerWrapper} ${IsFocused ? style.focused : ""}`, children: [
|
|
105
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: ComponentRef, className: style.timepickerInputWrapper, onClick: () => (setIsFocused((state) => !state), CalculatePos()), onFocus: Focus, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
106
|
-
FormInput,
|
|
107
|
-
{
|
|
108
|
-
...rest,
|
|
109
|
-
onFocusChange: (value2) => setIsFocused(value2),
|
|
110
|
-
customFocus: IsFocused,
|
|
111
|
-
withActive: false,
|
|
112
|
-
value: Value,
|
|
113
|
-
toggleFocus: true,
|
|
114
|
-
formInputStyle: { cursor: "pointer" },
|
|
115
|
-
rightSlot: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${style.dropdownRightIcon} ${IsFocused ? style.focused : ""}`, children: [
|
|
116
|
-
Value && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
117
|
-
"div",
|
|
118
|
-
{
|
|
119
|
-
onClick: (e) => {
|
|
120
|
-
e.stopPropagation();
|
|
121
|
-
Clear();
|
|
122
|
-
},
|
|
123
|
-
className: style.dropdownRightIconClose,
|
|
124
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconCloseCircle, {})
|
|
125
|
-
}
|
|
126
|
-
),
|
|
127
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.dropdownRightIconArrow, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconArrowUp, {}) })
|
|
128
|
-
] }),
|
|
129
|
-
readOnly: true,
|
|
130
|
-
forDropdown: true
|
|
131
|
-
}
|
|
132
|
-
) }),
|
|
133
|
-
IsFocused && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: DropdownRef, className: style.timepickerDropdownWrapper, children: [
|
|
134
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.timepickerDropdownHeader, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.timepickerDropdownHeaderButtons, children: [
|
|
135
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
136
|
-
"p",
|
|
137
|
-
{
|
|
138
|
-
className: TimeType === "12" ? style.active : "",
|
|
139
|
-
onClick: () => {
|
|
140
|
-
Clear();
|
|
141
|
-
setTimeType("12");
|
|
142
|
-
},
|
|
143
|
-
children: "AM -PM"
|
|
144
|
-
}
|
|
145
|
-
),
|
|
146
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147
|
-
"p",
|
|
148
|
-
{
|
|
149
|
-
className: TimeType === "24" ? style.active : "",
|
|
150
|
-
onClick: () => {
|
|
151
|
-
Clear();
|
|
152
|
-
setTimeType("24");
|
|
153
|
-
},
|
|
154
|
-
children: "24 Hours"
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] }) }),
|
|
158
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.timepickerDropdownBody, children: [
|
|
159
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.timepickerDropdownBodyHours, children: (TimeType === "12" ? hours12 : hours24).map((hour) => /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: Hours === hour || Value?.split(":")[0] === hour ? style.active : "", onClick: () => setHours(hour), children: hour }, hour)) }),
|
|
160
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.timepickerDropdownBodyMinutes, children: minutes.map((minute) => /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: Minutes === minute || Value?.split(":")[1] === minute ? style.active : "", onClick: () => setMinutes(minute), children: minute }, minute)) }),
|
|
161
|
-
TimeType === "12" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.timepickerDropdownBodyAmPm, children: [
|
|
162
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: AmPm === "AM" ? style.active : "", onClick: () => setAmPm("AM"), children: "AM" }, "AM"),
|
|
163
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: AmPm === "PM" ? style.active : "", onClick: () => setAmPm("PM"), children: "PM" }, "PM")
|
|
164
|
-
] })
|
|
165
|
-
] }),
|
|
166
|
-
withConfirm && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.timepickerDropdownFooter, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MainButton, { label: "Confirm time", onClick: () => onChange?.(Value) }) })
|
|
167
|
-
] })
|
|
168
|
-
] });
|
|
169
|
-
};
|
|
170
|
-
export {
|
|
171
|
-
TimePicker as default
|
|
172
|
-
};
|