ackee-frontend-toolkit
Advanced tools
Comparing version 0.4.4 to 0.5.0
@@ -18,8 +18,10 @@ # `createType(prefix, suffixes): ` | ||
createTypes('REQUEST_FEED'); | ||
// [ | ||
// 'REQUEST_FEED', | ||
// 'REQUEST_FEED_SUCCEEDED', | ||
// 'REQUEST_FEED_FAILED', | ||
// 'REQUEST_FEED_COMPLETED', | ||
// ] | ||
/* | ||
* [ | ||
* 'REQUEST_FEED', | ||
* 'REQUEST_FEED_SUCCEEDED', | ||
* 'REQUEST_FEED_FAILED', | ||
* 'REQUEST_FEED_COMPLETED', | ||
* ] | ||
* / | ||
``` |
@@ -24,5 +24,7 @@ # auth helpers | ||
tokens.getTokens(); | ||
// [ | ||
// { "id":6095, "token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9" "expiration":"2017-12-11T15:15:35.000Z" } | ||
// ] | ||
/* | ||
* [ | ||
* { "id":6095, "token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9" "expiration":"2017-12-11T15:15:35.000Z" } | ||
* ] | ||
*/ | ||
@@ -32,3 +34,5 @@ tokens.clearTokens(); | ||
tokens.getTokens(); | ||
// null | ||
/* | ||
* null | ||
*/ | ||
``` |
@@ -5,3 +5,6 @@ export default { | ||
LOG_ERROR: 'LOG_ERROR' | ||
}, | ||
forms: { | ||
FORM_SUBMIT: 'FORM_SUBMIT' | ||
} | ||
}; |
export { default as loadable } from './loadable'; | ||
export { default as makeDropzone } from './makeDropzone'; | ||
export { default as translatable } from './translatable'; | ||
export { default as translatable } from './translatable'; | ||
export { default as errorBoundary } from './makeDropzone'; |
@@ -0,1 +1,2 @@ | ||
export * from './actions'; | ||
export * from './helpers'; | ||
@@ -2,0 +3,0 @@ export * from './HOC'; |
@@ -1,1 +0,2 @@ | ||
export * from './routing'; | ||
export * from './routing'; | ||
export { default as formSubmitSaga } from './form'; |
@@ -10,3 +10,6 @@ 'use strict'; | ||
LOG_ERROR: 'LOG_ERROR' | ||
}, | ||
forms: { | ||
FORM_SUBMIT: 'FORM_SUBMIT' | ||
} | ||
}; |
@@ -33,3 +33,9 @@ 'use strict'; | ||
}); | ||
Object.defineProperty(exports, 'errorBoundary', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_makeDropzone).default; | ||
} | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -7,2 +7,14 @@ 'use strict'; | ||
var _actions = require('./actions'); | ||
Object.keys(_actions).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _actions[key]; | ||
} | ||
}); | ||
}); | ||
var _helpers = require('./helpers'); | ||
@@ -9,0 +21,0 @@ |
@@ -1,1 +0,129 @@ | ||
"use strict"; | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.default = _callee; | ||
var _effects = require('redux-saga/effects'); | ||
var _reduxForm = require('redux-form'); | ||
var _types = require('../actions/types'); | ||
var _types2 = _interopRequireDefault(_types); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _marked4 = /*#__PURE__*/regeneratorRuntime.mark(handleGeneralFormSubmit), | ||
_marked5 = /*#__PURE__*/regeneratorRuntime.mark(_callee); | ||
function handleGeneralFormSubmit(action) { | ||
var _marked, _marked2, _marked3, submitActionCreator, form, data, initialData, start, stop, res; | ||
return regeneratorRuntime.wrap(function handleGeneralFormSubmit$(_context4) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
res = function res() { | ||
return regeneratorRuntime.wrap(function res$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.next = 2; | ||
return (0, _effects.put)((0, _reduxForm.reset)(form)); | ||
case 2: | ||
case 'end': | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _marked3, this); | ||
}; | ||
stop = function stop(errors) { | ||
return regeneratorRuntime.wrap(function stop$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return (0, _effects.put)((0, _reduxForm.stopSubmit)(form, errors)); | ||
case 2: | ||
case 'end': | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _marked2, this); | ||
}; | ||
start = function start() { | ||
return regeneratorRuntime.wrap(function start$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return (0, _effects.put)((0, _reduxForm.startSubmit)(form)); | ||
case 2: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked, this); | ||
}; | ||
_marked = /*#__PURE__*/regeneratorRuntime.mark(start), _marked2 = /*#__PURE__*/regeneratorRuntime.mark(stop), _marked3 = /*#__PURE__*/regeneratorRuntime.mark(res); | ||
submitActionCreator = action.submitActionCreator, form = action.form; | ||
_context4.next = 7; | ||
return (0, _effects.select)((0, _reduxForm.getFormValues)(form)); | ||
case 7: | ||
data = _context4.sent; | ||
_context4.next = 10; | ||
return (0, _effects.select)((0, _reduxForm.getFormInitialValues)(form)); | ||
case 10: | ||
initialData = _context4.sent; | ||
if (!submitActionCreator) { | ||
_context4.next = 14; | ||
break; | ||
} | ||
_context4.next = 14; | ||
return (0, _effects.put)(_extends({}, submitActionCreator(), { | ||
data: data, | ||
form: form, | ||
initialData: initialData, | ||
reset: res, | ||
startSubmit: start, | ||
stopSubmit: stop | ||
})); | ||
case 14: | ||
case 'end': | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _marked4, this); | ||
} | ||
function _callee() { | ||
return regeneratorRuntime.wrap(function _callee$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.next = 2; | ||
return (0, _effects.takeEvery)(_types2.default.forms.FORM_SUBMIT, handleGeneralFormSubmit); | ||
case 2: | ||
case 'end': | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _marked5, this); | ||
} |
@@ -17,2 +17,13 @@ 'use strict'; | ||
}); | ||
}); | ||
}); | ||
var _form = require('./form'); | ||
Object.defineProperty(exports, 'formSubmitSaga', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_form).default; | ||
} | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
{ | ||
"name": "ackee-frontend-toolkit", | ||
"version": "0.4.4", | ||
"version": "0.5.0", | ||
"description": "Set of tools, libraries and all stuff useful for frontend development in Ackee having DRY in mind", | ||
@@ -8,4 +8,4 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build:es": "babel src --out-dir es", | ||
"build:lib": "babel src --out-dir lib --presets=es2015,babel-preset-stage-0", | ||
"build:es": "cross-env BABEL_ENV=es6 babel src --out-dir es", | ||
"build:lib": "babel src --out-dir lib", | ||
"build": "npm run build:es & npm run build:lib", | ||
@@ -15,3 +15,4 @@ "prepublish": "npm run build", | ||
"build-storybook": "build-storybook", | ||
"lint": "eslint \"src/**/*.{js,jsx}\"" | ||
"lint": "eslint \"src/**/*.{js,jsx}\"", | ||
"test": "BABEL_ENV=test jest" | ||
}, | ||
@@ -28,3 +29,4 @@ "author": "Lukáš Horák <lukas.horak@ackee.cz>", | ||
"prop-types": "^15.6.0", | ||
"react": "15", | ||
"react": "^16.0.0", | ||
"react-custom-scrollbars": "^4.2.1", | ||
"react-file-uploader": "git+https://github.com/baierjak/react-file-uploader.git#master-fork", | ||
@@ -34,2 +36,3 @@ "react-intl": "^2.4.0", | ||
"redux": "^3.7.2", | ||
"redux-form": "^7.2.0", | ||
"redux-saga": "^0.16.0" | ||
@@ -39,2 +42,3 @@ }, | ||
"@storybook/addon-actions": "^3.2.17", | ||
"@storybook/addon-info": "^3.3.9", | ||
"@storybook/addon-links": "^3.2.17", | ||
@@ -45,5 +49,9 @@ "@storybook/react": "^3.2.17", | ||
"babel-eslint": "^8.0.3", | ||
"babel-jest": "^22.0.4", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"cross-env": "^5.1.3", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"eslint": "^4.13.0", | ||
@@ -53,4 +61,13 @@ "eslint-config-ackee": "^0.7.0", | ||
"eslint-plugin-jest": "^21.4.2", | ||
"react-dom": "15" | ||
"jest": "^22.0.5", | ||
"react-dom": "^16.0.0" | ||
}, | ||
"jest": { | ||
"testPathIgnorePatterns": [ | ||
"/node_modules", | ||
"/es", | ||
"/lib" | ||
], | ||
"setupTestFrameworkScriptFile": "./configure-jest.js" | ||
} | ||
} |
@@ -15,22 +15,22 @@ ![Ackee Froentend Toolkit](https://cdn6.aptoide.com/imgs/f/2/e/f2e4802678264d40830b66f0459f7527_icon.png?w=256) | ||
Depending on your prefered module managment system, you can use directory `ackee-frontend-toolkit/lib` (CommonJS) or `ackee-frontend-toolkit/es` (ES2015) to import things you need. | ||
You can choose one of three ways for importing: | ||
1. Import partially | ||
```js | ||
import loadable from 'ackee-frontend-toolkit/HOC/loadable'; | ||
```js | ||
// 1. Import partially | ||
import loadable from 'ackee-frontend-toolkit/HOC/loadable'; | ||
loadable(...) | ||
``` | ||
2. Import from namespace | ||
```js | ||
import * HOC from 'ackee-frontend-toolkit/HOC'; | ||
loadable(...) | ||
HOC.loadable(...) | ||
``` | ||
3. Import from full package | ||
```js | ||
import * ackee from 'ackee-frontend-toolkit'; | ||
// 2. Import from namespace | ||
import * HOC from 'ackee-frontend-toolkit/HOC'; | ||
ackee.loadable(...) | ||
``` | ||
HOC.loadable(...) | ||
// 3. Import from full package | ||
import * ackee from 'ackee-frontend-toolkit'; | ||
ackee.loadable(...) | ||
``` | ||
## How to develop | ||
@@ -42,2 +42,6 @@ | ||
### Components | ||
* [DataList](/docs/components/dataList.md) | ||
### High order components | ||
@@ -47,2 +51,3 @@ * [loadable](/docs/HOC/loadable.md) | ||
* [translatable](/docs/HOC/translatable.md) | ||
* [errorBoundary](/docs/HOC/errorBoundary.md) | ||
@@ -55,3 +60,8 @@ ### Helpers | ||
* [routing](/docs/sagas/routing.md) | ||
* [formSubmit](/docs/sagas/formSubmit.md) | ||
### Actions | ||
* [form](/docs/actions/formActions.md) | ||
* [logging](/docs/actions/loggingActions.md) | ||
### [Selectors](/docs/selectors/index.md) | ||
@@ -58,0 +68,0 @@ |
@@ -5,2 +5,3 @@ import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withInfo } from '@storybook/addon-info'; | ||
@@ -100,13 +101,13 @@ import loadable from '../../src/HOC/loadable'; | ||
storiesOf('Lodable', module) | ||
.add('simple', () => { | ||
.add('simple', withInfo()(() => { | ||
const LoadableComponent = loadable(SimpleLoader)(ContentComponent); | ||
return <LoadableComponent />; | ||
}) | ||
.add('with text', () => { | ||
})) | ||
.add('with text', withInfo()(() => { | ||
const LoadableComponent = loadable(TextLoader)(ContentComponent, 'Loading content of my app..'); | ||
return <LoadableComponent />; | ||
}) | ||
.add('using showLoader prop', () => { | ||
})) | ||
.add('using showLoader prop', withInfo()(() => { | ||
const LoadableComponent = loadable(LiveLoader)(ContentComponent, 'Loading hide after few seconds'); | ||
return <LoadableComponent />; | ||
}); | ||
})); |
@@ -6,2 +6,3 @@ import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withInfo } from '@storybook/addon-info'; | ||
@@ -65,6 +66,6 @@ import makeDropzone, { FS } from '../../src/HOC/makeDropzone'; | ||
storiesOf('Dropzone', module) | ||
.add('with text', () => ( | ||
.add('with text', withInfo()(() => ( | ||
<IntlProvider locale="en" messages={messages}> | ||
<Dropzone onDrop={handleUpload} ic={''} icOk={''} size={'small'} /> | ||
</IntlProvider> | ||
)); | ||
))); |
@@ -7,2 +7,3 @@ import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withInfo } from '@storybook/addon-info'; | ||
@@ -35,5 +36,5 @@ import translatable from '../../src/HOC/translatable'; | ||
storiesOf('Translatable', module) | ||
.add('simple', () => { | ||
.add('simple', withInfo()(() => { | ||
const TranslatableComponent = translatable(messages)(ContentComponent); | ||
return <TranslatableComponent store={store} />; | ||
}); | ||
})); |
import './HOC/makeDropzone.story'; | ||
import './HOC/loadable.story'; | ||
import './HOC/translatable.story'; | ||
import './HOC/errorBoundary.story'; | ||
import './components/DataList.story'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1063531
74
14018
70
0
11
20
+ Addedredux-form@^7.2.0
+ Addedadd-px-to-style@1.0.0(transitive)
+ Addeddom-css@2.1.0(transitive)
+ Addedes6-error@4.1.1(transitive)
+ Addedhoist-non-react-statics@2.5.5(transitive)
+ Addedis-promise@2.2.2(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedprefix-style@2.0.1(transitive)
+ Addedraf@3.4.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-custom-scrollbars@4.2.1(transitive)
+ Addedreact-dom@16.14.0(transitive)
+ Addedredux-form@7.4.3(transitive)
+ Addedscheduler@0.19.1(transitive)
+ Addedto-camel-case@1.0.0(transitive)
+ Addedto-no-case@1.0.2(transitive)
+ Addedto-space-case@1.0.0(transitive)
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.39(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
Updatedreact@^16.0.0