@ledgerhq/lumen-ui-rnative-visualization 0.1.22 → 0.1.24

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 (68) hide show
  1. package/dist/module/lib/Components/Line/Line.js +4 -4
  2. package/dist/module/lib/Components/Line/Line.js.map +1 -1
  3. package/dist/module/lib/Components/LineChart/LineChart.js +4 -4
  4. package/dist/module/lib/Components/LineChart/LineChart.js.map +1 -1
  5. package/dist/module/lib/Components/LineChart/LineChart.performance.test.js +99 -0
  6. package/dist/module/lib/Components/LineChart/LineChart.performance.test.js.map +1 -0
  7. package/dist/module/lib/Components/Point/Point.js +81 -50
  8. package/dist/module/lib/Components/Point/Point.js.map +1 -1
  9. package/dist/module/lib/Components/Point/Point.test.js +41 -0
  10. package/dist/module/lib/Components/Point/Point.test.js.map +1 -1
  11. package/dist/module/lib/Components/Point/constants.js +2 -0
  12. package/dist/module/lib/Components/Point/constants.js.map +1 -1
  13. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.js +19 -9
  14. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.js.map +1 -1
  15. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.test.js +10 -1
  16. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.test.js.map +1 -1
  17. package/dist/module/lib/Components/Point/pointContext/index.js +1 -1
  18. package/dist/module/lib/Components/Point/pointContext/index.js.map +1 -1
  19. package/dist/module/lib/Components/Point/pointContext/magneticPointsContext.js +22 -4
  20. package/dist/module/lib/Components/Point/pointContext/magneticPointsContext.js.map +1 -1
  21. package/dist/module/lib/Components/Point/usePointGeometry.js +60 -0
  22. package/dist/module/lib/Components/Point/usePointGeometry.js.map +1 -0
  23. package/dist/module/lib/Components/Point/usePointGeometry.test.js +86 -0
  24. package/dist/module/lib/Components/Point/usePointGeometry.test.js.map +1 -0
  25. package/dist/module/lib/Components/Point/utils.js +58 -15
  26. package/dist/module/lib/Components/Point/utils.js.map +1 -1
  27. package/dist/module/lib/Components/Point/utils.test.js +37 -75
  28. package/dist/module/lib/Components/Point/utils.test.js.map +1 -1
  29. package/dist/module/lib/Components/Scrubber/ScrubberProvider.js +2 -2
  30. package/dist/module/lib/Components/Scrubber/ScrubberProvider.js.map +1 -1
  31. package/dist/module/lib/utils/domain/domain.js +4 -4
  32. package/dist/module/lib/utils/domain/domain.js.map +1 -1
  33. package/dist/typescript/src/lib/Components/Line/Line.d.ts +1 -1
  34. package/dist/typescript/src/lib/Components/Line/Line.d.ts.map +1 -1
  35. package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts.map +1 -1
  36. package/dist/typescript/src/lib/Components/Point/Point.d.ts +1 -1
  37. package/dist/typescript/src/lib/Components/Point/Point.d.ts.map +1 -1
  38. package/dist/typescript/src/lib/Components/Point/constants.d.ts +2 -0
  39. package/dist/typescript/src/lib/Components/Point/constants.d.ts.map +1 -1
  40. package/dist/typescript/src/lib/Components/Point/pointContext/MagneticPointsProvider.d.ts.map +1 -1
  41. package/dist/typescript/src/lib/Components/Point/pointContext/index.d.ts +1 -1
  42. package/dist/typescript/src/lib/Components/Point/pointContext/index.d.ts.map +1 -1
  43. package/dist/typescript/src/lib/Components/Point/pointContext/magneticPointsContext.d.ts +22 -5
  44. package/dist/typescript/src/lib/Components/Point/pointContext/magneticPointsContext.d.ts.map +1 -1
  45. package/dist/typescript/src/lib/Components/Point/types.d.ts +32 -0
  46. package/dist/typescript/src/lib/Components/Point/types.d.ts.map +1 -1
  47. package/dist/typescript/src/lib/Components/Point/usePointGeometry.d.ts +33 -0
  48. package/dist/typescript/src/lib/Components/Point/usePointGeometry.d.ts.map +1 -0
  49. package/dist/typescript/src/lib/Components/Point/utils.d.ts +30 -4
  50. package/dist/typescript/src/lib/Components/Point/utils.d.ts.map +1 -1
  51. package/package.json +4 -4
  52. package/src/lib/Components/Line/Line.tsx +4 -4
  53. package/src/lib/Components/LineChart/LineChart.performance.test.tsx +101 -0
  54. package/src/lib/Components/LineChart/LineChart.tsx +18 -11
  55. package/src/lib/Components/Point/Point.test.tsx +46 -0
  56. package/src/lib/Components/Point/Point.tsx +79 -57
  57. package/src/lib/Components/Point/constants.ts +2 -0
  58. package/src/lib/Components/Point/pointContext/MagneticPointsProvider.test.tsx +13 -1
  59. package/src/lib/Components/Point/pointContext/MagneticPointsProvider.tsx +20 -8
  60. package/src/lib/Components/Point/pointContext/index.ts +4 -2
  61. package/src/lib/Components/Point/pointContext/magneticPointsContext.ts +29 -7
  62. package/src/lib/Components/Point/types.ts +41 -0
  63. package/src/lib/Components/Point/usePointGeometry.test.ts +95 -0
  64. package/src/lib/Components/Point/usePointGeometry.ts +77 -0
  65. package/src/lib/Components/Point/utils.test.ts +34 -80
  66. package/src/lib/Components/Point/utils.ts +77 -19
  67. package/src/lib/Components/Scrubber/ScrubberProvider.tsx +2 -2
  68. package/src/lib/utils/domain/domain.ts +4 -4
