-
Notifications
You must be signed in to change notification settings - Fork 0
/
3310-99f291af6c0e95113526.js
1 lines (1 loc) · 45.5 KB
/
3310-99f291af6c0e95113526.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[3310],{63310:(n,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>w});var t=s(73450),e=s(73118),o=s(27378),p=s(57318),c=s(33938),l=s(86446),i=s(39215),u=s(14623),r=s(24246);function k(n,a){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.push.apply(s,t)}return s}function d(n){for(var a=1;a<arguments.length;a++){var s=null!=arguments[a]?arguments[a]:{};a%2?k(Object(s),!0).forEach((function(a){(0,t.Z)(n,a,s[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):k(Object(s)).forEach((function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))}))}return n}var m=function(){function n(n){var s=o.useState(null),t=(0,e.Z)(s,2),p=t[0],i=t[1],u=o.useState(!0),k=(0,e.Z)(u,2),m=k[0],f=k[1],h=o.useCallback((()=>i("Waypoint enter")),[]),v=o.useCallback((()=>i("Waypoint leave")),[]),g=o.useCallback((n=>f(n.target.checked)),[]),y=o.useMemo((()=>m?{topOffset:"auto",bottomOffset:"auto"}:{}),[m]);return(0,r.jsxs)("div",{className:"waypoint-demo-basic",children:[(0,r.jsx)("div",{style:{marginBottom:16},children:(0,r.jsx)(c.X,{checked:m,onChange:g,children:"Guess topOffset and bottomOffset"})}),p?(0,r.jsx)("div",{className:"waypoint-demo-basic__message",children:p}):null,(0,r.jsxs)("div",{className:"waypoint-demo-basic__scrollable-parent",children:[(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(l.h,d({onEnter:h,onLeave:v},y)),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{}),(0,r.jsx)(a,{})]})]})}function a(){return(0,r.jsx)("div",{className:"waypoint-demo-basic__spacer",children:(0,r.jsx)(i.J,{type:"down"})})}return(0,r.jsx)(n,{})},f=function(){function n(n){var a=o.useState(!1),s=(0,e.Z)(a,2),t=s[0],p=s[1],c=o.useCallback((()=>p(!0)),[]),i=o.useCallback((()=>p(!1)),[]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.h,{onEnter:c,onLeave:i}),(0,r.jsx)(u.Z,{in:t,timeout:500,classNames:"waypoint-demo-reveal",unmountOnExit:!0,children:n.children})]})}function a(a){return(0,r.jsx)("div",{className:"waypoint-demo-reveal",children:(0,r.jsxs)("div",{className:"waypoint-demo-reveal__scrollable-parent",children:[(0,r.jsx)(s,{}),(0,r.jsx)(s,{}),(0,r.jsx)(s,{}),(0,r.jsx)(n,{children:(0,r.jsx)("p",{className:"waypoint-demo-reveal-text",children:"Surely You're Joking, Mr. Feynman!"})}),(0,r.jsx)(s,{}),(0,r.jsx)(s,{}),(0,r.jsx)(s,{})]})})}function s(){return(0,r.jsx)("div",{className:"waypoint-demo-reveal__spacer",children:(0,r.jsx)(i.J,{type:"down",className:"waypoint-demo-reveal-pulse"})})}return(0,r.jsx)(a,{})};function h(n){return(0,r.jsx)(n.tag,d(d({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function v(n){return(0,r.jsx)(h,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function g(n){return(0,r.jsx)(h,{tag:"style",html:n.style})}function y(n,a){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(a+=n.offsetTop),y(n.parentNode,a);return a}class b extends o.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{showCode:!1}),(0,t.Z)(this,"toggle",(()=>{this.setState({showCode:!this.state.showCode})}))}render(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,e=a.children;return(0,r.jsxs)("div",{className:"zandoc-react-demo",children:[(0,r.jsx)("div",{className:"zandoc-react-demo__preview",children:e}),(0,r.jsxs)("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle,children:[(0,r.jsx)("div",{className:"zandoc-react-demo__title",children:(0,r.jsx)("p",{children:s||""})}),(0,r.jsx)("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})]}),n&&(0,r.jsx)("pre",{className:"zandoc-react-demo__code",children:(0,r.jsx)(h,{tag:"code",html:t,attributes:{className:"language-jsx"}})})]})}}class w extends o.Component{componentDidMount(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&(0,p.l)(document.documentElement,0,y(a,-9))}}render(){return o.createElement("div",{className:"zandoc-react-container"},o.createElement(g,{style:".waypoint-demo-basic .zent-waypoint-marker {\n\tdisplay: block;\n\theight: 4px;\n\tbackground: #d40000;\n}\n\n.waypoint-demo-basic__scrollable-parent {\n max-height: 400px;\n overflow: scroll;\n position: relative;\n\tborder: 20px solid rgba(21, 91, 212, 0.2);\n}\n\n.waypoint-demo-basic__spacer {\n color: #969799;\n font-size: 40px;\n line-height: 200px;\n text-align: center;\n}\n\n.waypoint-demo-basic__message {\n\tbox-sizing: border-box;\n background-color: #f2f3f5;\n color: #323233;\n opacity: 0.8;\n padding: 10px 0;\n pointer-events: none;\n text-align: center;\n width: 100%;\n}\n\n.waypoint-demo-reveal {\n position: relative;\n}\n\n.waypoint-demo-reveal__scrollable-parent {\n max-height: 400px;\n overflow: scroll;\n position: relative;\n}\n\n.waypoint-demo-reveal__spacer {\n color: #969799;\n font-size: 40px;\n line-height: 200px;\n text-align: center;\n}\n\n.waypoint-demo-reveal-text {\n\ttransition: opacity 500ms, transform 500ms;\n\ttext-align: center;\n\tpadding: 10px 0;\n}\n\n.waypoint-demo-reveal-enter {\n\topacity: 0;\n\ttransform: scale(0.1);\n}\n\n.waypoint-demo-reveal-enter-active {\n\topacity: 1;\n\ttransform: scale(1);\n}\n\n.waypoint-demo-reveal-exit {\n\topacity: 1;\n\ttransform: scale(0.9);\n}\n\n.waypoint-demo-reveal-exit-active {\n\topacity: 0;\n\ttransform: scale(0);\n}"}),o.createElement(v,{html:'<h2 class="anchor-heading"><a href="#waypoint">¶</a><a href="javascript:void(0)" id="waypoint" class="anchor-point"></a>Waypoint</h2>\n<p>Invoke a callback when scrolling to some DOM node, can be used in any scrolling container.</p>\n<p><strong>Can be used to implement:</strong></p>\n<ul>\n<li>Image lazy load</li>\n<li>Infinite scroll</li>\n<li>Affix</li>\n</ul>\n<h3 class="anchor-heading"><a href="#demos">¶</a><a href="javascript:void(0)" id="demos" class="anchor-point"></a>Demos</h3>'}),o.createElement(b,{title:"Basic Usage",id:"Demo01basic",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Waypoint</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Checkbox</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Demo</span></span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">[</span>msg<span class="token punctuation">,</span> setMsg<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useState</span><span class="token punctuation">(</span><span class="token keyword null nil">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> <span class="token punctuation">[</span>autoBorderWidth<span class="token punctuation">,</span> setAutoBorderWidth<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useState</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> setEnterMsg <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setMsg</span><span class="token punctuation">(</span><span class="token string">\'Waypoint enter\'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> setLeaveMsg <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setMsg</span><span class="token punctuation">(</span><span class="token string">\'Waypoint leave\'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> setAuto <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token parameter">e</span> <span class="token arrow operator">=></span> <span class="token function">setAutoBorderWidth</span><span class="token punctuation">(</span>e<span class="token punctuation">.</span><span class="token property-access">target</span><span class="token punctuation">.</span><span class="token property-access">checked</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> autoProps <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useMemo</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> autoBorderWidth <span class="token operator">?</span> <span class="token punctuation">{</span>\n topOffset<span class="token operator">:</span> <span class="token string">\'auto\'</span><span class="token punctuation">,</span>\n bottomOffset<span class="token operator">:</span> <span class="token string">\'auto\'</span>\n <span class="token punctuation">}</span> <span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>autoBorderWidth<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">style</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>marginBottom<span class="token operator">:</span> <span class="token number">16</span><span class="token punctuation">}</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Checkbox</span></span> <span class="token attr-name">checked</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>autoBorderWidth<span class="token punctuation">}</span></span> <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>setAuto<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n <span class="token maybe-class-name">Guess</span> topOffset and bottomOffset\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Checkbox</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>msg <span class="token operator">?</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic__message<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>msg<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span> <span class="token operator">:</span> <span class="token keyword null nil">null</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic__scrollable-parent<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Waypoint</span></span> <span class="token attr-name">onEnter</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>setEnterMsg<span class="token punctuation">}</span></span> <span class="token attr-name">onLeave</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>setLeaveMsg<span class="token punctuation">}</span></span> <span class="token spread"><span class="token punctuation">{</span><span class="token spread operator">...</span>autoProps<span class="token punctuation">}</span></span><span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Spacer</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic__spacer<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Icon</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>down<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Demo</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},o.createElement(m)),o.createElement(b,{title:"Reveal",id:"Demo02reveal",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Waypoint</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">CSSTransition</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'react-transition-group\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Reveal</span></span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">[</span>revealed<span class="token punctuation">,</span> setRevealed<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useState</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> reveal <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setRevealed</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> hide <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setRevealed</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Waypoint</span></span> <span class="token attr-name">onEnter</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>reveal<span class="token punctuation">}</span></span> <span class="token attr-name">onLeave</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>hide<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">CSSTransition</span></span>\n <span class="token attr-name">in</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>revealed<span class="token punctuation">}</span></span>\n <span class="token attr-name">timeout</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">500</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">classNames</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal<span class="token punctuation">"</span></span>\n <span class="token attr-name">unmountOnExit</span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>props<span class="token punctuation">.</span><span class="token property-access">children</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">CSSTransition</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Demo</span></span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal__scrollable-parent<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Reveal</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal-text<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token maybe-class-name">Surely</span> <span class="token maybe-class-name">You</span>\'re <span class="token maybe-class-name">Joking</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Mr</span><span class="token punctuation">.</span> <span class="token property-access"><span class="token maybe-class-name">Feynman</span></span><span class="token operator">!</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Reveal</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Spacer</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal__spacer<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Icon</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>down<span class="token punctuation">"</span></span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal-pulse<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Demo</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},o.createElement(f)),o.createElement(v,{html:'<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\n<table class="table">\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n<th>Type</th>\n<th>Required</th>\n<th>Default</th>\n<th>Alternative</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>onEnter</td>\n<td>Callback when element enters viewport</td>\n<td><code>(data: IWaypointCallbackData) => void</code></td>\n<td>No</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onLeave</td>\n<td>Callback when element leaves viewport</td>\n<td><code>(data: IWaypointCallbackData) => void</code></td>\n<td>No</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onPositionChange</td>\n<td>Callback when element position changes</td>\n<td><code>(data: IWaypointCallbackData) => void</code></td>\n<td>No</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>topOffset</td>\n<td>Offset to scrolling container top</td>\n<td><code>number</code>\n \n|\n \n<code>\'auto\'</code>\n \n|\n \n<code>string</code></td>\n<td>No</td>\n<td><code>0px</code></td>\n<td></td>\n</tr>\n<tr>\n<td>bottomOffset</td>\n<td>Offset to scrolling container bottom</td>\n<td><code>number</code>\n \n|\n \n<code>\'auto\'</code>\n \n|\n \n<code>string</code></td>\n<td>No</td>\n<td><code>0px</code></td>\n<td></td>\n</tr>\n<tr>\n<td>horizontal</td>\n<td>Use horizontal scroll</td>\n<td><code>boolean</code></td>\n<td>No</td>\n<td><code>false</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>scrollableAncestor</td>\n<td>Specify a scrolling container DOM node</td>\n<td><code>Element</code></td>\n<td>No</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>fireOnRapidScroll</td>\n<td>Trigger \n<code>onEnter</code>\n and \n<code>onLeave</code>\n on rapid scroll</td>\n<td><code>boolean</code></td>\n<td>No</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>children</td>\n<td>Element to track, you can think of the waypoint as a line across the container if omitted</td>\n<td><code>ReactNode</code></td>\n<td>No</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#topoffset-and-bottomoffset">¶</a><a href="javascript:void(0)" id="topoffset-and-bottomoffset" class="anchor-point"></a><code>topOffset</code> and <code>bottomOffset</code></h4>\n<ul>\n<li>Scroll container\'s <a href="https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model/Determining_the_dimensions_of_elements#what.27s_the_size_of_the_displayed_content.3f">scroll area</a> is <code>clientWidth</code>✖️<code>clientHeight</code>, but <code>getBoundingClientRect</code> returns <code>width</code> and <code>height</code> with <code>border</code> included. You need to set <code>topOffset</code> and <code>bottomOffset</code> if your scroll container has borders.</li>\n<li><code>topOffset</code> and <code>bottomOffset</code> can be positive or negative just like <code>margin</code>. Positive value pushes the boundaries inward the page, and negative value pushes boundaries outward the page.</li>\n<li>You can use percentage value in <code>topOffset</code> and <code>bottomOffset</code>, relative to its scrolling container.</li>\n<li>If <code>horizontal</code> is on, <code>topOffset</code> becomes <code>leftOffset</code>, and <code>bottomOffset</code> becomes <code>rightOffset</code>. Names are kept the same for simplicity\'s sake.</li>\n<li><code>topOffset</code> and <code>bottomOffset</code> can be set to <code>\'auto\'</code>, <code>Waypoint</code> will infer scroll container\'s border width and fall back to <code>0</code> if infer fails. Don\'t use <code>transform</code> on scroll container with <code>\'auto\'</code>.</li>\n</ul>\n<h3 class="anchor-heading"><a href="#faqs">¶</a><a href="javascript:void(0)" id="faqs" class="anchor-point"></a>FAQs</h3>\n<ul>\n<li><a href="../../apidoc/interfaces/IWaypointCallbackData.html">Definition of <code>IWaypointCallbackData</code></a>.</li>\n<li>A rapid scroll is when you scroll the page fast enough, the tracking element leaves the viewport immediately after it enters the viewport.</li>\n<li><code>children</code> can only be <strong>one</strong> element, it must be one of native DOM element, element returned from <code>React.forwardRef</code>, or an element with an <code>innerRef</code> prop. The <code>ref</code> must be properly passed to the tracking DOM node.</li>\n</ul>'}))}}},33938:(n,a,s)=>{"use strict";s.d(a,{X:()=>k});var t=s(59312),e=s(24246),o=s(60042),p=s.n(o),c=s(27378),l=s(1535),i=s(23130),u=s(1348),r=s(4008);function k(n){var a=(0,c.useContext)(u.d),s=(0,c.useContext)(i.Z),o=(0,c.useRef)(n);o.current=n;var r,k=s&&s.onChange,d=(0,c.useCallback)((function(n){var a=o.current,s=a.value,e=a.onChange;if(k)k(s);else if(e){var p=Object.create(n);p.target=(0,t.pi)((0,t.pi)({},o.current),{type:"checkbox",checked:n.target.checked}),e(p)}}),[k]),m=(n.checked,n.className),f=n.style,h=(n.disabled,n.readOnly,n.children),v=n.indeterminate,g=n.width,y=(n.value,n.labelStyle),b=n.onMouseEnter,w=n.onMouseLeave,x=(0,t._T)(n,["checked","className","style","disabled","readOnly","children","indeterminate","width","value","labelStyle","onMouseEnter","onMouseLeave"]),j=function(n,a){return"boolean"==typeof a.readOnly?a.readOnly:!!n&&n.readOnly}(s,n),O=function(n,a,s){return"boolean"==typeof s.disabled?s.disabled:a?a.disabled:n.value}(a,s,n);if(s){var C=s.value,S=s.isValueEqual;r=-1!==C.findIndex((function(a){return S(a,n.value)}))}else r=!!n.checked;return(0,e.jsxs)("label",(0,t.pi)({className:p()("zent-checkbox-wrap",m,{"zent-checkbox-checked":!!r,"zent-checkbox-disabled":O||j,"zent-checkbox-indeterminate":v}),style:(0,t.pi)((0,t.pi)({},f),(0,l.Z)(g)),onMouseEnter:b,onMouseLeave:w,"data-zv":"9.12.16"},{children:[(0,e.jsxs)("span",(0,t.pi)({className:"zent-checkbox","data-zv":"9.12.16"},{children:[(0,e.jsx)("span",{className:"zent-checkbox-inner","data-zv":"9.12.16"},void 0),(0,e.jsx)("input",(0,t.pi)({},x,{type:"checkbox",checked:r&&!v,disabled:O,readOnly:j,onChange:d,"data-zv":"9.12.16"}),void 0)]}),void 0),null!=h&&!0!==h&&!1!==h?(0,e.jsx)("div",(0,t.pi)({className:"zent-checkbox-label",style:y,"data-zv":"9.12.16"},{children:h}),void 0):null]}),void 0)}k.Group=r.Z,a.Z=k},4008:(n,a,s)=>{"use strict";s.d(a,{c:()=>k});var t=s(59312),e=s(24246),o=s(27378),p=s(60042),c=s.n(p),l=s(41925),i=s(23130),u=s(1348),r=i.Z.Provider,k=function(n){function a(){var a=null!==n&&n.apply(this,arguments)||this;return a.getGroupContext=(0,l.Z)((function(n,s,t,e){return{value:Array.isArray(n)?n:[],disabled:s,readOnly:t,isValueEqual:e,onChange:a.onCheckboxChange}})),a.onCheckboxChange=function(n){var s=a.props,t=s.isValueEqual,e=s.onChange,o=s.value;if(e){var p=o?o.slice():[],c=p.findIndex((function(a){return t(a,n)}));-1!==c?p.splice(c,1):p.push(n),e(p)}},a}return(0,t.ZT)(a,n),a.prototype.render=function(){var n=this.props,a=n.className,s=n.style,o=n.children,p=n.value,l=n.disabled,i=void 0===l?this.context.value:l,u=n.readOnly,k=void 0!==u&&u,d=n.isValueEqual,m=c()("zent-checkbox-group",a);return(0,e.jsx)(r,(0,t.pi)({value:this.getGroupContext(p,i,k,d)},{children:(0,e.jsx)("div",(0,t.pi)({className:m,style:s,"data-zv":"9.12.16"},{children:o}),void 0)}),void 0)},a.defaultProps={isValueEqual:Object.is,value:[]},a.contextType=u.d,a}(o.Component);a.Z=k},23130:(n,a,s)=>{"use strict";var t=s(27378);a.Z=(0,t.createContext)(null)},55978:(n,a,s)=>{"use strict";function t(n){for(var a=[],s=1;s<arguments.length;s++)a[s-1]=arguments[s];var t=setTimeout((function(){return n.apply(void 0,a)}),1);return{cancel:function(){clearTimeout(t)}}}s.d(a,{Z:()=>t})},1535:(n,a,s)=>{"use strict";function t(n){return"string"==typeof n||"number"==typeof n?{width:n}:{}}s.d(a,{Z:()=>t})},86446:(n,a,s)=>{"use strict";s.d(a,{h:()=>v});var t=s(59312),e=s(24246),o=s(27378),p=s(49744),c=s(19185);function l(n){return(0,c.isElement)(n)&&"string"==typeof n.type}function i(n){return n.viewportBottom-n.viewportTop==0?3:n.viewportTop<=n.waypointTop&&n.waypointTop<=n.viewportBottom||n.viewportTop<=n.waypointBottom&&n.waypointBottom<=n.viewportBottom||n.waypointTop<=n.viewportTop&&n.viewportBottom<=n.waypointBottom?1:n.viewportBottom<n.waypointTop?2:n.waypointTop<n.viewportTop?0:3}var u=s(79352),r=s(55978);function k(n){return f(n.toLowerCase())}function d(n,a,s){var t=f(n=n.toLowerCase());return null!==t?t:function(n,a,s){var t=h.exec(n);if(t){var e=parseFloat(t[1]);switch(t[2]){case"em":return null!==(o=a())?o*e:null;case"rem":var o;return null!==(o=s())?o*e:null;default:return null}}return null}(n,a,s)}var m=/(^-?\d*\.?\d+)(cm|mm|in|px|pt|pc)$/;function f(n){var a=m.exec(n);if(a){var s=parseFloat(a[1]);switch(a[2]){case"cm":return 9600*s/254;case"mm":return 960*s/254;case"in":return 96*s;case"pt":return 4*s/3;case"pc":return 16*s;case"px":return s;default:return null}}return null}var h=/(^-?\d*\.?\d+)(em|rem)$/,v=function(n){function a(){var a=null!==n&&n.apply(this,arguments)||this;return a.refElement=(0,o.createRef)(),a.previousPosition=4,a.handleScroll=function(n){if(a.refElement.current){var s=a.getBounds(),t=i(s),e=a.previousPosition,o=a.props,p=o.onPositionChange,c=o.onEnter,l=o.onLeave,u=o.fireOnRapidScroll;if(a.previousPosition=t,e!==t){var r={currentPosition:t,previousPosition:e,event:n,waypointTop:s.waypointTop,waypointBottom:s.waypointBottom,viewportTop:s.viewportTop,viewportBottom:s.viewportBottom};null==p||p(r),1===t?null==c||c(r):1!==e&&4!==e||null==l||l(r),u&&(2===e&&0===t||0===e&&2===t)&&(null==c||c({currentPosition:1,previousPosition:e,event:n,waypointTop:s.waypointTop,waypointBottom:s.waypointBottom,viewportTop:s.viewportTop,viewportBottom:s.viewportBottom}),null==l||l({currentPosition:t,previousPosition:1,event:n,waypointTop:s.waypointTop,waypointBottom:s.waypointBottom,viewportTop:s.viewportTop,viewportBottom:s.viewportBottom}))}}},a}return(0,t.ZT)(a,n),a.prototype.componentDidMount=function(){var n=this;u.Z&&(this.cancelOnNextTick=(0,r.Z)((function(){n.cancelOnNextTick=null,function(n,a){if(n&&!l(n)&&!a)throw new Error("<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a DOM element (e.g. <div>) nor does it use the innerRef prop.\n")}(n.props.children,n.refElement.current),n.scrollableAncestor=n.findScrollableAncestor(),n.scrollEventListenerUnsubscribe=(0,p.Oo)(n.scrollableAncestor,"scroll",n.handleScroll,{passive:!0}),n.resizeEventListenerUnsubscribe=(0,p.Oo)(window,"resize",n.handleScroll,{passive:!0}),n.handleScroll(null)})))},a.prototype.componentDidUpdate=function(){var n=this;u.Z&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=(0,r.Z)((function(){n.cancelOnNextTick=null,n.handleScroll(null)}))))},a.prototype.componentWillUnmount=function(){var n,a,s;u.Z&&(null===(n=this.scrollEventListenerUnsubscribe)||void 0===n||n.call(this),null===(a=this.resizeEventListenerUnsubscribe)||void 0===a||a.call(this),null===(s=this.cancelOnNextTick)||void 0===s||s.cancel())},a.prototype.findScrollableAncestor=function(){var n=this.props,a=n.horizontal,s=n.scrollableAncestor;if(s)return s;for(var t=this.refElement.current;t.parentNode;){if((t=t.parentNode)===document.body)return window;var e=getComputedStyle(t),o=(a?e.getPropertyValue("overflow-x"):e.getPropertyValue("overflow-y"))||e.getPropertyValue("overflow");if("auto"===o||"scroll"===o)return t}return window},a.prototype.getBounds=function(){var n,a,s=this.props.horizontal,t=this.refElement.current.getBoundingClientRect(),e=t.left,o=t.top,p=t.right,c=t.bottom,l=s?e:o,i=s?p:c;if(this.scrollableAncestor===window)n=s?window.innerWidth:window.innerHeight,a=0;else{var u=this.scrollableAncestor.getBoundingClientRect();n=s?u.width:u.height,a=s?u.left:u.top}return{waypointTop:l,waypointBottom:i,viewportTop:a+this.getOffset("top",n),viewportBottom:a+n-this.getOffset("bottom",n)}},a.prototype.getOffset=function(n,a){var s,t,e=this.props.horizontal,o=n+"Offset",p="top"===n?"border"+(e?"Left":"Top")+"Width":"border"+(e?"Right":"Bottom")+"Width",c=this.props[o];if("auto"!==c)return function(n,a){var s=function(n){var a;if(a="number"==typeof n?n:parseFloat(n),!Number.isNaN(a)&&Number.isFinite(a))return a}(n);if("number"==typeof s)return s;if("string"==typeof n){var t=function(n){if("%"===n.slice(-1))return parseFloat(n.slice(0,-1))/100}(n);if("number"==typeof t)return t*a}}(c,a);if(this.scrollableAncestor===window){var l=getComputedStyle(document.documentElement),i=function(){return k(l.fontSize)};return null!==(s=d(l[p],i,i))&&void 0!==s?s:0}var u=getComputedStyle(this.scrollableAncestor);return i=function(){return k(u.fontSize)},null!==(t=d(u[p],i,(function(){return k(getComputedStyle(document.documentElement).fontSize)})))&&void 0!==t?t:0},a.prototype.render=function(){var n=this,a=this.props.children;if(!a)return(0,e.jsx)("span",{ref:this.refElement,style:{fontSize:0},className:"zent-waypoint-marker","data-zv":"9.12.16"},void 0);var s=o.Children.only(a);return l(s)||(0,c.isForwardRef)(s)?(0,o.cloneElement)(s,{ref:function(a){n.refElement.current=a;var t=s.ref;t&&("function"==typeof t?t(a):t.current=a)}}):(0,o.cloneElement)(s,{innerRef:this.refElement})},a.defaultProps={topOffset:0,bottomOffset:0,horizontal:!1,fireOnRapidScroll:!0},a}(o.PureComponent)}}]);