@moises.ai/design-system 3.7.1 → 3.7.2

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.7.1",
3
+ "version": "3.7.2",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -1,7 +1,6 @@
1
1
  import React, { memo } from 'react'
2
2
  import { ContextMenu as ContextMenuRadix } from 'radix-ui'
3
3
  import classNames from 'classnames'
4
-
5
4
  import { createRenderItem, styles } from '../../lib/menu'
6
5
 
7
6
  const renderOption = createRenderItem(ContextMenuRadix)
@@ -1,4 +1,4 @@
1
- import { Flex } from '../../index'
1
+ import { Flex, Text } from '../../index'
2
2
  import { ProfileMenu } from './ProfileMenu'
3
3
 
4
4
  export default {
@@ -15,6 +15,34 @@ export const Default = {
15
15
  plan: 'Premium',
16
16
  },
17
17
  menuOptions: [
18
+ {
19
+ type: 'custom',
20
+ key: 'credits-header',
21
+ customRender: () => <div key="credits-header">
22
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }} className="showActiveTrigger">
23
+ <div>
24
+ <Text style={{ fontSize: 14, fontWeight: 'normal', lineHeight: '20px' }}>Credits:</Text>{` `}
25
+ <Text style={{ color: '#fff', fontSize: 14, fontWeight: 400 }}>45</Text>
26
+ <Text style={{ color: '#fff', fontSize: 14, fontWeight: 400, marginLeft: 4 }}>/60</Text >
27
+ </div>
28
+ <button
29
+ type="button"
30
+ aria-label="Upgrade"
31
+ title="Upgrade"
32
+ style={{ border: 'none', cursor: 'pointer', backgroundColor: '#00dae8', color: '#061415', fontSize: 12, fontWeight: 500, padding: '4px 8px', borderRadius: 4 }}
33
+ onClick={() => {
34
+ alert('Upgrade clicked')
35
+ }}
36
+ >
37
+ Upgrade
38
+ </button>
39
+ </div>
40
+ </div>
41
+ },
42
+ {
43
+ type: 'separator',
44
+ key: 'separator-credits',
45
+ },
18
46
  {
19
47
  type: 'item',
20
48
  key: 'account-settings',
@@ -5,7 +5,8 @@
5
5
  min-width: 151px;
6
6
  background-color: var(--panel-solid) !important;
7
7
  padding: 4px;
8
- box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.30), 0 12px 60px 0 rgba(0, 0, 0, 0.15);
8
+ box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.3),
9
+ 0 12px 60px 0 rgba(0, 0, 0, 0.15);
9
10
  z-index: 9999;
10
11
  border: 1px solid var(--neutral-alpha-3);
11
12
  animation-duration: 400ms;
@@ -84,8 +85,9 @@
84
85
  .menuPortal {
85
86
  border-radius: 8px;
86
87
  border: 1px solid var(--neutral-alpha-3);
87
- background: #18191B;
88
- box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.30), 0 12px 60px 0 rgba(0, 0, 0, 0.15);
88
+ background: #18191b;
89
+ box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.3),
90
+ 0 12px 60px 0 rgba(0, 0, 0, 0.15);
89
91
  }
90
92
 
91
93
  .menuItem {
@@ -271,6 +273,13 @@
271
273
  }
272
274
  }
273
275
 
276
+ .menuCustomRender,
277
+ .menuSubTrigger[data-highlighted]:is(.menuCustomRender),
278
+ .menuItem[data-highlighted]:is(.menuCustomRender) {
279
+ background-color: transparent;
280
+ cursor: default;
281
+ }
282
+
274
283
  .menuItem[data-state='open'],
275
284
  .menuTrigger[data-state='open']:not(.showActiveTrigger),
276
285
  .menuTrigger[data-highlighted]:not(.showActiveTrigger) {
@@ -409,4 +418,3 @@
409
418
  color: var(--aqua-dark-alpha-11);
410
419
  }
411
420
  }
412
-
@@ -18,16 +18,23 @@ export const createRenderItem = (MenuPrimitives) => {
18
18
  switch (opt.type) {
19
19
  case 'custom':
20
20
  return (
21
- <div
21
+ <MenuPrimitives.Item
22
22
  key={opt.key}
23
23
  className={classNames(
24
24
  styles.menuItem,
25
+ styles.menuCustomRender,
25
26
  styles[`menuItem-size-${size}`],
26
27
  )}
27
- data-disabled={opt.disabled ? '' : undefined}
28
+ onSelect={(event) => {
29
+ if (!closeOnSelect) {
30
+ event.preventDefault()
31
+ }
32
+ }}
33
+ disabled={opt.disabled}
34
+ asChild
28
35
  >
29
36
  {opt.customRender()}
30
- </div>
37
+ </MenuPrimitives.Item>
31
38
  )
32
39
 
33
40
  case 'separator':