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/adjust textfield character count position; #347

Merged
merged 3 commits into from
May 3, 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
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
Loading