├── .gitignore
├── LICENSE
├── README.md
├── build
├── index.js
└── index.js.map
├── config
├── env.js
├── jest
│ ├── cssTransform.js
│ └── fileTransform.js
├── paths.js
├── polyfills.js
├── webpack.config.demo.js
├── webpack.config.dev.js
├── webpack.config.prod.js
└── webpackDevServer.config.js
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo.png
├── logo.svg
└── manifest.json
├── scripts
├── build.js
├── demo.js
├── start.js
└── test.js
├── src
├── demo
│ ├── App.css
│ ├── App.js
│ ├── index.js
│ ├── logo.png
│ └── registerServiceWorker.js
├── lib
│ ├── components
│ │ ├── Layout
│ │ │ ├── HorizontalLayout.jsx
│ │ │ ├── Layout.jsx
│ │ │ ├── Panel.jsx
│ │ │ ├── Separator.jsx
│ │ │ ├── Spacer.jsx
│ │ │ ├── VerticalLayout.jsx
│ │ │ └── index.js
│ │ └── View
│ │ │ ├── View.jsx
│ │ │ └── index.js
│ └── index.js
└── version.json
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # production
7 | /demo
8 |
9 | # testing
10 | /coverage
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Eric Ros
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://npm.im/nice-react-layout)
2 | 
3 | 
4 | [](https://deepscan.io/dashboard#view=project&pid=2670&bid=18301)
5 |
6 | #  Nice React Layout
7 |
8 | A set of React components to create complex flexbox-based layouts without knowing what flexbox is.
9 | [https://ekros.github.io/nice-react-layout/](https://ekros.github.io/nice-react-layout/)
10 |
11 | ## Installation
12 |
13 | ```sh
14 | yarn add nice-react-layout
15 | ```
16 |
17 | ## Motivation
18 |
19 | The aim of this project is to have a reduced set of components to create flexbox-based layouts abstracting the knowledge needed to understand how flexbox works. This library is very useful for web apps with lots of panels.
20 |
21 | ## Features
22 |
23 | - Easy to learn: Just combine layouts and panels.
24 | - Create collapsible sidebars with ease.
25 | - Automagically colorize panels with random colors to speed-up prototyping.
26 | - Resizable panels. Just add separators to your layouts.
27 | - Swap panels position using Drag and drop!
28 |
29 | 
30 |
31 | 
32 |
33 | ## Basic Usage
34 |
35 | Components can be imported using ES6 modules syntax:
36 |
37 | ```javascript
38 | import {
39 | HorizontalLayout,
40 | VerticalLayout,
41 | Panel,
42 | Separator,
43 | Spacer,
44 | View
45 | } from "nice-react-layout";
46 | ```
47 |
48 | Creating a simple layout is as easy as this:
49 |
50 | ```javascript
51 |
52 |
53 |
54 |
55 | ```
56 |
57 | It renders an horizontal layout with two panels of the same size (they have proportion=1 by default). Thanks to the 'mockup' prop it paints every panel with a random color, easing the layout prototyping process. Layouts get all the available space by default (in the parent element). If you want your layout to fill the viewport you can use the component. Like this:
58 |
59 | ```javascript
60 |
61 |
62 |
63 |
64 |
65 |
66 | ```
67 |
68 |
69 | In both horizontal and vertical layouts add the prop 'proportion' with the proportional part it takes from the available space. This example creates a typical sidebar + content layout:
70 |
71 | ```javascript
72 |
73 |
74 |
75 |
76 | ```
77 |
78 |
79 | Do you want to add a separator between both panels? Use the Separator component:
80 |
81 | ```javascript
82 |
83 |
84 |
85 |
86 |
87 | ```
88 |
89 |
90 | You can nest layouts. Let's add a vertical layout, with its own Separator, inside the right panel:
91 |
92 | ```javascript
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | ```
105 |
106 | To enable drag-and-drop feature, use the `draggable` and `droppable` props:
107 |
108 | ```javascript
109 |
110 |
111 |
112 |
113 | ```
114 |
115 | For a complete example with every feature, see the src/demo/App.js file. Or just run `yarn start`.
116 |
117 | ## Components
118 |
119 | ### View
120 |
121 | The top-level component. It gets all the available viewport space. Use it if you want your layout to fill the viewport or pass width / height props.
122 |
123 | ##### Props
124 |
125 | | Prop | Description |
126 | | ------ | ------------------------------ |
127 | | width | view width (100vw by default) |
128 | | height | view height (100vh by default) |
129 |
130 | ### HorizontalLayout
131 |
132 | It creates an horizontal layout. This is shorthand component for:
133 |
134 | ```javascript
135 |
136 | ```
137 |
138 | ### VerticalLayout
139 |
140 | It creates vertical layout layout. This is a shorthand component for:
141 |
142 | ```javascript
143 |
144 | ```
145 |
146 | ### Layout
147 |
148 | Creates a layout.
149 |
150 | ##### Props
151 |
152 | | Prop | Description |
153 | | ------------ | ------------------------------------------- |
154 | | className | Top-level element class name |
155 | | collapseSize | Collapsible panels size when collapsed |
156 | | customCss | Custom layout CSS object |
157 | | mockup | Render in mockup mode |
158 | | onResize | Returns (layout, collapsedPanels) on resize |
159 | | orientation | 'vertical' or 'horizontal' |
160 | | reverse | Render layout in reverse order |
161 |
162 | ### Panel
163 |
164 | Here is where your content goes.
165 | If you are familiar with flexbox, this is like a "flex item" with a flex value of 1 by default. If not, don't worry, you don't need to know that :)
166 |
167 | ##### Props
168 |
169 | | Prop | Description |
170 | | ------------------------------ | ---------------------------------------------------------------------------------- |
171 | | centered | Center panel content |
172 | | className | Top-level element class name |
173 | | collapsible | The panel can be collapsed |
174 | | collapsed | Is the panel collapsed? |
175 | | collapseButtonClass | Adds a class to the collapse button |
176 | | collapseButtonContent | A String or element |
177 | | collapseButtonCollapsedContent | A String or element |
178 | | collapseButtonStyle | Inject inline CSS to the collapse button |
179 | | collapsePanel | Called when collapse button is clicked |
180 | | collapseSwitch | Custom collapse element (renders button if not provided) |
181 | | columns | Number of columns (uses CSS multiple columns) |
182 | | customCss | Custom panel CSS object (injects it as an inline style) |
183 | | draggable | Enable dragging |
184 | | droppable | Other panels can be dropped here |
185 | | minHeight | Minimum panel height |
186 | | minWidth | Minimum panel width |
187 | | mockup | Render in mockup mode |
188 | | orientation | 'vertical' or 'horizontal' |
189 | | proportion | Proportion it uses from the available space (default = 1) |
190 | | reverse | Render layout in reverse order |
191 | | showSize | Show panel size while dragging adjacent separators |
192 | | sidebar | Don't do much by it self. It is a requirement for sidebar props like 'collapsible' |
193 |
194 | ### Separator
195 |
196 | It separates panels and allows them to be resized. This is optional.
197 |
198 | ##### Props
199 |
200 | | Prop | Description |
201 | | ---------------------- | ----------------------------------------------------------- |
202 | | customCss | Custom separator CSS object (injects it as an inline style) |
203 | | defaultDblClickPos | Position where the separator goes when double-clicked |
204 | | disabled | Is disabled? |
205 | | onSeparatorDoubleClick | Action called when the separator is double-clicked |
206 | | onSeparatorMouseDown | Action called when the mouse is over the separator |
207 |
208 | ### Spacer
209 |
210 | It renders a blank space. Useful when you need to leave spaces between panels.
211 |
212 | ##### Props
213 |
214 | | Prop | Description |
215 | | ---- | ------------------------ |
216 | | size | Separator size in pixels |
217 |
218 | ---
219 |
220 | Like this project? ★ us on Github :)
221 |
--------------------------------------------------------------------------------
/build/index.js:
--------------------------------------------------------------------------------
1 | !function(e,t){if("object"===typeof exports&&"object"===typeof module)module.exports=t(require("react"),require("react-dom"));else if("function"===typeof define&&define.amd)define(["react","react-dom"],t);else{var n="object"===typeof exports?t(require("react"),require("react-dom")):t(e.react,e["react-dom"]);for(var r in n)("object"===typeof exports?exports:e)[r]=n[r]}}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(10)()},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),u=n(1),c=n.n(u),s=n(12),f=n.n(s),d=function(){function e(e,t){for(var n=0;n=s?b=s:"horizontal"===r&&b>=c&&(b=c);var x=0,w=0,S="vertical"===r?s-v-y:c-g-y;m.forEach(function(e){x+=e});for(var O=b*x/S,E=0;E<=d;E++)w+=m[E];for(var j=O/w,k=0;k<=d;k++)m[k]=m[k]*j;e.setState({draggingSeparator:!0,layout:m,isBusyOnDragging:!0}),setTimeout(function(){e.setState({isBusyOnDragging:!1})},o)}},this.handleSeparatorMouseUp=function(){document.removeEventListener("mouseup",e.handleSeparatorMouseUp),document.removeEventListener("mousemove",e.handleSeparatorMouseMove),e.setState({draggingSeparator:!1,draggingSeparatorIndex:void 0})},this.startDraggingPanel=function(t){e.setState({draggingPanelIndex:t})},this.stopDraggingPanel=function(){var t=e.state,n=t.layoutOrdering,r=t.draggingPanelIndex,i=t.draggingPanelOverIndex;if(n&&null!==r&&void 0!==r&&null!==i&&void 0!==i){var o=p(n,r,i);e.setState({draggingPanelIndex:void 0,draggingPanelOverIndex:void 0,layoutOrdering:o})}else e.setState({draggingPanelIndex:void 0,draggingPanelOverIndex:void 0})}};t.a=h},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),u=n(1),c=n.n(u),s=n(16),f=(n.n(s),function(){function e(e,t){for(var n=0;n0?t.style.transform="rotateZ(10deg)":e.clientX-n.lastDragX<0?t.style.transform="rotateZ(-10deg)":e.clientY-n.lastDragY>0?t.style.transform="rotateZ(-10deg)":e.clientY-n.lastDragY<0?t.style.transform="rotateZ(10deg)":t.style.transform="rotateZ(0deg)",n.lastDragX=e.clientX,n.lastDragY=e.clientY);var r=n.props;(0,r.draggingOver)(r.layoutIndex)}},n.startDragging=function(e){var t=n.panel.current.cloneNode(!0);t.id="panel-dragging-ghost",t.style.position="fixed",t.style.opacity=.5,t.style.width=n.panel.current.getBoundingClientRect().width+"px",t.style.height=n.panel.current.getBoundingClientRect().height+"px",t.style.transition="transform 0.2s",t.style.transformOrigin="0% 0%",t.style.zIndex=10,document.body.appendChild(t),document.addEventListener("mouseup",n.stopDragging);var r=n.props,i=r.layoutIndex;(0,r.startDragging)(i)},n.stopDragging=function(e){var t=document.getElementById("panel-dragging-ghost");t&&document.body.removeChild(t),t=document.getElementById("panel-dragging-ghost"),t&&document.body.removeChild(t),document.removeEventListener("mouseup",n.stopDragging),n.props.stopDragging()},n.toggleCollapse=function(){var e=n.props;(0,e.collapsePanel)(e.layoutIndex)},n.panel=l.a.createRef(),n.lastDragX,n.lastDragY,n}return o(t,e),f(t,[{key:"componentDidMount",value:function(){var e=this;this.props.draggable&&setTimeout(function(){e.panel.current.addEventListener("mousedown",e.startDragging)},400),this.props.droppable&&setTimeout(function(){e.panel.current.addEventListener("mousemove",e.draggingOver)},500)}},{key:"componentWillUnmount",value:function(){this.props.draggable&&(this.panel.current.removeEventListener("mousedown",this.startDragging),this.panel.current.removeEventListener("mouseup",this.cancelDragging)),this.props.droppable&&this.panel.current.removeEventListener("mousemove",this.draggingOver)}},{key:"render",value:function(){var e=this,t=this.props,n=t.centered,r=t.children,i=t.className,o=t.customCss,a=t.collapsed,u=t.collapsible,c=t.collapseButtonClass,f=t.collapseButtonContent,d=t.collapseButtonCollapsedContent,p=t.collapseSize,h=t.collapseButtonStyle,g=t.collapseSwitch,v=t.columns,y=t.draggingPanelIndex,m=t.draggingSeparator,b=t.flex,x=t.height,w=t.isDraggingOver,S=t.minHeight,O=t.minWidth,E=t.mockupStyle,j=t.order,k=t.showSize,z=t.orientation,P=t.render,_=t.sidebar,D=t.width,C={sidebarActions:{height:"20px"},centered:{display:"flex",justifyContent:"center",alignItems:"center"},horizontalPanel:{position:"relative",borderRight:_?"1px solid #445161":"none",cursor:m?"col-resize":"default",flex:null!==b&&void 0!==b?b:this.calculatePanelFlex(),minWidth:_&&u&&a?p:O,overflowX:"auto",overflowY:"auto",width:D||"auto"},draggingPanel:{cursor:"grab"},isDraggingOver:{filter:"brightness(120%)"},panelSize:{position:"absolute",background:"rgba(255, 255, 255, 0.5)",borderRadius:"4px",color:"#222222",fontSize:"11px",right:"5px",bottom:"5px",width:"90px",height:"15px",textAlign:"center"},verticalPanel:{position:"relative",borderRight:_?"1px solid #445161":"none",cursor:m?"row-resize":"default",flex:null!==b&&void 0!==b?b:this.calculatePanelFlex(),height:x||"auto",minHeight:_&&u&&a?p:S,overflowX:"hidden",overflowY:"auto"},collapsedPanel:{position:"relative",boxShadow:"1px 0px 4px black",flex:0}};return l.a.createElement(s.SizeMe,{monitorHeight:!0,refreshRate:200},function(t){var s=t.size;return l.a.createElement("div",{ref:e.panel,style:Object.assign({},{order:j,transition:m?"none":"flex 0.3s"},"vertical"===z?C.verticalPanel:C.horizontalPanel,n?C.centered:null,v?{columnCount:v}:null,o,a?C.collapsedPanel:null,E,w?C.isDraggingOver:null,null!==y&&void 0!==y?C.draggingPanel:null),className:i},u?l.a.createElement("div",{style:Object.assign({},C.sidebarActions,o&&o.sidebarActions?o.sidebarActions:null)},g||l.a.createElement("button",{style:h||{float:"right"},onClick:e.toggleCollapse,className:c},a?d:f)):null,P?P({size:s}):r,m&&k?l.a.createElement("div",{style:C.panelSize},s?Math.floor(s.width)+" x "+Math.floor(s.height):null):null)})}}]),t}(l.a.PureComponent);d.propTypes={id:c.a.string,centered:c.a.bool,children:c.a.node,className:c.a.string,customCss:c.a.object,draggable:c.a.bool,draggingOver:c.a.func,draggingPanelIndex:c.a.number,draggingSeparator:c.a.bool,droppable:c.a.bool,collapsed:c.a.bool,collapsible:c.a.bool,collapseButtonClass:c.a.string,collapseSize:c.a.string,collapseButtonStyle:c.a.object,collapseButtonContent:c.a.oneOfType([c.a.string,c.a.element]),collapseButtonCollapsedContent:c.a.oneOfType([c.a.string,c.a.element]),collapsePanel:c.a.func,collapseSwitch:c.a.element,columns:c.a.number,flex:c.a.oneOfType([c.a.string,c.a.number]),isDraggingOver:c.a.bool,layoutIndex:c.a.number,minHeight:c.a.number,minWidth:c.a.number,mockupStyle:c.a.object,order:c.a.number,proportion:c.a.number,render:c.a.func,startDragging:c.a.func,stopDragging:c.a.func,showSize:c.a.bool,sidebar:c.a.bool},d.defaultProps={id:"panel",centered:!1,className:"",collapseSize:"30px",collapseButtonContent:"Collapse",collapseButtonCollapsedContent:"Extend",columns:void 0,draggable:!1,droppable:!1,isDraggingOver:!1,proportion:1,render:void 0,showSize:!1},t.a=d},function(e,t,n){"use strict";(e.exports={}).forEach=function(e,t){for(var n=0;n4?e:void 0}())},r.isLegacyOpera=function(){return!!window.opera}},function(e,t,n){e.exports=n(8)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),i=n(35);n.d(t,"Layout",function(){return r.c}),n.d(t,"HorizontalLayout",function(){return r.b}),n.d(t,"VerticalLayout",function(){return r.h}),n.d(t,"Panel",function(){return r.d}),n.d(t,"Separator",function(){return r.e}),n.d(t,"Spacer",function(){return r.f}),n.d(t,"FormLayout",function(){return r.FormLayout}),n.d(t,"TableLayout",function(){return r.TableLayout}),n.d(t,"View",function(){return i.a})},function(e,t,n){"use strict";var r=n(2),i=n(14),o=n(15),a=n(4),l=n(33),u=n(34);n.d(t,"c",function(){return r.a}),n.d(t,"b",function(){return i.a}),n.d(t,"h",function(){return o.a}),n.d(t,"d",function(){return a.a}),n.d(t,"e",function(){return l.a}),n.d(t,"f",function(){return u.a})},function(e,t,n){"use strict";function r(){}var i=n(11);e.exports=function(){function e(e,t,n,r,o,a){if(a!==i){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){(function(e,n){var r,i;!function(){var o="object"==typeof self&&self.self===self&&self||"object"==typeof e&&e.global===e&&e||this||{},a=o._,l=Array.prototype,u=Object.prototype,c="undefined"!==typeof Symbol?Symbol.prototype:null,s=l.push,f=l.slice,d=u.toString,p=u.hasOwnProperty,h=Array.isArray,g=Object.keys,v=Object.create,y=function(){},m=function(e){return e instanceof m?e:this instanceof m?void(this._wrapped=e):new m(e)};"undefined"==typeof t||t.nodeType?o._=m:("undefined"!=typeof n&&!n.nodeType&&n.exports&&(t=n.exports=m),t._=m),m.VERSION="1.9.1";var b,x=function(e,t,n){if(void 0===t)return e;switch(null==n?3:n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)}}return function(){return e.apply(t,arguments)}},w=function(e,t,n){return m.iteratee!==b?m.iteratee(e,t):null==e?m.identity:m.isFunction(e)?x(e,t,n):m.isObject(e)&&!m.isArray(e)?m.matcher(e):m.property(e)};m.iteratee=b=function(e,t){return w(e,t,1/0)};var S=function(e,t){return t=null==t?e.length-1:+t,function(){for(var n=Math.max(arguments.length-t,0),r=Array(n),i=0;i=0&&t<=z};m.each=m.forEach=function(e,t,n){t=x(t,n);var r,i;if(_(e))for(r=0,i=e.length;r0?0:a-1;for(i||(r=t[o?o[l]:l],l+=e);l>=0&&l=3;return t(e,x(n,i,4),r,o)}};m.reduce=m.foldl=m.inject=D(1),m.reduceRight=m.foldr=D(-1),m.find=m.detect=function(e,t,n){var r=_(e)?m.findIndex:m.findKey,i=r(e,t,n);if(void 0!==i&&-1!==i)return e[i]},m.filter=m.select=function(e,t,n){var r=[];return t=w(t,n),m.each(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r},m.reject=function(e,t,n){return m.filter(e,m.negate(w(t)),n)},m.every=m.all=function(e,t,n){t=w(t,n);for(var r=!_(e)&&m.keys(e),i=(r||e).length,o=0;o=0},m.invoke=S(function(e,t,n){var r,i;return m.isFunction(t)?i=t:m.isArray(t)&&(r=t.slice(0,-1),t=t[t.length-1]),m.map(e,function(e){var o=i;if(!o){if(r&&r.length&&(e=k(e,r)),null==e)return;o=e[t]}return null==o?o:o.apply(e,n)})}),m.pluck=function(e,t){return m.map(e,m.property(t))},m.where=function(e,t){return m.filter(e,m.matcher(t))},m.findWhere=function(e,t){return m.find(e,m.matcher(t))},m.max=function(e,t,n){var r,i,o=-1/0,a=-1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e){e=_(e)?e:m.values(e);for(var l=0,u=e.length;lo&&(o=r)}else t=w(t,n),m.each(e,function(e,n,r){((i=t(e,n,r))>a||i===-1/0&&o===-1/0)&&(o=e,a=i)});return o},m.min=function(e,t,n){var r,i,o=1/0,a=1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e){e=_(e)?e:m.values(e);for(var l=0,u=e.length;lr||void 0===n)return 1;if(n0?0:i-1;o>=0&&o0?a=o>=0?o:Math.max(o+l,a):l=o>=0?Math.min(o+1,l):o+l+1;else if(n&&o&&l)return o=n(r,i),r[o]===i?o:-1;if(i!==i)return o=t(f.call(r,a,l),m.isNaN),o>=0?o+a:-1;for(o=e>0?a:l-1;o>=0&&ot?(r&&(clearTimeout(r),r=null),l=c,a=e.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(u,s)),a};return c.cancel=function(){clearTimeout(r),l=0,r=i=o=null},c},m.debounce=function(e,t,n){var r,i,o=function(t,n){r=null,n&&(i=e.apply(t,n))},a=S(function(a){if(r&&clearTimeout(r),n){var l=!r;r=setTimeout(o,t),l&&(i=e.apply(this,a))}else r=m.delay(o,t,this,a);return i});return a.cancel=function(){clearTimeout(r),r=null},a},m.wrap=function(e,t){return m.partial(t,e)},m.negate=function(e){return function(){return!e.apply(this,arguments)}},m.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}},m.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},m.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}},m.once=m.partial(m.before,2),m.restArguments=S;var L=!{toString:null}.propertyIsEnumerable("toString"),R=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],H=function(e,t){var n=R.length,r=e.constructor,i=m.isFunction(r)&&r.prototype||u,o="constructor";for(j(e,o)&&!m.contains(t,o)&&t.push(o);n--;)(o=R[n])in e&&e[o]!==i[o]&&!m.contains(t,o)&&t.push(o)};m.keys=function(e){if(!m.isObject(e))return[];if(g)return g(e);var t=[];for(var n in e)j(e,n)&&t.push(n);return L&&H(e,t),t},m.allKeys=function(e){if(!m.isObject(e))return[];var t=[];for(var n in e)t.push(n);return L&&H(e,t),t},m.values=function(e){for(var t=m.keys(e),n=t.length,r=Array(n),i=0;i1&&(r=x(r,t[1])),t=m.allKeys(e)):(r=W,t=I(t,!1,!1),e=Object(e));for(var i=0,o=t.length;i1&&(n=t[1])):(t=m.map(I(t,!1,!1),String),r=function(e,n){return!m.contains(t,n)}),m.pick(e,r,n)}),m.defaults=B(m.allKeys,!0),m.create=function(e,t){var n=O(e);return t&&m.extendOwn(n,t),n},m.clone=function(e){return m.isObject(e)?m.isArray(e)?e.slice():m.extend({},e):e},m.tap=function(e,t){return t(e),e},m.isMatch=function(e,t){var n=m.keys(t),r=n.length;if(null==e)return!r;for(var i=Object(e),o=0;o":">",'"':""","'":"'","`":"`"},U=m.invert(X),$=function(e){var t=function(t){return e[t]},n="(?:"+m.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(i,t):e}};m.escape=$(X),m.unescape=$(U),m.result=function(e,t,n){m.isArray(t)||(t=[t]);var r=t.length;if(!r)return m.isFunction(n)?n.call(e):n;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var V=/(.)^/,Z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},G=/\\|'|\r|\n|\u2028|\u2029/g,J=function(e){return"\\"+Z[e]};m.template=function(e,t,n){!t&&n&&(t=n),t=m.defaults({},t,m.templateSettings);var r=RegExp([(t.escape||V).source,(t.interpolate||V).source,(t.evaluate||V).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(r,function(t,n,r,a,l){return o+=e.slice(i,l).replace(G,J),i=l+t.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";var a;try{a=new Function(t.variable||"obj","_",o)}catch(e){throw e.source=o,e}var l=function(e){return a.call(this,e,m)};return l.source="function("+(t.variable||"obj")+"){\n"+o+"}",l},m.chain=function(e){var t=m(e);return t._chain=!0,t};var Q=function(e,t){return e._chain?m(t).chain():t};m.mixin=function(e){return m.each(m.functions(e),function(t){var n=m[t]=e[t];m.prototype[t]=function(){var e=[this._wrapped];return s.apply(e,arguments),Q(this,n.apply(m,e))}}),m},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=l[e];m.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],Q(this,n)}}),m.each(["concat","join","slice"],function(e){var t=l[e];m.prototype[e]=function(){return Q(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return String(this._wrapped)},r=[],void 0!==(i=function(){return m}.apply(t,r))&&(n.exports=i)}()}).call(t,n(3),n(13)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var i=n(0),o=n.n(i),a=n(2),l=function(e){var t=r(e,[]);return o.a.createElement(a.a,Object.assign({},t,{orientation:"horizontal"}))};t.a=l},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var i=n(0),o=n.n(i),a=n(2),l=function(e){var t=r(e,[]);return o.a.createElement(a.a,Object.assign({},t,{orientation:"vertical"}))};t.a=l},function(e,t,n){"use strict";function r(e){return e&&"object"===typeof e&&"default"in e?e.default:e}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";return y[e]||(y[e]=u({strategy:e})),y[e]}function o(e){return e.displayName||e.name||"Component"}function a(e){var t=e.className,n=e.style,r={};return t||n?(t&&(r.className=t),n&&(r.style=n)):r.style={width:"100%",height:"100%"},s.createElement("div",r)}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E,t=e.monitorWidth,n=void 0===t?E.monitorWidth:t,r=e.monitorHeight,a=void 0===r?E.monitorHeight:r,u=e.monitorPosition,c=void 0===u?E.monitorPosition:u,v=e.refreshRate,y=void 0===v?E.refreshRate:v,S=e.refreshMode,j=void 0===S?E.refreshMode:S,z=e.noPlaceholder,P=void 0===z?E.noPlaceholder:z,_=e.resizeDetectorStrategy,D=void 0===_?E.resizeDetectorStrategy:_;p(n||a||c,'You have to monitor at least one of the width, height, or position when using "sizeMe"'),p(y>=16,"It is highly recommended that you don't put your refreshRate lower than 16 as this may cause layout thrashing."),p("throttle"===j||"debounce"===j,'The refreshMode should have a value of "throttle" or "debounce"');var C="throttle"===j?h:g;return function(e){var t=k(e),r=function(e){function r(){var e,t,i,o;m(this,r);for(var l=arguments.length,u=Array(l),s=0;s=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},O=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t},E={monitorWidth:!0,monitorHeight:!1,monitorPosition:!1,refreshRate:16,refreshMode:"throttle",noPlaceholder:!1,resizeDetectorStrategy:"scroll"},j=function(e){function t(){return m(this,t),O(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return w(t,e),b(t,[{key:"render",value:function(){return c.Children.only(this.props.children)}}]),t}(c.Component);j.displayName="SizeMeReferenceWrapper",j.propTypes={children:f.element.isRequired},a.displayName="SizeMePlaceholder",a.propTypes={className:f.string,style:f.object};var k=function(e){function t(t){var n=t.explicitRef,r=t.className,i=t.style,o=t.size,l=t.disablePlaceholder,u=(t.onSize,S(t,["explicitRef","className","style","size","disablePlaceholder","onSize"])),c=null==o||null==o.width&&null==o.height&&null==o.position,f=c&&!l,d={className:r,style:i};null!=o&&(d.size=o);var p=f?s.createElement(a,{className:r,style:i}):s.createElement(e,x({},d,u));return s.createElement(j,{ref:n},p)}return t.displayName="SizeMeRenderer("+o(e)+")",t.propTypes={explicitRef:f.func.isRequired,className:f.string,style:f.object,size:f.shape({width:f.number,height:f.number}),disablePlaceholder:f.bool,onSize:f.func},t};l.enableSSRBehaviour=!1,l.noPlaceholders=!1;var z=function(e){function t(e){m(this,t);var n=O(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));P.call(n);var r=(e.children,e.render,S(e,["children","render"]));return n.createComponent(r),n.state={size:{width:void 0,height:void 0}},n}return w(t,e),b(t,[{key:"componentWillReceiveProps",value:function(e){var t=this.props,n=(t.children,t.render,S(t,["children","render"])),r=(e.children,e.render,S(e,["children","render"]));v(n,r)||this.createComponent(r)}},{key:"render",value:function(){var e=this.SizeAware,t=this.props.children||this.props.render;return s.createElement(e,{onSize:this.onSize},t({size:this.state.size}))}}]),t}(c.Component);z.propTypes={children:f.func,render:f.func},z.defaultProps={children:void 0,render:void 0};var P=function(){var e=this;this.createComponent=function(t){e.SizeAware=l(t)(function(e){return e.children})},this.onSize=function(t){return e.setState({size:t})}};l.SizeMe=z,l.withSize=l,e.exports=l},function(e,t,n){"use strict";function r(e){return Array.isArray(e)||void 0!==e.length}function i(e){if(Array.isArray(e))return e;var t=[];return l(e,function(e){t.push(e)}),t}function o(e){return e&&1===e.nodeType}function a(e,t,n){var r=e[t];return void 0!==r&&null!==r||void 0===n?r:n}var l=n(5).forEach,u=n(18),c=n(19),s=n(20),f=n(21),d=n(22),p=n(6),h=n(23),g=n(25),v=n(26),y=n(27);e.exports=function(e){function t(e,t,n){function u(e){var t=j.get(e);l(t,function(t){t(e)})}function c(e,t,n){j.add(t,n),e&&n(t)}if(n||(n=t,t=e,e={}),!t)throw new Error("At least one element required.");if(!n)throw new Error("Listener required.");if(o(t))t=[t];else{if(!r(t))return w.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");t=i(t)}var s=0,f=a(e,"callOnAdd",O.callOnAdd),d=a(e,"onReady",function(){}),p=a(e,"debug",O.debug);l(t,function(e){g.getState(e)||(g.initState(e),m.set(e));var r=m.get(e);if(p&&w.log("Attaching listener to element",r,e),!k.isDetectable(e))return p&&w.log(r,"Not detectable."),k.isBusy(e)?(p&&w.log(r,"System busy making it detectable"),c(f,e,n),_[r]=_[r]||[],void _[r].push(function(){++s===t.length&&d()})):(p&&w.log(r,"Making detectable..."),k.markBusy(e,!0),E.makeDetectable({debug:p},e,function(e){if(p&&w.log(r,"onElementDetectable"),g.getState(e)){k.markAsDetectable(e),k.markBusy(e,!1),E.addListener(e,u),c(f,e,n);var i=g.getState(e);if(i&&i.startSize){var o=e.offsetWidth,a=e.offsetHeight;i.startSize.width===o&&i.startSize.height===a||u(e)}_[r]&&l(_[r],function(e){e()})}else p&&w.log(r,"Element uninstalled before being detectable.");delete _[r],++s===t.length&&d()}));p&&w.log(r,"Already detecable, adding listener."),c(f,e,n),s++}),s===t.length&&d()}function n(e){if(!e)return w.error("At least one element is required.");if(o(e))e=[e];else{if(!r(e))return w.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");e=i(e)}l(e,function(e){j.removeAllListeners(e),E.uninstall(e),g.cleanState(e)})}e=e||{};var m;if(e.idHandler)m={get:function(t){return e.idHandler.get(t,!0)},set:e.idHandler.set};else{var b=s(),x=f({idGenerator:b,stateHandler:g});m=x}var w=e.reporter;if(!w){w=d(!1===w)}var S=a(e,"batchProcessor",h({reporter:w})),O={};O.callOnAdd=!!a(e,"callOnAdd",!0),O.debug=!!a(e,"debug",!1);var E,j=c(m),k=u({stateHandler:g}),z=a(e,"strategy","object"),P={reporter:w,batchProcessor:S,stateHandler:g,idHandler:m};if("scroll"===z&&(p.isLegacyOpera()?(w.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),z="object"):p.isIE(9)&&(w.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),z="object")),"scroll"===z)E=y(P);else{if("object"!==z)throw new Error("Invalid strategy name: "+z);E=v(P)}var _={};return{listenTo:t,removeListener:j.removeListener,removeAllListeners:j.removeAllListeners,uninstall:n}}},function(e,t,n){"use strict";e.exports=function(e){function t(e){var t=o(e);return t&&!!t.isDetectable}function n(e){o(e).isDetectable=!0}function r(e){return!!o(e).busy}function i(e,t){o(e).busy=!!t}var o=e.stateHandler.getState;return{isDetectable:t,markAsDetectable:n,isBusy:r,markBusy:i}}},function(e,t,n){"use strict";e.exports=function(e){function t(t){var n=e.get(t);return void 0===n?[]:o[n]||[]}function n(t,n){var r=e.get(t);o[r]||(o[r]=[]),o[r].push(n)}function r(e,n){for(var r=t(e),i=0,o=r.length;io?o=e:e div::-webkit-scrollbar { display: none; }\n\n",i+="."+r+" { -webkit-animation-duration: 0.1s; animation-duration: 0.1s; -webkit-animation-name: "+n+"; animation-name: "+n+"; }\n",i+="@-webkit-keyframes "+n+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }\n",i+="@keyframes "+n+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",function(t,n){n=n||function(e){document.head.appendChild(e)};var r=document.createElement("style");r.innerHTML=t,r.id=e,n(r)}(i)}}("erd_scroll_detection_scrollbar_style",g),{makeDetectable:u,addListener:l,uninstall:c}}},function(e,n){e.exports=t},function(e,t,n){"use strict";var r=function(e,t,n,r,i,o,a,l){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,a,l],s=0;u=new Error(t.replace(/%s/g,function(){return c[s++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};e.exports=r},function(e,t,n){(function(t){function n(e,t,n){function r(t){var n=g,r=v;return g=v=void 0,E=t,m=e.apply(r,n)}function o(e){return E=e,b=setTimeout(s,t),j?r(e):m}function a(e){var n=e-x,r=e-E,i=t-n;return k?S(i,y-r):i}function c(e){var n=e-x,r=e-E;return void 0===x||n>=t||n<0||k&&r>=y}function s(){var e=O();if(c(e))return f(e);b=setTimeout(s,a(e))}function f(e){return b=void 0,z&&g?r(e):(g=v=void 0,m)}function d(){void 0!==b&&clearTimeout(b),E=0,g=x=v=b=void 0}function p(){return void 0===b?m:f(O())}function h(){var e=O(),n=c(e);if(g=arguments,v=this,x=e,n){if(void 0===b)return o(x);if(k)return b=setTimeout(s,t),r(x)}return void 0===b&&(b=setTimeout(s,t)),m}var g,v,y,m,b,x,E=0,j=!1,k=!1,z=!0;if("function"!=typeof e)throw new TypeError(u);return t=l(t)||0,i(n)&&(j=!!n.leading,k="maxWait"in n,y=k?w(l(n.maxWait)||0,t):y,z="trailing"in n?!!n.trailing:z),h.cancel=d,h.flush=p,h}function r(e,t,r){var o=!0,a=!0;if("function"!=typeof e)throw new TypeError(u);return i(r)&&(o="leading"in r?!!r.leading:o,a="trailing"in r?!!r.trailing:a),n(e,t,{leading:o,maxWait:t,trailing:a})}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||o(e)&&x.call(e)==s}function l(e){if("number"==typeof e)return e;if(a(e))return c;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(f,"");var n=p.test(e);return n||h.test(e)?g(e.slice(2),n?2:8):d.test(e)?c:+e}var u="Expected a function",c=NaN,s="[object Symbol]",f=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,h=/^0o[0-7]+$/i,g=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,y="object"==typeof self&&self&&self.Object===Object&&self,m=v||y||Function("return this")(),b=Object.prototype,x=b.toString,w=Math.max,S=Math.min,O=function(){return m.Date.now()};e.exports=r}).call(t,n(3))},function(e,t,n){(function(t){function n(e,t,n){function i(t){var n=g,r=v;return g=v=void 0,E=t,m=e.apply(r,n)}function o(e){return E=e,b=setTimeout(s,t),j?i(e):m}function u(e){var n=e-O,r=e-E,i=t-n;return k?w(i,y-r):i}function c(e){var n=e-O,r=e-E;return void 0===O||n>=t||n<0||k&&r>=y}function s(){var e=S();if(c(e))return f(e);b=setTimeout(s,u(e))}function f(e){return b=void 0,z&&g?i(e):(g=v=void 0,m)}function d(){void 0!==b&&clearTimeout(b),E=0,g=O=v=b=void 0}function p(){return void 0===b?m:f(S())}function h(){var e=S(),n=c(e);if(g=arguments,v=this,O=e,n){if(void 0===b)return o(O);if(k)return b=setTimeout(s,t),i(O)}return void 0===b&&(b=setTimeout(s,t)),m}var g,v,y,m,b,O,E=0,j=!1,k=!1,z=!0;if("function"!=typeof e)throw new TypeError(l);return t=a(t)||0,r(n)&&(j=!!n.leading,k="maxWait"in n,y=k?x(a(n.maxWait)||0,t):y,z="trailing"in n?!!n.trailing:z),h.cancel=d,h.flush=p,h}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function o(e){return"symbol"==typeof e||i(e)&&b.call(e)==c}function a(e){if("number"==typeof e)return e;if(o(e))return u;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var n=d.test(e);return n||p.test(e)?h(e.slice(2),n?2:8):f.test(e)?u:+e}var l="Expected a function",u=NaN,c="[object Symbol]",s=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,p=/^0o[0-7]+$/i,h=parseInt,g="object"==typeof t&&t&&t.Object===Object&&t,v="object"==typeof self&&self&&self.Object===Object&&self,y=g||v||Function("return this")(),m=Object.prototype,b=m.toString,x=Math.max,w=Math.min,S=function(){return y.Date.now()};e.exports=n}).call(t,n(3))},function(e,t){e.exports=function(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!==typeof e||!e||"object"!==typeof t||!t)return!1;var o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),u=0;u {
33 | if (fs.existsSync(dotenvFile)) {
34 | require('dotenv').config({
35 | path: dotenvFile,
36 | });
37 | }
38 | });
39 |
40 | // We support resolving modules according to `NODE_PATH`.
41 | // This lets you use absolute paths in imports inside large monorepos:
42 | // https://github.com/facebookincubator/create-react-app/issues/253.
43 | // It works similar to `NODE_PATH` in Node itself:
44 | // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
45 | // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
46 | // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
47 | // https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
48 | // We also resolve them to make sure all tools using them work consistently.
49 | const appDirectory = fs.realpathSync(process.cwd());
50 | process.env.NODE_PATH = (process.env.NODE_PATH || '')
51 | .split(path.delimiter)
52 | .filter(folder => folder && !path.isAbsolute(folder))
53 | .map(folder => path.resolve(appDirectory, folder))
54 | .join(path.delimiter);
55 |
56 | // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
57 | // injected into the application via DefinePlugin in Webpack configuration.
58 | const REACT_APP = /^REACT_APP_/i;
59 |
60 | function getClientEnvironment(publicUrl) {
61 | const raw = Object.keys(process.env)
62 | .filter(key => REACT_APP.test(key))
63 | .reduce(
64 | (env, key) => {
65 | env[key] = process.env[key];
66 | return env;
67 | },
68 | {
69 | // Useful for determining whether we’re running in production mode.
70 | // Most importantly, it switches React into the correct mode.
71 | NODE_ENV: process.env.NODE_ENV || 'development',
72 | // Useful for resolving the correct path to static assets in `public`.
73 | // For example,
.
74 | // This should only be used as an escape hatch. Normally you would put
75 | // images into the `src` and `import` them in code to get their paths.
76 | PUBLIC_URL: publicUrl,
77 | }
78 | );
79 | // Stringify all values so we can feed into Webpack DefinePlugin
80 | const stringified = {
81 | 'process.env': Object.keys(raw).reduce((env, key) => {
82 | env[key] = JSON.stringify(raw[key]);
83 | return env;
84 | }, {}),
85 | };
86 |
87 | return { raw, stringified };
88 | }
89 |
90 | module.exports = getClientEnvironment;
91 |
--------------------------------------------------------------------------------
/config/jest/cssTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // This is a custom Jest transformer turning style imports into empty objects.
4 | // http://facebook.github.io/jest/docs/tutorial-webpack.html
5 |
6 | module.exports = {
7 | process() {
8 | return 'module.exports = {};';
9 | },
10 | getCacheKey() {
11 | // The output is always the same.
12 | return 'cssTransform';
13 | },
14 | };
15 |
--------------------------------------------------------------------------------
/config/jest/fileTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 |
5 | // This is a custom Jest transformer turning file imports into filenames.
6 | // http://facebook.github.io/jest/docs/tutorial-webpack.html
7 |
8 | module.exports = {
9 | process(src, filename) {
10 | return `module.exports = ${JSON.stringify(path.basename(filename))};`;
11 | },
12 | };
13 |
--------------------------------------------------------------------------------
/config/paths.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 | const fs = require('fs');
5 | const url = require('url');
6 |
7 | // Make sure any symlinks in the project folder are resolved:
8 | // https://github.com/facebookincubator/create-react-app/issues/637
9 | const appDirectory = fs.realpathSync(process.cwd());
10 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11 |
12 | const envPublicUrl = process.env.PUBLIC_URL;
13 |
14 | function ensureSlash(path, needsSlash) {
15 | const hasSlash = path.endsWith('/');
16 | if (hasSlash && !needsSlash) {
17 | return path.substr(path, path.length - 1);
18 | } else if (!hasSlash && needsSlash) {
19 | return `${path}/`;
20 | } else {
21 | return path;
22 | }
23 | }
24 |
25 | const getPublicUrl = appPackageJson =>
26 | envPublicUrl || require(appPackageJson).homepage;
27 |
28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer
29 | // "public path" at which the app is served.
30 | // Webpack needs to know it to put the right
23 |
24 |
25 |
28 |
29 |
39 |
40 |