From 3bdd2a262e0b5e3eb764cd926c91067f0387a38b Mon Sep 17 00:00:00 2001 From: Lewis Hankinson Date: Thu, 2 Nov 2023 12:26:34 +0000 Subject: [PATCH 1/4] Fix PersonSearch story error --- lib/src/components/personSearch/PersonSearch.stories.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/components/personSearch/PersonSearch.stories.tsx b/lib/src/components/personSearch/PersonSearch.stories.tsx index 5b5bc43e7..9d0b28016 100644 --- a/lib/src/components/personSearch/PersonSearch.stories.tsx +++ b/lib/src/components/personSearch/PersonSearch.stories.tsx @@ -13,7 +13,7 @@ export default { export function PersonSearch(args: any) { const getPerson = () => ({ name: faker.name.findName(), - subtitle: faker.internet.email(), + email: faker.internet.email(), avatar: faker.image.avatar(), selected: faker.random.boolean() }); From fa3eb28cd9acabb727662bec1e68d7a73d664111 Mon Sep 17 00:00:00 2001 From: Lewis Hankinson Date: Thu, 2 Nov 2023 12:38:35 +0000 Subject: [PATCH 2/4] Increase size of PersonSearch input --- lib/src/components/personSearch/PersonSearch.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/components/personSearch/PersonSearch.tsx b/lib/src/components/personSearch/PersonSearch.tsx index f760f5235..cf42c5313 100644 --- a/lib/src/components/personSearch/PersonSearch.tsx +++ b/lib/src/components/personSearch/PersonSearch.tsx @@ -33,6 +33,7 @@ export function PersonSearch({ onBlur={() => (showContent ? null : toggleShowContent(true))} onChange={(e: any) => setSearchValue(e.target.value)} value={searchValue} + size="md" /> )} From 4ef38201a2b4f920a7d130fdb49bc13356d9bd98 Mon Sep 17 00:00:00 2001 From: Lewis Hankinson Date: Thu, 2 Nov 2023 12:42:26 +0000 Subject: [PATCH 3/4] Replace size string value with component prop value --- lib/src/components/personSearch/PersonSearch.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/components/personSearch/PersonSearch.tsx b/lib/src/components/personSearch/PersonSearch.tsx index cf42c5313..ad536808c 100644 --- a/lib/src/components/personSearch/PersonSearch.tsx +++ b/lib/src/components/personSearch/PersonSearch.tsx @@ -33,7 +33,7 @@ export function PersonSearch({ onBlur={() => (showContent ? null : toggleShowContent(true))} onChange={(e: any) => setSearchValue(e.target.value)} value={searchValue} - size="md" + size={Input.sizes.md} /> )} From 32ee601850ab00e75d1496a4af3a28f1b9745221 Mon Sep 17 00:00:00 2001 From: TimBryanDev Date: Thu, 2 Nov 2023 13:23:35 +0000 Subject: [PATCH 4/4] :label: prevent collision with native HTML input `size` property --- lib/src/modules/input/Input.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/src/modules/input/Input.tsx b/lib/src/modules/input/Input.tsx index 3ff13195a..a0e899d96 100644 --- a/lib/src/modules/input/Input.tsx +++ b/lib/src/modules/input/Input.tsx @@ -2,11 +2,18 @@ import * as React from "react"; import cx from "classnames"; import { InputHelper } from "./InputHelper"; -interface Props extends React.InputHTMLAttributes { +const sizes = { + md: "md", + sm: "sm", +} as const; + +interface Props + extends Omit, "size"> { valid?: boolean; invalid?: boolean; enhanceNativeSupport?: boolean; inputRef?: React.RefObject; + size?: (typeof sizes)[keyof typeof sizes]; } export function Input({ @@ -51,10 +58,4 @@ export function Input({ } Input.Helper = InputHelper; - -const sizes = { - md: "md", - sm: "sm", -}; - Input.sizes = sizes;