@oanda/labs-widget-common 1.0.197 → 1.0.198

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/CHANGELOG.md CHANGED
@@ -3,6 +3,786 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.0.198 (2025-05-26)
7
+
8
+
9
+
10
+ ## 1.0.197 (2025-05-23)
11
+
12
+
13
+
14
+ ## 1.0.196 (2025-05-22)
15
+
16
+
17
+
18
+ ## 1.0.195 (2025-05-21)
19
+
20
+
21
+
22
+ ## 1.0.194 (2025-05-21)
23
+
24
+
25
+
26
+ ## 1.0.193 (2025-05-15)
27
+
28
+
29
+
30
+ ## 1.0.192 (2025-05-14)
31
+
32
+
33
+
34
+ ## 1.0.191 (2025-04-30)
35
+
36
+
37
+
38
+ ## 1.0.190 (2025-04-28)
39
+
40
+
41
+
42
+ ## 1.0.189 (2025-04-23)
43
+
44
+
45
+
46
+ ## 1.0.188 (2025-04-22)
47
+
48
+
49
+
50
+ ## 1.0.187 (2025-04-18)
51
+
52
+
53
+
54
+ ## 1.0.186 (2025-04-10)
55
+
56
+
57
+
58
+ ## 1.0.185 (2025-04-09)
59
+
60
+
61
+
62
+ ## 1.0.184 (2025-04-08)
63
+
64
+
65
+
66
+ ## 1.0.183 (2025-04-04)
67
+
68
+
69
+
70
+ ## 1.0.182 (2025-03-21)
71
+
72
+
73
+
74
+ ## 1.0.181 (2025-03-13)
75
+
76
+
77
+
78
+ ## 1.0.180 (2025-01-30)
79
+
80
+
81
+
82
+ ## 1.0.179 (2025-01-29)
83
+
84
+
85
+
86
+ ## 1.0.178 (2025-01-12)
87
+
88
+
89
+
90
+ ## 1.0.177 (2025-01-10)
91
+
92
+
93
+
94
+ ## 1.0.176 (2025-01-10)
95
+
96
+
97
+
98
+ ## 1.0.175 (2025-01-08)
99
+
100
+
101
+
102
+ ## 1.0.174 (2024-12-16)
103
+
104
+
105
+
106
+ ## 1.0.173 (2024-12-11)
107
+
108
+
109
+
110
+ ## 1.0.172 (2024-11-29)
111
+
112
+
113
+
114
+ ## 1.0.171 (2024-11-28)
115
+
116
+
117
+
118
+ ## 1.0.170 (2024-11-28)
119
+
120
+
121
+
122
+ ## 1.0.169 (2024-11-20)
123
+
124
+
125
+
126
+ ## 1.0.168 (2024-11-19)
127
+
128
+
129
+
130
+ ## 1.0.167 (2024-10-14)
131
+
132
+
133
+
134
+ ## 1.0.166 (2024-10-07)
135
+
136
+
137
+
138
+ ## 1.0.165 (2024-10-03)
139
+
140
+
141
+
142
+ ## 1.0.164 (2024-09-26)
143
+
144
+
145
+
146
+ ## 1.0.163 (2024-09-18)
147
+
148
+
149
+
150
+ ## 1.0.162 (2024-09-12)
151
+
152
+
153
+
154
+ ## 1.0.161 (2024-09-11)
155
+
156
+
157
+
158
+ ## 1.0.160 (2024-09-10)
159
+
160
+
161
+
162
+ ## 1.0.159 (2024-09-09)
163
+
164
+
165
+
166
+ ## 1.0.158 (2024-09-04)
167
+
168
+
169
+
170
+ ## 1.0.157 (2024-09-04)
171
+
172
+
173
+
174
+ ## 1.0.156 (2024-09-02)
175
+
176
+
177
+
178
+ ## 1.0.155 (2024-08-29)
179
+
180
+
181
+
182
+ ## 1.0.154 (2024-08-29)
183
+
184
+
185
+
186
+ ## 1.0.153 (2024-08-23)
187
+
188
+
189
+
190
+ ## 1.0.152 (2024-08-23)
191
+
192
+
193
+
194
+ ## 1.0.151 (2024-08-20)
195
+
196
+
197
+
198
+ ## 1.0.150 (2024-08-19)
199
+
200
+
201
+
202
+ ## 1.0.149 (2024-08-07)
203
+
204
+
205
+
206
+ ## 1.0.148 (2024-08-01)
207
+
208
+
209
+
210
+ ## 1.0.147 (2024-08-01)
211
+
212
+
213
+
214
+ ## 1.0.146 (2024-07-26)
215
+
216
+
217
+
218
+ ## 1.0.145 (2024-07-25)
219
+
220
+
221
+
222
+ ## 1.0.144 (2024-07-22)
223
+
224
+
225
+
226
+ ## 1.0.143 (2024-07-19)
227
+
228
+
229
+
230
+ ## 1.0.142 (2024-07-16)
231
+
232
+
233
+
234
+ ## 1.0.141 (2024-07-16)
235
+
236
+
237
+
238
+ ## 1.0.140 (2024-07-12)
239
+
240
+
241
+
242
+ ## 1.0.139 (2024-07-12)
243
+
244
+
245
+
246
+ ## 1.0.138 (2024-07-10)
247
+
248
+
249
+
250
+ ## 1.0.137 (2024-07-05)
251
+
252
+
253
+
254
+ ## 1.0.136 (2024-07-03)
255
+
256
+
257
+
258
+ ## 1.0.135 (2024-07-03)
259
+
260
+
261
+
262
+ ## 1.0.134 (2024-07-03)
263
+
264
+
265
+
266
+ ## 1.0.133 (2024-06-28)
267
+
268
+
269
+
270
+ ## 1.0.132 (2024-06-27)
271
+
272
+
273
+
274
+ ## 1.0.131 (2024-06-27)
275
+
276
+
277
+
278
+ ## 1.0.130 (2024-06-26)
279
+
280
+
281
+
282
+ ## 1.0.129 (2024-06-17)
283
+
284
+
285
+
286
+ ## 1.0.128 (2024-06-17)
287
+
288
+
289
+
290
+ ## 1.0.127 (2024-06-10)
291
+
292
+
293
+
294
+ ## 1.0.126 (2024-05-29)
295
+
296
+
297
+
298
+ ## 1.0.125 (2024-05-29)
299
+
300
+
301
+
302
+ ## 1.0.124 (2024-05-29)
303
+
304
+
305
+
306
+ ## 1.0.123 (2024-05-28)
307
+
308
+
309
+
310
+ ## 1.0.122 (2024-05-27)
311
+
312
+
313
+
314
+ ## 1.0.121 (2024-05-27)
315
+
316
+
317
+
318
+ ## 1.0.120 (2024-05-24)
319
+
320
+
321
+
322
+ ## 1.0.119 (2024-05-17)
323
+
324
+
325
+
326
+ ## 1.0.118 (2024-05-09)
327
+
328
+
329
+
330
+ ## 1.0.117 (2024-05-07)
331
+
332
+
333
+
334
+ ## 1.0.116 (2024-04-23)
335
+
336
+
337
+
338
+ ## 1.0.115 (2024-04-22)
339
+
340
+
341
+
342
+ ## 1.0.114 (2024-04-19)
343
+
344
+
345
+
346
+ ## 1.0.113 (2024-04-19)
347
+
348
+
349
+
350
+ ## 1.0.112 (2024-04-15)
351
+
352
+
353
+
354
+ ## 1.0.111 (2024-04-11)
355
+
356
+
357
+
358
+ ## 1.0.110 (2024-04-05)
359
+
360
+
361
+
362
+ ## 1.0.109 (2024-04-05)
363
+
364
+
365
+
366
+ ## 1.0.108 (2024-04-04)
367
+
368
+
369
+
370
+ ## 1.0.107 (2024-04-03)
371
+
372
+
373
+
374
+ ## 1.0.106 (2024-03-29)
375
+
376
+
377
+
378
+ ## 1.0.105 (2024-03-28)
379
+
380
+
381
+
382
+ ## 1.0.104 (2024-03-21)
383
+
384
+
385
+
386
+ ## 1.0.103 (2024-03-20)
387
+
388
+
389
+
390
+ ## 1.0.102 (2024-03-20)
391
+
392
+
393
+
394
+ ## 1.0.101 (2024-03-13)
395
+
396
+
397
+
398
+ ## 1.0.100 (2024-03-12)
399
+
400
+
401
+
402
+ ## 1.0.99 (2024-03-11)
403
+
404
+
405
+
406
+ ## 1.0.98 (2024-03-07)
407
+
408
+
409
+
410
+ ## 1.0.97 (2024-03-06)
411
+
412
+
413
+
414
+ ## 1.0.96 (2024-03-06)
415
+
416
+
417
+
418
+ ## 1.0.95 (2024-03-04)
419
+
420
+
421
+
422
+ ## 1.0.94 (2024-02-29)
423
+
424
+
425
+
426
+ ## 1.0.93 (2024-02-28)
427
+
428
+
429
+
430
+ ## 1.0.92 (2024-02-28)
431
+
432
+
433
+
434
+ ## 1.0.91 (2024-02-23)
435
+
436
+
437
+
438
+ ## 1.0.90 (2024-02-23)
439
+
440
+
441
+
442
+ ## 1.0.89 (2024-02-21)
443
+
444
+
445
+
446
+ ## 1.0.88 (2024-02-21)
447
+
448
+
449
+
450
+ ## 1.0.87 (2024-02-20)
451
+
452
+
453
+
454
+ ## 1.0.86 (2024-02-20)
455
+
456
+
457
+
458
+ ## 1.0.85 (2024-02-13)
459
+
460
+
461
+
462
+ ## 1.0.84 (2024-02-13)
463
+
464
+
465
+
466
+ ## 1.0.83 (2024-02-09)
467
+
468
+
469
+
470
+ ## 1.0.82 (2024-02-05)
471
+
472
+
473
+
474
+ ## 1.0.81 (2024-02-05)
475
+
476
+
477
+
478
+ ## 1.0.80 (2024-02-05)
479
+
480
+
481
+
482
+ ## 1.0.79 (2024-02-05)
483
+
484
+
485
+
486
+ ## 1.0.78 (2024-01-30)
487
+
488
+
489
+
490
+ ## 1.0.77 (2024-01-25)
491
+
492
+
493
+
494
+ ## 1.0.76 (2024-01-25)
495
+
496
+
497
+
498
+ ## 1.0.75 (2024-01-22)
499
+
500
+
501
+
502
+ ## 1.0.74 (2024-01-22)
503
+
504
+
505
+
506
+ ## 1.0.73 (2024-01-22)
507
+
508
+
509
+
510
+ ## 1.0.72 (2024-01-19)
511
+
512
+
513
+
514
+ ## 1.0.71 (2024-01-18)
515
+
516
+
517
+
518
+ ## 1.0.70 (2024-01-17)
519
+
520
+
521
+
522
+ ## 1.0.69 (2024-01-17)
523
+
524
+
525
+
526
+ ## 1.0.68 (2024-01-15)
527
+
528
+
529
+
530
+ ## 1.0.67 (2024-01-15)
531
+
532
+
533
+
534
+ ## 1.0.66 (2024-01-12)
535
+
536
+
537
+
538
+ ## 1.0.65 (2024-01-11)
539
+
540
+
541
+
542
+ ## 1.0.64 (2024-01-11)
543
+
544
+
545
+
546
+ ## 1.0.63 (2024-01-11)
547
+
548
+
549
+
550
+ ## 1.0.62 (2024-01-10)
551
+
552
+
553
+
554
+ ## 1.0.61 (2024-01-09)
555
+
556
+
557
+
558
+ ## 1.0.60 (2024-01-05)
559
+
560
+
561
+
562
+ ## 1.0.59 (2023-12-27)
563
+
564
+
565
+
566
+ ## 1.0.58 (2023-12-22)
567
+
568
+
569
+
570
+ ## 1.0.57 (2023-12-22)
571
+
572
+
573
+
574
+ ## 1.0.56 (2023-12-21)
575
+
576
+
577
+
578
+ ## 1.0.55 (2023-12-19)
579
+
580
+
581
+
582
+ ## 1.0.54 (2023-12-15)
583
+
584
+
585
+
586
+ ## 1.0.53 (2023-12-13)
587
+
588
+
589
+
590
+ ## 1.0.52 (2023-12-13)
591
+
592
+
593
+
594
+ ## 1.0.51 (2023-12-07)
595
+
596
+
597
+
598
+ ## 1.0.50 (2023-12-04)
599
+
600
+
601
+
602
+ ## 1.0.49 (2023-12-01)
603
+
604
+
605
+
606
+ ## 1.0.48 (2023-12-01)
607
+
608
+
609
+
610
+ ## 1.0.47 (2023-11-29)
611
+
612
+
613
+
614
+ ## 1.0.46 (2023-11-28)
615
+
616
+
617
+
618
+ ## 1.0.45 (2023-11-23)
619
+
620
+
621
+
622
+ ## 1.0.44 (2023-11-22)
623
+
624
+
625
+
626
+ ## 1.0.43 (2023-11-15)
627
+
628
+
629
+
630
+ ## 1.0.42 (2023-11-10)
631
+
632
+
633
+
634
+ ## 1.0.41 (2023-11-03)
635
+
636
+
637
+
638
+ ## 1.0.40 (2023-11-02)
639
+
640
+
641
+
642
+ ## 1.0.39 (2023-11-02)
643
+
644
+
645
+
646
+ ## 1.0.38 (2023-10-26)
647
+
648
+
649
+
650
+ ## 1.0.37 (2023-10-26)
651
+
652
+
653
+
654
+ ## 1.0.36 (2023-10-25)
655
+
656
+
657
+
658
+ ## 1.0.35 (2023-10-24)
659
+
660
+
661
+
662
+ ## 1.0.34 (2023-10-23)
663
+
664
+
665
+
666
+ ## 1.0.33 (2023-10-23)
667
+
668
+
669
+
670
+ ## 1.0.32 (2023-10-23)
671
+
672
+
673
+
674
+ ## 1.0.31 (2023-10-20)
675
+
676
+
677
+
678
+ ## 1.0.30 (2023-10-19)
679
+
680
+
681
+
682
+ ## 1.0.29 (2023-10-19)
683
+
684
+
685
+
686
+ ## 1.0.28 (2023-10-19)
687
+
688
+
689
+
690
+ ## 1.0.27 (2023-10-18)
691
+
692
+
693
+
694
+ ## 1.0.26 (2023-10-18)
695
+
696
+
697
+
698
+ ## 1.0.25 (2023-10-17)
699
+
700
+
701
+
702
+ ## 1.0.24 (2023-10-13)
703
+
704
+
705
+
706
+ ## 1.0.23 (2023-10-13)
707
+
708
+
709
+
710
+ ## 1.0.22 (2023-10-11)
711
+
712
+
713
+
714
+ ## 1.0.21 (2023-10-10)
715
+
716
+
717
+
718
+ ## 1.0.20 (2023-10-06)
719
+
720
+
721
+
722
+ ## 1.0.19 (2023-10-06)
723
+
724
+
725
+
726
+ ## 1.0.18 (2023-10-05)
727
+
728
+
729
+
730
+ ## 1.0.17 (2023-10-04)
731
+
732
+
733
+
734
+ ## 1.0.16 (2023-10-04)
735
+
736
+
737
+
738
+ ## 1.0.15 (2023-10-04)
739
+
740
+
741
+
742
+ ## 1.0.14 (2023-10-03)
743
+
744
+
745
+
746
+ ## 1.0.13 (2023-10-03)
747
+
748
+
749
+
750
+ ## 1.0.12 (2023-10-03)
751
+
752
+
753
+
754
+ ## 1.0.11 (2023-10-02)
755
+
756
+
757
+
758
+ ## 1.0.10 (2023-09-29)
759
+
760
+
761
+
762
+ ## 1.0.9 (2023-09-28)
763
+
764
+
765
+
766
+ ## 1.0.8 (2023-09-27)
767
+
768
+
769
+
770
+ ## 1.0.7 (2023-09-26)
771
+
772
+
773
+
774
+ ## 1.0.6 (2023-09-21)
775
+
776
+
777
+
778
+ ## 1.0.5 (2023-09-13)
779
+
780
+ **Note:** Version bump only for package @oanda/labs-widget-common
781
+
782
+
783
+
784
+
785
+
6
786
  ## 1.0.197 (2025-05-23)
