@moises.ai/design-system 3.12.1 → 3.12.3

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": "3.12.1",
3
+ "version": "3.12.3",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -20,6 +20,7 @@ export const DropdownMenu = memo(
20
20
  closeOnSelect = true,
21
21
  sideOffset = 5,
22
22
  matchTriggerWidth = false,
23
+ showSelectedItemBackground = true,
23
24
  wrapCloseMenu,
24
25
  ...props
25
26
  }) => {
@@ -87,6 +88,7 @@ export const DropdownMenu = memo(
87
88
  onSelectionChange,
88
89
  closeOnSelect,
89
90
  closeMenu,
91
+ showSelectedItemBackground,
90
92
  ),
91
93
  )}
92
94
  </ScrollArea>
@@ -116,6 +118,7 @@ export const DropdownMenu = memo(
116
118
  onSelectionChange,
117
119
  closeOnSelect,
118
120
  closeMenu,
121
+ showSelectedItemBackground,
119
122
  ),
120
123
  )}
121
124
  </DropdownMenuRadix.Content>
@@ -231,6 +231,58 @@ The \`options\` prop accepts an array of objects with the following types:
231
231
  defaultValue: { summary: 'false' },
232
232
  },
233
233
  },
234
+ maxHeight: {
235
+ control: { type: 'number' },
236
+ description:
237
+ 'Maximum content height. When provided, wraps menu content in a vertical ScrollArea',
238
+ table: {
239
+ type: { summary: 'number | string' },
240
+ defaultValue: { summary: 'undefined' },
241
+ },
242
+ },
243
+ sideOffset: {
244
+ control: { type: 'number' },
245
+ description: 'Distance in pixels between trigger and menu content',
246
+ table: {
247
+ type: { summary: 'number' },
248
+ defaultValue: { summary: '5' },
249
+ },
250
+ },
251
+ showSelectedItemBackground: {
252
+ control: { type: 'boolean' },
253
+ description:
254
+ 'When true, checked checkbox items get the selected background style',
255
+ table: {
256
+ type: { summary: 'boolean' },
257
+ defaultValue: { summary: 'true' },
258
+ },
259
+ },
260
+ open: {
261
+ control: { type: 'boolean' },
262
+ description:
263
+ 'Controlled open state. When defined, menu visibility is controlled externally',
264
+ table: {
265
+ type: { summary: 'boolean' },
266
+ defaultValue: { summary: 'undefined' },
267
+ },
268
+ },
269
+ onOpenChange: {
270
+ control: false,
271
+ description: 'Callback fired whenever open state changes',
272
+ table: {
273
+ type: { summary: '(open: boolean) => void' },
274
+ defaultValue: { summary: 'undefined' },
275
+ },
276
+ },
277
+ wrapCloseMenu: {
278
+ control: false,
279
+ description:
280
+ 'Allows wrapping internal close behavior and receiving a close callback',
281
+ table: {
282
+ type: { summary: '(close: () => void) => () => void' },
283
+ defaultValue: { summary: 'undefined' },
284
+ },
285
+ },
234
286
  },
235
287
  }
236
288
 
@@ -416,6 +468,40 @@ export const MatchTriggerWidth = {
416
468
  ),
417
469
  }
418
470
 
471
+ export const CheckboxWithoutSelectedBackground = {
472
+ args: {
473
+ showSelectedItemBackground: false,
474
+ side: 'bottom',
475
+ align: 'end',
476
+ trigger: (
477
+ <IconButton>
478
+ <DotsVerticalIcon />
479
+ </IconButton>
480
+ ),
481
+ options: [
482
+ {
483
+ type: 'checkbox',
484
+ key: 'option-1',
485
+ label: 'Voice',
486
+ checked: true,
487
+ onChange: (checked) => console.log('Voice:', checked),
488
+ },
489
+ {
490
+ type: 'checkbox',
491
+ key: 'option-2',
492
+ label: 'Instrumental',
493
+ checked: false,
494
+ onChange: (checked) => console.log('Instrumental:', checked),
495
+ },
496
+ ],
497
+ },
498
+ render: (args) => (
499
+ <Flex justify="center" align="start" height="300px">
500
+ <DropdownMenu {...args} />
501
+ </Flex>
502
+ ),
503
+ }
504
+
419
505
  export const CustomWithSwitch = {
420
506
  render: () => {
421
507
  const [access, setAccess] = useState('private')
@@ -38,17 +38,17 @@
38
38
  opacity: 0.5;
39
39
  }
40
40
 
41
- .button.autoMute:not(.active) {
41
+ .button.autoMute {
42
42
  background: var(--Colors-Neutral-Neutral-Alpha-2, rgba(216, 244, 246, 0.04));
43
- color: var(--warning-alpha-12);
43
+ color: var(--colors-semantic-warning-alpha-9);
44
44
  }
45
45
 
46
- .button.autoMute:not(.active):hover:not(:disabled) {
46
+ .button.autoMute:hover:not(:disabled) {
47
47
  background: var(--Colors-Neutral-Neutral-Alpha-3, rgba(221, 234, 248, 0.08));
48
- color: color-mix(in srgb, var(--warning-alpha-12) 88%, var(--colors-semantic-warning-alpha-9));
48
+ color: var(--colors-semantic-warning-alpha-9);
49
49
  }
50
50
 
51
- .button.autoMute:not(.active):active:not(:disabled) {
51
+ .button.autoMute:active:not(:disabled) {
52
52
  background: var(--Colors-Neutral-Neutral-Alpha-4, rgba(211, 237, 248, 0.11));
53
53
  }
54
54
 
@@ -76,21 +76,6 @@
76
76
  filter: brightness(0.92);
77
77
  }
78
78
 
79
- .button.active.autoMute {
80
- background-color: var(--warning-alpha-12);
81
- color: var(--colors-neutral-neutral-1);
82
- }
83
-
84
- .button.active.autoMute:hover:not(:disabled) {
85
- background-color: color-mix(in srgb, var(--warning-alpha-12) 78%, var(--colors-semantic-warning-alpha-9));
86
- color: var(--colors-neutral-neutral-1);
87
- }
88
-
89
- .button.active.autoMute:active:not(:disabled) {
90
- background-color: color-mix(in srgb, var(--warning-alpha-12) 62%, var(--colors-semantic-warning-alpha-9));
91
- color: var(--colors-neutral-neutral-1);
92
- }
93
-
94
79
  .button.active.solo {
95
80
  background-color: var(--colors-accent-accent-10);
96
81
  color: var(--colors-neutral-neutral-1);
@@ -8,7 +8,8 @@ export default {
8
8
  layout: 'centered',
9
9
  docs: {
10
10
  description: {
11
- component: 'Toggle button for track controls (Record, Mute, Auto Mute, and Solo). Use `selected` to represent active state and `tooltipContent` to show context and keyboard shortcut.',
11
+ component:
12
+ 'Toggle button for track controls (Record, Mute, Auto Mute, and Solo). For `type="autoMute"`, o Figma define um único visual (amarelo em fundo alpha-2); `selected` só afeta `aria-pressed`, não as cores.',
12
13
  },
13
14
  },
14
15
  },
@@ -98,7 +99,7 @@ export const MuteSelected = {
98
99
  },
99
100
  }
100
101
 
101
- export const AutoMuteSelected = {
102
+ export const AutoMute = {
102
103
  args: {
103
104
  type: 'autoMute',
104
105
  selected: true,
@@ -109,22 +110,12 @@ export const AutoMuteSelected = {
109
110
  },
110
111
  }
111
112
 
112
- export const AutoMuteInactive = {
113
- args: {
114
- type: 'autoMute',
115
- selected: false,
116
- tooltipContent: {
117
- text: 'Muted by solo (inactive)',
118
- shortcut: 'M',
119
- },
120
- },
121
- }
122
-
123
113
  export const AllStates = {
124
114
  parameters: {
125
115
  docs: {
126
116
  description: {
127
- story: 'Shows all states with and without tooltip. Click any toggle to switch between inactive and active.',
117
+ story:
118
+ 'Shows all states with and without tooltip. Click any toggle to switch `aria-pressed`; `autoMute` mantém o mesmo visual do Figma.',
128
119
  },
129
120
  },
130
121
  },
@@ -151,7 +142,15 @@ export const AllStates = {
151
142
  {...args}
152
143
  type={type}
153
144
  selected={states[type]}
154
- tooltipContent={withTooltip ? { text: `${type}`, shortcut: type.slice(0, 1).toUpperCase() } : undefined}
145
+ tooltipContent={
146
+ withTooltip
147
+ ? {
148
+ text: `${type}`,
149
+ shortcut:
150
+ type === 'record' ? 'R' : type === 'solo' ? 'S' : 'M',
151
+ }
152
+ : undefined
153
+ }
155
154
  onClick={() => {
156
155
  args.onClick?.()
157
156
  toggleState(type)
@@ -15,6 +15,7 @@ export const createRenderItem = (MenuPrimitives) => {
15
15
  onSelectionChange,
16
16
  closeOnSelect = true,
17
17
  closeMenu,
18
+ showSelectedItemBackground = true,
18
19
  ) => {
19
20
  switch (opt.type) {
20
21
  case 'custom':
@@ -81,7 +82,14 @@ export const createRenderItem = (MenuPrimitives) => {
81
82
 
82
83
  <MenuPrimitives.SubContent className={styles.menuSubContent}>
83
84
  {opt?.children?.map((child) =>
84
- renderItem(child, size, onSelectionChange, closeOnSelect, closeMenu),
85
+ renderItem(
86
+ child,
87
+ size,
88
+ onSelectionChange,
89
+ closeOnSelect,
90
+ closeMenu,
91
+ showSelectedItemBackground,
92
+ ),
85
93
  )}
86
94
  </MenuPrimitives.SubContent>
87
95
  </MenuPrimitives.Sub>
@@ -151,7 +159,8 @@ export const createRenderItem = (MenuPrimitives) => {
151
159
  styles.menuItem,
152
160
  styles.menuCheckboxItem,
153
161
  {
154
- [styles.menuItemSelected]: opt.checked,
162
+ [styles.menuItemSelected]:
163
+ opt.checked && showSelectedItemBackground,
155
164
  [styles[`menuItem-size-${size}`]]: size,
156
165
  [styles.red]: opt.color === 'red' && !opt.disabled,
157
166
  [styles.cyan]: opt.color === 'cyan' && !opt.disabled,