@featherds/composables
Advanced tools
Comparing version 0.9.2 to 0.9.3
@@ -14,4 +14,4 @@ import { useOutsideClick } from "./OutsideClick"; | ||
it("should only attach listeners when element and active", async () => { | ||
const windowSpy = spyOn(window, "addEventListener"); | ||
const documentSpy = spyOn(document, "addEventListener"); | ||
const windowSpy = jest.spyOn(window, "addEventListener"); | ||
const documentSpy = jest.spyOn(document, "addEventListener"); | ||
const elRef = ref(false); | ||
@@ -58,4 +58,4 @@ let active; | ||
it("should remove listeners when active is false", async () => { | ||
const windowSpy = spyOn(window, "removeEventListener"); | ||
const documentSpy = spyOn(document, "removeEventListener"); | ||
const windowSpy = jest.spyOn(window, "removeEventListener"); | ||
const documentSpy = jest.spyOn(document, "removeEventListener"); | ||
const elRef = ref(true); | ||
@@ -76,4 +76,4 @@ let active; | ||
it("should remove listeners on unmount", async () => { | ||
const windowSpy = spyOn(window, "removeEventListener"); | ||
const documentSpy = spyOn(document, "removeEventListener"); | ||
const windowSpy = jest.spyOn(window, "removeEventListener"); | ||
const documentSpy = jest.spyOn(document, "removeEventListener"); | ||
const elRef = ref(true); | ||
@@ -80,0 +80,0 @@ let active; |
@@ -34,3 +34,3 @@ import { nextTick } from "vue"; | ||
it("should only add event listener when active is set to true", async () => { | ||
const spy = spyOn(window, "addEventListener"); | ||
const spy = jest.spyOn(window, "addEventListener"); | ||
const listener = jest.fn(); | ||
@@ -50,3 +50,3 @@ | ||
it("should remove events on unmount", async () => { | ||
const spy = spyOn(window, "removeEventListener"); | ||
const spy = jest.spyOn(window, "removeEventListener"); | ||
const wrapper = createWrapper(() => { | ||
@@ -53,0 +53,0 @@ const active = useResize(jest.fn()); |
@@ -15,3 +15,3 @@ import { useCloseOnEsc } from "./CloseOnEsc"; | ||
it("should only attach listeners when visible", async () => { | ||
const documentSpy = spyOn(document, "addEventListener"); | ||
const documentSpy = jest.spyOn(document, "addEventListener"); | ||
const visible = ref(false); | ||
@@ -29,3 +29,3 @@ const wrapper = createWrapper(() => { | ||
it("should remove listeners when visible is false", async () => { | ||
const documentSpy = spyOn(document, "removeEventListener"); | ||
const documentSpy = jest.spyOn(document, "removeEventListener"); | ||
const visible = ref(true); | ||
@@ -66,3 +66,3 @@ const wrapper = createWrapper(() => { | ||
it("should remove listeners on unmount", async () => { | ||
const documentSpy = spyOn(document, "removeEventListener"); | ||
const documentSpy = jest.spyOn(document, "removeEventListener"); | ||
const visible = ref(true); | ||
@@ -69,0 +69,0 @@ const wrapper = createWrapper(() => { |
{ | ||
"name": "@featherds/composables", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"publishConfig": { | ||
@@ -10,3 +10,3 @@ "access": "public" | ||
"dependencies": { | ||
"@featherds/utils": "^0.9.2", | ||
"@featherds/utils": "^0.9.3", | ||
"vue": "^3.1.0-0" | ||
@@ -19,3 +19,3 @@ }, | ||
"types": "./index.d.ts", | ||
"gitHead": "c5b9a591688579921f59e070325aa141c23315f7" | ||
"gitHead": "aebb5c7fe38504ab6719aff7007fe42ba940c63e" | ||
} |
import { ref, watch, watchEffect, computed, provide } from "vue"; | ||
import { useValidation } from "@featherds/input/src/components/useValidation"; | ||
import { useSelection } from "./Selection"; | ||
const useRadioGroup = (modelValue, emit) => { | ||
import { getSafeId } from "@featherds/utils/id"; | ||
const useRadioGroup = (modelValue, emit, label, schema) => { | ||
const radios = ref([]); | ||
const currentSelected = ref(); | ||
const firstElement = ref(); | ||
const firstElementId = ref(); | ||
@@ -56,4 +59,16 @@ watchEffect(() => { | ||
const groupId = computed(() => { | ||
return getSafeId("feather-radio-group"); | ||
}); | ||
firstElementId.value = groupId.value; | ||
let validate = useValidation(firstElementId, modelValue, label, schema); | ||
const register = (radio) => { | ||
radios.value = [...radios.value, radio]; | ||
//lets try and instance validation | ||
if (firstElementId.value === groupId.value) { | ||
firstElementId.value = radio.id; | ||
} | ||
}; | ||
@@ -100,2 +115,5 @@ provide("register", register); | ||
focus, | ||
validate, | ||
firstElementId, | ||
groupId, | ||
}; | ||
@@ -102,0 +120,0 @@ }; |
@@ -28,3 +28,3 @@ import { ref, inject, computed, onMounted } from "vue"; | ||
thisEl = tab.value.parentElement; | ||
parent = (thisEl && thisEl.parentNode) ? thisEl.parentNode : []; | ||
parent = thisEl && thisEl.parentNode ? thisEl.parentNode : []; | ||
childNodes = [].filter.call(parent.children, function (el) { | ||
@@ -31,0 +31,0 @@ return el.querySelectorAll("[role=tab]").length; |
@@ -22,3 +22,3 @@ import { ref, inject, computed, onMounted } from "vue"; | ||
thisEl = panel.value; | ||
parent = (thisEl && thisEl.parentNode) ? thisEl.parentNode : []; | ||
parent = thisEl && thisEl.parentNode ? thisEl.parentNode : []; | ||
index = thisEl | ||
@@ -25,0 +25,0 @@ ? Array.prototype.indexOf.call(parent.children, thisEl) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41384
1054
Updated@featherds/utils@^0.9.3