From 79255fa656e94a91d414a32d7161fc81414fe3bd Mon Sep 17 00:00:00 2001 From: bitpshr Date: Mon, 3 May 2021 12:48:10 -0400 Subject: [PATCH 1/3] fix: chip typeahead value placement --- src/text-input/index.tsx | 11 ++++++++++- src/theme/dojo/chip-typeahead.m.css | 2 -- src/theme/material/chip-typeahead.m.css | 2 -- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/text-input/index.tsx b/src/text-input/index.tsx index fde3099d16..396443a605 100644 --- a/src/text-input/index.tsx +++ b/src/text-input/index.tsx @@ -8,6 +8,7 @@ import { formatAriaProperties } from '../common/util'; import HelperText from '../helper-text/index'; import Label from '../label/index'; import * as css from '../theme/default/text-input.m.css'; +import { isArray } from 'util'; export type TextInputType = | 'text' @@ -226,6 +227,11 @@ export const TextInput = factory(function TextInput({ const inputFocused = focus.isFocused('input'); const autofilled = Boolean(icache.get('autofilled')); + let leadingElements; + if (leading) { + leadingElements = isArray(leading) ? leading : [leading]; + } + return (
- {leading && {leading}} + {leadingElements && + leadingElements.map((leadingElement) => ( + {leadingElement} + ))} Date: Mon, 3 May 2021 13:55:57 -0400 Subject: [PATCH 2/3] fix: use virtual to wrap chips --- src/text-input/index.tsx | 11 +++++++---- src/text-input/tests/unit/TextInput.spec.tsx | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/text-input/index.tsx b/src/text-input/index.tsx index 396443a605..a4f4e07f5d 100644 --- a/src/text-input/index.tsx +++ b/src/text-input/index.tsx @@ -275,10 +275,13 @@ export const TextInput = factory(function TextInput({ ]} role="presentation" > - {leadingElements && - leadingElements.map((leadingElement) => ( - {leadingElement} - ))} + {leadingElements && ( + + {leadingElements.map((leadingElement) => ( + {leadingElement} + ))} + + )} A; + const leading = ( + + A + + ); const leadingTemplate = baseAssertion .setProperty('@wrapper', 'classes', [ css.wrapper, From ef0788c4cfd06354c601ab737e87badd678b1c6a Mon Sep 17 00:00:00 2001 From: bitpshr Date: Tue, 18 May 2021 11:13:29 -0400 Subject: [PATCH 3/3] feedback: Array.isArray --- src/text-input/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/text-input/index.tsx b/src/text-input/index.tsx index a4f4e07f5d..2a9f955165 100644 --- a/src/text-input/index.tsx +++ b/src/text-input/index.tsx @@ -8,7 +8,6 @@ import { formatAriaProperties } from '../common/util'; import HelperText from '../helper-text/index'; import Label from '../label/index'; import * as css from '../theme/default/text-input.m.css'; -import { isArray } from 'util'; export type TextInputType = | 'text' @@ -229,7 +228,7 @@ export const TextInput = factory(function TextInput({ let leadingElements; if (leading) { - leadingElements = isArray(leading) ? leading : [leading]; + leadingElements = Array.isArray(leading) ? leading : [leading]; } return (