@foxford/ui 2.0.0-beta-d4d193e-20220616 → 2.0.0-beta-c2f5825-20220621
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/components/ActionBtn/ActionBtn.js +1 -1
- package/components/ActionBtn/ActionBtn.js.map +1 -1
- package/components/Amount/Amount.js +1 -1
- package/components/Amount/Amount.js.map +1 -1
- package/components/Anchor/Anchor.js +1 -1
- package/components/Anchor/Anchor.js.map +1 -1
- package/components/Arrow/Arrow.js +1 -1
- package/components/Arrow/Arrow.js.map +1 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Avatar/Avatar.js.map +1 -1
- package/components/Badge/Badge.js +1 -1
- package/components/Badge/Badge.js.map +1 -1
- package/components/Button/Button.js +1 -1
- package/components/Button/Button.js.map +1 -1
- package/components/Checkbox/Checkbox.js +1 -1
- package/components/Checkbox/Checkbox.js.map +1 -1
- package/components/Container/Container.js +1 -1
- package/components/Container/Container.js.map +1 -1
- package/components/ContextMenu/ContextMenu.js +1 -1
- package/components/ContextMenu/ContextMenu.js.map +1 -1
- package/components/Icon/Icon.js +1 -1
- package/components/Icon/Icon.js.map +1 -1
- package/components/Input/Input.js +1 -1
- package/components/Input/Input.js.map +1 -1
- package/components/Modal/Modal.js +1 -1
- package/components/Modal/Modal.js.map +1 -1
- package/components/Paper/Paper.js +1 -1
- package/components/Paper/Paper.js.map +1 -1
- package/components/Progress/Progress.js +1 -1
- package/components/Progress/Progress.js.map +1 -1
- package/components/Radio/Radio.js +1 -1
- package/components/Radio/Radio.js.map +1 -1
- package/components/Scrollable/Scrollable.js +1 -1
- package/components/Scrollable/Scrollable.js.map +1 -1
- package/components/Section/Section.js +1 -1
- package/components/Section/Section.js.map +1 -1
- package/components/Select/Select.js +1 -1
- package/components/Select/Select.js.map +1 -1
- package/components/Separator/Separator.js +1 -1
- package/components/Separator/Separator.js.map +1 -1
- package/components/Spacer/Spacer.js +1 -1
- package/components/Spacer/Spacer.js.map +1 -1
- package/components/Spinner/Spinner.js +1 -1
- package/components/Spinner/Spinner.js.map +1 -1
- package/components/Switcher/Switcher.js +1 -1
- package/components/Switcher/Switcher.js.map +1 -1
- package/components/Tabs/style.js +1 -1
- package/components/Tabs/style.js.map +1 -1
- package/components/Tag/Tag.js +1 -1
- package/components/Tag/Tag.js.map +1 -1
- package/components/Text/Text.js +1 -1
- package/components/Text/Text.js.map +1 -1
- package/components/Text.Ellipse/Text.Ellipse.js +1 -1
- package/components/Text.Ellipse/Text.Ellipse.js.map +1 -1
- package/components/Textarea/Textarea.js +1 -1
- package/components/Textarea/Textarea.js.map +1 -1
- package/components/Tooltip/Tooltip.js +1 -1
- package/components/Tooltip/Tooltip.js.map +1 -1
- package/dts/index.d.ts +48 -5
- package/index.cjs.js +1 -1
- package/index.cjs.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from'@babel/runtime/helpers/esm/objectSpread2';import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import{PureComponent as r}from'react';import{Scrollbars as o}from'rc-scrollbars';import{withTheme as a}from'styled-components';import{jsx as l,jsxs as s}from'react/jsx-runtime';var i=["style"],h=["style"],c=["children","withShadow","shadowHeight","shadowColor","shadowOpacity","className","thumbColor","thumbOpacity","thumbBorderRadius","thumbWidth","trackColor","trackOpacity","trackBorderRadius","trackWidth","isolate","style","disabled"];class n extends r{constructor(){super(...arguments),this.scrollable=null,this.ts=0,this.state={scrollTop:0,scrollHeight:0,clientHeight:0},this.handleTouchStart=t=>{this.ts=t.touches[0].clientY},this.handleTouchMove=t=>{if(!this.props.isolate||!this.scrollable)return!0;var e=this.scrollable.parentNode;if(e){var r=t.changedTouches[0].clientY;var o=this.ts>r?-1:1;var a=1===o&&0===e.scrollTop;var l=-1===o&&Math.floor(e.scrollTop)===e.scrollHeight-e.clientHeight;return(a||l)&&(t.preventDefault(),this.ts=r),!0}},this.handleScroll=t=>{if(!this.props.isolate||!this.scrollable)return!0;var e=this.scrollable.parentNode;if(e){var r=(t.deltaY||t.detail)<0?1:-1;return(1===r&&0===e.scrollTop||-1===r&&e.scrollTop===e.scrollHeight-e.clientHeight)&&t.preventDefault(),!0}},this.handleUpdate=t=>{var{scrollTop:e,scrollHeight:r,clientHeight:o}=t;this.setState({scrollTop:e,scrollHeight:r,clientHeight:o})},this.hexToRgb=t=>{var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},this.renderTrack=(r,o)=>{var{style:a}=r,s=e(r,i);var{trackColor:h,trackOpacity:c,trackBorderRadius:n,trackWidth:d}=this.props;var p=h?this.hexToRgb(h):null;var u=t({background:p?"rgba(".concat(p.r,", ").concat(p.g,", ").concat(p.b,", ").concat(c,")"):"rgba(255,255,255,0)",borderRadius:"".concat(n,"px"),zIndex:14},'vertical'===o?{right:4,top:2,bottom:2,width:"".concat(d,"px")}:{bottom:4,left:2,right:2,height:"".concat(d,"px")});return l("div",t({style:t(t({},a),u)},s))},this.renderThumb=r=>{var{style:o}=r,a=e(r,h);var{thumbColor:s,thumbOpacity:i,thumbBorderRadius:c,thumbWidth:n}=this.props;var d={opacity:i,backgroundColor:this.props.theme.colors[s]||this.props.theme.colors[s],borderRadius:"".concat(c,"px"),width:"".concat(n,"px")};return l("div",t({style:t(t({},o),d)},a))}}componentDidMount(){this.scrollable&&this.scrollable.parentNode&&(this.scrollable.parentNode.addEventListener('touchstart',this.handleTouchStart,!1),this.scrollable.parentNode.addEventListener('touchmove',this.handleTouchMove,!1),this.scrollable.parentNode.addEventListener('wheel',this.handleScroll,!1),this.scrollable.parentNode.addEventListener('scroll',this.handleScroll,!1))}componentWillUnmount(){this.scrollable&&this.scrollable.parentNode&&(this.scrollable.parentNode.removeEventListener('touchstart',this.handleTouchStart),this.scrollable.parentNode.removeEventListener('touchmove',this.handleTouchMove),this.scrollable.parentNode.removeEventListener('wheel',this.handleScroll),this.scrollable.parentNode.removeEventListener('scroll',this.handleScroll))}calculateShadowOffset(){var{scrollTop:t,scrollHeight:e,clientHeight:r}=this.state;var{shadowHeight:o=50}=this.props;var a=e-r||0;return Math.floor(o*(100*t/(a<=0?1:a))/100-o)}render(){var r=this.props,{children:a,withShadow:i,shadowHeight:h,shadowColor:n,shadowOpacity:d,className:p,style:u,disabled:b}=r,m=e(r,c);if(b)return l("div",{children:a});var{scrollHeight:v,clientHeight:g}=this.state;var f=this.calculateShadowOffset();return s("div",{style:t(t({},u),{},{position:'relative'}),className:p,children:[i&&v>g&&f!==-h&&l("div",{style:{position:'absolute',display:'block',height:"".concat(h,"px"),left:0,right:0,top:"-".concat(h,"px"),opacity:d,backgroundImage:"linear-gradient(to bottom, ".concat(this.props.theme.colors[n]," 20%, rgba(255, 255, 255, 0) 100%)"),transform:"translateY(".concat(h+f,"px)"),zIndex:10}}),i&&v>g&&f<0&&l("div",{style:{position:'absolute',display:'block',height:"".concat(h,"px"),left:0,right:0,bottom:0,opacity:d,backgroundImage:"linear-gradient(to top, ".concat(this.props.theme.colors[n]," 20%, rgba(255, 255, 255, 0) 100%)"),transform:"translateY(".concat(h+f,"px)"),zIndex:10}}),l(o,t(t({renderTrackVertical:e=>this.renderTrack(t({},e),'vertical'),renderTrackHorizontal:e=>this.renderTrack(t({},e),'horizontal'),renderThumbHorizontal:this.renderThumb,renderThumbVertical:this.renderThumb,onUpdate:this.handleUpdate,hideTracksWhenNotNeeded:!0},m),{},{children:l("div",{ref:t=>{this.scrollable=t},children:a})}))]})}}n.defaultProps={autoHide:!1,autoHideTimeout:1e3,autoHideDuration:200,autoHeight:!1,withShadow:!1,shadowHeight:50,shadowOpacity:.15,shadowColor:'mineShaft',thumbColor:'mineShaft',thumbOpacity:.15,thumbBorderRadius:1,thumbWidth:4,trackColor:'#333333',trackOpacity:.15,trackBorderRadius:1,trackWidth:4,disabled:!1,isolate:!0};var d=a(n);d.displayName='Scrollable';export{d as Scrollable};
|
|
1
|
+
import t from'@babel/runtime/helpers/esm/objectSpread2';import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import{PureComponent as r}from'react';import{Scrollbars as o}from'rc-scrollbars';import{withTheme as a}from'styled-components';import{jsx as l,jsxs as s}from'react/jsx-runtime';var i=["style"],h=["style"],c=["children","withShadow","shadowHeight","shadowColor","shadowOpacity","className","thumbColor","thumbOpacity","thumbBorderRadius","thumbWidth","trackColor","trackOpacity","trackBorderRadius","trackWidth","isolate","style","disabled"];class n extends r{constructor(){super(...arguments),this.scrollable=null,this.ts=0,this.state={scrollTop:0,scrollHeight:0,clientHeight:0},this.handleTouchStart=t=>{this.ts=t.touches[0].clientY},this.handleTouchMove=t=>{if(!this.props.isolate||!this.scrollable)return!0;var e=this.scrollable.parentNode;if(e){var r=t.changedTouches[0].clientY;var o=this.ts>r?-1:1;var a=1===o&&0===e.scrollTop;var l=-1===o&&Math.floor(e.scrollTop)===e.scrollHeight-e.clientHeight;return(a||l)&&(t.preventDefault(),this.ts=r),!0}},this.handleScroll=t=>{if(!this.props.isolate||!this.scrollable)return!0;var e=this.scrollable.parentNode;if(e){var r=(t.deltaY||t.detail)<0?1:-1;return(1===r&&0===e.scrollTop||-1===r&&e.scrollTop===e.scrollHeight-e.clientHeight)&&t.preventDefault(),!0}},this.handleUpdate=t=>{var{scrollTop:e,scrollHeight:r,clientHeight:o}=t;this.setState({scrollTop:e,scrollHeight:r,clientHeight:o})},this.hexToRgb=t=>{var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},this.renderTrack=(r,o)=>{var{style:a}=r,s=e(r,i);var{trackColor:h,trackOpacity:c,trackBorderRadius:n,trackWidth:d}=this.props;var p=h?this.hexToRgb(h):null;var u=t({background:p?"rgba(".concat(p.r,", ").concat(p.g,", ").concat(p.b,", ").concat(c,")"):"rgba(255,255,255,0)",borderRadius:"".concat(n,"px"),zIndex:14},'vertical'===o?{right:4,top:2,bottom:2,width:"".concat(d,"px")}:{bottom:4,left:2,right:2,height:"".concat(d,"px")});return l("div",t({style:t(t({},a),u)},s))},this.renderThumb=r=>{var{style:o}=r,a=e(r,h);var{thumbColor:s,thumbOpacity:i,thumbBorderRadius:c,thumbWidth:n}=this.props;var d={opacity:i,backgroundColor:this.props.theme.colors[s]||this.props.theme.colors[s],borderRadius:"".concat(c,"px"),width:"".concat(n,"px")};return l("div",t({style:t(t({},o),d)},a))}}componentDidMount(){this.scrollable&&this.scrollable.parentNode&&(this.scrollable.parentNode.addEventListener('touchstart',this.handleTouchStart,!1),this.scrollable.parentNode.addEventListener('touchmove',this.handleTouchMove,!1),this.scrollable.parentNode.addEventListener('wheel',this.handleScroll,!1),this.scrollable.parentNode.addEventListener('scroll',this.handleScroll,!1))}componentWillUnmount(){this.scrollable&&this.scrollable.parentNode&&(this.scrollable.parentNode.removeEventListener('touchstart',this.handleTouchStart),this.scrollable.parentNode.removeEventListener('touchmove',this.handleTouchMove),this.scrollable.parentNode.removeEventListener('wheel',this.handleScroll),this.scrollable.parentNode.removeEventListener('scroll',this.handleScroll))}calculateShadowOffset(){var{scrollTop:t,scrollHeight:e,clientHeight:r}=this.state;var{shadowHeight:o=50}=this.props;var a=e-r||0;return Math.floor(o*(100*t/(a<=0?1:a))/100-o)}render(){var r=this.props,{children:a,withShadow:i,shadowHeight:h,shadowColor:n,shadowOpacity:d,className:p,style:u,disabled:b}=r,m=e(r,c);if(b)return l("div",{children:a});var{scrollHeight:v,clientHeight:g}=this.state;var f=this.calculateShadowOffset();return s("div",{style:t(t({},u),{},{position:'relative'}),className:p,children:[i&&v>g&&f!==-h&&l("div",{style:{position:'absolute',display:'block',height:"".concat(h,"px"),left:0,right:0,top:"-".concat(h,"px"),opacity:d,backgroundImage:"linear-gradient(to bottom, ".concat(this.props.theme.colors[n]," 20%, rgba(255, 255, 255, 0) 100%)"),transform:"translateY(".concat(h+f,"px)"),zIndex:10}}),i&&v>g&&f<0&&l("div",{style:{position:'absolute',display:'block',height:"".concat(h,"px"),left:0,right:0,bottom:0,opacity:d,backgroundImage:"linear-gradient(to top, ".concat(this.props.theme.colors[n]," 20%, rgba(255, 255, 255, 0) 100%)"),transform:"translateY(".concat(h+f,"px)"),zIndex:10}}),l(o,t(t({renderTrackVertical:e=>this.renderTrack(t({},e),'vertical'),renderTrackHorizontal:e=>this.renderTrack(t({},e),'horizontal'),renderThumbHorizontal:this.renderThumb,renderThumbVertical:this.renderThumb,onUpdate:this.handleUpdate,hideTracksWhenNotNeeded:!0},m),{},{children:l("div",{ref:t=>{this.scrollable=t},children:a})}))]})}}n.displayName='Scrollable',n.defaultProps={autoHide:!1,autoHideTimeout:1e3,autoHideDuration:200,autoHeight:!1,withShadow:!1,shadowHeight:50,shadowOpacity:.15,shadowColor:'mineShaft',thumbColor:'mineShaft',thumbOpacity:.15,thumbBorderRadius:1,thumbWidth:4,trackColor:'#333333',trackOpacity:.15,trackBorderRadius:1,trackWidth:4,disabled:!1,isolate:!0};var d=a(n);d.displayName='Scrollable';export{d as Scrollable};
|
|
2
2
|
//# sourceMappingURL=Scrollable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scrollable.js","sources":["../../../../src/components/Scrollable/Scrollable.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport { Scrollbars, ScrollbarsProps } from 'rc-scrollbars'\nimport { DefaultTheme, withTheme } from 'styled-components'\n\nexport interface ScrollableProps extends Partial<ScrollbarsProps> {\n /**\n * Children react node\n */\n children: React.ReactNode[] | React.ReactNode\n /**\n * Enable auto-hide mode\n * @see See [github docs](https://github.com/sakhnyuk/rc-scrollbars) for description\n */\n autoHide?: boolean\n /**\n * Hide delay in ms.\n */\n autoHideTimeout?: number\n /**\n * Duration for hide animation in ms.\n */\n autoHideDuration?: number\n /**\n * Enable auto-height mode.\n */\n autoHeight?: boolean\n /**\n * Set a minimum height for auto-height mode\n */\n autoHeightMin?: number\n /**\n * Set a maximum height for auto-height mode\n */\n autoHeightMax?: number\n /**\n * Event handler\n */\n onScroll?(): void\n /**\n * Runs inside the animation frame.\n */\n onScrollFrame?(): void\n /**\n * Called when scrolling starts\n */\n onScrollStart?(): void\n /**\n * Called when scrolling stops\n */\n onScrollStop?(): void\n /**\n * Height of shadow\n */\n shadowHeight?: number\n /**\n * Show shadow in scrollable component\n */\n withShadow?: boolean\n /**\n * Color of shadow from #Colors\n */\n shadowColor?: string\n /**\n * Opacity of shadow\n */\n shadowOpacity?: number\n /**\n * Color of thumb\n */\n thumbColor?: string\n /**\n * Opacity of thumb\n */\n thumbOpacity?: number\n /**\n * Border radius of thumb (px)\n */\n thumbBorderRadius?: number\n /**\n /**\n * Border radius of thumb (px)\n */\n thumbWidth?: number\n /**\n * Color of track (HEX)\n */\n trackColor?: string\n /**\n * Opacity of track\n */\n trackOpacity?: number\n /**\n * Border radius of track (px)\n */\n trackBorderRadius?: number\n /**\n /**\n * Border radius of track (px)\n */\n trackWidth?: number\n /**\n * Style for scrollable container\n */\n style?: object\n /**\n * Classname of scrollable container\n */\n className?: string\n /**\n * Disable scrollbar and return div\n */\n disabled?: boolean\n /**\n * Prevent body scrolling when start|end touched\n */\n isolate?: boolean\n\n theme?: DefaultTheme\n}\n\ntype ScrollableState = {\n scrollTop: number\n scrollHeight: number\n clientHeight: number\n}\n\n// eslint-disable-next-line no-use-before-define\nclass Scrollable extends PureComponent<typeof Scrollable.defaultProps & ScrollableProps, ScrollableState> {\n static defaultProps = {\n autoHide: false,\n autoHideTimeout: 1000,\n autoHideDuration: 200,\n autoHeight: false,\n withShadow: false,\n shadowHeight: 50,\n shadowOpacity: 0.15,\n shadowColor: 'mineShaft',\n thumbColor: 'mineShaft',\n thumbOpacity: 0.15,\n thumbBorderRadius: 1,\n thumbWidth: 4,\n trackColor: '#333333',\n trackOpacity: 0.15,\n trackBorderRadius: 1,\n trackWidth: 4,\n disabled: false,\n isolate: true,\n }\n\n scrollable: HTMLDivElement | null = null\n ts = 0\n\n state = {\n scrollTop: 0,\n scrollHeight: 0,\n clientHeight: 0,\n }\n\n componentDidMount() {\n if (!this.scrollable || !this.scrollable.parentNode) return\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener('touchstart', this.handleTouchStart, false)\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener('touchmove', this.handleTouchMove, false)\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener('wheel', this.handleScroll, false)\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener(\n 'scroll',\n this.handleScroll as (_e: Event) => void,\n false\n )\n }\n\n componentWillUnmount() {\n if (!this.scrollable || !this.scrollable.parentNode) return\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener('touchstart', this.handleTouchStart)\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener('touchmove', this.handleTouchMove)\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener('wheel', this.handleScroll)\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener(\n 'scroll',\n this.handleScroll as (_e: Event) => void\n )\n }\n\n handleTouchStart = (e: TouchEvent) => {\n this.ts = e.touches[0].clientY\n }\n\n handleTouchMove = (e: TouchEvent) => {\n if (!this.props.isolate || !this.scrollable) return true\n\n const scrollarea = this.scrollable.parentNode\n\n if (!scrollarea) return\n\n const te = e.changedTouches[0].clientY\n const dir = this.ts > te ? -1 : 1\n\n const upTouch = dir === 1 && (scrollarea as HTMLDivElement).scrollTop === 0\n const endTouch =\n dir === -1 &&\n Math.floor((scrollarea as HTMLDivElement).scrollTop) ===\n (scrollarea as HTMLDivElement).scrollHeight - (scrollarea as HTMLDivElement).clientHeight\n\n if (upTouch || endTouch) {\n e.preventDefault()\n this.ts = te\n }\n\n return true\n }\n\n handleScroll = (e: WheelEvent) => {\n if (!this.props.isolate || !this.scrollable) return true\n\n const delta = e.deltaY || e.detail\n\n const scrollarea = this.scrollable.parentNode\n\n if (!scrollarea) return\n\n const dir = delta < 0 ? 1 : -1\n\n const upTouch = dir === 1 && (scrollarea as HTMLDivElement).scrollTop === 0\n const endTouch =\n dir === -1 &&\n (scrollarea as HTMLDivElement).scrollTop ===\n (scrollarea as HTMLDivElement).scrollHeight - (scrollarea as HTMLDivElement).clientHeight\n\n if (upTouch || endTouch) {\n e.preventDefault()\n }\n\n return true\n }\n\n handleUpdate = (values: ScrollableState) => {\n const { scrollTop, scrollHeight, clientHeight } = values\n\n this.setState({\n scrollTop,\n scrollHeight,\n clientHeight,\n })\n }\n\n calculateShadowOffset() {\n const { scrollTop, scrollHeight, clientHeight } = this.state\n const { shadowHeight = 50 } = this.props\n\n const diffH = scrollHeight - clientHeight || 0\n\n const a = (scrollTop * 100) / (diffH <= 0 ? 1 : diffH)\n const b = (shadowHeight * a) / 100\n\n return Math.floor(-shadowHeight + b)\n }\n\n hexToRgb = (hex: string) => {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex)\n\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : null\n }\n\n renderTrack = ({ style, ...props }: { style: React.CSSProperties }, dir: 'vertical' | 'horizontal') => {\n const { trackColor, trackOpacity, trackBorderRadius, trackWidth } = this.props\n\n const hex = trackColor ? this.hexToRgb(trackColor) : null\n\n const trackStyle = {\n background: hex ? `rgba(${hex.r}, ${hex.g}, ${hex.b}, ${trackOpacity})` : `rgba(255,255,255,0)`,\n borderRadius: `${trackBorderRadius}px`,\n zIndex: 14,\n ...(dir === 'vertical'\n ? {\n right: 4,\n top: 2,\n bottom: 2,\n width: `${trackWidth}px`,\n }\n : {\n bottom: 4,\n left: 2,\n right: 2,\n height: `${trackWidth}px`,\n }),\n }\n\n return (\n <div\n style={{\n ...style,\n ...trackStyle,\n }}\n {...props}\n />\n )\n }\n\n renderThumb = ({ style, ...scrollableProps }: { style: React.CSSProperties }) => {\n const { thumbColor, thumbOpacity, thumbBorderRadius, thumbWidth } = this.props\n\n const thumbStyle = {\n opacity: thumbOpacity,\n backgroundColor:\n (this.props.theme as DefaultTheme).colors[thumbColor] || (this.props.theme as DefaultTheme).colors[thumbColor],\n borderRadius: `${thumbBorderRadius}px`,\n width: `${thumbWidth}px`,\n }\n\n return <div style={{ ...style, ...thumbStyle }} {...scrollableProps} />\n }\n\n render() {\n const {\n children,\n withShadow,\n shadowHeight,\n shadowColor,\n shadowOpacity,\n className,\n thumbColor, // eslint-disable-line\n thumbOpacity, // eslint-disable-line\n thumbBorderRadius, // eslint-disable-line\n thumbWidth, // eslint-disable-line\n trackColor, // eslint-disable-line\n trackOpacity, // eslint-disable-line\n trackBorderRadius, // eslint-disable-line\n trackWidth, // eslint-disable-line\n isolate, // eslint-disable-line\n style,\n disabled,\n ...props\n } = this.props\n\n if (disabled) return <div>{children}</div>\n\n const { scrollHeight, clientHeight } = this.state\n\n const shadowOffset = this.calculateShadowOffset()\n\n return (\n <div\n style={{\n ...style,\n position: 'relative',\n }}\n className={className}\n >\n {withShadow && scrollHeight > clientHeight && shadowOffset !== -shadowHeight && (\n <div\n style={{\n position: 'absolute',\n display: 'block',\n height: `${shadowHeight}px`,\n left: 0,\n right: 0,\n top: `-${shadowHeight}px`,\n opacity: shadowOpacity,\n backgroundImage: `linear-gradient(to bottom, ${\n (this.props.theme as DefaultTheme).colors[shadowColor]\n } 20%, rgba(255, 255, 255, 0) 100%)`,\n transform: `translateY(${shadowHeight + shadowOffset}px)`,\n zIndex: 10,\n }}\n />\n )}\n\n {withShadow && scrollHeight > clientHeight && shadowOffset < 0 && (\n <div\n style={{\n position: 'absolute',\n display: 'block',\n height: `${shadowHeight}px`,\n left: 0,\n right: 0,\n bottom: 0,\n opacity: shadowOpacity,\n backgroundImage: `linear-gradient(to top, ${\n (this.props.theme as DefaultTheme).colors[shadowColor]\n } 20%, rgba(255, 255, 255, 0) 100%)`,\n transform: `translateY(${shadowHeight + shadowOffset}px)`,\n zIndex: 10,\n }}\n />\n )}\n\n <Scrollbars\n renderTrackVertical={(nodeProps) => this.renderTrack({ ...nodeProps }, 'vertical')}\n renderTrackHorizontal={(nodeProps) => this.renderTrack({ ...nodeProps }, 'horizontal')}\n renderThumbHorizontal={this.renderThumb}\n renderThumbVertical={this.renderThumb}\n onUpdate={this.handleUpdate}\n hideTracksWhenNotNeeded\n {...props}\n >\n <div\n ref={(node) => {\n this.scrollable = node\n }}\n >\n {children}\n </div>\n </Scrollbars>\n </div>\n )\n }\n}\n\n/**\n * Scrollable component for create custom scrollable content\n *\n * Based on https://github.com/sakhnyuk/rc-scrollbars\n */\nconst withThemeScrollable = withTheme(Scrollable)\n\nwithThemeScrollable.displayName = 'Scrollable'\n\nexport { withThemeScrollable as Scrollable }\n"],"names":["Scrollable","PureComponent","constructor","super","arguments","this","scrollable","ts","state","scrollTop","scrollHeight","clientHeight","handleTouchStart","e","touches","clientY","handleTouchMove","props","isolate","scrollarea","parentNode","te","changedTouches","dir","upTouch","endTouch","Math","floor","preventDefault","handleScroll","deltaY","detail","handleUpdate","values","setState","hexToRgb","hex","result","exec","r","parseInt","g","b","renderTrack","style","_ref","_objectWithoutProperties","_excluded","trackColor","trackOpacity","trackBorderRadius","trackWidth","trackStyle","_objectSpread","background","concat","borderRadius","zIndex","right","top","bottom","width","left","height","_jsx","renderThumb","_ref2","scrollableProps","_excluded2","thumbColor","thumbOpacity","thumbBorderRadius","thumbWidth","thumbStyle","opacity","backgroundColor","theme","colors","componentDidMount","addEventListener","componentWillUnmount","removeEventListener","calculateShadowOffset","shadowHeight","diffH","render","_this$props","children","withShadow","shadowColor","shadowOpacity","className","disabled","_excluded3","shadowOffset","_jsxs","position","display","backgroundImage","transform","Scrollbars","renderTrackVertical","nodeProps","renderTrackHorizontal","renderThumbHorizontal","renderThumbVertical","onUpdate","hideTracksWhenNotNeeded","ref","node","defaultProps","autoHide","autoHideTimeout","autoHideDuration","autoHeight","withThemeScrollable","withTheme","displayName"],"mappings":"mjBA+HA,MAAMA,UAAmBC,EAAiFC,cAAAC,S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,GAEtCmH,EAAoBE,YAAc"}
|
|
1
|
+
{"version":3,"file":"Scrollable.js","sources":["../../../../src/components/Scrollable/Scrollable.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport { Scrollbars, ScrollbarsProps } from 'rc-scrollbars'\nimport { DefaultTheme, withTheme } from 'styled-components'\n\nexport interface ScrollableProps extends Partial<ScrollbarsProps> {\n /**\n * Children react node\n */\n children: React.ReactNode[] | React.ReactNode\n /**\n * Enable auto-hide mode\n * @see See [github docs](https://github.com/sakhnyuk/rc-scrollbars) for description\n */\n autoHide?: boolean\n /**\n * Hide delay in ms.\n */\n autoHideTimeout?: number\n /**\n * Duration for hide animation in ms.\n */\n autoHideDuration?: number\n /**\n * Enable auto-height mode.\n */\n autoHeight?: boolean\n /**\n * Set a minimum height for auto-height mode\n */\n autoHeightMin?: number\n /**\n * Set a maximum height for auto-height mode\n */\n autoHeightMax?: number\n /**\n * Event handler\n */\n onScroll?(): void\n /**\n * Runs inside the animation frame.\n */\n onScrollFrame?(): void\n /**\n * Called when scrolling starts\n */\n onScrollStart?(): void\n /**\n * Called when scrolling stops\n */\n onScrollStop?(): void\n /**\n * Height of shadow\n */\n shadowHeight?: number\n /**\n * Show shadow in scrollable component\n */\n withShadow?: boolean\n /**\n * Color of shadow from #Colors\n */\n shadowColor?: string\n /**\n * Opacity of shadow\n */\n shadowOpacity?: number\n /**\n * Color of thumb\n */\n thumbColor?: string\n /**\n * Opacity of thumb\n */\n thumbOpacity?: number\n /**\n * Border radius of thumb (px)\n */\n thumbBorderRadius?: number\n /**\n /**\n * Border radius of thumb (px)\n */\n thumbWidth?: number\n /**\n * Color of track (HEX)\n */\n trackColor?: string\n /**\n * Opacity of track\n */\n trackOpacity?: number\n /**\n * Border radius of track (px)\n */\n trackBorderRadius?: number\n /**\n /**\n * Border radius of track (px)\n */\n trackWidth?: number\n /**\n * Style for scrollable container\n */\n style?: object\n /**\n * Classname of scrollable container\n */\n className?: string\n /**\n * Disable scrollbar and return div\n */\n disabled?: boolean\n /**\n * Prevent body scrolling when start|end touched\n */\n isolate?: boolean\n\n theme?: DefaultTheme\n}\n\ntype ScrollableState = {\n scrollTop: number\n scrollHeight: number\n clientHeight: number\n}\n\n// eslint-disable-next-line no-use-before-define\nclass Scrollable extends PureComponent<typeof Scrollable.defaultProps & ScrollableProps, ScrollableState> {\n static displayName = 'Scrollable'\n static defaultProps = {\n autoHide: false,\n autoHideTimeout: 1000,\n autoHideDuration: 200,\n autoHeight: false,\n withShadow: false,\n shadowHeight: 50,\n shadowOpacity: 0.15,\n shadowColor: 'mineShaft',\n thumbColor: 'mineShaft',\n thumbOpacity: 0.15,\n thumbBorderRadius: 1,\n thumbWidth: 4,\n trackColor: '#333333',\n trackOpacity: 0.15,\n trackBorderRadius: 1,\n trackWidth: 4,\n disabled: false,\n isolate: true,\n }\n\n scrollable: HTMLDivElement | null = null\n ts = 0\n\n state = {\n scrollTop: 0,\n scrollHeight: 0,\n clientHeight: 0,\n }\n\n componentDidMount() {\n if (!this.scrollable || !this.scrollable.parentNode) return\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener('touchstart', this.handleTouchStart, false)\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener('touchmove', this.handleTouchMove, false)\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener('wheel', this.handleScroll, false)\n ;(this.scrollable.parentNode as HTMLDivElement).addEventListener(\n 'scroll',\n this.handleScroll as (_e: Event) => void,\n false\n )\n }\n\n componentWillUnmount() {\n if (!this.scrollable || !this.scrollable.parentNode) return\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener('touchstart', this.handleTouchStart)\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener('touchmove', this.handleTouchMove)\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener('wheel', this.handleScroll)\n ;(this.scrollable.parentNode as HTMLDivElement).removeEventListener(\n 'scroll',\n this.handleScroll as (_e: Event) => void\n )\n }\n\n handleTouchStart = (e: TouchEvent) => {\n this.ts = e.touches[0].clientY\n }\n\n handleTouchMove = (e: TouchEvent) => {\n if (!this.props.isolate || !this.scrollable) return true\n\n const scrollarea = this.scrollable.parentNode\n\n if (!scrollarea) return\n\n const te = e.changedTouches[0].clientY\n const dir = this.ts > te ? -1 : 1\n\n const upTouch = dir === 1 && (scrollarea as HTMLDivElement).scrollTop === 0\n const endTouch =\n dir === -1 &&\n Math.floor((scrollarea as HTMLDivElement).scrollTop) ===\n (scrollarea as HTMLDivElement).scrollHeight - (scrollarea as HTMLDivElement).clientHeight\n\n if (upTouch || endTouch) {\n e.preventDefault()\n this.ts = te\n }\n\n return true\n }\n\n handleScroll = (e: WheelEvent) => {\n if (!this.props.isolate || !this.scrollable) return true\n\n const delta = e.deltaY || e.detail\n\n const scrollarea = this.scrollable.parentNode\n\n if (!scrollarea) return\n\n const dir = delta < 0 ? 1 : -1\n\n const upTouch = dir === 1 && (scrollarea as HTMLDivElement).scrollTop === 0\n const endTouch =\n dir === -1 &&\n (scrollarea as HTMLDivElement).scrollTop ===\n (scrollarea as HTMLDivElement).scrollHeight - (scrollarea as HTMLDivElement).clientHeight\n\n if (upTouch || endTouch) {\n e.preventDefault()\n }\n\n return true\n }\n\n handleUpdate = (values: ScrollableState) => {\n const { scrollTop, scrollHeight, clientHeight } = values\n\n this.setState({\n scrollTop,\n scrollHeight,\n clientHeight,\n })\n }\n\n calculateShadowOffset() {\n const { scrollTop, scrollHeight, clientHeight } = this.state\n const { shadowHeight = 50 } = this.props\n\n const diffH = scrollHeight - clientHeight || 0\n\n const a = (scrollTop * 100) / (diffH <= 0 ? 1 : diffH)\n const b = (shadowHeight * a) / 100\n\n return Math.floor(-shadowHeight + b)\n }\n\n hexToRgb = (hex: string) => {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex)\n\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : null\n }\n\n renderTrack = ({ style, ...props }: { style: React.CSSProperties }, dir: 'vertical' | 'horizontal') => {\n const { trackColor, trackOpacity, trackBorderRadius, trackWidth } = this.props\n\n const hex = trackColor ? this.hexToRgb(trackColor) : null\n\n const trackStyle = {\n background: hex ? `rgba(${hex.r}, ${hex.g}, ${hex.b}, ${trackOpacity})` : `rgba(255,255,255,0)`,\n borderRadius: `${trackBorderRadius}px`,\n zIndex: 14,\n ...(dir === 'vertical'\n ? {\n right: 4,\n top: 2,\n bottom: 2,\n width: `${trackWidth}px`,\n }\n : {\n bottom: 4,\n left: 2,\n right: 2,\n height: `${trackWidth}px`,\n }),\n }\n\n return (\n <div\n style={{\n ...style,\n ...trackStyle,\n }}\n {...props}\n />\n )\n }\n\n renderThumb = ({ style, ...scrollableProps }: { style: React.CSSProperties }) => {\n const { thumbColor, thumbOpacity, thumbBorderRadius, thumbWidth } = this.props\n\n const thumbStyle = {\n opacity: thumbOpacity,\n backgroundColor:\n (this.props.theme as DefaultTheme).colors[thumbColor] || (this.props.theme as DefaultTheme).colors[thumbColor],\n borderRadius: `${thumbBorderRadius}px`,\n width: `${thumbWidth}px`,\n }\n\n return <div style={{ ...style, ...thumbStyle }} {...scrollableProps} />\n }\n\n render() {\n const {\n children,\n withShadow,\n shadowHeight,\n shadowColor,\n shadowOpacity,\n className,\n thumbColor, // eslint-disable-line\n thumbOpacity, // eslint-disable-line\n thumbBorderRadius, // eslint-disable-line\n thumbWidth, // eslint-disable-line\n trackColor, // eslint-disable-line\n trackOpacity, // eslint-disable-line\n trackBorderRadius, // eslint-disable-line\n trackWidth, // eslint-disable-line\n isolate, // eslint-disable-line\n style,\n disabled,\n ...props\n } = this.props\n\n if (disabled) return <div>{children}</div>\n\n const { scrollHeight, clientHeight } = this.state\n\n const shadowOffset = this.calculateShadowOffset()\n\n return (\n <div\n style={{\n ...style,\n position: 'relative',\n }}\n className={className}\n >\n {withShadow && scrollHeight > clientHeight && shadowOffset !== -shadowHeight && (\n <div\n style={{\n position: 'absolute',\n display: 'block',\n height: `${shadowHeight}px`,\n left: 0,\n right: 0,\n top: `-${shadowHeight}px`,\n opacity: shadowOpacity,\n backgroundImage: `linear-gradient(to bottom, ${\n (this.props.theme as DefaultTheme).colors[shadowColor]\n } 20%, rgba(255, 255, 255, 0) 100%)`,\n transform: `translateY(${shadowHeight + shadowOffset}px)`,\n zIndex: 10,\n }}\n />\n )}\n\n {withShadow && scrollHeight > clientHeight && shadowOffset < 0 && (\n <div\n style={{\n position: 'absolute',\n display: 'block',\n height: `${shadowHeight}px`,\n left: 0,\n right: 0,\n bottom: 0,\n opacity: shadowOpacity,\n backgroundImage: `linear-gradient(to top, ${\n (this.props.theme as DefaultTheme).colors[shadowColor]\n } 20%, rgba(255, 255, 255, 0) 100%)`,\n transform: `translateY(${shadowHeight + shadowOffset}px)`,\n zIndex: 10,\n }}\n />\n )}\n\n <Scrollbars\n renderTrackVertical={(nodeProps) => this.renderTrack({ ...nodeProps }, 'vertical')}\n renderTrackHorizontal={(nodeProps) => this.renderTrack({ ...nodeProps }, 'horizontal')}\n renderThumbHorizontal={this.renderThumb}\n renderThumbVertical={this.renderThumb}\n onUpdate={this.handleUpdate}\n hideTracksWhenNotNeeded\n {...props}\n >\n <div\n ref={(node) => {\n this.scrollable = node\n }}\n >\n {children}\n </div>\n </Scrollbars>\n </div>\n )\n }\n}\n\n/**\n * Scrollable component for create custom scrollable content\n *\n * Based on https://github.com/sakhnyuk/rc-scrollbars\n */\nconst withThemeScrollable = withTheme(Scrollable)\n\nwithThemeScrollable.displayName = 'Scrollable'\n\nexport { withThemeScrollable as Scrollable }\n"],"names":["Scrollable","PureComponent","constructor","super","arguments","this","scrollable","ts","state","scrollTop","scrollHeight","clientHeight","handleTouchStart","e","touches","clientY","handleTouchMove","props","isolate","scrollarea","parentNode","te","changedTouches","dir","upTouch","endTouch","Math","floor","preventDefault","handleScroll","deltaY","detail","handleUpdate","values","setState","hexToRgb","hex","result","exec","r","parseInt","g","b","renderTrack","style","_ref","_objectWithoutProperties","_excluded","trackColor","trackOpacity","trackBorderRadius","trackWidth","trackStyle","_objectSpread","background","concat","borderRadius","zIndex","right","top","bottom","width","left","height","_jsx","renderThumb","_ref2","scrollableProps","_excluded2","thumbColor","thumbOpacity","thumbBorderRadius","thumbWidth","thumbStyle","opacity","backgroundColor","theme","colors","componentDidMount","addEventListener","componentWillUnmount","removeEventListener","calculateShadowOffset","shadowHeight","diffH","render","_this$props","children","withShadow","shadowColor","shadowOpacity","className","disabled","_excluded3","shadowOffset","_jsxs","position","display","backgroundImage","transform","Scrollbars","renderTrackVertical","nodeProps","renderTrackHorizontal","renderThumbHorizontal","renderThumbVertical","onUpdate","hideTracksWhenNotNeeded","ref","node","displayName","defaultProps","autoHide","autoHideTimeout","autoHideDuration","autoHeight","withThemeScrollable","withTheme"],"mappings":"mjBA+HA,MAAMA,UAAmBC,EAAiFC,cAAAC,SAAAC,WAAAC,KAuBxGC,WAAoC,KAvBoED,KAwBxGE,GAAK,EAxBmGF,KA0BxGG,MAAQ,CACNC,UAAW,EACXC,aAAc,EACdC,aAAc,GA7BwFN,KAuDxGO,iBAAoBC,IAClBR,KAAKE,GAAKM,EAAEC,QAAQ,GAAGC,SAxD+EV,KA2DxGW,gBAAmBH,IACjB,IAAKR,KAAKY,MAAMC,UAAYb,KAAKC,WAAY,SAE7C,IAAMa,EAAad,KAAKC,WAAWc,WAEnC,GAAKD,EAAL,CAEA,IAAME,EAAKR,EAAES,eAAe,GAAGP,QAC/B,IAAMQ,EAAMlB,KAAKE,GAAKc,GAAM,EAAI,EAEhC,IAAMG,EAAkB,IAARD,GAA0D,IAA5CJ,EAA8BV,UAC5D,IAAMgB,GACK,IAATF,GACAG,KAAKC,MAAOR,EAA8BV,aACvCU,EAA8BT,aAAgBS,EAA8BR,aAOjF,OALIa,GAAWC,KACbZ,EAAEe,iBACFvB,KAAKE,GAAKc,QA7E0FhB,KAmFxGwB,aAAgBhB,IACd,IAAKR,KAAKY,MAAMC,UAAYb,KAAKC,WAAY,SAI7C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Aa,YACvEC,sBAAwBD,GAAcjG,KAAKsC,YAAiB2D,EAAAA,GAAAA,GAAa,cACzEE,sBAAuBnG,KAAK4D,YAC5BwC,oBAAqBpG,KAAK4D,YAC1ByC,SAAUrG,KAAK2B,aACf2E,yBAAuB,GACnB1F,GAPN,GAAA,CAAAsE,SASEvB,EAAA,MAAA,CACE4C,IAAMC,IACJxG,KAAKC,WAAauG,GAFtBtB,SAKGA,WAtRPvF,EACG8G,YAAc,aADjB9G,EAEG+G,aAAe,CACpBC,YACAC,gBAAiB,IACjBC,iBAAkB,IAClBC,cACA3B,YAAAA,EACAL,aAAc,GACdO,cAAe,IACfD,YAAa,YACbpB,WAAY,YACZC,aAAc,IACdC,kBAAmB,EACnBC,WAAY,EACZxB,WAAY,UACZC,aAAc,IACdC,kBAAmB,EACnBC,WAAY,EACZyC,YACA1E,SAAAA,GA+QJ,IAAMkG,EAAsBC,EAAUrH,GAEtCoH,EAAoBN,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from'@babel/runtime/helpers/esm/objectSpread2';import{Root as r}from'./style.js';import{jsx as t}from'react/jsx-runtime';function o(o){return t(r,e({},o))}o.displayName='Section';export{o as Section};
|
|
2
2
|
//# sourceMappingURL=Section.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Section.js","sources":["../../../../src/components/Section/Section.tsx"],"sourcesContent":["import { Color } from '../../mixins/color'\nimport { Display } from '../../mixins/display'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SectionProps extends BaseProps, Display, Color, ResponsiveProperty<'padding'> {\n /**\n * Paper with shadow\n */\n shadow?: boolean\n /**\n * This number represents the zDepth of the paper shadow\n */\n zDepth?: 1 | 2 | 3 | 4 | 5\n /**\n * Section content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Text align\n */\n textAlign?: 'left' | 'right' | 'center'\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'padding'>`](#/Миксины)\n */\nexport function Section(props: SectionProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Section","props","_jsx","Styled.Root","_objectSpread"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Section.js","sources":["../../../../src/components/Section/Section.tsx"],"sourcesContent":["import { Color } from '../../mixins/color'\nimport { Display } from '../../mixins/display'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SectionProps extends BaseProps, Display, Color, ResponsiveProperty<'padding'> {\n /**\n * Paper with shadow\n */\n shadow?: boolean\n /**\n * This number represents the zDepth of the paper shadow\n */\n zDepth?: 1 | 2 | 3 | 4 | 5\n /**\n * Section content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Text align\n */\n textAlign?: 'left' | 'right' | 'center'\n}\n\nSection.displayName = 'Section'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'padding'>`](#/Миксины)\n */\nexport function Section(props: SectionProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Section","props","_jsx","Styled.Root","_objectSpread","displayName"],"mappings":"kIAqCO,SAASA,EAAQC,GACtB,OAAOC,EAACC,EAADC,EAAA,GAAiBH,IAV1BD,EAAQK,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/esm/objectSpread2';import a from'@babel/runtime/helpers/esm/objectWithoutProperties';import r,{AsyncCreatable as l,Async as t,Creatable as o}from'react-select';import{Root as s}from'./style.js';import{jsx as c}from'react/jsx-runtime';var m=["fluid","error","className","style"];function p(p){var{fluid:i,error:
|
|
1
|
+
import e from'@babel/runtime/helpers/esm/objectSpread2';import a from'@babel/runtime/helpers/esm/objectWithoutProperties';import r,{AsyncCreatable as l,Async as t,Creatable as o}from'react-select';import{Root as s}from'./style.js';import{jsx as c}from'react/jsx-runtime';var m=["fluid","error","className","style"];function p(p){var{fluid:i,error:d,className:b,style:n}=p,u=a(p,m);return c(s,{className:b,style:n,error:d,fluid:i,children:c(p.loadOptions?p.allowCreate?l:t:p.allowCreate?o:r,e(e({},u),{},{promptTextCreator:e=>"Добавить \"".concat(e,"\"")}))})}p.defaultProps={allowCreate:!1,searchable:!0,clearable:!1,addLabelText:'Добавить "{label}"?',backspaceToRemoveMessage:'Нажмите клавишу Backspace, чтобы удалить {last label}',clearAllText:'Очистить все',clearValueText:'Очистить значение',noResultsText:'Результатов не найдено',placeholder:'Выбрать ...',searchPromptText:'Введите поисковый запрос',loadingPlaceholder:'Загрузка...',autoload:!0,loadOptions:!1},p.displayName='Select';export{p as Select};
|
|
2
2
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import ReactSelect, { Async, AsyncCreatable, Creatable, ReactSelectProps } from 'react-select'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SelectProps extends BaseProps, ReactSelectProps {\n fluid?: boolean\n error?: boolean\n}\n\nSelect.defaultProps = {\n allowCreate: false,\n searchable: true,\n clearable: false,\n addLabelText: 'Добавить \"{label}\"?',\n backspaceToRemoveMessage: 'Нажмите клавишу Backspace, чтобы удалить {last label}',\n clearAllText: 'Очистить все',\n clearValueText: 'Очистить значение',\n noResultsText: 'Результатов не найдено',\n placeholder: 'Выбрать ...',\n searchPromptText: 'Введите поисковый запрос',\n loadingPlaceholder: 'Загрузка...',\n autoload: true,\n loadOptions: false,\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - `ReactSelectProps`\n */\nexport function Select(props: typeof Select.defaultProps & SelectProps) {\n const { fluid, error, className, style, ...reactSelectProps } = props\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const SelectElement: typeof ReactSelect & typeof Creatable = props.loadOptions\n ? props.allowCreate\n ? AsyncCreatable\n : Async\n : props.allowCreate\n ? Creatable\n : ReactSelect\n\n return (\n <Styled.Root className={className} style={style} error={error} fluid={fluid}>\n <SelectElement {...reactSelectProps} promptTextCreator={(label: string) => `Добавить \"${label}\"`} />\n </Styled.Root>\n )\n}\n"],"names":["Select","props","fluid","error","className","style","reactSelectProps","_objectWithoutProperties","_excluded","_jsx","Styled.Root","children","loadOptions","allowCreate","AsyncCreatable","Async","Creatable","ReactSelect","_objectSpread","promptTextCreator","label","concat","defaultProps","searchable","clearable","addLabelText","backspaceToRemoveMessage","clearAllText","clearValueText","noResultsText","placeholder","searchPromptText","loadingPlaceholder","autoload"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import ReactSelect, { Async, AsyncCreatable, Creatable, ReactSelectProps } from 'react-select'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SelectProps extends BaseProps, ReactSelectProps {\n fluid?: boolean\n error?: boolean\n}\n\nSelect.defaultProps = {\n allowCreate: false,\n searchable: true,\n clearable: false,\n addLabelText: 'Добавить \"{label}\"?',\n backspaceToRemoveMessage: 'Нажмите клавишу Backspace, чтобы удалить {last label}',\n clearAllText: 'Очистить все',\n clearValueText: 'Очистить значение',\n noResultsText: 'Результатов не найдено',\n placeholder: 'Выбрать ...',\n searchPromptText: 'Введите поисковый запрос',\n loadingPlaceholder: 'Загрузка...',\n autoload: true,\n loadOptions: false,\n}\n\nSelect.displayName = 'Select'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - `ReactSelectProps`\n */\nexport function Select(props: typeof Select.defaultProps & SelectProps) {\n const { fluid, error, className, style, ...reactSelectProps } = props\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const SelectElement: typeof ReactSelect & typeof Creatable = props.loadOptions\n ? props.allowCreate\n ? AsyncCreatable\n : Async\n : props.allowCreate\n ? Creatable\n : ReactSelect\n\n return (\n <Styled.Root className={className} style={style} error={error} fluid={fluid}>\n <SelectElement {...reactSelectProps} promptTextCreator={(label: string) => `Добавить \"${label}\"`} />\n </Styled.Root>\n )\n}\n"],"names":["Select","props","fluid","error","className","style","reactSelectProps","_objectWithoutProperties","_excluded","_jsx","Styled.Root","children","loadOptions","allowCreate","AsyncCreatable","Async","Creatable","ReactSelect","_objectSpread","promptTextCreator","label","concat","defaultProps","searchable","clearable","addLabelText","backspaceToRemoveMessage","clearAllText","clearValueText","noResultsText","placeholder","searchPromptText","loadingPlaceholder","autoload","displayName"],"mappings":"2TAgCO,SAASA,EAAOC,GACrB,IAAMC,MAAEA,EAAFC,MAASA,EAATC,UAAgBA,EAAhBC,MAA2BA,GAA+BJ,EAArBK,EAA3CC,EAAgEN,EAAhEO,GAYA,OACEC,EAACC,EAAD,CAAaN,UAAWA,EAAWC,MAAOA,EAAOF,MAAOA,EAAOD,MAAOA,EAAtES,SACEF,EAVyDR,EAAMW,YAC/DX,EAAMY,YACJC,EACAC,EACFd,EAAMY,YACNG,EACAC,EAIAC,EAAAA,EAAA,GAAmBZ,GAAnB,GAAA,CAAqCa,kBAAoBC,GAAD,cAAAC,OAAgCD,EAAhC,WAtC9DpB,EAAOsB,aAAe,CACpBT,aAAAA,EACAU,YAAAA,EACAC,WAAW,EACXC,aAAc,sBACdC,yBAA0B,wDAC1BC,aAAc,eACdC,eAAgB,oBAChBC,cAAe,yBACfC,YAAa,cACbC,iBAAkB,2BAClBC,mBAAoB,cACpBC,UAAAA,EACArB,aAAa,GAGfZ,EAAOkC,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from'@babel/runtime/helpers/esm/objectSpread2';import{SeparatorText as e}from'./SeparatorText.js';import{Root as t}from'./style.js';import{jsx as o}from'react/jsx-runtime';function a(e){return o(t,r({},e))}a.defaultProps={margin:'s',color:'grey',weight:1},a.Text=e;export{a as Separator};
|
|
1
|
+
import r from'@babel/runtime/helpers/esm/objectSpread2';import{SeparatorText as e}from'./SeparatorText.js';import{Root as t}from'./style.js';import{jsx as o}from'react/jsx-runtime';function a(e){return o(t,r({},e))}a.defaultProps={margin:'s',color:'grey',weight:1},a.Text=e,a.displayName='Separator';export{a as Separator};
|
|
2
2
|
//# sourceMappingURL=Separator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.js","sources":["../../../../src/components/Separator/Separator.tsx"],"sourcesContent":["import { Color } from '../../mixins/color'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport { SeparatorText } from './SeparatorText'\nimport * as Styled from './style'\n\nexport interface SeparatorProps\n extends BaseProps,\n Color,\n ResponsiveProperty<'top'>,\n ResponsiveProperty<'right'>,\n ResponsiveProperty<'bottom'>,\n ResponsiveProperty<'left'>,\n ResponsiveProperty<'padding'>,\n ResponsiveProperty<'paddingTop'>,\n ResponsiveProperty<'paddingRight'>,\n ResponsiveProperty<'paddingBottom'>,\n ResponsiveProperty<'paddingLeft'>,\n ResponsiveProperty<'margin'>,\n ResponsiveProperty<'marginTop'>,\n ResponsiveProperty<'marginRight'>,\n ResponsiveProperty<'marginBottom'>,\n ResponsiveProperty<'marginLeft'> {\n /**\n * Separator weight\n */\n weight?: 1 | 2 | 3 | 4 | 5\n}\n\nSeparator.defaultProps = {\n margin: 's',\n color: 'grey',\n weight: 1,\n}\n\nSeparator.Text = SeparatorText\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'fontColor'>`](#/Миксины)\n * - [`ResponsiveProperty<'top'>`](#/Миксины)\n * - [`ResponsiveProperty<'right'>`](#/Миксины)\n * - [`ResponsiveProperty<'bottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'left'>`](#/Миксины)\n * - [`ResponsiveProperty<'padding'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingLeft'>`](#/Миксины)\n * - [`ResponsiveProperty<'margin'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginLeft'>`](#/Миксины)\n */\nexport function Separator(props: typeof Separator.defaultProps & SeparatorProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Separator","props","_jsx","Styled.Root","_objectSpread","defaultProps","margin","color","weight","Text","SeparatorText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Separator.js","sources":["../../../../src/components/Separator/Separator.tsx"],"sourcesContent":["import { Color } from '../../mixins/color'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport { SeparatorText } from './SeparatorText'\nimport * as Styled from './style'\n\nexport interface SeparatorProps\n extends BaseProps,\n Color,\n ResponsiveProperty<'top'>,\n ResponsiveProperty<'right'>,\n ResponsiveProperty<'bottom'>,\n ResponsiveProperty<'left'>,\n ResponsiveProperty<'padding'>,\n ResponsiveProperty<'paddingTop'>,\n ResponsiveProperty<'paddingRight'>,\n ResponsiveProperty<'paddingBottom'>,\n ResponsiveProperty<'paddingLeft'>,\n ResponsiveProperty<'margin'>,\n ResponsiveProperty<'marginTop'>,\n ResponsiveProperty<'marginRight'>,\n ResponsiveProperty<'marginBottom'>,\n ResponsiveProperty<'marginLeft'> {\n /**\n * Separator weight\n */\n weight?: 1 | 2 | 3 | 4 | 5\n}\n\nSeparator.defaultProps = {\n margin: 's',\n color: 'grey',\n weight: 1,\n}\n\nSeparator.Text = SeparatorText\nSeparator.displayName = 'Separator'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'fontColor'>`](#/Миксины)\n * - [`ResponsiveProperty<'top'>`](#/Миксины)\n * - [`ResponsiveProperty<'right'>`](#/Миксины)\n * - [`ResponsiveProperty<'bottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'left'>`](#/Миксины)\n * - [`ResponsiveProperty<'padding'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingLeft'>`](#/Миксины)\n * - [`ResponsiveProperty<'margin'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginLeft'>`](#/Миксины)\n */\nexport function Separator(props: typeof Separator.defaultProps & SeparatorProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Separator","props","_jsx","Styled.Root","_objectSpread","defaultProps","margin","color","weight","Text","SeparatorText","displayName"],"mappings":"qLA0DO,SAASA,EAAUC,GACxB,OAAOC,EAACC,EAADC,EAAA,GAAiBH,IA9B1BD,EAAUK,aAAe,CACvBC,OAAQ,IACRC,MAAO,OACPC,OAAQ,GAGVR,EAAUS,KAAOC,EACjBV,EAAUW,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from'@babel/runtime/helpers/esm/objectSpread2';import{Root as e}from'./style.js';import{jsx as t}from'react/jsx-runtime';function o(o){return t(e,r({},o))}export{o as Spacer};
|
|
1
|
+
import r from'@babel/runtime/helpers/esm/objectSpread2';import{Root as e}from'./style.js';import{jsx as t}from'react/jsx-runtime';function o(o){return t(e,r({},o))}o.displayName='Spacer';export{o as Spacer};
|
|
2
2
|
//# sourceMappingURL=Spacer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spacer.js","sources":["../../../../src/components/Spacer/Spacer.tsx"],"sourcesContent":["import { Display } from '../../mixins/display'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SpacerProps\n extends BaseProps,\n Display,\n ResponsiveProperty<'top'>,\n ResponsiveProperty<'right'>,\n ResponsiveProperty<'bottom'>,\n ResponsiveProperty<'left'>,\n ResponsiveProperty<'padding'>,\n ResponsiveProperty<'paddingTop'>,\n ResponsiveProperty<'paddingRight'>,\n ResponsiveProperty<'paddingBottom'>,\n ResponsiveProperty<'paddingLeft'>,\n ResponsiveProperty<'margin'>,\n ResponsiveProperty<'marginTop'>,\n ResponsiveProperty<'marginRight'>,\n ResponsiveProperty<'marginBottom'>,\n ResponsiveProperty<'marginLeft'> {\n /**\n * Primary content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'top'>`](#/Миксины)\n * - [`ResponsiveProperty<'right'>`](#/Миксины)\n * - [`ResponsiveProperty<'bottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'left'>`](#/Миксины)\n * - [`ResponsiveProperty<'padding'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingLeft'>`](#/Миксины)\n * - [`ResponsiveProperty<'margin'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginLeft'>`](#/Миксины)\n */\nexport function Spacer(props: SpacerProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Spacer","props","_jsx","Styled.Root","_objectSpread"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spacer.js","sources":["../../../../src/components/Spacer/Spacer.tsx"],"sourcesContent":["import { Display } from '../../mixins/display'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SpacerProps\n extends BaseProps,\n Display,\n ResponsiveProperty<'top'>,\n ResponsiveProperty<'right'>,\n ResponsiveProperty<'bottom'>,\n ResponsiveProperty<'left'>,\n ResponsiveProperty<'padding'>,\n ResponsiveProperty<'paddingTop'>,\n ResponsiveProperty<'paddingRight'>,\n ResponsiveProperty<'paddingBottom'>,\n ResponsiveProperty<'paddingLeft'>,\n ResponsiveProperty<'margin'>,\n ResponsiveProperty<'marginTop'>,\n ResponsiveProperty<'marginRight'>,\n ResponsiveProperty<'marginBottom'>,\n ResponsiveProperty<'marginLeft'> {\n /**\n * Primary content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n}\n\nSpacer.displayName = 'Spacer'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'top'>`](#/Миксины)\n * - [`ResponsiveProperty<'right'>`](#/Миксины)\n * - [`ResponsiveProperty<'bottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'left'>`](#/Миксины)\n * - [`ResponsiveProperty<'padding'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'paddingLeft'>`](#/Миксины)\n * - [`ResponsiveProperty<'margin'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginTop'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginRight'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginBottom'>`](#/Миксины)\n * - [`ResponsiveProperty<'marginLeft'>`](#/Миксины)\n */\nexport function Spacer(props: SpacerProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Spacer","props","_jsx","Styled.Root","_objectSpread","displayName"],"mappings":"kIAoDO,SAASA,EAAOC,GACrB,OAAOC,EAACC,EAADC,EAAA,GAAiBH,IAtB1BD,EAAOK,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from'@babel/runtime/helpers/esm/objectSpread2';import{Root as r}from'./style.js';import{jsx as t}from'react/jsx-runtime';function o(o){return t(r,e({},o))}o.defaultProps={size:'m'},o.displayName='Spinner';export{o as Spinner};
|
|
2
2
|
//# sourceMappingURL=Spinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SpinnerProps extends BaseProps, ResponsiveProperty<'size'> {\n /**\n * Size of spinner\n */\n size?: 'l' | 's' | 'm' | number\n /**\n * Vertically center the spinner inside 100vh container\n */\n fullscreen?: boolean\n /**\n * Inline. Has no top/bottom margins\n */\n inline?: boolean\n}\n\nSpinner.defaultProps = {\n size: 'm',\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`ResponsiveProperty<'size'>`](#/Миксины)\n */\nexport function Spinner(props: typeof Spinner.defaultProps & SpinnerProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Spinner","props","_jsx","Styled.Root","_objectSpread","defaultProps","size"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SpinnerProps extends BaseProps, ResponsiveProperty<'size'> {\n /**\n * Size of spinner\n */\n size?: 'l' | 's' | 'm' | number\n /**\n * Vertically center the spinner inside 100vh container\n */\n fullscreen?: boolean\n /**\n * Inline. Has no top/bottom margins\n */\n inline?: boolean\n}\n\nSpinner.defaultProps = {\n size: 'm',\n}\n\nSpinner.displayName = 'Spinner'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`ResponsiveProperty<'size'>`](#/Миксины)\n */\nexport function Spinner(props: typeof Spinner.defaultProps & SpinnerProps) {\n return <Styled.Root {...props} />\n}\n"],"names":["Spinner","props","_jsx","Styled.Root","_objectSpread","defaultProps","size","displayName"],"mappings":"kIA8BO,SAASA,EAAQC,GACtB,OAAOC,EAACC,EAADC,EAAA,GAAiBH,IAZ1BD,EAAQK,aAAe,CACrBC,KAAM,KAGRN,EAAQO,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/esm/objectSpread2';import r from'@babel/runtime/helpers/esm/objectWithoutProperties';import{createRef as a}from'react';import{Root as t,Input as o,Switcher as n,Label as i}from'./style.js';import{jsxs as l,jsx as s}from'react/jsx-runtime';var c=["id","value","name","children","tabIndex","onChange"];function m(m){var d=a();var{id:h,value:p,name:u,children:b,tabIndex:f,onChange:x}=m,v=r(m,c);return l(t,e(e({value:p},v),{},{children:[s(o,{id:h,name:u,checked:p,type:"checkbox",tabIndex:f,ref:d,onChange:e=>{m.disabled||'function'!=typeof x||x(e.target.checked,e)}}),s(n,{htmlFor:h}),b?s(i,{htmlFor:h,children:b}):null]}))}m.defaultProps={value:!1,disabled:!1,color:'atlantis'};export{m as Switcher};
|
|
1
|
+
import e from'@babel/runtime/helpers/esm/objectSpread2';import r from'@babel/runtime/helpers/esm/objectWithoutProperties';import{createRef as a}from'react';import{Root as t,Input as o,Switcher as n,Label as i}from'./style.js';import{jsxs as l,jsx as s}from'react/jsx-runtime';var c=["id","value","name","children","tabIndex","onChange"];function m(m){var d=a();var{id:h,value:p,name:u,children:b,tabIndex:f,onChange:x}=m,v=r(m,c);return l(t,e(e({value:p},v),{},{children:[s(o,{id:h,name:u,checked:p,type:"checkbox",tabIndex:f,ref:d,onChange:e=>{m.disabled||'function'!=typeof x||x(e.target.checked,e)}}),s(n,{htmlFor:h}),b?s(i,{htmlFor:h,children:b}):null]}))}m.defaultProps={value:!1,disabled:!1,color:'atlantis'},m.displayName='Switcher';export{m as Switcher};
|
|
2
2
|
//# sourceMappingURL=Switcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switcher.js","sources":["../../../../src/components/Switcher/Switcher.tsx"],"sourcesContent":["import { createRef } from 'react'\nimport { Color } from '../../mixins/color'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SwitcherProps extends BaseProps, Color<'color'>, Color<'inactiveColor'> {\n /**\n * Id for swithcer\n */\n id?: string\n /**\n * Name of input\n */\n name?: string\n /**\n * Value of input\n */\n value?: boolean\n /**\n * Switcher is disabled\n */\n disabled?: boolean\n /**\n * Tabindex\n */\n tabIndex?: number\n /**\n * Label of switcher\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * onChange function\n */\n onChange?(_checked: boolean, _event: React.ChangeEvent<HTMLInputElement>): void\n}\n\nSwitcher.defaultProps = {\n value: false,\n disabled: false,\n color: 'atlantis',\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'inactiveColor'>`](#/Миксины)\n */\nexport function Switcher(props: typeof Switcher.defaultProps & SwitcherProps) {\n const inputRef = createRef<HTMLInputElement>()\n const { id, value, name, children, tabIndex, onChange, ...restProps } = props\n\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n if (!props.disabled && typeof onChange === 'function') {\n onChange(event.target.checked, event)\n }\n }\n\n return (\n <Styled.Root value={value} {...restProps}>\n <Styled.Input\n id={id}\n name={name}\n checked={value}\n type='checkbox'\n tabIndex={tabIndex}\n ref={inputRef}\n onChange={handleChange}\n />\n <Styled.Switcher htmlFor={id} />\n {children ? <Styled.Label htmlFor={id}>{children}</Styled.Label> : null}\n </Styled.Root>\n )\n}\n"],"names":["Switcher","props","inputRef","createRef","id","value","name","children","tabIndex","onChange","restProps","_excluded","_jsxs","Styled.Root","_objectSpread","_jsx","Styled.Input","checked","type","ref","event","disabled","target","Styled.Switcher","htmlFor","Styled.Label","defaultProps","color"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switcher.js","sources":["../../../../src/components/Switcher/Switcher.tsx"],"sourcesContent":["import { createRef } from 'react'\nimport { Color } from '../../mixins/color'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface SwitcherProps extends BaseProps, Color<'color'>, Color<'inactiveColor'> {\n /**\n * Id for swithcer\n */\n id?: string\n /**\n * Name of input\n */\n name?: string\n /**\n * Value of input\n */\n value?: boolean\n /**\n * Switcher is disabled\n */\n disabled?: boolean\n /**\n * Tabindex\n */\n tabIndex?: number\n /**\n * Label of switcher\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * onChange function\n */\n onChange?(_checked: boolean, _event: React.ChangeEvent<HTMLInputElement>): void\n}\n\nSwitcher.defaultProps = {\n value: false,\n disabled: false,\n color: 'atlantis',\n}\n\nSwitcher.displayName = 'Switcher'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'inactiveColor'>`](#/Миксины)\n */\nexport function Switcher(props: typeof Switcher.defaultProps & SwitcherProps) {\n const inputRef = createRef<HTMLInputElement>()\n const { id, value, name, children, tabIndex, onChange, ...restProps } = props\n\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n if (!props.disabled && typeof onChange === 'function') {\n onChange(event.target.checked, event)\n }\n }\n\n return (\n <Styled.Root value={value} {...restProps}>\n <Styled.Input\n id={id}\n name={name}\n checked={value}\n type='checkbox'\n tabIndex={tabIndex}\n ref={inputRef}\n onChange={handleChange}\n />\n <Styled.Switcher htmlFor={id} />\n {children ? <Styled.Label htmlFor={id}>{children}</Styled.Label> : null}\n </Styled.Root>\n )\n}\n"],"names":["Switcher","props","inputRef","createRef","id","value","name","children","tabIndex","onChange","restProps","_excluded","_jsxs","Styled.Root","_objectSpread","_jsx","Styled.Input","checked","type","ref","event","disabled","target","Styled.Switcher","htmlFor","Styled.Label","defaultProps","color","displayName"],"mappings":"iVAqDO,SAASA,EAASC,GACvB,IAAMC,EAAWC,IACjB,IAAMC,GAAEA,EAAFC,MAAMA,EAANC,KAAaA,EAAbC,SAAmBA,EAAnBC,SAA6BA,EAA7BC,SAAuCA,GAA2BR,EAAdS,IAAcT,EAAxEU,GAQA,OACEC,EAACC,EAADC,EAAAA,EAAA,CAAaT,MAAOA,GAAWK,GAA/B,GAAA,CAAAH,SACE,CAAAQ,EAACC,EAAD,CACEZ,GAAIA,EACJE,KAAMA,EACNW,QAASZ,EACTa,KAAK,WACLV,SAAUA,EACVW,IAAKjB,EACLO,SAf4DW,IAC3DnB,EAAMoB,UAAgC,mBAAbZ,GAC5BA,EAASW,EAAME,OAAOL,QAASG,MAe/BL,EAACQ,EAAD,CAAiBC,QAASpB,IACzBG,EAAWQ,EAACU,EAAD,CAAcD,QAASpB,EAAvBG,SAA4BA,IAA2B,SApCzEP,EAAS0B,aAAe,CACtBrB,OAAO,EACPgB,UAAU,EACVM,MAAO,YAGT3B,EAAS4B,YAAc"}
|
package/components/Tabs/style.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o,{css as t}from'styled-components';import{color as r}from'../../mixins/color.js';var e=o=>t(["border-bottom:1px solid ",";"],o);var i=t(["color:",";position:relative;&:after{width:initial;opacity:1;}"],(o=>o.theme.colors.primary));var n=o.div.withConfig({shouldForwardProp:o=>'children'===o}).withConfig({componentId:"fox-ui__sc-ggtlgu-0"})(["color:rgba(247,247,247,1);display:flex;align-items:flex-end;justify-content:center;flex-direction:row;"," ",""],(o=>o.borderColor&&!o.noBorder?r(o.borderColor,e):null),(o=>o.color?r(o.color):null));var l=o.div.withConfig({componentId:"fox-ui__sc-ggtlgu-1"})(["position:relative;display:block;width:auto;height:auto;padding:0;margin:0 -20px;box-sizing:border-box;background:transparent;overflow:visible;max-width:100%;width:100%;&::before,&::after{position:absolute;z-index:1;top:0;bottom:0;display:block;content:'';width:20px;height:100%;}&::before{left:0;background:linear-gradient(-90deg,rgba(247,247,247,0) 0%,currentColor 100%);}&::after{right:0;background:linear-gradient(90deg,rgba(247,247,247,0) 0%,currentColor 100%);}"]);var a=o.div.withConfig({componentId:"fox-ui__sc-ggtlgu-2"})(["display:block;max-width:calc(100% - 40px);padding:0;margin:0 auto;white-space:nowrap;box-sizing:border-box;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;color:",";scrollbar-width:none;&::-webkit-scrollbar{height:0;background:transparent;visibility:hidden;}&::-webkit-scrollbar-thumb{height:0px;background:transparent;visibility:hidden;}",""],(o=>o.theme.colors.mineShaft),(o=>o.noBorder?t(["display:flex;justify-content:space-between;width:100%;"]):null));var c=o.div.withConfig({componentId:"fox-ui__sc-ggtlgu-3"})(["display:inline-block;margin-bottom:-1px;flex-shrink:0;font-size:16px;font-weight:bold;line-height:20px;padding-bottom:14px;text-decoration:none;cursor:pointer;z-index:2;transition:color 0.2s ease-out;"," "," &:after{opacity:0;width:0;content:'';height:3px;position:absolute;bottom:-1px;z-index:1;left:0;right:0;background-color:currentColor;transition:opacity 0.2s ease-out;}&:hover{color:",";}& + &{margin-left:60px;}"," ","
|
|
1
|
+
import o,{css as t}from'styled-components';import{color as r}from'../../mixins/color.js';var e=o=>t(["border-bottom:1px solid ",";"],o);var i=t(["color:",";position:relative;&:after{width:initial;opacity:1;}"],(o=>o.theme.colors.primary));var n=o.div.withConfig({shouldForwardProp:o=>'children'===o}).withConfig({componentId:"fox-ui__sc-ggtlgu-0"})(["color:rgba(247,247,247,1);display:flex;align-items:flex-end;justify-content:center;flex-direction:row;"," ",""],(o=>o.borderColor&&!o.noBorder?r(o.borderColor,e):null),(o=>o.color?r(o.color):null));var l=o.div.withConfig({componentId:"fox-ui__sc-ggtlgu-1"})(["position:relative;display:block;width:auto;height:auto;padding:0;margin:0 -20px;box-sizing:border-box;background:transparent;overflow:visible;max-width:100%;width:100%;&::before,&::after{position:absolute;z-index:1;top:0;bottom:0;display:block;content:'';width:20px;height:100%;}&::before{left:0;background:linear-gradient(-90deg,rgba(247,247,247,0) 0%,currentColor 100%);}&::after{right:0;background:linear-gradient(90deg,rgba(247,247,247,0) 0%,currentColor 100%);}"]);var a=o.div.withConfig({componentId:"fox-ui__sc-ggtlgu-2"})(["display:block;max-width:calc(100% - 40px);padding:0;margin:0 auto;white-space:nowrap;box-sizing:border-box;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;color:",";scrollbar-width:none;&::-webkit-scrollbar{height:0;background:transparent;visibility:hidden;}&::-webkit-scrollbar-thumb{height:0px;background:transparent;visibility:hidden;}",""],(o=>o.theme.colors.mineShaft),(o=>o.noBorder?t(["display:flex;justify-content:space-between;width:100%;"]):null));var c=o.div.withConfig({shouldForwardProp:o=>!['themeKey','color','borderColor','active'].includes(o)}).withConfig({componentId:"fox-ui__sc-ggtlgu-3"})(["display:inline-block;margin-bottom:-1px;flex-shrink:0;font-size:16px;font-weight:bold;line-height:20px;padding-bottom:14px;text-decoration:none;cursor:pointer;z-index:2;transition:color 0.2s ease-out;"," "," &:after{opacity:0;width:0;content:'';height:3px;position:absolute;bottom:-1px;z-index:1;left:0;right:0;background-color:currentColor;transition:opacity 0.2s ease-out;}&:hover{color:",";}& + &{margin-left:60px;}"," ",""],(o=>o.color?r(o.color):null),(o=>o.borderColor?r(o.borderColor,e):null),(o=>o.theme.colors.primary),(o=>o.themeKey?(o=>{switch(o){case'compact':return t(["font-weight:normal;& + &{margin-left:20px;}"]);case'crispyCompact':return t(["text-transform:uppercase;font-size:12px;height:16px;line-height:16px;padding-bottom:8px;border-bottom:1px solid ",";& + &{margin-left:18px;}"],(o=>o.theme.colors.mercury));case'crispy':return t(["height:35px;text-transform:uppercase;font-size:12px;& + &{margin-left:32px;}"]);default:return null}})(o.themeKey):null),(o=>o.active?i:null));export{a as Content,l as Inner,n as Root,c as Tab};
|
|
2
2
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Tabs/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { color } from 'mixins/color'\nimport { TabsProps } from './Tabs'\nimport { TabProps } from './Tab'\n\nconst borderColor = (color: string) => css`\n border-bottom: 1px solid ${color};\n`\n\nconst getThemedCss = (theme: TabProps['theme']) => {\n switch (theme) {\n case 'compact':\n return css`\n font-weight: normal;\n & + & {\n margin-left: 20px;\n }\n `\n case 'crispyCompact':\n return css`\n text-transform: uppercase;\n font-size: 12px;\n height: 16px;\n line-height: 16px;\n padding-bottom: 8px;\n border-bottom: 1px solid ${(props) => props.theme.colors.mercury};\n & + & {\n margin-left: 18px;\n }\n `\n case 'crispy':\n return css`\n height: 35px;\n text-transform: uppercase;\n font-size: 12px;\n & + & {\n margin-left: 32px;\n }\n `\n default:\n return null\n }\n}\n\nconst activeTab = css`\n color: ${(props) => props.theme.colors.primary};\n position: relative;\n &:after {\n width: initial;\n opacity: 1;\n }\n`\n\nexport const Root = styled.div.withConfig({\n shouldForwardProp: (prop) => prop === 'children',\n})<Pick<TabsProps, 'noBorder' | 'borderColor' | 'color'>>`\n color: rgba(247, 247, 247, 1);\n display: flex;\n align-items: flex-end;\n justify-content: center;\n flex-direction: row;\n ${(props) => (props.borderColor && !props.noBorder ? color(props.borderColor, borderColor) : null)}\n ${(props) => (props.color ? color(props.color) : null)}\n`\n\nexport const Inner = styled.div`\n position: relative;\n display: block;\n width: auto;\n height: auto;\n padding: 0;\n margin: 0 -20px;\n box-sizing: border-box;\n background: transparent;\n overflow: visible;\n max-width: 100%;\n width: 100%;\n &::before,\n &::after {\n position: absolute;\n z-index: 1;\n top: 0;\n bottom: 0;\n display: block;\n content: '';\n width: 20px;\n height: 100%;\n }\n\n &::before {\n left: 0;\n background: linear-gradient(-90deg, rgba(247, 247, 247, 0) 0%, currentColor 100%);\n }\n\n &::after {\n right: 0;\n background: linear-gradient(90deg, rgba(247, 247, 247, 0) 0%, currentColor 100%);\n }\n`\n\nexport const Content = styled.div<Pick<TabsProps, 'noBorder'>>`\n display: block;\n max-width: calc(100% - 40px);\n padding: 0;\n margin: 0 auto;\n white-space: nowrap;\n box-sizing: border-box;\n overflow-x: auto;\n overflow-y: hidden;\n -webkit-overflow-scrolling: touch;\n color: ${(props) => props.theme.colors.mineShaft};\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n height: 0;\n background: transparent;\n visibility: hidden;\n }\n\n &::-webkit-scrollbar-thumb {\n height: 0px;\n background: transparent;\n visibility: hidden;\n }\n\n ${(props) =>\n props.noBorder\n ? css`\n display: flex;\n justify-content: space-between;\n width: 100%;\n `\n : null}\n`\n\nexport const Tab = styled.div<TabProps & { themeKey: TabProps['theme'] }
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Tabs/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { color } from 'mixins/color'\nimport { TabsProps } from './Tabs'\nimport { TabProps } from './Tab'\n\nconst borderColor = (color: string) => css`\n border-bottom: 1px solid ${color};\n`\n\nconst getThemedCss = (theme: TabProps['theme']) => {\n switch (theme) {\n case 'compact':\n return css`\n font-weight: normal;\n & + & {\n margin-left: 20px;\n }\n `\n case 'crispyCompact':\n return css`\n text-transform: uppercase;\n font-size: 12px;\n height: 16px;\n line-height: 16px;\n padding-bottom: 8px;\n border-bottom: 1px solid ${(props) => props.theme.colors.mercury};\n & + & {\n margin-left: 18px;\n }\n `\n case 'crispy':\n return css`\n height: 35px;\n text-transform: uppercase;\n font-size: 12px;\n & + & {\n margin-left: 32px;\n }\n `\n default:\n return null\n }\n}\n\nconst activeTab = css`\n color: ${(props) => props.theme.colors.primary};\n position: relative;\n &:after {\n width: initial;\n opacity: 1;\n }\n`\n\nexport const Root = styled.div.withConfig({\n shouldForwardProp: (prop) => prop === 'children',\n})<Pick<TabsProps, 'noBorder' | 'borderColor' | 'color'>>`\n color: rgba(247, 247, 247, 1);\n display: flex;\n align-items: flex-end;\n justify-content: center;\n flex-direction: row;\n ${(props) => (props.borderColor && !props.noBorder ? color(props.borderColor, borderColor) : null)}\n ${(props) => (props.color ? color(props.color) : null)}\n`\n\nexport const Inner = styled.div`\n position: relative;\n display: block;\n width: auto;\n height: auto;\n padding: 0;\n margin: 0 -20px;\n box-sizing: border-box;\n background: transparent;\n overflow: visible;\n max-width: 100%;\n width: 100%;\n &::before,\n &::after {\n position: absolute;\n z-index: 1;\n top: 0;\n bottom: 0;\n display: block;\n content: '';\n width: 20px;\n height: 100%;\n }\n\n &::before {\n left: 0;\n background: linear-gradient(-90deg, rgba(247, 247, 247, 0) 0%, currentColor 100%);\n }\n\n &::after {\n right: 0;\n background: linear-gradient(90deg, rgba(247, 247, 247, 0) 0%, currentColor 100%);\n }\n`\n\nexport const Content = styled.div<Pick<TabsProps, 'noBorder'>>`\n display: block;\n max-width: calc(100% - 40px);\n padding: 0;\n margin: 0 auto;\n white-space: nowrap;\n box-sizing: border-box;\n overflow-x: auto;\n overflow-y: hidden;\n -webkit-overflow-scrolling: touch;\n color: ${(props) => props.theme.colors.mineShaft};\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n height: 0;\n background: transparent;\n visibility: hidden;\n }\n\n &::-webkit-scrollbar-thumb {\n height: 0px;\n background: transparent;\n visibility: hidden;\n }\n\n ${(props) =>\n props.noBorder\n ? css`\n display: flex;\n justify-content: space-between;\n width: 100%;\n `\n : null}\n`\n\nexport const Tab = styled.div.withConfig<TabProps & { themeKey: TabProps['theme'] }>({\n shouldForwardProp: (prop) => !['themeKey', 'color', 'borderColor', 'active'].includes(prop),\n})`\n display: inline-block;\n margin-bottom: -1px;\n flex-shrink: 0;\n font-size: 16px;\n font-weight: bold;\n line-height: 20px;\n padding-bottom: 14px;\n text-decoration: none;\n cursor: pointer;\n z-index: 2;\n transition: color 0.2s ease-out;\n ${(props) => (props.color ? color(props.color) : null)}\n ${(props) => (props.borderColor ? color(props.borderColor, borderColor) : null)}\n &:after {\n opacity: 0;\n width: 0;\n content: '';\n height: 3px;\n position: absolute;\n bottom: -1px;\n z-index: 1;\n left: 0;\n right: 0;\n background-color: currentColor;\n transition: opacity 0.2s ease-out;\n }\n &:hover {\n color: ${(props) => props.theme.colors.primary};\n }\n & + & {\n margin-left: 60px;\n }\n ${(props) => (props.themeKey ? getThemedCss(props.themeKey) : null)}\n ${(props) => (props.active ? activeTab : null)}\n`\n"],"names":["borderColor","color","css","activeTab","props","theme","colors","primary","Root","styled","div","withConfig","shouldForwardProp","prop","componentId","noBorder","Inner","Content","mineShaft","Tab","includes","themeKey","mercury","active"],"mappings":"yFAKA,IAAMA,EAAeC,GAAkBC,EAAnB,CAAA,2BAAA,KACSD,GAsC7B,IAAME,EAAYD,EAAH,CAAA,SAAA,yDACHE,GAAUA,EAAMC,MAAMC,OAAOC,UAQlC,IAAMC,EAAOC,EAAOC,IAAIC,WAAW,CACxCC,kBAAoBC,GAAkB,aAATA,IADdF,WAAA,CAAAG,YAAA,uBAAGL,CAAH,CAAA,yGAAA,IAAA,KAQZL,GAAWA,EAAMJ,cAAgBI,EAAMW,SAAWd,EAAMG,EAAMJ,YAAaA,GAAe,OAC1FI,GAAWA,EAAMH,MAAQA,EAAMG,EAAMH,OAAS,OAGtCe,IAAAA,EAAQP,EAAOC,IAAVC,WAAA,CAAAG,YAAA,uBAAGL,CAAd,CAAA,udAmCMQ,IAAAA,EAAUR,EAAOC,IAAVC,WAAA,CAAAG,YAAA,uBAAGL,CAAH,CAAA,uLAAA,iLAAA,KAURL,GAAUA,EAAMC,MAAMC,OAAOY,YAepCd,GACDA,EAAMW,SACFb,EADJ,CAAA,2DAMI,OAGD,IAAMiB,EAAMV,EAAOC,IAAIC,WAAuD,CACnFC,kBAAoBC,IAAU,CAAC,WAAY,QAAS,cAAe,UAAUO,SAASP,KADxEF,WAAA,CAAAG,YAAA,uBAAGL,CAAH,CAAA,2MAAA,IAAA,yLAAA,6BAAA,IAAA,KAcXL,GAAWA,EAAMH,MAAQA,EAAMG,EAAMH,OAAS,OAC9CG,GAAWA,EAAMJ,YAAcC,EAAMG,EAAMJ,YAAaA,GAAe,OAe9DI,GAAUA,EAAMC,MAAMC,OAAOC,UAKtCH,GAAWA,EAAMiB,SAjKAhB,CAAAA,IACpB,OAAQA,GACN,IAAK,UACH,OAAOH,EAAP,CAAA,gDAMF,IAAK,gBACH,OAAOA,EAMuBE,CAAAA,mHAAAA,8BAAAA,GAAUA,EAAMC,MAAMC,OAAOgB,UAK7D,IAAK,SACH,OAAOpB,EAAP,CAAA,iFAQF,QACE,OAAO,OA/BSG,CAiKwBD,EAAMiB,UAAY,OAC3DjB,GAAWA,EAAMmB,OAASpB,EAAY"}
|
package/components/Tag/Tag.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import t from'@babel/runtime/helpers/esm/objectSpread2';import{Root as n,Text as i}from'./style.js';import{jsx as r,jsxs as o}from'react/jsx-runtime';var a=["as","textProps","content","children","htmlFor","id","name","inputType","value","disabled","onChange","onClick","inverse","checked"];function l(e){return r(s,t({as:"input"},e))}function s(l){var{as:s,textProps:
|
|
1
|
+
import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import t from'@babel/runtime/helpers/esm/objectSpread2';import{Root as n,Text as i}from'./style.js';import{jsx as r,jsxs as o}from'react/jsx-runtime';var a=["as","textProps","content","children","htmlFor","id","name","inputType","value","disabled","onChange","onClick","inverse","checked"];function l(e){return r(s,t({as:"input"},e))}function s(l){var{as:s,textProps:p,content:u,children:d,htmlFor:c,id:h,name:m,inputType:b,value:f,disabled:k,onChange:g,onClick:v,inverse:y,checked:x}=l,C=e(l,a);var j='button'===s?{type:'button'}:{};var S='input'===s?{htmlFor:h||m}:{};return o(n,t(t(t(t(t({as:'input'===s?'label':s,inverse:y,checked:x,disabled:k,onClick:'input'!==s?v:void 0},'label'===s?{htmlFor:c}:{}),j),S),C),{},{children:['input'===s?r("input",{id:h||m,name:m,type:b||'checkbox',tabIndex:0,onChange:function(e){function t(t){return e.apply(this,arguments)}return t.toString=()=>e.toString(),t}((e=>(e.persist(),g&&g(e)))),onClick:function(e){function t(t){return e.apply(this,arguments)}return t.toString=()=>e.toString(),t}((e=>(e.persist(),v&&v(e)))),defaultChecked:l.defaultChecked,checked:x,value:f,disabled:k,hidden:!0}):null,d,r(i,t(t({size:14,forwardedAs:"span",color:x&&!y?'white':'mineShaft'},p),{},{children:u}))]}))}s.defaultProps={display:'inline-block',as:'button',height:40},l.defaultProps={display:'inline-block',height:40},s.Input=l,s.displayName='Tag';export{s as Tag};
|
|
2
2
|
//# sourceMappingURL=Tag.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { Color } from '../../mixins/color'\nimport { Display } from '../../mixins/display'\nimport { BaseProps } from '../../shared/interfaces'\nimport { TextProps } from '../Text/Text'\nimport * as Styled from './style'\n\nexport interface TagProps extends BaseProps, Display, Color, ResponsiveProperty<'height'>, ResponsiveProperty<'width'> {\n as?: 'button' | 'div' | 'input' | 'label'\n /**\n * Field id\n */\n id?: string\n /**\n * Field name\n */\n name?: string\n /**\n * Input type\n */\n inputType?: 'checkbox' | 'radio'\n /**\n * On change handler\n */\n onChange?(_e: React.ChangeEvent<HTMLInputElement>): void\n /**\n * On click handler\n */\n onClick?(_e: React.MouseEvent<HTMLInputElement>): void\n /**\n * Whether or not Radio is checked\n */\n defaultChecked?: boolean\n /**\n * Value\n */\n value?: string | number\n /** Children are placed before Text */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /** Inner Text content */\n content?: React.ReactNode\n /** Inner Text component props */\n textProps?: TextProps\n /** Checked state */\n checked?: boolean\n /** Disabled state */\n disabled?: boolean\n /** Error state */\n error?: boolean\n /** If as = 'label' could provide for */\n htmlFor?: string\n /**\n * inverse\n */\n inverse?: boolean\n /**\n * Size\n */\n size?: 'l' | 'm' | 's' | 'xs'\n}\n\nTag.defaultProps = {\n display: 'inline-block',\n as: 'button',\n height: 40,\n}\n\nTagInput.defaultProps = {\n display: 'inline-block',\n height: 40,\n}\n\n// Prevent brakechanges\nTag.Input = TagInput\n\nfunction TagInput(props: typeof TagInput.defaultProps & TagProps) {\n return <Tag as='input' {...props} />\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`ResponsiveProperty<'width'>`](#/Миксины)\n * - [`ResponsiveProperty<'height'>`](#/Миксины)\n */\nexport function Tag(props: typeof Tag.defaultProps & TagProps) {\n const {\n as,\n textProps,\n content,\n children,\n htmlFor,\n id,\n name,\n inputType,\n value,\n disabled,\n onChange,\n onClick,\n inverse,\n checked,\n ...restProps\n } = props\n\n const buttonProps = as === 'button' ? { type: 'button' } : {}\n const labelProps = as === 'label' ? { htmlFor } : {}\n const inputProps = as === 'input' ? { htmlFor: id || name } : {}\n\n return (\n <Styled.Root\n as={as === 'input' ? 'label' : as}\n inverse={inverse}\n checked={checked}\n disabled={disabled}\n onClick={as !== 'input' ? onClick : undefined}\n {...labelProps}\n {...buttonProps}\n {...inputProps}\n {...restProps}\n >\n {as === 'input' ? (\n <input\n id={id || name}\n name={name}\n type={inputType || 'checkbox'}\n tabIndex={0}\n onChange={(e) => {\n e.persist()\n\n return onChange && onChange(e)\n }}\n onClick={(e) => {\n e.persist()\n\n return onClick && onClick(e)\n }}\n defaultChecked={props.defaultChecked}\n checked={checked}\n value={value}\n disabled={disabled}\n hidden\n />\n ) : null}\n {children}\n <Styled.Text size={14} forwardedAs='span' color={checked && !inverse ? 'white' : 'mineShaft'} {...textProps}>\n {content}\n </Styled.Text>\n </Styled.Root>\n )\n}\n"],"names":["TagInput","props","_jsx","Tag","_objectSpread","as","textProps","content","children","htmlFor","id","name","inputType","value","disabled","onChange","onClick","inverse","checked","restProps","_excluded","buttonProps","type","inputProps","_jsxs","Styled.Root","
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { Color } from '../../mixins/color'\nimport { Display } from '../../mixins/display'\nimport { BaseProps } from '../../shared/interfaces'\nimport { TextProps } from '../Text/Text'\nimport * as Styled from './style'\n\nexport interface TagProps extends BaseProps, Display, Color, ResponsiveProperty<'height'>, ResponsiveProperty<'width'> {\n as?: 'button' | 'div' | 'input' | 'label'\n /**\n * Field id\n */\n id?: string\n /**\n * Field name\n */\n name?: string\n /**\n * Input type\n */\n inputType?: 'checkbox' | 'radio'\n /**\n * On change handler\n */\n onChange?(_e: React.ChangeEvent<HTMLInputElement>): void\n /**\n * On click handler\n */\n onClick?(_e: React.MouseEvent<HTMLInputElement>): void\n /**\n * Whether or not Radio is checked\n */\n defaultChecked?: boolean\n /**\n * Value\n */\n value?: string | number\n /** Children are placed before Text */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /** Inner Text content */\n content?: React.ReactNode\n /** Inner Text component props */\n textProps?: TextProps\n /** Checked state */\n checked?: boolean\n /** Disabled state */\n disabled?: boolean\n /** Error state */\n error?: boolean\n /** If as = 'label' could provide for */\n htmlFor?: string\n /**\n * inverse\n */\n inverse?: boolean\n /**\n * Size\n */\n size?: 'l' | 'm' | 's' | 'xs'\n}\n\nTag.defaultProps = {\n display: 'inline-block',\n as: 'button',\n height: 40,\n}\n\nTagInput.defaultProps = {\n display: 'inline-block',\n height: 40,\n}\n\n// Prevent brakechanges\nTag.Input = TagInput\n\nTag.displayName = 'Tag'\n\nfunction TagInput(props: typeof TagInput.defaultProps & TagProps) {\n return <Tag as='input' {...props} />\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`ResponsiveProperty<'width'>`](#/Миксины)\n * - [`ResponsiveProperty<'height'>`](#/Миксины)\n */\nexport function Tag(props: typeof Tag.defaultProps & TagProps) {\n const {\n as,\n textProps,\n content,\n children,\n htmlFor,\n id,\n name,\n inputType,\n value,\n disabled,\n onChange,\n onClick,\n inverse,\n checked,\n ...restProps\n } = props\n\n const buttonProps = as === 'button' ? { type: 'button' } : {}\n const labelProps = as === 'label' ? { htmlFor } : {}\n const inputProps = as === 'input' ? { htmlFor: id || name } : {}\n\n return (\n <Styled.Root\n as={as === 'input' ? 'label' : as}\n inverse={inverse}\n checked={checked}\n disabled={disabled}\n onClick={as !== 'input' ? onClick : undefined}\n {...labelProps}\n {...buttonProps}\n {...inputProps}\n {...restProps}\n >\n {as === 'input' ? (\n <input\n id={id || name}\n name={name}\n type={inputType || 'checkbox'}\n tabIndex={0}\n onChange={(e) => {\n e.persist()\n\n return onChange && onChange(e)\n }}\n onClick={(e) => {\n e.persist()\n\n return onClick && onClick(e)\n }}\n defaultChecked={props.defaultChecked}\n checked={checked}\n value={value}\n disabled={disabled}\n hidden\n />\n ) : null}\n {children}\n <Styled.Text size={14} forwardedAs='span' color={checked && !inverse ? 'white' : 'mineShaft'} {...textProps}>\n {content}\n </Styled.Text>\n </Styled.Root>\n )\n}\n"],"names":["TagInput","props","_jsx","Tag","_objectSpread","as","textProps","content","children","htmlFor","id","name","inputType","value","disabled","onChange","onClick","inverse","checked","restProps","_excluded","buttonProps","type","inputProps","_jsxs","Styled.Root","tabIndex","_onChange","_x","apply","this","arguments","toString","e","persist","_onClick","_x2","defaultChecked","hidden","Styled.Text","size","forwardedAs","color","defaultProps","display","height","Input","displayName"],"mappings":"oWAgFA,SAASA,EAASC,GAChB,OAA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,EACDN,EAACqC,EAADnC,EAAAA,EAAA,CAAaoC,KAAM,GAAIC,YAAY,OAAOC,MAAOxB,IAAYD,EAAU,QAAU,aAAiBX,GAAlG,GAAA,CAAAE,SACGD,SAxFTJ,EAAIwC,aAAe,CACjBC,QAAS,eACTvC,GAAI,SACJwC,OAAQ,IAGV7C,EAAS2C,aAAe,CACtBC,QAAS,eACTC,OAAQ,IAIV1C,EAAI2C,MAAQ9C,EAEZG,EAAI4C,YAAc"}
|
package/components/Text/Text.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TextHeading as e}from'../Text.Heading/Text.Heading.js';import{TextEllipse as i}from'../Text.Ellipse/Text.Ellipse.js';import{Root as s}from'./style.js';import{jsx as t}from'react/jsx-runtime';function l(e){var{as:i="div",children:l,weight:n="normal",content:a,textAlign:r,underlineLinks:o,className:
|
|
1
|
+
import{TextHeading as e}from'../Text.Heading/Text.Heading.js';import{TextEllipse as i}from'../Text.Ellipse/Text.Ellipse.js';import{Root as s}from'./style.js';import{jsx as t}from'react/jsx-runtime';function l(e){var{as:i="div",children:l,weight:n="normal",content:a,textAlign:r,underlineLinks:o,className:m,style:z,lineHeight:d="m",fontStyle:g="normal",title:x,color:p="black",size:c="m",sizeXS:y,sizeS:L,sizeM:S,sizeL:h,sizeXL:T,display:f}=e;return t(s,l?{as:i,color:p,className:m,title:x,weight:n,lineHeight:d,textAlign:r,fontStyle:g,underlineLinks:o,size:c,sizeXS:y,sizeS:L,sizeM:S,sizeL:h,sizeXL:T,display:f,style:z,children:l}:{as:i,color:p,className:m,title:x,weight:n,lineHeight:d,textAlign:r,fontStyle:g,underlineLinks:o,size:c,sizeXS:y,sizeS:L,sizeM:S,sizeL:h,sizeXL:T,display:f,style:z,dangerouslySetInnerHTML:{__html:a||''}})}l.Heading=e,l.Ellipse=i,l.displayName='Text';export{l as Text};
|
|
2
2
|
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sources":["../../../../src/components/Text/Text.tsx"],"sourcesContent":["import { TextHeading } from '../../components/Text.Heading'\nimport { TextEllipse } from '../../components/Text.Ellipse'\nimport { Color } from '../../mixins/color'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { Display } from '../../mixins/display'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface TextProps extends BaseProps, Color, ResponsiveProperty<'size'>, Display {\n /**\n * An element type to render as (string).\n */\n as?: 'div' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'p'\n /**\n * Primary content\n */\n content?: string\n /**\n * Primary content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Text font weight\n */\n weight?: 'lighter' | 'normal' | 'bold' | 'bolder' | number\n /**\n * Text font style\n */\n fontStyle?: 'normal' | 'italic'\n /**\n * Add underline to inline links\n */\n underlineLinks?: boolean\n /**\n * Text align\n */\n textAlign?: 'left' | 'center' | 'right'\n /**\n * Line height\n */\n lineHeight?: 'l' | 'm' | 's' | 'xs' | number\n /**\n * Element title\n */\n title?: string\n}\n\nText.Heading = TextHeading\nText.Ellipse = TextEllipse\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'size'>`](#/Миксины)\n */\nexport function Text(props: TextProps) {\n const {\n as = 'div',\n children,\n weight = 'normal',\n content,\n textAlign,\n underlineLinks,\n className,\n style,\n lineHeight = 'm',\n fontStyle = 'normal',\n title,\n color = 'black',\n size = 'm',\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n display,\n } = props\n\n if (children) {\n return (\n <Styled.Root\n as={as}\n color={color}\n className={className}\n title={title}\n weight={weight}\n lineHeight={lineHeight}\n textAlign={textAlign}\n fontStyle={fontStyle}\n underlineLinks={underlineLinks}\n size={size}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n display={display}\n style={style}\n >\n {children}\n </Styled.Root>\n )\n }\n\n return (\n <Styled.Root\n as={as}\n color={color}\n className={className}\n title={title}\n weight={weight}\n lineHeight={lineHeight}\n textAlign={textAlign}\n fontStyle={fontStyle}\n underlineLinks={underlineLinks}\n size={size}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n display={display}\n style={style}\n dangerouslySetInnerHTML={{ __html: content || '' }}\n />\n )\n}\n"],"names":["Text","props","as","children","weight","content","textAlign","underlineLinks","className","style","lineHeight","fontStyle","title","color","size","sizeXS","sizeS","sizeM","sizeL","sizeXL","display","_jsx","Styled.Root","dangerouslySetInnerHTML","__html","Heading","TextHeading","Ellipse","TextEllipse"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text.js","sources":["../../../../src/components/Text/Text.tsx"],"sourcesContent":["import { TextHeading } from '../../components/Text.Heading'\nimport { TextEllipse } from '../../components/Text.Ellipse'\nimport { Color } from '../../mixins/color'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { Display } from '../../mixins/display'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nexport interface TextProps extends BaseProps, Color, ResponsiveProperty<'size'>, Display {\n /**\n * An element type to render as (string).\n */\n as?: 'div' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'p'\n /**\n * Primary content\n */\n content?: string\n /**\n * Primary content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Text font weight\n */\n weight?: 'lighter' | 'normal' | 'bold' | 'bolder' | number\n /**\n * Text font style\n */\n fontStyle?: 'normal' | 'italic'\n /**\n * Add underline to inline links\n */\n underlineLinks?: boolean\n /**\n * Text align\n */\n textAlign?: 'left' | 'center' | 'right'\n /**\n * Line height\n */\n lineHeight?: 'l' | 'm' | 's' | 'xs' | number\n /**\n * Element title\n */\n title?: string\n}\n\nText.Heading = TextHeading\nText.Ellipse = TextEllipse\nText.displayName = 'Text'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'size'>`](#/Миксины)\n */\nexport function Text(props: TextProps) {\n const {\n as = 'div',\n children,\n weight = 'normal',\n content,\n textAlign,\n underlineLinks,\n className,\n style,\n lineHeight = 'm',\n fontStyle = 'normal',\n title,\n color = 'black',\n size = 'm',\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n display,\n } = props\n\n if (children) {\n return (\n <Styled.Root\n as={as}\n color={color}\n className={className}\n title={title}\n weight={weight}\n lineHeight={lineHeight}\n textAlign={textAlign}\n fontStyle={fontStyle}\n underlineLinks={underlineLinks}\n size={size}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n display={display}\n style={style}\n >\n {children}\n </Styled.Root>\n )\n }\n\n return (\n <Styled.Root\n as={as}\n color={color}\n className={className}\n title={title}\n weight={weight}\n lineHeight={lineHeight}\n textAlign={textAlign}\n fontStyle={fontStyle}\n underlineLinks={underlineLinks}\n size={size}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n display={display}\n style={style}\n dangerouslySetInnerHTML={{ __html: content || '' }}\n />\n )\n}\n"],"names":["Text","props","as","children","weight","content","textAlign","underlineLinks","className","style","lineHeight","fontStyle","title","color","size","sizeXS","sizeS","sizeM","sizeL","sizeXL","display","_jsx","Styled.Root","dangerouslySetInnerHTML","__html","Heading","TextHeading","Ellipse","TextEllipse","displayName"],"mappings":"sMA6DO,SAASA,EAAKC,GACnB,IAAMC,GACJA,EAAK,MADDC,SAEJA,EAFIC,OAGJA,EAAS,SAHLC,QAIJA,EAJIC,UAKJA,EALIC,eAMJA,EANIC,UAOJA,EAPIC,MAQJA,EARIC,WASJA,EAAa,IATTC,UAUJA,EAAY,SAVRC,MAWJA,EAXIC,MAYJA,EAAQ,QAZJC,KAaJA,EAAO,IAbHC,OAcJA,EAdIC,MAeJA,EAfIC,MAgBJA,EAhBIC,MAiBJA,EAjBIC,OAkBJA,EAlBIC,QAmBJA,GACEnB,EAEJ,OAEIoB,EAACC,EAFDnB,EAEA,CACED,GAAIA,EACJW,MAAOA,EACPL,UAAWA,EACXI,MAAOA,EACPR,OAAQA,EACRM,WAAYA,EACZJ,UAAWA,EACXK,UAAWA,EACXJ,eAAgBA,EAChBO,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,QAASA,EACTX,MAAOA,EAjBTN,SAmBGA,GAML,CACED,GAAIA,EACJW,MAAOA,EACPL,UAAWA,EACXI,MAAOA,EACPR,OAAQA,EACRM,WAAYA,EACZJ,UAAWA,EACXK,UAAWA,EACXJ,eAAgBA,EAChBO,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,QAASA,EACTX,MAAOA,EACPc,wBAAyB,CAAEC,OAAQnB,GAAW,MA/EpDL,EAAKyB,QAAUC,EACf1B,EAAK2B,QAAUC,EACf5B,EAAK6B,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import t from'@babel/runtime/helpers/esm/objectSpread2';import{Component as s}from'react';import{Spacer as i}from'../Spacer/Spacer.js';import{Anchor as r}from'../Anchor/Anchor.js';import{Text as o}from'../Text/Text.js';import{Ul as l,Li as a}from'./style.js';import{jsx as n,jsxs as p}from'react/jsx-runtime';var h=["className","style","moreText","lessText","showToggler"];class c extends s{constructor(e){super(e),this.
|
|
1
|
+
import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import t from'@babel/runtime/helpers/esm/objectSpread2';import{Component as s}from'react';import{Spacer as i}from'../Spacer/Spacer.js';import{Anchor as r}from'../Anchor/Anchor.js';import{Text as o}from'../Text/Text.js';import{Ul as l,Li as a}from'./style.js';import{jsx as n,jsxs as p}from'react/jsx-runtime';var h=["className","style","moreText","lessText","showToggler"];class c extends s{constructor(e){super(e),this.getContent=e=>{var{content:s,chars:i=0}=this.props;if(!s)return'';var{isEllipsed:r}=this.state;var p='string'==typeof s?'':[];if(this.state.isUnFolded)p=s;else if('string'==typeof p)p=(r=s.length>i)?"".concat(s.slice(0,i),"..."):s;else{var h=i;for(var c=0;c<s.length;c++){if(!(h-s[c].length>0)){r=!0,p[c]="".concat(s[c].slice(0,h),"...");break}h-=s[c].length,p[c]=s[c]}}return this.state.isEllipsed!==r&&setTimeout((()=>this.setState({isEllipsed:r}))),'string'==typeof p?n(o,t(t({},e),{},{content:this.getQuted(p)})):n(l,{children:p.map(((s,i)=>n(a,{children:n(o,t(t({},e),{},{display:"inline",content:s}))},i)))})},this.getQuted=e=>this.props.quoted?"«".concat(e,"»"):e,this.toggle=()=>{console.log(this.state),this.setState({isUnFolded:!this.state.isUnFolded})},this.state={isUnFolded:!1,isEllipsed:!1}}render(){var t=this.props,{className:s="",style:o,moreText:l="Читать полностью",lessText:a="Свернуть",showToggler:c=!0}=t,m=e(t,h);var{isUnFolded:d,isEllipsed:g}=this.state;return p("div",{className:s,style:o,children:[this.getContent(m),c&&g&&n(i,{marginTop:16,marginBottom:1,children:n(r,{pseudo:!0,onClick:this.toggle,children:d?a:l})})]})}}c.displayName='Text.Ellipse';export{c as TextEllipse};
|
|
2
2
|
//# sourceMappingURL=Text.Ellipse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.Ellipse.js","sources":["../../../../src/components/Text.Ellipse/Text.Ellipse.tsx"],"sourcesContent":["import { Component } from 'react'\nimport { Spacer } from '../Spacer/Spacer'\nimport { Anchor } from '../Anchor/Anchor'\nimport { Text, TextProps } from '../Text'\nimport * as Styled from './style'\n\nexport interface TextEllipseProps extends Omit<TextProps, 'content'> {\n /** Toggle text for folded state */\n moreText?: string\n /** Toggle text for unfolded state */\n lessText?: string\n /** Classname */\n className?: string\n /** Html content */\n content: string | string[]\n /** Characters quantity for ellipsed text */\n chars?: number\n /** Wrap text in quotes */\n quoted?: boolean\n /** Flag to show toggler */\n showToggler?: boolean\n}\n\ninterface TextEllipseState {\n isUnFolded: boolean\n isEllipsed: boolean\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'size'>`](#/Миксины)\n */\nexport class TextEllipse extends Component<TextEllipseProps, TextEllipseState> {\n displayName = 'Text.Ellipse'\n\n constructor(props: TextEllipseProps) {\n super(props)\n\n this.state = {\n isUnFolded: false,\n isEllipsed: false,\n }\n }\n\n // componentDidUpdate({ content }: Props) {\n // if (content !== this.props.content && this.state.isUnFolded) {\n // this.toggle()\n // }\n // }\n\n getContent = (props: Omit<TextEllipseProps, 'className' | 'moreText' | 'lessText' | 'showToggler'>) => {\n const { content, chars = 0 } = this.props\n\n if (!content) return ''\n\n let { isEllipsed } = this.state\n let text: string | string[] = typeof content === 'string' ? '' : []\n\n if (!this.state.isUnFolded) {\n if (typeof text === 'string') {\n isEllipsed = content.length > chars\n\n text = isEllipsed ? `${content.slice(0, chars)}...` : content\n } else {\n let leftChars = chars\n\n for (let index = 0; index < content.length; index++) {\n if (leftChars - content[index].length > 0) {\n leftChars -= content[index].length\n\n text[index] = content[index]\n } else {\n isEllipsed = true\n text[index] = `${content[index].slice(0, leftChars)}...`\n\n break\n }\n }\n }\n } else {\n text = content\n }\n\n if (this.state.isEllipsed !== isEllipsed) setTimeout(() => this.setState({ isEllipsed }))\n\n return typeof text === 'string' ? (\n <Text {...props} content={this.getQuted(text)} />\n ) : (\n <Styled.Ul>\n {text.map((item, index) => (\n <Styled.Li key={index}>\n <Text {...props} display='inline' content={item} />\n </Styled.Li>\n ))}\n </Styled.Ul>\n )\n }\n\n getQuted = (content: string) => (this.props.quoted ? `«${content}»` : content)\n\n toggle = () => {\n console.log(this.state)\n this.setState({ isUnFolded: !this.state.isUnFolded })\n }\n\n render() {\n const {\n className = '',\n style,\n moreText = 'Читать полностью',\n lessText = 'Свернуть',\n showToggler = true,\n ...restProps\n } = this.props\n const { isUnFolded, isEllipsed } = this.state\n\n return (\n <div className={className} style={style}>\n {this.getContent(restProps)}\n {showToggler && isEllipsed && (\n <Spacer marginTop={16} marginBottom={1}>\n <Anchor pseudo onClick={this.toggle}>\n {isUnFolded ? lessText : moreText}\n </Anchor>\n </Spacer>\n )}\n </div>\n )\n }\n}\n"],"names":["TextEllipse","Component","constructor","props","super","this","
|
|
1
|
+
{"version":3,"file":"Text.Ellipse.js","sources":["../../../../src/components/Text.Ellipse/Text.Ellipse.tsx"],"sourcesContent":["import { Component } from 'react'\nimport { Spacer } from '../Spacer/Spacer'\nimport { Anchor } from '../Anchor/Anchor'\nimport { Text, TextProps } from '../Text'\nimport * as Styled from './style'\n\nexport interface TextEllipseProps extends Omit<TextProps, 'content'> {\n /** Toggle text for folded state */\n moreText?: string\n /** Toggle text for unfolded state */\n lessText?: string\n /** Classname */\n className?: string\n /** Html content */\n content: string | string[]\n /** Characters quantity for ellipsed text */\n chars?: number\n /** Wrap text in quotes */\n quoted?: boolean\n /** Flag to show toggler */\n showToggler?: boolean\n}\n\ninterface TextEllipseState {\n isUnFolded: boolean\n isEllipsed: boolean\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`ResponsiveProperty<'size'>`](#/Миксины)\n */\nexport class TextEllipse extends Component<TextEllipseProps, TextEllipseState> {\n static displayName = 'Text.Ellipse'\n\n constructor(props: TextEllipseProps) {\n super(props)\n\n this.state = {\n isUnFolded: false,\n isEllipsed: false,\n }\n }\n\n // componentDidUpdate({ content }: Props) {\n // if (content !== this.props.content && this.state.isUnFolded) {\n // this.toggle()\n // }\n // }\n\n getContent = (props: Omit<TextEllipseProps, 'className' | 'moreText' | 'lessText' | 'showToggler'>) => {\n const { content, chars = 0 } = this.props\n\n if (!content) return ''\n\n let { isEllipsed } = this.state\n let text: string | string[] = typeof content === 'string' ? '' : []\n\n if (!this.state.isUnFolded) {\n if (typeof text === 'string') {\n isEllipsed = content.length > chars\n\n text = isEllipsed ? `${content.slice(0, chars)}...` : content\n } else {\n let leftChars = chars\n\n for (let index = 0; index < content.length; index++) {\n if (leftChars - content[index].length > 0) {\n leftChars -= content[index].length\n\n text[index] = content[index]\n } else {\n isEllipsed = true\n text[index] = `${content[index].slice(0, leftChars)}...`\n\n break\n }\n }\n }\n } else {\n text = content\n }\n\n if (this.state.isEllipsed !== isEllipsed) setTimeout(() => this.setState({ isEllipsed }))\n\n return typeof text === 'string' ? (\n <Text {...props} content={this.getQuted(text)} />\n ) : (\n <Styled.Ul>\n {text.map((item, index) => (\n <Styled.Li key={index}>\n <Text {...props} display='inline' content={item} />\n </Styled.Li>\n ))}\n </Styled.Ul>\n )\n }\n\n getQuted = (content: string) => (this.props.quoted ? `«${content}»` : content)\n\n toggle = () => {\n console.log(this.state)\n this.setState({ isUnFolded: !this.state.isUnFolded })\n }\n\n render() {\n const {\n className = '',\n style,\n moreText = 'Читать полностью',\n lessText = 'Свернуть',\n showToggler = true,\n ...restProps\n } = this.props\n const { isUnFolded, isEllipsed } = this.state\n\n return (\n <div className={className} style={style}>\n {this.getContent(restProps)}\n {showToggler && isEllipsed && (\n <Spacer marginTop={16} marginBottom={1}>\n <Anchor pseudo onClick={this.toggle}>\n {isUnFolded ? lessText : moreText}\n </Anchor>\n </Spacer>\n )}\n </div>\n )\n }\n}\n"],"names":["TextEllipse","Component","constructor","props","super","this","getContent","content","chars","isEllipsed","state","text","isUnFolded","length","slice","leftChars","index","concat","setTimeout","setState","_jsx","Text","getQuted","Styled.Ul","children","map","item","Styled.Li","_objectSpread","display","quoted","toggle","console","log","render","_this$props","className","style","moreText","lessText","showToggler","restProps","_objectWithoutProperties","_excluded","_jsxs","Spacer","marginTop","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AaP,KAAKK,MAAME,cAhExCP,KAAKK,MAAQ,CACXE,YAAAA,EACAH,YAAY,GAiEhByB,SACE,IAAAC,EAOI9B,KAAKF,OAPHiC,UACJA,EAAY,GADRC,MAEJA,EAFIC,SAGJA,EAAW,mBAHPC,SAIJA,EAAW,WAJPC,YAKJA,GAAc,GALhBL,EAMKM,EANLC,EAAAP,EAAAQ,GAQA,IAAM/B,WAAEA,EAAFH,WAAcA,GAAeJ,KAAKK,MAExC,OACEkC,EAAA,MAAA,CAAKR,UAAWA,EAAWC,MAAOA,EAAlCb,SACG,CAAAnB,KAAKC,WAAWmC,GAChBD,GAAe/B,GACdW,EAACyB,EAAD,CAAQC,UAAW,GAAIC,aAAc,EAArCvB,SACEJ,EAAC4B,EAAD,CAAQC,QAAAA,EAAOC,QAAS7C,KAAK0B,OAA7BP,SACGZ,EAAa2B,EAAWD,UA1F1BtC,EACJmD,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/esm/objectSpread2';import r from'@babel/runtime/helpers/esm/objectWithoutProperties';import{useState as o,useCallback as a}from'react';import{Root as l}from'./style.js';import{jsx as t}from'react/jsx-runtime';var s=["cols","disabled","error","fluid","name","onChange","maxLength","placeholder","required","rounded","rows","tabIndex","value","className","style","children","autosize","maxRows","color","placeholderColor"];function n(n){var{cols:d,disabled:i,error:c,fluid:
|
|
1
|
+
import e from'@babel/runtime/helpers/esm/objectSpread2';import r from'@babel/runtime/helpers/esm/objectWithoutProperties';import{useState as o,useCallback as a}from'react';import{Root as l}from'./style.js';import{jsx as t}from'react/jsx-runtime';var s=["cols","disabled","error","fluid","name","onChange","maxLength","placeholder","required","rounded","rows","tabIndex","value","className","style","children","autosize","maxRows","color","placeholderColor"];function n(n){var{cols:d,disabled:i,error:c,fluid:m,name:u,onChange:h,maxLength:p,placeholder:f,required:x,rounded:g,rows:b,tabIndex:v,value:C,className:w,style:y,children:j,autosize:R,maxRows:L,color:N,placeholderColor:T}=n,q=r(n,s);var[z,I]=o(b);var S=a((e=>{var{target:r}=e;if(r instanceof HTMLTextAreaElement&&R){var o=r.getBoundingClientRect();r.scrollHeight>o.height&&z<L?I(z+1):r.value&&''!==r.value||I(b)}'function'==typeof h&&h(e)}),[h,z,L,R]);return t(l,e(e({className:w,style:y,onChange:S,cols:d,disabled:i,maxLength:p,name:u,placeholder:f,required:x,rows:z,tabIndex:v,value:C,color:N,rounded:g,placeholderColor:T,fluid:m,error:c},q),{},{children:j}))}n.defaultProps={onChange:e=>console.log(e,e.target.value),rounded:!0,width:'l',color:'mineShaft',placeholderColor:'silver',cols:20,maxRows:30,rows:2,autosize:!0},n.displayName='Textarea';export{n as Textarea};
|
|
2
2
|
//# sourceMappingURL=Textarea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { useCallback, useState } from 'react'\nimport { BaseProps, InputField } from '../../shared/interfaces'\nimport * as Styled from './style'\n\ntype TextAreaHTMLAttributes = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'cols' | 'rows' | 'color'>\n\nexport interface TextareaProps extends BaseProps, InputField, TextAreaHTMLAttributes {\n /**\n * Specifies the visible width of a text area\n */\n cols?: number\n /**\n * Specifies the visible number of lines in a text area\n */\n rows?: number\n /**\n * Specifies the visible max number of lines in a text area\n */\n maxRows?: number\n /**\n * Specifies the maximum number of characters allowed in the text area\n */\n maxLength?: number\n /**\n * On change handler\n */\n onChange?(_event: React.ChangeEvent<HTMLTextAreaElement>): void\n /**\n * Value\n */\n value?: string\n /**\n * Autosize for textarea\n */\n autosize?: boolean\n}\n\nTextarea.defaultProps = {\n onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => console.log(e, e.target.value), // eslint-disable-line no-console\n rounded: true,\n width: 'l',\n color: 'mineShaft',\n placeholderColor: 'silver',\n cols: 20,\n maxRows: 30,\n rows: 2,\n autosize: true,\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`InputField`](#/Миксины)\n * - `React.TextareaHTMLAttributes<HTMLTextAreaElement>`\n */\nexport function Textarea({\n cols,\n disabled,\n error,\n fluid,\n name,\n onChange,\n maxLength,\n placeholder,\n required,\n rounded,\n rows,\n tabIndex,\n value,\n className,\n style,\n children,\n autosize,\n maxRows,\n color,\n placeholderColor,\n ...props\n}: typeof Textarea.defaultProps & TextareaProps) {\n const [tRows, setRows] = useState(rows)\n\n const onChangeHandler: React.ChangeEventHandler<HTMLTextAreaElement> = useCallback(\n (event) => {\n const { target } = event\n\n if (target instanceof HTMLTextAreaElement && autosize) {\n const rect = target.getBoundingClientRect()\n\n if (target.scrollHeight > rect.height && tRows < maxRows) {\n setRows(tRows + 1)\n } else if (!target.value || target.value === '') {\n setRows(rows)\n }\n }\n\n if (typeof onChange === 'function') {\n onChange(event)\n }\n },\n [onChange, tRows, maxRows, autosize]\n )\n\n return (\n <Styled.Root\n className={className}\n style={style}\n onChange={onChangeHandler}\n cols={cols}\n disabled={disabled}\n maxLength={maxLength}\n name={name}\n placeholder={placeholder}\n required={required}\n rows={tRows}\n tabIndex={tabIndex}\n value={value}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n fluid={fluid}\n error={error}\n {...props}\n >\n {children}\n </Styled.Root>\n )\n}\n"],"names":["Textarea","_ref","cols","disabled","error","fluid","name","onChange","maxLength","placeholder","required","rounded","rows","tabIndex","value","className","style","children","autosize","maxRows","color","placeholderColor","props","_objectWithoutProperties","_excluded","tRows","setRows","useState","onChangeHandler","useCallback","event","target","HTMLTextAreaElement","rect","getBoundingClientRect","scrollHeight","height","_jsx","Styled.Root","_objectSpread","defaultProps","e","console","log","width"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { useCallback, useState } from 'react'\nimport { BaseProps, InputField } from '../../shared/interfaces'\nimport * as Styled from './style'\n\ntype TextAreaHTMLAttributes = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'cols' | 'rows' | 'color'>\n\nexport interface TextareaProps extends BaseProps, InputField, TextAreaHTMLAttributes {\n /**\n * Specifies the visible width of a text area\n */\n cols?: number\n /**\n * Specifies the visible number of lines in a text area\n */\n rows?: number\n /**\n * Specifies the visible max number of lines in a text area\n */\n maxRows?: number\n /**\n * Specifies the maximum number of characters allowed in the text area\n */\n maxLength?: number\n /**\n * On change handler\n */\n onChange?(_event: React.ChangeEvent<HTMLTextAreaElement>): void\n /**\n * Value\n */\n value?: string\n /**\n * Autosize for textarea\n */\n autosize?: boolean\n}\n\nTextarea.defaultProps = {\n onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => console.log(e, e.target.value), // eslint-disable-line no-console\n rounded: true,\n width: 'l',\n color: 'mineShaft',\n placeholderColor: 'silver',\n cols: 20,\n maxRows: 30,\n rows: 2,\n autosize: true,\n}\n\nTextarea.displayName = 'Textarea'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`InputField`](#/Миксины)\n * - `React.TextareaHTMLAttributes<HTMLTextAreaElement>`\n */\nexport function Textarea({\n cols,\n disabled,\n error,\n fluid,\n name,\n onChange,\n maxLength,\n placeholder,\n required,\n rounded,\n rows,\n tabIndex,\n value,\n className,\n style,\n children,\n autosize,\n maxRows,\n color,\n placeholderColor,\n ...props\n}: typeof Textarea.defaultProps & TextareaProps) {\n const [tRows, setRows] = useState(rows)\n\n const onChangeHandler: React.ChangeEventHandler<HTMLTextAreaElement> = useCallback(\n (event) => {\n const { target } = event\n\n if (target instanceof HTMLTextAreaElement && autosize) {\n const rect = target.getBoundingClientRect()\n\n if (target.scrollHeight > rect.height && tRows < maxRows) {\n setRows(tRows + 1)\n } else if (!target.value || target.value === '') {\n setRows(rows)\n }\n }\n\n if (typeof onChange === 'function') {\n onChange(event)\n }\n },\n [onChange, tRows, maxRows, autosize]\n )\n\n return (\n <Styled.Root\n className={className}\n style={style}\n onChange={onChangeHandler}\n cols={cols}\n disabled={disabled}\n maxLength={maxLength}\n name={name}\n placeholder={placeholder}\n required={required}\n rows={tRows}\n tabIndex={tabIndex}\n value={value}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n fluid={fluid}\n error={error}\n {...props}\n >\n {children}\n </Styled.Root>\n )\n}\n"],"names":["Textarea","_ref","cols","disabled","error","fluid","name","onChange","maxLength","placeholder","required","rounded","rows","tabIndex","value","className","style","children","autosize","maxRows","color","placeholderColor","props","_objectWithoutProperties","_excluded","tRows","setRows","useState","onChangeHandler","useCallback","event","target","HTMLTextAreaElement","rect","getBoundingClientRect","scrollHeight","height","_jsx","Styled.Root","_objectSpread","defaultProps","e","console","log","width","displayName"],"mappings":"0cAyDO,SAASA,EAsBiCC,GAAA,IAtBxBC,KACvBA,EADuBC,SAEvBA,EAFuBC,MAGvBA,EAHuBC,MAIvBA,EAJuBC,KAKvBA,EALuBC,SAMvBA,EANuBC,UAOvBA,EAPuBC,YAQvBA,EARuBC,SASvBA,EATuBC,QAUvBA,EAVuBC,KAWvBA,EAXuBC,SAYvBA,EAZuBC,MAavBA,EAbuBC,UAcvBA,EAduBC,MAevBA,EAfuBC,SAgBvBA,EAhBuBC,SAiBvBA,EAjBuBC,QAkBvBA,EAlBuBC,MAmBvBA,EAnBuBC,iBAoBvBA,GAE+CpB,EAD5CqB,EAC4CC,EAAAtB,EAAAuB,GAC/C,IAAOC,EAAOC,GAAWC,EAASf,GAElC,IAAMgB,EAAiEC,GACpEC,IACC,IAAMC,OAAEA,GAAWD,EAEnB,GAAIC,aAAkBC,qBAAuBd,EAAU,CACrD,IAAMe,EAAOF,EAAOG,wBAEhBH,EAAOI,aAAeF,EAAKG,QAAUX,EAAQN,EAC/CO,EAAQD,EAAQ,GACNM,EAAOjB,OAA0B,KAAjBiB,EAAOjB,OACjCY,EAAQd,GAIY,mBAAbL,GACTA,EAASuB,KAGb,CAACvB,EAAUkB,EAAON,EAASD,IAG7B,OACEmB,EAACC,EAADC,EAAAA,EAAA,CACExB,UAAWA,EACXC,MAAOA,EACPT,SAAUqB,EACV1B,KAAMA,EACNC,SAAUA,EACVK,UAAWA,EACXF,KAAMA,EACNG,YAAaA,EACbC,SAAUA,EACVE,KAAMa,EACNZ,SAAUA,EACVC,MAAOA,EACPM,MAAOA,EACPT,QAASA,EACTU,iBAAkBA,EAClBhB,MAAOA,EACPD,MAAOA,GACHkB,GAlBN,GAAA,CAAAL,SAoBGA,KAvFPjB,EAASwC,aAAe,CACtBjC,SAAWkC,GAA8CC,QAAQC,IAAIF,EAAGA,EAAEV,OAAOjB,OACjFH,WACAiC,MAAO,IACPxB,MAAO,YACPC,iBAAkB,SAClBnB,KAAM,GACNiB,QAAS,GACTP,KAAM,EACNM,UAAU,GAGZlB,EAAS6C,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from'@babel/runtime/helpers/esm/objectSpread2';import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import o from'react-floater';import l from'ramda/es/mergeDeepRight';import{tooltipStyles as s,tooltipDisplayBlockStyles as
|
|
1
|
+
import t from'@babel/runtime/helpers/esm/objectSpread2';import e from'@babel/runtime/helpers/esm/objectWithoutProperties';import o from'react-floater';import l from'ramda/es/mergeDeepRight';import{tooltipStyles as s,tooltipDisplayBlockStyles as i,tooltipStylesRounend as r}from'./tooltip-styles.js';import{jsx as p}from'react/jsx-runtime';var a=["children","styles"];function n(i){var{children:r,styles:n={}}=i,m=e(i,a);var c=l(s||{},n);return p(o,t(t({styles:c},m),{},{children:r}))}n.defaultProps={autoOpen:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:'click',eventDelay:.4,offset:15,placement:'bottom',showCloseButton:!1,styles:s,target:null,wrapperOptions:{position:!1},component:null},n.themes={tooltipStyles:s,tooltipDisplayBlockStyles:i,tooltipStylesRounend:r},n.displayName='Tooltip';export{n as Tooltip};
|
|
2
2
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import Floater from 'react-floater'\nimport mergeDeepRight from 'ramda/es/mergeDeepRight'\nimport { tooltipStyles, tooltipStylesRounend, tooltipDisplayBlockStyles } from './tooltip-styles'\n\nTooltip.defaultProps = {\n autoOpen: false,\n disableAnimation: false,\n disableFlip: false,\n disableHoverToClick: false,\n event: 'click',\n eventDelay: 0.4,\n offset: 15,\n placement: 'bottom',\n showCloseButton: false,\n styles: tooltipStyles,\n target: null,\n wrapperOptions: {\n position: false,\n },\n component: null,\n}\n\nTooltip.themes = {\n tooltipStyles,\n tooltipDisplayBlockStyles,\n tooltipStylesRounend,\n}\n\ntype FloaterProps = Parameters<typeof Floater>[0]\n\nexport type TooltipProps = FloaterProps\n\n/**\n * Основан на [react-floater](https://github.com/gilbarbara/react-floater).\n */\nexport function Tooltip({ children, styles = {}, ...props }: TooltipProps) {\n const tooltipStyle = mergeDeepRight(tooltipStyles || {}, styles) as TooltipProps['styles']\n\n return (\n <Floater styles={tooltipStyle} {...props}>\n {children}\n </Floater>\n )\n}\n"],"names":["Tooltip","_ref","children","styles","props","_objectWithoutProperties","_excluded","tooltipStyle","mergeDeepRight","tooltipStyles","_jsx","Floater","_objectSpread","defaultProps","autoOpen","disableAnimation","disableFlip","disableHoverToClick","event","eventDelay","offset","placement","showCloseButton","target","wrapperOptions","position","component","themes","tooltipDisplayBlockStyles","tooltipStylesRounend"],"mappings":"+
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import Floater from 'react-floater'\nimport mergeDeepRight from 'ramda/es/mergeDeepRight'\nimport { tooltipStyles, tooltipStylesRounend, tooltipDisplayBlockStyles } from './tooltip-styles'\n\nTooltip.defaultProps = {\n autoOpen: false,\n disableAnimation: false,\n disableFlip: false,\n disableHoverToClick: false,\n event: 'click',\n eventDelay: 0.4,\n offset: 15,\n placement: 'bottom',\n showCloseButton: false,\n styles: tooltipStyles,\n target: null,\n wrapperOptions: {\n position: false,\n },\n component: null,\n}\n\nTooltip.themes = {\n tooltipStyles,\n tooltipDisplayBlockStyles,\n tooltipStylesRounend,\n}\n\nTooltip.displayName = 'Tooltip'\n\ntype FloaterProps = Parameters<typeof Floater>[0]\n\nexport type TooltipProps = FloaterProps\n\n/**\n * Основан на [react-floater](https://github.com/gilbarbara/react-floater).\n */\nexport function Tooltip({ children, styles = {}, ...props }: TooltipProps) {\n const tooltipStyle = mergeDeepRight(tooltipStyles || {}, styles) as TooltipProps['styles']\n\n return (\n <Floater styles={tooltipStyle} {...props}>\n {children}\n </Floater>\n )\n}\n"],"names":["Tooltip","_ref","children","styles","props","_objectWithoutProperties","_excluded","tooltipStyle","mergeDeepRight","tooltipStyles","_jsx","Floater","_objectSpread","defaultProps","autoOpen","disableAnimation","disableFlip","disableHoverToClick","event","eventDelay","offset","placement","showCloseButton","target","wrapperOptions","position","component","themes","tooltipDisplayBlockStyles","tooltipStylesRounend","displayName"],"mappings":"+WAqCO,SAASA,EAA2DC,GAAA,IAAnDC,SAAEA,EAAFC,OAAYA,EAAS,IAA8BF,EAAvBG,EAAuBC,EAAAJ,EAAAK,GACzE,IAAMC,EAAeC,EAAeC,GAAiB,GAAIN,GAEzD,OACEO,EAACC,EAADC,EAAAA,EAAA,CAAST,OAAQI,GAAkBH,GAAnC,GAAA,CAAAF,SACGA,KAtCPF,EAAQa,aAAe,CACrBC,UAAAA,EACAC,kBAAkB,EAClBC,eACAC,qBAAAA,EACAC,MAAO,QACPC,WAAY,GACZC,OAAQ,GACRC,UAAW,SACXC,mBACAnB,OAAQM,EACRc,OAAQ,KACRC,eAAgB,CACdC,UAAAA,GAEFC,UAAW,MAGb1B,EAAQ2B,OAAS,CACflB,cAAAA,EACAmB,0BAAAA,EACAC,qBAAAA,GAGF7B,EAAQ8B,YAAc"}
|