From a3d00afa0cc8b72002fa4a5c102a0813ad553d22 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Tue, 18 Apr 2023 15:53:36 -0400 Subject: [PATCH] feat: added full size chip option on autocomplete dropdown --- CHANGELOG.md | 6 +++++ package.json | 4 ++-- .../AutocompleteDropdownInput.stories.tsx | 23 +++++++++++++++++++ .../AutocompleteDropdownInput.tsx | 21 +++++++++++++---- src/components/DropdownInput/index.css | 4 ++++ 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03ed2cf..a5098ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [10.3.0] 2023-04-18 + +### Changes + +- Added option to have a full size chip with `AutocompleteDropdownInput` + ## [10.2.0] 2023-04-18 ### Changes diff --git a/package.json b/package.json index 35d240d..d0a3fca 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@perimetre/ui", "description": "A component library made by @perimetre", - "version": "10.2.0", + "version": "10.3.0", "repository": { "type": "git", "url": "git+https://github.com/perimetre/ui.git" @@ -161,4 +161,4 @@ "resolutions": { "@storybook/react/webpack": "^5" } -} \ No newline at end of file +} diff --git a/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.stories.tsx b/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.stories.tsx index 401f1e6..ea46bd7 100644 --- a/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.stories.tsx +++ b/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.stories.tsx @@ -68,3 +68,26 @@ const DropdownWithButtonsTemplate: Story = (props) => ( ); export const DropdownWithButtons = DropdownWithButtonsTemplate.bind({}); + +/** + * A story that displays an Autocomplete example + * + * @param props the story props + */ +const ChipsFullSizeTemplate: Story = (props) => ( + ({ + id: i, + label: `Option Option Option Option Option Option Option Option ${i + 1}` + }))} + /> +); + +export const ChipsFullSize = ChipsFullSizeTemplate.bind({}); +ChipsFullSize.args = { + chipFullSize: true +}; diff --git a/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.tsx b/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.tsx index 7b29500..5950e51 100644 --- a/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.tsx +++ b/src/components/AutocompleteDropdownInput/AutocompleteDropdownInput.tsx @@ -23,6 +23,10 @@ export type AutocompleteDropdownInputProps React.ReactNode; + /** + * Whether or not the chips should be full size + */ + chipFullSize?: boolean; }; /** @@ -44,6 +48,7 @@ export type AutocompleteDropdownInputProps({ // Hook settings @@ -63,6 +68,7 @@ export const AutocompleteDropdownInput = ) => { @@ -177,16 +183,23 @@ export const AutocompleteDropdownInput = ))} diff --git a/src/components/DropdownInput/index.css b/src/components/DropdownInput/index.css index 387bbbe..d0168ab 100644 --- a/src/components/DropdownInput/index.css +++ b/src/components/DropdownInput/index.css @@ -145,6 +145,10 @@ @apply mb-2 mr-2 pui-text-ellipsis; max-width: 220px; + + &.fullSize { + max-width: none; + } } /* The styling for a single selected option */