minerva-design 1.19.0 → 1.19.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/angular/fesm2022/minerva-angular.mjs +10 -14
  3. package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
  4. package/dist/angular/types/minerva-angular.d.ts +8 -2
  5. package/dist/core/decimal-places.d.cts +6 -0
  6. package/dist/core/decimal-places.d.ts +6 -0
  7. package/dist/core/index.cjs +21 -21
  8. package/dist/core/index.cjs.map +1 -1
  9. package/dist/core/index.js +590 -580
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/keyboard-navigation.d.cts +14 -0
  12. package/dist/core/keyboard-navigation.d.ts +14 -0
  13. package/dist/core/number-input.d.cts +4 -1
  14. package/dist/core/number-input.d.ts +4 -1
  15. package/dist/core/slider.d.cts +1 -1
  16. package/dist/core/slider.d.ts +1 -1
  17. package/dist/react/components/AutoComplete/AutoComplete.cjs +1 -1
  18. package/dist/react/components/AutoComplete/AutoComplete.cjs.map +1 -1
  19. package/dist/react/components/AutoComplete/AutoComplete.js +91 -90
  20. package/dist/react/components/AutoComplete/AutoComplete.js.map +1 -1
  21. package/dist/react/components/DatePicker/DatePicker.cjs +1 -1
  22. package/dist/react/components/DatePicker/DatePicker.cjs.map +1 -1
  23. package/dist/react/components/DatePicker/DatePicker.js +3 -2
  24. package/dist/react/components/DatePicker/DatePicker.js.map +1 -1
  25. package/dist/vue/components/AutoComplete/AutoComplete.vue.js.map +1 -1
  26. package/dist/vue/components/AutoComplete/AutoComplete.vue_vue_type_script_setup_true_lang.js +58 -57
  27. package/dist/vue/components/AutoComplete/AutoComplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/weapp/controls.js +24 -12
  29. package/dist/web-components/cdn/minerva.js +532 -532
  30. package/dist/web-components/cdn/minerva.js.map +1 -1
  31. package/dist/web-components/components/autocomplete/autocomplete.d.ts +7 -1
  32. package/dist/web-components/components/autocomplete/autocomplete.js +29 -24
  33. package/dist/web-components/components/autocomplete/autocomplete.js.map +1 -1
  34. package/dist/web-components/components/date-picker/date-picker.js +11 -5
  35. package/dist/web-components/components/date-picker/date-picker.js.map +1 -1
  36. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # minerva-design
2
2
 
