Socket
Socket
Sign inDemoInstall

@featherds/composables

Package Overview
Dependencies
Maintainers
2
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@featherds/composables - npm Package Compare versions

Comparing version 0.10.17 to 0.11.1

4

modal/CloseOnEsc.js
import { watch, ref, onBeforeUnmount } from "vue";
import { KEYCODES } from "@featherds/utils/keys";
import { Code } from "@featherds/utils/keys";
const useCloseOnEsc = (visibleRef) => {
const result = ref(false);
const handleEsc = (e) => {
if (e.keyCode === KEYCODES.ESCAPE) {
if (e.code === Code.ESCAPE) {
e.preventDefault();

@@ -8,0 +8,0 @@ result.value = !result.value;

import { useCloseOnEsc } from "./CloseOnEsc";
import { mount } from "@vue/test-utils";
import { ref, nextTick } from "vue";
import { KEYCODES } from "@featherds/utils/keys";
import { Code } from "@featherds/utils/keys";

@@ -50,3 +50,3 @@ const createWrapper = (setup) => {

const event = new KeyboardEvent("keydown", {
keyCode: KEYCODES.ESCAPE,
code: Code.ESCAPE,
view: window,

@@ -53,0 +53,0 @@ bubbles: true,

import { watch, ref, onBeforeUnmount, Ref } from "vue";
import { KEYCODES } from "@featherds/utils/keys";
import { Code } from "@featherds/utils/keys";

@@ -7,3 +7,3 @@ const useCloseOnEsc = (visibleRef: Ref<boolean>) => {

const handleEsc = (e: KeyboardEvent) => {
if (e.keyCode === KEYCODES.ESCAPE) {
if (e.code === Code.ESCAPE) {
e.preventDefault();

@@ -10,0 +10,0 @@ result.value = !result.value;

{
"name": "@featherds/composables",
"version": "0.10.17",
"version": "0.11.1",
"publishConfig": {

@@ -12,3 +12,3 @@ "access": "public"

"dependencies": {
"@featherds/utils": "^0.10.17",
"@featherds/utils": "^0.11.1",
"vue": "^3.1.0-0"

@@ -20,3 +20,3 @@ },

],
"gitHead": "41821f88a5ba6b29ed971d0eaab62876979a16b6"
"gitHead": "c7511ec0934820519f9efd079a66a64c82c7bf58"
}

@@ -5,2 +5,3 @@ import { ref, watch, watchEffect, computed, provide } from "vue";

import { getSafeId } from "@featherds/utils/id";
import { Code } from "@featherds/utils/keys";
const useRadioGroup = (modelValue, emit, label, schema, errorFromInput) => {

@@ -78,5 +79,5 @@ const radios = ref([]);

const keydown = (e) => {
switch (e.keyCode) {
case 13:
case 32:
switch (e.code) {
case Code.ENTER:
case Code.SPACE:
if (currentSelected.value) {

@@ -90,9 +91,9 @@ select(currentSelected.value);

//next
case 40:
case 39:
case Code.DOWN:
case Code.RIGHT:
selection.selectNext();
break;
//previous
case 37:
case 38:
case Code.LEFT:
case Code.UP:
selection.selectPrevious();

@@ -99,0 +100,0 @@ break;

@@ -5,2 +5,3 @@ import { ref, watch, watchEffect, computed, provide, Ref } from "vue";

import { getSafeId } from "@featherds/utils/id";
import { Code } from "@featherds/utils/keys";

@@ -101,5 +102,5 @@ const useRadioGroup = (

const keydown = (e: KeyboardEvent) => {
switch (e.keyCode) {
case 13:
case 32:
switch (e.code) {
case Code.ENTER:
case Code.SPACE:
if (currentSelected.value) {

@@ -112,9 +113,9 @@ select(currentSelected.value);

//next
case 40:
case 39:
case Code.DOWN:
case Code.RIGHT:
selection.selectNext();
break;
//previous
case 37:
case 38:
case Code.LEFT:
case Code.UP:
selection.selectPrevious();

@@ -121,0 +122,0 @@ break;

import { ref, toRef, watch, provide, } from "vue";
import { getSafeId } from "@featherds/utils/id";
import { KEYCODES } from "@featherds/utils/keys";
import { Code } from "@featherds/utils/keys";
const model = {

@@ -46,3 +46,3 @@ prop: "modelValue",

}
const key = evt.keyCode;
const code = evt.code;
const stop = (e) => {

@@ -55,10 +55,10 @@ e.stopPropagation();

let index = focusedIndex !== -1 ? focusedIndex : localSelected.value;
const nextKeys = [KEYCODES.RIGHT];
const prevKeys = [KEYCODES.LEFT];
const selectKeys = [KEYCODES.ENTER, KEYCODES.SPACE];
const nextKeys = [Code.RIGHT];
const prevKeys = [Code.LEFT];
const selectKeys = [Code.ENTER, Code.SPACE];
if (props.vertical) {
nextKeys.push(KEYCODES.DOWN);
prevKeys.push(KEYCODES.UP);
nextKeys.push(Code.DOWN);
prevKeys.push(Code.UP);
}
if (nextKeys.indexOf(key) > -1) {
if (nextKeys.includes(code)) {
index++;

@@ -71,3 +71,3 @@ if (index >= notDisabledPairs.length) {

}
else if (prevKeys.indexOf(key) > -1) {
else if (prevKeys.includes(code)) {
index--;

@@ -80,3 +80,3 @@ if (index < 0) {

}
if (selectKeys.indexOf(key) > -1) {
if (selectKeys.includes(code)) {
activateIndex(index);

@@ -83,0 +83,0 @@ }

@@ -11,3 +11,3 @@ import {

import { getSafeId } from "@featherds/utils/id";
import { KEYCODES } from "@featherds/utils/keys";
import { Code } from "@featherds/utils/keys";

@@ -104,3 +104,3 @@ const model = {

}
const key = evt.keyCode;
const code = evt.code;
const stop = (e: Event) => {

@@ -117,11 +117,11 @@ e.stopPropagation();

let index = focusedIndex !== -1 ? focusedIndex : localSelected.value;
const nextKeys = [KEYCODES.RIGHT];
const prevKeys = [KEYCODES.LEFT];
const selectKeys = [KEYCODES.ENTER, KEYCODES.SPACE];
const nextKeys = [<string>Code.RIGHT];
const prevKeys = [<string>Code.LEFT];
const selectKeys = [<string>Code.ENTER, <string>Code.SPACE];
if (props.vertical) {
nextKeys.push(KEYCODES.DOWN);
prevKeys.push(KEYCODES.UP);
nextKeys.push(<string>Code.DOWN);
prevKeys.push(<string>Code.UP);
}
if (nextKeys.indexOf(key) > -1) {
if (nextKeys.includes(code)) {
index++;

@@ -133,3 +133,3 @@ if (index >= notDisabledPairs.length) {

selectIndex(pairs.value.indexOf(notDisabledPairs[index]));
} else if (prevKeys.indexOf(key) > -1) {
} else if (prevKeys.includes(code)) {
index--;

@@ -142,3 +142,3 @@ if (index < 0) {

}
if (selectKeys.indexOf(key) > -1) {
if (selectKeys.includes(code)) {
activateIndex(index);

@@ -145,0 +145,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc