@moises.ai/design-system 3.6.11 → 3.6.13

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.11",
3
+ "version": "3.6.13",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -3,6 +3,7 @@ import classNames from 'classnames'
3
3
  import { DropdownMenu as DropdownMenuRadix } from 'radix-ui'
4
4
  import React, { memo } from 'react'
5
5
  import { createRenderItem, styles } from '../../lib/menu'
6
+ import { Theme } from '../theme/Theme'
6
7
 
7
8
  const renderOption = createRenderItem(DropdownMenuRadix)
8
9
 
@@ -47,6 +48,7 @@ export const DropdownMenu = memo(
47
48
  </DropdownMenuRadix.Trigger>
48
49
  {maxHeight ? (
49
50
  <DropdownMenuRadix.Portal className={styles.menuPortal}>
51
+ <Theme asChild>
50
52
  <DropdownMenuRadix.Content
51
53
  className={classNames(styles.menuContent, className)}
52
54
  size={size}
@@ -74,9 +76,11 @@ export const DropdownMenu = memo(
74
76
  )}
75
77
  </ScrollArea>
76
78
  </DropdownMenuRadix.Content>
79
+ </Theme>
77
80
  </DropdownMenuRadix.Portal>
78
81
  ) : (
79
82
  <DropdownMenuRadix.Portal className={styles.menuPortal}>
83
+ <Theme asChild>
80
84
  <DropdownMenuRadix.Content
81
85
  className={classNames(styles.menuContent, className)}
82
86
  size={size}
@@ -99,6 +103,7 @@ export const DropdownMenu = memo(
99
103
  ),
100
104
  )}
101
105
  </DropdownMenuRadix.Content>
106
+ </Theme>
102
107
  </DropdownMenuRadix.Portal>
103
108
  )}
104
109
  </DropdownMenuRadix.Root>
@@ -2,7 +2,7 @@ import React, { useState } from 'react'
2
2
  import { DropdownMenu } from './DropdownMenu'
3
3
  import { IconButton } from '../IconButton/IconButton'
4
4
  import { Button } from '../Button/Button'
5
- import { Flex } from '@radix-ui/themes'
5
+ import { Flex, Switch, Text } from '@radix-ui/themes'
6
6
  import {
7
7
  DotsVerticalIcon,
8
8
  GearIcon,
@@ -416,6 +416,62 @@ export const MatchTriggerWidth = {
416
416
  ),
417
417
  }
418
418
 
419
+ export const CustomWithSwitch = {
420
+ render: () => {
421
+ const [access, setAccess] = useState('private')
422
+ const [allowEdit, setAllowEdit] = useState(true)
423
+
424
+ const options = [
425
+ {
426
+ type: 'checkbox',
427
+ key: 'private',
428
+ label: 'Private',
429
+ secondaryText: 'Only you can access',
430
+ secondaryTextPosition: 'bottom',
431
+ checked: access === 'private',
432
+ onChange: () => setAccess('private'),
433
+ },
434
+ { type: 'separator', key: 'sep1' },
435
+ {
436
+ type: 'checkbox',
437
+ key: 'public',
438
+ label: 'Public',
439
+ secondaryText: 'Anyone with the link can join.',
440
+ secondaryTextPosition: 'bottom',
441
+ checked: access === 'public',
442
+ onChange: () => setAccess('public'),
443
+ },
444
+ {
445
+ type: 'custom',
446
+ key: 'allow-edit',
447
+ customRender: () => (
448
+ <Flex direction="column" gap="4" width="100%">
449
+ <Text size="2">Allow members to edit this Setlist</Text>
450
+ <Switch size="2" checked={allowEdit} onCheckedChange={setAllowEdit} />
451
+ </Flex>
452
+ ),
453
+ },
454
+ ]
455
+
456
+ return (
457
+ <Flex direction="column" width="280px" gap="4">
458
+ <DropdownMenu
459
+ matchTriggerWidth
460
+ side="bottom"
461
+ align="start"
462
+ trigger={
463
+ <Button variant="soft" style={{ width: '100%', justifyContent: 'space-between' }}>
464
+ {access === 'private' ? 'Private' : 'Public'}
465
+ <ChevronDownIcon />
466
+ </Button>
467
+ }
468
+ options={options}
469
+ />
470
+ </Flex>
471
+ )
472
+ },
473
+ }
474
+
419
475
  const ItemPlaygroundComponent = ({
420
476
  size,
421
477
  // Item 1
@@ -18,7 +18,14 @@ export const createRenderItem = (MenuPrimitives) => {
18
18
  switch (opt.type) {
19
19
  case 'custom':
20
20
  return (
21
- <div key={opt.key} className={styles.menuItem}>
21
+ <div
22
+ key={opt.key}
23
+ className={classNames(
24
+ styles.menuItem,
25
+ styles[`menuItem-size-${size}`],
26
+ )}
27
+ data-disabled={opt.disabled ? '' : undefined}
28
+ >
22
29
  {opt.customRender()}
23
30
  </div>
24
31
  )