@moises.ai/design-system 4.16.6 → 4.16.8

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.
Files changed (29) hide show
  1. package/dist/{ForwardBarFillIcon-CUEgLgyx.js → ChordDiagramGridIcon-CxpGQmg4.js} +1029 -976
  2. package/dist/colors/custom-styles.css +1 -0
  3. package/dist/icons.js +604 -602
  4. package/dist/{index-f-eJMg6F.js → index-Dwaw5zqT.js} +151 -151
  5. package/dist/index.js +3209 -3105
  6. package/dist/primitives.js +147 -147
  7. package/package.json +1 -1
  8. package/src/colors/custom-styles.css +1 -0
  9. package/src/components/PlayerBar/PlayerBar.jsx +12 -11
  10. package/src/components/PlayerBar/PlayerBar.stories.jsx +193 -8
  11. package/src/components/PlayerMasterVolume/PlayerMasterVolume.jsx +54 -0
  12. package/src/components/PlayerMasterVolume/PlayerMasterVolume.module.css +31 -0
  13. package/src/components/PlayerMasterVolume/PlayerMasterVolume.stories.jsx +182 -0
  14. package/src/components/PlayerSmartMetronome/PlayerSmartMetronome.jsx +79 -0
  15. package/src/components/PlayerSmartMetronome/PlayerSmartMetronome.module.css +23 -0
  16. package/src/components/PlayerSmartMetronome/PlayerSmartMetronome.stories.jsx +225 -0
  17. package/src/components/PlayerSmartMetronome/SegmentedField.jsx +19 -0
  18. package/src/components/PlayerTempoPitch/PlayerTempoPitch.jsx +123 -0
  19. package/src/components/PlayerTempoPitch/PlayerTempoPitch.module.css +25 -0
  20. package/src/components/PlayerTempoPitch/PlayerTempoPitch.stories.jsx +215 -0
  21. package/src/components/PlayerTempoPitch/StepperField.jsx +57 -0
  22. package/src/components/PlayerTempoPitch/constants.js +40 -0
  23. package/src/components/ToolsDropdown/ToolsDropdown.jsx +147 -0
  24. package/src/components/ToolsDropdown/ToolsDropdown.module.css +23 -0
  25. package/src/components/ToolsDropdown/ToolsDropdown.stories.jsx +136 -0
  26. package/src/icons/ChordDiagramGridIcon.jsx +22 -0
  27. package/src/icons/ChordGrid3Icon.jsx +20 -0
  28. package/src/icons.jsx +2 -0
  29. package/src/index.jsx +2 -1