7
787
 
8
788
 
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BaseChart = void 0;
7
+ var _core = _interopRequireDefault(require("echarts-for-react/lib/core"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
+ const BaseChart = exports.BaseChart = (0, _react.forwardRef)((_ref, ref) => {
14
+ let {
15
+ isDark,
16
+ chartHeight,
17
+ ...props
18
+ } = _ref;
19
+ const [ready, setReady] = (0, _react.useState)(false);
20
+ (0, _react.useEffect)(() => {
21
+ void document.fonts.ready.then(() => setReady(true));
22
+ }, []);
23
+ return _react.default.createElement(_core.default, _extends({}, props, {
24
+ ref: ref,
25
+ "data-testid": "charts-container",
26
+ showLoading: !ready,
27
+ style: {
28
+ height: `${chartHeight}px`,
29
+ width: '100%'
30
+ },
31
+ theme: isDark ? 'dark_theme' : 'light_theme'
32
+ }));
33
+ });
34
+ BaseChart.displayName = 'BaseChart';
35
+ //# sourceMappingURL=BaseChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseChart.js","names":["_core","_interopRequireDefault","require","_react","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","BaseChart","exports","forwardRef","_ref","ref","isDark","chartHeight","props","ready","setReady","useState","useEffect","document","fonts","then","createElement","showLoading","style","height","width","theme","displayName"],"sources":["../../../src/chart/BaseChart.tsx"],"sourcesContent":["import ReactEChartsCore from 'echarts-for-react/lib/core';\nimport type { EChartsReactProps } from 'echarts-for-react/lib/types';\nimport React, { forwardRef, useEffect, useState } from 'react';\n\nimport type { BaseChartRef } from './types';\n\ntype BaseChartProps = EChartsReactProps & {\n isDark: boolean;\n chartHeight: number;\n};\n\nexport const BaseChart = forwardRef<BaseChartRef, BaseChartProps>(\n ({ isDark, chartHeight, ...props }, ref) => {\n const [ready, setReady] = useState(false);\n\n useEffect(() => {\n void document.fonts.ready.then(() => setReady(true));\n }, []);\n\n return (\n <ReactEChartsCore\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n ref={ref}\n data-testid=\"charts-container\"\n showLoading={!ready}\n style={{\n height: `${chartHeight}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n );\n }\n);\n\nBaseChart.displayName = 'BaseChart';\n"],"mappings":"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","ignoreList":[]}
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _BaseChart = require("./BaseChart");
7
+ Object.keys(_BaseChart).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _BaseChart[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _BaseChart[key];
14
+ }
15
+ });
16
+ });
6
17
  var _getGridLines = require("./getGridLines");