@@ -1 +1 @@
1
- {"version":3,"names":["computeXDomain","series","axisConfig","axisData","data","autoBounds","length","nums","min","max","i","value","maxLen","reduce","s","Math","applyDomainOverride","domain","computeYDomain","hasValue","v","undefined","computeDataLength","domainOverride"],"sourceRoot":"../../../../../src","sources":["lib/utils/domain/domain.ts"],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,GAAGA,CAC5BC,MAAgB,EAChBC,UAAmC,KACpB;EACf,MAAMC,QAAQ,GAAGD,UAAU,EAAEE,IAAI;EAEjC,IAAIC,UAAsB;EAE1B,IAAIF,QAAQ,IAAIA,QAAQ,CAACG,MAAM,GAAG,CAAC,EAAE;IACnC,IAAI,OAAOH,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;MACnC,MAAMI,IAAI,GAAGJ,QAAoB;MACjC,IAAIK,GAAG,GAAGD,IAAI,CAAC,CAAC,CAAC;MACjB,IAAIE,GAAG,GAAGF,IAAI,CAAC,CAAC,CAAC;MACjB,KAAK,IAAIG,CAAC,GAAG,CAA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xC,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["computeXDomain","series","axisConfig","axisData","data","autoBounds","length","nums","min","max","i","value","maxLen","reduce","s","Math","applyDomainOverride","domain","computeYDomain","hasValue","v","undefined","computeDataLength","domainOverride"],"sourceRoot":"../../../../../src","sources":["lib/utils/domain/domain.ts"],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,GAAGA,CAC5BC,MAAgB,EAChBC,UAAmC,KACpB;EACf,MAAMC,QAAQ,GAAGD,UAAU,EAAEE,IAAI;EAEjC,IAAIC,UAAsB;EAE1B,IAAIF,QAAQ,IAAIA,QAAQ,CAACG,MAAM,GAAG,CAAC,EAAE;IACnC,IAAI,OAAOH,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;MACnC,MAAMI,IAAI,GAAGJ,QAAoB;MACjC,IAAIK,GAAG,GAAGD,IAAI,CAAC,CAAC,CAAC;MACjB,IAAIE,GAAG,GAAGF,IAAI,CAAC,CAAC,CAAC;MACjB,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACD,MAAM,EAAEI,CAAC,IAAI,CAAC,EAAE;QACvC,MAAMC,KAAK,GAAGJ,IAAI,CAACG,CAAC,CAAC;QACrB,IAAIC,KAAK,GAAGH,GAAG,EAAEA,GAAG,GAAGG,KAAK;QAC5B,IAAIA,KAAK,GAAGF,GAAG,EAAEA,GAAG,GAAGE,KAAK;MAC9B;MACAN,UAAU,GAAG;QAAEG,GAAG;QAAEC;MAAI,CAAC;IAC3B,CAAC,MAAM;MACLJ,UAAU,GAAG;QAAEG,GAAG,EAAE,CAAC;QAAEC,GAAG,EAAEN,QAAQ,CAACG,MAAM,GAAG;MAAE,CAAC;IACnD;EACF,CAAC,MAAM;IACL,MAAMM,MAAM,GAAGX,MAAM,CAACY,MAAM,CAC1B,CAACJ,GAAG,EAAEK,CAAC,KAAKC,IAAI,CAACN,GAAG,CAACA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ChBC,UAAmC,KACxB;EACX,IAAIA,UAAU,EAAEE,IAAI,IAAIF,UAAU,CAACE,IAAI,CAACE,MAAM,GAAG,CAAC,EAAE;IAClD,OAAOJ,UAAU,CAACE,IAAI,CAACE,MAAM;EAC/B;EACA,OAAOL,MAAM,CAACY,MAAM,CAAC,CAACJ,GAAG,EAAEK,CAAC,KAAKC,IAAI,CAACN,GAAG,CAACA,GAAG,EAAEK,CAAC,CAACV,IAAI,EAAEE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,MAAMU,mBAAmB,GAAGA,CAC1BX,UAAsB,EACtBkB,cAAwC,KACzB;EACf,IAAI,CAACA,cAAc,EAAE,OAAOlB,UAAU;EAEtC,IAAI,OAAOkB,cAAc,KAAK,UAAU,EAAE;IACxC,OAAOA,cAAc,CAAClB,UAAU,CAAC;EACnC;EAEA,OAAO;IACLG,GAAG,EAAEe,cAAc,CAACf,GAAG,IAAIH,UAAU,CAACG,GAAG;IACzCC,GAAG,EAAEc,cAAc,CAACd,GAAG,IAAIJ,UAAU,CAACI;EACxC,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  import type { LineProps } from './types';
2
- export declare const Line: ({ seriesId, stroke, showArea, areaType: _areaType, curve, connectNulls, }: LineProps) => import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const Line: import("react").NamedExoticComponent<LineProps>;
3
3
  //# sourceMappingURL=Line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Line/Line.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,eAAO,MAAM,IAAI,GAAI,2EAOlB,SAAS,mDAkFX,CAAC"}
1
+ {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Line/Line.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,eAAO,MAAM,IAAI,iDAyFf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,SAAS,CAAC;AA0FjB,eAAO,MAAM,SAAS,GAAI,0MAmBvB,QAAQ,CAAC,cAAc,CAAC,4CAgF1B,CAAC"}
1
+ {"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,SAAS,CAAC;AA0FjB,eAAO,MAAM,SAAS,GAAI,0MAmBvB,QAAQ,CAAC,cAAc,CAAC,4CAuF1B,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import type { PointLabelProps, PointProps } from './types';
2
2
  export declare function PointLabel({ textAnchor, ...props }: Readonly<PointLabelProps>): import("react/jsx-runtime").JSX.Element;
3
- export declare function Point({ dataX, dataY, color, label, LabelComponent, labelPosition, hidePoint, showLabelArrow, size, onPress, magnetic, }: Readonly<PointProps>): import("react/jsx-runtime").JSX.Element | null;
3
+ export declare const Point: import("react").NamedExoticComponent<Readonly<PointProps>>;
4
4
  //# sourceMappingURL=Point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/Point.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAW3D,wBAAgB,UAAU,CAAC,EACzB,UAAqB,EACrB,GAAG,KAAK,EACT,EAAE,QAAQ,CAAC,eAAe,CAAC,2CAa3B;AAED,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,cAAc,EACd,aAAqB,EACrB,SAAiB,EACjB,cAAqB,EACrB,IAAmB,EACnB,OAAO,EACP,QAAgB,GACjB,EAAE,QAAQ,CAAC,UAAU,CAAC,kDA0DtB"}
1
+ {"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/Point.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,eAAe,EAEf,UAAU,EACX,MAAM,SAAS,CAAC;AAOjB,wBAAgB,UAAU,CAAC,EACzB,UAAqB,EACrB,GAAG,KAAK,EACT,EAAE,QAAQ,CAAC,eAAe,CAAC,2CAa3B;AAgCD,eAAO,MAAM,KAAK,4DAiEhB,CAAC"}
@@ -4,4 +4,6 @@ export declare const LABEL_FONT_SIZE = 10;
4
4
  export declare const ARROW_WIDTH = 6;
5
5
  export declare const ARROW_HEIGHT = 4;
6
6
  export declare const GAP = 4;
7
+ /** Approximate width of a character in the label font, as a ratio of the font size. Used to compute the label width. */
8
+ export declare const LABEL_CHAR_WIDTH_RATIO = 0.6;
7
9
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,GAAG,IAAI,CAAC;AACrB,wHAAwH;AACxH,eAAO,MAAM,sBAAsB,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MagneticPointsProvider.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Point/pointContext/MagneticPointsProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,GACT,EAAE,QAAQ,CAAC,2BAA2B,CAAC,2CA8BvC"}
1
+ {"version":3,"file":"MagneticPointsProvider.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Point/pointContext/MagneticPointsProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvC,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,GACT,EAAE,QAAQ,CAAC,2BAA2B,CAAC,2CAwCvC"}
@@ -1,3 +1,3 @@
1
- export { useMagneticPointsContext, type MagneticPointsContextValue, } from './magneticPointsContext';
1
+ export { useMagneticRegistry, useMagneticSnapshot, type MagneticRegistryValue, type MagneticSnapshotValue, } from './magneticPointsContext';
2
2
  export { MagneticPointsProvider } from './MagneticPointsProvider';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Point/pointContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Point/pointContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,13 +1,30 @@
1
- export type MagneticPointsContextValue = {
1
+ /**
2
+ * Stable registration API for magnetic points. Its identity never changes for
3
+ * the provider's lifetime, so consumers (every `Point`) do not re-render when
4
+ * the magnetic set changes — only when they mount/unmount.
5
+ */
6
+ export type MagneticRegistryValue = {
2
7
  register: (dataIndex: number) => void;
3
8
  unregister: (dataIndex: number) => void;
9
+ };
10
+ /**
11
+ * Mutable snapshot of the registered magnetic points. Changes on every
12
+ * register/unregister (via `version`) and is consumed only by the scrubber,
13
+ * which needs to recompute its snap targets when the set changes.
14
+ */
15
+ export type MagneticSnapshotValue = {
4
16
  version: number;
5
17
  getMagneticPoints: () => ReadonlySet<number>;
6
18
  };
7
- declare const MagneticPointsContextProvider: import("react").FC<{
19
+ declare const MagneticRegistryProvider: import("react").FC<{
20
+ children: import("react").ReactNode;
21
+ value: MagneticRegistryValue;
22
+ }>;
23
+ declare const MagneticSnapshotProvider: import("react").FC<{
8
24
  children: import("react").ReactNode;
9
- value: MagneticPointsContextValue;
25
+ value: MagneticSnapshotValue;
10
26
  }>;
11
- export declare const useMagneticPointsContext: () => MagneticPointsContextValue;
12
- export { MagneticPointsContextProvider };
27
+ export declare const useMagneticRegistry: () => MagneticRegistryValue;
28
+ export declare const useMagneticSnapshot: () => MagneticSnapshotValue;
29
+ export { MagneticRegistryProvider, MagneticSnapshotProvider };
13
30
  //# sourceMappingURL=magneticPointsContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"magneticPointsContext.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Point/pointContext/magneticPointsContext.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAO,6BAA6B;;;EAC6B,CAAC;AAElE,eAAO,MAAM,wBAAwB,QAAO,0BAIxC,CAAC;AAEL,OAAO,EAAE,6BAA6B,EAAE,CAAC"}
1
+ {"version":3,"file":"magneticPointsContext.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Point/pointContext/magneticPointsContext.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAO,wBAAwB;;;EAC+B,CAAC;AAE/D,QAAA,MAAO,wBAAwB;;;EAC+B,CAAC;AAE/D,eAAO,MAAM,mBAAmB,QAAO,qBAInC,CAAC;AAEL,eAAO,MAAM,mBAAmB,QAAO,qBAInC,CAAC;AAEL,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -7,6 +7,28 @@ export type PointLabelProps = {
7
7
  children: string;
8
8
  } & Omit<TextProps, 'x' | 'y' | 'children'>;
9
9
  export type PointLabelComponent = ComponentType<PointLabelProps>;
10
+ /**
11
+ * Horizontal alignment strategy for a point's label.
12
+ *
13
+ * - `'auto'`: keep the label inside the drawing area, anchoring it to the
14
+ * nearest edge when it would overflow.
15
+ * - `'center'`: always centre the label on the point.
16
+ */
17
+ export type LabelAlignment = 'center' | 'auto';
18
+ /**
19
+ * Pixel position and styling inputs shared by the point's rendered glyphs. Each
20
+ * glyph picks the subset it needs and derives its own pixel geometry (e.g.
21
+ * radius from `size`).
22
+ */
23
+ type PointGlyphProps = {
24
+ x: number;
25
+ y: number;
26
+ size: number;
27
+ color?: string;
28
+ position: 'top' | 'bottom';
29
+ };
30
+ export type PointMarkerProps = Pick<PointGlyphProps, 'x' | 'y' | 'size' | 'color'>;
31
+ export type PointArrowProps = Pick<PointGlyphProps, 'x' | 'y' | 'size' | 'position'>;
10
32
  export type PointProps = {
11
33
  /**
12
34
  * X coordinate in data space (index or explicit value).
@@ -77,5 +99,15 @@ export type PointProps = {
77
99
  * @default false
78
100
  */
79
101
  magnetic?: boolean;
102
+ /**
103
+ * Horizontal alignment of the label relative to the chart's drawing area.
104
+ * With `'auto'`, a label that would overflow the left/right edge is anchored
105
+ * to that edge and grows inward instead of being clipped, while the arrow
106
+ * keeps pointing at the exact data point. Use `'center'` to always centre the
107
+ * label on the point.
108
+ * @default 'auto'
109
+ */
110
+ labelAlignment?: LabelAlignment;
80
111
  };
112
+ export {};
81
113
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,C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jD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { DrawingArea } from '../../utils/types';
2
+ import type { BaseAxisProps } from '../Axis';
3
+ import { useRevealFadeProps } from '../CartesianChart/RevealAnimation';
4
+ import type { MagneticRegistryValue } from './pointContext/magneticPointsContext';
5
+ type Pixel = {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ type UsePointGeometryParams = {
10
+ dataX: number;
11
+ dataY: number;
12
+ magnetic: boolean;
13
+ };
14
+ type PointGeometry = {
15
+ pixel: Pixel | undefined;
16
+ drawingArea: DrawingArea;
17
+ fadeProps: ReturnType<typeof useRevealFadeProps>;
18
+ isVisible: boolean;
19
+ };
20
+ /**
21
+ * Resolves a point's chart geometry and behaviour: projects its data
22
+ * coordinates to pixels, registers it as a magnetic snap target when enabled,
23
+ * exposes the reveal-animation props, and reports whether it falls inside the
24
+ * drawing area.
25
+ */
26
+ export declare const usePointGeometry: ({ dataX, dataY, magnetic, }: UsePointGeometryParams) => PointGeometry;
27
+ /**
28
+ * Registers/unregisters a data index as a magnetic snap target
29
+ * when the Point has `magnetic` enabled.
30
+ */
31
+ export declare const useMagneticRegistration: (magnetic: boolean, dataX: number, getXAxisConfig: () => BaseAxisProps | undefined, { register, unregister }: MagneticRegistryValue) => void;
32
+ export {};
33
+ //# sourceMappingURL=usePointGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePointGeometry.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/usePointGeometry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAGlF,KAAK,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;IACjD,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,6BAI9B,sBAAsB,KAAG,aAqB3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,UAAU,OAAO,EACjB,OAAO,MAAM,EACb,gBAAgB,MAAM,aAAa,GAAG,SAAS,EAC/C,0BAA0B,qBAAqB,KAC9C,IAQF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { DrawingArea } from '../../utils/types';
2
2
  import type { BaseAxisProps } from '../Axis';
3
- import type { MagneticPointsContextValue } from './pointContext/magneticPointsContext';
3
+ import type { LabelAlignment } from './types';
4
+ export type LabelTextAnchor = 'start' | 'middle' | 'end';
4
5
  export declare const isWithinBounds: (px: number, py: number, area: DrawingArea) => boolean;
5
6
  /**
6
7
  * Builds the three SVG points of the arrow triangle.
@@ -15,12 +16,37 @@ export declare const buildArrowPoints: (cx: number, cy: number, radius: number,
15
16
  export declare const resolveLabel: (label: string | ((dataIndex: number) => string) | undefined, dataX: number) => string | undefined;
16
17
  export declare const resolveDataXToIndex: (dataX: number, axisConfig: BaseAxisProps | undefined) => number | undefined;
17
18
  /**
18
- * Registers/unregisters a data index as a magnetic snap target
19
- * when the Point has `magnetic` enabled.
19
+ * Computes the label's horizontal placement, keeping it inside the drawing area
20
+ * near the left/right edges. Centred on the point when it fits; otherwise
21
+ * anchored to the edge and aligned with the arrow's outer vertex (offset by half
22
+ * the arrow width from the point, when an arrow is rendered).
20
23
  */
21
- export declare const useMagneticRegistration: (magnetic: boolean, dataX: number, getXAxisConfig: () => BaseAxisProps | undefined, { register, unregister }: MagneticPointsContextValue) => void;
24
+ export declare const computeLabelX: (pixelX: number, label: string, area: DrawingArea, alignment: LabelAlignment, hasArrow: boolean) => {
25
+ x: number;
26
+ textAnchor: LabelTextAnchor;
27
+ };
22
28
  /**
23
29
  * Computes the vertical position of the label text baseline.
24
30
  */
25
31
  export declare const computeLabelY: (pixelY: number, radius: number, labelPosition: "top" | "bottom", renderArrow: boolean) => number;
32
+ /**
33
+ * Computes where a point's label and its connector arrow are drawn: the
34
+ * (optionally clamped) horizontal placement, the vertical baseline, and whether
35
+ * the arrow is rendered. Label content is resolved separately via
36
+ * {@link resolveLabel}.
37
+ */
38
+ export declare const computeLabelGeometry: ({ text, pixelX, pixelY, size, labelPosition, showLabelArrow, area, alignment, }: {
39
+ text: string;
40
+ pixelX: number;
41
+ pixelY: number;
42
+ size: number;
43
+ labelPosition: "top" | "bottom";
44
+ showLabelArrow: boolean;
45
+ area: DrawingArea;
46
+ alignment: LabelAlignment;
47
+ }) => {
48
+ x: number;
49
+ y: number;
50
+ textAnchor: LabelTextAnchor;
51
+ };
26
52
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,eAAO,MAAM,cAAc,GACzB,IAAI,MAAM,EACV,IAAI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3
+ "version": "0.1.24",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [
@@ -31,7 +31,7 @@
31
31
  "!**/*.tsbuildinfo"
32
32
  ],
33
33
  "dependencies": {
34
- "@ledgerhq/lumen-utils-shared": "0.1.5",
34
+ "@ledgerhq/lumen-utils-shared": "0.1.6",
35
35
  "d3-array": "^3.2.4",
36
36
  "d3-scale": "^4.0.2",
37
37
  "d3-shape": "^3.2.0"
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@types/react": "^19.0.0",
47
- "@ledgerhq/lumen-design-core": "0.1.17",
48
- "@ledgerhq/lumen-ui-rnative": "0.1.45",
47
+ "@ledgerhq/lumen-design-core": "0.1.18",
48
+ "@ledgerhq/lumen-ui-rnative": "0.1.47",
49
49
  "react": "^19.0.0",
50
50
  "react-native": "~0.81.6",
51
51
  "react-native-svg": "^15.0.0",
@@ -1,5 +1,5 @@
1
1
  import { useTheme } from '@ledgerhq/lumen-ui-rnative';
2
- import { useId, useMemo } from 'react';
2
+ import { useId, useMemo, memo } from 'react';
3
3
  import { Defs, G, LinearGradient, Path, Stop } from 'react-native-svg';
4
4
 
5
5
  import { isNumericScale } from '../../utils/scales/scales';
@@ -10,14 +10,14 @@ import { LINE_AREA_GRADIENT_OPACITY, LINE_STROKE_WIDTH } from './constants';
10
10
  import type { LineProps } from './types';
11
11
  import { buildAreaPath, buildLinePath, toScaledPoints } from './utils';
12
12
 
13
- export const Line = ({
13
+ export const Line = memo(function Line({
14
14
  seriesId,
15
15
  stroke,
16
16
  showArea = false,
17
17
  areaType: _areaType = 'gradient',
18
18
  curve,
19
19
  connectNulls,
20
- }: LineProps) => {
20
+ }: LineProps) {
21
21
  const { getXScale, getYScale, getXAxisConfig, drawingArea, seriesMap } =
22
22
  useCartesianChartContext();
23
23
  const clipPath = usePathReveal();
@@ -99,4 +99,4 @@ export const Line = ({
99
99
  />
100
100
  </G>
101
101
  );
102
- };
102
+ });
@@ -0,0 +1,101 @@
1
+ import { beforeEach, describe, expect, it } from '@jest/globals';
2
+ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
+ import { ThemeProvider } from '@ledgerhq/lumen-ui-rnative';
4
+ import { render } from '@testing-library/react-native';
5
+ import React, { Profiler } from 'react';
6
+ import type { ProfilerOnRenderCallback } from 'react';
7
+
8
+ import { Point } from '../Point';
9
+
10
+ import { LineChart } from './LineChart';
11
+
12
+ // Deterministic render budgets: assert on counts, never time, so CI never flakes.
13
+ // Native scrubbing is gesture/worklet driven and not simulable here, so the
14
+ // scrub re-render guard lives only in the React lib.
15
+
16
+ const POINT_COUNT = 24;
17
+
18
+ const buildData = (length: number): number[] =>
19
+ Array.from({ length }, (_, i) => (i % 9) + 1);
20
+
21
+ // Counts commits of the Point subtree itself (via React.Profiler) rather than a
22
+ // wrapper's renders. A wrapper counter sits above Point and never re-runs when a
23
+ // context Point consumes updates, so it would silently miss the version-cascade
24
+ // regression this budget guards against.
25
+ let pointMountCommits = 0;
26
+ let pointUpdateCommits = 0;
27
+ const onPointRender: ProfilerOnRenderCallback = (_id, phase) => {
28
+ if (phase === 'mount') {
29
+ pointMountCommits++;
30
+ } else {
31
+ pointUpdateCommits++;
32
+ }
33
+ };
34
+
35
+ const Wrapper = ({ children }: { children: React.ReactNode }) => (
36
+ <ThemeProvider themes={ledgerLiveThemes} colorScheme='light'>
37
+ {children}
38
+ </ThemeProvider>
39
+ );
40
+
41
+ beforeEach(() => {
42
+ pointMountCommits = 0;
43
+ pointUpdateCommits = 0;
44
+ });
45
+
46
+ describe('LineChart performance budgets', () => {
47
+ it('emits a bounded node count per point', () => {
48
+ const data = buildData(POINT_COUNT);
49
+
50
+ const { queryAllByTestId } = render(
51
+ <Wrapper>
52
+ <LineChart
53
+ series={[{ id: 's', stroke: '#000', data }]}
54
+ width={400}
55
+ height={200}
56
+ animate={false}
57
+ >
58
+ {data.map((value, index) => (
59
+ <Point key={index} dataX={index} dataY={value} />
60
+ ))}
61
+ </LineChart>
62
+ </Wrapper>,
63
+ );
64
+
65
+ const groups = queryAllByTestId('point-group');
66
+ const circles = queryAllByTestId('point-circle');
67
+ const arrows = queryAllByTestId('point-arrow');
68
+
69
+ expect(circles).toHaveLength(groups.length);
70
+ expect(arrows).toHaveLength(0);
71
+ expect(groups.length).toBeGreaterThan(0);
72
+ });
73
+
74
+ it('renders each magnetic point exactly once on mount (no version cascade)', () => {
75
+ const data = buildData(POINT_COUNT);
76
+
77
+ render(
78
+ <Wrapper>
79
+ <LineChart
80
+ series={[{ id: 's', stroke: '#000', data }]}
81
+ width={400}
82
+ height={200}
83
+ animate={false}
84
+ >
85
+ {data.map((value, index) => (
86
+ <Profiler
87
+ key={index}
88
+ id={`point-${index}`}
89
+ onRender={onPointRender}
90
+ >
91
+ <Point magnetic dataX={index} dataY={value} />
92
+ </Profiler>
93
+ ))}
94
+ </LineChart>
95
+ </Wrapper>,
96
+ );
97
+
98
+ expect(pointMountCommits).toBe(POINT_COUNT);
99
+ expect(pointUpdateCommits).toBe(0);
100
+ });
101
+ });
@@ -127,17 +127,24 @@ export const LineChart = ({
127
127
  emptyLabel = 'No data',
128
128
  connectNulls,
129
129
  }: Readonly<LineChartProps>) => {
130
- const xAxisConfig = {
131
- ...defaultXAxisProps,
132
- ...xAxis,
133
- position: xAxis?.position ?? defaultXAxisProps.position,
134
- };
135
- const yAxisConfig = {
136
- ...defaultYAxisProps,
137
- ...yAxis,
138
- position: yAxis?.position ?? defaultYAxisProps.position,
139
- width: yAxis?.width ?? defaultYAxisProps.width,
140
- };
130
+ const xAxisConfig = useMemo(
131
+ () => ({
132
+ ...defaultXAxisProps,
133
+ ...xAxis,
134
+ position: xAxis?.position ?? defaultXAxisProps.position,
135
+ }),
136
+ [xAxis],
137
+ );
138
+
139
+ const yAxisConfig = useMemo(
140
+ () => ({
141
+ ...defaultYAxisProps,
142
+ ...yAxis,
143
+ position: yAxis?.position ?? defaultYAxisProps.position,
144
+ width: yAxis?.width ?? defaultYAxisProps.width,
145
+ }),
146
+ [yAxis],
147
+ );
141
148
 
142
149
  const xAxisPosition = xAxisConfig.position;
143
150
  const yAxisPosition = yAxisConfig.position;
@@ -8,6 +8,7 @@ import { Text as SvgText } from 'react-native-svg';
8
8
  import { CartesianChart } from '../CartesianChart';
9
9
 
10
10
  import { Point } from './Point';
11
+ import type { PointLabelProps } from './types';
11
12
 
12
13
  const sampleSeries = [{ id: 's1', stroke: '#000', data: [10, 20, 30, 40, 50] }];
13
14
 
@@ -186,6 +187,51 @@ describe('Point', () => {
186
187
  expect(bottomY).toBeGreaterThan(topY);
187
188
  });
188
189
 
190
+ it('anchors a long label inward at the left edge by default', () => {
191
+ const labelSpy = jest.fn(({ x, y, children }: PointLabelProps) => (
192
+ <SvgText x={x} y={y}>
193
+ {children}
194
+ </SvgText>
195
+ ));
196
+
197
+ renderInChart(
198
+ <Point
199
+ dataX={0}
200
+ dataY={10}
201
+ label='A long edge label'
202
+ LabelComponent={labelSpy}
203
+ />,
204
+ );
205
+
206
+ expect(labelSpy).toHaveBeenCalledWith(
207
+ expect.objectContaining({ textAnchor: 'start' }),
208
+ undefined,
209
+ );
210
+ });
211
+
212
+ it("centres a long edge label when labelAlignment is 'center'", () => {
213
+ const labelSpy = jest.fn(({ x, y, children }: PointLabelProps) => (
214
+ <SvgText x={x} y={y}>
215
+ {children}
216
+ </SvgText>
217
+ ));
218
+
219
+ renderInChart(
220
+ <Point
221
+ dataX={0}
222
+ dataY={10}
223
+ label='A long edge label'
224
+ labelAlignment='center'
225
+ LabelComponent={labelSpy}
226
+ />,
227
+ );
228
+
229
+ expect(labelSpy).toHaveBeenCalledWith(
230
+ expect.objectContaining({ textAnchor: 'middle' }),
231
+ undefined,
232
+ );
233
+ });
234
+
189
235
  it('calls onPress when the point is pressed', () => {
190
236
  const onPress = jest.fn();
191
237
  const { getByTestId } = renderInChart(