@chief-editor/ui
Version:
UI Component for chief editor
1 lines • 2.2 kB
JavaScript
;var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r},__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});var util_1=require("@co-hooks/util"),react_1=__importStar(require("react")),dom_1=require("@rc-hooks/dom"),hooks_1=require("../../hooks"),breakpoint_1=require("../util/breakpoint"),grid_1=__importDefault(require("./context/grid")),RowAligns=util_1.tuple("start","end","center"),RowJustify=util_1.tuple("start","end","center","space-around","space-between"),GRID_BREAKPOINTS=util_1.getKeys(breakpoint_1.BREAKPOINT_WIDTHS).map((function(t){return{point:breakpoint_1.BREAKPOINT_WIDTHS[t],name:t}}));function Row(t){var e=t.justify,r=void 0===e?"start":e,i=t.align,n=void 0===i?"start":i,o=t.type,a=void 0===o?"flex":o,s=t.className,u=t.style,l=t.children,_=t.gutter,c=void 0===_?0:_,p=__rest(t,["justify","align","type","className","style","children","gutter"]),f=util_1.classnames(hooks_1.usePrefixCls("row",{type:a,justify:r,align:n}),s),d=react_1.useState("xxs"),y=d[0],g=d[1];dom_1.useWindowResponsive((function(){return!0}),GRID_BREAKPOINTS,(function(t){var e=t.name;g(e)}),!0);var m="object"==typeof c?c[y]||0:c||0,h=m>0?__assign({marginLeft:m/-2,marginRight:m/-2},u):u;return react_1.default.createElement(grid_1.default.Provider,{value:{gutter:m,breakpoint:y}},react_1.default.createElement("div",__assign({},p,{className:f,style:h}),l))}exports.Row=Row;