From 95d89a751a01c5dcf528fef6d7e5901a72a31f35 Mon Sep 17 00:00:00 2001 From: David Luzar <5153846+dwelle@users.noreply.github.com> Date: Thu, 15 May 2025 13:22:26 +0200 Subject: [PATCH] refactor: decouple radio button selection from `.buttonList` wrapper (#9528) * refactor: decouple radio button selection from `.buttonList` * fix --- .../components/ExampleApp.scss | 2 +- .../excalidraw/actions/actionProperties.tsx | 726 +++++++++--------- packages/excalidraw/components/Actions.tsx | 2 +- .../excalidraw/components/ButtonSelect.tsx | 30 - .../components/FontPicker/FontPicker.tsx | 16 +- ...uttonIconSelect.tsx => RadioSelection.tsx} | 7 +- packages/excalidraw/css/styles.scss | 14 +- 7 files changed, 393 insertions(+), 404 deletions(-) delete mode 100644 packages/excalidraw/components/ButtonSelect.tsx rename packages/excalidraw/components/{ButtonIconSelect.tsx => RadioSelection.tsx} (88%) diff --git a/examples/with-script-in-browser/components/ExampleApp.scss b/examples/with-script-in-browser/components/ExampleApp.scss index e41a77ccc..77b921ea8 100644 --- a/examples/with-script-in-browser/components/ExampleApp.scss +++ b/examples/with-script-in-browser/components/ExampleApp.scss @@ -52,7 +52,7 @@ transform: none; } -.excalidraw .panelColumn { +.excalidraw .selected-shape-actions { text-align: left; } diff --git a/packages/excalidraw/actions/actionProperties.tsx b/packages/excalidraw/actions/actionProperties.tsx index c379de7f8..654676e90 100644 --- a/packages/excalidraw/actions/actionProperties.tsx +++ b/packages/excalidraw/actions/actionProperties.tsx @@ -76,7 +76,7 @@ import type { Scene } from "@excalidraw/element"; import type { CaptureUpdateActionType } from "@excalidraw/element"; import { trackEvent } from "../analytics"; -import { ButtonIconSelect } from "../components/ButtonIconSelect"; +import { RadioSelection } from "../components/RadioSelection"; import { ColorPicker } from "../components/ColorPicker/ColorPicker"; import { FontPicker } from "../components/FontPicker/FontPicker"; import { IconPicker } from "../components/IconPicker"; @@ -421,50 +421,52 @@ export const actionChangeFillStyle = register({ return (
); }, @@ -488,38 +490,40 @@ export const actionChangeStrokeWidth = register({ PanelComponent: ({ elements, appState, updateData, app }) => ( ), }); @@ -543,35 +547,37 @@ export const actionChangeSloppiness = register({ PanelComponent: ({ elements, appState, updateData, app }) => ( ), }); @@ -594,35 +600,37 @@ export const actionChangeStrokeStyle = register({ PanelComponent: ({ elements, appState, updateData, app }) => ( ), }); @@ -661,63 +669,65 @@ export const actionChangeFontSize = register({ PanelComponent: ({ elements, appState, updateData, app }) => ( ), }); @@ -1189,52 +1199,54 @@ export const actionChangeTextAlign = register({ return ( ); }, @@ -1277,54 +1289,56 @@ export const actionChangeVerticalAlign = register({ PanelComponent: ({ elements, appState, updateData, app }) => { return ( ); }, @@ -1372,32 +1386,38 @@ export const actionChangeRoundness = register({ return ( ); }, @@ -1760,48 +1780,50 @@ export const actionChangeArrowType = register({ return ( ); }, diff --git a/packages/excalidraw/components/Actions.tsx b/packages/excalidraw/components/Actions.tsx index 4f3782048..60dab78f4 100644 --- a/packages/excalidraw/components/Actions.tsx +++ b/packages/excalidraw/components/Actions.tsx @@ -154,7 +154,7 @@ export const SelectedShapeActions = ({ !isSingleElementBoundContainer && alignActionsPredicate(appState, app); return ( -