@teachingtextbooks/keyboard
Version:
Customizable TypeScript soft keyboard
470 lines (435 loc) • 11.9 kB
CSS
/* @import "https://font.teachingtextbooksapp.com/Andika/Andika.css";
@import "https://font.teachingtextbooksapp.com/ZBKid/ZBKid.css"; */
@import "https://font.teachingtextbooksapp.com/Barto/Barto.css";
/* textarea, input {
user-select: text;
-webkit-user-select: text;
} */
/* .ttkbd-preloader {
position: fixed;
width: 1px;
height: 1px;
background-image: url("../tt-kbd-assets/cross_down.svg"),
url("../tt-kbd-assets/home_up.svg"),
url("../tt-kbd-assets/home_down.svg"),
url("../tt-kbd-assets/menu_up.svg"),
url("../tt-kbd-assets/menu_down.svg"),
url("../tt-kbd-assets/prev_down.svg"),
url("../tt-kbd-assets/prev_up.svg"),
url("../tt-kbd-assets/next_up.svg"),
url("../tt-kbd-assets/next_down.svg"),
url("../tt-kbd-assets/restart_down.svg"),
url("../tt-kbd-assets/restart_up.svg"),
url("../tt-kbd-assets/check_down.svg"),
url("../tt-kbd-assets/check_up.svg"),
url("../tt-kbd-assets/kbd_down.svg"),
url("../tt-kbd-assets/squarekey_up2.svg"),
url("../tt-kbd-assets/squarekey_ov2.svg"),
url("../tt-kbd-assets/squarekey_dn2.svg"),
url("../tt-kbd-assets/bluekey_ov.svg"),
url("../tt-kbd-assets/bluekey_dn.svg"),
url("../tt-kbd-assets/yellow_up.svg"),
url("../tt-kbd-assets/yellow_ov.svg"),
url("../tt-kbd-assets/yellow_dn.svg");
opacity: 0;
visibility: hidden;
} */
.tt-keyboard-wrap {
--size: 16px;
position: fixed;
white-space: nowrap;
min-width: max-content;
width: max-content;
text-align: center;
padding: calc(var(--size) * 0.3);
border-radius: calc(var(--size) * 1.4);
background: #EDE9E1;
box-shadow: -0.1rem 0.1rem 0.2rem #0009, inset 0 0 0.2rem #0009;
}
.tt-keyboard-wrap[data-keyboard-type="alphabet"] .tt-key-cross {
top: calc(var(--size) * 0.7);
right: calc(var(--size) * 0.7);
}
.tt-keyboard-wrap[data-keyboard-type="numbers"] .tt-key-btn {
margin: calc(var(--size) * 0.2) calc(var(--size) * 0.3);
}
.tt-keyboard {
font-family: Barto, Times, Impact, sans-serif;
color: #33312f;
display: inline-block;
padding: calc(var(--size) * 0.2);
border-radius: calc(var(--size) * 1.1);
background: #c0bbb3;
box-shadow: 0 0 0.2rem #0009, inset 0 0.1rem 0.2rem #0009;
}
.ttkbd-bottom {
bottom: calc(var(--size) * 2);
right: 0;
left: 0;
margin: auto;
transform-origin: center bottom;
}
.ttkbd-bottom-right {
bottom: 25px;
right: 25px;
transform-origin: right bottom;
}
.ttkbd-fixed {
top: 0px;
left: 0px;
}
.ttkbd-show-slide {
transition: transform 0.4s ease-out;
}
.ttkbd-hide-slide {
transition: transform 0.2s ease-in;
}
.ttkbd-fade-show {
transition: opacity 0.2s linear;
}
.ttkbd-fade-hide {
transition: opacity 0.1s linear;
}
/* .input-title {
display: inline-block;
margin-top: 10px;
}
.input-button {
display: inline-block;
font-family: Barto, "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
border: 0;
font-size: 14px;
text-align: center;
color: #e6e1dc;
text-shadow: 1px 1px 1px rgba(0, 0, 0, .3);
border-radius: 4px;
background-color: #6282b5;
outline: none;
cursor: pointer;
}
.input-button:hover {
background-color: #6e92cb;
}
.input-button:active {
background-color: #55719d;
} */
.ttkbd-unselectable, .kbd-info, .kbd-label {
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
-o-user-select:none;
user-select:none;
}
.ttkbd-enabled {
cursor: pointer;
color: #000;
}
.ttkbd-disabled {
pointer-events: none;
-webkit-touch-callout: none;
color: #bbbbbb;
opacity: 0.85;
}
.tt-keyboard-row {
display: flex;
}
.tt-key-btn {
position: relative;
margin: calc(var(--size) * 0.2);
width: calc(var(--size) * 1.8);
height: calc(var(--size) * 1.8);
white-space: nowrap;
border-radius: 50%;
padding: calc(var(--size) * 0.3);
background: #ece9e2;
/* box-shadow: -0.1rem 0.1rem 0.2rem #0009, inset 0 0 0.1rem #0009; */
box-shadow: -0.1rem 0.1rem 0.1rem #0009, inset 0 0 0.16rem #0009;
}
.tt-key-btn:active,
.tt-key-shift.tt-key-shift-on {
box-shadow: inset 0 0 calc(var(--size) * 0.8) #0009;
}
.tt-key-btn:active::after,
.tt-key-shift.tt-key-shift-on::after {
content: "";
position: absolute;
box-shadow: inset 0 0 calc(var(--size) * 0.8) #000, inset 0 0 calc(var(--size) * 0.8) #0009;
width: 100%;
height: 100%;
top: 0;
left: 0;
border-radius: 50%;
}
.tt-key-cross {
display: inline-block;
position: absolute;
top: calc(var(--size) * 0.6);
right: calc(var(--size) * 0.6);
width: calc(var(--size) * 1.4);
height: calc(var(--size) * 1.4);
padding: calc(var(--size) * 0.3);
margin: 0;
border-radius: 50%;
background: #DD312C;
box-shadow: -0.1rem 0.1rem 0.2rem #0009, inset 0 0 0.1rem #0009;
}
.tt-key-cross label {
font-size: calc(var(--size) * 1.125);
color: #fff;
background: #DD312C;
/* box-shadow: 0 0 0.1rem #0009, inset -0.06rem 0.06rem 0.06rem #0006; */
box-shadow: 0 0 0.18rem #0009, inset -0.06rem 0.06rem 0.1rem #0006;
}
.tt-key-kbd {
display: inline-block;
position: absolute;
right: 5px;
bottom: 5px;
width: 40px;
height: 41px;
border-style: solid;
border-width: 2px;
border-image-slice: 0 fill;
border-image-width: 1px;
border-image-source: url("../tt-kbd-assets/kbd_up.svg");
}
.tt-key-kbd:active {
border-image-source: url("../tt-kbd-assets/kbd_down.svg");
}
.tt-key-home {
display: inline-block;
position: absolute;
top: 5px;
left: 5px;
width: 40px;
height: 41px;
border-style: solid;
border-width: 2px;
border-image-slice: 0 fill;
border-image-width: 1px;
border-image-source: url("../tt-kbd-assets/home_up.svg");
}
.tt-key-home:active {
border-image-source: url("../tt-kbd-assets/home_down.svg");
}
.tt-key-menu, .tt-key-check-separate, .tt-key-reset, .tt-key-prev, .tt-key-next {
display: inline-block;
width: 40px;
height: 41px;
border-style: solid;
border-width: 2px;
border-image-slice: 0 fill;
border-image-width: 1px;
border-image-source: url("../tt-kbd-assets/menu_up.svg");
}
.tt-key-menu {
border-image-source: url("../tt-kbd-assets/menu_up.svg");
}
.tt-key-menu:active {
border-image-source: url("../tt-kbd-assets/menu_down.svg");
}
.tt-key-check-separate {
border-image-source: url("../tt-kbd-assets/check_up.svg");
}
.tt-key-check-separate:active {
border-image-source: url("../tt-kbd-assets/check_down.svg");
}
.tt-key-reset {
border-image-source: url("../tt-kbd-assets/restart_up.svg");
}
.tt-key-reset:active {
border-image-source: url("../tt-kbd-assets/restart_down.svg");
}
.tt-key-prev {
border-image-source: url("../tt-kbd-assets/prev_up.svg");
}
.tt-key-prev:active {
border-image-source: url("../tt-kbd-assets/prev_down.svg");
}
.tt-key-next {
border-image-source: url("../tt-kbd-assets/next_up.svg");
}
.tt-key-next:active {
border-image-source: url("../tt-kbd-assets/next_down.svg");
}
.tt-key-white {
filter: drop-shadow(-1px 1px 1px #0006);
border-image-source: url("../tt-kbd-assets/squarekey_up2.svg");
border-image-slice: 120 fill;
border-image-width: 12px;
border-image-outset: 4px 5px 4px 5px;
}
.tt-key-white:hover {
border-image-source: url("../tt-kbd-assets/squarekey_ov2.svg");
}
.tt-key-white:active {
border-image-source: url("../tt-kbd-assets/squarekey_dn2.svg");
/*padding: 1px 2px 0 0;*/
/*width: 20px;*/
/*height: 16px;*/
}
.tt-key-blue {
border-image-source: url("../tt-kbd-assets/bluekey_up.svg");
color: #FFFFFF;
text-shadow: 2px 1px #000000;
border-image-slice: 120 fill;
border-image-width: 12px;
border-image-outset: 4px 5px 4px 5px;
min-width: 18px;
}
.tt-key-blue:hover {
border-image-source: url("../tt-kbd-assets/bluekey_ov.svg");
}
.tt-key-blue:active {
border-image-source: url("../tt-kbd-assets/bluekey_dn.svg");
}
.tt-key-label {
pointer-events: none;
-webkit-touch-callout: none;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
background: #ece9e2;
border-radius: 50%;
/* box-shadow: 0 0 0.2rem #0009, inset -0.1rem 0.1rem 0.1rem #0006; */
box-shadow: 0 0 0.2rem #0009, inset -0.1rem 0.1rem 0.16rem #000c;
font-size: calc(var(--size) * 1.5); /* 18 / 16 */
font-weight: normal;
color: #000;
}
.tt-key-label::before {
content: attr(title);
position: absolute;
transform: translate(-0.02rem, 0.06rem);
}
.tt-key-white:active .tt-key-label {
padding-top: 1px;
color: white;
filter: drop-shadow(-1px 1px 1px #000);
}
.tt-key-reg {
font-size: var(--size);
}
.tt-key-wide {
font-size: 14px;
min-width: 56px;
}
.tt-key-space {
font-size: 14px;
min-width: 150px;
color: #999999;
}
.tt-key-space-wide {
font-size: 14px;
min-width: 538px;
color: #999999;
}
/* .tt-key-shift {
font-size: 14px;
min-width: 56px;
}
.tt-key-shift-off, .tt-key-capslock-off {
color: #999999;
}
.tt-key-shift-on, .tt-key-capslock-on {
color: #6eade0;
} */
.tt-key-backspace label, .tt-key-backspace-wide label {
background-image: url("../tt-kbd-assets/backspace.png");
background-size: 70%;
background-repeat: no-repeat;
background-position: 40% 50%;
}
.tt-key-backspace-wide {
flex: 1;
border-radius: calc(var(--size) * 1.2);
}
.tt-key-backspace-wide label {
background-size: 30%;
border-radius: calc(var(--size) * 1.2);
}
.tt-key-backspace-wide:active::after {
border-radius: calc(var(--size) * 1.2);
}
/* .tt-key-upper label, .tt-key-lower label {
background-image: url("../tt-kbd-assets/caps.png");
background-size: 70%;
background-repeat: no-repeat;
background-position: 40% 50%;
}
.tt-key-lower label {
transform: scaleY(-1);
box-shadow: 0 0 0.2rem #0009, inset 0.1rem -0.1rem 0.2rem #84807B;
background-position: 50% 40%;
} */
.tt-key-shift label {
background-image: url("../tt-kbd-assets/caps.png");
background-size: 70%;
background-repeat: no-repeat;
background-position: 40% 50%;
}
/* .tt-key-shift.tt-key-capslock-on label {
transform: scaleY(-1);
box-shadow: 0 0 0.2rem #0009, inset 0.1rem -0.1rem 0.2rem #84807B;
background-position: 50% 40%;
} */
.tt-key-arrow {
font-size: 14px;
color: #999999;
min-width: 16px;
}
.tt-key-tab {
font-size: 14px;
color: #999999;
min-width: 22px;
}
.tt-key-capslock {
font-size: 14px;
}
.tt-key-enter {
font-size: 14px;
color: #999999;
min-width: 60px;
}
.tt-key-numbers, .tt-key-alphabet {
position: relative;
padding: calc(var(--size) * 0.3);
border-radius: calc(var(--size) * 2.667);
background: #EFA806;
box-shadow: -0.1rem 0.1rem 0.2rem #0009, inset 0 0 0.2rem #0009;
}
.tt-key-numbers {
width: 41%;
}
.tt-key-alphabet {
width: 56%;
}
.tt-key-numbers label, .tt-key-alphabet label {
font-size: calc(var(--size) * 1.2);
border-radius: calc(var(--size) * 2.667);
background: #ffc655;
box-shadow: 0 0 0.2rem #0009, inset -0.1rem 0.1rem 0.2rem #0009;
}
.tt-key-numbers:active::after, .tt-key-alphabet:active::after {
border-radius: calc(var(--size) * 2.667);
}
.kbd-info {
/* font-family: ZBKid, Verdana, Arial, Helvetica, sans-serif; */
font-family: Barto, "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 17px;
color: #696969;
position: absolute;
top: 65px;
left: 10px;
line-height: 1.2;
min-width: 300px;
}
.kbd-info ul {
list-style-type: square;
margin-block-start: 10px;
margin-block-end: 10px;
padding-inline-start: 25px;
}