@bpfdev/oly-ui 1.0.11 → 1.0.12

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/dist/index.js CHANGED
@@ -6961,7 +6961,8 @@ function StackTotalLabel({
6961
6961
  width,
6962
6962
  height,
6963
6963
  index,
6964
- stackTotalFill
6964
+ stackTotalFill,
6965
+ angle = 0
6965
6966
  }) {
6966
6967
  const nx = toNum(x);
6967
6968
  const ny = toNum(y);
@@ -6975,6 +6976,7 @@ function StackTotalLabel({
6975
6976
  const total = rowTotal(row, series);
6976
6977
  const cx = nx + nw / 2;
6977
6978
  const cy = ny - 10;
6979
+ const isHorizontal = angle === 0;
6978
6980
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6979
6981
  "text",
6980
6982
  {
@@ -6983,7 +6985,8 @@ function StackTotalLabel({
6983
6985
  fill: stackTotalFill,
6984
6986
  fontSize: 12,
6985
6987
  fontWeight: 500,
6986
- textAnchor: "middle",
6988
+ textAnchor: isHorizontal ? "middle" : "start",
6989
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
6987
6990
  children: formatBarLabel(total)
6988
6991
  }
6989
6992
  );
@@ -7034,7 +7037,8 @@ function FootfallByAgeGroups({
7034
7037
  barStackId = "footfall-by-age-groups",
7035
7038
  xAxisTickAngle = 0,
7036
7039
  xAxisTickDx = 0,
7037
- xAxisTickStyle
7040
+ xAxisTickStyle,
7041
+ barValueLabelAngle = 0
7038
7042
  }) {
7039
7043
  const [activeIndex, setActiveIndex] = React11.useState(null);
7040
7044
  const handleMouseEnter = React11.useCallback((_, index) => {
@@ -7377,7 +7381,8 @@ function FootfallByAgeGroups({
7377
7381
  ...labelProps,
7378
7382
  series,
7379
7383
  rows: processedData,
7380
- stackTotalFill: chartColors.stackTotalLabelFill
7384
+ stackTotalFill: chartColors.stackTotalLabelFill,
7385
+ angle: barValueLabelAngle
7381
7386
  }
7382
7387
  )
7383
7388
  }
@@ -8575,7 +8580,8 @@ function BarTopLabel({
8575
8580
  y,
8576
8581
  width,
8577
8582
  value,
8578
- fill
8583
+ fill,
8584
+ angle = 0
8579
8585
  }) {
8580
8586
  const nx = toNum3(x);
8581
8587
  const ny = toNum3(y);
@@ -8589,6 +8595,7 @@ function BarTopLabel({
8589
8595
  }
8590
8596
  const cx = nx + nw / 2;
8591
8597
  const cy = ny - 10;
8598
+ const isHorizontal = angle === 0;
8592
8599
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
8593
8600
  "text",
8594
8601
  {
@@ -8597,7 +8604,8 @@ function BarTopLabel({
8597
8604
  fill,
8598
8605
  fontSize: 12,
8599
8606
  fontWeight: 500,
8600
- textAnchor: "middle",
8607
+ textAnchor: isHorizontal ? "middle" : "start",
8608
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
8601
8609
  children: formatBarLabel3(n)
8602
8610
  }
8603
8611
  );
@@ -8861,6 +8869,7 @@ function PasserbyConversion({
8861
8869
  showLegend = true,
8862
8870
  showConversionLine: showConversionLineProp,
8863
8871
  showBarValueLabels = true,
8872
+ barValueLabelAngle = 0,
8864
8873
  chartMargin: chartMarginProp,
8865
8874
  yAxisTickDx = -8,
8866
8875
  yAxisTickStyle,
@@ -9337,7 +9346,8 @@ function PasserbyConversion({
9337
9346
  BarTopLabel,
9338
9347
  {
9339
9348
  ...props,
9340
- fill: chartColors.barValueLabelFill
9349
+ fill: chartColors.barValueLabelFill,
9350
+ angle: barValueLabelAngle
9341
9351
  }
9342
9352
  )
9343
9353
  }
@@ -9373,7 +9383,8 @@ function PasserbyConversion({
9373
9383
  BarTopLabel,
9374
9384
  {
9375
9385
  ...props,
9376
- fill: chartColors.barValueLabelFill
9386
+ fill: chartColors.barValueLabelFill,
9387
+ angle: barValueLabelAngle
9377
9388
  }
9378
9389
  )
9379
9390
  }
@@ -10032,7 +10043,8 @@ function BarTopLabel2({
10032
10043
  y,
10033
10044
  width,
10034
10045
  value,
10035
- fill
10046
+ fill,
10047
+ angle = 0
10036
10048
  }) {
10037
10049
  const nx = toNum4(x);
10038
10050
  const ny = toNum4(y);
@@ -10046,6 +10058,7 @@ function BarTopLabel2({
10046
10058
  }
10047
10059
  const cx = nx + nw / 2;
10048
10060
  const cy = ny - 10;
10061
+ const isHorizontal = angle === 0;
10049
10062
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10050
10063
  "text",
10051
10064
  {
@@ -10054,7 +10067,8 @@ function BarTopLabel2({
10054
10067
  fill,
10055
10068
  fontSize: 12,
10056
10069
  fontWeight: 500,
10057
- textAnchor: "middle",
10070
+ textAnchor: isHorizontal ? "middle" : "start",
10071
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
10058
10072
  children: formatBarLabel4(n)
10059
10073
  }
10060
10074
  );
@@ -10320,6 +10334,7 @@ function WalkinTraffic({
10320
10334
  showTrendLine: showTrendLineProp,
10321
10335
  showLineInLegend = false,
10322
10336
  showBarValueLabels = true,
10337
+ barValueLabelAngle = 0,
10323
10338
  chartMargin: chartMarginProp,
10324
10339
  yAxisTickDx = -8,
10325
10340
  yAxisTickStyle,
@@ -10712,7 +10727,8 @@ function WalkinTraffic({
10712
10727
  BarTopLabel2,
10713
10728
  {
10714
10729
  ...props,
10715
- fill: chartColors.barValueLabelFill
10730
+ fill: chartColors.barValueLabelFill,
10731
+ angle: barValueLabelAngle
10716
10732
  }
10717
10733
  )
10718
10734
  }
@@ -12415,18 +12431,28 @@ function rowFromHeuristicLabel(zoneName, total) {
12415
12431
  }));
12416
12432
  return { id, label: zoneName, value: a + b + c + d, segments };
12417
12433
  }
12418
- function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12434
+ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles, buildBarRow) {
12435
+ const buildRow = (node, role, total, fallback) => {
12436
+ if (buildBarRow) {
12437
+ const custom = buildBarRow({ node, activeZone, role, total });
12438
+ if (custom) return custom;
12439
+ }
12440
+ return fallback();
12441
+ };
12419
12442
  if (activeZone) {
12420
12443
  const childRowsSource = (activeZone.list ?? []).filter(
12421
12444
  (n) => parseVisitorCount(n.overallData?.count) > 0
12422
12445
  );
12423
12446
  if (childRowsSource.length > 0) {
12424
- const items = childRowsSource.map(
12425
- (node) => rowFromHeuristicLabel(
12426
- node.name,
12427
- parseVisitorCount(node.overallData?.count)
12428
- )
12429
- );
12447
+ const items = childRowsSource.map((node) => {
12448
+ const total = parseVisitorCount(node.overallData?.count);
12449
+ return buildRow(
12450
+ node,
12451
+ "child",
12452
+ total,
12453
+ () => rowFromHeuristicLabel(node.name, total)
12454
+ );
12455
+ });
12430
12456
  const overallVisitorsFromChildren = childRowsSource.reduce(
12431
12457
  (sum, node) => sum + parseVisitorCount(node.overallData?.count),
12432
12458
  0
@@ -12457,7 +12483,14 @@ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12457
12483
  },
12458
12484
  rankedBarList: {
12459
12485
  title: "Zone breakdown",
12460
- items: [rowFromExplicitStrip(activeZone.name, zs)],
12486
+ items: [
12487
+ buildRow(
12488
+ activeZone,
12489
+ "active",
12490
+ zs.overallVisitors,
12491
+ () => rowFromExplicitStrip(activeZone.name, zs)
12492
+ )
12493
+ ],
12461
12494
  listHeaderLabel: "Zone",
12462
12495
  valueColumnHeader: "Visitors"
12463
12496
  }
@@ -12474,7 +12507,14 @@ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12474
12507
  summaryKpis: { storeCount: storeCount2, overallVisitors: overallVisitors2 },
12475
12508
  rankedBarList: {
12476
12509
  title: "Zone breakdown",
12477
- items: [rowFromHeuristicLabel(activeZone.name, overallVisitors2)],
12510
+ items: [
12511
+ buildRow(
12512
+ activeZone,
12513
+ "active",
12514
+ overallVisitors2,
12515
+ () => rowFromHeuristicLabel(activeZone.name, overallVisitors2)
12516
+ )
12517
+ ],
12478
12518
  listHeaderLabel: "Zone",
12479
12519
  valueColumnHeader: "Visitors"
12480
12520
  }
@@ -12486,11 +12526,26 @@ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12486
12526
  0
12487
12527
  );
12488
12528
  const storeCount = childTiles.length;
12529
+ const overviewNode = {
12530
+ name: "Overview",
12531
+ value: overallVisitors,
12532
+ originalValue: overallVisitors,
12533
+ color: "",
12534
+ overallData: { count: overallVisitors, dwell: "" },
12535
+ list: []
12536
+ };
12489
12537
  return {
12490
12538
  summaryKpis: { storeCount, overallVisitors },
12491
12539
  rankedBarList: {
12492
12540
  title: "Footfall overview",
12493
- items: [rowFromHeuristicLabel("Overview", overallVisitors)],
12541
+ items: [
12542
+ buildRow(
12543
+ overviewNode,
12544
+ "overview",
12545
+ overallVisitors,
12546
+ () => rowFromHeuristicLabel("Overview", overallVisitors)
12547
+ )
12548
+ ],
12494
12549
  listHeaderLabel: "Scope",
12495
12550
  valueColumnHeader: "Visitors"
12496
12551
  }
@@ -13328,9 +13383,17 @@ function FootFallHeatMapView({
13328
13383
  const activeZoneForStrip = trackingDetails.length > 0 ? trackingDetails[trackingDetails.length - 1] : void 0;
13329
13384
  return deriveFootfallHeatMapKpiStrip(
13330
13385
  activeZoneForStrip,
13331
- data.current ?? []
13386
+ data.current ?? [],
13387
+ kpiStripPresentation?.buildBarRow
13332
13388
  );
13333
- }, [isLoading, loading, initialData, trackingDetails, data]);
13389
+ }, [
13390
+ isLoading,
13391
+ loading,
13392
+ initialData,
13393
+ trackingDetails,
13394
+ data,
13395
+ kpiStripPresentation?.buildBarRow
13396
+ ]);
13334
13397
  const formatPercentage = (value) => {
13335
13398
  if (typeof value !== "number") return "0%";
13336
13399
  const formatted = value.toFixed(2);
@@ -14189,7 +14252,7 @@ function toNum5(n) {
14189
14252
  return typeof n === "number" ? n : Number(n);
14190
14253
  }
14191
14254
  function PeakBarTopLabel(props) {
14192
- const { x, y, width, value, fill, fontSize, fontWeight } = props;
14255
+ const { x, y, width, value, fill, fontSize, fontWeight, angle = 0 } = props;
14193
14256
  const nx = toNum5(x);
14194
14257
  const ny = toNum5(y);
14195
14258
  const nw = toNum5(width);
@@ -14202,6 +14265,7 @@ function PeakBarTopLabel(props) {
14202
14265
  }
14203
14266
  const cx = nx + nw / 2;
14204
14267
  const cy = ny - 6;
14268
+ const isHorizontal = angle === 0;
14205
14269
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
14206
14270
  "text",
14207
14271
  {
@@ -14210,7 +14274,8 @@ function PeakBarTopLabel(props) {
14210
14274
  fill,
14211
14275
  fontSize,
14212
14276
  fontWeight,
14213
- textAnchor: "middle",
14277
+ textAnchor: isHorizontal ? "middle" : "start",
14278
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
14214
14279
  children: String(Math.round(n))
14215
14280
  }
14216
14281
  );
@@ -14225,7 +14290,8 @@ function BarPlot({
14225
14290
  yAxisTickDx = -6,
14226
14291
  yAxisTickStyle,
14227
14292
  xAxisTickDx = 0,
14228
- xAxisTickStyle
14293
+ xAxisTickStyle,
14294
+ barValueLabelAngle = 0
14229
14295
  }) {
14230
14296
  const { barChart: bc } = usePeakBillingHoursCustomization();
14231
14297
  const height = bc?.heightPx ?? 320;
@@ -14336,7 +14402,8 @@ function BarPlot({
14336
14402
  ...props,
14337
14403
  fill: labelFill,
14338
14404
  fontSize: labelFs,
14339
- fontWeight: 500
14405
+ fontWeight: 500,
14406
+ angle: barValueLabelAngle
14340
14407
  }
14341
14408
  )
14342
14409
  }
@@ -14361,6 +14428,7 @@ function PeakBillingHours({
14361
14428
  yAxisTickStyle,
14362
14429
  xAxisTickDx = 0,
14363
14430
  xAxisTickStyle,
14431
+ barValueLabelAngle = 0,
14364
14432
  yAxisDomain = [0, 50],
14365
14433
  yAxisTicks = [0, 10, 20, 30, 40, 50],
14366
14434
  infoPopover,
@@ -14471,7 +14539,8 @@ function PeakBillingHours({
14471
14539
  yAxisTickDx,
14472
14540
  yAxisTickStyle,
14473
14541
  xAxisTickDx,
14474
- xAxisTickStyle
14542
+ xAxisTickStyle,
14543
+ barValueLabelAngle
14475
14544
  }
14476
14545
  ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
14477
14546
  ChartEmptyState,
@@ -14551,6 +14620,7 @@ function CustomerJourneyAnalysis({
14551
14620
  avgBillingPerTrial,
14552
14621
  // Labels
14553
14622
  title = "Customer Journey Analysis",
14623
+ hideTitle = false,
14554
14624
  titleFontSize,
14555
14625
  titleFontWeight = 700,
14556
14626
  titleColor = "#0f172a",
@@ -14742,7 +14812,7 @@ function CustomerJourneyAnalysis({
14742
14812
  ];
14743
14813
  const bodyDirection = { xs: "column", [bodyBreakpoint]: "row" };
14744
14814
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_Box21.default, { sx: outerSx, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_Stack20.default, { spacing: 2, children: [
14745
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
14815
+ !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
14746
14816
  import_Stack20.default,
14747
14817
  {
14748
14818
  direction: "row",