Build 533169stable
Module 939249
1,182 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{D:()=>l});var r=n(627968),i=n(64700),s=n(531142),a=n(426333),o=n(650583);class l extends i.Component{ref;static contextType=s.g;static defaultProps={tag:"div",role:"button",tabIndex:0};handleKeyPress=e=>{let{onClick:t,href:n,onKeyPress:r,ignoreKeyPress:i}=this.props;e.repeat||(i||null==t||null==this.ref||e.key!==o.dh.SPACE&&e.key!==o.dh.ENTER||(null==n&&e.preventDefault(),null==this.ref.click?t(e):this.ref.click()),null!=r&&r(e))};setRef=e=>{this.ref=e;let{innerRef:t}=this.props;null!=t&&("function"==typeof t?t(e):t.hasOwnProperty("current")&&(t.current=e))};renderNonInteractive(){let{tag:e,focusProps:t,innerRef:n,onClick:r,role:s,tabIndex:a,ignoreKeyPress:o,...l}=this.props;return i.createElement(e,{ref:this.setRef,...l})}renderInner(){let{tag:e,onClick:t,className:n,children:r,focusProps:s,innerRef:a,ignoreKeyPress:o,...l}=this.props;return null==t?i.createElement(e,{ref:this.setRef,className:n,...l},r):i.createElement(e,{onClick:t,ref:this.setRef,onKeyPress:this.handleKeyPress,className:n,...l},r)}render(){return this.context?this.renderNonInteractive():(0,r.jsx)(a.vN,{...this.props.focusProps,children:this.renderInner()})}}}