From 76cd29ab2cd590fabd36539c8258608ef6ab673d Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Wed, 22 May 2024 15:56:41 -0500 Subject: [PATCH 1/5] feat(Intput): increment/decrement reset buttons focus stylings --- .changeset/wise-suns-serve.md | 5 ++++ .../components/input/src/DecrementButton.tsx | 13 +++++++++- .../components/input/src/IncrementButton.tsx | 13 +++++++++- .../paste-core/components/input/src/Input.tsx | 2 ++ .../input/stories/input.stories.tsx | 26 +++++++++++++++++++ 5 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 .changeset/wise-suns-serve.md diff --git a/.changeset/wise-suns-serve.md b/.changeset/wise-suns-serve.md new file mode 100644 index 0000000000..3812dfefa5 --- /dev/null +++ b/.changeset/wise-suns-serve.md @@ -0,0 +1,5 @@ +--- +"@twilio-paste/input": patch +--- + +[Input] updated focus stylings on increment/decrement buttons for number input type on both default and inverse variants diff --git a/packages/paste-core/components/input/src/DecrementButton.tsx b/packages/paste-core/components/input/src/DecrementButton.tsx index 50b53e6e8c..d256369d0f 100644 --- a/packages/paste-core/components/input/src/DecrementButton.tsx +++ b/packages/paste-core/components/input/src/DecrementButton.tsx @@ -3,12 +3,14 @@ import { Button, type ButtonProps } from "@twilio-paste/button"; import { ChevronDownIcon } from "@twilio-paste/icons/esm/ChevronDownIcon"; import type { HTMLPasteProps } from "@twilio-paste/types"; import * as React from "react"; +import { InputVariants } from "./Input"; export interface DecrementButtonProps extends HTMLPasteProps<"button"> { i18nStepDownLabel?: string; element?: BoxProps["element"]; // Button component restricts tabIndex values tabIndex?: ButtonProps["tabIndex"]; + variant?: InputVariants; } export const DecrementButton = React.forwardRef( @@ -22,8 +24,17 @@ export const DecrementButton = React.forwardRef { i18nStepUpLabel?: string; element?: BoxProps["element"]; // Button component restricts tabIndex values tabIndex?: ButtonProps["tabIndex"]; + variant?: InputVariants; } export const IncrementButton = React.forwardRef( @@ -22,8 +24,17 @@ export const IncrementButton = React.forwardRef ( internalRef.current?.focus(); }} i18nStepUpLabel={i18nStepUpLabel} + variant={variant} /> ) : ( @@ -347,6 +348,7 @@ const Input = React.forwardRef( internalRef.current?.focus(); }} i18nStepDownLabel={i18nStepDownLabel} + variant={variant} /> ) : ( diff --git a/packages/paste-core/components/input/stories/input.stories.tsx b/packages/paste-core/components/input/stories/input.stories.tsx index 57b6e2f10c..cbe1bcbe89 100644 --- a/packages/paste-core/components/input/stories/input.stories.tsx +++ b/packages/paste-core/components/input/stories/input.stories.tsx @@ -713,6 +713,32 @@ export const DefaultNumberInput = (): React.ReactNode => { DefaultNumberInput.storyName = "Number Input - Controlled"; +export const DefaultNumberInverseInput = (): React.ReactNode => { + const uid = useUID(); + const [value, setValue] = React.useState("0"); + return ( + + + { + setValue(event.target.value); + }} + variant="inverse" + /> + + ); +}; + +DefaultNumberInverseInput.storyName = "Number Input - Inverse Controlled"; + export const TestNumberInput = (): React.ReactNode => { const uid = useUID(); const [value, setValue] = React.useState("5"); From 39ba2a7e7e346b06ccdba46be31b46c3b6d6368b Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Wed, 22 May 2024 16:21:34 -0500 Subject: [PATCH 2/5] feat(Input): updating the changeset to include core patch --- .changeset/wise-suns-serve.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.changeset/wise-suns-serve.md b/.changeset/wise-suns-serve.md index 3812dfefa5..e208741aab 100644 --- a/.changeset/wise-suns-serve.md +++ b/.changeset/wise-suns-serve.md @@ -1,5 +1,6 @@ --- "@twilio-paste/input": patch +"@twilio-paste/core": patch --- [Input] updated focus stylings on increment/decrement buttons for number input type on both default and inverse variants From 520967f16178cb8564994e99aec7e9777ad3433f Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Wed, 22 May 2024 16:31:19 -0500 Subject: [PATCH 3/5] feat(Input): lint fix --- packages/paste-core/components/input/src/DecrementButton.tsx | 1 + packages/paste-core/components/input/src/IncrementButton.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/paste-core/components/input/src/DecrementButton.tsx b/packages/paste-core/components/input/src/DecrementButton.tsx index d256369d0f..3f04843550 100644 --- a/packages/paste-core/components/input/src/DecrementButton.tsx +++ b/packages/paste-core/components/input/src/DecrementButton.tsx @@ -3,6 +3,7 @@ import { Button, type ButtonProps } from "@twilio-paste/button"; import { ChevronDownIcon } from "@twilio-paste/icons/esm/ChevronDownIcon"; import type { HTMLPasteProps } from "@twilio-paste/types"; import * as React from "react"; + import { InputVariants } from "./Input"; export interface DecrementButtonProps extends HTMLPasteProps<"button"> { diff --git a/packages/paste-core/components/input/src/IncrementButton.tsx b/packages/paste-core/components/input/src/IncrementButton.tsx index ba21e35910..0df628652f 100644 --- a/packages/paste-core/components/input/src/IncrementButton.tsx +++ b/packages/paste-core/components/input/src/IncrementButton.tsx @@ -3,6 +3,7 @@ import { Button, type ButtonProps } from "@twilio-paste/button"; import { ChevronUpIcon } from "@twilio-paste/icons/esm/ChevronUpIcon"; import type { HTMLPasteProps } from "@twilio-paste/types"; import * as React from "react"; + import { InputVariants } from "./Input"; export interface IncrementButtonProps extends HTMLPasteProps<"button"> { From 9cf682c2e04e3da82d1c71cd5faee272830e4d18 Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Thu, 23 May 2024 09:02:56 -0500 Subject: [PATCH 4/5] feat(Input): destructure prop --- .../paste-core/components/input/src/DecrementButton.tsx | 6 +++--- .../paste-core/components/input/src/IncrementButton.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/paste-core/components/input/src/DecrementButton.tsx b/packages/paste-core/components/input/src/DecrementButton.tsx index 3f04843550..bca0241dbc 100644 --- a/packages/paste-core/components/input/src/DecrementButton.tsx +++ b/packages/paste-core/components/input/src/DecrementButton.tsx @@ -15,7 +15,7 @@ export interface DecrementButtonProps extends HTMLPasteProps<"button"> { } export const DecrementButton = React.forwardRef( - ({ i18nStepDownLabel = "step value down", element, ...props }, ref) => { + ({ i18nStepDownLabel = "step value down", element, variant, ...props }, ref) => { return (