diff --git a/.changeset/bright-drinks-run.md b/.changeset/bright-drinks-run.md new file mode 100644 index 00000000000..00d98993851 --- /dev/null +++ b/.changeset/bright-drinks-run.md @@ -0,0 +1,7 @@ +--- +"@chakra-ui/theme": minor +--- + +The `Input` component now supports "xs" size. This change affects all components +that extend from `Input`'s theme, such as `Select`, `PinInput`, `Textarea` or +`NumberInput`. diff --git a/packages/input/stories/input.stories.tsx b/packages/input/stories/input.stories.tsx index 147bb215134..a40992add48 100644 --- a/packages/input/stories/input.stories.tsx +++ b/packages/input/stories/input.stories.tsx @@ -50,7 +50,7 @@ export const Controlled = () => { export const WithSizes = () => ( - {["sm", "md", "lg"].map((size) => ( + {["xs", "sm", "md", "lg"].map((size) => ( ))} diff --git a/packages/input/tests/__snapshots__/input.test.tsx.snap b/packages/input/tests/__snapshots__/input.test.tsx.snap index a2458082e40..e27285554f0 100644 --- a/packages/input/tests/__snapshots__/input.test.tsx.snap +++ b/packages/input/tests/__snapshots__/input.test.tsx.snap @@ -16,8 +16,6 @@ exports[`Elements inside input render correctly 1`] = ` width: 2.5rem; height: 2.5rem; font-size: 1rem; - padding-left: 1rem; - padding-right: 1rem; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -101,8 +99,6 @@ exports[`Elements inside input render correctly 1`] = ` width: 2.5rem; height: 2.5rem; font-size: 1rem; - padding-left: 1rem; - padding-right: 1rem; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; diff --git a/packages/number-input/stories/number-input.stories.tsx b/packages/number-input/stories/number-input.stories.tsx index b4ffe89d302..68ba536b482 100644 --- a/packages/number-input/stories/number-input.stories.tsx +++ b/packages/number-input/stories/number-input.stories.tsx @@ -159,29 +159,15 @@ export const allowOutOfRange = () => ( export const inputSizes = () => ( - - - - - - - - - - - - - - - - - - - - - - - + {["xs", "sm", "md", "lg"].map((size) => ( + + + + + + + + ))} ) diff --git a/packages/number-input/tests/__snapshots__/number-input.test.tsx.snap b/packages/number-input/tests/__snapshots__/number-input.test.tsx.snap index e3c2cd906d1..063c53a6118 100644 --- a/packages/number-input/tests/__snapshots__/number-input.test.tsx.snap +++ b/packages/number-input/tests/__snapshots__/number-input.test.tsx.snap @@ -27,6 +27,7 @@ exports[`should render correctly 1`] = ` padding-right: 1rem; height: 2.5rem; border-radius: 0.375rem; + vertical-align: top; border: 1px solid; border-color: inherit; background: inherit; @@ -94,7 +95,7 @@ exports[`should render correctly 1`] = ` border-left: 1px solid; border-color: inherit; color: inherit; - font-size: 10px; + font-size: calc(1rem * 0.75); display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; diff --git a/packages/pin-input/stories/pin-input.stories.tsx b/packages/pin-input/stories/pin-input.stories.tsx index cbbc2e18039..dcd30344974 100644 --- a/packages/pin-input/stories/pin-input.stories.tsx +++ b/packages/pin-input/stories/pin-input.stories.tsx @@ -53,8 +53,8 @@ export function ComponentExample() { export const Sizes = () => ( <> - {["sm", "md", "lg"].map((size, i) => ( -
+ {["xs", "sm", "md", "lg"].map((size) => ( +
diff --git a/packages/select/src/select.tsx b/packages/select/src/select.tsx index 3a4be7d9f63..6bc39ccb0bc 100644 --- a/packages/select/src/select.tsx +++ b/packages/select/src/select.tsx @@ -182,11 +182,8 @@ const IconWrapper = chakra("div", { baseStyle: { position: "absolute", display: "inline-flex", - width: "1.5rem", - height: "100%", alignItems: "center", justifyContent: "center", - right: "0.5rem", pointerEvents: "none", top: "50%", transform: "translateY(-50%)", diff --git a/packages/select/stories/select.stories.tsx b/packages/select/stories/select.stories.tsx index d46aafe4ef8..792ce3c692f 100644 --- a/packages/select/stories/select.stories.tsx +++ b/packages/select/stories/select.stories.tsx @@ -67,9 +67,9 @@ export const SelectVariants = () => ( export const SelectSizes = () => ( - - + ))} ) @@ -103,9 +103,9 @@ const UpDownIcon = (props: any) => ( ) -export const SelectIcon = () => { - return } placeholder="Placeholder" size="md" /> +) export const FocusAndErrorColors = () => ( diff --git a/packages/textarea/stories/textarea.stories.tsx b/packages/textarea/stories/textarea.stories.tsx index a1ba3071185..96bef29fc65 100644 --- a/packages/textarea/stories/textarea.stories.tsx +++ b/packages/textarea/stories/textarea.stories.tsx @@ -1,6 +1,6 @@ +import { chakra } from "@chakra-ui/system" import * as React from "react" import { Textarea } from "../src" -import { chakra } from "@chakra-ui/system" export default { title: "Textarea", @@ -29,6 +29,11 @@ export const invalid = () => ( export const withSizes = () => ( <> +