@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.78 → 2.0.0-next.80

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.
Files changed (53) hide show
  1. package/.storybook/vitest.setup.ts +24 -0
  2. package/bundle/openbridge-webcomponents.bundle.js +95 -10
  3. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  4. package/custom-elements.json +97 -5
  5. package/dist/components/alert-frame/alert-frame.css.js +9 -0
  6. package/dist/components/alert-frame/alert-frame.css.js.map +1 -1
  7. package/dist/components/alert-frame/alert-frame.d.ts +6 -1
  8. package/dist/components/alert-frame/alert-frame.d.ts.map +1 -1
  9. package/dist/components/alert-frame/alert-frame.js +7 -1
  10. package/dist/components/alert-frame/alert-frame.js.map +1 -1
  11. package/dist/components/input/input.d.ts +1 -0
  12. package/dist/components/input/input.d.ts.map +1 -0
  13. package/dist/components/input/input.js +2 -0
  14. package/dist/components/input/input.js.map +1 -0
  15. package/dist/components/pagination/pagination.d.ts +9 -0
  16. package/dist/components/pagination/pagination.d.ts.map +1 -1
  17. package/dist/components/pagination/pagination.js +12 -2
  18. package/dist/components/pagination/pagination.js.map +1 -1
  19. package/dist/components/slider/slider.d.ts +14 -1
  20. package/dist/components/slider/slider.d.ts.map +1 -1
  21. package/dist/components/slider/slider.js +17 -0
  22. package/dist/components/slider/slider.js.map +1 -1
  23. package/dist/components/slider-double/slider-double.d.ts +17 -1
  24. package/dist/components/slider-double/slider-double.d.ts.map +1 -1
  25. package/dist/components/slider-double/slider-double.js +15 -0
  26. package/dist/components/slider-double/slider-double.js.map +1 -1
  27. package/dist/components/toggle-button-group/toggle-button-group.d.ts +4 -0
  28. package/dist/components/toggle-button-group/toggle-button-group.d.ts.map +1 -1
  29. package/dist/components/toggle-button-group/toggle-button-group.js +15 -3
  30. package/dist/components/toggle-button-group/toggle-button-group.js.map +1 -1
  31. package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.d.ts +4 -0
  32. package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.d.ts.map +1 -1
  33. package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.js +10 -3
  34. package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.js.map +1 -1
  35. package/dist/components/toggle-switch/toggle-switch.d.ts +2 -0
  36. package/dist/components/toggle-switch/toggle-switch.d.ts.map +1 -1
  37. package/dist/components/toggle-switch/toggle-switch.js +8 -0
  38. package/dist/components/toggle-switch/toggle-switch.js.map +1 -1
  39. package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts.map +1 -1
  40. package/dist/navigation-instruments/readout-list-item/readout-list-item.js +2 -1
  41. package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/components/alert-frame/alert-frame.css +9 -0
  44. package/src/components/alert-frame/alert-frame.ts +10 -1
  45. package/src/components/input/input.ts +0 -0
  46. package/src/components/pagination/pagination.ts +25 -2
  47. package/src/components/slider/slider.ts +27 -1
  48. package/src/components/slider-double/slider-double.ts +28 -1
  49. package/src/components/toggle-button-group/toggle-button-group.ts +26 -3
  50. package/src/components/toggle-button-vertical-group/toggle-button-vertical-group.ts +28 -3
  51. package/src/components/toggle-switch/toggle-switch.ts +10 -0
  52. package/src/navigation-instruments/readout-list-item/readout-list-item.ts +2 -1
  53. package/vitest.config.ts +6 -0
@@ -1,4 +1,5 @@
1
1
  import {setProjectAnnotations} from '@storybook/web-components-vite';
2
+ import {beforeEach} from 'vitest';
2
3
  import * as projectAnnotations from './preview.js';
3
4
  import {vis, visAnnotations} from 'storybook-addon-vis/vitest-setup';
4
5
 
@@ -20,4 +21,27 @@ document.head.appendChild(style);
20
21
  // https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
21
22
  setProjectAnnotations([projectAnnotations, visAnnotations]);
22
23
 
24
+ // storybook-addon-vis captures and compares the screenshot in an afterEach hook.
23
25
  vis.setup();
26
+
27
+ // Flaky visual snapshots are retried via Vitest's `test.retry` (configured in
28
+ // vitest.config.ts). A retry re-runs the whole test, which re-renders the story
29
+ // and captures a brand new screenshot — that re-render is what actually shakes
30
+ // off render-time flakiness (e.g. sub-pixel anti-aliasing of <canvas> charts).
31
+ // Simply re-capturing an already-rendered DOM is not enough: the pixels are
32
+ // identical every time, so the only way to give a flaky frame another chance is
33
+ // to render it again.
34
+ //
35
+ // One catch: the vis matcher skips the comparison when the test already has
36
+ // recorded errors (`if (test.result.errors?.length) return`). On a Vitest retry
37
+ // the previous attempt's failure is still attached to the task, so without
38
+ // intervention the comparison would be silently skipped and the test would
39
+ // "pass" — masking real regressions. Clearing those errors at the start of each
40
+ // attempt keeps every retry honest: the snapshot is genuinely re-evaluated, so a
41
+ // transient diff gets another chance while a real mismatch still fails once the
42
+ // retries are exhausted.
43
+ beforeEach((context) => {
44
+ if (context.task.result) {
45
+ context.task.result.errors = [];
46
+ }
47
+ });
@@ -14552,6 +14552,11 @@ const compentStyle$1d = i$7`
14552
14552
  height: fit-content;
14553
14553
  }
14554
14554
 
14555
+ :host([fullwidth]) {
14556
+ display: block;
14557
+ width: 100%;
14558
+ }
14559
+
14555
14560
  .wrapper {
14556
14561
  --bg-color: var(--alert-alarm-color);
14557
14562
  --thickness: var(--global-size-spacing-border-weight-alertframe);
@@ -14578,6 +14583,10 @@ const compentStyle$1d = i$7`
14578
14583
  height: fit-content;
14579
14584
  }
14580
14585
 
14586
+ .wrapper.full-width {
14587
+ width: 100%;
14588
+ }
14589
+
14581
14590
  .wrapper {
14582
14591
 
14583
14592
  --blink-width-dynamic: calc(var(--blink-width) * var(--blink-on));
@@ -15271,6 +15280,7 @@ let ObcAlertFrame = class extends i$4 {
15271
15280
  this.status = AlertType.Alarm;
15272
15281
  this.mode = "acked-active";
15273
15282
  this.wrapContent = false;
15283
+ this.fullWidth = false;
15274
15284
  this.sharpEdgeTopLeft = false;
15275
15285
  this.sharpEdgeTopRight = false;
15276
15286
  this.sharpEdgeBottomLeft = false;
@@ -15285,6 +15295,7 @@ let ObcAlertFrame = class extends i$4 {
15285
15295
  class=${e$1({
15286
15296
  wrapper: true,
15287
15297
  "wrap-content": this.wrapContent,
15298
+ "full-width": this.fullWidth,
15288
15299
  ["thickness-" + this.thickness]: true,
15289
15300
  [this.type]: true,
15290
15301
  [this.status]: true,
@@ -15382,6 +15393,9 @@ __decorateClass$zF([
15382
15393
  __decorateClass$zF([
15383
15394
  n$3({ type: Boolean, reflect: true })
15384
15395
  ], ObcAlertFrame.prototype, "wrapContent", 2);
15396
+ __decorateClass$zF([
15397
+ n$3({ type: Boolean, reflect: true })
15398
+ ], ObcAlertFrame.prototype, "fullWidth", 2);
15385
15399
  __decorateClass$zF([
15386
15400
  n$3({ type: Boolean })
15387
15401
  ], ObcAlertFrame.prototype, "sharpEdgeTopLeft", 2);
@@ -15406,7 +15420,7 @@ __decorateClass$zF([
15406
15420
  ObcAlertFrame = __decorateClass$zF([
15407
15421
  customElement("obc-alert-frame")
15408
15422
  ], ObcAlertFrame);
15409
- function wrapWithAlertFrame(options, content) {
15423
+ function wrapWithAlertFrame(options, content, fullWidth = false) {
15410
15424
  if (typeof options !== "object" || options === null) {
15411
15425
  return content;
15412
15426
  }
@@ -15418,6 +15432,7 @@ function wrapWithAlertFrame(options, content) {
15418
15432
  .showIcon=${options.showIcon ?? false}
15419
15433
  .showAlertCategoryIcon=${options.showAlertCategoryIcon ?? true}
15420
15434
  .wrapContent=${true}
15435
+ .fullWidth=${fullWidth}
15421
15436
  >${content}</obc-alert-frame
15422
15437
  >`;
15423
15438
  }
@@ -75812,12 +75827,23 @@ let ObcSlider = class extends i$4 {
75812
75827
  this.value = value;
75813
75828
  this.dispatchEvent(new CustomEvent("value", { detail: this.value }));
75814
75829
  }
75830
+ /**
75831
+ * Fires the `change` event with the current value.
75832
+ *
75833
+ * @fires change
75834
+ */
75835
+ fireChangeEvent() {
75836
+ this.dispatchEvent(
75837
+ new CustomEvent("change", { detail: this.value })
75838
+ );
75839
+ }
75815
75840
  /**
75816
75841
  * Decrements the value by `stepClick` when the left icon button is clicked.
75817
75842
  */
75818
75843
  onReduceClick() {
75819
75844
  if (this.disabled) return;
75820
75845
  this.onInput(Math.max(this.value - this.stepClick, this.min));
75846
+ this.fireChangeEvent();
75821
75847
  }
75822
75848
  /**
75823
75849
  * Increments the value by `stepClick` when the right icon button is clicked.
@@ -75825,6 +75851,7 @@ let ObcSlider = class extends i$4 {
75825
75851
  onIncreaseClick() {
75826
75852
  if (this.disabled) return;
75827
75853
  this.onInput(Math.min(this.value + this.stepClick, this.max));
75854
+ this.fireChangeEvent();
75828
75855
  }
75829
75856
  get slider() {
75830
75857
  return this.renderRoot.querySelector('input[type="range"]');
@@ -75882,12 +75909,14 @@ let ObcSlider = class extends i$4 {
75882
75909
  window.removeEventListener("mousemove", this.onWindowMouseMove);
75883
75910
  window.removeEventListener("mouseup", this.onWindowMouseUp);
75884
75911
  this.stopAnimation();
75912
+ this.fireChangeEvent();
75885
75913
  }
75886
75914
  onTouchEnd() {
75887
75915
  this.isTouchActive = false;
75888
75916
  window.removeEventListener("touchmove", this.onWindowTouchMove);
75889
75917
  window.removeEventListener("touchend", this.onWindowTouchEnd);
75890
75918
  this.stopAnimation();
75919
+ this.fireChangeEvent();
75891
75920
  }
75892
75921
  updateTargetValue(e2) {
75893
75922
  const rect2 = this.slider.getBoundingClientRect();
@@ -75981,6 +76010,9 @@ let ObcSlider = class extends i$4 {
75981
76010
  @input=${(event) => {
75982
76011
  this.value = Number(event.target.value);
75983
76012
  this.dispatchEvent(new CustomEvent("value", { detail: this.value }));
76013
+ }}
76014
+ @change=${() => {
76015
+ this.fireChangeEvent();
75984
76016
  }}
75985
76017
  @mousedown=${this.onMouseDown}
75986
76018
  @touchstart=${this.onTouchStart}
@@ -77278,6 +77310,13 @@ let ObcToggleSwitch = class extends i$4 {
77278
77310
  e2.target.checked = this.checked;
77279
77311
  }
77280
77312
  }
77313
+ _fireChangeEvent(e2) {
77314
+ if (this.disabled) {
77315
+ e2.preventDefault();
77316
+ return;
77317
+ }
77318
+ this.dispatchEvent(new CustomEvent("change"));
77319
+ }
77281
77320
  render() {
77282
77321
  return b`
77283
77322
  <label
@@ -77302,6 +77341,7 @@ let ObcToggleSwitch = class extends i$4 {
77302
77341
  .checked=${this.checked}
77303
77342
  ?disabled=${this.disabled}
77304
77343
  @input=${this._tryChange}
77344
+ @change=${this._fireChangeEvent}
77305
77345
  />
77306
77346
  </div>
77307
77347
  </div>
@@ -78084,7 +78124,7 @@ let ObcToggleButtonGroup = class extends i$4 {
78084
78124
  if (this.disabled) return null;
78085
78125
  return Array.from(this.options).find((opt) => !opt.disabled) || null;
78086
78126
  }
78087
- updateSelection(newValue, emitEvent = true) {
78127
+ updateSelection(newValue, emitValueEvent = true, emitChangeEvent = false) {
78088
78128
  const oldValue = this.value;
78089
78129
  if (!this.hasAnyEnabledOption()) {
78090
78130
  this.options.forEach((option) => {
@@ -78113,13 +78153,20 @@ let ObcToggleButtonGroup = class extends i$4 {
78113
78153
  option.selected = option.value === newValue;
78114
78154
  });
78115
78155
  this.setNoDivider();
78116
- if (emitEvent && oldValue !== newValue) {
78156
+ if (emitValueEvent && oldValue !== newValue) {
78117
78157
  this.dispatchEvent(
78118
78158
  new CustomEvent("value", {
78119
78159
  detail: { value: newValue, previousValue: oldValue }
78120
78160
  })
78121
78161
  );
78122
78162
  }
78163
+ if (emitChangeEvent && oldValue !== newValue) {
78164
+ this.dispatchEvent(
78165
+ new CustomEvent("change", {
78166
+ detail: { value: newValue }
78167
+ })
78168
+ );
78169
+ }
78123
78170
  }
78124
78171
  updateActivated(newValue) {
78125
78172
  if (newValue) {
@@ -78220,8 +78267,13 @@ let ObcToggleButtonGroup = class extends i$4 {
78220
78267
  detail: { value, previousValue: this.value }
78221
78268
  })
78222
78269
  );
78270
+ this.dispatchEvent(
78271
+ new CustomEvent("change", {
78272
+ detail: { value }
78273
+ })
78274
+ );
78223
78275
  } else {
78224
- this.updateSelection(value);
78276
+ this.updateSelection(value, true, true);
78225
78277
  }
78226
78278
  }
78227
78279
  willUpdate(changedProperties) {
@@ -94348,7 +94400,14 @@ let ObcPagination = class extends i$4 {
94348
94400
  this.fullWidth = false;
94349
94401
  this.disabled = false;
94350
94402
  this.handlePageChange = (event) => {
94351
- this.setCurrentPage(Number(event.detail.value));
94403
+ const success = this.setCurrentPage(Number(event.detail.value));
94404
+ if (success) {
94405
+ this.dispatchEvent(
94406
+ new CustomEvent("select-page", {
94407
+ detail: { page: Number(event.detail.value) }
94408
+ })
94409
+ );
94410
+ }
94352
94411
  };
94353
94412
  this.handleFirstClick = () => {
94354
94413
  if (!this.canNavigateFirst) return;
@@ -94409,13 +94468,16 @@ let ObcPagination = class extends i$4 {
94409
94468
  }
94410
94469
  setCurrentPage(newPage) {
94411
94470
  const page = Math.max(1, Math.min(newPage, this.validatedPages));
94412
- if (page === this.currentPage) return;
94471
+ if (page === this.currentPage) {
94472
+ return false;
94473
+ }
94413
94474
  this.currentPage = page;
94414
94475
  this.dispatchEvent(
94415
94476
  new CustomEvent("value", {
94416
94477
  detail: { value: page }
94417
94478
  })
94418
94479
  );
94480
+ return true;
94419
94481
  }
94420
94482
  dispatchNavigateEvent(action) {
94421
94483
  this.dispatchEvent(
@@ -100664,6 +100726,18 @@ let ObcSliderDouble = class extends i$4 {
100664
100726
  new CustomEvent("value", { detail: { low: this.low, high: this.high } })
100665
100727
  );
100666
100728
  }
100729
+ /**
100730
+ * Fires the `change` event with the current low and high values.
100731
+ *
100732
+ * @fires change
100733
+ */
100734
+ fireChangeEvent() {
100735
+ this.dispatchEvent(
100736
+ new CustomEvent("change", {
100737
+ detail: { low: this.low, high: this.high }
100738
+ })
100739
+ );
100740
+ }
100667
100741
  lowClickValue(e2) {
100668
100742
  const rect2 = this.minInput.getBoundingClientRect();
100669
100743
  const left = rect2.left + this.THUMB_WIDTH - this.THUMB_VISIBLE_WIDTH / 2;
@@ -100751,6 +100825,7 @@ let ObcSliderDouble = class extends i$4 {
100751
100825
  window.removeEventListener("mousemove", this.onWindowMouseMove);
100752
100826
  window.removeEventListener("mouseup", this.onWindowMouseUp);
100753
100827
  this.stopAnimation();
100828
+ this.fireChangeEvent();
100754
100829
  }
100755
100830
  updateTargetValue(e2) {
100756
100831
  const unroundedValue = this.isTargetingLow ? this.lowClickValue(e2) : this.highClickValue(e2);
@@ -100867,6 +100942,7 @@ let ObcSliderDouble = class extends i$4 {
100867
100942
  .value=${this.low.toString()}
100868
100943
  ?disabled=${this.variant === "no-input" || this.disabled}
100869
100944
  @input=${this.onInput}
100945
+ @change=${() => this.fireChangeEvent()}
100870
100946
  />
100871
100947
  <input
100872
100948
  type="range"
@@ -100877,6 +100953,7 @@ let ObcSliderDouble = class extends i$4 {
100877
100953
  .value=${this.high.toString()}
100878
100954
  ?disabled=${this.variant === "no-input" || this.disabled}
100879
100955
  @input=${this.onInput}
100956
+ @change=${() => this.fireChangeEvent()}
100880
100957
  />
100881
100958
  <div class="interactive-track"></div>
100882
100959
  <div class="thumb min"></div>
@@ -107401,7 +107478,7 @@ let ObcToggleButtonVerticalGroup = class extends i$4 {
107401
107478
  if (this.disabled) return null;
107402
107479
  return Array.from(this.options).find((opt) => !opt.disabled) || null;
107403
107480
  }
107404
- updateSelection(newValue, emitEvent = true) {
107481
+ updateSelection(newValue, emitValueEvent = true, emitChangeEvent = false) {
107405
107482
  const oldValue = this.value;
107406
107483
  if (!this.hasAnyEnabledOption()) {
107407
107484
  this.options.forEach((option) => {
@@ -107430,13 +107507,20 @@ let ObcToggleButtonVerticalGroup = class extends i$4 {
107430
107507
  option.selected = option.value === newValue;
107431
107508
  });
107432
107509
  this.updateDividers();
107433
- if (emitEvent && oldValue !== newValue) {
107510
+ if (emitValueEvent && oldValue !== newValue) {
107434
107511
  this.dispatchEvent(
107435
107512
  new CustomEvent("value", {
107436
107513
  detail: { value: newValue, previousValue: oldValue }
107437
107514
  })
107438
107515
  );
107439
107516
  }
107517
+ if (emitChangeEvent && oldValue !== newValue) {
107518
+ this.dispatchEvent(
107519
+ new CustomEvent("change", {
107520
+ detail: { value: newValue }
107521
+ })
107522
+ );
107523
+ }
107440
107524
  }
107441
107525
  firstUpdated(changed) {
107442
107526
  super.firstUpdated(changed);
@@ -107535,7 +107619,7 @@ let ObcToggleButtonVerticalGroup = class extends i$4 {
107535
107619
  }
107536
107620
  onOptionSelected(e2) {
107537
107621
  const { value } = e2.detail;
107538
- this.updateSelection(value);
107622
+ this.updateSelection(value, true, true);
107539
107623
  }
107540
107624
  render() {
107541
107625
  const classes = {
@@ -222747,7 +222831,8 @@ let ObcReadoutListItem = class extends i$4 {
222747
222831
  `}
222748
222832
  </div>
222749
222833
  </div>
222750
- `
222834
+ `,
222835
+ true
222751
222836
  );
222752
222837
  }
222753
222838
  };