3
+ ## 1.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 220d212: Fix five input bugs, on every renderer that has the component.
8
+
9
+ - NumberInput (#5): when `precision` is not set, it now keeps every decimal of `step`. `step={1.25}` steps to 1.25 instead of 1, and `step={0.0000001}` now steps instead of staying at 0.
10
+ - Slider (#9): a step written in scientific notation keeps the decimals of its coefficient. With `step={1.5e-7}`, one key press moves by 1.5e-7 instead of 1e-7, and snapping keeps valid ticks unchanged.
11
+ - AutoComplete (#6): while `loading` hides the options, the arrow keys and Enter no longer pick a hidden old option, and `aria-activedescendant` no longer points to an option that is not shown.
12
+ - AutoComplete (#7): the keyboard highlight now follows the option, not its position. When the options change, the highlight stays on the same option. If that option is gone or disabled, `autoHighlight` moves to the first enabled option, and otherwise nothing is highlighted, so Enter always picks a shown option.
13
+ - DatePicker (#8): in a month partly cut by `minDate` / `maxDate`, the day grid always keeps one enabled day that Tab can reach.
14
+
3
15
  ## 1.19.0
4
16
 
5
17
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  import { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
2
2
  import * as i0 from "@angular/core";
3
3
  import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, Injectable, InjectionToken, Injector, PLATFORM_ID, SecurityContext, TemplateRef, ViewContainerRef, ViewEncapsulation, afterEveryRender, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, isDevMode, linkedSignal, makeEnvironmentProviders, model, numberAttribute, output, provideEnvironmentInitializer, signal, untracked, viewChild, viewChildren } from "@angular/core";
4
- import { CODE_MARK_COLORS, DEFAULT_LANGUAGE, DEFAULT_PLAYBACK_RATES, DEFAULT_SKIP_SECONDS, DEFAULT_TAG_SEPARATORS, MEDIA_ICON_PATHS, PALETTES, RATING_STAR_COUNT, addDays, answerSheetLegend, answerSheetMoveIndex, answerSheetSections, answerSheetSummary, applyCodeMarks, bufferedEnd, captionsPreference, clampMediaTime, clampNumber, clampVolume, closestSliderThumb, cn, codeLanguageLabel, codeMarkBackground, createCheckboxMachine, createRatingMachine, createSwitchMachine, createTypeahead, dashboardAccent, dashboardCount, dashboardLength, dayKey, designAttributes, detectCodeLanguage, findCascaderPath, flattenCascaderOptions, formatDevMessage, formatHasSeconds, formatMediaTime, formatNumberValue, formatPlaybackRate, formatTime, getNextIndex, getPageRange, getRatingKeyValue, getRatingStarFills, getSliderKeyValue, getSliderMarks, getVirtualRange, highlightCode, inferMediaType, inferStepPrecision, invalidPrimaryColorMessage, isPalette, isSliderMarkActive, isSupportedLanguage, localDate, matchesAccept, mediaKeyAction, mediaProgress, messages, monthStart, nextPlaybackRate, normalizeSliderValue, palettes, parseDayKey, parseNumberDraft, parseTimeInput, pickCaptionsTrack, presetPalette, readCaptionsPreference, resolveDesign, resolvePrimaryColor, resolveSize, resolveSpace, resolveTimeFormat, sameMonth, setSliderThumb, sliderPercent, sliderValueFromRatio, sliderValues, sliderValuesEqual, splitBySeparators, splitCodeMarkLines, startOfToday, toggledCaptionsTrack, translate, weekStart, writeCaptionsPreference } from "../../core/index.js";
4
+ import { CODE_MARK_COLORS, DEFAULT_LANGUAGE, DEFAULT_PLAYBACK_RATES, DEFAULT_SKIP_SECONDS, DEFAULT_TAG_SEPARATORS, MEDIA_ICON_PATHS, PALETTES, RATING_STAR_COUNT, addDays, answerSheetLegend, answerSheetMoveIndex, answerSheetSections, answerSheetSummary, applyCodeMarks, bufferedEnd, captionsPreference, clampMediaTime, clampNumber, clampVolume, closestSliderThumb, cn, codeLanguageLabel, codeMarkBackground, createCheckboxMachine, createRatingMachine, createSwitchMachine, createTypeahead, dashboardAccent, dashboardCount, dashboardLength, dayKey, designAttributes, detectCodeLanguage, findCascaderPath, flattenCascaderOptions, formatDevMessage, formatHasSeconds, formatMediaTime, formatNumberValue, formatPlaybackRate, formatTime, getNextIndex, getPageRange, getRatingKeyValue, getRatingStarFills, getSliderKeyValue, getSliderMarks, getVirtualRange, highlightCode, inferMediaType, inferStepPrecision, invalidPrimaryColorMessage, isPalette, isSliderMarkActive, isSupportedLanguage, localDate, matchesAccept, mediaKeyAction, mediaProgress, messages, monthStart, nextPlaybackRate, normalizeSliderValue, palettes, parseDayKey, parseNumberDraft, parseTimeInput, pickCaptionsTrack, presetPalette, readCaptionsPreference, resolveActiveOptionIndex, resolveDesign, resolvePrimaryColor, resolveSize, resolveSpace, resolveTimeFormat, sameMonth, setSliderThumb, sliderPercent, sliderValueFromRatio, sliderValues, sliderValuesEqual, splitBySeparators, splitCodeMarkLines, startOfToday, toggledCaptionsTrack, translate, weekStart, writeCaptionsPreference } from "../../core/index.js";
5
5
  import { FOCUS_SCOPE_UNMOUNT_EVENT, PALETTE_COOKIE_NAME, THEME_COOKIE_NAME, applyDesignAttributes, applyPosition, autoPosition, bindMediaCaptions, centerInScroller, clickedCodeMark, createDashboardDrag, createDismissableLayer, createFocusScope, dashboardDataAdapter, focusElement, generateCSSVariables, getCodeSelectionRange, getDirection, getSystemTheme, getTabbables, hideOthers, isBilingualTheme, isInteractiveEventTarget, lockScroll, logicalArrowKey, nearestInRow, parsePaletteCookie, parsePlacement, parseThemeCookie, primaryColorCss, primaryColorTheme, readCookieValue, resolveTheme, serializeThemeCookie, waitForExitAnimation } from "../../dom/index.js";
6
6
  import { FormGroupDirective, NG_VALUE_ACCESSOR, NgControl, NgForm } from "@angular/forms";
7
7
  import { DomSanitizer } from "@angular/platform-browser";
@@ -5985,7 +5985,7 @@ var MnAutoComplete = class MnAutoComplete extends MnFormValueControl {
5985
5985
  this.blocked = computed(() => this.isDisabled() || this.field.readOnly(), ...ngDevMode ? [{ debugName: "blocked" }] : /* istanbul ignore next */ []);
5986
5986
  this.shown = computed(() => this.open() && !this.blocked(), ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
5987
5987
  this.text = computed(() => this.value() ?? this.defaultValue() ?? "", ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
5988
- this.focusedIndex = signal(-1, ...ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []);
5988
+ this.focusedValue = signal(null, ...ngDevMode ? [{ debugName: "focusedValue" }] : /* istanbul ignore next */ []);
5989
5989
  this.hoveredIndex = signal(-1, ...ngDevMode ? [{ debugName: "hoveredIndex" }] : /* istanbul ignore next */ []);
5990
5990
  this.composing = false;
5991
5991
  this.layerEscape = null;
@@ -6039,12 +6039,8 @@ var MnAutoComplete = class MnAutoComplete extends MnFormValueControl {
6039
6039
  }));
6040
6040
  }, ...ngDevMode ? [{ debugName: "sections" }] : /* istanbul ignore next */ []);
6041
6041
  this.navigable = computed(() => this.sections().flatMap((section) => section.entries.map((entry) => entry.option)), ...ngDevMode ? [{ debugName: "navigable" }] : /* istanbul ignore next */ []);
6042
- this.activeIndex = computed(() => {
6043
- const focused = this.focusedIndex();
6044
- if (focused >= 0) return focused;
6045
- if (this.autoHighlight() && this.shown()) return this.navigable().findIndex((option) => !option.disabled);
6046
- return -1;
6047
- }, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
6042
+ this.interactive = computed(() => this.loading() ? [] : this.navigable(), ...ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []);
6043
+ this.activeIndex = computed(() => resolveActiveOptionIndex(this.interactive(), this.focusedValue(), this.autoHighlight() && this.shown()), ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
6048
6044
  this.activeOptionId = computed(() => this.shown() && this.activeIndex() >= 0 ? this.optionId(this.activeIndex()) : null, ...ngDevMode ? [{ debugName: "activeOptionId" }] : /* istanbul ignore next */ []);
6049
6045
  this.escapeConsumer = computed(() => !this.shown() && this.text() !== "", ...ngDevMode ? [{ debugName: "escapeConsumer" }] : /* istanbul ignore next */ []);
6050
6046
  this.showClear = computed(() => this.clearable() && this.text() !== "" && !this.isDisabled() && !this.field.readOnly(), ...ngDevMode ? [{ debugName: "showClear" }] : /* istanbul ignore next */ []);
@@ -6140,10 +6136,10 @@ var MnAutoComplete = class MnAutoComplete extends MnFormValueControl {
6140
6136
  }
6141
6137
  closeDropdown() {
6142
6138
  this.setOpen(false);
6143
- this.focusedIndex.set(-1);
6139
+ this.focusedValue.set(null);
6144
6140
  }
6145
6141
  moveFocus(step) {
6146
- const options = this.navigable();
6142
+ const options = this.interactive();
6147
6143
  const count = options.length;
6148
6144
  if (count === 0) return;
6149
6145
  const active = this.activeIndex();
@@ -6151,7 +6147,7 @@ var MnAutoComplete = class MnAutoComplete extends MnFormValueControl {
6151
6147
  for (let i = 0; i < count; i += 1) {
6152
6148
  index = (index + step + count) % count;
6153
6149
  if (!options[index].disabled) {
6154
- this.focusedIndex.set(index);
6150
+ this.focusedValue.set(options[index].value);
6155
6151
  return;
6156
6152
  }
6157
6153
  }
@@ -6164,7 +6160,7 @@ var MnAutoComplete = class MnAutoComplete extends MnFormValueControl {
6164
6160
  }
6165
6161
  onInput(next) {
6166
6162
  this.setText(next);
6167
- this.focusedIndex.set(-1);
6163
+ this.focusedValue.set(null);
6168
6164
  this.openDropdown();
6169
6165
  }
6170
6166
  onBlur(event) {
@@ -6186,7 +6182,7 @@ var MnAutoComplete = class MnAutoComplete extends MnFormValueControl {
6186
6182
  this.moveFocus(event.key === "ArrowDown" ? 1 : -1);
6187
6183
  break;
6188
6184
  case "Enter": {
6189
- const option = this.shown() ? this.navigable()[this.activeIndex()] : void 0;
6185
+ const option = this.shown() ? this.interactive()[this.activeIndex()] : void 0;
6190
6186
  const text = this.text().trim();
6191
6187
  if (option) {
6192
6188
  event.preventDefault();
@@ -6201,7 +6197,7 @@ var MnAutoComplete = class MnAutoComplete extends MnFormValueControl {
6201
6197
  case "Escape": if (event !== this.layerEscape && !this.shown() && this.text() !== "") {
6202
6198
  event.preventDefault();
6203
6199
  this.setText("");
6204
- this.focusedIndex.set(-1);
6200
+ this.focusedValue.set(null);
6205
6201
  }
6206
6202
  }
6207
6203
  }