From 9590fe7e4256a141952441c9329d2f1a5b81887e Mon Sep 17 00:00:00 2001 From: April Smith Date: Thu, 17 Oct 2024 17:43:22 +0100 Subject: [PATCH 1/4] Update the icons to use currentColor --- src/core/icons/icon-display-chat-mono.svg | 4 ++-- .../icons/icon-display-data-broadcast-mono.svg | 6 +++--- .../icons/icon-display-equalisers-mono.svg | 18 +++++++++--------- .../icon-display-push-notifications-mono.svg | 6 +++--- .../icons/icon-display-support-chat-mono.svg | 10 +++++----- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/core/icons/icon-display-chat-mono.svg b/src/core/icons/icon-display-chat-mono.svg index 7ec0c60ff..970ce11d4 100644 --- a/src/core/icons/icon-display-chat-mono.svg +++ b/src/core/icons/icon-display-chat-mono.svg @@ -1,4 +1,4 @@ - - + + diff --git a/src/core/icons/icon-display-data-broadcast-mono.svg b/src/core/icons/icon-display-data-broadcast-mono.svg index 22167e4cb..c105832ee 100644 --- a/src/core/icons/icon-display-data-broadcast-mono.svg +++ b/src/core/icons/icon-display-data-broadcast-mono.svg @@ -1,5 +1,5 @@ - - - + + + \ No newline at end of file diff --git a/src/core/icons/icon-display-equalisers-mono.svg b/src/core/icons/icon-display-equalisers-mono.svg index b51923992..067704593 100644 --- a/src/core/icons/icon-display-equalisers-mono.svg +++ b/src/core/icons/icon-display-equalisers-mono.svg @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/core/icons/icon-display-push-notifications-mono.svg b/src/core/icons/icon-display-push-notifications-mono.svg index 73f681aa1..abfabe925 100644 --- a/src/core/icons/icon-display-push-notifications-mono.svg +++ b/src/core/icons/icon-display-push-notifications-mono.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/src/core/icons/icon-display-support-chat-mono.svg b/src/core/icons/icon-display-support-chat-mono.svg index 2473b8438..878205553 100644 --- a/src/core/icons/icon-display-support-chat-mono.svg +++ b/src/core/icons/icon-display-support-chat-mono.svg @@ -1,7 +1,7 @@ - - - - - + + + + + From 91a554b787e4f3780bfbe8841dd3c710b495cc35 Mon Sep 17 00:00:00 2001 From: April Smith Date: Thu, 17 Oct 2024 16:12:01 +0100 Subject: [PATCH 2/4] Add onClick function in the AccordionData and add Story component --- package.json | 2 +- src/core/Accordion.tsx | 5 ++++- src/core/Accordion/Accordion.stories.tsx | 20 ++++++++++++++++++++ src/core/Accordion/types.ts | 1 + 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4eb2866fa..e3a628176 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ably/ui", - "version": "14.7.4", + "version": "14.7.5", "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.", "repository": { "type": "git", diff --git a/src/core/Accordion.tsx b/src/core/Accordion.tsx index d13e31cb5..cdba5ed50 100644 --- a/src/core/Accordion.tsx +++ b/src/core/Accordion.tsx @@ -203,7 +203,10 @@ const Accordion = ({ name={item.name} rowIcon={item.icon} open={fullyOpen ?? openIndexes.includes(currentIndex)} - onClick={() => handleSetIndex(currentIndex)} + onClick={() => { + handleSetIndex(currentIndex); + item.onClick?.(currentIndex); + }} toggleIcons={icons} theme={theme} options={options} diff --git a/src/core/Accordion/Accordion.stories.tsx b/src/core/Accordion/Accordion.stories.tsx index 8c8f7e240..ff552e41f 100644 --- a/src/core/Accordion/Accordion.stories.tsx +++ b/src/core/Accordion/Accordion.stories.tsx @@ -43,6 +43,11 @@ const longData = data.map((datum) => ({ ), })); +const dataWithCustomClickable = data.map((datum) => ({ + ...datum, + onClick: () => alert(`Custom onClick for ${datum.name} section`), +})); + const AccordionPresentation = ({ data, options }: AccordionProps) => (
{accordionThemes @@ -204,3 +209,18 @@ export const StaticAndFullyOpen = { }, }, }; + +export const WithCustomOnClick = { + render: () => + AccordionPresentation({ + data: dataWithCustomClickable, + }), + parameters: { + docs: { + description: { + story: + "When you set an onClick entry, it will be called when the section is clicked. It will add an additional action to be performed apart from the open/close behavior.", + }, + }, + }, +}; diff --git a/src/core/Accordion/types.ts b/src/core/Accordion/types.ts index 9d19b420c..21601d457 100644 --- a/src/core/Accordion/types.ts +++ b/src/core/Accordion/types.ts @@ -6,6 +6,7 @@ export type AccordionData = { name: string; icon?: IconName; content: ReactNode; + onClick?: (index: number) => void; }; export type AccordionIcons = { From 8bff1e06a8260e18461674d1412e8905bdd09c23 Mon Sep 17 00:00:00 2001 From: April Smith Date: Wed, 23 Oct 2024 10:50:23 +0100 Subject: [PATCH 3/4] Publish v14.7.5-dev.91a554b --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e3a628176..463f15a28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ably/ui", - "version": "14.7.5", + "version": "14.7.5-dev.91a554b", "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.", "repository": { "type": "git", From 3c8dadfabc12ed5c422aa84e124f08d5cb70401a Mon Sep 17 00:00:00 2001 From: April Smith Date: Wed, 23 Oct 2024 10:56:18 +0100 Subject: [PATCH 4/4] Update package after pre-release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 463f15a28..e3a628176 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ably/ui", - "version": "14.7.5-dev.91a554b", + "version": "14.7.5", "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.", "repository": { "type": "git",