@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.mjs CHANGED
@@ -6882,7 +6882,8 @@ function StackTotalLabel({
6882
6882
  width,
6883
6883
  height,
6884
6884
  index,
6885
- stackTotalFill
6885
+ stackTotalFill,
6886
+ angle = 0
6886
6887
  }) {
6887
6888
  const nx = toNum(x);
6888
6889
  const ny = toNum(y);
@@ -6896,6 +6897,7 @@ function StackTotalLabel({
6896
6897
  const total = rowTotal(row, series);
6897
6898
  const cx = nx + nw / 2;
6898
6899
  const cy = ny - 10;
6900
+ const isHorizontal = angle === 0;
6899
6901
  return /* @__PURE__ */ jsx32(
6900
6902
  "text",
6901
6903
  {
@@ -6904,7 +6906,8 @@ function StackTotalLabel({
6904
6906
  fill: stackTotalFill,
6905
6907
  fontSize: 12,
6906
6908
  fontWeight: 500,
6907
- textAnchor: "middle",
6909
+ textAnchor: isHorizontal ? "middle" : "start",
6910
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
6908
6911
  children: formatBarLabel(total)
6909
6912
  }
6910
6913
  );
@@ -6955,7 +6958,8 @@ function FootfallByAgeGroups({
6955
6958
  barStackId = "footfall-by-age-groups",
6956
6959
  xAxisTickAngle = 0,
6957
6960
  xAxisTickDx = 0,
6958
- xAxisTickStyle
6961
+ xAxisTickStyle,
6962
+ barValueLabelAngle = 0
6959
6963
  }) {
6960
6964
  const [activeIndex, setActiveIndex] = React11.useState(null);
6961
6965
  const handleMouseEnter = React11.useCallback((_, index) => {
@@ -7298,7 +7302,8 @@ function FootfallByAgeGroups({
7298
7302
  ...labelProps,
7299
7303
  series,
7300
7304
  rows: processedData,
7301
- stackTotalFill: chartColors.stackTotalLabelFill
7305
+ stackTotalFill: chartColors.stackTotalLabelFill,
7306
+ angle: barValueLabelAngle
7302
7307
  }
7303
7308
  )
7304
7309
  }
@@ -8515,7 +8520,8 @@ function BarTopLabel({
8515
8520
  y,
8516
8521
  width,
8517
8522
  value,
8518
- fill
8523
+ fill,
8524
+ angle = 0
8519
8525
  }) {
8520
8526
  const nx = toNum3(x);
8521
8527
  const ny = toNum3(y);
@@ -8529,6 +8535,7 @@ function BarTopLabel({
8529
8535
  }
8530
8536
  const cx = nx + nw / 2;
8531
8537
  const cy = ny - 10;
8538
+ const isHorizontal = angle === 0;
8532
8539
  return /* @__PURE__ */ jsx34(
8533
8540
  "text",
8534
8541
  {
@@ -8537,7 +8544,8 @@ function BarTopLabel({
8537
8544
  fill,
8538
8545
  fontSize: 12,
8539
8546
  fontWeight: 500,
8540
- textAnchor: "middle",
8547
+ textAnchor: isHorizontal ? "middle" : "start",
8548
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
8541
8549
  children: formatBarLabel3(n)
8542
8550
  }
8543
8551
  );
@@ -8801,6 +8809,7 @@ function PasserbyConversion({
8801
8809
  showLegend = true,
8802
8810
  showConversionLine: showConversionLineProp,
8803
8811
  showBarValueLabels = true,
8812
+ barValueLabelAngle = 0,
8804
8813
  chartMargin: chartMarginProp,
8805
8814
  yAxisTickDx = -8,
8806
8815
  yAxisTickStyle,
@@ -9277,7 +9286,8 @@ function PasserbyConversion({
9277
9286
  BarTopLabel,
9278
9287
  {
9279
9288
  ...props,
9280
- fill: chartColors.barValueLabelFill
9289
+ fill: chartColors.barValueLabelFill,
9290
+ angle: barValueLabelAngle
9281
9291
  }
9282
9292
  )
9283
9293
  }
@@ -9313,7 +9323,8 @@ function PasserbyConversion({
9313
9323
  BarTopLabel,
9314
9324
  {
9315
9325
  ...props,
9316
- fill: chartColors.barValueLabelFill
9326
+ fill: chartColors.barValueLabelFill,
9327
+ angle: barValueLabelAngle
9317
9328
  }
9318
9329
  )
9319
9330
  }
@@ -9981,7 +9992,8 @@ function BarTopLabel2({
9981
9992
  y,
9982
9993
  width,
9983
9994
  value,
9984
- fill
9995
+ fill,
9996
+ angle = 0
9985
9997
  }) {
9986
9998
  const nx = toNum4(x);
9987
9999
  const ny = toNum4(y);
@@ -9995,6 +10007,7 @@ function BarTopLabel2({
9995
10007
  }
9996
10008
  const cx = nx + nw / 2;
9997
10009
  const cy = ny - 10;
10010
+ const isHorizontal = angle === 0;
9998
10011
  return /* @__PURE__ */ jsx36(
9999
10012
  "text",
10000
10013
  {
@@ -10003,7 +10016,8 @@ function BarTopLabel2({
10003
10016
  fill,
10004
10017
  fontSize: 12,
10005
10018
  fontWeight: 500,
10006
- textAnchor: "middle",
10019
+ textAnchor: isHorizontal ? "middle" : "start",
10020
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
10007
10021
  children: formatBarLabel4(n)
10008
10022
  }
10009
10023
  );
@@ -10269,6 +10283,7 @@ function WalkinTraffic({
10269
10283
  showTrendLine: showTrendLineProp,
10270
10284
  showLineInLegend = false,
10271
10285
  showBarValueLabels = true,
10286
+ barValueLabelAngle = 0,
10272
10287
  chartMargin: chartMarginProp,
10273
10288
  yAxisTickDx = -8,
10274
10289
  yAxisTickStyle,
@@ -10661,7 +10676,8 @@ function WalkinTraffic({
10661
10676
  BarTopLabel2,
10662
10677
  {
10663
10678
  ...props,
10664
- fill: chartColors.barValueLabelFill
10679
+ fill: chartColors.barValueLabelFill,
10680
+ angle: barValueLabelAngle
10665
10681
  }
10666
10682
  )
10667
10683
  }
@@ -12389,18 +12405,28 @@ function rowFromHeuristicLabel(zoneName, total) {
12389
12405
  }));
12390
12406
  return { id, label: zoneName, value: a + b + c + d, segments };
12391
12407
  }
12392
- function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12408
+ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles, buildBarRow) {
12409
+ const buildRow = (node, role, total, fallback) => {
12410
+ if (buildBarRow) {
12411
+ const custom = buildBarRow({ node, activeZone, role, total });
12412
+ if (custom) return custom;
12413
+ }
12414
+ return fallback();
12415
+ };
12393
12416
  if (activeZone) {
12394
12417
  const childRowsSource = (activeZone.list ?? []).filter(
12395
12418
  (n) => parseVisitorCount(n.overallData?.count) > 0
12396
12419
  );
12397
12420
  if (childRowsSource.length > 0) {
12398
- const items = childRowsSource.map(
12399
- (node) => rowFromHeuristicLabel(
12400
- node.name,
12401
- parseVisitorCount(node.overallData?.count)
12402
- )
12403
- );
12421
+ const items = childRowsSource.map((node) => {
12422
+ const total = parseVisitorCount(node.overallData?.count);
12423
+ return buildRow(
12424
+ node,
12425
+ "child",
12426
+ total,
12427
+ () => rowFromHeuristicLabel(node.name, total)
12428
+ );
12429
+ });
12404
12430
  const overallVisitorsFromChildren = childRowsSource.reduce(
12405
12431
  (sum, node) => sum + parseVisitorCount(node.overallData?.count),
12406
12432
  0
@@ -12431,7 +12457,14 @@ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12431
12457
  },
12432
12458
  rankedBarList: {
12433
12459
  title: "Zone breakdown",
12434
- items: [rowFromExplicitStrip(activeZone.name, zs)],
12460
+ items: [
12461
+ buildRow(
12462
+ activeZone,
12463
+ "active",
12464
+ zs.overallVisitors,
12465
+ () => rowFromExplicitStrip(activeZone.name, zs)
12466
+ )
12467
+ ],
12435
12468
  listHeaderLabel: "Zone",
12436
12469
  valueColumnHeader: "Visitors"
12437
12470
  }
@@ -12448,7 +12481,14 @@ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12448
12481
  summaryKpis: { storeCount: storeCount2, overallVisitors: overallVisitors2 },
12449
12482
  rankedBarList: {
12450
12483
  title: "Zone breakdown",
12451
- items: [rowFromHeuristicLabel(activeZone.name, overallVisitors2)],
12484
+ items: [
12485
+ buildRow(
12486
+ activeZone,
12487
+ "active",
12488
+ overallVisitors2,
12489
+ () => rowFromHeuristicLabel(activeZone.name, overallVisitors2)
12490
+ )
12491
+ ],
12452
12492
  listHeaderLabel: "Zone",
12453
12493
  valueColumnHeader: "Visitors"
12454
12494
  }
@@ -12460,11 +12500,26 @@ function deriveFootfallHeatMapKpiStrip(activeZone, childTiles) {
12460
12500
  0
12461
12501
  );
12462
12502
  const storeCount = childTiles.length;
12503
+ const overviewNode = {
12504
+ name: "Overview",
12505
+ value: overallVisitors,
12506
+ originalValue: overallVisitors,
12507
+ color: "",
12508
+ overallData: { count: overallVisitors, dwell: "" },
12509
+ list: []
12510
+ };
12463
12511
  return {
12464
12512
  summaryKpis: { storeCount, overallVisitors },
12465
12513
  rankedBarList: {
12466
12514
  title: "Footfall overview",
12467
- items: [rowFromHeuristicLabel("Overview", overallVisitors)],
12515
+ items: [
12516
+ buildRow(
12517
+ overviewNode,
12518
+ "overview",
12519
+ overallVisitors,
12520
+ () => rowFromHeuristicLabel("Overview", overallVisitors)
12521
+ )
12522
+ ],
12468
12523
  listHeaderLabel: "Scope",
12469
12524
  valueColumnHeader: "Visitors"
12470
12525
  }
@@ -13302,9 +13357,17 @@ function FootFallHeatMapView({
13302
13357
  const activeZoneForStrip = trackingDetails.length > 0 ? trackingDetails[trackingDetails.length - 1] : void 0;
13303
13358
  return deriveFootfallHeatMapKpiStrip(
13304
13359
  activeZoneForStrip,
13305
- data.current ?? []
13360
+ data.current ?? [],
13361
+ kpiStripPresentation?.buildBarRow
13306
13362
  );
13307
- }, [isLoading, loading, initialData, trackingDetails, data]);
13363
+ }, [
13364
+ isLoading,
13365
+ loading,
13366
+ initialData,
13367
+ trackingDetails,
13368
+ data,
13369
+ kpiStripPresentation?.buildBarRow
13370
+ ]);
13308
13371
  const formatPercentage = (value) => {
13309
13372
  if (typeof value !== "number") return "0%";
13310
13373
  const formatted = value.toFixed(2);
@@ -14172,7 +14235,7 @@ function toNum5(n) {
14172
14235
  return typeof n === "number" ? n : Number(n);
14173
14236
  }
14174
14237
  function PeakBarTopLabel(props) {
14175
- const { x, y, width, value, fill, fontSize, fontWeight } = props;
14238
+ const { x, y, width, value, fill, fontSize, fontWeight, angle = 0 } = props;
14176
14239
  const nx = toNum5(x);
14177
14240
  const ny = toNum5(y);
14178
14241
  const nw = toNum5(width);
@@ -14185,6 +14248,7 @@ function PeakBarTopLabel(props) {
14185
14248
  }
14186
14249
  const cx = nx + nw / 2;
14187
14250
  const cy = ny - 6;
14251
+ const isHorizontal = angle === 0;
14188
14252
  return /* @__PURE__ */ jsx49(
14189
14253
  "text",
14190
14254
  {
@@ -14193,7 +14257,8 @@ function PeakBarTopLabel(props) {
14193
14257
  fill,
14194
14258
  fontSize,
14195
14259
  fontWeight,
14196
- textAnchor: "middle",
14260
+ textAnchor: isHorizontal ? "middle" : "start",
14261
+ transform: isHorizontal ? void 0 : `rotate(${angle} ${cx} ${cy})`,
14197
14262
  children: String(Math.round(n))
14198
14263
  }
14199
14264
  );
@@ -14208,7 +14273,8 @@ function BarPlot({
14208
14273
  yAxisTickDx = -6,
14209
14274
  yAxisTickStyle,
14210
14275
  xAxisTickDx = 0,
14211
- xAxisTickStyle
14276
+ xAxisTickStyle,
14277
+ barValueLabelAngle = 0
14212
14278
  }) {
14213
14279
  const { barChart: bc } = usePeakBillingHoursCustomization();
14214
14280
  const height = bc?.heightPx ?? 320;
@@ -14319,7 +14385,8 @@ function BarPlot({
14319
14385
  ...props,
14320
14386
  fill: labelFill,
14321
14387
  fontSize: labelFs,
14322
- fontWeight: 500
14388
+ fontWeight: 500,
14389
+ angle: barValueLabelAngle
14323
14390
  }
14324
14391
  )
14325
14392
  }
@@ -14344,6 +14411,7 @@ function PeakBillingHours({
14344
14411
  yAxisTickStyle,
14345
14412
  xAxisTickDx = 0,
14346
14413
  xAxisTickStyle,
14414
+ barValueLabelAngle = 0,
14347
14415
  yAxisDomain = [0, 50],
14348
14416
  yAxisTicks = [0, 10, 20, 30, 40, 50],
14349
14417
  infoPopover,
@@ -14454,7 +14522,8 @@ function PeakBillingHours({
14454
14522
  yAxisTickDx,
14455
14523
  yAxisTickStyle,
14456
14524
  xAxisTickDx,
14457
- xAxisTickStyle
14525
+ xAxisTickStyle,
14526
+ barValueLabelAngle
14458
14527
  }
14459
14528
  ) : /* @__PURE__ */ jsx49(
14460
14529
  ChartEmptyState,
@@ -14534,6 +14603,7 @@ function CustomerJourneyAnalysis({
14534
14603
  avgBillingPerTrial,
14535
14604
  // Labels
14536
14605
  title = "Customer Journey Analysis",
14606
+ hideTitle = false,
14537
14607
  titleFontSize,
14538
14608
  titleFontWeight = 700,
14539
14609
  titleColor = "#0f172a",
@@ -14725,7 +14795,7 @@ function CustomerJourneyAnalysis({
14725
14795
  ];
14726
14796
  const bodyDirection = { xs: "column", [bodyBreakpoint]: "row" };
14727
14797
  return /* @__PURE__ */ jsx50(Box33, { sx: outerSx, children: /* @__PURE__ */ jsxs40(Stack28, { spacing: 2, children: [
14728
- /* @__PURE__ */ jsxs40(
14798
+ !hideTitle && /* @__PURE__ */ jsxs40(
14729
14799
  Stack28,
14730
14800
  {
14731
14801
  direction: "row",