diff --git a/packages/ffe-accordion-react/package.json b/packages/ffe-accordion-react/package.json index f19b62ae4a..7e321460d1 100644 --- a/packages/ffe-accordion-react/package.json +++ b/packages/ffe-accordion-react/package.json @@ -28,7 +28,6 @@ "@sb1/ffe-accordion": "^10.0.30", "@sb1/ffe-collapse-react": "^5.0.5", "@sb1/ffe-icons-react": "^11.0.2", - "@types/uuid": "^9.0.0", "classnames": "^2.3.1" }, "devDependencies": { diff --git a/packages/ffe-form-react/src/ToggleSwitch.tsx b/packages/ffe-form-react/src/ToggleSwitch.tsx index 7111ebd2e6..d512a333f0 100644 --- a/packages/ffe-form-react/src/ToggleSwitch.tsx +++ b/packages/ffe-form-react/src/ToggleSwitch.tsx @@ -1,5 +1,4 @@ -import React, { useRef } from 'react'; -import { v4 as uuidv4 } from 'uuid'; +import React, { useId } from 'react'; import classNames from 'classnames'; import i18n from './i18n/i18n'; @@ -26,13 +25,15 @@ export const ToggleSwitch: React.FC = ({ hideOnOff, onText, offText, - id, + id: providedId, value = 'on', locale = 'nb', checked, ...rest }) => { - const generatedId = useRef(id ?? `toggle-${uuidv4()}`).current; + const generatedId = useId(); + + const id = providedId ?? generatedId; const text = i18n[locale]; @@ -47,12 +48,12 @@ export const ToggleSwitch: React.FC = ({ -