@tremolo-ui/react 0.0.8 → 0.0.9
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/cjs/index.js +9 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Piano/BlackKey.d.ts.map +1 -1
- package/dist/cjs/types/components/Piano/WhiteKey.d.ts +1 -0
- package/dist/cjs/types/components/Piano/WhiteKey.d.ts.map +1 -1
- package/dist/esm/index.js +9 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Piano/BlackKey.d.ts.map +1 -1
- package/dist/esm/types/components/Piano/WhiteKey.d.ts +1 -0
- package/dist/esm/types/components/Piano/WhiteKey.d.ts.map +1 -1
- package/dist/styles/index.css +1 -0
- package/package.json +4 -4
- package/src/components/NumberInput/index.css +1 -0
- package/src/components/Piano/BlackKey.tsx +2 -1
- package/src/components/Piano/WhiteKey.tsx +3 -1
- package/src/components/Piano/index.tsx +3 -3
|
@@ -8,13 +8,14 @@ import React, {
|
|
|
8
8
|
|
|
9
9
|
import { KeyMethods, KeyProps } from './key'
|
|
10
10
|
import { KeyLabel, KeyLabelProps } from './KeyLabel'
|
|
11
|
+
import { defaultWhiteKeyWidth } from './WhiteKey'
|
|
11
12
|
|
|
12
13
|
type Props = KeyProps & Omit<ComponentPropsWithoutRef<'div'>, keyof KeyProps>
|
|
13
14
|
|
|
14
15
|
export const BlackKey = forwardRef<KeyMethods, Props>(
|
|
15
16
|
(
|
|
16
17
|
{
|
|
17
|
-
width =
|
|
18
|
+
width = defaultWhiteKeyWidth * 0.65,
|
|
18
19
|
height = '60%',
|
|
19
20
|
className,
|
|
20
21
|
style,
|
|
@@ -11,10 +11,12 @@ import { KeyLabel, KeyLabelProps } from './KeyLabel'
|
|
|
11
11
|
|
|
12
12
|
type Props = KeyProps & Omit<ComponentPropsWithoutRef<'div'>, keyof KeyProps>
|
|
13
13
|
|
|
14
|
+
export const defaultWhiteKeyWidth = 40
|
|
15
|
+
|
|
14
16
|
export const WhiteKey = forwardRef<KeyMethods, Props>(
|
|
15
17
|
(
|
|
16
18
|
{
|
|
17
|
-
width =
|
|
19
|
+
width = defaultWhiteKeyWidth,
|
|
18
20
|
height = '100%',
|
|
19
21
|
className,
|
|
20
22
|
style,
|
|
@@ -24,7 +24,7 @@ import { useEventListener } from '../../hooks/useEventListener'
|
|
|
24
24
|
import { BlackKey } from './BlackKey'
|
|
25
25
|
import { KeyMethods, KeyProps } from './key'
|
|
26
26
|
import { KeyBoardShortcuts } from './keyboardShortcuts'
|
|
27
|
-
import { WhiteKey } from './WhiteKey'
|
|
27
|
+
import { defaultWhiteKeyWidth, WhiteKey } from './WhiteKey'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Piano component
|
|
@@ -149,7 +149,7 @@ export function Piano({
|
|
|
149
149
|
})
|
|
150
150
|
resizeObserver.observe(parent)
|
|
151
151
|
} else {
|
|
152
|
-
setWhiteNoteWidth(whiteKeyProps?.width ||
|
|
152
|
+
setWhiteNoteWidth(whiteKeyProps?.width || defaultWhiteKeyWidth)
|
|
153
153
|
}
|
|
154
154
|
}, [fill, whiteKeyProps?.width, whiteNoteCount])
|
|
155
155
|
|
|
@@ -178,7 +178,7 @@ export function Piano({
|
|
|
178
178
|
ref={pianoRef}
|
|
179
179
|
className={clsx('tremolo-piano', className)}
|
|
180
180
|
style={{
|
|
181
|
-
width: fill ? '100%' :
|
|
181
|
+
width: fill ? '100%' : (whiteNoteWidth + 3) * whiteNoteCount,
|
|
182
182
|
height: height,
|
|
183
183
|
...style,
|
|
184
184
|
}}
|