@moises.ai/design-system 3.6.26 → 3.7.0

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.6.26",
3
+ "version": "3.7.0",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -0,0 +1,73 @@
1
+ import classNames from 'classnames'
2
+ import { ContextMenu as ContextMenuRadix } from 'radix-ui'
3
+ import React, { forwardRef, memo } from 'react'
4
+
5
+ import { createRenderItem, styles } from '../../lib/menu'
6
+
7
+ const renderOption = createRenderItem(ContextMenuRadix)
8
+
9
+ /**
10
+ * Variant of ContextMenu for programmatic opening from non-DOM event sources
11
+ * (e.g. Pixi canvas). Instead of wrapping a visible trigger element, it exposes
12
+ * a ref to an internal hidden div that can receive a synthetic `contextmenu` event.
13
+ *
14
+ * Usage:
15
+ * const triggerRef = useRef(null)
16
+ * triggerRef.current?.dispatchEvent(
17
+ * new MouseEvent('contextmenu', { bubbles: true, clientX: x, clientY: y })
18
+ * )
19
+ * ...
20
+ * <CanvasContextMenu ref={triggerRef} options={[...]}>
21
+ * {children} // rendered between trigger and content, inside the same Root
22
+ * </CanvasContextMenu>
23
+ */
24
+ export const CanvasContextMenu = memo(
25
+ forwardRef(function CanvasContextMenu(
26
+ {
27
+ children,
28
+ options,
29
+ className,
30
+ size = '2',
31
+ onSelectionChange,
32
+ closeOnSelect = true,
33
+ ...props
34
+ },
35
+ ref,
36
+ ) {
37
+ return (
38
+ // The outer div catches the bubbling contextmenu event AFTER Radix has already
39
+ // processed it on the trigger, suppressing the browser's native context menu
40
+ // without interfering with Radix's own handler.
41
+ <div onContextMenu={(e) => e.preventDefault()} style={{ display: 'contents' }}>
42
+ <ContextMenuRadix.Root>
43
+ <ContextMenuRadix.Trigger asChild>
44
+ <div
45
+ ref={ref}
46
+ style={{ position: 'fixed', width: 0, height: 0, pointerEvents: 'none' }}
47
+ />
48
+ </ContextMenuRadix.Trigger>
49
+ {children}
50
+ {options?.length > 0 && (
51
+ <ContextMenuRadix.Content
52
+ className={classNames(styles.menuContent, className)}
53
+ side={props.side}
54
+ align={props.align}
55
+ sideOffset={5}
56
+ alignOffset={0}
57
+ onCloseAutoFocus={(event) => {
58
+ event.preventDefault()
59
+ }}
60
+ onClick={(event) => event.stopPropagation()}
61
+ >
62
+ {options?.map((option) =>
63
+ renderOption(option, size, onSelectionChange, closeOnSelect),
64
+ )}
65
+ </ContextMenuRadix.Content>
66
+ )}
67
+ </ContextMenuRadix.Root>
68
+ </div>
69
+ )
70
+ }),
71
+ )
72
+
73
+ CanvasContextMenu.displayName = 'CanvasContextMenu'
@@ -0,0 +1,28 @@
1
+ export const EmailIcon = ({ width = 20, height = 20, className, ...props }) => (
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ width={width}
5
+ height={height}
6
+ viewBox="0 0 20 20"
7
+ fill="none"
8
+ className={className}
9
+ {...props}
10
+ >
11
+ <path
12
+ d="M3.33 3.33h13.34c.92 0 1.66.75 1.66 1.67v10c0 .92-.74 1.67-1.66 1.67H3.33c-.92 0-1.66-.75-1.66-1.67V5c0-.92.74-1.67 1.66-1.67z"
13
+ stroke="currentColor"
14
+ strokeWidth="1.5"
15
+ strokeLinecap="round"
16
+ strokeLinejoin="round"
17
+ />
18
+ <path
19
+ d="M18.33 5l-8.33 5.83L1.67 5"
20
+ stroke="currentColor"
21
+ strokeWidth="1.5"
22
+ strokeLinecap="round"
23
+ strokeLinejoin="round"
24
+ />
25
+ </svg>
26
+ )
27
+
28
+ EmailIcon.displayName = 'EmailIcon'
@@ -0,0 +1,30 @@
1
+ export const EyeIcon = ({ width = 16, height = 16, className, ...props }) => (
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ width={width}
5
+ height={height}
6
+ viewBox="0 0 16 16"
7
+ fill="none"
8
+ className={className}
9
+ {...props}
10
+ >
11
+ <path
12
+ d="M0.667 8s2.666-5.333 7.333-5.333C12.667 2.667 15.333 8 15.333 8s-2.666 5.333-7.333 5.333C3.333 13.333.667 8 .667 8z"
13
+ stroke="currentColor"
14
+ strokeWidth="1.2"
15
+ strokeLinecap="round"
16
+ strokeLinejoin="round"
17
+ />
18
+ <circle
19
+ cx="8"
20
+ cy="8"
21
+ r="2"
22
+ stroke="currentColor"
23
+ strokeWidth="1.2"
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ />
27
+ </svg>
28
+ )
29
+
30
+ EyeIcon.displayName = 'EyeIcon'
@@ -0,0 +1,28 @@
1
+ export const EyeOffIcon = ({ width = 16, height = 16, className, ...props }) => (
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ width={width}
5
+ height={height}
6
+ viewBox="0 0 16 16"
7
+ fill="none"
8
+ className={className}
9
+ {...props}
10
+ >
11
+ <path
12
+ d="M9.41 9.41a2 2 0 11-2.83-2.83M6.59 2.89A6.5 6.5 0 018 2.67c4.67 0 7.33 5.33 7.33 5.33a12.1 12.1 0 01-1.44 2.18m-3.18 1.64A6.5 6.5 0 018 13.33C3.33 13.33.67 8 .67 8a12.1 12.1 0 013.15-3.81"
13
+ stroke="currentColor"
14
+ strokeWidth="1.2"
15
+ strokeLinecap="round"
16
+ strokeLinejoin="round"
17
+ />
18
+ <path
19
+ d="M.667.667l14.666 14.666"
20
+ stroke="currentColor"
21
+ strokeWidth="1.2"
22
+ strokeLinecap="round"
23
+ strokeLinejoin="round"
24
+ />
25
+ </svg>
26
+ )
27
+
28
+ EyeOffIcon.displayName = 'EyeOffIcon'
package/src/icons.jsx CHANGED
@@ -343,3 +343,6 @@ export { GlobeIcon } from './icons/GlobeIcon'
343
343
  export { DotsVertical2Icon } from './icons/DotsVertical2Icon'
344
344
  export { EditIcon } from './icons/EditIcon'
345
345
  export { UnlockIcon } from './icons/UnlockIcon'
346
+ export { EmailIcon } from './icons/EmailIcon'
347
+ export { EyeIcon } from './icons/EyeIcon'
348
+ export { EyeOffIcon } from './icons/EyeOffIcon'
package/src/index.jsx CHANGED
@@ -81,6 +81,7 @@ export { Callout } from './components/Callout/Callout'
81
81
  export { Card as CardWidget } from './components/Card/Card'
82
82
  export { Checkbox } from './components/Checkbox/Checkbox'
83
83
  export { CigarBar } from './components/CigarBar/CigarBar'
84
+ export { CanvasContextMenu } from './components/ContextMenu/CanvasContextMenu'
84
85
  export { ContextMenu } from './components/ContextMenu/ContextMenu'
85
86
  export { Countdown } from './components/Countdown/Countdown'
86
87
  export { DataTable } from './components/DataTable/DataTable'