1.4.30 • Published 8 months ago

cosmic-tamil-keyboard v1.4.30

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
8 months ago

Installation

npm install cosmic-tamil-keyboard

Example function component :

 import { useRef, useState } from 'react';
 import { Input } from 'antd';
 import TamilKeyboard  from "cosmic-tamil-keyboard";

 const  App =() =>{
    
  const [data, setdata] = useState({
 	 visible: true,
  	inputs: ""
  });
  const inputRef = useRef();
  const keyboardRef = useRef();

  const handleKeyboardChange = (data) => {
    setdata((inputData) => ({ ...inputData, inputs: data, }))
  };

  
  const handleEnterClick=(key)=>{
        console.log(key,'clicked');
  }

  return (
  
    <>
      {/* Pass all the input field properties same as example to get expected output. This keyboard only applicable for antd input.*/}
	
      <Input 
	    type="text"
	    id="virtualkeyID"
        onPaste={(e) => keyboardRef.current.handlePaste(e)}
        onKeyPress={(e) => keyboardRef.current.keypress(e)}
        onKeyDown={(e) => keyboardRef.current.keyup(e)}
        onCut={e => keyboardRef.current.handleCut(e)}
        onFocus={(e) => [keyboardRef.current.onfocus(e),
        // multiple un used keyboard hideing(textbox id passing for array in the format)
        keyboardRef.current.anotherKeyBoardHide(["virtualkeyID1","virtualkeyID2","virtualkeyID3"])]}
        value={data.inputs}
        ref={inputRef} />

      <TamilKeyboard  keysound={true}
        visible={data.visible}
		// To 'set' keyboard input values to above input field
        keydatavalue={handleKeyboardChange}
        ref={keyboardRef}
		// 'inputid' same as above input field 'id'
        inputid={"virtualkeyID"}
        handleEnterClick={handleEnterClick} // if you use enter handlecontroller
		// 'inputref' same as above input field 'ref'
    //  inputType={"textArea"} if you give textArear provide this
        inputref={inputRef} /> 
       <button  onClick={(e)=>keyboardRef.current.allowclear(e)}>allowclear</button>
    </>
  );
}

Example class component :

import React, { createRef } from 'react';
import { Input } from 'antd';
import { TamilKeyboard } from 'cosmic-tamil-keyboard'

class Keyboad extends React.Component {
  constructor() {
  super()
  this.state = {
      visible: true,
      inputs: ""
    }
  }
  
  inputRef = createRef();
  keyboardRef = createRef();

  handleKeyboardChange  = (data) => {
    this.setState((inputData) => ({ ...inputData, inputs: data, }))
  }

  
 handleEnterClick=(key)=>{
        console.log(key,'clicked');
  }
  
  render() {
    return (
	
      <>
         {/* Pass all the input field properties same as example to get expected output. This keyboard only applicable for antd input.*/}
	  
        <Input
          type="text"
          id="virtualkeyID"
          onPaste={(e) => this.keyboardRef.current.handlePaste(e)}
          onKeyPress={(e) => this.keyboardRef.current.keypress(e)}
          onKeyDown={(e) => this.keyboardRef.current.keyup(e)}
          onCut={e => this.keyboardRef.current.handleCut(e)}
            onFocus={(e) => [this.keyboardRef.current.onfocus(e),this.keyboardRef.current.anotherKeyBoardHide(["virtualkeyID1","virtualkeyID2","virtualkeyID3"])]}
          value={this.state.inputs}
          ref={this.inputRef} />

        <TamilKeyboard
          keysound={true}
          visible={this.state.visible}
          // To 'set' keyboard input values to above input field
          keydatavalue={this.handleKeyboardChange }
          ref={this.keyboardRef}
          handleEnterClick={handleEnterClick} // if you use enter handlecontroller
          // 'inputid' same as above input field 'id'
          inputid={"virtualkeyID"}
		      // 'inputref' same as above input field 'ref'
          inputref={this.inputRef}
        />
        <button  onClick={(e)=>this.keyboardRef.current.allowclear(e)}>allowclear</button>
      </>

    );
  }
}
export default Keyboad

Features

  • Sound effects
  • System keyboard control
  • Draggable
  • Customized color change
  • Touch based control
  • Allow clear function

API

Properties (All are mandatory)DescriptionTypeDefault
visibleshow & hidebooleantrue
keydatavalueset user keyboard input values to targeted input fieldInput change function()empty
keysoundsound enable/disablebooleantrue
inputidset inputid value same as text field idstringany string
inputrefset inputref value same as text field refanycreateRef()/useRef()

Images

npm.io

1.4.30

8 months ago

1.1.30

8 months ago

1.3.30

8 months ago

1.2.30

8 months ago

1.1.29

10 months ago

1.1.28

11 months ago

1.1.27

11 months ago

1.1.26

11 months ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.20

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.1.33

2 years ago

0.1.34

2 years ago

0.1.35

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

0.1.32

2 years ago

0.1.31

2 years ago

0.1.30

2 years ago

0.1.29

2 years ago

0.1.28

2 years ago

0.1.27

2 years ago

0.1.26

2 years ago

0.1.25

2 years ago

0.1.24

2 years ago

0.1.23

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago