-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
460 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 shubhadip | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script lang="ts"> | ||
import Prism from 'svelte-prism'; | ||
import OtpInput from '../../lib/OtpInput/OtpInput.svelte'; | ||
const FocusValue = ` | ||
<OtpInput | ||
separator="-" | ||
maskInput={true} | ||
numberOfInputs={4} | ||
placeholder="****" | ||
autoFocusNextOnInput={true} | ||
focusPreviousOnDelete={true} | ||
/>`; | ||
</script> | ||
|
||
<main> | ||
|
||
<div class="container"> | ||
<div class="codesnippet"> | ||
<Prism language="html" source="{FocusValue}" /> | ||
</div> | ||
<div> | ||
<OtpInput | ||
separator={"-"} | ||
maskInput={true} | ||
numberOfInputs={4} | ||
placeholder={"****"} | ||
autoFocusNextOnInput={true} | ||
focusPreviousOnDelete={true} | ||
/> | ||
</div> | ||
<label for="name">Focus Change on Input/Delete </label> | ||
</div> | ||
</main> | ||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script lang="ts"> | ||
import Prism from 'svelte-prism'; | ||
import OtpInput from '../../lib/OtpInput/OtpInput.svelte'; | ||
let value = ''; | ||
let emittedValue = '' | ||
let otpInstance: {getValue: () => void}; | ||
function handleClick() { | ||
alert(JSON.stringify(otpInstance?.getValue())) | ||
} | ||
function callbackFunction(event: CustomEvent) { | ||
emittedValue = JSON.stringify(event.detail) | ||
} | ||
const GetInputValueHtml = ` | ||
// script | ||
let value = ''; | ||
let otpInstance: {getValue: () => void}; | ||
function handleClick() { | ||
console.log('value on click', | ||
otpInstance?.getValue()); | ||
} | ||
function callbackFunction(event: CustomEvent) { | ||
console.log('emittedValue', event.detail); | ||
} | ||
` | ||
const GetInputValueJS = ` | ||
<OtpInput | ||
numberOfInputs={4} | ||
separator='*' | ||
placeholder='0000' | ||
bind:initialValue={value} | ||
on:notify={callbackFunction} | ||
maskInput={false} | ||
autoFocusNextOnInput={true} | ||
focusPreviousOnDelete={true} | ||
emitEventOnPrefill={true} | ||
bind:this={otpInstance} | ||
/>` | ||
</script> | ||
|
||
<main> | ||
<div class="container"> | ||
<div class="codesnippet prism-multi"> | ||
<Prism language="html" source="{GetInputValueHtml}" /> | ||
<Prism language="html" source="{GetInputValueJS}" /> | ||
</div> | ||
<OtpInput | ||
numberOfInputs={4} | ||
separator={'*'} | ||
placeholder={'0000'} | ||
bind:initialValue={value} | ||
on:notify={callbackFunction} | ||
maskInput={false} | ||
autoFocusNextOnInput={true} | ||
focusPreviousOnDelete={true} | ||
emitEventOnPrefill={true} | ||
bind:this={otpInstance} | ||
/> | ||
<p style="font-weight: bold">EmittedValue: {emittedValue}</p> | ||
<div class="button-otp" on:click={handleClick}> Get Value </div> | ||
</div> | ||
</main> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script lang="ts"> | ||
import NumberOfInputs from './NumberOfInputs/Index.svelte' | ||
import PlaceholderSeparators from './PlaceholderSeparators/Index.svelte' | ||
// import Styles from './Styles/Index.svelte' | ||
import MaskInput from './MaskInput/Index.svelte' | ||
import Focus from './Focus/Index.svelte' | ||
import GetValue from './GetValue/Index.svelte' | ||
import Prefill from './Prefill/Index.svelte' | ||
</script> | ||
<main class="main-container"> | ||
<div class="example"> | ||
<NumberOfInputs /> | ||
</div> | ||
<div class="example"> | ||
<PlaceholderSeparators /> | ||
</div> | ||
<div class="example"> | ||
<MaskInput /> | ||
</div> | ||
<div class="example"> | ||
<Focus /> | ||
</div> | ||
<div class="example"> | ||
<GetValue /> | ||
</div> | ||
<!-- <div class="example"> | ||
<Styles /> | ||
</div> --> | ||
<div class="example"> | ||
<Prefill /> | ||
</div> | ||
|
||
</main> | ||
<style lang="postcss"> | ||
@import "./examples.postcss"; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<script lang="ts"> | ||
import Prism from 'svelte-prism'; | ||
import OtpInput from '../../lib/OtpInput/OtpInput.svelte'; | ||
const MaskingValue = ` | ||
<OtpInput separator="-" placeholder="****" numberOfInputs={4} maskInput={true} />`; | ||
</script> | ||
|
||
<main> | ||
<div class="container"> | ||
<div class="codesnippet"> | ||
<Prism language="html" source="{MaskingValue}" /> | ||
</div> | ||
<div> | ||
<OtpInput | ||
separator={"-"} | ||
maskInput={true} | ||
numberOfInputs={4} | ||
placeholder={"****"} | ||
/> | ||
</div> | ||
<label for="name">Masking Input </label> | ||
</div> | ||
</main> | ||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script lang="ts"> | ||
import Prism from 'svelte-prism' | ||
import OtpInput from '../../lib/OtpInput/OtpInput.svelte'; | ||
const InputSix = ` | ||
<OtpInput numberOfInputs={6} />`; | ||
</script> | ||
|
||
<main> | ||
<div> | ||
<div class="container"> | ||
<div class="codesnippet"> | ||
<Prism language="html" source="{InputSix}" /> | ||
</div> | ||
<div> | ||
<OtpInput numberOfInputs={6} /> | ||
</div> | ||
<label>Number Of Inputs</label> | ||
</div> | ||
</div> | ||
</main> | ||
<style lang="postcss"> | ||
@import "./index.postcss"; | ||
</style> |
Empty file.
Oops, something went wrong.