font-picker-react
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -13,2 +13,3 @@ import { Category, Font, FontManager, Script, SortOption, Variant } from "@samuelmeuli/font-manager"; | ||
variants: Variant[]; | ||
filter: (font: Font) => boolean; | ||
limit: number; | ||
@@ -30,2 +31,3 @@ sort: SortOption; | ||
variants: Variant[]; | ||
filter: (font: Font) => boolean; | ||
limit: number; | ||
@@ -32,0 +34,0 @@ sort: SortOption; |
@@ -44,3 +44,3 @@ import { FONT_FAMILY_DEFAULT, OPTIONS_DEFAULTS, FontManager } from '@samuelmeuli/font-manager'; | ||
}; | ||
var _a = _this.props, apiKey = _a.apiKey, activeFontFamily = _a.activeFontFamily, pickerId = _a.pickerId, families = _a.families, categories = _a.categories, scripts = _a.scripts, variants = _a.variants, limit = _a.limit, sort = _a.sort, onChange = _a.onChange; | ||
var _a = _this.props, apiKey = _a.apiKey, activeFontFamily = _a.activeFontFamily, pickerId = _a.pickerId, families = _a.families, categories = _a.categories, scripts = _a.scripts, variants = _a.variants, filter = _a.filter, limit = _a.limit, sort = _a.sort, onChange = _a.onChange; | ||
var options = { | ||
@@ -52,2 +52,3 @@ pickerId: pickerId, | ||
variants: variants, | ||
filter: filter, | ||
limit: limit, | ||
@@ -162,2 +163,3 @@ sort: sort, | ||
variants: OPTIONS_DEFAULTS.variants, | ||
filter: OPTIONS_DEFAULTS.filter, | ||
limit: OPTIONS_DEFAULTS.limit, | ||
@@ -164,0 +166,0 @@ sort: OPTIONS_DEFAULTS.sort, |
@@ -49,3 +49,3 @@ 'use strict'; | ||
}; | ||
var _a = _this.props, apiKey = _a.apiKey, activeFontFamily = _a.activeFontFamily, pickerId = _a.pickerId, families = _a.families, categories = _a.categories, scripts = _a.scripts, variants = _a.variants, limit = _a.limit, sort = _a.sort, onChange = _a.onChange; | ||
var _a = _this.props, apiKey = _a.apiKey, activeFontFamily = _a.activeFontFamily, pickerId = _a.pickerId, families = _a.families, categories = _a.categories, scripts = _a.scripts, variants = _a.variants, filter = _a.filter, limit = _a.limit, sort = _a.sort, onChange = _a.onChange; | ||
var options = { | ||
@@ -57,2 +57,3 @@ pickerId: pickerId, | ||
variants: variants, | ||
filter: filter, | ||
limit: limit, | ||
@@ -167,2 +168,3 @@ sort: sort, | ||
variants: fontManager.OPTIONS_DEFAULTS.variants, | ||
filter: fontManager.OPTIONS_DEFAULTS.filter, | ||
limit: fontManager.OPTIONS_DEFAULTS.limit, | ||
@@ -169,0 +171,0 @@ sort: fontManager.OPTIONS_DEFAULTS.sort, |
{ | ||
"name": "font-picker-react", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "Font selector component for Google Fonts", | ||
@@ -47,3 +47,3 @@ "author": { | ||
"dependencies": { | ||
"@samuelmeuli/font-manager": "^1.3.1" | ||
"@samuelmeuli/font-manager": "^1.4.0" | ||
}, | ||
@@ -55,30 +55,31 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "^7.7.2", | ||
"@samuelmeuli/eslint-config": "^4.0.1", | ||
"@babel/core": "^7.7.4", | ||
"@samuelmeuli/eslint-config": "^5.0.2", | ||
"@samuelmeuli/prettier-config": "^1.0.0", | ||
"@samuelmeuli/stylelint-config": "^1.0.2", | ||
"@samuelmeuli/tsconfig": "^0.2.0", | ||
"@storybook/react": "^5.2.6", | ||
"@types/react": "^16.9.11", | ||
"@typescript-eslint/eslint-plugin": "^2.7.0", | ||
"@typescript-eslint/parser": "^2.7.0", | ||
"@storybook/react": "^5.2.8", | ||
"@types/react": "^16.9.15", | ||
"@typescript-eslint/eslint-plugin": "^2.10.0", | ||
"@typescript-eslint/parser": "^2.10.0", | ||
"babel-loader": "^8.0.6", | ||
"eslint": "6.6.0", | ||
"eslint": "6.7.2", | ||
"eslint-config-airbnb": "18.0.1", | ||
"eslint-config-prettier": "^6.5.0", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.14.3", | ||
"eslint-plugin-react": "^7.17.0", | ||
"eslint-plugin-react-hooks": "^1.7.0", | ||
"eslint-plugin-simple-import-sort": "^4.0.0", | ||
"husky": "^3.0.9", | ||
"lint-staged": "^9.4.3", | ||
"np": "~5.0.0", | ||
"eslint-plugin-simple-import-sort": "^5.0.0", | ||
"husky": "^3.1.0", | ||
"lint-staged": "^9.5.0", | ||
"np": "^5.2.1", | ||
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.19.1", | ||
"react": "^16.11.0", | ||
"react-dom": "^16.11.0", | ||
"rollup": "^1.27.0", | ||
"rollup-plugin-typescript2": "^0.25.2", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-typescript2": "^0.25.3", | ||
"stylelint": "^11.0.0", | ||
"typescript": "^3.7.2" | ||
"typescript": "^3.7.3" | ||
}, | ||
@@ -111,6 +112,3 @@ "eslintConfig": { | ||
}, | ||
"prettier": { | ||
"printWidth": 100, | ||
"trailingComma": "all" | ||
}, | ||
"prettier": "@samuelmeuli/prettier-config", | ||
"lint-staged": { | ||
@@ -117,0 +115,0 @@ "*.{js,jsx}": [ |
@@ -39,25 +39,25 @@ # Font Picker for React | ||
export default class ExampleComponent extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
activeFontFamily: "Open Sans", | ||
}; | ||
} | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
activeFontFamily: "Open Sans", | ||
}; | ||
} | ||
render() { | ||
return ( | ||
<div> | ||
<FontPicker | ||
apiKey="YOUR_API_KEY" | ||
activeFontFamily={this.state.activeFontFamily} | ||
onChange={nextFont => | ||
this.setState({ | ||
activeFontFamily: nextFont.family, | ||
}) | ||
} | ||
/> | ||
<p className="apply-font">The font will be applied to this text.</p> | ||
</div> | ||
); | ||
} | ||
render() { | ||
return ( | ||
<div> | ||
<FontPicker | ||
apiKey="YOUR_API_KEY" | ||
activeFontFamily={this.state.activeFontFamily} | ||
onChange={nextFont => | ||
this.setState({ | ||
activeFontFamily: nextFont.family, | ||
}) | ||
} | ||
/> | ||
<p className="apply-font">The font will be applied to this text.</p> | ||
</div> | ||
); | ||
} | ||
} | ||
@@ -82,4 +82,5 @@ ``` | ||
- **`categories`**: Array of font categories to include in the list. Possible values: `"sans-serif", "serif", "display", "handwriting", "monospace"`. Default: All categories | ||
- **`scripts`**: Array of scripts which the fonts must include and which will be downloaded on font selection. Example: `["latin", "greek", "hebrew"]` (see [all possible values](https://github.com/samuelmeuli/font-picker/blob/master/src/shared/types.ts)). Default: `["latin"]` | ||
- **`variants`**: Array of variants which the fonts must include and which will be downloaded on font selection. Example: `["regular", "italic", "700", "700italic"]` (see [all possible values](https://github.com/samuelmeuli/font-picker/blob/master/src/shared/types.ts)). Default: `["regular"]` | ||
- **`scripts`**: Array of scripts which the fonts must include and which will be downloaded on font selection. Default: `["latin"]`. Example: `["latin", "greek", "hebrew"]` (see [all possible values](https://github.com/samuelmeuli/font-picker/blob/master/src/shared/types.ts)) | ||
- **`variants`**: Array of variants which the fonts must include and which will be downloaded on font selection. Default: `["regular"]`. Example: `["regular", "italic", "700", "700italic"]` (see [all possible values](https://github.com/samuelmeuli/font-picker/blob/master/src/shared/types.ts)) | ||
- **`filter`**: Function which must evaluate to `true` for a font to be included in the list. Default: `font => true`. Example: If `font => font.family.toLowerCase().startsWith("m")`, only fonts whose names begin with "M" will be in the list | ||
- **`limit`**: Maximum number of fonts to display in the list (the least popular fonts will be omitted). Default: `50` | ||
@@ -86,0 +87,0 @@ - **`sort`**: Sorting attribute for the font list. Possible values: `"alphabet", "popularity"`. Default: `"alphabet"` |
Sorry, the diff of this file is not supported yet
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
26662
372
99
0
29