From c5d131d05bae5b72a6c946612917e21a12d3eaea Mon Sep 17 00:00:00 2001 From: Connor Lanigan Date: Mon, 31 Jul 2023 14:10:17 +0000 Subject: [PATCH] chore: Expose component configuration in DOM metadata property --- src/button/index.tsx | 2 +- src/internal/hooks/use-base-component/index.ts | 4 ++-- src/select/index.tsx | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/button/index.tsx b/src/button/index.tsx index d43fe1c56e..aad41f3a32 100644 --- a/src/button/index.tsx +++ b/src/button/index.tsx @@ -39,7 +39,7 @@ const Button = React.forwardRef( }: ButtonProps, ref: React.Ref ) => { - const baseComponentProps = useBaseComponent('Button'); + const baseComponentProps = useBaseComponent('Button', { variant, disabled, loading }); const baseProps = getBaseProps(props); return ( (componentName: string) { +export default function useBaseComponent(componentName: string, componentConfiguration?: Record) { useTelemetry(componentName); useFocusVisible(); - const elementRef = useComponentMetadata(componentName, PACKAGE_VERSION); + const elementRef = useComponentMetadata(componentName, PACKAGE_VERSION, componentConfiguration); return { __internalRootRef: elementRef }; } diff --git a/src/select/index.tsx b/src/select/index.tsx index ce87bf7240..d854d88cc3 100644 --- a/src/select/index.tsx +++ b/src/select/index.tsx @@ -20,7 +20,10 @@ const Select = React.forwardRef( }: SelectProps, ref: React.Ref ) => { - const baseComponentProps = useBaseComponent('Select'); + const baseComponentProps = useBaseComponent('Select', { + placeholder: restProps.placeholder, + disabled: restProps.disabled, + }); const externalProps = getExternalProps(restProps); return (