@moises.ai/design-system 4.17.7 → 4.17.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from 'react'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
|
+
import { Spinner } from '@radix-ui/themes'
|
|
3
4
|
import { LockIcon } from '../../icons'
|
|
4
5
|
import styles from './InstrumentSelect.module.css'
|
|
5
6
|
|
|
@@ -22,7 +23,8 @@ import styles from './InstrumentSelect.module.css'
|
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Individual instrument card with five visual states (default, hover, checked, disabled,
|
|
25
|
-
* disabled-checked).
|
|
26
|
+
* disabled-checked). In the `disabled-checked` state (selected but non-interactive) a spinner
|
|
27
|
+
* replaces the icon to signal an in-progress action.
|
|
26
28
|
*
|
|
27
29
|
* Native `<button>` with `aria-pressed` for selection (works for both single and multi-select)
|
|
28
30
|
* and `aria-disabled` for locked/disabled items. The HTML `disabled` attribute is intentionally
|
|
@@ -63,6 +65,8 @@ export const InstrumentSelectCard = forwardRef(function InstrumentSelectCard(
|
|
|
63
65
|
? 'checked'
|
|
64
66
|
: 'default')
|
|
65
67
|
|
|
68
|
+
const showSpinner = computedState === 'disabled-checked'
|
|
69
|
+
|
|
66
70
|
const renderIcon = () => {
|
|
67
71
|
if (!Icon) return null
|
|
68
72
|
if (typeof Icon === 'function') {
|
|
@@ -84,7 +88,11 @@ export const InstrumentSelectCard = forwardRef(function InstrumentSelectCard(
|
|
|
84
88
|
className={classNames(styles.card, className)}
|
|
85
89
|
{...props}
|
|
86
90
|
>
|
|
87
|
-
{Icon &&
|
|
91
|
+
{(Icon || showSpinner) && (
|
|
92
|
+
<>
|
|
93
|
+
{showSpinner ? <Spinner size="2" state='1'/> : <span className={styles.cardIcon}> {renderIcon()} </span>}
|
|
94
|
+
</>
|
|
95
|
+
)}
|
|
88
96
|
{text != null && <span className={styles.cardText}>{text}</span>}
|
|
89
97
|
{locked && <LockIcon width={12} height={12} className={styles.lockIcon} />}
|
|
90
98
|
</button>
|