@razorpay/blade 12.50.0 → 12.52.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/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js +12 -0
- package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js.map +1 -0
- package/build/lib/native/components/Charts/LineChart/LineChart.native.js +12 -0
- package/build/lib/native/components/Charts/LineChart/LineChart.native.js.map +1 -0
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js +3 -2
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js.map +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/native/components/index.js +2 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/theme/bladeTheme.js +1 -1
- package/build/lib/native/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/native/tokens/theme/theme.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js +285 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/index.js +2 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js +15 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js.map +1 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/utils.js +60 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/utils.js.map +1 -0
- package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js +107 -0
- package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js.map +1 -0
- package/build/lib/web/development/components/Charts/LineChart/componentIds.js +6 -0
- package/build/lib/web/development/components/Charts/LineChart/componentIds.js.map +1 -0
- package/build/lib/web/development/components/Charts/LineChart/index.js +2 -0
- package/build/lib/web/development/components/Charts/LineChart/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/index.js +5 -0
- package/build/lib/web/development/components/Charts/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/utils/index.js +2 -0
- package/build/lib/web/development/components/Charts/utils/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/utils/useColorTheme.js +19 -0
- package/build/lib/web/development/components/Charts/utils/useColorTheme.js.map +1 -0
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +3 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +16 -8
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +7 -0
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/development/components/index.js +3 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/theme/bladeTheme.js +350 -0
- package/build/lib/web/development/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/web/development/tokens/theme/theme.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js +285 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/index.js +2 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js +15 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js.map +1 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/utils.js +60 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/utils.js.map +1 -0
- package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js +107 -0
- package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js.map +1 -0
- package/build/lib/web/production/components/Charts/LineChart/componentIds.js +6 -0
- package/build/lib/web/production/components/Charts/LineChart/componentIds.js.map +1 -0
- package/build/lib/web/production/components/Charts/LineChart/index.js +2 -0
- package/build/lib/web/production/components/Charts/LineChart/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/index.js +5 -0
- package/build/lib/web/production/components/Charts/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/utils/index.js +2 -0
- package/build/lib/web/production/components/Charts/utils/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/utils/useColorTheme.js +19 -0
- package/build/lib/web/production/components/Charts/utils/useColorTheme.js.map +1 -0
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +3 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +16 -8
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +7 -0
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/production/components/index.js +3 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/tokens/theme/bladeTheme.js +350 -0
- package/build/lib/web/production/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/web/production/tokens/theme/theme.js.map +1 -1
- package/build/types/components/index.d.ts +290 -4532
- package/build/types/components/index.native.d.ts +266 -602
- package/build/types/tokens/index.d.ts +12 -0
- package/build/types/tokens/index.native.d.ts +12 -0
- package/build/types/utils/index.d.ts +31 -0
- package/build/types/utils/index.native.d.ts +31 -0
- package/package.json +3 -2
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { XAxis, YAxis, CartesianGrid, Tooltip, Legend, ReferenceLine } from 'recharts';
|
|
4
|
+
import { X_OFFSET, Y_OFFSET, X_AXIS_TEXT_BASELINE, TEXT_BASELINE, PADDING_HORIZONTAL, PADDING_VERTICAL, RECT_HEIGHT } from './tokens.js';
|
|
5
|
+
import { calculateTextWidth } from './utils.js';
|
|
6
|
+
import '../../Typography/index.js';
|
|
7
|
+
import '../../Box/index.js';
|
|
8
|
+
import '../../BladeProvider/index.js';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
11
|
+
import { Heading } from '../../Typography/Heading/Heading.js';
|
|
12
|
+
import { Box } from '../../Box/Box.js';
|
|
13
|
+
import { Text } from '../../Typography/Text/Text.js';
|
|
14
|
+
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
var ChartXAxis = function ChartXAxis(props) {
|
|
18
|
+
var _useTheme = useTheme(),
|
|
19
|
+
theme = _useTheme.theme;
|
|
20
|
+
return /*#__PURE__*/jsx(XAxis, _objectSpread(_objectSpread({}, props), {}, {
|
|
21
|
+
tick: {
|
|
22
|
+
fill: theme.colors.surface.text.gray.normal,
|
|
23
|
+
fontSize: theme.typography.fonts.size[75],
|
|
24
|
+
fontFamily: theme.typography.fonts.family.text,
|
|
25
|
+
fontWeight: theme.typography.fonts.weight.regular,
|
|
26
|
+
letterSpacing: theme.typography.letterSpacings[100]
|
|
27
|
+
},
|
|
28
|
+
stroke: theme.colors.surface.border.gray.muted,
|
|
29
|
+
label: function label(_ref) {
|
|
30
|
+
var viewBox = _ref.viewBox;
|
|
31
|
+
return /*#__PURE__*/jsx("text", {
|
|
32
|
+
x: viewBox.x + viewBox.width / 2 - X_OFFSET,
|
|
33
|
+
y: viewBox.y + Y_OFFSET + X_AXIS_TEXT_BASELINE,
|
|
34
|
+
textAnchor: "middle",
|
|
35
|
+
fill: theme.colors.surface.text.gray.subtle,
|
|
36
|
+
fontSize: theme.typography.fonts.size[75],
|
|
37
|
+
fontFamily: theme.typography.fonts.family.text,
|
|
38
|
+
fontWeight: theme.typography.fonts.weight.medium,
|
|
39
|
+
letterSpacing: theme.typography.letterSpacings[100],
|
|
40
|
+
children: props === null || props === void 0 ? void 0 : props.label
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
dataKey: props === null || props === void 0 ? void 0 : props.dataKey
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
var ChartYAxis = function ChartYAxis(props) {
|
|
47
|
+
var _useTheme2 = useTheme(),
|
|
48
|
+
theme = _useTheme2.theme;
|
|
49
|
+
return /*#__PURE__*/jsx(YAxis, _objectSpread(_objectSpread({}, props), {}, {
|
|
50
|
+
tick: {
|
|
51
|
+
fill: theme.colors.surface.text.gray.normal,
|
|
52
|
+
fontSize: theme.typography.fonts.size[75],
|
|
53
|
+
fontFamily: theme.typography.fonts.family.text,
|
|
54
|
+
fontWeight: theme.typography.fonts.weight.regular,
|
|
55
|
+
letterSpacing: theme.typography.letterSpacings[100]
|
|
56
|
+
},
|
|
57
|
+
stroke: theme.colors.surface.border.gray.muted,
|
|
58
|
+
label: {
|
|
59
|
+
value: props === null || props === void 0 ? void 0 : props.label,
|
|
60
|
+
position: 'insideLeft',
|
|
61
|
+
style: {
|
|
62
|
+
textAnchor: 'middle',
|
|
63
|
+
fill: theme.colors.surface.text.gray.subtle,
|
|
64
|
+
fontSize: theme.typography.fonts.size[75],
|
|
65
|
+
fontWeight: theme.typography.fonts.weight.medium,
|
|
66
|
+
fontFamily: theme.typography.fonts.family.text,
|
|
67
|
+
letterSpacing: theme.typography.letterSpacings[100],
|
|
68
|
+
lineHeight: theme.typography.lineHeights[500]
|
|
69
|
+
},
|
|
70
|
+
angle: -90,
|
|
71
|
+
fill: theme.colors.surface.text.gray.subtle
|
|
72
|
+
},
|
|
73
|
+
dataKey: props === null || props === void 0 ? void 0 : props.dataKey
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
var ChartCartesianGrid = function ChartCartesianGrid(props) {
|
|
77
|
+
var _useTheme3 = useTheme(),
|
|
78
|
+
theme = _useTheme3.theme;
|
|
79
|
+
return /*#__PURE__*/jsx(CartesianGrid, _objectSpread({
|
|
80
|
+
stroke: theme.colors.surface.border.gray.muted,
|
|
81
|
+
vertical: false
|
|
82
|
+
}, props));
|
|
83
|
+
};
|
|
84
|
+
var ChartTooltip = function ChartTooltip(props) {
|
|
85
|
+
var _useTheme4 = useTheme(),
|
|
86
|
+
theme = _useTheme4.theme;
|
|
87
|
+
return /*#__PURE__*/jsx(Tooltip, _objectSpread({
|
|
88
|
+
content: function content(_ref2) {
|
|
89
|
+
var payload = _ref2.payload,
|
|
90
|
+
label = _ref2.label;
|
|
91
|
+
return /*#__PURE__*/jsxs("div", {
|
|
92
|
+
style: {
|
|
93
|
+
backgroundColor: theme.colors.surface.icon.staticBlack.normal,
|
|
94
|
+
borderRadius: theme.border.radius.large,
|
|
95
|
+
border: "1px solid ".concat(theme.colors.surface.border.gray.muted),
|
|
96
|
+
padding: theme.spacing[4]
|
|
97
|
+
},
|
|
98
|
+
children: [/*#__PURE__*/jsx(Heading, {
|
|
99
|
+
size: "small",
|
|
100
|
+
weight: "semibold",
|
|
101
|
+
color: "surface.text.staticWhite.normal",
|
|
102
|
+
children: label
|
|
103
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
104
|
+
paddingTop: "spacing.4",
|
|
105
|
+
children: payload.map(function (item) {
|
|
106
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
107
|
+
display: "flex",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
justifyContent: "space-between",
|
|
110
|
+
gap: "spacing.4",
|
|
111
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
112
|
+
display: "flex",
|
|
113
|
+
gap: "spacing.3",
|
|
114
|
+
alignItems: "center",
|
|
115
|
+
justifyContent: "center",
|
|
116
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
117
|
+
style: {
|
|
118
|
+
width: theme.spacing[4],
|
|
119
|
+
height: theme.spacing[4],
|
|
120
|
+
backgroundColor: item.color,
|
|
121
|
+
borderRadius: theme.border.radius.small
|
|
122
|
+
}
|
|
123
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
124
|
+
size: "small",
|
|
125
|
+
weight: "regular",
|
|
126
|
+
color: "surface.text.staticWhite.normal",
|
|
127
|
+
children: item.name
|
|
128
|
+
})]
|
|
129
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
130
|
+
size: "small",
|
|
131
|
+
weight: "regular",
|
|
132
|
+
color: "surface.text.staticWhite.normal",
|
|
133
|
+
children: item.value
|
|
134
|
+
})]
|
|
135
|
+
}, item.name);
|
|
136
|
+
})
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
cursor: {
|
|
141
|
+
fill: 'rgba(0, 0, 0, 0.1)',
|
|
142
|
+
stroke: theme.colors.surface.border.gray.muted
|
|
143
|
+
}
|
|
144
|
+
}, props));
|
|
145
|
+
};
|
|
146
|
+
var CustomSquareLegend = function CustomSquareLegend(props) {
|
|
147
|
+
var payload = props.payload;
|
|
148
|
+
var _useTheme5 = useTheme(),
|
|
149
|
+
theme = _useTheme5.theme;
|
|
150
|
+
if (!payload || payload.length === 0) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
/*
|
|
154
|
+
This is a custom legend component that is used to display the legend for the chart.
|
|
155
|
+
we need to show the legend only if the legendType is not none. (for example in line chart we don't want to show the legend for the reference line)
|
|
156
|
+
so we are filtering the payload and then mapping over it to display the legend.
|
|
157
|
+
*/
|
|
158
|
+
var filteredPayload = payload.filter(function (entry) {
|
|
159
|
+
var _entry$payload;
|
|
160
|
+
return (entry === null || entry === void 0 || (_entry$payload = entry.payload) === null || _entry$payload === void 0 ? void 0 : _entry$payload.legendType) !== 'none';
|
|
161
|
+
});
|
|
162
|
+
return /*#__PURE__*/jsx(Box, {
|
|
163
|
+
display: "flex",
|
|
164
|
+
justifyContent: "center",
|
|
165
|
+
gap: "spacing.5",
|
|
166
|
+
children: filteredPayload.map(function (entry, index) {
|
|
167
|
+
return /*#__PURE__*/jsx(Box, {
|
|
168
|
+
display: "flex",
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
children: /*#__PURE__*/jsxs(Box, {
|
|
171
|
+
display: "flex",
|
|
172
|
+
gap: "spacing.3",
|
|
173
|
+
justifyContent: "center",
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
176
|
+
style: {
|
|
177
|
+
backgroundColor: entry.color,
|
|
178
|
+
// Uses the color of the line/bar
|
|
179
|
+
width: theme.spacing[4],
|
|
180
|
+
// Size of the square
|
|
181
|
+
height: theme.spacing[4],
|
|
182
|
+
// Size of the square
|
|
183
|
+
display: 'inline-block',
|
|
184
|
+
borderRadius: theme.border.radius.small
|
|
185
|
+
}
|
|
186
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
187
|
+
size: "medium",
|
|
188
|
+
color: "surface.text.gray.muted",
|
|
189
|
+
children: entry.value
|
|
190
|
+
})]
|
|
191
|
+
})
|
|
192
|
+
}, "item-".concat(index));
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
var ChartLegend = function ChartLegend(props) {
|
|
197
|
+
var _useTheme6 = useTheme(),
|
|
198
|
+
theme = _useTheme6.theme;
|
|
199
|
+
return /*#__PURE__*/jsx(Legend, _objectSpread({
|
|
200
|
+
wrapperStyle: {
|
|
201
|
+
fontFamily: theme.typography.fonts.family.text,
|
|
202
|
+
fontSize: theme.typography.fonts.size[100],
|
|
203
|
+
color: theme.colors.surface.text.gray.normal,
|
|
204
|
+
paddingTop: theme.spacing[5]
|
|
205
|
+
},
|
|
206
|
+
align: "center",
|
|
207
|
+
content: /*#__PURE__*/jsx(CustomSquareLegend, {})
|
|
208
|
+
}, props));
|
|
209
|
+
};
|
|
210
|
+
var CustomReferenceLabel = function CustomReferenceLabel(_ref3) {
|
|
211
|
+
var viewBox = _ref3.viewBox,
|
|
212
|
+
value = _ref3.value,
|
|
213
|
+
isVertical = _ref3.isVertical;
|
|
214
|
+
// Extract viewBox coordinates with fallback values to prevent undefined errors.
|
|
215
|
+
// viewBox contains the positioning information for the reference line label from Recharts.
|
|
216
|
+
var _ref4 = viewBox !== null && viewBox !== void 0 ? viewBox : {
|
|
217
|
+
x: 0,
|
|
218
|
+
y: 0,
|
|
219
|
+
width: 0
|
|
220
|
+
},
|
|
221
|
+
x = _ref4.x,
|
|
222
|
+
y = _ref4.y,
|
|
223
|
+
width = _ref4.width;
|
|
224
|
+
var _useTheme7 = useTheme(),
|
|
225
|
+
theme = _useTheme7.theme;
|
|
226
|
+
|
|
227
|
+
// Calculate dynamic text width to ensure the background rectangle fits the text perfectly.
|
|
228
|
+
// This prevents text overflow for long labels and avoids unnecessarily large rectangles for short text.
|
|
229
|
+
// The function also handles text truncation with ellipsis if the text exceeds the maximum width.
|
|
230
|
+
var _ref5 = value ? calculateTextWidth(value, theme) : {
|
|
231
|
+
width: 80,
|
|
232
|
+
displayText: value !== null && value !== void 0 ? value : ''
|
|
233
|
+
},
|
|
234
|
+
RECT_WIDTH = _ref5.width,
|
|
235
|
+
displayText = _ref5.displayText;
|
|
236
|
+
var rect_x = isVertical ? x + width - RECT_WIDTH / 2 : x + width - RECT_WIDTH;
|
|
237
|
+
var rect_y = isVertical ? y : y - TEXT_BASELINE;
|
|
238
|
+
// Text position with padding inside the rectangle
|
|
239
|
+
var text_x = rect_x + PADDING_HORIZONTAL + (RECT_WIDTH - PADDING_HORIZONTAL * 2) / 2;
|
|
240
|
+
var text_y = rect_y + PADDING_VERTICAL + TEXT_BASELINE; // +15 for text baseline
|
|
241
|
+
|
|
242
|
+
return /*#__PURE__*/jsxs("g", {
|
|
243
|
+
children: [/*#__PURE__*/jsx("rect", {
|
|
244
|
+
x: rect_x,
|
|
245
|
+
y: rect_y,
|
|
246
|
+
width: RECT_WIDTH,
|
|
247
|
+
height: RECT_HEIGHT,
|
|
248
|
+
rx: theme.border.radius.medium,
|
|
249
|
+
fill: theme.colors.surface.background.gray.subtle,
|
|
250
|
+
stroke: theme.colors.surface.border.gray.muted,
|
|
251
|
+
strokeWidth: "1"
|
|
252
|
+
}), /*#__PURE__*/jsx("text", {
|
|
253
|
+
x: text_x,
|
|
254
|
+
y: text_y,
|
|
255
|
+
textAnchor: "middle",
|
|
256
|
+
fill: theme.colors.surface.text.gray.normal,
|
|
257
|
+
fontSize: theme.typography.fonts.size[50],
|
|
258
|
+
fontFamily: theme.typography.fonts.family.text,
|
|
259
|
+
fontWeight: theme.typography.fonts.weight.medium,
|
|
260
|
+
letterSpacing: theme.typography.letterSpacings[100],
|
|
261
|
+
children: displayText
|
|
262
|
+
})]
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
var ChartReferenceLine = function ChartReferenceLine(_ref6) {
|
|
266
|
+
var label = _ref6.label,
|
|
267
|
+
x = _ref6.x,
|
|
268
|
+
y = _ref6.y;
|
|
269
|
+
var _useTheme8 = useTheme(),
|
|
270
|
+
theme = _useTheme8.theme;
|
|
271
|
+
return /*#__PURE__*/jsx(ReferenceLine, {
|
|
272
|
+
stroke: theme.colors.chart.background.categorical.gray.intense,
|
|
273
|
+
strokeWidth: 2,
|
|
274
|
+
strokeDasharray: "4 4",
|
|
275
|
+
label: /*#__PURE__*/jsx(CustomReferenceLabel, {
|
|
276
|
+
value: label,
|
|
277
|
+
isVertical: Boolean(x)
|
|
278
|
+
}),
|
|
279
|
+
x: x,
|
|
280
|
+
y: y
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export { ChartCartesianGrid, ChartLegend, ChartReferenceLine, ChartTooltip, ChartXAxis, ChartYAxis };
|
|
285
|
+
//# sourceMappingURL=CommonChartComponents.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonChartComponents.web.js","sources":["../../../../../../../src/components/Charts/CommonChartComponents/CommonChartComponents.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n CartesianGrid as RechartsCartesianGrid,\n Tooltip as RechartsTooltip,\n Legend as RechartsLegend,\n ReferenceLine as RechartsReferenceLine,\n} from 'recharts';\nimport type {\n ChartReferenceLineProps,\n ChartXAxisProps,\n ChartYAxisProps,\n ChartTooltipProps,\n ChartLegendProps,\n ChartCartesianGridProps,\n} from './types';\nimport {\n RECT_HEIGHT,\n TEXT_BASELINE,\n PADDING_VERTICAL,\n PADDING_HORIZONTAL,\n X_AXIS_TEXT_BASELINE,\n Y_OFFSET,\n X_OFFSET,\n} from './tokens';\nimport { calculateTextWidth } from './utils';\nimport { Heading, Text } from '~components/Typography';\nimport { Box } from '~components/Box';\nimport { useTheme } from '~components/BladeProvider';\n\nconst ChartXAxis: React.FC<ChartXAxisProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsXAxis\n {...props}\n tick={{\n fill: theme.colors.surface.text.gray.normal,\n fontSize: theme.typography.fonts.size[75],\n fontFamily: theme.typography.fonts.family.text,\n fontWeight: theme.typography.fonts.weight.regular,\n letterSpacing: theme.typography.letterSpacings[100],\n }}\n stroke={theme.colors.surface.border.gray.muted}\n label={({ viewBox }: { viewBox: { x: number; y: number; width: number } }) => (\n <text\n x={viewBox.x + viewBox.width / 2 - X_OFFSET}\n y={viewBox.y + Y_OFFSET + X_AXIS_TEXT_BASELINE}\n textAnchor=\"middle\"\n fill={theme.colors.surface.text.gray.subtle}\n fontSize={theme.typography.fonts.size[75]}\n fontFamily={theme.typography.fonts.family.text}\n fontWeight={theme.typography.fonts.weight.medium}\n letterSpacing={theme.typography.letterSpacings[100]}\n >\n {props?.label}\n </text>\n )}\n dataKey={props?.dataKey}\n />\n );\n};\n\nconst ChartYAxis: React.FC<ChartYAxisProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsYAxis\n {...props}\n tick={{\n fill: theme.colors.surface.text.gray.normal,\n fontSize: theme.typography.fonts.size[75],\n fontFamily: theme.typography.fonts.family.text,\n fontWeight: theme.typography.fonts.weight.regular,\n letterSpacing: theme.typography.letterSpacings[100],\n }}\n stroke={theme.colors.surface.border.gray.muted}\n label={{\n value: props?.label,\n position: 'insideLeft',\n style: {\n textAnchor: 'middle',\n fill: theme.colors.surface.text.gray.subtle,\n fontSize: theme.typography.fonts.size[75],\n fontWeight: theme.typography.fonts.weight.medium,\n fontFamily: theme.typography.fonts.family.text,\n letterSpacing: theme.typography.letterSpacings[100],\n lineHeight: theme.typography.lineHeights[500],\n },\n angle: -90,\n fill: theme.colors.surface.text.gray.subtle,\n }}\n dataKey={props?.dataKey}\n />\n );\n};\n\nconst ChartCartesianGrid: React.FC<ChartCartesianGridProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsCartesianGrid\n stroke={theme.colors.surface.border.gray.muted}\n vertical={false}\n {...props}\n />\n );\n};\n\nconst ChartTooltip: React.FC<ChartTooltipProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsTooltip\n content={({ payload, label }) => {\n return (\n <div\n style={{\n backgroundColor: theme.colors.surface.icon.staticBlack.normal,\n borderRadius: theme.border.radius.large,\n border: `1px solid ${theme.colors.surface.border.gray.muted}`,\n padding: theme.spacing[4],\n }}\n >\n <Heading size=\"small\" weight=\"semibold\" color=\"surface.text.staticWhite.normal\">\n {label}\n </Heading>\n <Box paddingTop=\"spacing.4\">\n {payload.map((item) => (\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap=\"spacing.4\"\n key={item.name}\n >\n <Box display=\"flex\" gap=\"spacing.3\" alignItems=\"center\" justifyContent=\"center\">\n <div\n style={{\n width: theme.spacing[4],\n height: theme.spacing[4],\n backgroundColor: item.color,\n borderRadius: theme.border.radius.small,\n }}\n />\n <Text size=\"small\" weight=\"regular\" color=\"surface.text.staticWhite.normal\">\n {item.name}\n </Text>\n </Box>\n <Text size=\"small\" weight=\"regular\" color=\"surface.text.staticWhite.normal\">\n {item.value}\n </Text>\n </Box>\n ))}\n </Box>\n </div>\n );\n }}\n cursor={{ fill: 'rgba(0, 0, 0, 0.1)', stroke: theme.colors.surface.border.gray.muted }}\n {...props}\n />\n );\n};\n\nconst CustomSquareLegend = (props: {\n payload?: Array<{\n payload: {\n legendType: 'none' | 'line';\n };\n value: string;\n color: string;\n }>;\n}): JSX.Element | null => {\n const { payload } = props;\n const { theme } = useTheme();\n\n if (!payload || payload.length === 0) {\n return null;\n }\n /*\n This is a custom legend component that is used to display the legend for the chart.\n we need to show the legend only if the legendType is not none. (for example in line chart we don't want to show the legend for the reference line)\n so we are filtering the payload and then mapping over it to display the legend.\n */\n const filteredPayload = payload.filter((entry) => entry?.payload?.legendType !== 'none');\n\n return (\n <Box display=\"flex\" justifyContent=\"center\" gap=\"spacing.5\">\n {filteredPayload.map((entry, index) => (\n <Box key={`item-${index}`} display=\"flex\" alignItems=\"center\">\n <Box display=\"flex\" gap=\"spacing.3\" justifyContent=\"center\" alignItems=\"center\">\n <span\n style={{\n backgroundColor: entry.color, // Uses the color of the line/bar\n width: theme.spacing[4], // Size of the square\n height: theme.spacing[4], // Size of the square\n display: 'inline-block',\n borderRadius: theme.border.radius.small,\n }}\n />\n {/* Legend text with custom color and size */}\n <Text size=\"medium\" color=\"surface.text.gray.muted\">\n {entry.value}\n </Text>\n </Box>\n </Box>\n ))}\n </Box>\n );\n};\n\nconst ChartLegend: React.FC<ChartLegendProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsLegend\n wrapperStyle={{\n fontFamily: theme.typography.fonts.family.text,\n fontSize: theme.typography.fonts.size[100],\n color: theme.colors.surface.text.gray.normal,\n paddingTop: theme.spacing[5],\n }}\n align=\"center\"\n content={<CustomSquareLegend />}\n {...props}\n />\n );\n};\n\nconst CustomReferenceLabel = ({\n viewBox,\n value,\n isVertical,\n}: {\n viewBox?: { x: number; y: number; width: number };\n value: string | undefined;\n isVertical: boolean;\n}): JSX.Element => {\n // Extract viewBox coordinates with fallback values to prevent undefined errors.\n // viewBox contains the positioning information for the reference line label from Recharts.\n const { x, y, width } = viewBox ?? { x: 0, y: 0, width: 0 };\n const { theme } = useTheme();\n\n // Calculate dynamic text width to ensure the background rectangle fits the text perfectly.\n // This prevents text overflow for long labels and avoids unnecessarily large rectangles for short text.\n // The function also handles text truncation with ellipsis if the text exceeds the maximum width.\n const { width: RECT_WIDTH, displayText } = value\n ? calculateTextWidth(value, theme)\n : { width: 80, displayText: value ?? '' };\n\n const rect_x = isVertical ? x + width - RECT_WIDTH / 2 : x + width - RECT_WIDTH;\n const rect_y = isVertical ? y : y - TEXT_BASELINE;\n // Text position with padding inside the rectangle\n const text_x = rect_x + PADDING_HORIZONTAL + (RECT_WIDTH - PADDING_HORIZONTAL * 2) / 2;\n const text_y = rect_y + PADDING_VERTICAL + TEXT_BASELINE; // +15 for text baseline\n\n return (\n <g>\n <rect\n x={rect_x}\n y={rect_y}\n width={RECT_WIDTH}\n height={RECT_HEIGHT}\n rx={theme.border.radius.medium}\n fill={theme.colors.surface.background.gray.subtle}\n stroke={theme.colors.surface.border.gray.muted}\n strokeWidth=\"1\"\n />\n <text\n x={text_x}\n y={text_y}\n textAnchor=\"middle\"\n fill={theme.colors.surface.text.gray.normal}\n fontSize={theme.typography.fonts.size[50]}\n fontFamily={theme.typography.fonts.family.text}\n fontWeight={theme.typography.fonts.weight.medium}\n letterSpacing={theme.typography.letterSpacings[100]}\n >\n {displayText}\n </text>\n </g>\n );\n};\n\nconst ChartReferenceLine: React.FC<ChartReferenceLineProps> = ({ label, x, y }) => {\n const { theme } = useTheme();\n return (\n <RechartsReferenceLine\n stroke={theme.colors.chart.background.categorical.gray.intense}\n strokeWidth={2}\n strokeDasharray=\"4 4\"\n label={<CustomReferenceLabel value={label} isVertical={Boolean(x)} />}\n x={x}\n y={y}\n />\n );\n};\n\nexport {\n ChartXAxis,\n ChartYAxis,\n ChartCartesianGrid,\n ChartLegend,\n ChartTooltip,\n ChartReferenceLine,\n};\n"],"names":["ChartXAxis","props","_useTheme","useTheme","theme","_jsx","RechartsXAxis","_objectSpread","tick","fill","colors","surface","text","gray","normal","fontSize","typography","fonts","size","fontFamily","family","fontWeight","weight","regular","letterSpacing","letterSpacings","stroke","border","muted","label","_ref","viewBox","x","width","X_OFFSET","y","Y_OFFSET","X_AXIS_TEXT_BASELINE","textAnchor","subtle","medium","children","dataKey","ChartYAxis","_useTheme2","RechartsYAxis","value","position","style","lineHeight","lineHeights","angle","ChartCartesianGrid","_useTheme3","RechartsCartesianGrid","vertical","ChartTooltip","_useTheme4","RechartsTooltip","content","_ref2","payload","_jsxs","backgroundColor","icon","staticBlack","borderRadius","radius","large","concat","padding","spacing","Heading","color","Box","paddingTop","map","item","display","alignItems","justifyContent","gap","height","small","Text","name","cursor","CustomSquareLegend","_useTheme5","length","filteredPayload","filter","entry","_entry$payload","legendType","index","ChartLegend","_useTheme6","RechartsLegend","wrapperStyle","align","CustomReferenceLabel","_ref3","isVertical","_ref4","_useTheme7","_ref5","calculateTextWidth","displayText","RECT_WIDTH","rect_x","rect_y","TEXT_BASELINE","text_x","PADDING_HORIZONTAL","text_y","PADDING_VERTICAL","RECT_HEIGHT","rx","background","strokeWidth","ChartReferenceLine","_ref6","_useTheme8","RechartsReferenceLine","chart","categorical","intense","strokeDasharray","Boolean"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAMA,UAAqC,GAAG,SAAxCA,UAAqCA,CAAIC,KAAK,EAAK;AACvD,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EAEb,oBACEC,GAAA,CAACC,KAAa,EAAAC,aAAA,CAAAA,aAAA,KACRN,KAAK,CAAA,EAAA,EAAA,EAAA;AACTO,IAAAA,IAAI,EAAE;MACJC,IAAI,EAAEL,KAAK,CAACM,MAAM,CAACC,OAAO,CAACC,IAAI,CAACC,IAAI,CAACC,MAAM;MAC3CC,QAAQ,EAAEX,KAAK,CAACY,UAAU,CAACC,KAAK,CAACC,IAAI,CAAC,EAAE,CAAC;MACzCC,UAAU,EAAEf,KAAK,CAACY,UAAU,CAACC,KAAK,CAACG,MAAM,CAACR,IAAI;MAC9CS,UAAU,EAAEjB,KAAK,CAACY,UAAU,CAACC,KAAK,CAACK,MAAM,CAACC,OAAO;AACjDC,MAAAA,aAAa,EAAEpB,KAAK,CAACY,UAAU,CAACS,cAAc,CAAC,GAAG,CAAA;KAClD;IACFC,MAAM,EAAEtB,KAAK,CAACM,MAAM,CAACC,OAAO,CAACgB,MAAM,CAACd,IAAI,CAACe,KAAM;AAC/CC,IAAAA,KAAK,EAAE,SAAPA,KAAKA,CAAAC,IAAA,EAAA;AAAA,MAAA,IAAKC,OAAO,GAAAD,IAAA,CAAPC,OAAO,CAAA;AAAA,MAAA,oBACf1B,GAAA,CAAA,MAAA,EAAA;QACE2B,CAAC,EAAED,OAAO,CAACC,CAAC,GAAGD,OAAO,CAACE,KAAK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AAuF,KAAA,CAADvF,CAAC,CAAA;AAC1E,EAAA,IAAAwF,UAAA,GAAkBxH,QAAQ,EAAE;IAApBC,KAAK,GAAAuH,UAAA,CAALvH,KAAK,CAAA;EACb,oBACEC,GAAA,CAACuH,aAAqB,EAAA;AACpBlG,IAAAA,MAAM,EAAEtB,KAAK,CAACM,MAAM,CAACmH,KAAK,CAACN,UAAU,CAACO,WAAW,CAACjH,IAAI,CAACkH,OAAQ;AAC/DP,IAAAA,WAAW,EAAE,CAAE;AACfQ,IAAAA,eAAe,EAAC,KAAK;IACrBnG,KAAK,eAAExB,GAAA,CAACgG,oBAAoB,EAAA;AAACvD,MAAAA,KAAK,EAAEjB,KAAM;MAAC0E,UAAU,EAAE0B,OAAO,CAACjG,CAAC,CAAA;AAAE,KAAE,CAAE;AACtEA,IAAAA,CAAC,EAAEA,CAAE;AACLG,IAAAA,CAAC,EAAEA,CAAAA;AAAE,GACN,CAAC,CAAA;AAEN;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var RECT_WIDTH = 80;
|
|
2
|
+
var RECT_HEIGHT = 30;
|
|
3
|
+
var TEXT_BASELINE = 15;
|
|
4
|
+
|
|
5
|
+
// Padding for text inside the rectangle (4px vertical, 8px horizontal)
|
|
6
|
+
var PADDING_VERTICAL = 4;
|
|
7
|
+
var PADDING_HORIZONTAL = 8;
|
|
8
|
+
var X_OFFSET = 32;
|
|
9
|
+
var Y_OFFSET = 14.5;
|
|
10
|
+
var X_AXIS_TEXT_BASELINE = 24;
|
|
11
|
+
var MIN_WIDTH = RECT_WIDTH;
|
|
12
|
+
var MAX_WIDTH = 200;
|
|
13
|
+
|
|
14
|
+
export { MAX_WIDTH, MIN_WIDTH, PADDING_HORIZONTAL, PADDING_VERTICAL, RECT_HEIGHT, RECT_WIDTH, TEXT_BASELINE, X_AXIS_TEXT_BASELINE, X_OFFSET, Y_OFFSET };
|
|
15
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sources":["../../../../../../../src/components/Charts/CommonChartComponents/tokens.ts"],"sourcesContent":["const RECT_WIDTH = 80;\nconst RECT_HEIGHT = 30;\nconst TEXT_BASELINE = 15;\n\n// Padding for text inside the rectangle (4px vertical, 8px horizontal)\nconst PADDING_VERTICAL = 4;\nconst PADDING_HORIZONTAL = 8;\n\nconst X_OFFSET = 32;\nconst Y_OFFSET = 14.5;\nconst X_AXIS_TEXT_BASELINE = 24;\n\nconst MIN_WIDTH = RECT_WIDTH;\nconst MAX_WIDTH = 200;\nexport {\n RECT_WIDTH,\n RECT_HEIGHT,\n TEXT_BASELINE,\n PADDING_VERTICAL,\n PADDING_HORIZONTAL,\n X_OFFSET,\n Y_OFFSET,\n X_AXIS_TEXT_BASELINE,\n MIN_WIDTH,\n MAX_WIDTH,\n};\n"],"names":["RECT_WIDTH","RECT_HEIGHT","TEXT_BASELINE","PADDING_VERTICAL","PADDING_HORIZONTAL","X_OFFSET","Y_OFFSET","X_AXIS_TEXT_BASELINE","MIN_WIDTH","MAX_WIDTH"],"mappings":"AAAMA,IAAAA,UAAU,GAAG,GAAE;AACfC,IAAAA,WAAW,GAAG,GAAE;AAChBC,IAAAA,aAAa,GAAG,GAAE;;AAExB;AACMC,IAAAA,gBAAgB,GAAG,EAAC;AACpBC,IAAAA,kBAAkB,GAAG,EAAC;AAEtBC,IAAAA,QAAQ,GAAG,GAAE;AACbC,IAAAA,QAAQ,GAAG,KAAI;AACfC,IAAAA,oBAAoB,GAAG,GAAE;AAEzBC,IAAAA,SAAS,GAAGR,WAAU;AACtBS,IAAAA,SAAS,GAAG;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { MAX_WIDTH, PADDING_HORIZONTAL, MIN_WIDTH } from './tokens.js';
|
|
2
|
+
|
|
3
|
+
var calculateTextWidth = function calculateTextWidth(text, theme) {
|
|
4
|
+
// Create a temporary canvas to measure text
|
|
5
|
+
var canvas = document.createElement('canvas');
|
|
6
|
+
var context = canvas.getContext('2d');
|
|
7
|
+
if (!context) return {
|
|
8
|
+
width: 80,
|
|
9
|
+
displayText: text
|
|
10
|
+
}; // fallback
|
|
11
|
+
|
|
12
|
+
// Set font properties to match the text styling
|
|
13
|
+
var fontSize = theme.typography.fonts.size[50];
|
|
14
|
+
var fontFamily = theme.typography.fonts.family.text;
|
|
15
|
+
var fontWeight = theme.typography.fonts.weight.medium;
|
|
16
|
+
context.font = "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily);
|
|
17
|
+
|
|
18
|
+
// Measure the full text first
|
|
19
|
+
var fullTextWidth = context.measureText(text).width;
|
|
20
|
+
var availableWidth = MAX_WIDTH - PADDING_HORIZONTAL;
|
|
21
|
+
|
|
22
|
+
// If text fits within max width, use it as is
|
|
23
|
+
if (fullTextWidth <= availableWidth) {
|
|
24
|
+
var _finalWidth = Math.max(MIN_WIDTH, fullTextWidth + PADDING_HORIZONTAL);
|
|
25
|
+
return {
|
|
26
|
+
width: _finalWidth,
|
|
27
|
+
displayText: text
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Text is too long, need to truncate
|
|
32
|
+
var ELLIPSIS = '...';
|
|
33
|
+
var ellipsisWidth = context.measureText(ELLIPSIS).width;
|
|
34
|
+
var maxTextWidth = availableWidth - ellipsisWidth;
|
|
35
|
+
|
|
36
|
+
// Binary search to find the optimal truncation point
|
|
37
|
+
var left = 0;
|
|
38
|
+
var right = text.length;
|
|
39
|
+
var bestFit = '';
|
|
40
|
+
while (left <= right) {
|
|
41
|
+
var mid = Math.floor((left + right) / 2);
|
|
42
|
+
var testText = text.substring(0, mid);
|
|
43
|
+
var testWidth = context.measureText(testText).width;
|
|
44
|
+
if (testWidth <= maxTextWidth) {
|
|
45
|
+
bestFit = testText;
|
|
46
|
+
left = mid + 1;
|
|
47
|
+
} else {
|
|
48
|
+
right = mid - 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var truncatedText = bestFit + ELLIPSIS;
|
|
52
|
+
var finalWidth = Math.max(MIN_WIDTH, MAX_WIDTH);
|
|
53
|
+
return {
|
|
54
|
+
width: finalWidth,
|
|
55
|
+
displayText: truncatedText
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { calculateTextWidth };
|
|
60
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../../src/components/Charts/CommonChartComponents/utils.ts"],"sourcesContent":["import { MIN_WIDTH, MAX_WIDTH, PADDING_HORIZONTAL } from './tokens';\nimport type { Theme } from '~components/BladeProvider';\n\nconst calculateTextWidth = (text: string, theme: Theme): { width: number; displayText: string } => {\n // Create a temporary canvas to measure text\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) return { width: 80, displayText: text }; // fallback\n\n // Set font properties to match the text styling\n const fontSize = theme.typography.fonts.size[50];\n const fontFamily = theme.typography.fonts.family.text;\n const fontWeight = theme.typography.fonts.weight.medium;\n\n context.font = `${fontWeight} ${fontSize}px ${fontFamily}`;\n\n // Measure the full text first\n const fullTextWidth = context.measureText(text).width;\n const availableWidth = MAX_WIDTH - PADDING_HORIZONTAL;\n\n // If text fits within max width, use it as is\n if (fullTextWidth <= availableWidth) {\n const finalWidth = Math.max(MIN_WIDTH, fullTextWidth + PADDING_HORIZONTAL);\n return { width: finalWidth, displayText: text };\n }\n\n // Text is too long, need to truncate\n const ELLIPSIS = '...';\n const ellipsisWidth = context.measureText(ELLIPSIS).width;\n const maxTextWidth = availableWidth - ellipsisWidth;\n\n // Binary search to find the optimal truncation point\n let left = 0;\n let right = text.length;\n let bestFit = '';\n\n while (left <= right) {\n const mid = Math.floor((left + right) / 2);\n const testText = text.substring(0, mid);\n const testWidth = context.measureText(testText).width;\n\n if (testWidth <= maxTextWidth) {\n bestFit = testText;\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n\n const truncatedText = bestFit + ELLIPSIS;\n const finalWidth = Math.max(MIN_WIDTH, MAX_WIDTH);\n\n return { width: finalWidth, displayText: truncatedText };\n};\n\nexport { calculateTextWidth };\n"],"names":["calculateTextWidth","text","theme","canvas","document","createElement","context","getContext","width","displayText","fontSize","typography","fonts","size","fontFamily","family","fontWeight","weight","medium","font","concat","fullTextWidth","measureText","availableWidth","MAX_WIDTH","PADDING_HORIZONTAL","finalWidth","Math","max","MIN_WIDTH","ELLIPSIS","ellipsisWidth","maxTextWidth","left","right","length","bestFit","mid","floor","testText","substring","testWidth","truncatedText"],"mappings":";;AAGMA,IAAAA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAAY,EAAEC,KAAY,EAA6C;AACjG;AACA,EAAA,IAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC,CAAA;AAC/C,EAAA,IAAMC,OAAO,GAAGH,MAAM,CAACI,UAAU,CAAC,IAAI,CAAC,CAAA;EACvC,IAAI,CAACD,OAAO,EAAE,OAAO;AAAEE,IAAAA,KAAK,EAAE,EAAE;AAAEC,IAAAA,WAAW,EAAER,IAAAA;AAAK,GAAC,CAAC;;AAEtD;EACA,IAAMS,QAAQ,GAAGR,KAAK,CAACS,UAAU,CAACC,KAAK,CAACC,IAAI,CAAC,EAAE,CAAC,CAAA;EAChD,IAAMC,UAAU,GAAGZ,KAAK,CAACS,UAAU,CAACC,KAAK,CAACG,MAAM,CAACd,IAAI,CAAA;EACrD,IAAMe,UAAU,GAAGd,KAAK,CAACS,UAAU,CAACC,KAAK,CAACK,MAAM,CAACC,MAAM,CAAA;AAEvDZ,EAAAA,OAAO,CAACa,IAAI,GAAAC,EAAAA,CAAAA,MAAA,CAAMJ,UAAU,EAAA,GAAA,CAAA,CAAAI,MAAA,CAAIV,QAAQ,EAAA,KAAA,CAAA,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AAM;MACLH,KAAK,GAAGG,GAAG,GAAG,CAAC,CAAA;AACjB,KAAA;AACF,GAAA;AAEA,EAAA,IAAMK,aAAa,GAAGN,OAAO,GAAGN,QAAQ,CAAA;EACxC,IAAMJ,UAAU,GAAGC,IAAI,CAACC,GAAG,CAACC,SAAS,EAAEL,SAAS,CAAC,CAAA;EAEjD,OAAO;AAAEhB,IAAAA,KAAK,EAAEkB,UAAU;AAAEjB,IAAAA,WAAW,EAAEiC,aAAAA;GAAe,CAAA;AAC1D;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { Line as Line$1, ResponsiveContainer, LineChart } from 'recharts';
|
|
5
|
+
import '../utils/index.js';
|
|
6
|
+
import { componentIds } from './componentIds.js';
|
|
7
|
+
import '../../../utils/metaAttribute/index.js';
|
|
8
|
+
import '../../BladeProvider/index.js';
|
|
9
|
+
import '../../Box/BaseBox/index.js';
|
|
10
|
+
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
11
|
+
import '../../../utils/makeAnalyticsAttribute/index.js';
|
|
12
|
+
import '../../../utils/isValidAllowedChildren/index.js';
|
|
13
|
+
import '../../../utils/assignWithoutSideEffects/index.js';
|
|
14
|
+
import { jsx } from 'react/jsx-runtime';
|
|
15
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
16
|
+
import useChartsColorTheme from '../utils/useColorTheme.js';
|
|
17
|
+
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
18
|
+
import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
19
|
+
import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
|
|
20
|
+
import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js';
|
|
21
|
+
import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
22
|
+
|
|
23
|
+
var _excluded = ["color", "strokeStyle", "type", "dot", "activeDot", "showLegend", "_index", "_colorTheme"],
|
|
24
|
+
_excluded2 = ["children", "colorTheme", "testID", "data"];
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
+
var Line = function Line(_ref) {
|
|
28
|
+
var color = _ref.color,
|
|
29
|
+
_ref$strokeStyle = _ref.strokeStyle,
|
|
30
|
+
strokeStyle = _ref$strokeStyle === void 0 ? 'solid' : _ref$strokeStyle,
|
|
31
|
+
_ref$type = _ref.type,
|
|
32
|
+
type = _ref$type === void 0 ? 'monotone' : _ref$type,
|
|
33
|
+
_ref$dot = _ref.dot,
|
|
34
|
+
dot = _ref$dot === void 0 ? false : _ref$dot,
|
|
35
|
+
_ref$activeDot = _ref.activeDot,
|
|
36
|
+
activeDot = _ref$activeDot === void 0 ? true : _ref$activeDot,
|
|
37
|
+
_ref$showLegend = _ref.showLegend,
|
|
38
|
+
showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend,
|
|
39
|
+
_index = _ref._index,
|
|
40
|
+
_colorTheme = _ref._colorTheme,
|
|
41
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
+
var _useTheme = useTheme(),
|
|
43
|
+
theme = _useTheme.theme;
|
|
44
|
+
var themeColors = useChartsColorTheme({
|
|
45
|
+
colorTheme: _colorTheme !== null && _colorTheme !== void 0 ? _colorTheme : 'default'
|
|
46
|
+
});
|
|
47
|
+
var colorToken = color ? getIn(theme.colors, color) : themeColors[_index !== null && _index !== void 0 ? _index : 0];
|
|
48
|
+
var strokeDasharray = strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;
|
|
49
|
+
var isLineDotted = strokeStyle === 'dashed';
|
|
50
|
+
var animationBegin = isLineDotted ? theme.motion.delay.gentle + theme.motion.duration.xgentle : theme.motion.delay.gentle;
|
|
51
|
+
var animationDuration = theme.motion.duration.xgentle;
|
|
52
|
+
return /*#__PURE__*/jsx(Line$1, _objectSpread({
|
|
53
|
+
stroke: colorToken,
|
|
54
|
+
strokeWidth: 3,
|
|
55
|
+
strokeDasharray: strokeDasharray,
|
|
56
|
+
type: type,
|
|
57
|
+
activeDot: activeDot,
|
|
58
|
+
dot: dot,
|
|
59
|
+
legendType: showLegend ? 'line' : 'none',
|
|
60
|
+
animationBegin: animationBegin,
|
|
61
|
+
animationDuration: animationDuration
|
|
62
|
+
}, props));
|
|
63
|
+
};
|
|
64
|
+
var ChartLine = /*#__PURE__*/assignWithoutSideEffects(Line, {
|
|
65
|
+
componentId: componentIds.ChartLine
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Main components
|
|
69
|
+
var ChartLineWrapper = function ChartLineWrapper(_ref2) {
|
|
70
|
+
var children = _ref2.children,
|
|
71
|
+
_ref2$colorTheme = _ref2.colorTheme,
|
|
72
|
+
colorTheme = _ref2$colorTheme === void 0 ? 'default' : _ref2$colorTheme,
|
|
73
|
+
testID = _ref2.testID,
|
|
74
|
+
data = _ref2.data,
|
|
75
|
+
restProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
76
|
+
var lineChartModifiedChildrens = React__default.useMemo(function () {
|
|
77
|
+
var LineChartIndex = 0;
|
|
78
|
+
return React__default.Children.map(children, function (child) {
|
|
79
|
+
if (/*#__PURE__*/React__default.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {
|
|
80
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
81
|
+
_index: LineChartIndex++,
|
|
82
|
+
_colorTheme: colorTheme
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return child;
|
|
86
|
+
});
|
|
87
|
+
}, [children, colorTheme]);
|
|
88
|
+
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
|
|
89
|
+
name: 'line-chart',
|
|
90
|
+
testID: testID
|
|
91
|
+
})), makeAnalyticsAttribute(restProps)), {}, {
|
|
92
|
+
width: "100%",
|
|
93
|
+
height: "100%"
|
|
94
|
+
}, restProps), {}, {
|
|
95
|
+
children: /*#__PURE__*/jsx(ResponsiveContainer, {
|
|
96
|
+
width: "100%",
|
|
97
|
+
height: "100%",
|
|
98
|
+
children: /*#__PURE__*/jsx(LineChart, {
|
|
99
|
+
data: data,
|
|
100
|
+
children: lineChartModifiedChildrens
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { ChartLine, ChartLineWrapper };
|
|
107
|
+
//# sourceMappingURL=LineChart.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChart.web.js","sources":["../../../../../../../src/components/Charts/LineChart/LineChart.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n LineChart as RechartsLineChart,\n Line as RechartsLine,\n ResponsiveContainer as RechartsResponsiveContainer,\n} from 'recharts';\nimport { useChartsColorTheme } from '../utils';\nimport type { ChartLineProps, ChartLineWrapperProps } from './types';\nimport { componentIds } from './componentIds';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst Line: React.FC<ChartLineProps> = ({\n color,\n strokeStyle = 'solid',\n type = 'monotone',\n dot = false,\n activeDot = true,\n showLegend = true,\n _index,\n _colorTheme,\n ...props\n}) => {\n const { theme } = useTheme();\n const themeColors = useChartsColorTheme({ colorTheme: _colorTheme ?? 'default' });\n const colorToken = color ? getIn(theme.colors, color) : themeColors[_index ?? 0];\n\n const strokeDasharray =\n strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;\n\n const isLineDotted = strokeStyle === 'dashed';\n const animationBegin = isLineDotted\n ? theme.motion.delay.gentle + theme.motion.duration.xgentle\n : theme.motion.delay.gentle;\n const animationDuration = theme.motion.duration.xgentle;\n\n return (\n <RechartsLine\n stroke={colorToken}\n strokeWidth={3}\n strokeDasharray={strokeDasharray}\n type={type}\n activeDot={activeDot}\n dot={dot}\n legendType={showLegend ? 'line' : 'none'}\n animationBegin={animationBegin}\n animationDuration={animationDuration}\n {...props}\n />\n );\n};\n\nconst ChartLine = assignWithoutSideEffects(Line, {\n componentId: componentIds.ChartLine,\n});\n\n// Main components\nconst ChartLineWrapper: React.FC<ChartLineWrapperProps & TestID & DataAnalyticsAttribute> = ({\n children,\n colorTheme = 'default',\n testID,\n data,\n ...restProps\n}) => {\n const lineChartModifiedChildrens = React.useMemo(() => {\n let LineChartIndex = 0;\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {\n return React.cloneElement(child, {\n _index: LineChartIndex++,\n _colorTheme: colorTheme,\n } as Partial<ChartLineProps>);\n }\n return child;\n });\n }, [children, colorTheme]);\n return (\n <BaseBox\n {...metaAttribute({ name: 'line-chart', testID })}\n {...makeAnalyticsAttribute(restProps)}\n width=\"100%\"\n height=\"100%\"\n {...restProps}\n >\n <RechartsResponsiveContainer width=\"100%\" height=\"100%\">\n <RechartsLineChart data={data}>{lineChartModifiedChildrens}</RechartsLineChart>\n </RechartsResponsiveContainer>\n </BaseBox>\n );\n};\n\nexport { ChartLine, ChartLineWrapper };\n"],"names":["Line","_ref","color","_ref$strokeStyle","strokeStyle","_ref$type","type","_ref$dot","dot","_ref$activeDot","activeDot","_ref$showLegend","showLegend","_index","_colorTheme","props","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","themeColors","useChartsColorTheme","colorTheme","colorToken","getIn","colors","strokeDasharray","undefined","isLineDotted","animationBegin","motion","delay","gentle","duration","xgentle","animationDuration","_jsx","RechartsLine","_objectSpread","stroke","strokeWidth","legendType","ChartLine","assignWithoutSideEffects","componentId","componentIds","ChartLineWrapper","_ref2","children","_ref2$colorTheme","testID","data","restProps","_excluded2","lineChartModifiedChildrens","React","useMemo","LineChartIndex","Children","map","child","isValidElement","getComponentId","cloneElement","BaseBox","metaAttribute","name","makeAnalyticsAttribute","width","height","RechartsResponsiveContainer","RechartsLineChart"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,IAA8B,GAAG,SAAjCA,IAA8BA,CAAAC,IAAA,EAU9B;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,gBAAA,GAAAF,IAAA,CACLG,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,gBAAA;IAAAE,SAAA,GAAAJ,IAAA,CACrBK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,SAAA;IAAAE,QAAA,GAAAN,IAAA,CACjBO,GAAG;AAAHA,IAAAA,GAAG,GAAAD,QAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,QAAA;IAAAE,cAAA,GAAAR,IAAA,CACXS,SAAS;AAATA,IAAAA,SA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F,KAAK,CAAC,KAAKf,YAAY,CAACH,SAAS,EAAE;AACnF,QAAA,oBAAOa,cAAK,CAACQ,YAAY,CAACH,KAAK,EAAE;UAC/BhD,MAAM,EAAE6C,cAAc,EAAE;AACxB5C,UAAAA,WAAW,EAAES,UAAAA;AACf,SAA4B,CAAC,CAAA;AAC/B,OAAA;AACA,MAAA,OAAOsC,KAAK,CAAA;AACd,KAAC,CAAC,CAAA;AACJ,GAAC,EAAE,CAACZ,QAAQ,EAAE1B,UAAU,CAAC,CAAC,CAAA;AAC1B,EAAA,oBACEc,GAAA,CAAC4B,OAAO,EAAA1B,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA,EAAA,EACF2B,aAAa,CAAC;AAAEC,IAAAA,IAAI,EAAE,YAAY;AAAEhB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EAC7CiB,sBAAsB,CAACf,SAAS,CAAC,CAAA,EAAA,EAAA,EAAA;AACrCgB,IAAAA,KAAK,EAAC,MAAM;AACZC,IAAAA,MAAM,EAAC,MAAA;AAAM,GAAA,EACTjB,SAAS,CAAA,EAAA,EAAA,EAAA;IAAAJ,QAAA,eAEbZ,GAAA,CAACkC,mBAA2B,EAAA;AAACF,MAAAA,KAAK,EAAC,MAAM;AAACC,MAAAA,MAAM,EAAC,MAAM;MAAArB,QAAA,eACrDZ,GAAA,CAACmC,SAAiB,EAAA;AAACpB,QAAAA,IAAI,EAAEA,IAAK;AAAAH,QAAAA,QAAA,EAAEM,0BAAAA;OAA8C,CAAA;KACnD,CAAA;AAAC,GAAA,CACvB,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentIds.js","sources":["../../../../../../../src/components/Charts/LineChart/componentIds.ts"],"sourcesContent":["export const componentIds = {\n ChartLine: 'ChartLine',\n};\n"],"names":["componentIds","ChartLine"],"mappings":"AAAO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,SAAS,EAAE,WAAA;AACb;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/components/Charts/index.ts"],"sourcesContent":["// Export LineCharts (includes shared components)\nexport * from './LineChart';\nexport * from './CommonChartComponents';\n"],"names":[],"mappings":";;;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import '../../BladeProvider/index.js';
|
|
2
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
3
|
+
|
|
4
|
+
var useChartsColorTheme = function useChartsColorTheme(_ref) {
|
|
5
|
+
var _ref$colorTheme = _ref.colorTheme,
|
|
6
|
+
colorTheme = _ref$colorTheme === void 0 ? 'default' : _ref$colorTheme;
|
|
7
|
+
var _useTheme = useTheme(),
|
|
8
|
+
theme = _useTheme.theme;
|
|
9
|
+
var defaultColorThemeArray = [theme.colors.chart.background.categorical.azure.subtle, theme.colors.chart.background.categorical.topaz.moderate, theme.colors.chart.background.categorical.orchid.moderate, theme.colors.chart.background.categorical.emerald.subtle, theme.colors.chart.background.categorical.cider.moderate, theme.colors.chart.background.categorical.sapphire.moderate, theme.colors.chart.background.categorical.magenta.moderate, theme.colors.chart.background.categorical.crimson.subtle, theme.colors.chart.background.categorical.azure.intense, theme.colors.chart.background.categorical.topaz.intense, theme.colors.chart.background.categorical.orchid.intense, theme.colors.chart.background.categorical.emerald.intense, theme.colors.chart.background.categorical.sapphire.intense, theme.colors.chart.background.categorical.magenta.intense, theme.colors.chart.background.categorical.cider.intense, theme.colors.chart.background.categorical.crimson.intense];
|
|
10
|
+
if (colorTheme !== 'default') {
|
|
11
|
+
console.log('Currently we only support default color theme');
|
|
12
|
+
}
|
|
13
|
+
//TODO:Currently we only have one color theme will add more color theme later.
|
|
14
|
+
|
|
15
|
+
return defaultColorThemeArray;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useChartsColorTheme as default };
|
|
19
|
+
//# sourceMappingURL=useColorTheme.js.map
|