From ea37465920c2b4d8c954ffad553c3136b126991a Mon Sep 17 00:00:00 2001 From: Georgina Date: Fri, 11 Jul 2025 17:37:07 -0400 Subject: [PATCH 1/4] fix draggableLine, use spinButton for numbers, use fileUploadLine from NME --- .../src/fluent/hoc/buttonLine.tsx | 29 ++++++---- .../src/fluent/hoc/fileUploadLine.tsx | 7 ++- .../src/fluent/hoc/propertyLine.tsx | 2 +- .../src/fluent/primitives/draggable.tsx | 54 ++++++++++++++++++ .../src/fluent/primitives/spinButton.tsx | 21 +++++-- .../src/lines/buttonLineComponent.tsx | 4 +- .../src/lines/draggableLineComponent.tsx | 45 +++++++-------- .../draggableLineWithButtonComponent.tsx | 55 ++++++++++--------- .../src/lines/fileButtonLineComponent.tsx | 3 +- .../src/lines/floatLineComponent.tsx | 26 ++++++++- .../src/lines/messageLineComponent.tsx | 16 +++++- 11 files changed, 190 insertions(+), 72 deletions(-) create mode 100644 packages/dev/sharedUiComponents/src/fluent/primitives/draggable.tsx diff --git a/packages/dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx b/packages/dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx index 7c361b796c6..cc0a65343ee 100644 --- a/packages/dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx +++ b/packages/dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx @@ -1,6 +1,7 @@ -import { Body1, Button, makeStyles, tokens } from "@fluentui/react-components"; +import { Body1, Button as FluentButton, makeStyles, tokens } from "@fluentui/react-components"; import { LineContainer } from "./propertyLine"; import type { FunctionComponent } from "react"; +import type { FluentIcon } from "@fluentui/react-icons"; const useButtonLineStyles = makeStyles({ button: { @@ -8,12 +9,11 @@ const useButtonLineStyles = makeStyles({ }, }); -export type ButtonLineProps = { - label: string; +export type ButtonProps = { onClick: () => void; + icon?: FluentIcon; + label: string; disabled?: boolean; - icon?: string; - title?: string; }; /** @@ -21,13 +21,22 @@ export type ButtonLineProps = { * @param props Button props plus a label * @returns A button inside a line */ -export const ButtonLine: FunctionComponent = (props) => { - const classes = useButtonLineStyles(); +export const ButtonLine: FunctionComponent = (props) => { return ( - + - + ); diff --git a/packages/dev/sharedUiComponents/src/lines/draggableLineComponent.tsx b/packages/dev/sharedUiComponents/src/lines/draggableLineComponent.tsx index c01985bb974..5e795fc1e52 100644 --- a/packages/dev/sharedUiComponents/src/lines/draggableLineComponent.tsx +++ b/packages/dev/sharedUiComponents/src/lines/draggableLineComponent.tsx @@ -3,7 +3,8 @@ import { ToolContext } from "../fluent/hoc/fluentToolWrapper"; import { DraggableLine } from "../fluent/primitives/draggable"; import type { DraggableLineProps } from "../fluent/primitives/draggable"; -export const DraggableLineComponent: React.FunctionComponent> = (props) => { +type DraggableLineComponentProps = Omit; +export const DraggableLineComponent: React.FunctionComponent = (props) => { const useFluent = useContext(ToolContext); if (useFluent) { // When updating the callsites to use fluent directly this label will be clearer since the string replace occurs where the Block_Foo lives where the Block name is diff --git a/packages/dev/sharedUiComponents/src/lines/draggableLineWithButtonComponent.tsx b/packages/dev/sharedUiComponents/src/lines/draggableLineWithButtonComponent.tsx index d96e0ef795f..1a33e14a25e 100644 --- a/packages/dev/sharedUiComponents/src/lines/draggableLineWithButtonComponent.tsx +++ b/packages/dev/sharedUiComponents/src/lines/draggableLineWithButtonComponent.tsx @@ -2,7 +2,7 @@ import { useContext } from "react"; import { ToolContext } from "../fluent/hoc/fluentToolWrapper"; import { DraggableLine } from "../fluent/primitives/draggable"; -export type DraggableLineProps = { +export type DraggableLineWithButtonProps = { format: string; data: string; tooltip: string; @@ -12,7 +12,7 @@ export type DraggableLineProps = { lenSuffixToRemove?: number; }; -export const DraggableLineWithButtonComponent: React.FunctionComponent = (props) => { +export const DraggableLineWithButtonComponent: React.FunctionComponent = (props) => { const useFluent = useContext(ToolContext); if (useFluent) { // When updating the callsites to use fluent directly this label will be clearer since the string replace occurs where the data string lives