@moises.ai/design-system 3.6.10 → 3.6.11
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/dist/{EditIcon-Bn6TqXCt.js → UnlockIcon-DeCeTwbX.js} +705 -680
- package/dist/icons.js +36 -35
- package/dist/index.js +298 -287
- package/package.json +1 -1
- package/src/components/DropdownMenu/DropdownMenu.jsx +10 -1
- package/src/components/DropdownMenu/DropdownMenu.stories.jsx +74 -0
- package/src/icons/LockIcon.jsx +8 -14
- package/src/icons/UnlockIcon.jsx +22 -0
- package/src/icons.jsx +1 -0
package/package.json
CHANGED
|
@@ -18,8 +18,16 @@ export const DropdownMenu = memo(
|
|
|
18
18
|
maxHeight,
|
|
19
19
|
closeOnSelect = true,
|
|
20
20
|
sideOffset = 5,
|
|
21
|
+
matchTriggerWidth = false,
|
|
21
22
|
...props
|
|
22
23
|
}) => {
|
|
24
|
+
const contentStyle = {
|
|
25
|
+
...(matchTriggerWidth && {
|
|
26
|
+
width: 'var(--radix-dropdown-menu-trigger-width)',
|
|
27
|
+
boxSizing: 'border-box',
|
|
28
|
+
}),
|
|
29
|
+
...(maxHeight && { height: maxHeight }),
|
|
30
|
+
}
|
|
23
31
|
return (
|
|
24
32
|
<>
|
|
25
33
|
{options?.length > 0 && (
|
|
@@ -44,7 +52,7 @@ export const DropdownMenu = memo(
|
|
|
44
52
|
size={size}
|
|
45
53
|
side={props.side}
|
|
46
54
|
align={props.align}
|
|
47
|
-
style={
|
|
55
|
+
style={contentStyle}
|
|
48
56
|
sideOffset={sideOffset}
|
|
49
57
|
alignOffset={0}
|
|
50
58
|
onCloseAutoFocus={(event) => {
|
|
@@ -74,6 +82,7 @@ export const DropdownMenu = memo(
|
|
|
74
82
|
size={size}
|
|
75
83
|
side={props.side}
|
|
76
84
|
align={props.align}
|
|
85
|
+
style={contentStyle}
|
|
77
86
|
sideOffset={sideOffset}
|
|
78
87
|
alignOffset={0}
|
|
79
88
|
onCloseAutoFocus={(event) => {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { DropdownMenu } from './DropdownMenu'
|
|
3
3
|
import { IconButton } from '../IconButton/IconButton'
|
|
4
|
+
import { Button } from '../Button/Button'
|
|
4
5
|
import { Flex } from '@radix-ui/themes'
|
|
5
6
|
import {
|
|
6
7
|
DotsVerticalIcon,
|
|
7
8
|
GearIcon,
|
|
8
9
|
MixerHorizontalIcon,
|
|
10
|
+
ChevronDownIcon,
|
|
9
11
|
} from '@radix-ui/react-icons'
|
|
10
12
|
|
|
11
13
|
export default {
|
|
@@ -220,6 +222,15 @@ The \`options\` prop accepts an array of objects with the following types:
|
|
|
220
222
|
defaultValue: { summary: 'false' },
|
|
221
223
|
},
|
|
222
224
|
},
|
|
225
|
+
matchTriggerWidth: {
|
|
226
|
+
control: { type: 'boolean' },
|
|
227
|
+
description:
|
|
228
|
+
'When true, the dropdown content width matches the trigger element width',
|
|
229
|
+
table: {
|
|
230
|
+
type: { summary: 'boolean' },
|
|
231
|
+
defaultValue: { summary: 'false' },
|
|
232
|
+
},
|
|
233
|
+
},
|
|
223
234
|
},
|
|
224
235
|
}
|
|
225
236
|
|
|
@@ -342,6 +353,69 @@ export const StayOpenAfterSelect = {
|
|
|
342
353
|
},
|
|
343
354
|
}
|
|
344
355
|
|
|
356
|
+
export const MatchTriggerWidth = {
|
|
357
|
+
args: {
|
|
358
|
+
matchTriggerWidth: true,
|
|
359
|
+
side: 'bottom',
|
|
360
|
+
align: 'start',
|
|
361
|
+
trigger: (
|
|
362
|
+
<Button variant="soft" style={{ width: '100%', justifyContent: 'space-between' }}>
|
|
363
|
+
Private
|
|
364
|
+
<ChevronDownIcon />
|
|
365
|
+
</Button>
|
|
366
|
+
),
|
|
367
|
+
options: [
|
|
368
|
+
{ type: 'label', key: 'actions', label: 'Actions' },
|
|
369
|
+
{
|
|
370
|
+
type: 'item',
|
|
371
|
+
key: 'copy',
|
|
372
|
+
label: 'Copy',
|
|
373
|
+
secondaryText: 'Copies the selection to clipboard',
|
|
374
|
+
keybinding: '⌘C',
|
|
375
|
+
onClick: () => console.log('Copy clicked'),
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
type: 'item',
|
|
379
|
+
key: 'paste',
|
|
380
|
+
label: 'Paste',
|
|
381
|
+
keybinding: 'Ctrl+V ⌘V',
|
|
382
|
+
onClick: () => console.log('Paste clicked'),
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
type: 'item',
|
|
386
|
+
key: 'settings',
|
|
387
|
+
label: 'Settings',
|
|
388
|
+
secondaryText: 'Open app preferences',
|
|
389
|
+
keybinding: '⌘,',
|
|
390
|
+
onClick: () => console.log('Settings clicked'),
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
type: 'item',
|
|
394
|
+
key: 'delete',
|
|
395
|
+
label: 'Delete',
|
|
396
|
+
secondaryText: 'Cannot be undone',
|
|
397
|
+
keybinding: '⌘⌫',
|
|
398
|
+
color: 'red',
|
|
399
|
+
onClick: () => console.log('Delete clicked'),
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
type: 'checkbox',
|
|
403
|
+
key: 'dark',
|
|
404
|
+
label: 'Dark mode',
|
|
405
|
+
secondaryText: 'Switch to dark theme',
|
|
406
|
+
keybinding: '⌘D',
|
|
407
|
+
checked: true,
|
|
408
|
+
onChange: (checked) => console.log('Dark mode:', checked),
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
},
|
|
412
|
+
render: (args) => (
|
|
413
|
+
<Flex direction="column" width="280px" gap="4">
|
|
414
|
+
<DropdownMenu {...args} />
|
|
415
|
+
</Flex>
|
|
416
|
+
),
|
|
417
|
+
}
|
|
418
|
+
|
|
345
419
|
const ItemPlaygroundComponent = ({
|
|
346
420
|
size,
|
|
347
421
|
// Item 1
|
package/src/icons/LockIcon.jsx
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
export const LockIcon = ({ width = 16, height = 16, className, ...props }) => (
|
|
2
|
-
<svg
|
|
3
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
4
3
|
width={width}
|
|
5
4
|
height={height}
|
|
6
|
-
viewBox="0 0
|
|
5
|
+
viewBox="0 0 16 16"
|
|
7
6
|
fill="none"
|
|
8
|
-
{...props}
|
|
9
7
|
className={className}
|
|
8
|
+
{...props}
|
|
10
9
|
>
|
|
11
|
-
<g clipPath="url(#
|
|
12
|
-
<path
|
|
13
|
-
|
|
14
|
-
stroke="currentColor"
|
|
15
|
-
strokeWidth="1.5"
|
|
16
|
-
strokeLinecap="round"
|
|
17
|
-
strokeLinejoin="round"
|
|
18
|
-
/>
|
|
10
|
+
<g clipPath="url(#clip0_35277_68311)">
|
|
11
|
+
<path d="M4.66667 7.33398V4.66732C4.66667 3.78326 5.01786 2.93542 5.64298 2.3103C6.2681 1.68517 7.11595 1.33398 8 1.33398C8.88406 1.33398 9.7319 1.68517 10.357 2.3103C10.9821 2.93542 11.3333 3.78326 11.3333 4.66732V7.33398M3.33333 7.33398H12.6667C13.403 7.33398 14 7.93094 14 8.66732V13.334C14 14.0704 13.403 14.6673 12.6667 14.6673H3.33333C2.59695 14.6673 2 14.0704 2 13.334V8.66732C2 7.93094 2.59695 7.33398 3.33333 7.33398Z"
|
|
12
|
+
stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
|
|
19
13
|
</g>
|
|
20
14
|
<defs>
|
|
21
|
-
<clipPath id="
|
|
22
|
-
<rect width="
|
|
15
|
+
<clipPath id="clip0_35277_68311">
|
|
16
|
+
<rect width="16" height="16" fill="white" />
|
|
23
17
|
</clipPath>
|
|
24
18
|
</defs>
|
|
25
19
|
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const UnlockIcon = ({ width = 16, height = 16, className, ...props }) => (
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width={width}
|
|
4
|
+
height={height}
|
|
5
|
+
viewBox="0 0 16 16"
|
|
6
|
+
fill="none"
|
|
7
|
+
className={className}
|
|
8
|
+
{...props}
|
|
9
|
+
>
|
|
10
|
+
<g clipPath="url(#clip0_35277_49197)">
|
|
11
|
+
<path d="M4.66667 7.33398V4.66732C4.66667 3.78326 5.01786 2.93542 5.64298 2.3103C6.2681 1.68517 7.11595 1.33398 8 1.33398C8.88406 1.33398 9.7319 1.68517 10.357 2.3103C10.8226 2.77588 11.1362 3.36502 11.266 4.00065M3.33333 7.33398H12.6667C13.403 7.33398 14 7.93094 14 8.66732V13.334C14 14.0704 13.403 14.6673 12.6667 14.6673H3.33333C2.59695 14.6673 2 14.0704 2 13.334V8.66732C2 7.93094 2.59695 7.33398 3.33333 7.33398Z"
|
|
12
|
+
stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
|
|
13
|
+
</g>
|
|
14
|
+
<defs>
|
|
15
|
+
<clipPath id="clip0_35277_49197">
|
|
16
|
+
<rect width="16" height="16" fill="white" />
|
|
17
|
+
</clipPath>
|
|
18
|
+
</defs>
|
|
19
|
+
</svg>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
UnlockIcon.displayName = 'UnlockIcon'
|
package/src/icons.jsx
CHANGED