victory-core 37.0.2 → 37.0.3-next.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 (154) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/victory-core.js +390 -350
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/index.d.ts +18 -17
  5. package/es/index.js +2 -1
  6. package/es/types/callbacks.d.ts +36 -36
  7. package/es/types/prop-types.d.ts +130 -129
  8. package/es/victory-accessible-group/victory-accessible-group.d.ts +10 -10
  9. package/es/victory-animation/util.d.ts +66 -66
  10. package/es/victory-animation/victory-animation.d.ts +34 -34
  11. package/es/victory-clip-container/victory-clip-container.d.ts +46 -46
  12. package/es/victory-container/victory-container.d.ts +62 -68
  13. package/es/victory-container/victory-container.js +134 -162
  14. package/es/victory-label/victory-label.d.ts +58 -58
  15. package/es/victory-portal/portal-context.d.ts +12 -11
  16. package/es/victory-portal/portal-context.js +37 -6
  17. package/es/victory-portal/portal-outlet.d.ts +12 -0
  18. package/es/victory-portal/portal-outlet.js +16 -0
  19. package/es/victory-portal/portal.d.ts +9 -20
  20. package/es/victory-portal/portal.js +6 -32
  21. package/es/victory-portal/victory-portal.d.ts +9 -26
  22. package/es/victory-portal/victory-portal.js +27 -44
  23. package/es/victory-primitives/arc.d.ts +14 -14
  24. package/es/victory-primitives/background.d.ts +13 -13
  25. package/es/victory-primitives/border.d.ts +10 -10
  26. package/es/victory-primitives/circle.d.ts +3 -3
  27. package/es/victory-primitives/clip-path.d.ts +7 -7
  28. package/es/victory-primitives/index.d.ts +14 -14
  29. package/es/victory-primitives/line-segment.d.ts +11 -11
  30. package/es/victory-primitives/line.d.ts +3 -3
  31. package/es/victory-primitives/path.d.ts +3 -3
  32. package/es/victory-primitives/point.d.ts +13 -13
  33. package/es/victory-primitives/rect.d.ts +3 -3
  34. package/es/victory-primitives/text.d.ts +8 -8
  35. package/es/victory-primitives/tspan.d.ts +3 -3
  36. package/es/victory-primitives/types.d.ts +7 -7
  37. package/es/victory-primitives/whisker.d.ts +15 -15
  38. package/es/victory-theme/grayscale.d.ts +2 -2
  39. package/es/victory-theme/material.d.ts +2 -2
  40. package/es/victory-theme/types.d.ts +238 -238
  41. package/es/victory-theme/victory-theme.d.ts +5 -5
  42. package/es/victory-transition/victory-transition.d.ts +53 -53
  43. package/es/victory-util/add-events.d.ts +126 -126
  44. package/es/victory-util/axis.d.ts +50 -50
  45. package/es/victory-util/collection.d.ts +15 -15
  46. package/es/victory-util/common-props.d.ts +79 -79
  47. package/es/victory-util/data.d.ts +74 -74
  48. package/es/victory-util/default-transitions.d.ts +4 -4
  49. package/es/victory-util/domain.d.ts +90 -90
  50. package/es/victory-util/events.d.ts +64 -64
  51. package/es/victory-util/helpers.d.ts +96 -96
  52. package/es/victory-util/hooks/index.d.ts +2 -2
  53. package/es/victory-util/hooks/use-animation-state.d.ts +21 -21
  54. package/es/victory-util/hooks/use-previous-props.d.ts +1 -1
  55. package/es/victory-util/immutable.d.ts +11 -11
  56. package/es/victory-util/index.d.ts +27 -26
  57. package/es/victory-util/index.js +1 -0
  58. package/es/victory-util/label-helpers.d.ts +26 -26
  59. package/es/victory-util/line-helpers.d.ts +4 -4
  60. package/es/victory-util/log.d.ts +1 -1
  61. package/es/victory-util/merge-refs.d.ts +13 -0
  62. package/es/victory-util/merge-refs.js +23 -0
  63. package/es/victory-util/point-path-helpers.d.ts +9 -9
  64. package/es/victory-util/scale.d.ts +9 -9
  65. package/es/victory-util/selection.d.ts +28 -28
  66. package/es/victory-util/style.d.ts +18 -18
  67. package/es/victory-util/textsize.d.ts +35 -35
  68. package/es/victory-util/timer-context.d.ts +11 -11
  69. package/es/victory-util/timer.d.ts +16 -16
  70. package/es/victory-util/transitions.d.ts +48 -48
  71. package/es/victory-util/type-helpers.d.ts +9 -9
  72. package/es/victory-util/user-props.d.ts +26 -26
  73. package/es/victory-util/wrapper.d.ts +33 -33
  74. package/lib/index.d.ts +18 -17
  75. package/lib/index.js +16 -4
  76. package/lib/types/callbacks.d.ts +36 -36
  77. package/lib/types/prop-types.d.ts +130 -129
  78. package/lib/victory-accessible-group/victory-accessible-group.d.ts +10 -10
  79. package/lib/victory-animation/util.d.ts +66 -66
  80. package/lib/victory-animation/victory-animation.d.ts +34 -34
  81. package/lib/victory-clip-container/victory-clip-container.d.ts +46 -46
  82. package/lib/victory-container/victory-container.d.ts +62 -68
  83. package/lib/victory-container/victory-container.js +136 -163
  84. package/lib/victory-label/victory-label.d.ts +58 -58
  85. package/lib/victory-portal/portal-context.d.ts +12 -11
  86. package/lib/victory-portal/portal-context.js +40 -7
  87. package/lib/victory-portal/portal-outlet.d.ts +12 -0
  88. package/lib/victory-portal/portal-outlet.js +24 -0
  89. package/lib/victory-portal/portal.d.ts +9 -20
  90. package/lib/victory-portal/portal.js +6 -33
  91. package/lib/victory-portal/victory-portal.d.ts +9 -26
  92. package/lib/victory-portal/victory-portal.js +27 -44
  93. package/lib/victory-primitives/arc.d.ts +14 -14
  94. package/lib/victory-primitives/background.d.ts +13 -13
  95. package/lib/victory-primitives/border.d.ts +10 -10
  96. package/lib/victory-primitives/circle.d.ts +3 -3
  97. package/lib/victory-primitives/clip-path.d.ts +7 -7
  98. package/lib/victory-primitives/index.d.ts +14 -14
  99. package/lib/victory-primitives/line-segment.d.ts +11 -11
  100. package/lib/victory-primitives/line.d.ts +3 -3
  101. package/lib/victory-primitives/path.d.ts +3 -3
  102. package/lib/victory-primitives/point.d.ts +13 -13
  103. package/lib/victory-primitives/rect.d.ts +3 -3
  104. package/lib/victory-primitives/text.d.ts +8 -8
  105. package/lib/victory-primitives/tspan.d.ts +3 -3
  106. package/lib/victory-primitives/types.d.ts +7 -7
  107. package/lib/victory-primitives/whisker.d.ts +15 -15
  108. package/lib/victory-theme/grayscale.d.ts +2 -2
  109. package/lib/victory-theme/material.d.ts +2 -2
  110. package/lib/victory-theme/types.d.ts +238 -238
  111. package/lib/victory-theme/victory-theme.d.ts +5 -5
  112. package/lib/victory-transition/victory-transition.d.ts +53 -53
  113. package/lib/victory-util/add-events.d.ts +126 -126
  114. package/lib/victory-util/axis.d.ts +50 -50
  115. package/lib/victory-util/collection.d.ts +15 -15
  116. package/lib/victory-util/common-props.d.ts +79 -79
  117. package/lib/victory-util/data.d.ts +74 -74
  118. package/lib/victory-util/default-transitions.d.ts +4 -4
  119. package/lib/victory-util/domain.d.ts +90 -90
  120. package/lib/victory-util/events.d.ts +64 -64
  121. package/lib/victory-util/helpers.d.ts +96 -96
  122. package/lib/victory-util/hooks/index.d.ts +2 -2
  123. package/lib/victory-util/hooks/use-animation-state.d.ts +21 -21
  124. package/lib/victory-util/hooks/use-previous-props.d.ts +1 -1
  125. package/lib/victory-util/immutable.d.ts +11 -11
  126. package/lib/victory-util/index.d.ts +27 -26
  127. package/lib/victory-util/index.js +12 -0
  128. package/lib/victory-util/label-helpers.d.ts +26 -26
  129. package/lib/victory-util/line-helpers.d.ts +4 -4
  130. package/lib/victory-util/log.d.ts +1 -1
  131. package/lib/victory-util/merge-refs.d.ts +13 -0
  132. package/lib/victory-util/merge-refs.js +31 -0
  133. package/lib/victory-util/point-path-helpers.d.ts +9 -9
  134. package/lib/victory-util/scale.d.ts +9 -9
  135. package/lib/victory-util/selection.d.ts +28 -28
  136. package/lib/victory-util/style.d.ts +18 -18
  137. package/lib/victory-util/textsize.d.ts +35 -35
  138. package/lib/victory-util/timer-context.d.ts +11 -11
  139. package/lib/victory-util/timer.d.ts +16 -16
  140. package/lib/victory-util/transitions.d.ts +48 -48
  141. package/lib/victory-util/type-helpers.d.ts +9 -9
  142. package/lib/victory-util/user-props.d.ts +26 -26
  143. package/lib/victory-util/wrapper.d.ts +33 -33
  144. package/package.json +2 -5
  145. package/src/index.ts +2 -1
  146. package/src/types/prop-types.ts +7 -0
  147. package/src/victory-container/victory-container.tsx +168 -196
  148. package/src/victory-portal/portal-context.tsx +69 -0
  149. package/src/victory-portal/portal-outlet.tsx +25 -0
  150. package/src/victory-portal/portal.tsx +5 -42
  151. package/src/victory-portal/victory-portal.tsx +34 -64
  152. package/src/victory-util/index.ts +1 -0
  153. package/src/victory-util/merge-refs.ts +26 -0
  154. package/src/victory-portal/portal-context.ts +0 -14
