@moises.ai/design-system 4.17.6 → 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,6 +1,6 @@
1
1
  {
2
2
  "name": "@moises.ai/design-system",
3
- "version": "4.17.6",
3
+ "version": "4.17.8",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -94,6 +94,20 @@
94
94
  color: var(--neutral-alpha-5);
95
95
  }
96
96
 
97
+ .card[data-state='disabled-checked'] {
98
+ border-color: rgba(0, 220, 253, 0.20);
99
+ background: var(--neutral-alpha-2, rgba(216, 244, 246, 0.04));
100
+ cursor: default;
101
+ }
102
+
103
+ .card[data-state='disabled-checked'] .cardIcon {
104
+ color: rgba(0, 220, 253, 0.20);
105
+ }
106
+
107
+ .card[data-state='disabled-checked'] .cardText {
108
+ color: var(--neutral-alpha-6);
109
+ }
110
+
97
111
  /* ----- Card slots ----- */
98
112
 
99
113
  .cardIcon {
@@ -144,4 +158,4 @@
144
158
  transform: translateY(-50%);
145
159
  color: var(--neutral-alpha-5);
146
160
  pointer-events: none;
147
- }
161
+ }
@@ -187,6 +187,12 @@ export const CardStates = () => (
187
187
  state="disabled"
188
188
  locked
189
189
  />
190
+ <InstrumentSelectCard
191
+ value="vocals"
192
+ text="Disabled checked"
193
+ Icon={VocalIcon}
194
+ state="disabled-checked"
195
+ />
190
196
  </div>
191
197
  )
192
198
 
@@ -194,7 +200,7 @@ CardStates.parameters = {
194
200
  docs: {
195
201
  description: {
196
202
  story:
197
- 'The four visual states of `InstrumentSelectCard`: default, hover, checked, and disabled (locked).',
203
+ 'The five visual states of `InstrumentSelectCard`: default, hover, checked, disabled (locked), and disabled-checked (selected but non-interactive).',
198
204
  },
199
205
  },
200
206
  }
@@ -1,10 +1,11 @@
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
 
6
7
  /**
7
- * @typedef {'default' | 'hover' | 'checked' | 'disabled'} InstrumentSelectCardState
8
+ * @typedef {'default' | 'hover' | 'checked' | 'disabled' | 'disabled-checked'} InstrumentSelectCardState
8
9
  */
9
10
 
10
11
  /**
@@ -21,7 +22,9 @@ import styles from './InstrumentSelect.module.css'
21
22
  */
22
23
 
23
24
  /**
24
- * Individual instrument card with four visual states (default, hover, checked, disabled).
25
+ * Individual instrument card with five visual states (default, hover, checked, disabled,
26
+ * disabled-checked). In the `disabled-checked` state (selected but non-interactive) a spinner
27
+ * replaces the icon to signal an in-progress action.
25
28
  *
26
29
  * Native `<button>` with `aria-pressed` for selection (works for both single and multi-select)
27
30
  * and `aria-disabled` for locked/disabled items. The HTML `disabled` attribute is intentionally
@@ -52,7 +55,17 @@ export const InstrumentSelectCard = forwardRef(function InstrumentSelectCard(
52
55
  ref,
53
56
  ) {
54
57
  const isBlocked = locked || disabled
55
- const computedState = state ?? (isBlocked ? 'disabled' : selected ? 'checked' : 'default')
58
+ const computedState =
59
+ state ??
60
+ (isBlocked
61
+ ? selected
62
+ ? 'disabled-checked'
63
+ : 'disabled'
64
+ : selected
65
+ ? 'checked'
66
+ : 'default')
67
+
68
+ const showSpinner = computedState === 'disabled-checked'
56
69
 
57
70
  const renderIcon = () => {
58
71
  if (!Icon) return null
@@ -75,7 +88,11 @@ export const InstrumentSelectCard = forwardRef(function InstrumentSelectCard(
75
88
  className={classNames(styles.card, className)}
76
89
  {...props}
77
90
  >
78
- {Icon && <span className={styles.cardIcon}>{renderIcon()}</span>}
91
+ {(Icon || showSpinner) && (
92
+ <>
93
+ {showSpinner ? <Spinner size="2" state='1'/> : <span className={styles.cardIcon}> {renderIcon()} </span>}
94
+ </>
95
+ )}
79
96
  {text != null && <span className={styles.cardText}>{text}</span>}
80
97
  {locked && <LockIcon width={12} height={12} className={styles.lockIcon} />}
81
98
  </button>