From 7978a2b2c3c26abcacca85b0f3c93dee7a99709e Mon Sep 17 00:00:00 2001 From: barsnes Date: Wed, 30 Oct 2024 13:54:24 +0100 Subject: [PATCH 01/32] feat(Search): api changes --- .../src/components/form/Search/Search.tsx | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/packages/react/src/components/form/Search/Search.tsx b/packages/react/src/components/form/Search/Search.tsx index c1dd736ec4..9e5fe16c64 100644 --- a/packages/react/src/components/form/Search/Search.tsx +++ b/packages/react/src/components/form/Search/Search.tsx @@ -9,17 +9,12 @@ import { omit } from '../../../utilities'; import { Button } from '../../Button/Button'; import { Label } from '../../Label'; import { Paragraph } from '../../Paragraph'; +import { Input } from '../Input/Input'; import type { FormFieldProps } from '../useFormField'; import { useSearch } from './useSearch'; export type SearchProps = { - /** Label */ - label?: ReactNode; - /** Visually hides `label` and `description` (still available for screen readers) - * @default true - */ - hideLabel?: boolean; /** Variant * @default 'simple' */ @@ -45,7 +40,12 @@ export type SearchProps = { 'size' | 'description' | 'readOnly' | 'error' | 'errorId' > & Omit, 'size' | 'readOnly'> & - DefaultProps; + DefaultProps & + ( + | { 'aria-label': string; 'aria-labelledby'?: never; label?: never } + | { 'aria-label'?: never; 'aria-labelledby'?: never; label: ReactNode } + | { 'aria-label'?: never; 'aria-labelledby': string; label?: never } + ); /** Search field * @@ -59,7 +59,6 @@ export const Search = forwardRef( const { label, style, - hideLabel = true, variant = 'simple', searchButtonLabel = 'Søk', clearButtonLabel = 'Tøm', @@ -115,13 +114,8 @@ export const Search = forwardRef( )} > {label && ( -