Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix TextField error when responsive size prop passed #936

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions packages/vibrant-components/src/lib/FieldLayout/FieldLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Box, PressableBox, Text } from '@vibrant-ui/core';
import { Icon } from '@vibrant-ui/icons';
import { Transition } from '@vibrant-ui/motion';
import { Body } from '../Body';
import { VStack } from '../VStack';
import { withFieldLayoutVariation } from './FieldLayoutProps';

Expand Down Expand Up @@ -34,8 +33,8 @@ export const FieldLayout = withFieldLayoutVariation(
prefixText,
suffixText,
testId = 'field-layout',
bodyLevel,
helperTextBodyLevel,
typography,
helperTextTypography,
helperTextSpacing,
height,
spacing,
Expand Down Expand Up @@ -72,8 +71,8 @@ export const FieldLayout = withFieldLayoutVariation(
</Transition>
</PressableBox>
<Box flexDirection="row" alignItems="baseline">
<Body
level={bodyLevel}
<Text
typography={typography}
color="onView2"
hidden={!prefixText || (!shrink && Boolean(label))}
flexShrink={0}
Expand All @@ -82,12 +81,12 @@ export const FieldLayout = withFieldLayoutVariation(
pb={pb}
>
{prefixText}
</Body>
</Text>

{renderField({ height: height - 2, color: valueColor, pt, pl, pr, pb, typography: `body${bodyLevel}` })}
{renderField({ height: height - 2, color: valueColor, pt, pl, pr, pb, typography })}

<Body
level={bodyLevel}
<Text
typography={typography}
color="onView2"
hidden={!suffixText || (!shrink && Boolean(label))}
flexShrink={0}
Expand All @@ -96,7 +95,7 @@ export const FieldLayout = withFieldLayoutVariation(
pb={pb}
>
{suffixText}
</Body>
</Text>
</Box>
</Box>
{showClearButton && (
Expand All @@ -107,9 +106,9 @@ export const FieldLayout = withFieldLayoutVariation(
<VStack flexShrink={0}>{renderEnd?.()}</VStack>
</Box>
{Boolean(helperText) && (
<Body level={helperTextBodyLevel} color={helperTextColor}>
<Text typography={helperTextTypography} color={helperTextColor}>
{helperText}
</Body>
</Text>
)}
</VStack>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export const withFieldLayoutVariation = withVariation<FieldLayoutProps>('FieldLa
variants: {
lg: {
height: 50,
bodyLevel: 2,
helperTextBodyLevel: 4,
typography: 'body2',
helperTextTypography: 'body4',
helperTextSpacing: 4,
px: 15,
spacing: 12,
Expand All @@ -53,8 +53,8 @@ export const withFieldLayoutVariation = withVariation<FieldLayoutProps>('FieldLa
},
md: {
height: 38,
bodyLevel: 2,
helperTextBodyLevel: 4,
typography: 'body2',
helperTextTypography: 'body4',
helperTextSpacing: 4,
px: 9,
spacing: 8,
Expand All @@ -63,8 +63,8 @@ export const withFieldLayoutVariation = withVariation<FieldLayoutProps>('FieldLa
},
sm: {
height: 30,
bodyLevel: 4,
helperTextBodyLevel: 5,
typography: 'body4',
helperTextTypography: 'body5',
helperTextSpacing: 2,
px: 7,
spacing: 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,15 @@ exports[`<PasswordField /> when size is lg match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 23px;
padding-left: 15px;
padding-bottom: 7px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

.emotion-8 {
Expand Down Expand Up @@ -236,16 +235,15 @@ exports[`<PasswordField /> when size is lg match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 23px;
padding-right: 12px;
padding-bottom: 7px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

.emotion-11 {
Expand Down Expand Up @@ -336,7 +334,6 @@ exports[`<PasswordField /> when size is lg match snapshot 1`] = `
>
<span
class="emotion-7"
data-testid="body"
/>
<input
autocomplete="current-password"
Expand All @@ -348,7 +345,6 @@ exports[`<PasswordField /> when size is lg match snapshot 1`] = `
/>
<span
class="emotion-9"
data-testid="body"
/>
</div>
</div>
Expand Down Expand Up @@ -544,16 +540,15 @@ exports[`<PasswordField /> when size is md match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 15px;
padding-left: 9px;
padding-bottom: 3px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

.emotion-8 {
Expand Down Expand Up @@ -612,16 +607,15 @@ exports[`<PasswordField /> when size is md match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 15px;
padding-right: 8px;
padding-bottom: 3px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

.emotion-11 {
Expand Down Expand Up @@ -712,7 +706,6 @@ exports[`<PasswordField /> when size is md match snapshot 1`] = `
>
<span
class="emotion-7"
data-testid="body"
/>
<input
autocomplete="current-password"
Expand All @@ -724,7 +717,6 @@ exports[`<PasswordField /> when size is md match snapshot 1`] = `
/>
<span
class="emotion-9"
data-testid="body"
/>
</div>
</div>
Expand Down Expand Up @@ -920,16 +912,15 @@ exports[`<PasswordField /> when size is sm match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.75rem;
line-height: 1rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 12px;
padding-left: 7px;
padding-bottom: 0;
font-size: 0.75rem;
line-height: 1rem;
font-weight: 400;
}

.emotion-8 {
Expand Down Expand Up @@ -988,16 +979,15 @@ exports[`<PasswordField /> when size is sm match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.75rem;
line-height: 1rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 12px;
padding-right: 6px;
padding-bottom: 0;
font-size: 0.75rem;
line-height: 1rem;
font-weight: 400;
}

.emotion-11 {
Expand Down Expand Up @@ -1088,7 +1078,6 @@ exports[`<PasswordField /> when size is sm match snapshot 1`] = `
>
<span
class="emotion-7"
data-testid="body"
/>
<input
autocomplete="current-password"
Expand All @@ -1100,7 +1089,6 @@ exports[`<PasswordField /> when size is sm match snapshot 1`] = `
/>
<span
class="emotion-9"
data-testid="body"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,15 @@ exports[`<TableSearchField /> when maxWidth is default match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 9px;
padding-left: 8px;
padding-bottom: 9px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

.emotion-11 {
Expand Down Expand Up @@ -294,16 +293,15 @@ exports[`<TableSearchField /> when maxWidth is default match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 9px;
padding-right: 9px;
padding-bottom: 9px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

<div>
Expand Down Expand Up @@ -349,7 +347,6 @@ exports[`<TableSearchField /> when maxWidth is default match snapshot 1`] = `
>
<span
class="emotion-10"
data-testid="body"
/>
<input
autocapitalize="none"
Expand All @@ -361,7 +358,6 @@ exports[`<TableSearchField /> when maxWidth is default match snapshot 1`] = `
/>
<span
class="emotion-12"
data-testid="body"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,15 @@ exports[`<TableSearch /> when component is rendering match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 9px;
padding-left: 8px;
padding-bottom: 9px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

.emotion-12 {
Expand Down Expand Up @@ -321,16 +320,15 @@ exports[`<TableSearch /> when component is rendering match snapshot 1`] = `
color: #5b5b5b;
-webkit-text-fill-color: #5b5b5b;
text-fill-color: #5b5b5b;
font-size: 0.875rem;
line-height: 1.125rem;
display: none;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding-top: 9px;
padding-right: 9px;
padding-bottom: 9px;
font-size: 0.875rem;
line-height: 1.125rem;
font-weight: 400;
}

.emotion-15 {
Expand Down Expand Up @@ -539,7 +537,6 @@ exports[`<TableSearch /> when component is rendering match snapshot 1`] = `
>
<span
class="emotion-11"
data-testid="body"
/>
<input
autocapitalize="none"
Expand All @@ -551,7 +548,6 @@ exports[`<TableSearch /> when component is rendering match snapshot 1`] = `
/>
<span
class="emotion-13"
data-testid="body"
/>
</div>
</div>
Expand Down
Loading
Loading