forked from sindresorhus/awesome
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
245-79aaeff9f38d7088.js.download
234 lines (219 loc) · 16.5 KB
/
245-79aaeff9f38d7088.js.download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[245],{61446:function(e,t,i){"use strict";i.d(t,{l:function(){return FormLabel}});var n=i(28165),r=i(39479),a=i(77293),o=i(99029),s=i(3e3);let l=(0,r.B)("FormLabelRequiredText",{root:Object.assign(Object.assign({},s.ZT.smallPrint1),{color:o.w.neutral700,textTransform:"lowercase","&::before":{content:'"("'},"&::after":{content:'")"'},'&[data-state="disabled"]':{color:o.w.neutral500}})}),FormLabelRequiredText=({children:e="Required",isDisabled:t=!1})=>(0,a.U)("span",{"aria-hidden":"true",css:l.root,"data-state":t?"disabled":void 0},e),d=(0,r.B)("FormLabel",{root:n.iv`
display: grid;
justify-content: start;
grid-gap: 5px;
grid-auto-flow: column;
grid-auto-columns: auto;
cursor: pointer;
color: ${o.w.neutral700};
&[data-align-items='center'] {
align-items: center;
}
&[data-align-items='start'] {
align-items: start;
}
&[data-justify-content='start'] {
justify-content: start;
}
&[data-justify-content='stretch'] {
justify-content: stretch;
}
&[data-state~='selected'] {
color: ${o.w.blue};
}
&[data-state~='errored'] {
color: ${o.w.error400};
}
&[data-state~='disabled'] {
cursor: not-allowed;
}
&[data-state~='disabled'] {
color: ${o.w.neutral500};
}
&[data-size='small'] {
${s.ZT.smallPrint1Semibold};
}
&[data-size='medium'] {
${s.ZT.paragraph3Medium};
}
&[data-size='medium'][data-state='selected'] {
${s.ZT.paragraph3Semibold}
}
`}),FormLabel=({children:e,alignItems:t="center",htmlFor:i,isDisabled:n,isErrored:r,isRequired:o,isSelected:s,justifyContent:l="start",requiredText:c,size:u="medium"})=>(0,a.U)("label",{css:d.root,"data-align-items":t,"data-justify-content":l,"data-size":u,"data-state":[s&&"selected",r&&"errored",n&&"disabled"].filter(Boolean).join(" ")||void 0,htmlFor:i},o&&"*",e,o?c?(0,a.U)(FormLabelRequiredText,{isDisabled:n},c):(0,a.U)(FormLabelRequiredText,{isDisabled:n}):null)},74936:function(e,t,i){"use strict";i.d(t,{v:function(){return Menu}});var n=i(95945),r=i(39479),a=i(77293);let o=(0,r.B)("Menu",{root:{overflow:"auto"}}),Menu=e=>(0,a.U)("ul",Object.assign({css:o.root,role:e.role},(0,n.v)(e)),e.children)},75725:function(e,t,i){"use strict";i.d(t,{s:function(){return MenuItem}});var n=i(39479),r=i(52676),a=i(77293),o=i(26215),s=i(3e3),l=i(99029);let d=(0,n.B)("MenuItem",{content:e=>[Object.assign(Object.assign({},s.ZT.paragraph3Medium),{alignItems:"center",borderRadius:3,color:l.w.neutral700,display:"flex",height:44,lineHeight:"44px",padding:"0 10px",textDecoration:"none",outline:"none",width:"100%","&:not([disabled]):hover, &:not([disabled]):focus":{backgroundColor:l.w.blue10,color:l.w.blue,fontWeight:e.isSelected?600:500},"&[disabled]":{color:l.w.neutral500,cursor:"not-allowed"}}),e.isSelected&&(0,r.Q)("selected",{backgroundColor:l.w.neutral200,fontWeight:600})],text:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),MenuItem=e=>{let t=e.href&&!e.disabled?o.r:"button",i=t===o.r,n=e.isSelected?`${e.ariaLabel||e.children}, selected`:e.ariaLabel,r=i?{ariaLabel:n,href:e.href,rel:e.rel}:{"aria-label":n,type:"button",disabled:e.disabled},s=e.role?{role:"none"}:null;return(0,a.U)("li",Object.assign({},s),(0,a.U)(t,Object.assign({},r,{component:i?e.component:void 0,color:i?null:void 0,css:d.content(e),href:e.href,onClick:e.onClick,role:e.role}),(0,a.U)("span",{css:d.text},e.children)))}},1795:function(e,t,i){"use strict";i.d(t,{Z:function(){return ToggleSwitch}});var n=i(28165),r=i(87593),a=i(22211),o=i(95945),s=i(3e3),l=i(99029),d=i(98628),c=i(39479),u=i(52676),p=i(77293);let f=(0,c.B)("ToggleSwitch",{root:e=>[n.iv`
${s.ZT.paragraph3Bold};
align-items: stretch;
color: ${l.w.neutral800};
cursor: pointer;
display: inline-flex;
overflow: hidden;
border: ${`1px solid ${l.w.neutral600}`};
transition: all ${d.f.transitionDuration} ease-in-out;
&:focus-within:not(:hover) {
box-shadow: 0 0 0 2px ${l.w.blue};
border-color: transparent;
}
`,"small"===e.size&&(0,u.Q)(e.size,n.iv`
width: 40px;
height: 22px;
border-radius: 20px;
font-size: 0px;
line-height: 0px;
padding: 3px;
`),"medium"===e.size&&(0,u.Q)(e.size,n.iv`
min-width: 60px;
height: 44px;
border-radius: 30px;
padding: 6px;
`),!e.checked&&(0,u.Q)("unchecked",n.iv`
background-color: ${l.w.neutral200};
`),e.checked&&(0,u.Q)("checked",n.iv`
background-color: ${l.w.success100};
border: ${`1px solid ${l.w.success400}`};
`),e.indeterminate&&(0,u.Q)("indeterminate",n.iv`
background-color: ${l.w.warning200};
`),(e.disabled||e.isLoading)&&(0,u.Q)("disabled",n.iv`
background-color: ${l.w.neutral200};
color: ${l.w.neutral500};
cursor: not-allowed;
border: ${`1px solid ${l.w.neutral600}`};
`)],innerWrap:n.iv`
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
`,input:n.iv`
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: -1;
`,spinner:[n.iv`
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
`],text:e=>[n.iv`
display: grid;
// Define to allow 'textInner' nodes to easily stack
// on top of each other while preserving their widths,
// setting up the layout for a nice transition.
grid-template-areas: 'text';
width: 100%;
user-select: none;
text-align: center;
transition: padding ${d.f.transitionDuration} ease-in-out;
`,!e.checked&&(0,u.Q)(`unchecked-${e.size}`,{paddingLeft:"calc(30px + 8px)",paddingRight:0}),e.checked&&(0,u.Q)(`checked-${e.size}`,{paddingLeft:0,paddingRight:"calc(30px + 8px)"}),e.indeterminate&&(0,u.Q)("indeterminate",n.iv`
padding-left: 0;
padding-right: 0;
`),e.isLoading&&(0,u.Q)("loading",n.iv`
visibility: hidden;
height: 0;
`)],textInner:({isHidden:e})=>[n.iv`
// See note at 'grid-template-areas' definition.
grid-area: text;
transition: opacity 0.1s ease-in-out;
`,e&&(0,u.Q)("hidden",n.iv`
opacity: 0;
`)],dot:e=>[n.iv`
display: block;
border-radius: 100%;
background-color: ${l.w.neutral600};
position: absolute;
top: 0;
transition: all ${d.f.transitionDuration} ease-in-out;
width: 30px;
height: 30px;
`,!e.checked&&(0,u.Q)("unchecked",n.iv`
left: 0;
transform: translateX(0);
`),e.checked&&(0,u.Q)("checked",n.iv`
background-color: ${l.w.success400};
left: 100%;
transform: translateX(-100%);
`),e.disabled&&(0,u.Q)("disabled",n.iv`
background-color: ${l.w.neutral400};
`),e.isLoading&&(0,u.Q)("loading",n.iv`
visibility: hidden;
height: 0;
`)]}),InnerText=({children:e,isHidden:t})=>(0,p.U)("span",{"aria-hidden":"true",css:f.textInner({isHidden:t})},e),getAriaLabel=e=>e.ariaLabel?e.ariaLabel:e.isLoading?"Loading":e.indeterminate?"string"==typeof e.indeterminateText?e.indeterminateText:"Indeterminate":e.checked?e.checkedText:e.uncheckedText,getTooltipContent=e=>e.disabled&&e.showDisabledTooltip?"Disabled":"",ToggleSwitch=({ariaLabel:e,checked:t,checkedText:i="On",disabled:n,id:s,indeterminate:l,indeterminateText:d="N/A",isLoading:c=!1,name:u,onChange:h=()=>{},showDisabledTooltip:m=!0,size:b="medium",uncheckedText:g="Off",value:v})=>{let x={ariaLabel:e,checked:t,checkedText:i,disabled:n,id:s,indeterminate:l,indeterminateText:d,isLoading:c,name:u,onChange:h,showDisabledTooltip:m,size:b,uncheckedText:g,value:v};return(0,p.U)(r.p,{content:getTooltipContent(x)},({childProps:e})=>(0,p.U)("label",Object.assign({},(0,o.v)(e),{css:f.root(x)}),(0,p.U)("span",{css:f.innerWrap},(0,p.U)("input",{"aria-disabled":x.disabled||x.isLoading,"aria-label":getAriaLabel(x),checked:x.checked,css:f.input,disabled:x.disabled||x.isLoading,id:x.id,name:x.name,onChange:x.onChange,type:"checkbox",value:x.value}),x.isLoading&&(0,p.U)("span",{css:f.spinner},(0,p.U)(a.$,null)),(0,p.U)("span",{css:f.text(x)},(0,p.U)(InnerText,{isHidden:x.indeterminate||!!x.checked},x.uncheckedText),(0,p.U)(InnerText,{isHidden:x.indeterminate||!x.checked},x.checkedText),(0,p.U)(InnerText,{isHidden:!x.indeterminate},x.indeterminateText)),!x.indeterminate&&!x.isLoading&&(0,p.U)("span",{"aria-hidden":"true",css:f.dot(x),role:"presentation"}))))}},60943:function(e,t,i){"use strict";i.d(t,{W:function(){return LoadMoreBar}});var n=i(22211),r=i(20110),a=i(77293);let LoadMoreBar=e=>{let{children:t,isLoading:i,onClick:o,size:s}=e,l=(0,a.U)("span",{css:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"13.2px"}},(0,a.U)(n.$,{color:"black",ariaLabel:"loading icon"}),"Loading");return(0,a.U)(r.z,{color:"secondary",disabled:i,isFullWidth:!0,onClick:o,size:s},i?l:t)}},91451:function(e,t,i){"use strict";i.d(t,{I:function(){return AutoTabs}});var n=i(2784),r=i(77293),a=i(53583),o=i(99929),__rest=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)0>t.indexOf(n[r])&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i};let AutoTabs=e=>{var{items:t,selectedItemHref:i,shouldRenderTrack:s=!0,onChooseItem:l=()=>{}}=e,d=__rest(e,["items","selectedItemHref","shouldRenderTrack","onChooseItem"]);let c=(0,n.useRef)(null),[u,p]=(0,n.useState)(t);return(0,n.useLayoutEffect)(()=>{let e=c.current,t=!!e&&e.scrollWidth>e.offsetWidth;if(t){let e=u.some(e=>e.isExtra),t=e?u.findIndex(e=>e.isExtra):u.length;p(u.map((e,i)=>i<t-1?e:Object.assign(Object.assign({},e),{isExtra:!0})))}},[u]),(0,n.useLayoutEffect)(()=>{let e=(0,o.D)(()=>{p([...t])},100);return window.addEventListener("resize",e,{capture:!0}),()=>{window.removeEventListener("resize",e,{capture:!0})}}),(0,n.useEffect)(()=>p([...t]),[t]),(0,r.U)(a.m,Object.assign({},d,{forwardedRef:c,items:u,selectedItemHref:i,onChooseItem:l,shouldRenderTrack:s}))}},53583:function(e,t,i){"use strict";i.d(t,{m:function(){return Tabs}});var n=i(2784),r=i(28165),a=i(26215),o=i(3e3),s=i(99029),l=i(39479),d=i(52676),c=i(77293),u=i(15504),p=i(67762),f=i(75725),h=i(74936),m=i(37168);let b=(0,l.B)("TabsDropdown",{root:r.iv`
position: relative;
`,summary:r.iv`
// Hides default icon on details element
&::-webkit-details-marker {
display: none;
}
&::before {
display: none;
}
`,menu:r.iv`
padding: 10px;
min-width: 250px;
`}),TabsDropdown=e=>{let[t,i]=(0,n.useState)(!1),r=e.items.map(t=>(0,c.U)(f.s,{disabled:t.disabled,href:t.href,isSelected:t.href===e.selectedItemHref,key:t.href,onClick:n=>{i(!1),e.onChooseItem(t,n)}},t.text)),[a]=(0,m.O)({onClickOutside:()=>{i(!1)}});return(0,c.U)("div",Object.assign({ref:a},{onKeyUp:e=>{"Escape"===e.key&&i(!1)}}),(0,c.U)(p.h,{color:"icon-primary",icon:"navMoreHoriz",label:"More items…",ariaExpanded:t,onClick:()=>i(!t),size:{medium:"xsmall",large:"small"}[e.size],tooltipPosition:"west"}),t&&(0,c.U)(u.f,{align:"right"},(0,c.U)("div",{css:b.menu},(0,c.U)(h.v,{ariaLabel:""},r))))},g=(0,l.B)("Tabs",{root:e=>[r.iv`
${o.ZT.paragraph3Semibold}
position: relative;
display: grid;
grid-template-columns: 1fr auto;
column-gap: 20px;
row-gap: 2px;
align-items: center;
`,"medium"===e&&(0,d.Q)("medium",r.iv`
height: 50px;
`),"large"===e&&(0,d.Q)("large",r.iv`
height: 70px;
`)],primary:({count:e})=>[r.iv`
display: grid;
height: 100%;
// Allow shrinking
min-width: 0;
max-width: 100%;
`,(0,d.Q)(`count-${e}`,r.iv`
grid-template-columns: repeat(${e}, minmax(auto, min-content));
`)],item:({isSelected:e})=>[r.iv`
display: flex;
align-items: center;
justify-content: center;
text-align: center;
color: ${s.w.neutral800};
font-weight: 600;
text-decoration: none;
padding: 0 20px;
&:not([disabled]):hover,
&:not([disabled]):focus {
color: ${s.w.blue};
outline: none;
}
&[disabled] {
color: ${s.w.neutral500};
cursor: not-allowed;
}
`,e&&(0,d.Q)("selected",r.iv`
color: ${s.w.blue};
`)],itemText:r.iv`
display: block;
white-space: nowrap;
`,indicatorTrack:e=>[r.iv`
position: absolute;
bottom: 0;
left: 0;
right: 0;
// This ends up being a non-integer, but it actually renders better
// in Chrome (and still renders fine in other browsers) this way.
border-radius: ${1.5}px;
height: ${3}px;
overflow: hidden;
`,e&&(0,d.Q)("visible",r.iv`
background-color: ${s.w.neutral300};
`)],indicator:r.iv`
position: absolute;
height: inherit;
border-radius: inherit;
background-color: ${s.w.blue};
transition: all 250ms ease-in-out;
`}),TabsItem=e=>e.disabled?(0,c.U)("button",{type:"button","aria-label":e.ariaLabel,css:g.item(e),disabled:!0},(0,c.U)("span",{css:g.itemText},e.text)):(0,c.U)(a.r,{ariaLabel:e.ariaLabel,ariaCurrent:e.isSelected?e.ariaCurrent:void 0,color:null,css:g.item(e),href:e.href,onClick:e.onChoose,ref:e.forwardedRef},(0,c.U)("span",{css:g.itemText},e.text)),Tabs=({items:e,selectedItemHref:t,forwardedRef:i,ariaLabel:r,ariaCurrent:a="page",isItemSelected:o=(e,t)=>e.href===t,onChooseItem:s=()=>{},shouldRenderTrack:l=!0,size:d="large"})=>{let u=(0,n.useRef)(null),[p,f]=(0,n.useState)({}),h=!e.every(e=>e.isExtra),m=e.filter(e=>!e.isExtra),b=m.map(e=>{let i=o(e,t);return(0,c.U)(TabsItem,Object.assign({},e,{ariaCurrent:a,forwardedRef:i&&h?u:null,isSelected:i,key:e.href,onChoose:t=>s(e,t)}))}),v=e.filter(e=>e.isExtra),x=v.some(e=>o(e,t)),w=v.length>0&&(0,c.U)("div",{ref:x&&h?u:null},(0,c.U)(TabsDropdown,{size:d,items:v,onChooseItem:s,selectedItemHref:t}));return(0,n.useEffect)(()=>{let e=requestAnimationFrame(()=>{f(u.current?{left:u.current.offsetLeft,width:u.current.offsetWidth}:{})});return()=>cancelAnimationFrame(e)},[e,t]),(0,c.U)("nav",{"aria-label":r,css:g.root(d)},(0,c.U)("div",{css:g.primary({count:b.length}),ref:i},b),w,(0,c.U)("div",{css:g.indicatorTrack(l)},(0,c.U)("div",{css:g.indicator,style:p})))}},99929:function(e,t,i){"use strict";i.d(t,{D:function(){return debounce}});let debounce=(e,t)=>{let i;return(...n)=>{clearTimeout(i),i=setTimeout(()=>{e(...n)},t)}}},51704:function(e,t,i){var n=i(52153),r=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(r,""):e}},52153:function(e){var t=/\s/;e.exports=function(e){for(var i=e.length;i--&&t.test(e.charAt(i)););return i}},54073:function(e,t,i){var n=i(29259),r=i(61100),a=i(7642),o=Math.max,s=Math.min;e.exports=function(e,t,i){var l,d,c,u,p,f,h=0,m=!1,b=!1,g=!0;if("function"!=typeof e)throw TypeError("Expected a function");function invokeFunc(t){var i=l,n=d;return l=d=void 0,h=t,u=e.apply(n,i)}function shouldInvoke(e){var i=e-f,n=e-h;return void 0===f||i>=t||i<0||b&&n>=c}function timerExpired(){var e,i,n,a=r();if(shouldInvoke(a))return trailingEdge(a);p=setTimeout(timerExpired,(e=a-f,i=a-h,n=t-e,b?s(n,c-i):n))}function trailingEdge(e){return(p=void 0,g&&l)?invokeFunc(e):(l=d=void 0,u)}function debounced(){var e,i=r(),n=shouldInvoke(i);if(l=arguments,d=this,f=i,n){if(void 0===p)return h=e=f,p=setTimeout(timerExpired,t),m?invokeFunc(e):u;if(b)return clearTimeout(p),p=setTimeout(timerExpired,t),invokeFunc(f)}return void 0===p&&(p=setTimeout(timerExpired,t)),u}return t=a(t)||0,n(i)&&(m=!!i.leading,c=(b="maxWait"in i)?o(a(i.maxWait)||0,t):c,g="trailing"in i?!!i.trailing:g),debounced.cancel=function(){void 0!==p&&clearTimeout(p),h=0,l=f=d=p=void 0},debounced.flush=function(){return void 0===p?u:trailingEdge(r())},debounced}},61100:function(e,t,i){var n=i(37772);e.exports=function(){return n.Date.now()}},7642:function(e,t,i){var n=i(51704),r=i(29259),a=i(4795),o=0/0,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,d=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return o;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var i=l.test(e);return i||d.test(e)?c(e.slice(2),i?2:8):s.test(e)?o:+e}},2357:function(e,t,i){"use strict";i.d(t,{Z:function(){return isSameDay}});var n=i(19652),r=i(75105);function isSameDay(e,t){(0,r.Z)(2,arguments);var i=(0,n.Z)(e),a=(0,n.Z)(t);return i.getTime()===a.getTime()}}}]);