// SPDX-License-Identifier: MIT // Copyright (c) 2022 The Pybricks Authors import { Classes, Icon, IconName, IconSize, Spinner } from '@blueprintjs/core'; import { mergeRefs, useId } from '@react-aria/utils'; import classNames from 'classnames'; import React, { useRef } from 'react'; import { FocusRing, useButton } from 'react-aria'; type ButtonProps = { /** The label for the button. */ label: string; /** If true, the label will not be visible (will use aria-label instead). */ hideLabel?: boolean; /** A description of what the button does (not displayed - read by screen reader). */ description?: string; /** When true, the contents of the button will be replaced with a {@link Spinner}. */ loading?: boolean; /** When true, the button will use the {@link Classes.MINIMAL} style. */ minimal?: boolean; /** Icon that will be displayed to the left of the button content. */ icon: IconName; /** A reference to the underlying {/* This can't be inside the button element, otherwise it messes up the styling */} {description && ( )} ); };