From 3fa0b0439c7dc49ffb2c4aff89e5a0f96aacf5e2 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 3 Jan 2019 16:46:47 +0100 Subject: Add forms --- packages/forms/src/input/styles.ts | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 packages/forms/src/input/styles.ts (limited to 'packages/forms/src/input/styles.ts') diff --git a/packages/forms/src/input/styles.ts b/packages/forms/src/input/styles.ts new file mode 100644 index 000000000..46c0ef701 --- /dev/null +++ b/packages/forms/src/input/styles.ts @@ -0,0 +1,98 @@ +import * as CSS from 'csstype'; +import { Theme } from '../../../theme/lib'; + +const prefixStyles = (theme: Theme) => ({ + background: theme.inputPrefixBackground, + color: theme.inputPrefixColor, + lineHeight: theme.inputHeight, + padding: '0 10px', +}); + +export default (theme: Theme) => ({ + container: { + // display: 'flex', + }, + disabled: { + opacity: theme.inputDisabledOpacity, + }, + formModifier: { + background: 'none', + border: 0, + borderLeft: theme.inputBorder, + padding: '4px 20px 0', + outline: 'none', + + '&:active': { + opacity: 0.5, + }, + + '& svg': { + fill: theme.inputModifierColor, + }, + }, + input: { + background: 'none', + border: 0, + fontSize: theme.inputFontSize, + outline: 'none', + padding: 8, + width: '100%', + color: theme.inputColor, + + '&::placeholder': { + color: theme.inputPlaceholderColor, + }, + }, + passwordScore: { + background: theme.inputScorePasswordBackground, + border: theme.inputBorder, + borderTopWidth: 0, + borderBottomLeftRadius: theme.borderRadiusSmall, + borderBottomRightRadius: theme.borderRadiusSmall, + display: 'block', + flexBasis: '100%', + height: 5, + overflow: 'hidden', + + '& meter': { + display: 'block', + height: '100%', + width: '100%', + + '&::-webkit-meter-bar': { + background: 'none', + }, + + '&::-webkit-meter-even-less-good-value': { + background: theme.brandDanger, + }, + + '&::-webkit-meter-suboptimum-value': { + background: theme.brandWarning, + }, + + '&::-webkit-meter-optimum-value': { + background: theme.brandSuccess, + }, + }, + }, + prefix: prefixStyles(theme), + suffix: prefixStyles(theme), + wrapper: { + background: theme.inputBackground, + border: theme.inputBorder, + borderRadius: theme.borderRadiusSmall, + boxSizing: 'border-box' as CSS.BoxSizingProperty, + display: 'flex', + height: theme.inputHeight, + order: 1, + width: '100%', + }, + hasPasswordScore: { + borderBottomLeftRadius: 0, + borderBottomRightRadius: 0, + }, + hasError: { + borderColor: theme.brandDanger, + }, +}); -- cgit v1.2.3-70-g09d2