@moises.ai/design-system 3.12.2 → 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
|
@@ -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')
|
|
@@ -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(
|
|
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]:
|
|
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,
|