Commit 9263c645 authored by tom's avatar tom

more smooth label transition on input focus, god damn safari

parent a9d1521a
...@@ -6,16 +6,15 @@ import type { Dict } from '@chakra-ui/utils'; ...@@ -6,16 +6,15 @@ import type { Dict } from '@chakra-ui/utils';
import getDefaultFormColors from '../utils/getDefaultFormColors'; import getDefaultFormColors from '../utils/getDefaultFormColors';
const getActiveLabelStyles = (theme: Dict, fc: string) => ({ const getActiveLabelStyles = (theme: Dict, fc: string) => ({
fontSize: '12px',
lineHeight: '15px',
top: '10px',
color: getColor(theme, fc), color: getColor(theme, fc),
transform: 'scale(0.75) translateY(-10px)',
}) })
const getActiveInputStyles = (theme: Dict, fc: string) => ({ const getActiveInputStyles = (theme: Dict, fc: string) => ({
paddingTop: '30px', paddingTop: '30px',
paddingBottom: '10px', paddingBottom: '10px',
borderColor: getColor(theme, fc), borderColor: getColor(theme, fc),
boxShadow: 'none',
}) })
const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionProps) => { const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionProps) => {
...@@ -38,18 +37,16 @@ const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionP ...@@ -38,18 +37,16 @@ const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionP
// label's styles // label's styles
label: { label: {
top: '20px', top: '20px',
left: 0, left: '20px',
zIndex: 2, zIndex: 2,
position: 'absolute', position: 'absolute',
color: mode('gray.500', 'whiteAlpha.400')(props), color: mode('gray.500', 'whiteAlpha.400')(props),
backgroundColor: 'transparent', backgroundColor: 'transparent',
pointerEvents: 'none', pointerEvents: 'none',
padding: '0 20px',
margin: 0, margin: 0,
transformOrigin: 'left top', transformOrigin: 'left top',
fontSize: '16px', fontSize: '16px',
lineHeight: '20px', lineHeight: '20px',
transitionProperty: 'top, font-size, line-height',
}, },
'input:not(:placeholder-shown) + label': { 'input:not(:placeholder-shown) + label': {
...activeLabelStyles, ...activeLabelStyles,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment