@adiba-banking-cloud/backoffice 0.0.28 → 0.0.29
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/index.cjs.js/index.js +232 -21
- package/build/index.esm.js/index.js +232 -22
- package/build/typings/components/charts/area/Area.d.ts +3 -0
- package/build/typings/components/charts/area/Area.default.d.ts +2 -0
- package/build/typings/components/charts/area/Area.stories.d.ts +6 -0
- package/build/typings/components/charts/area/Area.types.d.ts +59 -0
- package/build/typings/components/index.d.ts +1 -0
- package/build/typings/shared/libs/charts.d.ts +24 -0
- package/package.json +1 -1
|
@@ -11170,7 +11170,7 @@ function requireHighcharts() {
|
|
|
11170
11170
|
var highchartsExports = requireHighcharts();
|
|
11171
11171
|
var Highcharts = /*@__PURE__*/getDefaultExportFromCjs(highchartsExports);
|
|
11172
11172
|
|
|
11173
|
-
const initChart = props => {
|
|
11173
|
+
const initChart$1 = props => {
|
|
11174
11174
|
return {
|
|
11175
11175
|
chart: {
|
|
11176
11176
|
type: "column",
|
|
@@ -11210,8 +11210,88 @@ const initChart = props => {
|
|
|
11210
11210
|
};
|
|
11211
11211
|
};
|
|
11212
11212
|
|
|
11213
|
-
|
|
11214
|
-
|
|
11213
|
+
const computeBoundary = items => {
|
|
11214
|
+
return Math.ceil(Math.max(...items) * 1.1 / 10) * 10;
|
|
11215
|
+
};
|
|
11216
|
+
const computeDelta = (items, boundary) => {
|
|
11217
|
+
return items.map(item => {
|
|
11218
|
+
if (!boundary) return 100;
|
|
11219
|
+
return boundary - item;
|
|
11220
|
+
});
|
|
11221
|
+
};
|
|
11222
|
+
const parseColorToRgb = colorString => {
|
|
11223
|
+
if (colorString.startsWith("#")) {
|
|
11224
|
+
const hex = colorString.slice(1);
|
|
11225
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
11226
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
11227
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
11228
|
+
return {
|
|
11229
|
+
r,
|
|
11230
|
+
g,
|
|
11231
|
+
b
|
|
11232
|
+
};
|
|
11233
|
+
} else if (colorString.startsWith("rgb")) {
|
|
11234
|
+
var _colorString$match;
|
|
11235
|
+
const parts = (_colorString$match = colorString.match(/\d+/g)) === null || _colorString$match === void 0 ? void 0 : _colorString$match.map(Number);
|
|
11236
|
+
if (parts !== null && parts !== void 0 && parts.length) return {
|
|
11237
|
+
r: parts[0],
|
|
11238
|
+
g: parts[1],
|
|
11239
|
+
b: parts[2]
|
|
11240
|
+
};
|
|
11241
|
+
}
|
|
11242
|
+
console.warn("Color format '".concat(colorString, "' not fully recognized. Using black as fallback."));
|
|
11243
|
+
return {
|
|
11244
|
+
r: 0,
|
|
11245
|
+
g: 0,
|
|
11246
|
+
b: 0
|
|
11247
|
+
};
|
|
11248
|
+
};
|
|
11249
|
+
|
|
11250
|
+
/**
|
|
11251
|
+
* Creates a Highcharts linear gradient fillColor configuration for an Area/AreaSpline series.
|
|
11252
|
+
* The gradient flows vertically from the baseColor (at the series line) down to the x-axis,
|
|
11253
|
+
* fading to a transparent version of the baseColor.
|
|
11254
|
+
*
|
|
11255
|
+
* @param {string} baseColor The primary color for the gradient (e.g., '#FF0000', 'rgb(0,128,255)').
|
|
11256
|
+
* @param {object} [options] Configuration options for the gradient.
|
|
11257
|
+
* @param {number} [options.startOpacity=0.7] The opacity of the `baseColor` at the top (near the series line, position 0).
|
|
11258
|
+
* Value should be between 0 (fully transparent) and 1 (fully opaque).
|
|
11259
|
+
* @param {number} [options.endOpacity=0.0] The opacity of the transparent end color at the bottom (near the x-axis, position 1).
|
|
11260
|
+
* Value should be between 0 (fully transparent) and 1 (fully opaque).
|
|
11261
|
+
* @returns {Highcharts.GradientColorObject} A Highcharts `fillColor` configuration object.
|
|
11262
|
+
*/
|
|
11263
|
+
const createAreaFillGradient = function (baseColor) {
|
|
11264
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11265
|
+
const {
|
|
11266
|
+
startOpacity = 0.6,
|
|
11267
|
+
endOpacity = 0.0
|
|
11268
|
+
} = options;
|
|
11269
|
+
const parsedColor = parseColorToRgb(baseColor);
|
|
11270
|
+
|
|
11271
|
+
// Color string for the top of the gradient (base color with specified start opacity)
|
|
11272
|
+
const rgbaStart = "rgba(".concat(parsedColor.r, ", ").concat(parsedColor.g, ", ").concat(parsedColor.b, ", ").concat(startOpacity, ")");
|
|
11273
|
+
|
|
11274
|
+
// Color string for the bottom of the gradient (always transparent version of base color)
|
|
11275
|
+
const rgbaEnd = "rgba(".concat(parsedColor.r, ", ").concat(parsedColor.g, ", ").concat(parsedColor.b, ", ").concat(endOpacity, ")");
|
|
11276
|
+
return {
|
|
11277
|
+
linearGradient: {
|
|
11278
|
+
x1: 0,
|
|
11279
|
+
// Gradient starts at the left edge
|
|
11280
|
+
y1: 0,
|
|
11281
|
+
// Gradient starts at the top edge
|
|
11282
|
+
x2: 0,
|
|
11283
|
+
// Gradient ends at the left edge (same x as start)
|
|
11284
|
+
y2: 1 // Gradient ends at the bottom edge (so it's a vertical gradient)
|
|
11285
|
+
},
|
|
11286
|
+
stops: [[0, rgbaStart],
|
|
11287
|
+
// First stop: at the top (0% of gradient vector)
|
|
11288
|
+
[1, rgbaEnd] // Second stop: at the bottom (100% of gradient vector)
|
|
11289
|
+
]
|
|
11290
|
+
};
|
|
11291
|
+
};
|
|
11292
|
+
|
|
11293
|
+
function ownKeys$1(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; }
|
|
11294
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11215
11295
|
|
|
11216
11296
|
// Initialize Highcharts with rounded corners
|
|
11217
11297
|
if (typeof window !== "undefined") {
|
|
@@ -11220,13 +11300,8 @@ if (typeof window !== "undefined") {
|
|
|
11220
11300
|
const Column = props => {
|
|
11221
11301
|
const chartRef = React.useRef(null);
|
|
11222
11302
|
const chartOptions = React.useMemo(() => {
|
|
11223
|
-
const
|
|
11224
|
-
|
|
11225
|
-
};
|
|
11226
|
-
const column = _objectSpread(_objectSpread({}, props), {
|
|
11227
|
-
chart
|
|
11228
|
-
});
|
|
11229
|
-
return _objectSpread(_objectSpread({}, initChart(column)), initSeries(column));
|
|
11303
|
+
const column = _objectSpread$1({}, props);
|
|
11304
|
+
return _objectSpread$1(_objectSpread$1({}, initChart$1(column)), initSeries$1(column));
|
|
11230
11305
|
}, [props]);
|
|
11231
11306
|
React.useEffect(() => {
|
|
11232
11307
|
if (chartRef.current && chartRef.current.chart) {
|
|
@@ -11272,7 +11347,7 @@ const StackedColumn = props => {
|
|
|
11272
11347
|
equalizer: false
|
|
11273
11348
|
}));
|
|
11274
11349
|
};
|
|
11275
|
-
const initSeries = props => {
|
|
11350
|
+
const initSeries$1 = props => {
|
|
11276
11351
|
const renderXAxis = categories => ({
|
|
11277
11352
|
categories,
|
|
11278
11353
|
labels: {
|
|
@@ -11282,7 +11357,7 @@ const initSeries = props => {
|
|
|
11282
11357
|
}
|
|
11283
11358
|
}
|
|
11284
11359
|
});
|
|
11285
|
-
const renderYAxis = (
|
|
11360
|
+
const renderYAxis = (equalizer, series) => ({
|
|
11286
11361
|
allowDecimals: false,
|
|
11287
11362
|
title: {
|
|
11288
11363
|
text: null
|
|
@@ -11329,7 +11404,7 @@ const initSeries = props => {
|
|
|
11329
11404
|
enableMouseTracking: false,
|
|
11330
11405
|
showInLegend: false
|
|
11331
11406
|
});
|
|
11332
|
-
const mainSeries = _objectSpread(_objectSpread({}, fillSeries(boundary)), {
|
|
11407
|
+
const mainSeries = _objectSpread$1(_objectSpread$1({}, fillSeries(boundary)), {
|
|
11333
11408
|
name: props.yAxisLabel[0],
|
|
11334
11409
|
color: seriesColors ? seriesColors[0] : "gray",
|
|
11335
11410
|
data: seriesData[0],
|
|
@@ -11369,7 +11444,7 @@ const initSeries = props => {
|
|
|
11369
11444
|
pointWidth: undefined
|
|
11370
11445
|
}
|
|
11371
11446
|
};
|
|
11372
|
-
const plot = _objectSpread(_objectSpread({}, {
|
|
11447
|
+
const plot = _objectSpread$1(_objectSpread$1({}, {
|
|
11373
11448
|
column: {
|
|
11374
11449
|
borderWidth: 0,
|
|
11375
11450
|
borderRadius: 10
|
|
@@ -11379,20 +11454,155 @@ const initSeries = props => {
|
|
|
11379
11454
|
};
|
|
11380
11455
|
return {
|
|
11381
11456
|
xAxis: renderXAxis(props.xAxisLabel),
|
|
11382
|
-
yAxis: renderYAxis(props.
|
|
11457
|
+
yAxis: renderYAxis(props.equalizer, props.series),
|
|
11383
11458
|
plotOptions: renderPlot(props.equalizer),
|
|
11384
11459
|
series: renderSeries(props.series, props === null || props === void 0 ? void 0 : props.colors, props.equalizer)
|
|
11385
11460
|
};
|
|
11386
11461
|
};
|
|
11387
|
-
|
|
11388
|
-
|
|
11462
|
+
|
|
11463
|
+
const initChart = props => {
|
|
11464
|
+
return {
|
|
11465
|
+
chart: {
|
|
11466
|
+
type: "areaspline",
|
|
11467
|
+
backgroundColor: (props === null || props === void 0 ? void 0 : props.bgColor) || "rgba(255, 255, 255, 0)",
|
|
11468
|
+
plotBackgroundColor: (props === null || props === void 0 ? void 0 : props.plotBgColor) || "rgba(255, 255, 255, 0)"
|
|
11469
|
+
},
|
|
11470
|
+
tooltip: {
|
|
11471
|
+
backgroundColor: "#0F193D",
|
|
11472
|
+
borderColor: "black",
|
|
11473
|
+
borderRadius: 5,
|
|
11474
|
+
borderWidth: 1,
|
|
11475
|
+
style: {
|
|
11476
|
+
color: "white"
|
|
11477
|
+
},
|
|
11478
|
+
format: props.series.length > 1 ? "<b>{key}</b><br/>{series.name}: <b>{y}</b><br/>" + "Total: <b>{point.stackTotal}</b>" : "<b>{key}</b><br/>{series.name}: {y}<br/>"
|
|
11479
|
+
},
|
|
11480
|
+
credits: {
|
|
11481
|
+
enabled: false
|
|
11482
|
+
},
|
|
11483
|
+
exporting: {
|
|
11484
|
+
enabled: false
|
|
11485
|
+
},
|
|
11486
|
+
title: {
|
|
11487
|
+
text: props.title || null
|
|
11488
|
+
},
|
|
11489
|
+
labels: {
|
|
11490
|
+
style: {
|
|
11491
|
+
color: "#575E77"
|
|
11492
|
+
}
|
|
11493
|
+
},
|
|
11494
|
+
legend: {
|
|
11495
|
+
enabled: props.withLegend,
|
|
11496
|
+
align: "right",
|
|
11497
|
+
verticalAlign: "top"
|
|
11498
|
+
}
|
|
11499
|
+
};
|
|
11389
11500
|
};
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11501
|
+
|
|
11502
|
+
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; }
|
|
11503
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).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; }
|
|
11504
|
+
const Area = props => {
|
|
11505
|
+
const chartRef = React.useRef(null);
|
|
11506
|
+
const chartOptions = React.useMemo(() => {
|
|
11507
|
+
const area = _objectSpread({}, props);
|
|
11508
|
+
return _objectSpread(_objectSpread({}, initChart(area)), initSeries(area));
|
|
11509
|
+
}, [props]);
|
|
11510
|
+
React.useEffect(() => {
|
|
11511
|
+
if (chartRef.current && chartRef.current.chart) {
|
|
11512
|
+
chartRef.current.chart.update(chartOptions, true);
|
|
11513
|
+
}
|
|
11514
|
+
}, [chartOptions]);
|
|
11515
|
+
return /*#__PURE__*/React.createElement(HighchartsReact, {
|
|
11516
|
+
highcharts: Highcharts,
|
|
11517
|
+
ref: chartRef,
|
|
11518
|
+
options: chartOptions
|
|
11394
11519
|
});
|
|
11395
11520
|
};
|
|
11521
|
+
const SimpleArea = props => {
|
|
11522
|
+
const chartOptions = {
|
|
11523
|
+
xAxisLabel: props.xAxisLabel,
|
|
11524
|
+
yAxisLabel: [props.yAxisLabel],
|
|
11525
|
+
series: [props.series],
|
|
11526
|
+
withLegend: props.withLegend,
|
|
11527
|
+
withCrossHair: props.withCrossHair,
|
|
11528
|
+
bgColor: props.bgColor,
|
|
11529
|
+
plotBgColor: props.plotBgColor,
|
|
11530
|
+
colors: [props.color || "gray"],
|
|
11531
|
+
title: props.title
|
|
11532
|
+
};
|
|
11533
|
+
return /*#__PURE__*/React.createElement(Area, chartOptions);
|
|
11534
|
+
};
|
|
11535
|
+
const initSeries = props => {
|
|
11536
|
+
const renderXAxis = () => {
|
|
11537
|
+
var _props$colors;
|
|
11538
|
+
const crosshair = props.withCrossHair ? {
|
|
11539
|
+
color: props !== null && props !== void 0 && (_props$colors = props.colors) !== null && _props$colors !== void 0 && _props$colors.length ? props === null || props === void 0 ? void 0 : props.colors[0] : "#ccc",
|
|
11540
|
+
width: 2,
|
|
11541
|
+
dashStyle: "Dot",
|
|
11542
|
+
snap: true
|
|
11543
|
+
} : undefined;
|
|
11544
|
+
const categories = props.xAxisLabel;
|
|
11545
|
+
const labels = {
|
|
11546
|
+
style: {
|
|
11547
|
+
textTransform: "uppercase",
|
|
11548
|
+
color: "#575E77"
|
|
11549
|
+
}
|
|
11550
|
+
};
|
|
11551
|
+
return {
|
|
11552
|
+
categories,
|
|
11553
|
+
crosshair,
|
|
11554
|
+
labels
|
|
11555
|
+
};
|
|
11556
|
+
};
|
|
11557
|
+
const renderYAxis = () => {
|
|
11558
|
+
const defaults = {
|
|
11559
|
+
allowDecimals: false,
|
|
11560
|
+
title: {
|
|
11561
|
+
text: null
|
|
11562
|
+
},
|
|
11563
|
+
gridLineDashStyle: "Dot",
|
|
11564
|
+
gridLineWidth: 2
|
|
11565
|
+
};
|
|
11566
|
+
const labels = {
|
|
11567
|
+
color: "#575E77"
|
|
11568
|
+
};
|
|
11569
|
+
return _objectSpread(_objectSpread({}, defaults), {
|
|
11570
|
+
labels
|
|
11571
|
+
});
|
|
11572
|
+
};
|
|
11573
|
+
const renderPlot = () => {
|
|
11574
|
+
const areaspline = {
|
|
11575
|
+
lineWidth: 1,
|
|
11576
|
+
opacity: 0.3,
|
|
11577
|
+
color: "#C8700B",
|
|
11578
|
+
pointPlacement: "on",
|
|
11579
|
+
marker: {
|
|
11580
|
+
enabled: false
|
|
11581
|
+
}
|
|
11582
|
+
};
|
|
11583
|
+
return {
|
|
11584
|
+
areaspline
|
|
11585
|
+
};
|
|
11586
|
+
};
|
|
11587
|
+
const renderSeries = () => {
|
|
11588
|
+
const series = props.series.map((value, key) => {
|
|
11589
|
+
var _props$colors2, _props$colors3;
|
|
11590
|
+
return {
|
|
11591
|
+
name: props.yAxisLabel[key],
|
|
11592
|
+
color: (_props$colors2 = props.colors) !== null && _props$colors2 !== void 0 && _props$colors2.length ? props.colors[key] : "#C8700B",
|
|
11593
|
+
data: value,
|
|
11594
|
+
fillColor: createAreaFillGradient((_props$colors3 = props.colors) !== null && _props$colors3 !== void 0 && _props$colors3.length ? props.colors[key] : "#C8700B")
|
|
11595
|
+
};
|
|
11596
|
+
});
|
|
11597
|
+
return series;
|
|
11598
|
+
};
|
|
11599
|
+
return {
|
|
11600
|
+
xAxis: renderXAxis(),
|
|
11601
|
+
yAxis: renderYAxis(),
|
|
11602
|
+
plotOptions: renderPlot(),
|
|
11603
|
+
series: renderSeries()
|
|
11604
|
+
};
|
|
11605
|
+
};
|
|
11396
11606
|
|
|
11397
11607
|
const Icons = _ref => {
|
|
11398
11608
|
let {
|
|
@@ -12676,6 +12886,7 @@ exports.PaymentMethod = PaymentMethod;
|
|
|
12676
12886
|
exports.PaymentMethodAdd = PaymentMethodAdd;
|
|
12677
12887
|
exports.SearchPanel = SearchPanel;
|
|
12678
12888
|
exports.SideMenu = SideMenu;
|
|
12889
|
+
exports.SimpleArea = SimpleArea;
|
|
12679
12890
|
exports.SimpleColumn = SimpleColumn;
|
|
12680
12891
|
exports.SimplePanel = SimplePanel;
|
|
12681
12892
|
exports.SimpleTable = SimpleTable;
|
|
@@ -11149,7 +11149,7 @@ function requireHighcharts() {
|
|
|
11149
11149
|
var highchartsExports = requireHighcharts();
|
|
11150
11150
|
var Highcharts = /*@__PURE__*/getDefaultExportFromCjs(highchartsExports);
|
|
11151
11151
|
|
|
11152
|
-
const initChart = props => {
|
|
11152
|
+
const initChart$1 = props => {
|
|
11153
11153
|
return {
|
|
11154
11154
|
chart: {
|
|
11155
11155
|
type: "column",
|
|
@@ -11189,8 +11189,88 @@ const initChart = props => {
|
|
|
11189
11189
|
};
|
|
11190
11190
|
};
|
|
11191
11191
|
|
|
11192
|
-
|
|
11193
|
-
|
|
11192
|
+
const computeBoundary = items => {
|
|
11193
|
+
return Math.ceil(Math.max(...items) * 1.1 / 10) * 10;
|
|
11194
|
+
};
|
|
11195
|
+
const computeDelta = (items, boundary) => {
|
|
11196
|
+
return items.map(item => {
|
|
11197
|
+
if (!boundary) return 100;
|
|
11198
|
+
return boundary - item;
|
|
11199
|
+
});
|
|
11200
|
+
};
|
|
11201
|
+
const parseColorToRgb = colorString => {
|
|
11202
|
+
if (colorString.startsWith("#")) {
|
|
11203
|
+
const hex = colorString.slice(1);
|
|
11204
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
11205
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
11206
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
11207
|
+
return {
|
|
11208
|
+
r,
|
|
11209
|
+
g,
|
|
11210
|
+
b
|
|
11211
|
+
};
|
|
11212
|
+
} else if (colorString.startsWith("rgb")) {
|
|
11213
|
+
var _colorString$match;
|
|
11214
|
+
const parts = (_colorString$match = colorString.match(/\d+/g)) === null || _colorString$match === void 0 ? void 0 : _colorString$match.map(Number);
|
|
11215
|
+
if (parts !== null && parts !== void 0 && parts.length) return {
|
|
11216
|
+
r: parts[0],
|
|
11217
|
+
g: parts[1],
|
|
11218
|
+
b: parts[2]
|
|
11219
|
+
};
|
|
11220
|
+
}
|
|
11221
|
+
console.warn("Color format '".concat(colorString, "' not fully recognized. Using black as fallback."));
|
|
11222
|
+
return {
|
|
11223
|
+
r: 0,
|
|
11224
|
+
g: 0,
|
|
11225
|
+
b: 0
|
|
11226
|
+
};
|
|
11227
|
+
};
|
|
11228
|
+
|
|
11229
|
+
/**
|
|
11230
|
+
* Creates a Highcharts linear gradient fillColor configuration for an Area/AreaSpline series.
|
|
11231
|
+
* The gradient flows vertically from the baseColor (at the series line) down to the x-axis,
|
|
11232
|
+
* fading to a transparent version of the baseColor.
|
|
11233
|
+
*
|
|
11234
|
+
* @param {string} baseColor The primary color for the gradient (e.g., '#FF0000', 'rgb(0,128,255)').
|
|
11235
|
+
* @param {object} [options] Configuration options for the gradient.
|
|
11236
|
+
* @param {number} [options.startOpacity=0.7] The opacity of the `baseColor` at the top (near the series line, position 0).
|
|
11237
|
+
* Value should be between 0 (fully transparent) and 1 (fully opaque).
|
|
11238
|
+
* @param {number} [options.endOpacity=0.0] The opacity of the transparent end color at the bottom (near the x-axis, position 1).
|
|
11239
|
+
* Value should be between 0 (fully transparent) and 1 (fully opaque).
|
|
11240
|
+
* @returns {Highcharts.GradientColorObject} A Highcharts `fillColor` configuration object.
|
|
11241
|
+
*/
|
|
11242
|
+
const createAreaFillGradient = function (baseColor) {
|
|
11243
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11244
|
+
const {
|
|
11245
|
+
startOpacity = 0.6,
|
|
11246
|
+
endOpacity = 0.0
|
|
11247
|
+
} = options;
|
|
11248
|
+
const parsedColor = parseColorToRgb(baseColor);
|
|
11249
|
+
|
|
11250
|
+
// Color string for the top of the gradient (base color with specified start opacity)
|
|
11251
|
+
const rgbaStart = "rgba(".concat(parsedColor.r, ", ").concat(parsedColor.g, ", ").concat(parsedColor.b, ", ").concat(startOpacity, ")");
|
|
11252
|
+
|
|
11253
|
+
// Color string for the bottom of the gradient (always transparent version of base color)
|
|
11254
|
+
const rgbaEnd = "rgba(".concat(parsedColor.r, ", ").concat(parsedColor.g, ", ").concat(parsedColor.b, ", ").concat(endOpacity, ")");
|
|
11255
|
+
return {
|
|
11256
|
+
linearGradient: {
|
|
11257
|
+
x1: 0,
|
|
11258
|
+
// Gradient starts at the left edge
|
|
11259
|
+
y1: 0,
|
|
11260
|
+
// Gradient starts at the top edge
|
|
11261
|
+
x2: 0,
|
|
11262
|
+
// Gradient ends at the left edge (same x as start)
|
|
11263
|
+
y2: 1 // Gradient ends at the bottom edge (so it's a vertical gradient)
|
|
11264
|
+
},
|
|
11265
|
+
stops: [[0, rgbaStart],
|
|
11266
|
+
// First stop: at the top (0% of gradient vector)
|
|
11267
|
+
[1, rgbaEnd] // Second stop: at the bottom (100% of gradient vector)
|
|
11268
|
+
]
|
|
11269
|
+
};
|
|
11270
|
+
};
|
|
11271
|
+
|
|
11272
|
+
function ownKeys$1(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; }
|
|
11273
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11194
11274
|
|
|
11195
11275
|
// Initialize Highcharts with rounded corners
|
|
11196
11276
|
if (typeof window !== "undefined") {
|
|
@@ -11199,13 +11279,8 @@ if (typeof window !== "undefined") {
|
|
|
11199
11279
|
const Column = props => {
|
|
11200
11280
|
const chartRef = useRef(null);
|
|
11201
11281
|
const chartOptions = useMemo(() => {
|
|
11202
|
-
const
|
|
11203
|
-
|
|
11204
|
-
};
|
|
11205
|
-
const column = _objectSpread(_objectSpread({}, props), {
|
|
11206
|
-
chart
|
|
11207
|
-
});
|
|
11208
|
-
return _objectSpread(_objectSpread({}, initChart(column)), initSeries(column));
|
|
11282
|
+
const column = _objectSpread$1({}, props);
|
|
11283
|
+
return _objectSpread$1(_objectSpread$1({}, initChart$1(column)), initSeries$1(column));
|
|
11209
11284
|
}, [props]);
|
|
11210
11285
|
useEffect(() => {
|
|
11211
11286
|
if (chartRef.current && chartRef.current.chart) {
|
|
@@ -11251,7 +11326,7 @@ const StackedColumn = props => {
|
|
|
11251
11326
|
equalizer: false
|
|
11252
11327
|
}));
|
|
11253
11328
|
};
|
|
11254
|
-
const initSeries = props => {
|
|
11329
|
+
const initSeries$1 = props => {
|
|
11255
11330
|
const renderXAxis = categories => ({
|
|
11256
11331
|
categories,
|
|
11257
11332
|
labels: {
|
|
@@ -11261,7 +11336,7 @@ const initSeries = props => {
|
|
|
11261
11336
|
}
|
|
11262
11337
|
}
|
|
11263
11338
|
});
|
|
11264
|
-
const renderYAxis = (
|
|
11339
|
+
const renderYAxis = (equalizer, series) => ({
|
|
11265
11340
|
allowDecimals: false,
|
|
11266
11341
|
title: {
|
|
11267
11342
|
text: null
|
|
@@ -11308,7 +11383,7 @@ const initSeries = props => {
|
|
|
11308
11383
|
enableMouseTracking: false,
|
|
11309
11384
|
showInLegend: false
|
|
11310
11385
|
});
|
|
11311
|
-
const mainSeries = _objectSpread(_objectSpread({}, fillSeries(boundary)), {
|
|
11386
|
+
const mainSeries = _objectSpread$1(_objectSpread$1({}, fillSeries(boundary)), {
|
|
11312
11387
|
name: props.yAxisLabel[0],
|
|
11313
11388
|
color: seriesColors ? seriesColors[0] : "gray",
|
|
11314
11389
|
data: seriesData[0],
|
|
@@ -11348,7 +11423,7 @@ const initSeries = props => {
|
|
|
11348
11423
|
pointWidth: undefined
|
|
11349
11424
|
}
|
|
11350
11425
|
};
|
|
11351
|
-
const plot = _objectSpread(_objectSpread({}, {
|
|
11426
|
+
const plot = _objectSpread$1(_objectSpread$1({}, {
|
|
11352
11427
|
column: {
|
|
11353
11428
|
borderWidth: 0,
|
|
11354
11429
|
borderRadius: 10
|
|
@@ -11358,20 +11433,155 @@ const initSeries = props => {
|
|
|
11358
11433
|
};
|
|
11359
11434
|
return {
|
|
11360
11435
|
xAxis: renderXAxis(props.xAxisLabel),
|
|
11361
|
-
yAxis: renderYAxis(props.
|
|
11436
|
+
yAxis: renderYAxis(props.equalizer, props.series),
|
|
11362
11437
|
plotOptions: renderPlot(props.equalizer),
|
|
11363
11438
|
series: renderSeries(props.series, props === null || props === void 0 ? void 0 : props.colors, props.equalizer)
|
|
11364
11439
|
};
|
|
11365
11440
|
};
|
|
11366
|
-
|
|
11367
|
-
|
|
11441
|
+
|
|
11442
|
+
const initChart = props => {
|
|
11443
|
+
return {
|
|
11444
|
+
chart: {
|
|
11445
|
+
type: "areaspline",
|
|
11446
|
+
backgroundColor: (props === null || props === void 0 ? void 0 : props.bgColor) || "rgba(255, 255, 255, 0)",
|
|
11447
|
+
plotBackgroundColor: (props === null || props === void 0 ? void 0 : props.plotBgColor) || "rgba(255, 255, 255, 0)"
|
|
11448
|
+
},
|
|
11449
|
+
tooltip: {
|
|
11450
|
+
backgroundColor: "#0F193D",
|
|
11451
|
+
borderColor: "black",
|
|
11452
|
+
borderRadius: 5,
|
|
11453
|
+
borderWidth: 1,
|
|
11454
|
+
style: {
|
|
11455
|
+
color: "white"
|
|
11456
|
+
},
|
|
11457
|
+
format: props.series.length > 1 ? "<b>{key}</b><br/>{series.name}: <b>{y}</b><br/>" + "Total: <b>{point.stackTotal}</b>" : "<b>{key}</b><br/>{series.name}: {y}<br/>"
|
|
11458
|
+
},
|
|
11459
|
+
credits: {
|
|
11460
|
+
enabled: false
|
|
11461
|
+
},
|
|
11462
|
+
exporting: {
|
|
11463
|
+
enabled: false
|
|
11464
|
+
},
|
|
11465
|
+
title: {
|
|
11466
|
+
text: props.title || null
|
|
11467
|
+
},
|
|
11468
|
+
labels: {
|
|
11469
|
+
style: {
|
|
11470
|
+
color: "#575E77"
|
|
11471
|
+
}
|
|
11472
|
+
},
|
|
11473
|
+
legend: {
|
|
11474
|
+
enabled: props.withLegend,
|
|
11475
|
+
align: "right",
|
|
11476
|
+
verticalAlign: "top"
|
|
11477
|
+
}
|
|
11478
|
+
};
|
|
11368
11479
|
};
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11480
|
+
|
|
11481
|
+
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; }
|
|
11482
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).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; }
|
|
11483
|
+
const Area = props => {
|
|
11484
|
+
const chartRef = useRef(null);
|
|
11485
|
+
const chartOptions = useMemo(() => {
|
|
11486
|
+
const area = _objectSpread({}, props);
|
|
11487
|
+
return _objectSpread(_objectSpread({}, initChart(area)), initSeries(area));
|
|
11488
|
+
}, [props]);
|
|
11489
|
+
useEffect(() => {
|
|
11490
|
+
if (chartRef.current && chartRef.current.chart) {
|
|
11491
|
+
chartRef.current.chart.update(chartOptions, true);
|
|
11492
|
+
}
|
|
11493
|
+
}, [chartOptions]);
|
|
11494
|
+
return /*#__PURE__*/React.createElement(HighchartsReact, {
|
|
11495
|
+
highcharts: Highcharts,
|
|
11496
|
+
ref: chartRef,
|
|
11497
|
+
options: chartOptions
|
|
11373
11498
|
});
|
|
11374
11499
|
};
|
|
11500
|
+
const SimpleArea = props => {
|
|
11501
|
+
const chartOptions = {
|
|
11502
|
+
xAxisLabel: props.xAxisLabel,
|
|
11503
|
+
yAxisLabel: [props.yAxisLabel],
|
|
11504
|
+
series: [props.series],
|
|
11505
|
+
withLegend: props.withLegend,
|
|
11506
|
+
withCrossHair: props.withCrossHair,
|
|
11507
|
+
bgColor: props.bgColor,
|
|
11508
|
+
plotBgColor: props.plotBgColor,
|
|
11509
|
+
colors: [props.color || "gray"],
|
|
11510
|
+
title: props.title
|
|
11511
|
+
};
|
|
11512
|
+
return /*#__PURE__*/React.createElement(Area, chartOptions);
|
|
11513
|
+
};
|
|
11514
|
+
const initSeries = props => {
|
|
11515
|
+
const renderXAxis = () => {
|
|
11516
|
+
var _props$colors;
|
|
11517
|
+
const crosshair = props.withCrossHair ? {
|
|
11518
|
+
color: props !== null && props !== void 0 && (_props$colors = props.colors) !== null && _props$colors !== void 0 && _props$colors.length ? props === null || props === void 0 ? void 0 : props.colors[0] : "#ccc",
|
|
11519
|
+
width: 2,
|
|
11520
|
+
dashStyle: "Dot",
|
|
11521
|
+
snap: true
|
|
11522
|
+
} : undefined;
|
|
11523
|
+
const categories = props.xAxisLabel;
|
|
11524
|
+
const labels = {
|
|
11525
|
+
style: {
|
|
11526
|
+
textTransform: "uppercase",
|
|
11527
|
+
color: "#575E77"
|
|
11528
|
+
}
|
|
11529
|
+
};
|
|
11530
|
+
return {
|
|
11531
|
+
categories,
|
|
11532
|
+
crosshair,
|
|
11533
|
+
labels
|
|
11534
|
+
};
|
|
11535
|
+
};
|
|
11536
|
+
const renderYAxis = () => {
|
|
11537
|
+
const defaults = {
|
|
11538
|
+
allowDecimals: false,
|
|
11539
|
+
title: {
|
|
11540
|
+
text: null
|
|
11541
|
+
},
|
|
11542
|
+
gridLineDashStyle: "Dot",
|
|
11543
|
+
gridLineWidth: 2
|
|
11544
|
+
};
|
|
11545
|
+
const labels = {
|
|
11546
|
+
color: "#575E77"
|
|
11547
|
+
};
|
|
11548
|
+
return _objectSpread(_objectSpread({}, defaults), {
|
|
11549
|
+
labels
|
|
11550
|
+
});
|
|
11551
|
+
};
|
|
11552
|
+
const renderPlot = () => {
|
|
11553
|
+
const areaspline = {
|
|
11554
|
+
lineWidth: 1,
|
|
11555
|
+
opacity: 0.3,
|
|
11556
|
+
color: "#C8700B",
|
|
11557
|
+
pointPlacement: "on",
|
|
11558
|
+
marker: {
|
|
11559
|
+
enabled: false
|
|
11560
|
+
}
|
|
11561
|
+
};
|
|
11562
|
+
return {
|
|
11563
|
+
areaspline
|
|
11564
|
+
};
|
|
11565
|
+
};
|
|
11566
|
+
const renderSeries = () => {
|
|
11567
|
+
const series = props.series.map((value, key) => {
|
|
11568
|
+
var _props$colors2, _props$colors3;
|
|
11569
|
+
return {
|
|
11570
|
+
name: props.yAxisLabel[key],
|
|
11571
|
+
color: (_props$colors2 = props.colors) !== null && _props$colors2 !== void 0 && _props$colors2.length ? props.colors[key] : "#C8700B",
|
|
11572
|
+
data: value,
|
|
11573
|
+
fillColor: createAreaFillGradient((_props$colors3 = props.colors) !== null && _props$colors3 !== void 0 && _props$colors3.length ? props.colors[key] : "#C8700B")
|
|
11574
|
+
};
|
|
11575
|
+
});
|
|
11576
|
+
return series;
|
|
11577
|
+
};
|
|
11578
|
+
return {
|
|
11579
|
+
xAxis: renderXAxis(),
|
|
11580
|
+
yAxis: renderYAxis(),
|
|
11581
|
+
plotOptions: renderPlot(),
|
|
11582
|
+
series: renderSeries()
|
|
11583
|
+
};
|
|
11584
|
+
};
|
|
11375
11585
|
|
|
11376
11586
|
const Icons = _ref => {
|
|
11377
11587
|
let {
|
|
@@ -12640,4 +12850,4 @@ const File = _ref => {
|
|
|
12640
12850
|
}, /*#__PURE__*/React.createElement(Icons, rightsection === null || rightsection === void 0 ? void 0 : rightsection.icon)) : undefined)));
|
|
12641
12851
|
};
|
|
12642
12852
|
|
|
12643
|
-
export { ApplicationMenu, ApplicationPanel, AvatarLabelPanel, ConnectionPanel, DynamicLogo, DynamicShigaLogo, EqualizerColumn, File, Icons, LabelPanel, PageTitle, PaymentMethod, PaymentMethodAdd, SearchPanel, SideMenu, SimpleColumn, SimplePanel, SimpleTable, SimpleText, StackedColumn, SubscriptionPlans, TitleWithIndex, TitledPanel, UserMenu, theme };
|
|
12853
|
+
export { ApplicationMenu, ApplicationPanel, AvatarLabelPanel, ConnectionPanel, DynamicLogo, DynamicShigaLogo, EqualizerColumn, File, Icons, LabelPanel, PageTitle, PaymentMethod, PaymentMethodAdd, SearchPanel, SideMenu, SimpleArea, SimpleColumn, SimplePanel, SimpleTable, SimpleText, StackedColumn, SubscriptionPlans, TitleWithIndex, TitledPanel, UserMenu, theme };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import "@mantine/core/styles.css";
|
|
3
|
+
import { SimpleArea } from "./Area";
|
|
4
|
+
declare const _default: Meta<typeof SimpleArea>;
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const SimpleAreaChart: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./Area.types").SimpleAreaChartProps>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface AreaChartConfig {
|
|
2
|
+
chart: object;
|
|
3
|
+
tooltip: object;
|
|
4
|
+
credits: object;
|
|
5
|
+
exporting: object;
|
|
6
|
+
title: object;
|
|
7
|
+
labels: object;
|
|
8
|
+
legend: object;
|
|
9
|
+
}
|
|
10
|
+
export interface AreaChartProps {
|
|
11
|
+
bgColor?: string;
|
|
12
|
+
plotBgColor?: string;
|
|
13
|
+
colors?: string[];
|
|
14
|
+
title?: string;
|
|
15
|
+
xAxisLabel: string[];
|
|
16
|
+
yAxisLabel: string[];
|
|
17
|
+
series: number[][];
|
|
18
|
+
withLegend: boolean;
|
|
19
|
+
withCrossHair: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface SimpleAreaChartProps {
|
|
22
|
+
bgColor?: string;
|
|
23
|
+
plotBgColor?: string;
|
|
24
|
+
color?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
xAxisLabel: string[];
|
|
27
|
+
yAxisLabel: string;
|
|
28
|
+
series: number[];
|
|
29
|
+
withLegend: boolean;
|
|
30
|
+
withCrossHair: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ChartSeriesArea {
|
|
33
|
+
xAxis: {
|
|
34
|
+
categories: string[];
|
|
35
|
+
labels: object;
|
|
36
|
+
crosshair?: {
|
|
37
|
+
color: string;
|
|
38
|
+
width: number;
|
|
39
|
+
dashStyle: string;
|
|
40
|
+
snap: boolean;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
yAxis: {
|
|
44
|
+
allowDecimals: boolean;
|
|
45
|
+
title: object;
|
|
46
|
+
gridLineDashStyle?: string;
|
|
47
|
+
gridLineWidth?: number;
|
|
48
|
+
labels: object;
|
|
49
|
+
};
|
|
50
|
+
series: AreaChartSeries[];
|
|
51
|
+
plotOptions: object;
|
|
52
|
+
}
|
|
53
|
+
export interface AreaChartSeries {
|
|
54
|
+
name: string;
|
|
55
|
+
data: number[];
|
|
56
|
+
color: string;
|
|
57
|
+
enableMouseTracking?: boolean;
|
|
58
|
+
showInLegend?: boolean;
|
|
59
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { SimpleColumn, EqualizerColumn, StackedColumn, } from "./charts/column/Column";
|
|
2
|
+
export { SimpleArea } from "./charts/area/Area";
|
|
2
3
|
export { Icons } from "./general/icons/Icons";
|
|
3
4
|
export { DynamicLogo, DynamicShigaLogo } from "./general/logos/Logos";
|
|
4
5
|
export { ApplicationMenu } from "./menus/application/Application";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const computeBoundary: (items: number[]) => number;
|
|
2
|
+
export declare const computeDelta: (items: number[], boundary: number) => number[];
|
|
3
|
+
export declare const parseColorToRgb: (colorString: string) => {
|
|
4
|
+
r: number;
|
|
5
|
+
g: number;
|
|
6
|
+
b: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Creates a Highcharts linear gradient fillColor configuration for an Area/AreaSpline series.
|
|
10
|
+
* The gradient flows vertically from the baseColor (at the series line) down to the x-axis,
|
|
11
|
+
* fading to a transparent version of the baseColor.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} baseColor The primary color for the gradient (e.g., '#FF0000', 'rgb(0,128,255)').
|
|
14
|
+
* @param {object} [options] Configuration options for the gradient.
|
|
15
|
+
* @param {number} [options.startOpacity=0.7] The opacity of the `baseColor` at the top (near the series line, position 0).
|
|
16
|
+
* Value should be between 0 (fully transparent) and 1 (fully opaque).
|
|
17
|
+
* @param {number} [options.endOpacity=0.0] The opacity of the transparent end color at the bottom (near the x-axis, position 1).
|
|
18
|
+
* Value should be between 0 (fully transparent) and 1 (fully opaque).
|
|
19
|
+
* @returns {Highcharts.GradientColorObject} A Highcharts `fillColor` configuration object.
|
|
20
|
+
*/
|
|
21
|
+
export declare const createAreaFillGradient: (baseColor: string, options?: {
|
|
22
|
+
startOpacity?: number;
|
|
23
|
+
endOpacity?: number;
|
|
24
|
+
}) => Highcharts.GradientColorObject;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adiba-banking-cloud/backoffice",
|
|
3
3
|
"author": "TUROG Technologies",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.29",
|
|
5
5
|
"description": "An ADIBA component library for backoffice and dashboard applications",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"main": "build/index.cjs.js",
|