From 312c3cc4b8037ae1295d1adabfe8be861f1ffb63 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 21 Jul 2025 23:34:38 +0200 Subject: [PATCH] Mon 21 Jul 22:43:21 CEST 2025 --- js/ui/dialog/doc/README.md | 141 +++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 js/ui/dialog/doc/README.md diff --git a/js/ui/dialog/doc/README.md b/js/ui/dialog/doc/README.md new file mode 100644 index 0000000..e7f6af6 --- /dev/null +++ b/js/ui/dialog/doc/README.md @@ -0,0 +1,141 @@ +# Prompt-Boxes +A small package I created for my own project so currently there's limited functionality. I will update it as and when I require more functionality (or a request is made). + +##### Migrating from version <2.0 to 2.0 +`I've re-written a lot of mechanics. There are a lot more options available to each instance. Please review the ReadMe and update your current implementation accordingly.` + +#### Demo +You can find an old demo [here](https://iamrobert.co.uk/projects/prompt-boxes). For a better demo, download the repo and open the 'index.html' page within the demo folder + +#### Installation +``npm install prompt-boxes --save`` + +#### Screenshots + + +#### Add scripts +~~~ + + +~~~ + +#### Create instance +~~~ + +~~~ + +#### Permanent toast +~~~ + pb.success( + 'This is a permanent toast with a close option', // Message text + { + duration: 0, // Show permanently + allowClose: true // Add manual close button + } + ); +~~~ + +#### Success toast +~~~ +pb.success( + 'This is an example success toast' // Message text + {} // Addition options +); +~~~ + +#### Error toast +~~~ +pb.error( + 'This is an example error toast' // Message text + {} // Addition options +); +~~~ + +#### Info toast +~~~ +pb.info( + 'This is an example info toast' // Message text + {} // Addition options +); +~~~ + +#### Alert dialogue +~~~ +pb.alert( + (confirmed) => alert('You have: ' + (confirmed ? 'confirmed' : 'cancelled')), + 'This is an example alert', // Message text + 'Ok', // Ok text + {} // Addition options +); +~~~ + +#### Confirmation dialogue +~~~ +pb.confirm( + (outcome) => alert('You have: ' + (outcome ? 'confirmed' : 'cancelled')), // Callback + 'This is an example confirm', // Message text + 'Yes', // Confirm text + 'No' // Cancel text + {} // Addition options +); +~~~ + +#### Prompt dialogue +~~~ +pb.prompt( + function (value) { alert('You have: ' + (value ? 'entered ' + value : 'cancelled')) }, // Callback + 'This is an example prompt', // Message text + 'text', // Input type + 'Submit', // Submit text + 'Cancel', // Cancel text + {} // Addition options +); +~~~ + +#### Clear instances +~~~ +pb.clear(); +~~~ + +#### Style Sheet +There is a default stylesheet that you'll need to include. You're more than welcome to create your own and style it the way you want! +