7
18
  Object.keys(_getGridLines).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -47,4 +58,15 @@ Object.keys(_sharedOptions).forEach(function (key) {
47
58
  }
48
59
  });
49
60
  });
61
+ var _types = require("./types");
62
+ Object.keys(_types).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _types[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _types[key];
69
+ }
70
+ });
71
+ });
50
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_getGridLines","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getTheme","_getZoomControls","_sharedOptions"],"sources":["../../../src/chart/index.ts"],"sourcesContent":["export * from './getGridLines';\nexport * from './getTheme';\nexport * from './getZoomControls';\nexport * from './sharedOptions';\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,SAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,SAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,SAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,gBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,gBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,gBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,gBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,cAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,cAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,cAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,cAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_BaseChart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getGridLines","_getTheme","_getZoomControls","_sharedOptions","_types"],"sources":["../../../src/chart/index.ts"],"sourcesContent":["export * from './BaseChart';\nexport * from './getGridLines';\nexport * from './getTheme';\nexport * from './getZoomControls';\nexport * from './sharedOptions';\nexport * from './types';\n"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,SAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,SAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,SAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,SAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,gBAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,gBAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,gBAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,gBAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,cAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,cAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,cAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,cAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,MAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,MAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,MAAA,CAAAT,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/chart/types.ts"],"sourcesContent":["import type ReactEChartsCore from 'echarts-for-react/lib/core';\n\nexport type BaseChartRef = ReactEChartsCore;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import ReactEChartsCore from 'echarts-for-react/lib/core';
3
+ import React, { forwardRef, useEffect, useState } from 'react';
4
+ export const BaseChart = forwardRef((_ref, ref) => {
5
+ let {
6
+ isDark,
7
+ chartHeight,
8
+ ...props
9
+ } = _ref;
10
+ const [ready, setReady] = useState(false);
11
+ useEffect(() => {
12
+ void document.fonts.ready.then(() => setReady(true));
13
+ }, []);
14
+ return React.createElement(ReactEChartsCore, _extends({}, props, {
15
+ ref: ref,
16
+ "data-testid": "charts-container",
17
+ showLoading: !ready,
18
+ style: {
19
+ height: `${chartHeight}px`,
20
+ width: '100%'
21
+ },
22
+ theme: isDark ? 'dark_theme' : 'light_theme'
23
+ }));
24
+ });
25
+ BaseChart.displayName = 'BaseChart';
26
+ //# sourceMappingURL=BaseChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseChart.js","names":["ReactEChartsCore","React","forwardRef","useEffect","useState","BaseChart","_ref","ref","isDark","chartHeight","props","ready","setReady","document","fonts","then","createElement","_extends","showLoading","style","height","width","theme","displayName"],"sources":["../../../src/chart/BaseChart.tsx"],"sourcesContent":["import ReactEChartsCore from 'echarts-for-react/lib/core';\nimport type { EChartsReactProps } from 'echarts-for-react/lib/types';\nimport React, { forwardRef, useEffect, useState } from 'react';\n\nimport type { BaseChartRef } from './types';\n\ntype BaseChartProps = EChartsReactProps & {\n isDark: boolean;\n chartHeight: number;\n};\n\nexport const BaseChart = forwardRef<BaseChartRef, BaseChartProps>(\n ({ isDark, chartHeight, ...props }, ref) => {\n const [ready, setReady] = useState(false);\n\n useEffect(() => {\n void document.fonts.ready.then(() => setReady(true));\n }, []);\n\n return (\n <ReactEChartsCore\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n ref={ref}\n data-testid=\"charts-container\"\n showLoading={!ready}\n style={{\n height: `${chartHeight}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n );\n }\n);\n\nBaseChart.displayName = 'BaseChart';\n"],"mappings":";AAAA,OAAOA,gBAAgB,MAAM,4BAA4B;AAEzD,OAAOC,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAS9D,OAAO,MAAMC,SAAS,GAAGH,UAAU,CACjC,CAAAI,IAAA,EAAoCC,GAAG,KAAK;EAAA,IAA3C;IAAEC,MAAM;IAAEC,WAAW;IAAE,GAAGC;EAAM,CAAC,GAAAJ,IAAA;EAChC,MAAM,CAACK,KAAK,EAAEC,QAAQ,CAAC,GAAGR,QAAQ,CAAC,KAAK,CAAC;EAEzCD,SAAS,CAAC,MAAM;IACd,KAAKU,QAAQ,CAACC,KAAK,CAACH,KAAK,CAACI,IAAI,CAAC,MAAMH,QAAQ,CAAC,IAAI,CAAC,CAAC;EACtD,CAAC,EAAE,EAAE,CAAC;EAEN,OACEX,KAAA,CAAAe,aAAA,CAAChB,gBAAgB,EAAAiB,QAAA,KAEXP,KAAK;IACTH,GAAG,EAAEA,GAAI;IACT,eAAY,kBAAkB;IAC9BW,WAAW,EAAE,CAACP,KAAM;IACpBQ,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGX,WAAW,IAAI;MAC1BY,KAAK,EAAE;IACT,CAAE;IACFC,KAAK,EAAEd,MAAM,GAAG,YAAY,GAAG;EAAc,EAC9C,CAAC;AAEN,CACF,CAAC;AAEDH,SAAS,CAACkB,WAAW,GAAG,WAAW","ignoreList":[]}
@@ -1,5 +1,7 @@
1
+ export * from './BaseChart';
1
2
  export * from './getGridLines';
2
3
  export * from './getTheme';
3
4
  export * from './getZoomControls';
4
5
  export * from './sharedOptions';
6
+ export * from './types';
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/chart/index.ts"],"sourcesContent":["export * from './getGridLines';\nexport * from './getTheme';\nexport * from './getZoomControls';\nexport * from './sharedOptions';\n"],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,mBAAmB;AACjC,cAAc,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/chart/index.ts"],"sourcesContent":["export * from './BaseChart';\nexport * from './getGridLines';\nexport * from './getTheme';\nexport * from './getZoomControls';\nexport * from './sharedOptions';\nexport * from './types';\n"],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,mBAAmB;AACjC,cAAc,iBAAiB;AAC/B,cAAc,SAAS","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/chart/types.ts"],"sourcesContent":["import type ReactEChartsCore from 'echarts-for-react/lib/core';\n\nexport type BaseChartRef = ReactEChartsCore;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import ReactEChartsCore from 'echarts-for-react/lib/core';
2
+ import type { EChartsReactProps } from 'echarts-for-react/lib/types';
3
+ import React from 'react';
4
+ export declare const BaseChart: React.ForwardRefExoticComponent<EChartsReactProps & {
5
+ isDark: boolean;
6
+ chartHeight: number;
7
+ } & React.RefAttributes<ReactEChartsCore>>;
@@ -1,4 +1,6 @@
1
+ export * from './BaseChart';
1
2
  export * from './getGridLines';
