colors
+disabled
++ {children} +
+ ); +} diff --git a/packages/taler-wallet-webextension/src/mui/input/FormLabel.tsx b/packages/taler-wallet-webextension/src/mui/input/FormLabel.tsx new file mode 100644 index 000000000..e5ca53263 --- /dev/null +++ b/packages/taler-wallet-webextension/src/mui/input/FormLabel.tsx @@ -0,0 +1,67 @@ +import { css } from "@linaria/core"; +import { ComponentChildren, h } from "preact"; +import { Colors, theme } from "../style"; +import { useFormControl } from "./FormControl"; + +export interface Props { + class?: string; + disabled?: boolean; + error?: boolean; + filled?: boolean; + focused?: boolean; + required?: boolean; + color?: Colors; + children?: ComponentChildren; +} + +const root = css` + color: ${theme.palette.text.secondary}; + line-height: 1.4375em; + padding: 0px; + position: relative; + &[data-focused] { + color: var(--color-main); + } + &[data-disabled] { + color: ${theme.palette.text.disabled}; + } + &[data-error] { + color: ${theme.palette.error.main}; + } +`; + +export function FormLabel({ + disabled, + error, + filled, + focused, + required, + color, + class: _class, + children, + ...rest +}: Props) { + const fcs = useFormControl({ + disabled, + error, + filled, + focused, + required, + color, + }); + return ( + + ); +} diff --git a/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx b/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx new file mode 100644 index 000000000..5714eb1ba --- /dev/null +++ b/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx @@ -0,0 +1,258 @@ +import { css } from "@linaria/core"; +import { h, JSX } from "preact"; +import { useEffect, useLayoutEffect, useState } from "preact/hooks"; +import { theme } from "../style"; +import { FormControlContext, useFormControl } from "./FormControl"; + +const rootStyle = css` + color: ${theme.palette.text.primary}; + line-height: 1.4375em; + box-sizing: border-box; + position: relative; + cursor: text; + display: inline-flex; + align-items: center; +`; +const rootDisabledStyle = css` + color: ${theme.palette.text.disabled}; + cursor: default; +`; +const rootMultilineStyle = css` + padding: 4px 0 5px; +`; +const fullWidthStyle = css` + width: "100%"; +`; + +export function InputBaseRoot({ + class: _class, + disabled, + error, + multiline, + focused, + fullWidth, + children, +}: any) { + const fcs = useFormControl({}); + return ( +