file-select-dialog
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -0,1 +1,10 @@ | ||
## [1.5.1](https://github.com/TomokiMiyauci/file-select-dialog/compare/v1.5.0...v1.5.1) (2021-02-10) | ||
### Bug Fixes | ||
* **docs:** change base path ([d20183b](https://github.com/TomokiMiyauci/file-select-dialog/commit/d20183b626ad9bbc6443d44c812b2e331e78d265)) | ||
* **docs:** change path ([dffcb23](https://github.com/TomokiMiyauci/file-select-dialog/commit/dffcb23739d95c3ca718f50830b4fecc2f751998)) | ||
* **docs:** fix typo ([df19064](https://github.com/TomokiMiyauci/file-select-dialog/commit/df19064832a653a15d692a54399f757f2cf44b64)) | ||
# [1.5.0](https://github.com/TomokiMiyauci/file-select-dialog/compare/v1.4.1...v1.5.0) (2020-11-29) | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "file-select-dialog", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Call file select dialog programmatically", | ||
@@ -30,3 +30,6 @@ "types": "dist/index.d.ts", | ||
"semantic-release": "semantic-release", | ||
"prepublishOnly": "yarn build" | ||
"prepublishOnly": "yarn build", | ||
"docs:dev": "vitepress dev docs", | ||
"docs:build": "vitepress build docs", | ||
"docs:serve": "vitepress serve docs" | ||
}, | ||
@@ -58,3 +61,4 @@ "devDependencies": { | ||
"typedoc": "^0.20.0-beta.24", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.0.5", | ||
"vitepress": "^0.11.5" | ||
}, | ||
@@ -68,3 +72,3 @@ "husky": { | ||
"*.ts": "eslint --fix", | ||
"*": "prettier -w -u" | ||
"*.": "prettier -w -u" | ||
}, | ||
@@ -71,0 +75,0 @@ "config": { |
@@ -1,2 +0,3 @@ | ||
# file-select-dialog | ||
<div align="center"> | ||
<img height="300" src="https://tomokimiyauci.github.io/file-select-dialog/cover.png" alt="logo" title="logo"> | ||
@@ -6,3 +7,2 @@ [![npm version](https://img.shields.io/npm/v/file-select-dialog.svg?style=flat)](https://www.npmjs.com/package/file-select-dialog) | ||
[![size](https://img.shields.io/npm/dw/file-select-dialog?color=blue)](https://img.shields.io/npm/dw/file-select-dialog?color=blue) | ||
[![codecov](https://codecov.io/gh/TomokiMiyauci/file-select-dialog/branch/main/graph/badge.svg?token=KY5KS2WE4I)](https://codecov.io/gh/TomokiMiyauci/file-select-dialog) | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier) | ||
@@ -13,6 +13,10 @@ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
Directly call file select dialog to JavaScript. | ||
Get Back Promise File or FileList object. | ||
No more hacky hiding of `<input type="file">` elements. | ||
</div> | ||
# file-select-dialog | ||
> Directly call file select dialog to JavaScript. | ||
> Get Back Promise File or FileList object. | ||
> No more hacky hiding of `<input type="file">` elements. | ||
## :sparkles: Feature | ||
@@ -27,79 +31,6 @@ | ||
## :truck: Install | ||
[Read the Docs to Learn More.](https://tomokimiyauci.github.io/file-select-dialog/) | ||
```bash | ||
yarn add file-select-dialog | ||
or | ||
npm i file-select-dialog | ||
``` | ||
import like this. | ||
```ts | ||
import { fileDialog } from 'file-select-dialog' | ||
``` | ||
## :page_facing_up: Docs | ||
Reference is [here](https://tomokimiyauci.github.io/file-select-dialog/modules/file_dialog.html#filedialog). | ||
### :pencil2: Argument | ||
Parameters `Object` | ||
| key | type | default | | ||
| -------- | ---------------------- | ------- | | ||
| accept | (string \| stirng[] )? | '\*' | | ||
| multiple | boolean? | `false` | | ||
| strict | boolean? | `false` | | ||
## :mag: Examples | ||
[Demo](https://file-select-dialog.vercel.app/) | ||
![screenshot](https://res.cloudinary.com/dz3vsv9pg/image/upload/c_scale,f_auto,q_auto,w_1217/v1606026970/screenshot.png) | ||
By default can only select a single file and get a FileList object. | ||
```ts | ||
const onClick = async () => { | ||
// open file select dialog and waiting user selection then return FileList object. | ||
const fileList = await fileDialog() | ||
} | ||
``` | ||
If the `multiple` parameter is `true`, can select multiple files and get a FileList object. | ||
```ts | ||
const onClick = async () => { | ||
const fileList = await fileDialog({ multiple: true }) | ||
} | ||
``` | ||
The `accept` parameter limit the selecable file types. | ||
```ts | ||
const onClick = async () => { | ||
const fileList = await fileDialog({ accept: '.png' }) | ||
// multiple acceptable types | ||
const fileList = await fileDialog({ accept: ['.jpg', '.pdf'] }) | ||
} | ||
``` | ||
### :zap: Advanced | ||
If the parameter of `multiple` is `false` and `strict` is `true`, can get File object directly. | ||
Your editor suggest File object types. | ||
```ts | ||
const onClick = async () => { | ||
const file = await fileDialog({ strict: true }) | ||
} | ||
``` | ||
## :bulb: LICENSE | ||
[MIT](https://github.com/TomokiMiyauci/file-select-dialog/blob/main/LICENSE) | ||
26287
26
34