From 24ecc41fefd52bdd15a49ab0d3b0e335d0d9c0d1 Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Mon, 3 Jun 2024 14:56:57 -0400 Subject: [PATCH] Add default accName to `spinner` --- packages/react/src/Spinner/Spinner.tsx | 44 +++++++++++++++----------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/packages/react/src/Spinner/Spinner.tsx b/packages/react/src/Spinner/Spinner.tsx index 52fe378508f..2562bc62e29 100644 --- a/packages/react/src/Spinner/Spinner.tsx +++ b/packages/react/src/Spinner/Spinner.tsx @@ -3,6 +3,8 @@ import styled from 'styled-components' import type {SxProp} from '../sx' import sx from '../sx' import type {ComponentProps} from '../utils/types' +import Box from '../Box' +import VisuallyHidden from '../_VisuallyHidden' const sizeMap = { small: '16px', @@ -13,30 +15,34 @@ const sizeMap = { export interface SpinnerInternalProps { /** Sets the width and height of the spinner. */ size?: keyof typeof sizeMap + 'aria-label'?: string } -function Spinner({size: sizeKey = 'medium', ...props}: SpinnerInternalProps) { +function Spinner({size: sizeKey = 'medium', 'aria-label': ariaLabel, ...props}: SpinnerInternalProps) { const size = sizeMap[sizeKey] return ( - - - - + + + + + + {!ariaLabel ? Loading : null} + ) }