Skip to content
Snippets Groups Projects
Unverified Commit d41e45cb authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Add extended color pickers (#22880)

parent 73fac018
No related branches found
No related tags found
No related merge requests found
export { default } from "./ColorSelector";
......@@ -19,7 +19,7 @@ const TIME_FORMAT_24 = "HH:mm";
export type DateInputAttributes = Omit<
InputHTMLAttributes<HTMLDivElement>,
"value" | "onChange"
"size" | "value" | "onChange"
>;
export interface DateInputProps extends DateInputAttributes {
......
......@@ -2,8 +2,10 @@ import styled from "@emotion/styled";
import { css } from "@emotion/react";
import { color, darken } from "metabase/lib/colors";
import IconButtonWrapper from "metabase/components/IconButtonWrapper";
import { InputSize } from "./types";
export interface InputProps {
fieldSize?: InputSize;
hasError?: boolean;
fullWidth?: boolean;
hasLeftIcon?: boolean;
......@@ -57,6 +59,13 @@ export const InputField = styled.input<InputProps>`
css`
padding-right: 2.25rem;
`};
${props =>
props.fieldSize === "small" &&
css`
font-size: 0.875rem;
padding: 0.4375rem 0.625rem;
`};
`;
export const InputButton = styled(IconButtonWrapper)`
......
......@@ -13,9 +13,16 @@ import {
InputRightButton,
InputRoot,
} from "./Input.styled";
import { InputSize } from "./types";
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
export type InputAttributes = Omit<
InputHTMLAttributes<HTMLInputElement>,
"size"
>;
export interface InputProps extends InputAttributes {
inputRef?: Ref<HTMLInputElement>;
size?: InputSize;
error?: boolean;
fullWidth?: boolean;
leftIcon?: string;
......@@ -31,6 +38,7 @@ const Input = forwardRef(function Input(
className,
style,
inputRef,
size = "medium",
error,
fullWidth,
leftIcon,
......@@ -53,6 +61,7 @@ const Input = forwardRef(function Input(
<InputField
{...props}
ref={inputRef}
fieldSize={size}
hasError={error}
fullWidth={fullWidth}
hasRightIcon={Boolean(rightIcon)}
......
export type InputSize = "small" | "medium";
......@@ -12,7 +12,7 @@ import Input from "metabase/core/components/Input";
export type NumericInputAttributes = Omit<
InputHTMLAttributes<HTMLDivElement>,
"value" | "onChange"
"value" | "size" | "onChange"
>;
export interface NumericInputProps extends NumericInputAttributes {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment