@geotab/zenith 3.15.0-beta.0 → 3.15.0-beta.1

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.
@@ -40,6 +40,15 @@ function getInterpolatedValue(xScale, data, datasetIndex, xPixel) {
40
40
  if (x1 === x2) {
41
41
  return y1;
42
42
  }
43
+ // Sub-pixel tolerance: element.x (from Chart.js) and xScale.getPixelForValue()
44
+ // can disagree by a fraction of a pixel, causing the cursor to land just past a
45
+ // data point and interpolate with the next segment instead of returning the exact value.
46
+ if (Math.abs(x - x1) < 0.5) {
47
+ return y1;
48
+ }
49
+ if (Math.abs(x - x2) < 0.5) {
50
+ return y2;
51
+ }
43
52
  const interpolatedY = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1);
44
53
  return interpolatedY;
45
54
  }
@@ -55,32 +55,9 @@ const LinePlugin = (containerId, options, isDark) => ({
55
55
  const y = chart.verticalLine.y;
56
56
  const topY = chart.chartArea.top;
57
57
  const bottomY = chart.chartArea.bottom;
58
+ (0, drawLine_1.drawLine)(ctx, x, topY, bottomY);
58
59
  const datasets = chart.data.datasets;
59
60
  let lowestValueY = Infinity;
60
- const xScale = chart.scales.x;
61
- let snappedX = x;
62
- let closestDist = Infinity;
63
- datasets.forEach((dataset, dsIndex) => {
64
- if (!chart.isDatasetVisible(dsIndex)) {
65
- return;
66
- }
67
- if (chart.getDatasetMeta(dsIndex).type !== "line") {
68
- return;
69
- }
70
- const dataPoints = dataset.data;
71
- for (const point of dataPoints) {
72
- if (point.y === null) {
73
- continue;
74
- }
75
- const px = xScale.getPixelForValue(point.x);
76
- const dist = Math.abs(px - x);
77
- if (dist < closestDist) {
78
- closestDist = dist;
79
- snappedX = px;
80
- }
81
- }
82
- });
83
- (0, drawLine_1.drawLine)(ctx, snappedX, topY, bottomY);
84
61
  const items = datasets
85
62
  .map((dataset, dsIndex) => {
86
63
  if (!chart.isDatasetVisible(dsIndex)) {
@@ -89,7 +66,8 @@ const LinePlugin = (containerId, options, isDark) => ({
89
66
  if (chart.getDatasetMeta(dsIndex).type !== "line") {
90
67
  return undefined;
91
68
  }
92
- const value = (0, getInterpolatedValue_1.getInterpolatedValue)(xScale, chart.data, dsIndex, snappedX);
69
+ const xScale = chart.scales.x;
70
+ const value = (0, getInterpolatedValue_1.getInterpolatedValue)(xScale, chart.data, dsIndex, x);
93
71
  const yAxisID = dataset.yAxisID || "y";
94
72
  const yScale = chart.scales[yAxisID];
95
73
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -117,8 +95,8 @@ const LinePlugin = (containerId, options, isDark) => ({
117
95
  return;
118
96
  }
119
97
  const chartRect = chart.canvas.getBoundingClientRect();
120
- const top = chartRect.top + (lowestValueY !== Infinity ? lowestValueY : y);
121
- const left = chartRect.left + snappedX;
98
+ const top = chartRect.top + (lowestValueY || y);
99
+ const left = chartRect.left + x;
122
100
  if (zen_1.zen.document === undefined) {
123
101
  return;
124
102
  }
@@ -135,8 +113,8 @@ const LinePlugin = (containerId, options, isDark) => ({
135
113
  xLabel = scaleLabels[elementIdx];
136
114
  }
137
115
  else {
138
- const xValue = chart.scales.x.getValueForPixel(snappedX);
139
- xLabel = xValue !== undefined ? chart.scales.x.getLabelForValue(xValue) : undefined;
116
+ const xValue = chart.scales.x.getValueForPixel(x);
117
+ xLabel = xValue ? chart.scales.x.getLabelForValue(xValue) : undefined;
140
118
  }
141
119
  (0, renderTooltip_1.renderTooltip)(containerId, left + scrollLeft, top + scrollTop, "top", items, options === null || options === void 0 ? void 0 : options.title, options && options.subtitle !== undefined ? options.subtitle : xLabel, (options === null || options === void 0 ? void 0 : options.note) || undefined, isDark);
142
120
  }
package/dist/index.css CHANGED
@@ -3338,6 +3338,10 @@ html:lang(ar) .zen-tooltip__title {
3338
3338
  position: absolute;
3339
3339
  border-style: solid;
3340
3340
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
3341
+ border-width: 6px;
3342
+ border-color: transparent;
3343
+ /* stylelint-disable */
3344
+ /* stylelint-enable */
3341
3345
  }
3342
3346
  .zen-tooltip__arrow--top {
3343
3347
  inset-block-start: 100%;
@@ -3354,25 +3358,15 @@ html:lang(ar) .zen-tooltip__title {
3354
3358
  filter: drop-shadow(0 -4px 4px rgba(0, 0, 0, 0.2));
3355
3359
  }
3356
3360
  .zen-tooltip__arrow--right {
3357
- inset-inline-end: 100%;
3358
- border-color: transparent var(--backgrounds-content-1) transparent transparent;
3359
- border-width: 5px 6px 5px 0;
3361
+ right: 100%;
3362
+ border-right-color: var(--backgrounds-content-1);
3360
3363
  filter: drop-shadow(-4px 0 4px rgba(0, 0, 0, 0.2));
3361
3364
  }
3362
- [dir="rtl"] .zen-tooltip__arrow--right {
3363
- border-color: transparent transparent transparent var(--backgrounds-content-1);
3364
- filter: drop-shadow(4px 0 4px rgba(0, 0, 0, 0.2));
3365
- }
3366
3365
  .zen-tooltip__arrow--left {
3367
- inset-inline-start: 100%;
3368
- border-color: transparent transparent transparent var(--backgrounds-content-1);
3369
- border-width: 5px 0 6px 5px;
3366
+ left: 100%;
3367
+ border-left-color: var(--backgrounds-content-1);
3370
3368
  filter: drop-shadow(4px 0 4px rgba(0, 0, 0, 0.2));
3371
3369
  }
3372
- [dir="rtl"] .zen-tooltip__arrow--left {
3373
- border-color: transparent var(--backgrounds-content-1) transparent transparent;
3374
- filter: drop-shadow(-4px 0 4px rgba(0, 0, 0, 0.2));
3375
- }
3376
3370
  .zen-tooltip__trigger {
3377
3371
  color: var(--text-secondary);
3378
3372
  fill: var(--text-secondary);
@@ -4311,6 +4305,10 @@ html:lang(ar) .zen-side-panel-cell__title {
4311
4305
  background-color: var(--accents-success--main);
4312
4306
  border-color: var(--accents-success--detail);
4313
4307
  }
4308
+ .zen-toast--error {
4309
+ background-color: var(--accents-error--main);
4310
+ border-color: var(--accents-error--detail);
4311
+ }
4314
4312
  .zen-toast__icon {
4315
4313
  padding-inline-end: 0.5rem;
4316
4314
  }
@@ -4320,6 +4318,9 @@ html:lang(ar) .zen-side-panel-cell__title {
4320
4318
  .zen-toast__icon--success {
4321
4319
  fill: var(--accents-success--detail);
4322
4320
  }
4321
+ .zen-toast__icon--error {
4322
+ fill: var(--accents-error--detail);
4323
+ }
4323
4324
  .zen-toast__header {
4324
4325
  display: -webkit-box;
4325
4326
  -webkit-line-clamp: 2;
@@ -4346,6 +4347,10 @@ html:lang(ar) .zen-toast__header {
4346
4347
  color: var(--accents-success--detail);
4347
4348
  fill: var(--accents-success--detail);
4348
4349
  }
4350
+ .zen-toast__header--error {
4351
+ color: var(--accents-error--detail);
4352
+ fill: var(--accents-error--detail);
4353
+ }
4349
4354
  .zen-toast__close-button {
4350
4355
  display: flex;
4351
4356
  align-items: center;
@@ -4374,6 +4379,11 @@ html:lang(ar) .zen-toast__header {
4374
4379
  color: var(--accents-success--detail);
4375
4380
  outline-color: var(--accents-success--detail);
4376
4381
  }
4382
+ .zen-toast__close-button--error {
4383
+ fill: var(--accents-error--detail);
4384
+ color: var(--accents-error--detail);
4385
+ outline-color: var(--accents-error--detail);
4386
+ }
4377
4387
  .zen-toast__action {
4378
4388
  max-width: 6.875rem;
4379
4389
  overflow: hidden;
@@ -4383,11 +4393,18 @@ html:lang(ar) .zen-toast__header {
4383
4393
  justify-self: end;
4384
4394
  }
4385
4395
  .zen-toast__progress {
4386
- border-radius: 4px 4px 0 0;
4396
+ justify-self: start;
4397
+ border-start-start-radius: 4px;
4398
+ border-start-end-radius: 4px;
4399
+ border-end-start-radius: 0;
4400
+ border-end-end-radius: 0;
4387
4401
  transition: width 0.3s linear;
4388
4402
  }
4389
4403
  .zen-toast__progress--active {
4390
- border-radius: 4px 0 0 0;
4404
+ border-start-start-radius: 4px;
4405
+ border-start-end-radius: 0;
4406
+ border-end-start-radius: 0;
4407
+ border-end-end-radius: 0;
4391
4408
  }
4392
4409
  .zen-toast__progress--info {
4393
4410
  background-color: var(--accents-general--detail);
@@ -4395,6 +4412,9 @@ html:lang(ar) .zen-toast__header {
4395
4412
  .zen-toast__progress--success {
4396
4413
  background-color: var(--accents-success--detail);
4397
4414
  }
4415
+ .zen-toast__progress--error {
4416
+ background-color: var(--accents-error--detail);
4417
+ }
4398
4418
  .zen-alert {
4399
4419
  box-sizing: border-box;
4400
4420
  font-family: Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
@@ -8476,6 +8496,27 @@ html:lang(ar) .zen-dropdown-list__action-label {
8476
8496
  .zen-dropdown-list__action-button:disabled svg {
8477
8497
  fill: var(--text-button-disabled);
8478
8498
  }
8499
+ .zen-dropdown-list__action-button--selected {
8500
+ background-color: var(--action-primary--default);
8501
+ }
8502
+ .zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):hover,
8503
+ .zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):focus {
8504
+ background-color: var(--action-primary--default);
8505
+ fill: var(--text-reverse-primary);
8506
+ color: var(--text-reverse-primary);
8507
+ }
8508
+ .zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):focus-visible {
8509
+ border-color: var(--backgrounds-content-1);
8510
+ outline: 1px solid var(--borders-form-field--active);
8511
+ outline-offset: 2px;
8512
+ }
8513
+ .zen-dropdown-list__action-button--selected .zen-dropdown-list__icon {
8514
+ color: var(--text-reverse-primary);
8515
+ fill: var(--text-reverse-primary);
8516
+ }
8517
+ .zen-dropdown-list__action-button--selected .zen-dropdown-list__action-label {
8518
+ color: var(--text-reverse-primary);
8519
+ }
8479
8520
  .zen-dropdown-list__footer {
8480
8521
  display: flex;
8481
8522
  justify-content: flex-start;
@@ -12826,37 +12867,37 @@ html:lang(ar) .zen-radio__wrapper--mobile .zen-radio__label {
12826
12867
  .zen-alerts {
12827
12868
  position: fixed;
12828
12869
  top: 0;
12829
- right: 0;
12870
+ inset-inline-end: 0;
12830
12871
  z-index: 11020;
12831
12872
  display: grid;
12832
12873
  gap: 16px;
12833
12874
  margin-top: 48px;
12834
- padding-right: 24px;
12875
+ padding-inline-end: 24px;
12835
12876
  }
12836
12877
  .zen-alerts--mobile {
12837
12878
  width: 100%;
12838
12879
  gap: 8px;
12839
12880
  margin-top: 40px;
12840
- padding-right: 12px;
12841
- padding-left: 12px;
12881
+ padding-inline-end: 12px;
12882
+ padding-inline-start: 12px;
12842
12883
  box-sizing: border-box;
12843
12884
  }
12844
12885
  .zen-toasts {
12845
12886
  position: fixed;
12846
12887
  bottom: 0;
12847
- right: 0;
12888
+ inset-inline-end: 0;
12848
12889
  z-index: 11020;
12849
12890
  display: grid;
12850
12891
  gap: 16px;
12851
12892
  margin-bottom: 32px;
12852
- padding-right: 24px;
12893
+ padding-inline-end: 24px;
12853
12894
  }
12854
12895
  .zen-toasts--mobile {
12855
12896
  width: 100%;
12856
12897
  gap: 8px;
12857
12898
  margin-bottom: 16px;
12858
- padding-right: 12px;
12859
- padding-left: 12px;
12899
+ padding-inline-end: 12px;
12900
+ padding-inline-start: 12px;
12860
12901
  box-sizing: border-box;
12861
12902
  }
12862
12903
  @keyframes waiting {
@@ -13247,17 +13288,50 @@ html:lang(ar) .zen-file-upload__file-name {
13247
13288
  }
13248
13289
  }
13249
13290
  .zen-filters {
13250
- max-width: 40rem;
13291
+ display: flex;
13292
+ align-items: center;
13293
+ gap: 0.5rem;
13294
+ width: 100%;
13251
13295
  box-sizing: border-box;
13252
13296
  }
13253
13297
  .zen-filters * {
13254
13298
  box-sizing: border-box;
13255
13299
  }
13300
+ .zen-filters .zen-filters-search {
13301
+ flex-grow: 0;
13302
+ flex-shrink: 0;
13303
+ margin: 0;
13304
+ width: 11.25rem;
13305
+ }
13306
+ .zen-filters--mobile {
13307
+ flex-wrap: nowrap;
13308
+ overflow: auto hidden;
13309
+ scrollbar-width: none;
13310
+ -ms-overflow-style: none;
13311
+ }
13312
+ .zen-filters--mobile::-webkit-scrollbar {
13313
+ display: none;
13314
+ }
13315
+ .zen-filters--mobile .zen-filters__main-row--mobile {
13316
+ flex-shrink: 0;
13317
+ }
13318
+ .zen-filters--mobile .zen-filters-container {
13319
+ flex-shrink: 0;
13320
+ flex-grow: 0;
13321
+ flex-wrap: nowrap;
13322
+ width: auto;
13323
+ min-width: unset;
13324
+ }
13325
+ .zen-filters--mobile .zen-filters-container__mobile-scroll-wrapper {
13326
+ overflow: visible;
13327
+ width: auto;
13328
+ flex-shrink: 0;
13329
+ }
13256
13330
  .zen-filters__main-row {
13257
13331
  display: flex;
13258
13332
  align-items: center;
13259
13333
  box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.15);
13260
- border-radius: var(--border-radius-default);
13334
+ border-radius: 999px;
13261
13335
  border: var(--border-width-default) solid var(--borders-general);
13262
13336
  background-color: var(--backgrounds-main);
13263
13337
  }
@@ -13273,6 +13347,12 @@ html:lang(ar) .zen-file-upload__file-name {
13273
13347
  .zen-filters__main-row--initial {
13274
13348
  view-transition-name: expand-panel;
13275
13349
  }
13350
+ .zen-filters__main-row--mobile {
13351
+ width: auto;
13352
+ }
13353
+ .zen-filters__main-row--mobile .zen-filters-search {
13354
+ width: auto;
13355
+ }
13276
13356
  .zen-filters__select-trigger {
13277
13357
  width: auto;
13278
13358
  flex-shrink: 0;
@@ -13319,39 +13399,53 @@ html:lang(ar) .zen-file-upload__file-name {
13319
13399
  }
13320
13400
  .zen-filters__search .zen-search-input__input {
13321
13401
  border: none;
13322
- padding-inline: 0 0.0625rem;
13323
- border-end-start-radius: 0;
13324
- border-start-start-radius: 0;
13402
+ border-radius: 999px;
13403
+ display: flex;
13404
+ }
13405
+ .zen-filters__search-with-pills {
13406
+ border-radius: 999px;
13325
13407
  }
13326
- .zen-filters-popup.zen-filters-popup:not(.zen-filters-popup--mobile) {
13408
+ .zen-filters-popup.zen-filters-popup {
13327
13409
  box-sizing: border-box;
13328
- width: 40rem;
13329
- max-width: 40rem;
13410
+ border-radius: 0.5rem;
13411
+ overflow: hidden;
13412
+ display: flex;
13413
+ flex-direction: column;
13414
+ width: 28.125rem;
13415
+ max-width: 100%;
13330
13416
  view-transition-name: expand-panel;
13417
+ padding: 0;
13331
13418
  }
13332
- .zen-filters-popup.zen-filters-popup:not(.zen-filters-popup--mobile) * {
13419
+ .zen-filters-popup.zen-filters-popup * {
13333
13420
  box-sizing: border-box;
13334
13421
  }
13335
13422
  .zen-filters-popup__first-row {
13336
13423
  display: flex;
13337
- justify-content: space-between;
13338
13424
  align-items: center;
13339
- gap: 0.5rem;
13340
- padding: 0;
13425
+ border-block-end: var(--border-width-default) solid var(--borders-general);
13341
13426
  }
13342
- .zen-filters-popup__first-row--mobile {
13343
- padding: 0.5rem 1rem;
13427
+ .zen-filters-popup__first-row .zen-filters-search {
13428
+ flex-grow: 1;
13429
+ margin: 0;
13430
+ width: 100%;
13344
13431
  }
13345
- .zen-filters-popup__second-row {
13346
- border-block-start: var(--border-width-default) solid var(--borders-general);
13347
- padding: 1rem 0;
13432
+ .zen-filters-popup__first-row .zen-search-input__close-button--visible {
13433
+ visibility: visible;
13348
13434
  }
13349
- .zen-filters-popup__second-row--mobile {
13435
+ .zen-filters-popup__second-row {
13350
13436
  border-block-start: none;
13351
13437
  padding: 0;
13438
+ display: flex;
13439
+ flex-direction: column;
13440
+ flex: 1;
13441
+ min-height: 0;
13442
+ overflow-y: hidden;
13352
13443
  }
13353
13444
  .zen-filters-popup__content {
13354
13445
  display: flex;
13446
+ flex: 1;
13447
+ min-height: 0;
13448
+ overflow: hidden;
13355
13449
  }
13356
13450
  .zen-filters-popup__content .zen-filters-popup__left-panel {
13357
13451
  display: flex;
@@ -13383,21 +13477,44 @@ html:lang(ar) .zen-file-upload__file-name {
13383
13477
  flex-direction: row;
13384
13478
  flex-wrap: wrap;
13385
13479
  gap: 0.25rem;
13386
- margin-block-start: 0.5rem;
13480
+ margin-block-start: 0;
13387
13481
  padding: 0.5rem 0;
13388
13482
  }
13389
- .zen-filters-container__removal-chip .zen-chip__icon {
13390
- border: 1px solid var(--action-primary--active);
13391
- border-radius: 50%;
13483
+ .zen-filters-container .zen-chip--default {
13484
+ background-color: var(--backgrounds-main);
13485
+ color: var(--text-secondary);
13486
+ fill: var(--text-secondary);
13392
13487
  }
13393
- .zen-filters-container__removal-chip.zen-chip--accent .zen-chip__icon {
13394
- border: 1px solid var(--accents-general--main);
13488
+ .zen-filters-container .zen-chip--default:hover {
13489
+ background-color: var(--backgrounds-content-1);
13490
+ }
13491
+ .zen-filters-container .zen-chip--active {
13492
+ background-color: var(--accents-general--main);
13493
+ color: var(--action-primary--active);
13494
+ fill: var(--action-primary--active);
13495
+ border-color: var(--action-primary--active);
13496
+ }
13497
+ .zen-filters-container .zen-chip--active:hover {
13498
+ border-color: var(--action-primary--active);
13499
+ }
13500
+ .zen-filters-container .zen-chip--accent {
13501
+ background-color: var(--action-primary--active);
13502
+ color: var(--accents-general--main);
13503
+ fill: var(--accents-general--main);
13504
+ border-color: var(--action-primary--active);
13505
+ }
13506
+ .zen-filters-container__save-chip.zen-chip--active {
13507
+ border-color: var(--borders-general);
13395
13508
  }
13396
13509
  .zen-filters-container.zen-filters-container--mobile {
13397
13510
  padding: 0;
13398
13511
  }
13512
+ .zen-filters-container.zen-filters-container--mobile .zen-chip {
13513
+ height: 40px;
13514
+ padding-block: 0.75rem;
13515
+ padding-inline: 0.5rem;
13516
+ }
13399
13517
  .zen-filters-container__mobile-scroll-wrapper {
13400
- margin-inline-start: 0.5rem;
13401
13518
  padding: 0.125rem;
13402
13519
  display: flex;
13403
13520
  flex-direction: row;
@@ -13716,7 +13833,8 @@ html:lang(ar) .zen-file-upload__file-name {
13716
13833
  font-size: 0.75rem;
13717
13834
  border: none;
13718
13835
  outline: none;
13719
- padding-inline-end: 0.3125rem;
13836
+ padding-block: 0;
13837
+ padding-inline: 0 0.3125rem;
13720
13838
  -webkit-appearance: none;
13721
13839
  appearance: none;
13722
13840
  background-color: inherit;
@@ -14638,8 +14756,9 @@ html:lang(ar) .zen-list-item__secondary {
14638
14756
  justify-content: center;
14639
14757
  }
14640
14758
  .zen-filters-search-list {
14641
- max-height: 21.5625rem;
14642
- min-height: 21.25rem;
14759
+ flex: 1;
14760
+ min-height: 0;
14761
+ overflow-y: auto;
14643
14762
  }
14644
14763
  .zen-filters-search-list--mobile {
14645
14764
  padding: 1rem 0;
@@ -14649,8 +14768,8 @@ html:lang(ar) .zen-list-item__secondary {
14649
14768
  display: flex;
14650
14769
  align-items: center;
14651
14770
  justify-content: space-between;
14652
- margin-block: 0 0.5rem;
14653
- margin-inline: 0.5rem;
14771
+ margin-block: 1rem;
14772
+ margin-inline: 1rem;
14654
14773
  }
14655
14774
  .zen-filters-search-list__header-title {
14656
14775
  font-family: Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
@@ -15156,7 +15275,8 @@ html:lang(ar) .zen-page-header--mobile .zen-page-header__page-name {
15156
15275
  overflow-y: hidden;
15157
15276
  scrollbar-width: none;
15158
15277
  -ms-overflow-style: none;
15159
- padding: 0.0625rem;
15278
+ padding-block-start: 0.0625rem;
15279
+ padding-inline: 0.0625rem;
15160
15280
  }
15161
15281
  .zen-tabs__scrollable::-webkit-scrollbar {
15162
15282
  display: none;
@@ -16337,19 +16457,25 @@ html:lang(ar) .zen-filters-saved-popup__content.zen-filters-saved-popup__content
16337
16457
  flex-grow: 1;
16338
16458
  margin: 0 0.75rem;
16339
16459
  }
16460
+ .zen-filters-search__search-input {
16461
+ flex: 1;
16462
+ min-width: 0;
16463
+ }
16340
16464
  .zen-filters-search__selected {
16341
16465
  display: flex;
16342
16466
  gap: 0.5rem;
16343
16467
  flex-wrap: nowrap;
16344
16468
  align-items: center;
16345
- margin-inline-start: 0.5rem;
16346
- overflow: hidden;
16469
+ margin-inline-end: 0.5rem;
16470
+ flex-shrink: 0;
16347
16471
  }
16348
16472
  .zen-filters-search__selected-item {
16349
16473
  max-width: 11.3125rem;
16350
16474
  }
16351
16475
  .zen-filters-search__selected-item--more {
16352
16476
  flex-shrink: 0;
16477
+ min-width: 1.375rem;
16478
+ justify-content: center;
16353
16479
  }
16354
16480
  .zen-filters-search.zen-filters-popup__search-with-pills.zen-filters-search--mobile {
16355
16481
  margin: 0;
@@ -16360,6 +16486,30 @@ html:lang(ar) .zen-filters-saved-popup__content.zen-filters-saved-popup__content
16360
16486
  .zen-filters-search.zen-filters-popup__search-with-pills.zen-filters-search--mobile .zen-filters-search__selected {
16361
16487
  flex-shrink: 0;
16362
16488
  }
16489
+ .zen-filters-search--mobile {
16490
+ margin: 0;
16491
+ }
16492
+ .zen-filters-search__mobile-trigger {
16493
+ display: flex;
16494
+ align-items: center;
16495
+ justify-content: center;
16496
+ background: none;
16497
+ border: none;
16498
+ cursor: pointer;
16499
+ padding: 0 0.5rem;
16500
+ width: 2.5rem;
16501
+ height: 2.5rem;
16502
+ color: inherit;
16503
+ fill: currentcolor;
16504
+ flex-shrink: 0;
16505
+ }
16506
+ .zen-filters-search__mobile-trigger:focus-visible {
16507
+ outline: var(--border-width-default) solid var(--borders-form-field--active);
16508
+ border-radius: 999px;
16509
+ }
16510
+ .zen-filters-search__mobile-trigger-icon {
16511
+ flex-shrink: 0;
16512
+ }
16363
16513
  .zen-side-panel-filters {
16364
16514
  box-sizing: border-box;
16365
16515
  border-radius: var(--border-radius-default);
@@ -16555,7 +16705,8 @@ html:lang(ar) .zen-side-panel-filters__item-label--mobile {
16555
16705
  }
16556
16706
  }
16557
16707
  .zen-filters-select-compact {
16558
- padding: 0.25rem 1rem;
16708
+ padding-block: 1rem 0.25rem;
16709
+ padding-inline: 1rem;
16559
16710
  width: 100%;
16560
16711
  overflow-x: auto;
16561
16712
  -ms-overflow-style: none;
@@ -37,6 +37,15 @@ export function getInterpolatedValue(xScale, data, datasetIndex, xPixel) {
37
37
  if (x1 === x2) {
38
38
  return y1;
39
39
  }
40
+ // Sub-pixel tolerance: element.x (from Chart.js) and xScale.getPixelForValue()
41
+ // can disagree by a fraction of a pixel, causing the cursor to land just past a
42
+ // data point and interpolate with the next segment instead of returning the exact value.
43
+ if (Math.abs(x - x1) < 0.5) {
44
+ return y1;
45
+ }
46
+ if (Math.abs(x - x2) < 0.5) {
47
+ return y2;
48
+ }
40
49
  const interpolatedY = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1);
41
50
  return interpolatedY;
42
51
  }
@@ -52,32 +52,9 @@ export const LinePlugin = (containerId, options, isDark) => ({
52
52
  const y = chart.verticalLine.y;
53
53
  const topY = chart.chartArea.top;
54
54
  const bottomY = chart.chartArea.bottom;
55
+ drawLine(ctx, x, topY, bottomY);
55
56
  const datasets = chart.data.datasets;
56
57
  let lowestValueY = Infinity;
57
- const xScale = chart.scales.x;
58
- let snappedX = x;
59
- let closestDist = Infinity;
60
- datasets.forEach((dataset, dsIndex) => {
61
- if (!chart.isDatasetVisible(dsIndex)) {
62
- return;
63
- }
64
- if (chart.getDatasetMeta(dsIndex).type !== "line") {
65
- return;
66
- }
67
- const dataPoints = dataset.data;
68
- for (const point of dataPoints) {
69
- if (point.y === null) {
70
- continue;
71
- }
72
- const px = xScale.getPixelForValue(point.x);
73
- const dist = Math.abs(px - x);
74
- if (dist < closestDist) {
75
- closestDist = dist;
76
- snappedX = px;
77
- }
78
- }
79
- });
80
- drawLine(ctx, snappedX, topY, bottomY);
81
58
  const items = datasets
82
59
  .map((dataset, dsIndex) => {
83
60
  if (!chart.isDatasetVisible(dsIndex)) {
@@ -86,7 +63,8 @@ export const LinePlugin = (containerId, options, isDark) => ({
86
63
  if (chart.getDatasetMeta(dsIndex).type !== "line") {
87
64
  return undefined;
88
65
  }
89
- const value = getInterpolatedValue(xScale, chart.data, dsIndex, snappedX);
66
+ const xScale = chart.scales.x;
67
+ const value = getInterpolatedValue(xScale, chart.data, dsIndex, x);
90
68
  const yAxisID = dataset.yAxisID || "y";
91
69
  const yScale = chart.scales[yAxisID];
92
70
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -114,8 +92,8 @@ export const LinePlugin = (containerId, options, isDark) => ({
114
92
  return;
115
93
  }
116
94
  const chartRect = chart.canvas.getBoundingClientRect();
117
- const top = chartRect.top + (lowestValueY !== Infinity ? lowestValueY : y);
118
- const left = chartRect.left + snappedX;
95
+ const top = chartRect.top + (lowestValueY || y);
96
+ const left = chartRect.left + x;
119
97
  if (zen.document === undefined) {
120
98
  return;
121
99
  }
@@ -132,8 +110,8 @@ export const LinePlugin = (containerId, options, isDark) => ({
132
110
  xLabel = scaleLabels[elementIdx];
133
111
  }
134
112
  else {
135
- const xValue = chart.scales.x.getValueForPixel(snappedX);
136
- xLabel = xValue !== undefined ? chart.scales.x.getLabelForValue(xValue) : undefined;
113
+ const xValue = chart.scales.x.getValueForPixel(x);
114
+ xLabel = xValue ? chart.scales.x.getLabelForValue(xValue) : undefined;
137
115
  }
138
116
  renderTooltip(containerId, left + scrollLeft, top + scrollTop, "top", items, options === null || options === void 0 ? void 0 : options.title, options && options.subtitle !== undefined ? options.subtitle : xLabel, (options === null || options === void 0 ? void 0 : options.note) || undefined, isDark);
139
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geotab/zenith",
3
- "version": "3.15.0-beta.0",
3
+ "version": "3.15.0-beta.1",
4
4
  "description": "Zenith components library on React",
5
5
  "main": "dist/index.js",
6
6
  "types": "esm/index.d.ts",