diff --git a/src/components/form/input/input.scss b/src/components/form/input/input.scss index afe117f1..e4c1d9fe 100644 --- a/src/components/form/input/input.scss +++ b/src/components/form/input/input.scss @@ -56,4 +56,8 @@ &[type="file"] { border: none; } + + &--variant-transparent { + background-color: transparent; + } } diff --git a/src/components/form/input/input.stories.tsx b/src/components/form/input/input.stories.tsx index b0b44606..261b8364 100644 --- a/src/components/form/input/input.stories.tsx +++ b/src/components/form/input/input.stories.tsx @@ -5,6 +5,7 @@ import { Formik } from "formik"; import React from "react"; import { Button } from "../../button"; +import { Page } from "../../page"; import { FORM_TEST_DECORATOR } from "../.storybook/decorators"; import { Input } from "./input"; @@ -168,6 +169,24 @@ export const InputWithCustomSize: Story = { decorators: [FORM_TEST_DECORATOR], }; +export const TransparentInput: Story = { + args: { + name: "input", + placeholder: "e.g. John Doe", + type: "text", + variant: "transparent", + }, + argTypes: FORM_TEST_ARG_TYPES, + decorators: [ + FORM_TEST_DECORATOR, + (Story) => ( + + + + ), + ], +}; + export const UsageWithFormik: Story = { args: { name: "input", diff --git a/src/components/form/input/input.tsx b/src/components/form/input/input.tsx index a2ae981c..a17a010f 100644 --- a/src/components/form/input/input.tsx +++ b/src/components/form/input/input.tsx @@ -1,3 +1,4 @@ +import clsx from "clsx"; import React, { useEffect, useState } from "react"; import { eventFactory } from "../eventFactory"; @@ -7,6 +8,9 @@ export type InputProps = Omit< React.InputHTMLAttributes, "value" > & { + /** The variant (style) of the input. */ + variant?: "normal" | "transparent"; + /** Gets called when the value is changed */ onChange?: React.ChangeEventHandler; @@ -23,6 +27,7 @@ export type InputProps = Omit< export const Input: React.FC = ({ type = "text", value, + variant = "normal", onChange, ...props }) => { @@ -60,7 +65,7 @@ export const Input: React.FC = ({ return ( ( + + + + ), + ], +}; + export const UsageWithFormik: Story = { args: { options: [ diff --git a/src/components/form/select/select.tsx b/src/components/form/select/select.tsx index ede85af5..c4ba2ad1 100644 --- a/src/components/form/select/select.tsx +++ b/src/components/form/select/select.tsx @@ -51,6 +51,9 @@ export type SelectProps = React.HTMLAttributes & { size?: "fit-content"; value?: Option["value"] | null; + + /** The variant (style) of the input. */ + variant?: "normal" | "transparent"; } & SelectRequiredConditional; type SelectRequiredConditional = @@ -92,6 +95,7 @@ export const Select: React.FC = ({ required = false, size, value = null, + variant = "normal", ...props }) => { const fakeInputRef = React.useRef(null); @@ -179,7 +183,7 @@ export const Select: React.FC = ({ return ( <>
= ({ required={true} size="fit-content" value={pageSizeState} + variant="transparent" onChange={handlePageSizeChange} /> @@ -201,6 +202,7 @@ export const Paginator: React.FC = ({ size={String(pageCount).length} type="number" value={pageState} + variant="transparent" onChange={handlePageChange} >