@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.
@@ -1,5 +1,6 @@
1
1
  .tremolo-number-input {
2
2
  display: inline-block;
3
+ background-color: inherit;
3
4
  font: inherit;
4
5
  margin: 0px;
5
6
  padding-top: 6px;
@@ -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 = 40 * 0.65,
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 = 40,
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 || 40)
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%' : undefined,
181
+ width: fill ? '100%' : (whiteNoteWidth + 3) * whiteNoteCount,
182
182
  height: height,
183
183
  ...style,
184
184
  }}