panelui-native 0.112.1 → 0.113.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.
- package/README.md +2 -2
- package/lib/module/components/area-chart/index.js +3 -1
- package/lib/module/components/area-chart/index.js.map +1 -1
- package/lib/module/components/bar-chart/index.js +3 -1
- package/lib/module/components/bar-chart/index.js.map +1 -1
- package/lib/module/components/bubble-chart/index.js +5 -1
- package/lib/module/components/bubble-chart/index.js.map +1 -1
- package/lib/module/components/bump-chart/index.js +3 -1
- package/lib/module/components/bump-chart/index.js.map +1 -1
- package/lib/module/components/candlestick-chart/index.js +3 -1
- package/lib/module/components/candlestick-chart/index.js.map +1 -1
- package/lib/module/components/heatmap-chart/index.js +32 -7
- package/lib/module/components/heatmap-chart/index.js.map +1 -1
- package/lib/module/components/line-chart/index.js +3 -1
- package/lib/module/components/line-chart/index.js.map +1 -1
- package/lib/module/components/live-line-chart/index.js +3 -0
- package/lib/module/components/live-line-chart/index.js.map +1 -1
- package/lib/module/components/mirror-area-chart/index.js +3 -1
- package/lib/module/components/mirror-area-chart/index.js.map +1 -1
- package/lib/module/components/plot/index.js +3 -1
- package/lib/module/components/plot/index.js.map +1 -1
- package/lib/module/components/pyramid-chart/index.js +4 -1
- package/lib/module/components/pyramid-chart/index.js.map +1 -1
- package/lib/module/components/scatter-chart/index.js +3 -1
- package/lib/module/components/scatter-chart/index.js.map +1 -1
- package/lib/module/components/waterfall-chart/index.js +3 -1
- package/lib/module/components/waterfall-chart/index.js.map +1 -1
- package/lib/module/primitives/chart-accessibility.js +8 -0
- package/lib/module/primitives/chart-accessibility.js.map +1 -1
- package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bubble-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bump-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/candlestick-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/heatmap-chart/index.d.ts +5 -2
- package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/live-line-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/mirror-area-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/plot/index.d.ts.map +1 -1
- package/lib/typescript/src/components/pyramid-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/scatter-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/waterfall-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/chart-accessibility.d.ts +7 -0
- package/lib/typescript/src/primitives/chart-accessibility.d.ts.map +1 -1
- package/package.json +11 -1
- package/src/components/area-chart/index.tsx +13 -2
- package/src/components/bar-chart/index.tsx +7 -2
- package/src/components/bubble-chart/index.tsx +17 -2
- package/src/components/bump-chart/index.tsx +13 -2
- package/src/components/candlestick-chart/index.tsx +14 -2
- package/src/components/heatmap-chart/index.tsx +46 -7
- package/src/components/line-chart/index.tsx +13 -2
- package/src/components/live-line-chart/index.tsx +13 -2
- package/src/components/mirror-area-chart/index.tsx +7 -1
- package/src/components/plot/index.tsx +13 -2
- package/src/components/pyramid-chart/index.tsx +10 -2
- package/src/components/scatter-chart/index.tsx +13 -2
- package/src/components/waterfall-chart/index.tsx +7 -2
- package/src/primitives/chart-accessibility.ts +8 -0
|
@@ -93,6 +93,7 @@ import Svg, {
|
|
|
93
93
|
Line as SvgLine,
|
|
94
94
|
} from 'react-native-svg';
|
|
95
95
|
import { useCSSVariable } from 'uniwind';
|
|
96
|
+
import { CHART_AXIS_MAX_FONT_SCALE } from '../../primitives/chart-accessibility';
|
|
96
97
|
import { Text } from '../../primitives/text';
|
|
97
98
|
import {
|
|
98
99
|
compactNumber,
|
|
@@ -1027,7 +1028,12 @@ function LiveLineChartXAxis({ ticks = 4, formatTick, className }: LiveLineChartX
|
|
|
1027
1028
|
}}
|
|
1028
1029
|
className={cn('items-center', className)}
|
|
1029
1030
|
>
|
|
1030
|
-
<Text
|
|
1031
|
+
<Text
|
|
1032
|
+
size="xs"
|
|
1033
|
+
muted
|
|
1034
|
+
numberOfLines={1}
|
|
1035
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
1036
|
+
>
|
|
1031
1037
|
{format(seconds * (1 - fraction))}
|
|
1032
1038
|
</Text>
|
|
1033
1039
|
</View>
|
|
@@ -1082,7 +1088,12 @@ function LiveLineChartYAxis({ ticks = 4, formatValue, className }: LiveLineChart
|
|
|
1082
1088
|
}}
|
|
1083
1089
|
className={cn('items-end', className)}
|
|
1084
1090
|
>
|
|
1085
|
-
<Text
|
|
1091
|
+
<Text
|
|
1092
|
+
size="xs"
|
|
1093
|
+
muted
|
|
1094
|
+
numberOfLines={1}
|
|
1095
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
1096
|
+
>
|
|
1086
1097
|
{format(max - (max - min) * fraction)}
|
|
1087
1098
|
</Text>
|
|
1088
1099
|
</View>
|
|
@@ -64,7 +64,11 @@ import Svg, {
|
|
|
64
64
|
} from 'react-native-svg';
|
|
65
65
|
import { useCSSVariable } from 'uniwind';
|
|
66
66
|
import { Text } from '../../primitives/text';
|
|
67
|
-
import {
|
|
67
|
+
import {
|
|
68
|
+
CHART_AXIS_MAX_FONT_SCALE,
|
|
69
|
+
ChartAccessibilityData,
|
|
70
|
+
type ChartAccessibilityProps,
|
|
71
|
+
} from '../../primitives/chart-accessibility';
|
|
68
72
|
import { finiteChartDomain } from '../../primitives/finite-chart';
|
|
69
73
|
import {
|
|
70
74
|
colorStop,
|
|
@@ -934,6 +938,7 @@ function MirrorAreaChartXAxis({ ticks = 4, format, className }: MirrorAreaChartX
|
|
|
934
938
|
width: POINT_LABEL_WIDTH,
|
|
935
939
|
textAlign: 'center',
|
|
936
940
|
}}
|
|
941
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
937
942
|
>
|
|
938
943
|
{label.text}
|
|
939
944
|
</Text>
|
|
@@ -984,6 +989,7 @@ function MirrorAreaChartYAxis({ formatTop, formatBottom, className }: MirrorArea
|
|
|
984
989
|
width,
|
|
985
990
|
textAlign: 'right',
|
|
986
991
|
}}
|
|
992
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
987
993
|
>
|
|
988
994
|
{label.text}
|
|
989
995
|
</Text>
|
|
@@ -96,7 +96,11 @@ import Svg, {
|
|
|
96
96
|
Rect,
|
|
97
97
|
} from 'react-native-svg';
|
|
98
98
|
import { useCSSVariable } from 'uniwind';
|
|
99
|
-
import {
|
|
99
|
+
import {
|
|
100
|
+
CHART_AXIS_MAX_FONT_SCALE,
|
|
101
|
+
ChartAccessibilityData,
|
|
102
|
+
type ChartAccessibilityProps,
|
|
103
|
+
} from '../../primitives/chart-accessibility';
|
|
100
104
|
import { Text } from '../../primitives/text';
|
|
101
105
|
import { finiteChartNumber } from '../../primitives/finite-chart';
|
|
102
106
|
import {
|
|
@@ -1371,6 +1375,7 @@ function PlotXAxis({ ticks = 4, format, className }: PlotXAxisProps) {
|
|
|
1371
1375
|
width: POINT_LABEL_WIDTH,
|
|
1372
1376
|
textAlign: 'center',
|
|
1373
1377
|
}}
|
|
1378
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
1374
1379
|
>
|
|
1375
1380
|
{label.text}
|
|
1376
1381
|
</Text>
|
|
@@ -1429,7 +1434,13 @@ function PlotYAxis({ ticks = 4, format, className }: PlotYAxisProps) {
|
|
|
1429
1434
|
className={cn('items-end justify-between', className)}
|
|
1430
1435
|
>
|
|
1431
1436
|
{labels.map((label) => (
|
|
1432
|
-
<Text
|
|
1437
|
+
<Text
|
|
1438
|
+
key={label.key}
|
|
1439
|
+
size="xs"
|
|
1440
|
+
muted
|
|
1441
|
+
numberOfLines={1}
|
|
1442
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
1443
|
+
>
|
|
1433
1444
|
{label.text}
|
|
1434
1445
|
</Text>
|
|
1435
1446
|
))}
|
|
@@ -80,6 +80,7 @@ import Animated, {
|
|
|
80
80
|
import Svg, { Defs, G, Line as SvgLine, LinearGradient, Path, Stop } from 'react-native-svg';
|
|
81
81
|
import { useCSSVariable } from 'uniwind';
|
|
82
82
|
import {
|
|
83
|
+
CHART_AXIS_MAX_FONT_SCALE,
|
|
83
84
|
ChartAccessibilityData,
|
|
84
85
|
type ChartAccessibilityProps,
|
|
85
86
|
} from '../../primitives/chart-accessibility';
|
|
@@ -956,6 +957,7 @@ function PyramidChartXAxis({ ticks = 2, format, className }: PyramidChartXAxisPr
|
|
|
956
957
|
width: AXIS_LABEL_WIDTH,
|
|
957
958
|
textAlign: 'center',
|
|
958
959
|
}}
|
|
960
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
959
961
|
>
|
|
960
962
|
{label.text}
|
|
961
963
|
</Text>
|
|
@@ -1013,7 +1015,13 @@ function PyramidChartYAxis({ format, className }: PyramidChartYAxisProps) {
|
|
|
1013
1015
|
}}
|
|
1014
1016
|
className="justify-center"
|
|
1015
1017
|
>
|
|
1016
|
-
<Text
|
|
1018
|
+
<Text
|
|
1019
|
+
size="xs"
|
|
1020
|
+
muted
|
|
1021
|
+
numberOfLines={1}
|
|
1022
|
+
style={{ textAlign: 'center' }}
|
|
1023
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
1024
|
+
>
|
|
1017
1025
|
{label(datum, index)}
|
|
1018
1026
|
</Text>
|
|
1019
1027
|
</View>
|
|
@@ -1037,7 +1045,7 @@ function PyramidChartYAxis({ format, className }: PyramidChartYAxisProps) {
|
|
|
1037
1045
|
>
|
|
1038
1046
|
{data.map((datum, index) => (
|
|
1039
1047
|
<View key={index} className="flex-1 justify-center">
|
|
1040
|
-
<Text size="xs" muted numberOfLines={1}>
|
|
1048
|
+
<Text size="xs" muted numberOfLines={1} maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}>
|
|
1041
1049
|
{label(datum, index)}
|
|
1042
1050
|
</Text>
|
|
1043
1051
|
</View>
|
|
@@ -67,7 +67,11 @@ import Animated, {
|
|
|
67
67
|
import Svg, { Circle, G, Line as SvgLine } from 'react-native-svg';
|
|
68
68
|
import { useCSSVariable } from 'uniwind';
|
|
69
69
|
import { Text } from '../../primitives/text';
|
|
70
|
-
import {
|
|
70
|
+
import {
|
|
71
|
+
CHART_AXIS_MAX_FONT_SCALE,
|
|
72
|
+
ChartAccessibilityData,
|
|
73
|
+
type ChartAccessibilityProps,
|
|
74
|
+
} from '../../primitives/chart-accessibility';
|
|
71
75
|
import { compactNumber, useSeriesColor, xAt, yOf, type Plot } from '../../utils/chart';
|
|
72
76
|
import { cn } from '../../utils/cn';
|
|
73
77
|
import { useSkeletonHandoff } from '../../hooks/use-skeleton-handoff';
|
|
@@ -957,6 +961,7 @@ function ScatterChartXAxis({ ticks = 4, format, className }: ScatterChartXAxisPr
|
|
|
957
961
|
width: POINT_LABEL_WIDTH,
|
|
958
962
|
textAlign: 'center',
|
|
959
963
|
}}
|
|
964
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
960
965
|
>
|
|
961
966
|
{label.text}
|
|
962
967
|
</Text>
|
|
@@ -1004,7 +1009,13 @@ function ScatterChartYAxis({ ticks = 4, format, className }: ScatterChartYAxisPr
|
|
|
1004
1009
|
className={cn('items-end justify-between', className)}
|
|
1005
1010
|
>
|
|
1006
1011
|
{labels.map((label) => (
|
|
1007
|
-
<Text
|
|
1012
|
+
<Text
|
|
1013
|
+
key={label.key}
|
|
1014
|
+
size="xs"
|
|
1015
|
+
muted
|
|
1016
|
+
numberOfLines={1}
|
|
1017
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
1018
|
+
>
|
|
1008
1019
|
{label.text}
|
|
1009
1020
|
</Text>
|
|
1010
1021
|
))}
|
|
@@ -66,7 +66,11 @@ import Animated, {
|
|
|
66
66
|
} from 'react-native-reanimated';
|
|
67
67
|
import Svg, { Defs, G, Line as SvgLine, LinearGradient, Path, Stop } from 'react-native-svg';
|
|
68
68
|
import { useCSSVariable } from 'uniwind';
|
|
69
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
CHART_AXIS_MAX_FONT_SCALE,
|
|
71
|
+
ChartAccessibilityData,
|
|
72
|
+
type ChartAccessibilityProps,
|
|
73
|
+
} from '../../primitives/chart-accessibility';
|
|
70
74
|
import { Text } from '../../primitives/text';
|
|
71
75
|
import {
|
|
72
76
|
finiteChartDomain,
|
|
@@ -1142,6 +1146,7 @@ function WaterfallChartXAxis({ ticks, format, className }: WaterfallChartXAxisPr
|
|
|
1142
1146
|
width: bandWidth,
|
|
1143
1147
|
textAlign: 'center',
|
|
1144
1148
|
}}
|
|
1149
|
+
maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}
|
|
1145
1150
|
>
|
|
1146
1151
|
{label.text}
|
|
1147
1152
|
</Text>
|
|
@@ -1209,7 +1214,7 @@ function WaterfallChartYAxis({ ticks = 4, format, className }: WaterfallChartYAx
|
|
|
1209
1214
|
>
|
|
1210
1215
|
{labels.map((label) => (
|
|
1211
1216
|
<View key={label.key} className={horizontal ? 'flex-1 justify-center' : undefined}>
|
|
1212
|
-
<Text size="xs" muted numberOfLines={1}>
|
|
1217
|
+
<Text size="xs" muted numberOfLines={1} maxFontSizeMultiplier={CHART_AXIS_MAX_FONT_SCALE}>
|
|
1213
1218
|
{label.text}
|
|
1214
1219
|
</Text>
|
|
1215
1220
|
</View>
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The largest text scale a chart's axis labels follow: iOS's biggest size before
|
|
5
|
+
* the accessibility range. Axis labels sit in fixed-width gutters at fixed
|
|
6
|
+
* steps, so past this they overlap each other or clip. Screen readers still get
|
|
7
|
+
* every value through the chart's accessibility data.
|
|
8
|
+
*/
|
|
9
|
+
export const CHART_AXIS_MAX_FONT_SCALE = 1.353;
|
|
10
|
+
|
|
3
11
|
export interface ChartAccessibilityProps<Datum> {
|
|
4
12
|
/** Spoken summary. Defaults to the chart family and number of data entries. */
|
|
5
13
|
accessibilityLabel?: string;
|