2
3
  export * from './getTheme';
3
4
  export * from './getZoomControls';
4
5
  export * from './sharedOptions';
6
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ import type ReactEChartsCore from 'echarts-for-react/lib/core';
2
+ export type BaseChartRef = ReactEChartsCore;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-widget-common",
3
- "version": "1.0.197",
3
+ "version": "1.0.198",
4
4
  "description": "Labs Widget Common",
5
5
  "main": "dist/main/index.js",
6
6
  "module": "dist/module/index.js",
@@ -21,5 +21,5 @@
21
21
  "tailwind-merge": "2.2.2",
22
22
  "usehooks-ts": "3.0.2"
23
23
  },
24
- "gitHead": "ecd6f0edf62d64f6537ce92408ae285fc012e18e"
24
+ "gitHead": "083781981c17b38576e6e46122dca29abd250b34"
25
25
  }
@@ -0,0 +1,37 @@
1
+ import ReactEChartsCore from 'echarts-for-react/lib/core';
2
+ import type { EChartsReactProps } from 'echarts-for-react/lib/types';
3
+ import React, { forwardRef, useEffect, useState } from 'react';
4
+
5
+ import type { BaseChartRef } from './types';
6
+
7
+ type BaseChartProps = EChartsReactProps & {
8
+ isDark: boolean;
9
+ chartHeight: number;
10
+ };
11
+
12
+ export const BaseChart = forwardRef<BaseChartRef, BaseChartProps>(
13
+ ({ isDark, chartHeight, ...props }, ref) => {
14
+ const [ready, setReady] = useState(false);
15
+
16
+ useEffect(() => {
17
+ void document.fonts.ready.then(() => setReady(true));
18
+ }, []);
19
+
20
+ return (
21
+ <ReactEChartsCore
22
+ // eslint-disable-next-line react/jsx-props-no-spreading
23
+ {...props}
24
+ ref={ref}
25
+ data-testid="charts-container"
26
+ showLoading={!ready}
27
+ style={{
28
+ height: `${chartHeight}px`,
29
+ width: '100%',
30
+ }}
31
+ theme={isDark ? 'dark_theme' : 'light_theme'}
32
+ />
33
+ );
34
+ }
35
+ );
36
+
37
+ BaseChart.displayName = 'BaseChart';
@@ -1,4 +1,6 @@
1
+ export * from './BaseChart';
1
2
  export * from './getGridLines';
