font-picker-react
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -48,3 +48,2 @@ 'use strict'; | ||
_this.state = { | ||
activeFontFamily: activeFontFamily, | ||
expanded: false, | ||
@@ -83,7 +82,9 @@ loadingStatus: "loading", | ||
FontPicker.prototype.componentDidUpdate = function (prevProps) { | ||
var fontFamilyProps = this.props.activeFontFamily; | ||
var fontFamilyState = this.state.activeFontFamily; | ||
if (fontFamilyProps !== prevProps.activeFontFamily && fontFamilyProps !== fontFamilyState) { | ||
this.setActiveFontFamily(fontFamilyProps); | ||
var _a = this.props, activeFontFamily = _a.activeFontFamily, onChange = _a.onChange; | ||
if (activeFontFamily !== prevProps.activeFontFamily) { | ||
this.setActiveFontFamily(activeFontFamily); | ||
} | ||
if (onChange !== prevProps.onChange) { | ||
this.fontManager.setOnChange(onChange); | ||
} | ||
}; | ||
@@ -107,10 +108,8 @@ FontPicker.prototype.onClose = function (e) { | ||
FontPicker.prototype.setActiveFontFamily = function (activeFontFamily) { | ||
var _this = this; | ||
this.setState({ | ||
activeFontFamily: activeFontFamily, | ||
}, function () { return _this.fontManager.setActiveFont(activeFontFamily); }); | ||
this.fontManager.setActiveFont(activeFontFamily); | ||
}; | ||
FontPicker.prototype.generateFontList = function (fonts) { | ||
var _this = this; | ||
var _a = this.state, activeFontFamily = _a.activeFontFamily, loadingStatus = _a.loadingStatus; | ||
var activeFontFamily = this.props.activeFontFamily; | ||
var loadingStatus = this.state.loadingStatus; | ||
if (loadingStatus !== "finished") { | ||
@@ -142,4 +141,4 @@ return React__default.createElement("div", null); | ||
FontPicker.prototype.render = function () { | ||
var sort = this.props.sort; | ||
var _a = this.state, activeFontFamily = _a.activeFontFamily, expanded = _a.expanded, loadingStatus = _a.loadingStatus; | ||
var _a = this.props, activeFontFamily = _a.activeFontFamily, sort = _a.sort; | ||
var _b = this.state, expanded = _b.expanded, loadingStatus = _b.loadingStatus; | ||
var fonts = Array.from(this.fontManager.getFonts().values()); | ||
@@ -146,0 +145,0 @@ if (sort === "alphabet") { |
{ | ||
"name": "font-picker-react", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Font selector component for Google Fonts", | ||
@@ -34,9 +34,11 @@ "author": "Samuel Meuli <me@samuelmeuli.com>", | ||
"format": "prettier --write", | ||
"lint:js": "eslint --fix", | ||
"lint:ts": "eslint --ext .tsx --fix", | ||
"lint:css": "stylelint --fix src/**/*.css", | ||
"lint:scss": "stylelint --fix --syntax scss src/**/*.scss" | ||
"lint:css": "stylelint --fix --max-warnings 0", | ||
"lint:scss": "stylelint --fix --max-warnings 0 --syntax scss", | ||
"lint:js": "eslint --ext .js,.jsx --fix --max-warnings 0", | ||
"lint:ts": "eslint --ext .ts,.tsx --fix --max-warnings 0", | ||
"version": "yarn build", | ||
"release": "np" | ||
}, | ||
"dependencies": { | ||
"font-picker": "^3.0.3" | ||
"font-picker": "^3.1.0" | ||
}, | ||
@@ -64,2 +66,3 @@ "peerDependencies": { | ||
"lint-staged": "^8.1.5", | ||
"np": "^5.0.2", | ||
"npm-run-all": "^4.1.3", | ||
@@ -66,0 +69,0 @@ "prettier": "^1.16.4", |
@@ -86,3 +86,3 @@ # Font Picker for React | ||
_Currently, only the `activeFontFamily` and `sort` props are reactive._ | ||
_Currently, only the `activeFontFamily`, `onChange` and `sort` props are reactive._ | ||
@@ -89,0 +89,0 @@ ## Development |
15008
25
155
Updatedfont-picker@^3.1.0