From e15b1cadfa97dd5ee71fae07840d702ce420a17c Mon Sep 17 00:00:00 2001 From: Ken Date: Thu, 13 Feb 2025 19:46:16 +0100 Subject: [PATCH] :recycle: Switch, Textarea --- @navikt/core/react/src/form/select/Select.tsx | 21 ++++++++----- @navikt/core/react/src/form/switch/Switch.tsx | 31 +++++++++++++------ .../core/react/src/form/textarea/Textarea.tsx | 13 +++++--- .../src/form/textarea/TextareaCounter.tsx | 9 +++--- 4 files changed, 47 insertions(+), 27 deletions(-) diff --git a/@navikt/core/react/src/form/select/Select.tsx b/@navikt/core/react/src/form/select/Select.tsx index 0f217c6fcb..5da6212160 100644 --- a/@navikt/core/react/src/form/select/Select.tsx +++ b/@navikt/core/react/src/form/select/Select.tsx @@ -1,6 +1,6 @@ -import cl from "clsx"; import React, { SelectHTMLAttributes, forwardRef } from "react"; import { ChevronDownIcon } from "@navikt/aksel-icons"; +import { useRenameCSS } from "../../theme/Theme"; import { BodyShort, ErrorMessage, Label } from "../../typography"; import { omit } from "../../util"; import { ReadOnlyIconWithTitle } from "../ReadOnlyIcon"; @@ -70,6 +70,8 @@ export const Select = forwardRef( ...rest } = props; + const { cn } = useRenameCSS(); + const readOnlyEventHandlers = { onMouseDown: (evt) => { // NOTE: does not prevent click @@ -93,7 +95,7 @@ export const Select = forwardRef( return (
( {!!description && ( ( {description} )} -
+
- +
( ...rest } = props; + const { cn } = useRenameCSS(); + const [_checked, setChecked] = useState( defaultChecked ?? checkedProp ?? false, ); @@ -76,7 +78,7 @@ export const Switch = forwardRef( return (
( } props.onClick?.(event); }} - className={cl(className, "navds-switch__input")} + className={cn(className, "navds-switch__input")} /> - - + + {loading ? ( ( focusable={false} role="img" aria-hidden - className="navds-switch__checkmark" + className={cn("navds-switch__checkmark")} > ( )} -