@coinbase/cds-mobile 9.13.0 → 9.15.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 (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dts/accordion/Accordion.d.ts +11 -1
  3. package/dts/accordion/Accordion.d.ts.map +1 -1
  4. package/dts/accordion/AccordionHeader.d.ts +33 -5
  5. package/dts/accordion/AccordionHeader.d.ts.map +1 -1
  6. package/dts/accordion/AccordionItem.d.ts +25 -17
  7. package/dts/accordion/AccordionItem.d.ts.map +1 -1
  8. package/dts/accordion/AccordionPanel.d.ts +6 -2
  9. package/dts/accordion/AccordionPanel.d.ts.map +1 -1
  10. package/dts/collapsible/Collapsible.d.ts +5 -2
  11. package/dts/collapsible/Collapsible.d.ts.map +1 -1
  12. package/dts/controls/Switch.d.ts +10 -1
  13. package/dts/controls/Switch.d.ts.map +1 -1
  14. package/dts/core/componentConfig.d.ts +2 -0
  15. package/dts/core/componentConfig.d.ts.map +1 -1
  16. package/dts/tabs/SegmentedTabs.d.ts +10 -2
  17. package/dts/tabs/SegmentedTabs.d.ts.map +1 -1
  18. package/dts/visualizations/chart/axis/Axis.d.ts +12 -0
  19. package/dts/visualizations/chart/axis/Axis.d.ts.map +1 -1
  20. package/dts/visualizations/chart/axis/AxisTickLabelOverflowMask.d.ts +11 -0
  21. package/dts/visualizations/chart/axis/AxisTickLabelOverflowMask.d.ts.map +1 -0
  22. package/dts/visualizations/chart/axis/XAxis.d.ts.map +1 -1
  23. package/dts/visualizations/chart/axis/YAxis.d.ts.map +1 -1
  24. package/dts/visualizations/chart/axis/index.d.ts +1 -0
  25. package/dts/visualizations/chart/axis/index.d.ts.map +1 -1
  26. package/dts/visualizations/chart/line/ReferenceLine.d.ts +1 -0
  27. package/dts/visualizations/chart/line/ReferenceLine.d.ts.map +1 -1
  28. package/dts/visualizations/chart/text/ChartText.d.ts +20 -3
  29. package/dts/visualizations/chart/text/ChartText.d.ts.map +1 -1
  30. package/esm/accordion/Accordion.js +6 -2
  31. package/esm/accordion/AccordionHeader.js +49 -15
  32. package/esm/accordion/AccordionItem.js +40 -6
  33. package/esm/accordion/AccordionPanel.js +3 -1
  34. package/esm/collapsible/Collapsible.js +4 -2
  35. package/esm/controls/Switch.js +25 -4
  36. package/esm/controls/__stories__/Switch.stories.js +26 -1
  37. package/esm/tabs/SegmentedTabs.js +24 -5
  38. package/esm/visualizations/chart/axis/AxisTickLabelOverflowMask.js +44 -0
  39. package/esm/visualizations/chart/axis/XAxis.js +23 -10
  40. package/esm/visualizations/chart/axis/YAxis.js +23 -10
  41. package/esm/visualizations/chart/axis/__stories__/Axis.stories.js +276 -121
  42. package/esm/visualizations/chart/axis/index.js +1 -0
  43. package/esm/visualizations/chart/scrubber/DefaultScrubberBeaconLabel.js +1 -1
  44. package/esm/visualizations/chart/text/ChartText.js +21 -19
  45. package/package.json +2 -2
@@ -1,55 +1,58 @@
1
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 { memo, useCallback, useMemo } from 'react';
2
+ import { memo, useCallback, useMemo, useState } from 'react';
3
+ import { IconButton } from '../../../../buttons';
3
4
  import { Example, ExampleScreen } from '../../../../examples/ExampleScreen';
4
5
  import { useTheme } from '../../../../hooks/useTheme';
6
+ import { HStack, VStack } from '../../../../layout';
7
+ import { Text } from '../../../../typography';
5
8
  import { BarPlot } from '../../bar';
6
9
  import { CartesianChart } from '../../CartesianChart';
7
10
  import { LineChart, SolidLine } from '../../line';
8
11
  import { Line } from '../../line/Line';
9
12
  import { Scrubber } from '../../scrubber/Scrubber';
10
13
  import { XAxis, YAxis } from '..';
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
15
  const defaultChartHeight = 250;
13
16
  const ThinSolidLine = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SolidLine, _extends({}, props, {
14
17
  strokeWidth: 1
15
18
  })));
