diff --git a/README.md b/README.md index 123e025..c2de1fb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Custom Electron Prompt -[![NPM Version](https://img.shields.io/npm/v/custom-electron-prompt)](https://www.npmjs.com/package/custom-electron-prompt) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Araxeus/custom-electron-prompt/blob/main/LICENSE) +[![NPM Version](https://img.shields.io/npm/v/custom-electron-prompt)](https://www.npmjs.com/package/custom-electron-prompt) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Araxeus/custom-electron-prompt/blob/main/LICENSE) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/Araxeus/custom-electron-prompt) [![Website shields.io](https://img.shields.io/website-up-down-green-red/http/shields.io.svg)](https://araxeus.github.io/custom-electron-prompt) @@ -19,7 +19,7 @@ There is also an option for a button with user-defined `onclick` function. ## Usage -* 1: Install the npm package to your project directory with +* 1: Install the npm package to your project directory with ```bash npm install custom-electron-prompt ``` @@ -29,19 +29,19 @@ There is also an option for a button with user-defined `onclick` function. ``` * 2: Import prompt - + ```javascript const prompt = require('custom-electron-prompt') ``` * 3: Create a prompt - + ```javascript prompt([options, parentBrowserWindow]) ``` - + calling the prompt function returns a Promise - + Promise resolve returns the input or returns null if prompt was canceled        On error, Prompise reject returns custom error message @@ -87,15 +87,15 @@ keybindOptions: [ ] ``` -Return an array made of objects in format +Return an array made of objects in format -`{value: "copyAccelerator", accelerator: "Ctrl+Shift+Insert"}` +`{value: "copyAccelerator", accelerator: "Ctrl+Shift+Insert"}` where `accelerator` is the input for the `value` you registered
Code Example - + ```javascript const kb = ($value, $label, $default) => { return { value: $value, label: $label, default: $default } }; prompt({ @@ -119,7 +119,7 @@ prompt({ .catch(console.error) ```
- +
Screenshots @@ -150,7 +150,7 @@ counterOptions: {
Code Example - + ```javascript prompt({ title: "Counter", @@ -165,7 +165,7 @@ prompt({ }, win).then(input => console.log(`input == ${input}`)).catch(console.error) ```
- +
Screenshots @@ -193,7 +193,7 @@ Must specify selectOptions with valid entries in **one** of the following format
Code Example - + ```javascript prompt({ title: "Select", @@ -209,7 +209,7 @@ prompt({ }, win).then(input => console.log(`input == ${input}`)).catch(console.error) ```
- +
Screenshots @@ -237,40 +237,41 @@ Must specify multiInputOptions with valid entries in the following format:
Code Example - + ```javascript prompt({ - title: "credentials", - label: "Please enter username and password", - type: "multiInput", - multiInputOptions: - [{ - inputAttrs: - { - type: "email", - required: true, - placeholder: "email" - } - }, - { - value: "2", - selectOptions: ["thisReturn0", "thisReturn1", "imSelected", "thisReturn3"], - // selectOptions: {0: "thisReturn0", 1: "thisReturn1", 2: "imSelected" , potato: "thisReturnPotato"}, - }, - { - inputAttrs: - { - type: "password", - placeholder: "password" - } - }], - resizable: true, - height: 150, - width: 300, + title: "credentials", + label: "Login Info:", + type: "multiInput", + multiInputOptions: + [ + { + inputAttrs: + { + type: "email", + required: true, + placeholder: "email" + } + }, + { + inputAttrs: + { + type: "password", + placeholder: "password" + } + }, + { + selectOptions: { na: "North America", eu: "Europe", other: "Other" }, + value: "2" + } + ], + resizable: true, + width: 300, + height: 225, }, win).then(input => console.log(`input == ${input}`)).catch(console.error) ```
- +
Screenshots @@ -278,7 +279,9 @@ prompt({ This screenshot also contains a custom button. - + +![](screenshots/multiInput/multiInputSelect.PNG) +
---- @@ -345,8 +348,8 @@ Adds an extra/custom button with special functionalities other than success or e
Code Example - - + + ```javascript await prompt({ title: 'Login credentials', @@ -378,7 +381,7 @@ await prompt({ button: { label: "Autofill", - click: () => + click: () => { document.querySelectorAll("#data")[0].value = "mama@young.com"; document.querySelectorAll("#data")[1].value = "mysecretrecipe"; @@ -395,8 +398,8 @@ await prompt({
Screenshots - - + + ![](https://github.com/amunim/custom-electron-prompt/blob/main/screenshots/multiInput/button.PNG)