@ferrlabs/ui-ng 1.52.4 → 1.52.5

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.
@@ -5114,7 +5114,7 @@ i0.ɵɵngDeclareClassMetadata({
5114
5114
  }]
5115
5115
  }
5116
5116
  });
5117
- const STEPS = [
5117
+ const STEPS$1 = [
5118
5118
  1,
5119
5119
  1.5,
5120
5120
  2,
@@ -5130,7 +5130,7 @@ function niceCeil(raw) {
5130
5130
  if (raw <= 0 || !Number.isFinite(raw)) return 1;
5131
5131
  const pow = Math.pow(10, Math.floor(Math.log10(raw)));
5132
5132
  const n = raw / pow;
5133
- return (STEPS.find((s) => n <= s + 1e-9) ?? 10) * pow;
5133
+ return (STEPS$1.find((s) => n <= s + 1e-9) ?? 10) * pow;
5134
5134
  }
5135
5135
  var BarChartComponent = class BarChartComponent {
5136
5136
  constructor() {
@@ -14948,6 +14948,19 @@ function userMenuItems(options = {}) {
14948
14948
  });
14949
14949
  return items;
14950
14950
  }
14951
+ const STEPS = /* @__PURE__ */ new Map([
14952
+ ["ArrowRight", 1],
14953
+ ["ArrowDown", 1],
14954
+ ["ArrowLeft", -1],
14955
+ ["ArrowUp", -1]
14956
+ ]);
14957
+ function keyTargetIndex(key, index, count) {
14958
+ if (count === 0) return null;
14959
+ if (key === "Home") return 0;
14960
+ if (key === "End") return count - 1;
14961
+ const step = STEPS.get(key);
14962
+ return step === void 0 ? null : (index + step + count) % count;
14963
+ }
14951
14964
  var SegmentedComponent = class SegmentedComponent {
14952
14965
  constructor() {
14953
14966
  this.sanitizer = inject(DomSanitizer);
@@ -14978,15 +14991,9 @@ var SegmentedComponent = class SegmentedComponent {
14978
14991
  }
14979
14992
  handleKeydown(event, index) {
14980
14993
  const options = this.options();
14981
- const step = {
14982
- ArrowRight: 1,
14983
- ArrowDown: 1,
14984
- ArrowLeft: -1,
14985
- ArrowUp: -1
14986
- }[event.key];
14987
- if (step === void 0) return;
14994
+ const next = keyTargetIndex(event.key, index, options.length);
14995
+ if (next === null) return;
14988
14996
  event.preventDefault();
14989
- const next = (index + step + options.length) % options.length;
14990
14997
  this.value.set(options[next].value);
14991
14998
  this.buttons()[next]?.nativeElement.focus();
14992
14999
  }