@@ -0,0 +1,26 @@
1
+ import * as Helpers from "./helpers";
2
+
3
+ type Ref<T> = React.MutableRefObject<T> | React.LegacyRef<T> | undefined | null;
4
+
5
+ /**
6
+ * Used to merge multiple React refs into a single callback ref.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <div ref={mergeRefs([ref, forwardedRef])} />
11
+ * ```
12
+ */
13
+ export function mergeRefs<T>(refs: Ref<T>[]): React.RefCallback<T> {
14
+ return (value) => {
15
+ refs.forEach((ref) => {
16
+ // If the ref is a function, it's a callback ref and we call it with the value.
17
+ if (Helpers.isFunction(ref)) {
18
+ ref(value);
19
+ } else if (ref !== null && ref !== undefined) {
20
+ // If the ref is an object (not null and not undefined), it's an object ref.
21
+ // We assign the value to its 'current' property.
22
+ (ref as React.MutableRefObject<T | null>).current = value;
23
+ }
24
+ });
25
+ };
26
+ }
@@ -1,14 +0,0 @@
1
- import React from "react";
2
-
3
- export interface PortalContextValue {
4
- portalRegister(): number;
5
- portalUpdate(key: number, element: React.ReactElement): void;
6
- portalDeregister(key: number): void;
7
- }
8
-
9
- /**
10
- * The React context object consumers may use to access the context of the
11
- * portal.
12
- */
13
- export const PortalContext = React.createContext({} as PortalContextValue);
14
- PortalContext.displayName = "PortalContext";