@@ -0,0 +1,147 @@
1
+ import { Flex, ScrollArea } from '@radix-ui/themes'
2
+ import classNames from 'classnames'
3
+ import { DropdownMenu as DropdownMenuRadix } from 'radix-ui'
4
+ import { memo, useCallback, useState } from 'react'
5
+ import { ChevronDownIcon } from '../../icons/ChevronDownIcon'
6
+ import { styles as menuStyles } from '../../lib/menu'
7
+ import { Button } from '../Button/Button'
8
+ import { Theme } from '../theme/Theme'
9
+ import styles from './ToolsDropdown.module.css'
10
+
11
+ export const ToolsDropdown = memo(
12
+ ({
13
+ trigger,
14
+ children,
15
+ className,
16
+ contentClassName,
17
+ showActiveTrigger,
18
+ size = '2',
19
+ disabled = false,
20
+ maxHeight,
21
+ sideOffset = 5,
22
+ matchTriggerWidth = false,
23
+ onTriggerClick,
24
+ showSeparator = true,
25
+ withIconTrigger = true,
26
+ wrapCloseMenu,
27
+ ...props
28
+ }) => {
29
+ const isControlled = props.open !== undefined
30
+ const [internalOpen, setInternalOpen] = useState(false)
31
+ const [hover, setHover] = useState(false)
32
+ const [isActionFocused, setIsActionFocused] = useState(false)
33
+ const [isMenuTriggerFocused, setIsMenuTriggerFocused] = useState(false)
34
+
35
+ const open = isControlled ? props.open : internalOpen
36
+ const onOpenChange = useCallback(
37
+ (value) => {
38
+ if (!isControlled) setInternalOpen(value)
39
+ props?.onOpenChange?.(value)
40
+ },
41
+ [isControlled, props?.onOpenChange],
42
+ )
43
+
44
+ const baseClose = useCallback(() => onOpenChange(false), [onOpenChange])
45
+ const closeMenu = wrapCloseMenu ? wrapCloseMenu(baseClose) : baseClose
46
+
47
+ const contentStyle = {
48
+ ...(matchTriggerWidth && {
49
+ width: 'var(--radix-dropdown-menu-trigger-width)',
50
+ boxSizing: 'border-box',
51
+ }),
52
+ ...(maxHeight && { height: maxHeight }),
53
+ }
54
+
55
+ const handleTriggerClick = (event) => {
56
+ if (!onTriggerClick) return
57
+ event.preventDefault()
58
+ event.stopPropagation()
59
+ onTriggerClick(event)
60
+ }
61
+
62
+ const triggerButtonStyle = {
63
+ padding: showSeparator ? '0px 8px 0 6px' : '0 6px',
64
+ width: withIconTrigger ? '32px' : undefined,
65
+ outline: 'none',
66
+ }
67
+
68
+ const menuContent = (
69
+ <Theme asChild>
70
+ <DropdownMenuRadix.Content
71
+ className={classNames(menuStyles.menuContent, contentClassName)}
72
+ size={size}
73
+ side={props.side}
74
+ align={props.align}
75
+ style={contentStyle}
76
+ sideOffset={sideOffset}
77
+ alignOffset={0}
78
+ onCloseAutoFocus={(event) => {
79
+ event.preventDefault()
80
+ }}
81
+ onClick={(event) => event.stopPropagation()}
82
+ >
83
+ {maxHeight ? (
84
+ <ScrollArea scrollbars="vertical" style={{ height: maxHeight }}>
85
+ <div className={styles.contentPanel}>
86
+ {typeof children === 'function' ? children(closeMenu) : children}
87
+ </div>
88
+ </ScrollArea>
89
+ ) : (
90
+ <div className={styles.contentPanel}>
91
+ {typeof children === 'function' ? children(closeMenu) : children}
92
+ </div>
93
+ )}
94
+ </DropdownMenuRadix.Content>
95
+ </Theme>
96
+ )
97
+
98
+ return (
99
+ <Flex className={classNames(styles.container, className)}>
100
+ <DropdownMenuRadix.Root
101
+ {...props}
102
+ open={disabled ? false : open}
103
+ onOpenChange={disabled ? undefined : onOpenChange}
104
+ >
105
+ {onTriggerClick && (
106
+ <button
107
+ type="button"
108
+ onClick={handleTriggerClick}
109
+ className={classNames(styles.triggerWithClick)}
110
+ >
111
+ {trigger}
112
+ </button>
113
+ )}
114
+
115
+ <DropdownMenuRadix.Trigger
116
+ asChild
117
+ disabled={disabled}
118
+ >
119
+ <button
120
+ type="button"
121
+ className={classNames(menuStyles.menuTrigger)}
122
+
123
+ >
124
+ {trigger}
125
+
126
+ {showSeparator && <span className={styles.separator} />}
127
+
128
+ <ChevronDownIcon
129
+ width={8}
130
+ height={8}
131
+ className={classNames(styles.chevron, {
132
+ [styles.hover]: hover,
133
+ })}
134
+ />
135
+ </button>
136
+ </DropdownMenuRadix.Trigger>
137
+
138
+ <DropdownMenuRadix.Portal className={menuStyles.menuPortal}>
139
+ {menuContent}
140
+ </DropdownMenuRadix.Portal>
141
+ </DropdownMenuRadix.Root>
142
+ </Flex>
143
+ )
144
+ },
145
+ )
146
+
147
+ ToolsDropdown.displayName = 'ToolsDropdown'
@@ -0,0 +1,23 @@
1
+ .container {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ }
6
+
7
+ .triggerWithClick {
8
+ cursor: pointer;
9
+ height: 32px;
10
+ }
11
+
12
+ .menuTrigger {
13
+ cursor: pointer;
14
+ height: 32px;
15
+ }
16
+
17
+ .menuPortal {
18
+ border-radius: 8px;
19
+ border: 1px solid var(--neutral-alpha-3);
20
+ background: #18191b;
21
+ box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.3),
22
+ 0 12px 60px 0 rgba(0, 0, 0, 0.15);
23
+ }
@@ -0,0 +1,136 @@
1
+ import { Flex, Switch, Text } from '@radix-ui/themes'
2
+ import { useState } from 'react'
3
+ import { DropdownMenu as DropdownMenuRadix } from 'radix-ui'
4
+ import { MetronomeIcon } from '../../icons/MetronomeIcon'
5
+ import { ToolsDropdown } from './ToolsDropdown'
6
+
7
+ export default {
8
+ title: 'Components/ToolsDropdown',
9
+ component: ToolsDropdown,
10
+ parameters: {
11
+ layout: 'centered',
12
+ docs: {
13
+ description: {
14
+ component: `
15
+ ToolsDropdown combines a tool action trigger with a dropdown menu built on Radix DropdownMenu.
16
+
17
+ - Pass \`onTriggerClick\` to run a primary action without opening the menu. The chevron opens the menu.
18
+ - Omit \`onTriggerClick\` to open the menu from the full trigger.
19
+ - Use \`children\` or \`children(closeMenu)\` for custom panel content.
20
+ `,
21
+ },
22
+ },
23
+ },
24
+ tags: ['autodocs'],
25
+ argTypes: {
26
+ trigger: {
27
+ description: 'Trigger content shown on the main button area',
28
+ table: { type: { summary: 'React.ReactNode' } },
29
+ },
30
+ onTriggerClick: {
31
+ description: 'Primary action executed when the main trigger is clicked',
32
+ table: { type: { summary: 'function' } },
33
+ },
34
+ showSeparator: {
35
+ control: 'boolean',
36
+ table: { type: { summary: 'boolean' }, defaultValue: { summary: true } },
37
+ },
38
+ children: {
39
+ description: 'Dropdown content or render prop receiving closeMenu',
40
+ table: { type: { summary: 'React.ReactNode | (closeMenu) => React.ReactNode' } },
41
+ },
42
+ },
43
+ }
44
+
45
+ export const Default = {
46
+ args: {
47
+ trigger: <Text>Tools</Text>,
48
+ showSeparator: true,
49
+ },
50
+ render: (args) => (
51
+ <ToolsDropdown {...args}>
52
+ <Text size="2">Tool settings panel</Text>
53
+ </ToolsDropdown>
54
+ ),
55
+ }
56
+
57
+ export const WithCustomAction = {
58
+ args: {
59
+ trigger: <MetronomeIcon width={16} height={16} />,
60
+ onTriggerClick: () => alert('Metronome toggled'),
61
+ },
62
+ render: (args) => (
63
+ <ToolsDropdown {...args}>
64
+ <Flex direction="column" gap="2">
65
+ <Text size="2">BPM: 120</Text>
66
+ <Text size="2">Time signature: 4/4</Text>
67
+ </Flex>
68
+ </ToolsDropdown>
69
+ ),
70
+ }
71
+
72
+ export const WithRenderProp = {
73
+ render: () => {
74
+ const [enabled, setEnabled] = useState(false)
75
+
76
+ return (
77
+ <ToolsDropdown
78
+ trigger={<Text>Chords</Text>}
79
+ onTriggerClick={() => alert('Chords toggled')}
80
+ >
81
+ {(closeMenu) => (
82
+ <>
83
+ <Flex direction="column" gap="3" width="220px">
84
+ <Text size="2">Show chord diagrams</Text>
85
+ <Switch
86
+ size="2"
87
+ checked={enabled}
88
+ onCheckedChange={setEnabled}
89
+ />
90
+ <button
91
+ type="button"
92
+ onClick={() => {
93
+ closeMenu()
94
+ alert('Saved')
95
+ }}
96
+ >
97
+ Save
98
+ </button>
99
+ </Flex>
100
+ </>
101
+ )}
102
+ </ToolsDropdown>
103
+ )
104
+ },
105
+ }
106
+
107
+ export const ControlledOpen = {
108
+ render: () => {
109
+ const [isOpen, setIsOpen] = useState(false)
110
+
111
+ return (
112
+ <Flex direction="column" gap="4" align="center">
113
+ <Flex gap="2">
114
+ <button type="button" onClick={() => setIsOpen(true)}>
115
+ Open
116
+ </button>
117
+ <button type="button" onClick={() => setIsOpen(false)}>
118
+ Close
119
+ </button>
120
+ </Flex>
121
+
122
+ <ToolsDropdown
123
+ open={isOpen}
124
+ onOpenChange={setIsOpen}
125
+ trigger={<Text>Controlled</Text>}
126
+ >
127
+ <Text size="2">Controlled menu content</Text>
128
+ </ToolsDropdown>
129
+
130
+ <Text size="1">
131
+ Status: <strong>{isOpen ? 'Open' : 'Closed'}</strong>
132
+ </Text>
133
+ </Flex>
134
+ )
135
+ },
136
+ }
@@ -0,0 +1,22 @@
1
+ export const ChordDiagramGridIcon = ({ 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="M5.33325 14.6663C5.33325 14.9425 5.55711 15.1663 5.83325 15.1663C6.10939 15.1663 6.33325 14.9425 6.33325 14.6663H5.83325H5.33325ZM9.66658 14.6663C9.66658 14.9425 9.89044 15.1663 10.1666 15.1663C10.4427 15.1663 10.6666 14.9425 10.6666 14.6663H10.1666H9.66658ZM2.66659 10.6663V11.1663H13.3333V10.6663V10.1663H2.66659V10.6663ZM2.66659 14.6663V15.1663H13.3333V14.6663V14.1663H2.66659V14.6663ZM5.83325 14.6663H6.33325V10.6663H5.83325H5.33325V14.6663H5.83325ZM10.1666 14.6663H10.6666V10.6663H10.1666H9.66658V14.6663H10.1666ZM1.33325 13.333H1.83325V11.9997H1.33325H0.833252V13.333H1.33325ZM14.6666 13.333H15.1666V11.9997H14.6666H14.1666V13.333H14.6666ZM13.3333 10.6663V11.1663C13.7935 11.1663 14.1666 11.5394 14.1666 11.9997H14.6666H15.1666C15.1666 10.9872 14.3458 10.1663 13.3333 10.1663V10.6663ZM13.3333 14.6663V15.1663C14.3458 15.1663 15.1666 14.3455 15.1666 13.333H14.6666H14.1666C14.1666 13.7932 13.7935 14.1663 13.3333 14.1663V14.6663ZM2.66659 10.6663V10.1663C1.65406 10.1663 0.833252 10.9872 0.833252 11.9997H1.33325H1.83325C1.83325 11.5394 2.20635 11.1663 2.66659 11.1663V10.6663ZM2.66659 14.6663V14.1663C2.20635 14.1663 1.83325 13.7932 1.83325 13.333H1.33325H0.833252C0.833252 14.3455 1.65406 15.1663 2.66659 15.1663V14.6663ZM3.83325 1.33301V1.83301H6.16659V1.33301V0.833008H3.83325V1.33301ZM6.16659 1.33301V1.83301H9.83325V1.33301V0.833008H6.16659V1.33301ZM9.83325 1.33301V1.83301H12.1666V1.33301V0.833008H9.83325V1.33301ZM13.4999 2.66634H12.9999V7.99967H13.4999H13.9999V2.66634H13.4999ZM2.49992 7.99967H2.99992V2.66634H2.49992H1.99992V7.99967H2.49992ZM12.1666 1.33301V1.83301C12.6268 1.83301 12.9999 2.2061 12.9999 2.66634H13.4999H13.9999C13.9999 1.65382 13.1791 0.833008 12.1666 0.833008V1.33301ZM3.83325 1.33301V0.833008C2.82073 0.833008 1.99992 1.65382 1.99992 2.66634H2.49992H2.99992C2.99992 2.2061 3.37301 1.83301 3.83325 1.83301V1.33301ZM6.16659 7.99967H6.66659V1.33301H6.16659H5.66659V7.99967H6.16659ZM9.83325 7.99967H10.3333V1.33301H9.83325H9.33325V7.99967H9.83325Z"
13
+ fill='currentColor'
14
+ />
15
+ <path
16
+ d="M11.1667 4.66634C11.1667 5.40272 10.5697 5.99967 9.83333 5.99967C9.09695 5.99967 8.5 5.40272 8.5 4.66634C8.5 3.92996 9.09695 3.33301 9.83333 3.33301C10.5697 3.33301 11.1667 3.92996 11.1667 4.66634Z"
17
+ fill='currentColor'
18
+ />
19
+ </svg>
20
+ )
21
+
22
+ ChordDiagramGridIcon.displayName = 'ChordDiagramGridIcon'
@@ -0,0 +1,20 @@
1
+ export const ChordGrid3Icon = ({ 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 15 8"
7
+ fill="none"
8
+ className={className}
9
+ {...props}
10
+ >
11
+ <path
12
+ d="M5 7.5V0.5M9.33333 7.5V0.5M12.5 0.5H1.83333C1.09695 0.5 0.5 1.39543 0.5 2.5V5.5C0.5 6.60457 1.09695 7.5 1.83333 7.5H12.5C13.2364 7.5 13.8333 6.60457 13.8333 5.5V2.5C13.8333 1.39543 13.2364 0.5 12.5 0.5Z"
13
+ stroke="currentColor"
14
+ strokeMiterlimit="10"
15
+ strokeLinecap="round"
16
+ />
17
+ </svg>
18
+ )
19
+
20
+ ChordGrid3Icon.displayName = 'ChordGrid3Icon'
package/src/icons.jsx CHANGED
@@ -435,3 +435,5 @@ export { ThumbsDownIcon } from './icons/ThumbsDownIcon'
435
435
  export { LightBulbIcon } from './icons/LightBulbIcon'
436
436
  export { RewindBarFillIcon } from './icons/RewindBarFillIcon'
437
437
  export { ForwardBarFillIcon } from './icons/ForwardBarFillIcon'
438
+ export { ChordGrid3Icon } from './icons/ChordGrid3Icon'
439
+ export { ChordDiagramGridIcon } from './icons/ChordDiagramGridIcon'
package/src/index.jsx CHANGED
@@ -53,6 +53,7 @@ export { Countdown } from './components/Countdown/Countdown'
53
53
  export { DataTable } from './components/DataTable/DataTable'
54
54
  export { DropdownButton } from './components/DropdownButton/DropdownButton'
55
55
  export { DropdownMenu } from './components/DropdownMenu/DropdownMenu'
56
+ export { ToolsDropdown } from './components/ToolsDropdown/ToolsDropdown'
56
57
  export { EmptyState } from './components/EmptyState/EmptyState'
57
58
  export {
58
59
  Extension,
@@ -122,4 +123,4 @@ export { TrackHeader } from './components/TrackHeader/TrackHeader'
122
123
  export { useForm } from './components/useForm/useForm'
123
124
  export { VerticalSegmentControl } from './components/VerticalSegmentControl/VerticalSegmentControl'
124
125
  export { VoiceConversionForm } from './components/VoiceConversionForm/VoiceConversionForm'
125
- export { Waveform } from './components/VoiceConversionForm/Waveform/Waveform'
126
+ export { Waveform } from './components/VoiceConversionForm/Waveform/Waveform'