2
3
  export * from './getTheme';
3
4
  export * from './getZoomControls';
4
5
  export * from './sharedOptions';
6
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ import type ReactEChartsCore from 'echarts-for-react/lib/core';
2
+
3
+ export type BaseChartRef = ReactEChartsCore;
@@ -0,0 +1,121 @@
1
+ /* eslint-disable react/jsx-props-no-spreading */
2
+ import { act, render, screen } from '@testing-library/react';
3
+ import React from 'react';
4
+
5
+ import { BaseChart } from '../../src/chart/BaseChart';
6
+ import type { BaseChartRef } from '../../src/chart/types';
7
+
8
+ jest.mock('echarts-for-react/lib/core', () => {
9
+ const ReactMock = require('react');
10
+ const MockEChartsCore = ReactMock.forwardRef(
11
+ (props: any, ref: React.Ref<any>) => (
12
+ <div
13
+ ref={ref as any}
14
+ data-loading={props.showLoading}
15
+ data-testid="charts-container"
16
+ data-theme={props.theme}
17
+ style={props.style}
18
+ />
19
+ )
20
+ );
21
+ MockEChartsCore.displayName = 'MockEChartsCore';
22
+ return MockEChartsCore;
23
+ });
24
+
25
+ describe('BaseChart component', () => {
26
+ const defaultProps = {
27
+ isDark: false,
28
+ chartHeight: 400,
29
+ option: {
30
+ xAxis: {
31
+ type: 'category',
32
+ data: ['Mon', 'Tue', 'Wed'],
33
+ },
34
+ yAxis: {
35
+ type: 'value',
36
+ },
37
+ series: [
38
+ {
39
+ data: [120, 200, 150],
40
+ type: 'line',
41
+ },
42
+ ],
43
+ },
44
+ };
45
+
46
+ let resolveFontsReady: (value?: unknown) => void;
47
+
48
+ beforeEach(() => {
49
+ Object.defineProperty(document, 'fonts', {
50
+ value: {
51
+ ready: new Promise((resolve) => {
52
+ resolveFontsReady = resolve;
53
+ }),
54
+ },
55
+ writable: true,
56
+ });
57
+ });
58
+
59
+ it('should show loading state initially', () => {
60
+ render(<BaseChart {...defaultProps} />);
61
+ const chart = screen.getByTestId('charts-container');
62
+ expect(chart).toHaveAttribute('data-loading', 'true');
63
+ });
64
+
65
+ it('should render chart after fonts are ready', async () => {
66
+ render(<BaseChart {...defaultProps} />);
67
+
68
+ const chart = screen.getByTestId('charts-container');
69
+ expect(chart).toHaveAttribute('data-loading', 'true');
70
+
71
+ await act(async () => {
72
+ resolveFontsReady();
73
+ await document.fonts.ready;
74
+ });
75
+
76
+ expect(chart).toHaveAttribute('data-loading', 'false');
77
+ });
78
+
79
+ it('should apply dark theme when isDark is true', async () => {
80
+ render(<BaseChart {...defaultProps} isDark={true} />);
81
+
82
+ await act(async () => {
83
+ resolveFontsReady();
84
+ await document.fonts.ready;
85
+ });
86
+
87
+ const chart = screen.getByTestId('charts-container');
88
+ expect(chart).toHaveAttribute('data-theme', 'dark_theme');
89
+ });
90
+
91
+ it('should apply light theme when isDark is false', async () => {
92
+ render(<BaseChart {...defaultProps} isDark={false} />);
93
+
94
+ await act(async () => {
95
+ resolveFontsReady();
96
+ await document.fonts.ready;
97
+ });
98
+
99
+ const chart = screen.getByTestId('charts-container');
100
+ expect(chart).toHaveAttribute('data-theme', 'light_theme');
101
+ });
102
+
103
+ it('should set correct chart height', async () => {
104
+ const height = 500;
105
+ render(<BaseChart {...defaultProps} chartHeight={height} />);
106
+
107
+ await act(async () => {
108
+ resolveFontsReady();
109
+ await document.fonts.ready;
110
+ });
111
+
112
+ const chart = screen.getByTestId('charts-container');
113
+ expect(chart).toHaveStyle({ height: `${height}px` });
114
+ });
115
+
116
+ it('should forward ref to BaseChartRef', () => {
117
+ const ref = React.createRef<BaseChartRef>();
118
+ render(<BaseChart {...defaultProps} ref={ref} />);
119
+ expect(ref.current).toBeTruthy();
120
+ });
121
+ });
package/test/setup.ts ADDED
@@ -0,0 +1,16 @@
1
+ // Mock document.fonts.ready
2
+ if (!document.fonts) {
3
+ Object.defineProperty(document, 'fonts', {
4
+ value: {
5
+ ready: Promise.resolve(),
6
+ check: () => true,
7
+ load: () => Promise.resolve([]),
8
+ },
9
+ configurable: true,
10
+ });
11
+ } else if (!('ready' in document.fonts)) {
12
+ Object.defineProperty(document.fonts, 'ready', {
13
+ value: Promise.resolve(),
14
+ configurable: true,
15
+ });
16
+ }