Skip to content

Commit

Permalink
Merge pull request #347 from nginformatica/chore/hermes-adjusts
Browse files Browse the repository at this point in the history
fix/adjust textfield character count position;
  • Loading branch information
renanponick authored May 3, 2024
2 parents 884b7de + fcaaa65 commit c0244b4
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flipper-ui",
"version": "0.31.5",
"version": "0.31.6",
"description": "",
"main": "dist/index.js",
"homepage": "https://flipper-ui.ngi.com.br/",
Expand Down
8 changes: 4 additions & 4 deletions src/core/data-display/data-table/rows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ export const StatefulRow = <D extends Data>({

return (
<>
{columns.map(column => (
{columns.map((column, i) => (
<TableCell
align={column.align}
key={column.title}
key={`${column.title}-${i}`}
style={column.cellStyle}>
{getCorrectViewMode(column, mode, isEditable(column))}
</TableCell>
Expand Down Expand Up @@ -237,11 +237,11 @@ export const NewRow = <D extends Data>({

return (
<TableRow data-testid='table-row'>
{columns.map(column => (
{columns.map((column, i) => (
<TableCell
style={column.cellStyle}
align={column.align}
key={column.title}>
key={`${column.title}-${i}`}>
{isEditable(column)
? renderEditMode(
column,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`AutoComplete should match snapshot 1`] = `
style="position: relative;"
>
<div
class="sc-dmyCSP kvMDoa"
class="sc-dmyCSP jvASYa"
>
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports[`DateTime should match snapshot 1`] = `
class="MuiInputBase-input MuiOutlinedInput-input makeStyles-outlinedInput-49 MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd"
role="date-picker"
type="text"
value="03042024"
value="03052024"
/>
<div
class="MuiInputAdornment-root MuiInputAdornment-positionEnd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`MaskField should match snapshot 1`] = `
<div>
<div
class="sc-dmyCSP kvMDoa"
class="sc-dmyCSP jvASYa"
>
<div
class="MuiFormControl-root MuiTextField-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`TextField should match snapshot 1`] = `
<div>
<div
class="sc-hLQSwg dhfXCV"
class="sc-hLQSwg gdgoxJ"
>
<div
class="MuiFormControl-root MuiTextField-root"
Expand Down
12 changes: 6 additions & 6 deletions src/core/inputs/text-field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ export const TextField = ({
? classes.outlinedMultiline
: ''
},
endAdornment: characters && (
<CharactersCount>
{otherProps.value?.toString().length}/
{otherProps.inputProps?.maxLength}
</CharactersCount>
),
...InputProps
}}
SelectProps={{
Expand All @@ -319,12 +325,6 @@ export const TextField = ({
{...otherProps}>
{options ? renderOptions(options, classes) : children}
</MuiTextField>
{characters && (
<CharactersCount>
{otherProps.value?.toString().length}/
{otherProps.inputProps?.maxLength}
</CharactersCount>
)}
{onHelperClick && (
<HelperBox
helperIcon={helperIcon}
Expand Down
5 changes: 2 additions & 3 deletions src/core/inputs/text-field/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export const Helper = styled.div`
`

export const TextFieldWrapper = styled.div`
width: 100%;
display: flex;
flex-direction: rows;
width: 100%;
align-items: center;
button {
display: none;
Expand All @@ -24,14 +24,13 @@ export const TextFieldWrapper = styled.div`
`

export const StaticTextFieldWrapper = styled.div`
width: 100%;
display: flex;
flex-direction: rows;
width: 100%;
align-items: center;
`

export const CharactersCount = styled.span`
margin-left: -35px;
color: ${grays.g3};
font-size: 14px;
font-family:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { Autocomplete as AutocompleteLab } from '@material-ui/lab'
import type { Meta } from '@storybook/react'
import { default as AutoComplete } from '@/core/inputs/auto-complete'
import { TextField } from '@/core/inputs/text-field'
import { Autocomplete as AutocompleteLab } from '.'

export default {
title: 'Experimental/AutoCompleteLab',
Expand Down

0 comments on commit c0244b4

Please sign in to comment.