@tremolo-ui/react 0.6.0 → 0.8.0

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 (57) hide show
  1. package/dist/index.cjs +522 -997
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +601 -329
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.ts +601 -329
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +487 -953
  8. package/dist/index.js.map +1 -1
  9. package/package.json +4 -4
  10. package/src/components/DropZone/index.tsx +101 -0
  11. package/src/components/FileInput/Trigger.tsx +39 -0
  12. package/src/components/FileInput/context.tsx +24 -0
  13. package/src/components/FileInput/index.tsx +139 -0
  14. package/src/components/Knob/ActiveLine.tsx +5 -3
  15. package/src/components/Knob/InactiveLine.tsx +6 -4
  16. package/src/components/Knob/SVGRoot.tsx +3 -3
  17. package/src/components/Knob/Thumb.tsx +3 -2
  18. package/src/components/Knob/context.tsx +3 -74
  19. package/src/components/Knob/index.tsx +27 -21
  20. package/src/components/NumberInput/DecrementStepper.tsx +2 -13
  21. package/src/components/NumberInput/IncrementStepper.tsx +2 -14
  22. package/src/components/NumberInput/InputField.tsx +17 -38
  23. package/src/components/NumberInput/Stepper.tsx +44 -107
  24. package/src/components/NumberInput/StepperButton.tsx +16 -12
  25. package/src/components/NumberInput/context.tsx +8 -8
  26. package/src/components/NumberInput/index.tsx +41 -81
  27. package/src/components/Piano/index.tsx +39 -149
  28. package/src/components/PointsEditor/Background.tsx +2 -8
  29. package/src/components/PointsEditor/Container.tsx +17 -34
  30. package/src/components/PointsEditor/Point.tsx +41 -86
  31. package/src/components/PointsEditor/SelectionBox.tsx +2 -8
  32. package/src/components/PointsEditor/context.tsx +10 -61
  33. package/src/components/PointsEditor/index.tsx +31 -315
  34. package/src/components/Slider/Marks.tsx +8 -13
  35. package/src/components/Slider/MarksOption.tsx +11 -17
  36. package/src/components/Slider/Thumb.tsx +9 -15
  37. package/src/components/Slider/Track.tsx +7 -13
  38. package/src/components/Slider/index.tsx +33 -39
  39. package/src/components/XYPad/Area.tsx +26 -53
  40. package/src/components/XYPad/Thumb.tsx +8 -12
  41. package/src/components/XYPad/context.tsx +1 -3
  42. package/src/components/XYPad/index.tsx +35 -50
  43. package/src/components/_util/VisuallyHiddenRangeInput.tsx +3 -15
  44. package/src/css-variables.ts +23 -0
  45. package/src/hooks/_internal/useCheckSteps.ts +9 -147
  46. package/src/hooks/useDrag.ts +13 -4
  47. package/src/hooks/useDragValue.ts +17 -2
  48. package/src/hooks/useDropZone.ts +78 -0
  49. package/src/hooks/useLongPress.ts +35 -51
  50. package/src/hooks/useMIDIAccess.ts +0 -8
  51. package/src/hooks/useMIDIInput.ts +0 -3
  52. package/src/hooks/useWheel.ts +4 -1
  53. package/src/index.ts +14 -36
  54. package/src/components/Piano/keyboard-shortcuts.ts +0 -61
  55. package/src/components/Slider/type.ts +0 -44
  56. package/src/components/_util/css-length.ts +0 -13
  57. package/src/input-event.ts +0 -32
@@ -1,13 +0,0 @@
1
- /**
2
- * A number as a CSS length, for a custom property.
3
- *
4
- * React appends `px` to a bare number for the properties it knows take a
5
- * length, and a custom property is never one of them: `--size: 50` would come
6
- * out as the invalid `50`. Anything already a string is passed through, so
7
- * `'3rem'` and `'100%'` still work.
8
- */
9
- export function cssLength(
10
- value: number | string | undefined,
11
- ): string | undefined {
12
- return typeof value === 'number' ? `${value}px` : value
13
- }
@@ -1,32 +0,0 @@
1
- import type { InputEventOption, ModifierValue } from '@tremolo-ui/functions'
2
-
3
- /**
4
- * The keyboard amount used by Knob, NumberInput, Slider, and XYPad by default:
5
- * 1 per press in the units of the value, and 0.1 with shift held. That is one
6
- * `step` only while `step` is 1; a coarser `step` rounds 1 straight back, which
7
- * `useCheckSteps` warns about.
8
- *
9
- * A modifier entry is not snapped to `step`, which is what lets the finer
10
- * amount move at all — see `applyDelta` in `@tremolo-ui/functions`.
11
- */
12
- export const DEFAULT_KEYBOARD_OPTIONS: ModifierValue<InputEventOption> = {
13
- default: ['raw', 1],
14
- shift: ['raw', 0.1],
15
- }
16
-
17
- /**
18
- * The wheel amount used by Knob, NumberInput, Slider, and XYPad by default.
19
- *
20
- * Browsers turn shift+wheel into horizontal scrolling, which empties `deltaY`
21
- * and fills `deltaX`, so no modifier is bound here.
22
- */
23
- export const DEFAULT_WHEEL_OPTIONS: ModifierValue<InputEventOption> = ['raw', 1]
24
-
25
- /**
26
- * The drag sensitivity used by value controls by default. Shift makes the
27
- * same movement cover a tenth of the range, matching the arrow keys.
28
- */
29
- export const DEFAULT_DRAG_SENSITIVITY: ModifierValue<number> = {
30
- default: 1,
31
- shift: 0.1,
32
- }