19
+ const data = [{
20
+ name: 'Page A',
21
+ uv: 4000,
22
+ pv: 2400,
23
+ amt: 2400
24
+ }, {
25
+ name: 'Page B',
26
+ uv: 3000,
27
+ pv: 1398,
28
+ amt: 2210
29
+ }, {
30
+ name: 'Page C',
31
+ uv: 2000,
32
+ pv: 9800,
33
+ amt: 2290
34
+ }, {
35
+ name: 'Page D',
36
+ uv: 2780,
37
+ pv: 3908,
38
+ amt: 2000
39
+ }, {
40
+ name: 'Page E',
41
+ uv: 1890,
42
+ pv: 4800,
43
+ amt: 2181
44
+ }, {
45
+ name: 'Page F',
46
+ uv: 2390,
47
+ pv: 3800,
48
+ amt: 2500
49
+ }, {
50
+ name: 'Page G',
51
+ uv: 3490,
52
+ pv: 4300,
53
+ amt: 2100
54
+ }];
16
55
  const Simple = () => {
17
- const data = [{
18
- name: 'Page A',
19
- uv: 4000,
20
- pv: 2400,
21
- amt: 2400
22
- }, {
23
- name: 'Page B',
24
- uv: 3000,
25
- pv: 1398,
26
- amt: 2210
27
- }, {
28
- name: 'Page C',
29
- uv: 2000,
30
- pv: 9800,
31
- amt: 2290
32
- }, {
33
- name: 'Page D',
34
- uv: 2780,
35
- pv: 3908,
36
- amt: 2000
37
- }, {
38
- name: 'Page E',
39
- uv: 1890,
40
- pv: 4800,
41
- amt: 2181
42
- }, {
43
- name: 'Page F',
44
- uv: 2390,
45
- pv: 3800,
46
- amt: 2500
47
- }, {
48
- name: 'Page G',
49
- uv: 3490,
50
- pv: 4300,
51
- amt: 2100
52
- }];
53
56
  const pageViews = data.map(d => d.pv);
54
57
  const pageNames = data.map(d => d.name);
55
58
  const pageUniqueVisitors = data.map(d => d.uv);
@@ -457,80 +460,180 @@ const LineChartOnBandScale = _ref2 => {
457
460
  })]
458
461
  });
459
462
  };
