Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@ jobs:
- name: Use npm >= v11.15.0 for staged publishing
run: npm install -g npm@11.16.0

- name: Install root dependencies
- name: Install dependencies
run: npm ci

- name: Install React subpackage dependencies
run: npm ci
working-directory: src/react

- name: Build
run: npm run build
Comment thread
ty2k marked this conversation as resolved.
working-directory: ./

- name: Publish to npm
run: npm stage publish --tag latest --provenance
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ permissions:

on:
pull_request:
paths:
- src/react/**
workflow_dispatch:

jobs:
test:
name: React tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/react

steps:
- name: Checkout code
Expand Down
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
File renamed without changes.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# v-k-b ⌨️

Virtual keyboard library for web front-ends.
Virtual keyboard library for React front-ends.

- No styles or opinionated button components included - bring your design system components and custom styling.
- Handle your own text field state with key press callbacks, including backspace and clear functions.
- Minimum possible dependencies. For example, the React keyboard component only depends on `react` and `react-dom` as peer dependencies.
- Minimum possible dependencies: `react` and `react-dom` as peer dependencies.

## Install

`npm i v-k-b`
Comment thread
ty2k marked this conversation as resolved.

## Components by front-end

### React
## Use

Import the `VkbReactKeyboard` component and `Key` type:

Expand Down Expand Up @@ -123,7 +121,7 @@ function App() {
}
```

#### How React button components work
### How React button components work

`VkbReactKeyboard` lets you pass your own React button components to use with the keyboard. The `ButtonComponent` prop accepts things like:

Expand All @@ -139,11 +137,11 @@ Use the `buttonProps` prop for passing common props to all buttons. For example,

Use the `getButtonProps` callback that receives information about the key being pressed to let you customize the rendering of individual buttons.

#### How rows of keys work
### How rows of keys work

`VkbReactKeyboard` accepts a `rows` array prop, which is an array of `Key` arrays.

#### How keys work
### How keys work

A `Key` can be a regular string `KeyString`:

Expand Down Expand Up @@ -195,7 +193,7 @@ const backspaceKeyObject: KeyObject = {
};
```

#### How capitalization (shift and caps lock) works
### How capitalization (shift and caps lock) works

Keyboards keep track of lowercase/uppercase state internally using React's `useState()`. Keyboards initially start off in lowercase mode. You can access uppercase mode by including a Shift or Caps Lock key:

Expand Down Expand Up @@ -236,11 +234,11 @@ If you use a `Key` that's just a string, the Keyboard will infer how capitalizat

If a `KeyObject` with a callback `cb` is pressed while in shift mode, the keyboard returns to lowercase mode.

#### How styling works
### How styling works

Any extra props passed to `VkbReactKeyboard` are spread on the parent `<div>` being returned. Use this to target your styles by passing `className`, or use a CSS-in-JS library to style the component.

#### Accessibility
### Accessibility

For labelling, the `ariaLabel` prop can be used to assign an [aria-label](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label) directly. The `ariaLabelledBy` prop can be used to point to a label outside of the component using [aria-labelledby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-labelledby).

Expand Down
31 changes: 0 additions & 31 deletions __tests__/importTests.test.ts

This file was deleted.

4 changes: 0 additions & 4 deletions dist/index.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions dist/index.js

This file was deleted.

122 changes: 0 additions & 122 deletions dist/react/index.d.ts

This file was deleted.

Loading