forked from sindresorhus/awesome
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
6691-ae2043bfd6cd38d5.js.download
4 lines (4 loc) · 8.82 KB
/
6691-ae2043bfd6cd38d5.js.download
1
2
3
4
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6691],{81901:function(e,t,n){n.d(t,{L:function(){return Dropdown}});var r=n(45897),a=n(28165),o=n(2784),i=n(23273),l=n(35080),s=n(13030),c=n(99029),u=n(95945),d=n(39479),f=n(77293),p=n(93594);let omit=(e,t)=>(0,p.s)(Object.entries(e).filter(([e])=>!t.includes(e)));var __rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};let isDisabled=e=>e.isDisabled||0===e.items.length,g=(0,d.B)("Dropdown",{root:(0,a.iv)({position:"relative"}),buttonWrap:e=>({cursor:isDisabled(e)?"default":"pointer"}),button:(0,a.iv)({maxWidth:"100%",overflow:"hidden"}),buttonText:(0,a.iv)({display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),placeholder:(0,a.iv)({color:c.w.neutral600})}),buildAriaLabel=({label:e,value:t,placeholder:n})=>[t,e,!t&&n].filter(Boolean).join(", ");function Dropdown(e){var{size:t="small",getLabelForItem:n=e=>e.label,renderFloatingMenu:a=e=>(0,f.U)(l.A,Object.assign({},e)),menuAriaLabel:c="List of items"}=e,d=__rest(e,["size","getLabelForItem","renderFloatingMenu","menuAriaLabel"]);let p=Object.assign({size:t,getLabelForItem:n,renderFloatingMenu:a,menuAriaLabel:c},d),b=(0,o.useRef)(null),h=p.renderButtonForItem||p.getLabelForItem;return(0,f.U)(r.ZP,{initialSelectedItem:p.initialSelectedItem,inputId:p.inputId,itemCount:p.items.length,itemToString:e=>e?p.getLabelForItem(e):"",onChange:e=>{var t;e&&(null===(t=p.onChange)||void 0===t||t.call(p,e))},onSelect:e=>{var t;e&&(null===(t=p.onSelect)||void 0===t||t.call(p,e))},stateReducer:(e,t)=>t.type===r.ZP.stateChangeTypes.keyDownEscape?{isOpen:!1}:t,selectedItem:p.selectedItem},({clearSelection:e,closeMenu:t,getInputProps:n,getItemProps:r,getMenuProps:a,getRootProps:o,highlightedIndex:l,isOpen:c,openMenu:d,selectItem:m,selectedItem:v,setHighlightedIndex:y})=>{let O=!!v,w=omit(o(),["aria-labelledby"]),onBlur=e=>{if(p.onBlur){let n={didBlurWithin:!!b.current&&b.current.contains(e.relatedTarget),closeMenu:t};p.onBlur(e,n)}else t()},{onChange:I,onClick:P}=p,x=__rest(p,["onChange","onClick"]);return(0,f.U)("div",Object.assign({"aria-label":p.menuAriaLabel,"aria-labelledby":p.inputId,css:g.root},w,{onBlur:onBlur,ref:b}),(0,f.U)("div",{css:g.buttonWrap(p)},(0,f.U)(s.I,Object.assign({onClick:()=>{!0===c?t():isDisabled(p)||d(),p.onClick&&p.onClick()}},x,(0,u.j)(n()),{canClickIconAfter:!1,id:p.inputId,isDisabled:isDisabled(p),renderIconAfter:()=>(0,f.U)(i.J,{name:"arrowDropdown",size:24}),renderIconBefore:()=>"function"==typeof p.renderIcon?p.renderIcon(v):void 0}),e=>(0,f.U)("button",{"aria-activedescendant":e["aria-activedescendant"],"aria-invalid":e["aria-invalid"],"aria-controls":e["aria-controls"],"aria-expanded":c?"true":"false","aria-haspopup":"true","aria-label":buildAriaLabel({label:e["aria-label"]||"",placeholder:p.placeholder,value:O?p.getLabelForItem(v):void 0}),css:[e.css,g.button],disabled:e.disabled,id:e.id,onBlur:onBlur,onFocus:p.onFocus,onKeyDown:e.onKeyDown,type:"button"},O?(0,f.U)("span",{css:g.buttonText},h(v)):(0,f.U)("span",{css:[g.buttonText,g.placeholder]},p.placeholder)))),c&&p.renderFloatingMenu({ariaLabel:p.menuAriaLabel,clearSelection:e,closeMenu:t,items:p.items,highlightedIndex:l,getKeyForItem:p.getKeyForItem,getLabelForItem:p.getLabelForItem,getItemProps:r,getMenuProps:a,getInputProps:n,renderIcon:p.renderIcon,selectItem:m,selectedItem:v,setHighlightedIndex:y}))})}},52968:function(e,t,n){n.d(t,{N:function(){return DarkBackgroundButton}});var r=n(77293),a=n(36897),__rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};let o={primary:"primary-dark",secondary:"secondary-dark"};function DarkBackgroundButton(e){var{size:t="small",color:n="primary"}=e,i=__rest(e,["size","color"]);return(0,r.U)(a.Y,Object.assign({color:o[n],size:t},i))}},90982:function(e,t,n){n.d(t,{D:function(){return Paginator}});var r=n(28165),a=n(67762),o=n(3e3),i=n(99029),l=n(39479),s=n(52676),c=n(77293),u=n(37260),d=n(36897),__rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};function NumberButton(e){var{selected:t,value:n}=e,r=__rest(e,["selected","value"]);return(0,c.U)(d.Y,Object.assign({},r,{color:t?"primary-alt":"number",isSquare:!0,size:"small"}),n)}let f=(0,l.B)("Paginator",{root:(e,t)=>[{display:"grid",gap:10,gridTemplateColumns:`repeat(${e.numberOfButtons}, 40px)`,alignItems:"center"},e.isCondensed&&(0,s.Q)("condensed",{gridTemplateColumns:"44px 44px min-content 44px 44px"}),t&&(0,s.Q)("isCentered",{justifyContent:"center"})],text:[(0,r.iv)(Object.assign(Object.assign({},o.ZT.base),{fontSize:16,lineHeight:"22px",fontWeight:600,textAlign:"center",whiteSpace:"nowrap",color:i.w.neutral800})),r.iv`
padding-left: 20px;
padding-right: 20px;
`]}),PaginatorText=e=>{let t=2*`${e.numberOfPages}`.length+3;return(0,c.U)("span",{css:f.text,style:{minWidth:`${t}ch`}},`${e.currentPageIndex+1} of ${e.numberOfPages}`)},Paginator=({currentPageIndex:e,pageUrls:t,ariaLabel:n,condenseAt:r=6,firstPageUrl:o,isCentered:i,lastPageUrl:l,offset:s=0,onPaginate:d})=>{let p=t.length,g=p-1,b=(0,u.u)(e,0,g),h=Math.max(0,b-1),m=Math.min(g,b+1),v=p>=r,y={numberOfPages:p,isCondensed:v,numberOfButtons:p+2+[o,l].filter(Boolean).length},createOnPaginateFn=(e,t,n)=>r=>{d&&d({buttonType:e,pageIndex:t,pageUrl:n},r)},O=v?(0,c.U)(PaginatorText,{currentPageIndex:b,numberOfPages:p}):t.map((e,t)=>{let n=t===b,r=s+t+1;return(0,c.U)(NumberButton,{ariaLabel:n?`Current page (${r})`:`${r}`,href:e,key:e||r,onClick:createOnPaginateFn("number",t,e),value:r,selected:n,hasShadow:n})}),w=o||(v?t[0]:void 0),I=(w||v)&&(0,c.U)(a.h,{ariaLabel:"First page",color:"icon-secondary",disabled:e<=0,href:w,icon:"arrowLineLeft",onClick:createOnPaginateFn("first",0,w),tooltipPosition:"southwest"}),P=l||(v?t[g]:void 0),x=(P||v)&&(0,c.U)(a.h,{ariaLabel:"Last page",color:"icon-secondary",disabled:b>=g,href:P,icon:"arrowLineRight",onClick:createOnPaginateFn("last",g,P),tooltipPosition:"southeast"});return(0,c.U)("nav",{"aria-label":n,css:[f.root(y,i)]},I,(0,c.U)(a.h,{ariaLabel:`Previous page (${h+1})`,color:"icon-secondary",disabled:b<=0,href:t[h],icon:"arrowSmallLeft",onClick:createOnPaginateFn("previous",h,t[h]),tooltipPosition:"southwest"}),O,(0,c.U)(a.h,{ariaLabel:`Next page (${m+1})`,color:"icon-secondary",disabled:b>=g,href:t[m],icon:"arrowSmallRight",onClick:createOnPaginateFn("next",m,t[m]),tooltipPosition:"southeast"}),x)}},93201:function(e,t,n){n.d(t,{Z:function(){return addMonths}});var r=n(95661),a=n(60922),o=n(75105);function addMonths(e,t){(0,o.Z)(2,arguments);var n=(0,a.Z)(e),i=(0,r.Z)(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var l=n.getDate(),s=new Date(n.getTime());return(s.setMonth(n.getMonth()+i+1,0),l>=s.getDate())?s:(n.setFullYear(s.getFullYear(),s.getMonth(),l),n)}},57199:function(e,t,n){n.d(t,{Z:function(){return differenceInCalendarDays}});var r=n(37652),a=n(19652),o=n(75105);function differenceInCalendarDays(e,t){(0,o.Z)(2,arguments);var n=(0,a.Z)(e),i=(0,a.Z)(t);return Math.round((n.getTime()-(0,r.Z)(n)-(i.getTime()-(0,r.Z)(i)))/864e5)}},70278:function(e,t,n){n.d(t,{Z:function(){return differenceInCalendarMonths}});var r=n(60922),a=n(75105);function differenceInCalendarMonths(e,t){(0,a.Z)(2,arguments);var n=(0,r.Z)(e),o=(0,r.Z)(t);return 12*(n.getFullYear()-o.getFullYear())+(n.getMonth()-o.getMonth())}},44001:function(e,t,n){n.d(t,{Z:function(){return getDate}});var r=n(60922),a=n(75105);function getDate(e){return(0,a.Z)(1,arguments),(0,r.Z)(e).getDate()}},82489:function(e,t,n){n.d(t,{Z:function(){return getMonth}});var r=n(60922),a=n(75105);function getMonth(e){return(0,a.Z)(1,arguments),(0,r.Z)(e).getMonth()}},22438:function(e,t,n){n.d(t,{Z:function(){return lastDayOfMonth}});var r=n(60922),a=n(75105);function lastDayOfMonth(e){(0,a.Z)(1,arguments);var t=(0,r.Z)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}},17471:function(e,t,n){n.d(t,{Z:function(){return min}});var r=n(86522),a=n(60922),o=n(75105);function min(e){var t,n;if((0,o.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==(0,r.Z)(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach(function(e){var t=(0,a.Z)(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)}),n||new Date(NaN)}}}]);