460
- const AxisStories = () => {
461
- return /*#__PURE__*/_jsxs(ExampleScreen, {
462
- children: [/*#__PURE__*/_jsx(Example, {
463
- title: "Basic",
464
- children: /*#__PURE__*/_jsx(Simple, {})
465
- }), /*#__PURE__*/_jsx(Example, {
466
- title: "Time of Day",
467
- children: /*#__PURE__*/_jsx(TimeOfDayAxesExample, {})
468
- }), /*#__PURE__*/_jsx(Example, {
469
- title: "Multiple Axes on Same Side",
470
- children: /*#__PURE__*/_jsx(MultipleYAxesExample, {})
471
- }), /*#__PURE__*/_jsx(Example, {
472
- title: "Strict Domain Limit",
473
- children: /*#__PURE__*/_jsx(DomainLimitType, {
474
- limit: "strict"
475
- })
476
- }), /*#__PURE__*/_jsx(Example, {
477
- title: "Nice Domain Limit",
478
- children: /*#__PURE__*/_jsx(DomainLimitType, {
479
- limit: "nice"
480
- })
481
- }), /*#__PURE__*/_jsx(Example, {
482
- title: "Band Axis Grid Alignment",
483
- children: /*#__PURE__*/_jsxs(CartesianChart, {
484
- height: 350,
485
- inset: 8,
486
- series: [{
487
- id: 'prices',
488
- data: [10, 22, 29, 45, 98, 45, 22]
489
- }],
490
- xAxis: {
491
- scaleType: 'band',
492
- data: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
493
- },
494
- yAxis: {
495
- domain: {
496
- min: 0
497
- }
498
- },
499
- children: [/*#__PURE__*/_jsx(XAxis, {
500
- showGrid: true,
501
- showLine: true,
502
- showTickMarks: true,
503
- label: "Default"
504
- }), /*#__PURE__*/_jsx(XAxis, {
505
- showLine: true,
506
- showTickMarks: true,
507
- bandTickMarkPlacement: "start",
508
- label: "Start"
509
- }), /*#__PURE__*/_jsx(XAxis, {
510
- showLine: true,
511
- showTickMarks: true,
512
- bandTickMarkPlacement: "end",
513
- label: "End"
514
- }), /*#__PURE__*/_jsx(XAxis, {
515
- showLine: true,
516
- showTickMarks: true,
517
- bandTickMarkPlacement: "middle",
518
- label: "Middle"
519
- }), /*#__PURE__*/_jsx(XAxis, {
520
- showLine: true,
521
- showTickMarks: true,
522
- bandTickMarkPlacement: "edges",
523
- label: "Edges"
524
- }), /*#__PURE__*/_jsx(BarPlot, {})]
525
- })
526
- }), /*#__PURE__*/_jsx(Example, {
527
- title: "Band Scale - Tick Filtering",
528
- children: /*#__PURE__*/_jsx(BandScaleTickFiltering, {})
529
- }), /*#__PURE__*/_jsx(Example, {
530
- title: "Band Scale - Explicit Ticks",
531
- children: /*#__PURE__*/_jsx(BandScaleExplicitTicks, {})
532
- }), /*#__PURE__*/_jsxs(Example, {
533
- title: "Line Chart on Band Scale - Grid Positions",
463
+ const tickLabelOverflowModes = ['reposition', 'fade', 'visible'];
464
+ const ordinalLabels = ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th'];
465
+ const overflowSeriesData = [10, 22, 29, 45, 98, 45, 22];
466
+ const TickLabelOverflowYAxes = () => {
467
+ return /*#__PURE__*/_jsxs(CartesianChart, {
468
+ height: 320,
469
+ series: [{
470
+ id: 'line1',
471
+ data: overflowSeriesData
472
+ }],
473
+ yAxis: {
474
+ domain: {
475
+ min: 0
476
+ }
477
+ },
478
+ inset: 0,
479
+ children: [tickLabelOverflowModes.map(tickLabelOverflow => /*#__PURE__*/_jsx(YAxis, {
480
+ position: "left",
481
+ tickLabelOverflow: tickLabelOverflow,
482
+ width: 30
483
+ }, "left-" + tickLabelOverflow)), tickLabelOverflowModes.map(tickLabelOverflow => /*#__PURE__*/_jsx(YAxis, {
484
+ position: "right",
485
+ tickLabelOverflow: tickLabelOverflow,
486
+ width: 30
487
+ }, "right-" + tickLabelOverflow)), /*#__PURE__*/_jsx(Line, {
488
+ seriesId: "line1"
489
+ })]
490
+ });
491
+ };
492
+ const TickLabelOverflowXAxes = () => {
493
+ return /*#__PURE__*/_jsxs(CartesianChart, {
494
+ height: 420,
495
+ series: [{
496
+ id: 'line1',
497
+ data: overflowSeriesData
498
+ }],
499
+ xAxis: {
500
+ data: ordinalLabels
501
+ },
502
+ yAxis: {
503
+ domain: {
504
+ min: 0
505
+ }
506
+ },
507
+ inset: 0,
508
+ children: [tickLabelOverflowModes.map(tickLabelOverflow => /*#__PURE__*/_jsx(XAxis, {
509
+ showLine: true,
510
+ showTickMarks: true,
511
+ label: tickLabelOverflow,
512
+ position: "bottom",
513
+ tickLabelOverflow: tickLabelOverflow
514
+ }, "bottom-" + tickLabelOverflow)), tickLabelOverflowModes.map(tickLabelOverflow => /*#__PURE__*/_jsx(XAxis, {
515
+ showLine: true,
516
+ showTickMarks: true,
517
+ label: tickLabelOverflow,
518
+ position: "top",
519
+ tickLabelOverflow: tickLabelOverflow
520
+ }, "top-" + tickLabelOverflow)), /*#__PURE__*/_jsx(Line, {
521
+ seriesId: "line1"
522
+ })]
523
+ });
524
+ };
525
+ const TickLabelOverflowAllSides = () => {
526
+ const theme = useTheme();
527
+ return /*#__PURE__*/_jsxs(CartesianChart, {
528
+ height: 250,
529
+ series: [{
530
+ id: 'line1',
531
+ data: overflowSeriesData,
532
+ color: theme.color.accentBoldBlue
533
+ }],
534
+ xAxis: {
535
+ data: ordinalLabels
536
+ },
537
+ yAxis: {
538
+ domain: {
539
+ min: 0,
540
+ max: 100
541
+ }
542
+ },
543
+ inset: 0,
544
+ children: [/*#__PURE__*/_jsx(XAxis, {
545
+ showLine: true,
546
+ showTickMarks: true,
547
+ label: "Fade",
548
+ position: "bottom",
549
+ tickLabelOverflow: "fade"
550
+ }), /*#__PURE__*/_jsx(YAxis, {
551
+ showLine: true,
552
+ showTickMarks: true,
553
+ label: "Visible",
554
+ position: "left",
555
+ tickLabelOverflow: "visible"
556
+ }), /*#__PURE__*/_jsx(Line, {
557
+ curve: "natural",
558
+ seriesId: "line1"
559
+ })]
560
+ });
561
+ };
562
+ function ExampleNavigator() {
563
+ const [currentIndex, setCurrentIndex] = useState(0);
564
+ const examples = useMemo(() => [{
565
+ title: 'Basic',
566
+ component: /*#__PURE__*/_jsx(Simple, {})
567
+ }, {
568
+ title: 'Time of Day',
569
+ component: /*#__PURE__*/_jsx(TimeOfDayAxesExample, {})
570
+ }, {
571
+ title: 'Multiple Axes on Same Side',
572
+ component: /*#__PURE__*/_jsx(MultipleYAxesExample, {})
573
+ }, {
574
+ title: 'Strict Domain Limit',
575
+ component: /*#__PURE__*/_jsx(DomainLimitType, {
576
+ limit: "strict"
577
+ })
578
+ }, {
579
+ title: 'Nice Domain Limit',
580
+ component: /*#__PURE__*/_jsx(DomainLimitType, {
581
+ limit: "nice"
582
+ })
583
+ }, {
584
+ title: 'Band Axis Grid Alignment',
585
+ component: /*#__PURE__*/_jsxs(CartesianChart, {
586
+ height: 350,
587
+ inset: 8,
588
+ series: [{
589
+ id: 'prices',
590
+ data: [10, 22, 29, 45, 98, 45, 22]
591
+ }],
592
+ xAxis: {
593
+ scaleType: 'band',
594
+ data: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
595
+ },
596
+ yAxis: {
597
+ domain: {
598
+ min: 0
599
+ }
600
+ },
601
+ children: [/*#__PURE__*/_jsx(XAxis, {
602
+ showGrid: true,
603
+ showLine: true,
604
+ showTickMarks: true,
605
+ label: "Default"
606
+ }), /*#__PURE__*/_jsx(XAxis, {
607
+ showLine: true,
608
+ showTickMarks: true,
609
+ bandTickMarkPlacement: "start",
610
+ label: "Start"
611
+ }), /*#__PURE__*/_jsx(XAxis, {
612
+ showLine: true,
613
+ showTickMarks: true,
614
+ bandTickMarkPlacement: "end",
615
+ label: "End"
616
+ }), /*#__PURE__*/_jsx(XAxis, {
617
+ showLine: true,
618
+ showTickMarks: true,
619
+ bandTickMarkPlacement: "middle",
620
+ label: "Middle"
621
+ }), /*#__PURE__*/_jsx(XAxis, {
622
+ showLine: true,
623
+ showTickMarks: true,
624
+ bandTickMarkPlacement: "edges",
625
+ label: "Edges"
626
+ }), /*#__PURE__*/_jsx(BarPlot, {})]
627
+ })
628
+ }, {
629
+ title: 'Band Scale - Tick Filtering',
630
+ component: /*#__PURE__*/_jsx(BandScaleTickFiltering, {})
631
+ }, {
632
+ title: 'Band Scale - Explicit Ticks',
633
+ component: /*#__PURE__*/_jsx(BandScaleExplicitTicks, {})
634
+ }, {
635
+ title: 'Line Chart on Band Scale - Grid Positions',
636
+ component: /*#__PURE__*/_jsxs(_Fragment, {
534
637
  children: [/*#__PURE__*/_jsx(LineChartOnBandScale, {
535
638
  bandGridLinePlacement: "edges"
536
639
  }), /*#__PURE__*/_jsx(LineChartOnBandScale, {
@@ -540,13 +643,65 @@ const AxisStories = () => {
540
643
  }), /*#__PURE__*/_jsx(LineChartOnBandScale, {
541
644
  bandGridLinePlacement: "end"
542
645
  })]
543
- }), /*#__PURE__*/_jsx(Example, {
544
- title: "Axes on All Sides",
545
- children: /*#__PURE__*/_jsx(AxesOnAllSides, {})
546
- }), /*#__PURE__*/_jsx(Example, {
547
- title: "Custom Tick Mark Sizes",
548
- children: /*#__PURE__*/_jsx(CustomTickMarkSizes, {})
549
- })]
646
+ })
647
+ }, {
648
+ title: 'Axes on All Sides',
649
+ component: /*#__PURE__*/_jsx(AxesOnAllSides, {})
650
+ }, {
651
+ title: 'Custom Tick Mark Sizes',
652
+ component: /*#__PURE__*/_jsx(CustomTickMarkSizes, {})
653
+ }, {
654
+ title: 'Y Axis Label Repositioning',
655
+ component: /*#__PURE__*/_jsx(TickLabelOverflowYAxes, {})
656
+ }, {
657
+ title: 'X Axis Label Repositioning',
658
+ component: /*#__PURE__*/_jsx(TickLabelOverflowXAxes, {})
659
+ }, {
660
+ title: 'Ineffective Repositioning',
661
+ component: /*#__PURE__*/_jsx(TickLabelOverflowAllSides, {})
662
+ }], []);
663
+ const currentExample = examples[currentIndex];
664
+ const handlePrevious = useCallback(() => {
665
+ setCurrentIndex(prev => (prev - 1 + examples.length) % examples.length);
666
+ }, [examples.length]);
667
+ const handleNext = useCallback(() => {
668
+ setCurrentIndex(prev => (prev + 1) % examples.length);
669
+ }, [examples.length]);
670
+ return /*#__PURE__*/_jsx(ExampleScreen, {
671
+ paddingX: 0,
672
+ children: /*#__PURE__*/_jsxs(VStack, {
673
+ gap: 4,
674
+ children: [/*#__PURE__*/_jsxs(HStack, {
675
+ alignItems: "center",
676
+ justifyContent: "space-between",
677
+ padding: 2,
678
+ children: [/*#__PURE__*/_jsx(IconButton, {
679
+ accessibilityHint: "Navigate to previous example",
680
+ accessibilityLabel: "Previous",
681
+ name: "arrowLeft",
682
+ onPress: handlePrevious,
683
+ variant: "secondary"
684
+ }), /*#__PURE__*/_jsxs(VStack, {
685
+ alignItems: "center",
686
+ children: [/*#__PURE__*/_jsx(Text, {
687
+ font: "title3",
688
+ children: currentExample.title
689
+ }), /*#__PURE__*/_jsxs(Text, {
690
+ color: "fgMuted",
691
+ font: "label1",
692
+ children: [currentIndex + 1, " / ", examples.length]
693
+ })]
694
+ }), /*#__PURE__*/_jsx(IconButton, {
695
+ accessibilityHint: "Navigate to next example",
696
+ accessibilityLabel: "Next",
697
+ name: "arrowRight",
698
+ onPress: handleNext,
699
+ variant: "secondary"
700
+ })]
701
+ }), /*#__PURE__*/_jsx(Example, {
702
+ children: currentExample.component
703
+ })]
704
+ })
550
705
  });
551
- };
552
- export default AxisStories;
706
+ }
707
+ export default ExampleNavigator;
@@ -1,5 +1,6 @@
1
1
  // codegen:start {preset: barrel, include: ./*.tsx, exclude: ./__stories__/*.tsx}
2
2
  export * from './Axis';
3
+ export * from './AxisTickLabelOverflowMask';
3
4
  export * from './DefaultAxisTickLabel';
4
5
  export * from './XAxis';
5
6
  export * from './YAxis';
@@ -29,13 +29,13 @@ export const DefaultScrubberBeaconLabel = /*#__PURE__*/memo(_ref => {
29
29
  chartTextProps = _objectWithoutPropertiesLoose(_ref, _excluded);
30
30
  const theme = useTheme();
31
31
  return /*#__PURE__*/_jsx(ChartText, _extends({
32
- disableRepositioning: true,
33
32
  background: background != null ? background : theme.color.bg,
34
33
  borderRadius: borderRadius,
35
34
  color: color != null ? color : theme.color.fgPrimary,
36
35
  elevated: elevated,
37
36
  font: font,
38
37
  inset: inset,
38
+ repositionAxes: "none",
39
39
  verticalAlignment: verticalAlignment
40
40
  }, chartTextProps, {
41
41
  children: label
@@ -34,6 +34,11 @@ const getFontWeight = (theme, font) => {
34
34
  * Vertical alignment options for chart text.
35
35
  */
36
36
 
37
+ /**
38
+ * Which axes ChartText may nudge labels along to stay in bounds.
39
+ * @default 'both'
40
+ */
41
+
37
42
  export const ChartText = /*#__PURE__*/memo(_ref => {
38
43
  var _elevationShadow$shad, _elevationShadow$shad2, _elevationShadow$shad3, _elevationShadow$shad4, _elevationShadow$shad5, _elevationShadow$shad6, _elevationShadow$shad7;
39
44
  let {
@@ -46,6 +51,7 @@ export const ChartText = /*#__PURE__*/memo(_ref => {
46
51
  verticalAlignment = 'middle',
47
52
  paragraphAlignment = TextAlign.Left,
48
53
  disableRepositioning = false,
54
+ repositionAxes = disableRepositioning ? 'none' : 'both',
49
55
  bounds,
50
56
  color,
51
57
  background: backgroundProp,
@@ -183,12 +189,8 @@ export const ChartText = /*#__PURE__*/memo(_ref => {
183
189
  height: chartHeight
184
190
  }), [chartWidth, chartHeight]);
185
191
  const overflowAmount = useDerivedValue(() => {
186
- if (disableRepositioning) {
187
- return {
188
- x: 0,
189
- y: 0
190
- };
191
- }
192
+ const repositionX = repositionAxes === 'both' || repositionAxes === 'x';
193
+ const repositionY = repositionAxes === 'both' || repositionAxes === 'y';
192
194
  const parentBounds = bounds != null ? bounds : fullChartBounds;
193
195
  if (!parentBounds || parentBounds.width <= 0 || parentBounds.height <= 0) {
194
196
  return {
@@ -198,25 +200,25 @@ export const ChartText = /*#__PURE__*/memo(_ref => {
198
200
  }
199
201
  let offsetX = 0;
200
202
  let offsetY = 0;
201
-
202
- // X-axis overflow
203
- if (backgroundRect.value.x < parentBounds.x) {
204
- offsetX = parentBounds.x - backgroundRect.value.x;
205
- } else if (backgroundRect.value.x + backgroundRect.value.width > parentBounds.x + parentBounds.width) {
206
- offsetX = parentBounds.x + parentBounds.width - (backgroundRect.value.x + backgroundRect.value.width);
203
+ if (repositionX) {
204
+ if (backgroundRect.value.x < parentBounds.x) {
205
+ offsetX = parentBounds.x - backgroundRect.value.x;
206
+ } else if (backgroundRect.value.x + backgroundRect.value.width > parentBounds.x + parentBounds.width) {
207
+ offsetX = parentBounds.x + parentBounds.width - (backgroundRect.value.x + backgroundRect.value.width);
208
+ }
207
209
  }
208
-
209
- // Y-axis overflow
210
- if (backgroundRect.value.y < parentBounds.y) {
211
- offsetY = parentBounds.y - backgroundRect.value.y;
212
- } else if (backgroundRect.value.y + backgroundRect.value.height > parentBounds.y + parentBounds.height) {
213
- offsetY = parentBounds.y + parentBounds.height - (backgroundRect.value.y + backgroundRect.value.height);
210
+ if (repositionY) {
211
+ if (backgroundRect.value.y < parentBounds.y) {
212
+ offsetY = parentBounds.y - backgroundRect.value.y;
213
+ } else if (backgroundRect.value.y + backgroundRect.value.height > parentBounds.y + parentBounds.height) {
214
+ offsetY = parentBounds.y + parentBounds.height - (backgroundRect.value.y + backgroundRect.value.height);
215
+ }
214
216
  }
215
217
  return {
216
218
  x: offsetX,
217
219
  y: offsetY
218
220
  };
219
- }, [backgroundRect, fullChartBounds, bounds, disableRepositioning]);
221
+ }, [backgroundRect, fullChartBounds, bounds, repositionAxes]);
220
222
 
221
223
  // Final adjusted positions
222
224
  const backgroundRectWithOffset = useDerivedValue(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile",
3
- "version": "9.13.0",
3
+ "version": "9.15.0",
4
4
  "description": "Coinbase Design System - Mobile",
5
5
  "repository": {
6
6
  "type": "git",
@@ -218,7 +218,7 @@
218
218
  "react-native-worklets": "0.5.2"
219
219
  },
220
220
  "dependencies": {
221
- "@coinbase/cds-common": "^9.13.0",
221
+ "@coinbase/cds-common": "^9.15.0",
222
222
  "@coinbase/cds-icons": "^5.21.0",
223
223
  "@coinbase/cds-illustrations": "^4.47.0",
224
224
  "@coinbase/cds-lottie-files": "^3.3.4",