minerva-design 1.19.0 → 1.19.2

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 +18 -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
@@ -9,10 +9,11 @@ import "../Empty/index.js";
9
9
  import o from "../ProgressIndicator/ProgressIndicator.vue.js";
10
10
  import "../ProgressIndicator/index.js";
11
11
  import { Fragment as s, computed as c, createBlock as l, createCommentVNode as ee, createElementBlock as u, createElementVNode as d, createVNode as f, defineComponent as p, getCurrentInstance as te, guardReactiveProps as ne, h as m, mergeProps as h, normalizeClass as g, normalizeProps as re, onMounted as ie, openBlock as _, ref as v, renderList as y, renderSlot as ae, shallowRef as b, toDisplayString as x, unref as S, useAttrs as oe, useId as se, useSlots as ce, watch as le, withCtx as ue } from "vue";
12
- import { ESCAPE_CONSUMER_ATTRIBUTE as de } from "../../../dom/index.js";
12
+ import { resolveActiveOptionIndex as de } from "../../../core/index.js";
13
+ import { ESCAPE_CONSUMER_ATTRIBUTE as fe } from "../../../dom/index.js";
13
14
  import C from "../../../react/components/AutoComplete/autoComplete.module.scss.js";
14
15
  //#region src/components/AutoComplete/AutoComplete.vue?vue&type=script&setup=true&lang.ts
15
- var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@__PURE__*/ p({
16
+ var pe = ["for"], me = ["aria-label", "aria-busy"], he = ["aria-label"], w = /*@__PURE__*/ p({
16
17
  name: "AutoComplete",
17
18
  inheritAttrs: !1,
18
19
  __name: "AutoComplete",
@@ -70,30 +71,30 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
70
71
  "submit"
71
72
  ],
72
73
  setup(p, { emit: w }) {
73
- let T = p, E = w, D = ce(), he = {
74
+ let T = p, E = w, D = ce(), ge = {
74
75
  top: "top-start",
75
76
  bottom: "bottom-start",
76
77
  left: "left-start",
77
78
  right: "right-start"
78
- }, ge = oe(), _e = te(), ve = () => !!_e?.vnode.props?.onSubmit, O = n(T, "modelValue", {
79
+ }, _e = oe(), ve = te(), ye = () => !!ve?.vnode.props?.onSubmit, O = n(T, "modelValue", {
79
80
  defaultProp: "defaultValue",
80
81
  fallback: "",
81
82
  onChange: (e) => E("change", e),
82
83
  name: "AutoComplete"
83
84
  }), k = v(!1), A = (e) => {
84
85
  k.value !== e && (k.value = e, E("dropdownVisibleChange", e));
85
- }, j = v(-1), M = v(-1), N = b(null), P = b(null), F = v(null), I = c(() => T.placement === "top" || T.placement === "bottom"), L = se(), R = `${L}-listbox`, z = !1, B = (e) => {
86
+ }, j = v(null), M = v(-1), N = b(null), P = b(null), F = v(null), I = c(() => T.placement === "top" || T.placement === "bottom"), L = se(), R = `${L}-listbox`, z = !1, B = (e) => {
86
87
  z = e;
87
- }, ye = () => T.inputProps?.readOnly ?? T.inputProps?.readonly, V = t(() => ({
88
+ }, be = () => T.inputProps?.readOnly ?? T.inputProps?.readonly, V = t(() => ({
88
89
  id: T.inputProps?.id,
89
90
  disabled: T.inputProps?.disabled,
90
- readOnly: ye()
91
+ readOnly: be()
91
92
  })), H = c(() => V.value.id ?? `${L}-input`), U = c(() => V.value.disabled || V.value.readOnly), W = c(() => k.value && !U.value);
92
93
  function G() {
93
94
  U.value || A(!0);
94
95
  }
95
96
  function K() {
96
- A(!1), j.value = -1;
97
+ A(!1), j.value = null;
97
98
  }
98
99
  let q = c(() => {
99
100
  let e = O.value, t = e.toLowerCase(), n = T.options.filter((n) => T.filterOption ? T.filterOption(e, n) : n.label.toLowerCase().includes(t));
@@ -113,88 +114,88 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
113
114
  let r = e(n), i = t.get(r);
114
115
  i ? i.push(n) : t.set(r, [n]);
115
116
  }), Array.from(t.entries());
116
- }), Y = c(() => J.value ? J.value.flatMap(([, e]) => e) : q.value), X = c(() => j.value >= 0 ? j.value : T.autoHighlight && W.value ? Y.value.findIndex((e) => !e.disabled) : -1);
117
- function Z(e) {
118
- let t = Y.value, n = t.length;
117
+ }), Y = c(() => J.value ? J.value.flatMap(([, e]) => e) : q.value), X = c(() => T.loading ? [] : Y.value), Z = c(() => de(X.value, j.value, T.autoHighlight && W.value));
118
+ function Q(e) {
119
+ let t = X.value, n = t.length;
119
120
  if (n === 0) return;
120
- let r = X.value >= 0 ? X.value : e === 1 ? -1 : n;
121
+ let r = Z.value >= 0 ? Z.value : e === 1 ? -1 : n;
121
122
  for (let i = 0; i < n; i += 1) if (r = (r + e + n) % n, !t[r].disabled) {
122
- j.value = r;
123
+ j.value = t[r].value;
123
124
  return;
124
125
  }
125
126
  }
126
- function Q(e) {
127
+ function xe(e) {
127
128
  e.disabled || (T.fillOnSelect && (O.value = e.label), K(), E("select", e));
128
129
  }
129
- function be(e) {
130
+ function Se(e) {
130
131
  if (!(U.value || z || e.isComposing || e.keyCode === 229)) switch (e.key) {
131
132
  case "ArrowDown":
132
- e.preventDefault(), k.value || G(), Z(1);
133
+ e.preventDefault(), k.value || G(), Q(1);
133
134
  break;
134
135
  case "ArrowUp":
135
- e.preventDefault(), k.value || G(), Z(-1);
136
+ e.preventDefault(), k.value || G(), Q(-1);
136
137
  break;
137
138
  case "Enter": {
138
- let t = W.value ? Y.value[X.value] : void 0, n = O.value.trim();
139
- t ? (e.preventDefault(), Q(t)) : ve() && n && (e.preventDefault(), E("submit", n), K());
139
+ let t = W.value ? X.value[Z.value] : void 0, n = O.value.trim();
140
+ t ? (e.preventDefault(), xe(t)) : ye() && n && (e.preventDefault(), E("submit", n), K());
140
141
  break;
141
142
  }
142
- case "Escape": e !== Ae && !W.value && O.value !== "" && (e.preventDefault(), O.value = "", j.value = -1);
143
+ case "Escape": e !== Me && !W.value && O.value !== "" && (e.preventDefault(), O.value = "", j.value = null);
143
144
  }
144
145
  }
145
- function xe(e) {
146
- O.value = e, j.value = -1, G();
146
+ function Ce(e) {
147
+ O.value = e, j.value = null, G();
147
148
  }
148
- function Se(e) {
149
+ function we(e) {
149
150
  let t = e.relatedTarget, n = F.value?.element;
150
151
  t && (n?.contains(t) || N.value?.contains(t)) || K();
151
152
  }
152
- function Ce(e) {
153
- e.disabled || z || (Q(e), E("optionClick", e), P.value?.focus());
153
+ function Te(e) {
154
+ e.disabled || z || (xe(e), E("optionClick", e), P.value?.focus());
154
155
  }
155
- function we(e, t) {
156
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Ce(t));
156
+ function Ee(e, t) {
157
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Te(t));
157
158
  }
158
- function Te() {
159
+ function De() {
159
160
  k.value || G();
160
161
  }
161
162
  ie(() => {
162
163
  P.value = N.value?.querySelector("input") ?? null;
163
164
  });
164
- let Ee = (e) => `${R}-option-${e}`, De = c(() => W.value && X.value >= 0 ? Ee(X.value) : void 0);
165
- le(De, (e) => {
165
+ let Oe = (e) => `${R}-option-${e}`, ke = c(() => W.value && Z.value >= 0 ? Oe(Z.value) : void 0);
166
+ le(ke, (e) => {
166
167
  e && (N.value?.ownerDocument.getElementById(e))?.scrollIntoView?.({ block: "nearest" });
167
168
  }, { flush: "post" });
168
- let Oe = c(() => ({
169
+ let Ae = c(() => ({
169
170
  ...T.inputProps,
170
171
  id: H.value,
171
172
  disabled: V.value.disabled,
172
173
  readOnly: V.value.readOnly,
173
174
  name: T.name,
174
175
  modelValue: O.value,
175
- "onUpdate:modelValue": xe,
176
+ "onUpdate:modelValue": Ce,
176
177
  role: "combobox",
177
178
  "aria-autocomplete": "list",
178
179
  "aria-expanded": String(W.value),
179
180
  "aria-controls": W.value ? R : void 0,
180
- "aria-activedescendant": De.value,
181
- [de]: !W.value && O.value !== "" ? "" : void 0
182
- })), ke = c(() => ({
181
+ "aria-activedescendant": ke.value,
182
+ [fe]: !W.value && O.value !== "" ? "" : void 0
183
+ })), je = c(() => ({
183
184
  mainAxis: I.value ? T.offset.y : T.offset.x,
184
185
  crossAxis: I.value ? T.offset.x : T.offset.y
185
- })), Ae = null;
186
- function je(e) {
187
- Ae = e, (z || e.isComposing) && e.preventDefault();
186
+ })), Me = null;
187
+ function Ne(e) {
188
+ Me = e, (z || e.isComposing) && e.preventDefault();
188
189
  }
189
- let Me = c(() => ({
190
- ...ge,
190
+ let Pe = c(() => ({
191
+ ..._e,
191
192
  ...e("autocomplete", "root", {
192
193
  state: W.value ? "open" : "closed",
193
194
  disabled: V.value.disabled,
194
195
  readonly: V.value.readOnly,
195
196
  loading: T.loading
196
197
  })
197
- })), Ne = c(() => {
198
+ })), Fe = c(() => {
198
199
  let e = J.value;
199
200
  if (!e) return [{
200
201
  key: "all",
@@ -214,7 +215,7 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
214
215
  }))
215
216
  }));
216
217
  }), $ = ({ option: t, index: n }) => {
217
- let r = X.value === n, i = M.value === n || r, a = t.icon, o = T.mode === "custom" && D.option ? D.option({ option: t }) : m("div", { class: C.basicOption }, [a ? m("span", { class: C.icon }, typeof a == "function" ? a() : a) : null, m("div", { class: C.content }, [m("div", { class: C.label }, t.label), t.description ? m("div", { class: C.description }, t.description) : null])]);
218
+ let r = Z.value === n, i = M.value === n || r, a = t.icon, o = T.mode === "custom" && D.option ? D.option({ option: t }) : m("div", { class: C.basicOption }, [a ? m("span", { class: C.icon }, typeof a == "function" ? a() : a) : null, m("div", { class: C.content }, [m("div", { class: C.label }, t.label), t.description ? m("div", { class: C.description }, t.description) : null])]);
218
219
  return m("div", {
219
220
  class: [
220
221
  C.optionItem,
@@ -225,12 +226,12 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
225
226
  style: t.style,
226
227
  role: "option",
227
228
  tabindex: -1,
228
- id: Ee(n),
229
+ id: Oe(n),
229
230
  "aria-selected": r,
230
231
  "aria-disabled": t.disabled || void 0,
231
232
  onMousedown: (e) => e.preventDefault(),
232
- onClick: () => Ce(t),
233
- onKeydown: (e) => we(e, t),
233
+ onClick: () => Te(t),
234
+ onKeydown: (e) => Ee(e, t),
234
235
  onMouseenter: () => M.value = n,
235
236
  onMouseleave: () => M.value = -1,
236
237
  ...e("autocomplete", "item", {
@@ -243,7 +244,7 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
243
244
  ref_key: "container",
244
245
  ref: N,
245
246
  class: S(C).autoComplete
246
- }, Me.value, {
247
+ }, Pe.value, {
247
248
  onCompositionstart: n[0] ||= (e) => B(!0),
248
249
  onCompositionend: n[1] ||= (e) => B(!1)
249
250
  }), [
@@ -251,26 +252,26 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
251
252
  key: 0,
252
253
  for: H.value,
253
254
  class: S(C).label
254
- }, S(e)("autocomplete", "label")), x(p.label), 17, fe)) : ee("", !0),
255
- f(S(r), h(Oe.value, {
255
+ }, S(e)("autocomplete", "label")), x(p.label), 17, pe)) : ee("", !0),
256
+ f(S(r), h(Ae.value, {
256
257
  onFocus: G,
257
- onBlur: Se,
258
- onKeydown: be,
259
- onClick: Te
258
+ onBlur: we,
259
+ onKeydown: Se,
260
+ onClick: De
260
261
  }), null, 16),
261
262
  f(i, h({
262
263
  ref_key: "panel",
263
264
  ref: F,
264
265
  open: W.value,
265
266
  anchor: N.value,
266
- placement: he[p.placement],
267
- offset: ke.value,
267
+ placement: ge[p.placement],
268
+ offset: je.value,
268
269
  "match-anchor-width": "min",
269
270
  branches: () => [N.value],
270
271
  "return-focus-on-escape": () => P.value,
271
272
  class: [S(C).popup, p.dropdownClassName]
272
273
  }, S(e)("autocomplete", "content", { state: "open" }), {
273
- onEscapeKeyDown: je,
274
+ onEscapeKeyDown: Ne,
274
275
  onDismiss: K
275
276
  }), {
276
277
  default: ue(() => [d("div", { class: g([S(C).dropdown, p.animation && S(C).animated]) }, [d("div", h({
@@ -283,7 +284,7 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
283
284
  key: 0,
284
285
  role: "presentation",
285
286
  class: S(C).loading
286
- }, S(e)("autocomplete", "loading")), [f(S(o))], 16)) : q.value.length > 0 ? (_(!0), u(s, { key: 1 }, y(Ne.value, (t) => (_(), u(s, { key: t.key }, [t.group === "" ? (_(!0), u(s, { key: 0 }, y(t.items, (e) => (_(), l($, {
287
+ }, S(e)("autocomplete", "loading")), [f(S(o))], 16)) : q.value.length > 0 ? (_(!0), u(s, { key: 1 }, y(Fe.value, (t) => (_(), u(s, { key: t.key }, [t.group === "" ? (_(!0), u(s, { key: 0 }, y(t.items, (e) => (_(), l($, {
287
288
  key: e.option.value,
288
289
  option: e.option,
289
290
  index: e.index
@@ -299,11 +300,11 @@ var fe = ["for"], pe = ["aria-label", "aria-busy"], me = ["aria-label"], w = /*@
299
300
  key: e.option.value,
300
301
  option: e.option,
301
302
  index: e.index
302
- }, null, 8, ["option", "index"]))), 128))], 10, me))], 64))), 128)) : (_(), u("div", h({
303
+ }, null, 8, ["option", "index"]))), 128))], 10, he))], 64))), 128)) : (_(), u("div", h({
303
304
  key: 2,
304
305
  role: "presentation",
305
306
  class: S(C).empty
306
- }, S(e)("autocomplete", "empty")), [ae(t.$slots, "empty", {}, () => [f(S(a), re(ne(p.emptyProps)), null, 16)])], 16))], 16, pe)], 2)]),
307
+ }, S(e)("autocomplete", "empty")), [ae(t.$slots, "empty", {}, () => [f(S(a), re(ne(p.emptyProps)), null, 16)])], 16))], 16, me)], 2)]),
307
308
  _: 3
308
309
  }, 16, [
309
310
  "open",
@@ -1 +1 @@
1
- {"version":3,"file":"AutoComplete.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_createCommentVNode","_createVNode","Input","FloatingPanel","_withCtx","_createElementVNode","_normalizeClass","ProgressIndicator","_Fragment","_renderList","_createBlock","_renderSlot","Empty","_normalizeProps","_guardReactiveProps","Input_default","FloatingPanel_default","Empty_default","ProgressIndicator_default","styles","_hoisted_1","_hoisted_2","_hoisted_3","AutoComplete_vue_vue_type_script_setup_true_lang_default","__emit","props","__props","emit","slots","useSlots","PLACEMENT","attrs","useAttrs","instance","getCurrentInstance","hasSubmitListener","inputValue","useControllable","next","visible","ref","setVisible","focusedIndex","hoveredIndex","container","shallowRef","input","panel","vertical","computed","baseId","useId","listboxId","composing","setComposing","value","inputReadOnly","field","useFormControlProps","inputId","blocked","shown","open","close","processedOptions","search","result","option","groupedOptions","groupBy","runs","group","last","groups","list","navigableOptions","activeIndex","moveFocus","count","index","step","handleOptionSelect","handleKeyDown","event","text","closingEscape","handleInputChange","handleBlur","dropdown","handleOptionClick","onOptionKeyDown","onInputClick","optionId","activeOptionId","id","inputBindings","ESCAPE_CONSUMER_ATTRIBUTE","panelOffset","onEscapeKeyDown","rootAttrs","hooks","sections","order","groupIndex","OptionRow","active","highlighted","icon","content","h","openBlock","createElementBlock","mergeProps","unref","_cache","toDisplayString","createCommentVNode","createVNode","withCtx","createElementVNode","normalizeClass","Fragment","renderList","section","createBlock","item","renderSlot","_ctx","normalizeProps","guardReactiveProps"],"sources":["../../../../../vue/src/components/AutoComplete/AutoComplete.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * AutoComplete: a text input (combobox) that suggests options from a list.\n * Supports grouping, custom rendering (`option` slot) and async loading; the\n * input text is `v-model` (or `defaultValue`). Focus stays in the input\n * (`aria-activedescendant`). For picking several values use `TagInput`.\n */\nimport {\n computed,\n getCurrentInstance,\n h,\n onMounted,\n ref,\n shallowRef,\n useAttrs,\n useId,\n watch,\n type FunctionalComponent,\n type VNodeChild,\n} from \"vue\";\nimport { ESCAPE_CONSUMER_ATTRIBUTE } from \"@minerva/dom\";\nimport styles from \"@react-styles/components/AutoComplete/autoComplete.module.scss\";\nimport FloatingPanel from \"../../internal/FloatingPanel.vue\";\nimport { hooks } from \"../../internal/hooks\";\nimport { useControllable } from \"../../internal/controllable\";\nimport { useFormControlProps } from \"../../internal/form-control\";\nimport { Input } from \"../Input\";\nimport { Empty } from \"../Empty\";\nimport { ProgressIndicator } from \"../ProgressIndicator\";\nimport type { AutoCompleteOption, AutoCompleteProps } from \"./types\";\n\ndefineOptions({ name: \"AutoComplete\", inheritAttrs: false });\n\nconst props = withDefaults(defineProps<AutoCompleteProps>(), {\n name: undefined,\n label: undefined,\n mode: \"basic\",\n modelValue: undefined,\n options: () => [],\n defaultValue: undefined,\n groupBy: undefined,\n loading: false,\n inputProps: undefined,\n emptyProps: undefined,\n dropdownClassName: undefined,\n placement: \"bottom\",\n offset: () => ({ x: 0, y: 4 }),\n animation: true,\n filterOption: undefined,\n sortOption: undefined,\n autoHighlight: false,\n fillOnSelect: true,\n groupMode: \"first\",\n});\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n /** The input text changed (typing or selecting an option) */\n change: [value: string];\n /** An option was picked (mouse or keyboard) */\n select: [option: AutoCompleteOption];\n /** An option was clicked with the mouse */\n optionClick: [option: AutoCompleteOption];\n /** The dropdown opened or closed */\n dropdownVisibleChange: [visible: boolean];\n /**\n * Enter was pressed while no option is active, with the trimmed text\n * (e.g. to run a search); the dropdown closes\n */\n submit: [value: string];\n}>();\n\nconst slots = defineSlots<{\n /** Custom option content (`mode=\"custom\"`, React `renderOption`) */\n option?: (props: { option: AutoCompleteOption }) => unknown;\n /** Custom content shown when no option matches (React `renderEmpty`) */\n empty?: () => unknown;\n}>();\n\nconst PLACEMENT = {\n top: \"top-start\",\n bottom: \"bottom-start\",\n left: \"left-start\",\n right: \"right-start\",\n} as const;\n\nconst attrs = useAttrs();\nconst instance = getCurrentInstance();\n/** Whether a `submit` listener is bound (React: `onSubmit` is set) */\nconst hasSubmitListener = () => !!instance?.vnode.props?.onSubmit;\nconst inputValue = useControllable<string>(props, \"modelValue\", {\n defaultProp: \"defaultValue\",\n fallback: \"\",\n onChange: (next) => emit(\"change\", next),\n name: \"AutoComplete\",\n});\n\nconst visible = ref(false);\nconst setVisible = (next: boolean) => {\n if (visible.value === next) return;\n visible.value = next;\n emit(\"dropdownVisibleChange\", next);\n};\nconst focusedIndex = ref(-1);\nconst hoveredIndex = ref(-1);\nconst container = shallowRef<HTMLDivElement | null>(null);\nconst input = shallowRef<HTMLInputElement | null>(null);\nconst panel = ref<{ element: HTMLElement | null } | null>(null);\nconst vertical = computed(\n () => props.placement === \"top\" || props.placement === \"bottom\",\n);\n\nconst baseId = useId();\nconst listboxId = `${baseId}-listbox`;\n// IME composition in progress: Enter / arrows belong to the IME.\nlet composing = false;\nconst setComposing = (value: boolean) => {\n composing = value;\n};\n\nconst inputReadOnly = () =>\n (props.inputProps?.readOnly ?? props.inputProps?.readonly) as\n boolean | undefined;\n\n// FormControl wiring (id, disabled / read-only state). The input's own\n// disabled / readOnly props still apply.\nconst field = useFormControlProps(() => ({\n id: props.inputProps?.id as string | undefined,\n disabled: props.inputProps?.disabled as boolean | undefined,\n readOnly: inputReadOnly(),\n}));\nconst inputId = computed(() => field.value.id ?? `${baseId}-input`);\nconst blocked = computed(() => field.value.disabled || field.value.readOnly);\n// A disabled / read-only field never shows (or keeps) the dropdown.\nconst shown = computed(() => visible.value && !blocked.value);\n\nfunction open() {\n if (!blocked.value) setVisible(true);\n}\nfunction close() {\n setVisible(false);\n focusedIndex.value = -1;\n}\n\nconst processedOptions = computed(() => {\n const value = inputValue.value;\n const search = value.toLowerCase();\n const result = props.options.filter((option) =>\n props.filterOption\n ? props.filterOption(value, option)\n : option.label.toLowerCase().includes(search),\n );\n return props.sortOption ? [...result].sort(props.sortOption) : result;\n});\n\n/** Groups in order of first appearance, or runs of adjacent options */\nconst groupedOptions = computed<[string, AutoCompleteOption[]][] | null>(() => {\n const groupBy = props.groupBy;\n if (!groupBy) return null;\n if (props.groupMode === \"adjacent\") {\n const runs: [string, AutoCompleteOption[]][] = [];\n processedOptions.value.forEach((option) => {\n const group = groupBy(option);\n const last = runs[runs.length - 1];\n if (last && last[0] === group) last[1].push(option);\n else runs.push([group, [option]]);\n });\n return runs;\n }\n const groups = new Map<string, AutoCompleteOption[]>();\n processedOptions.value.forEach((option) => {\n const group = groupBy(option);\n const list = groups.get(group);\n if (list) list.push(option);\n else groups.set(group, [option]);\n });\n return Array.from(groups.entries());\n});\n\n/** Options in display order; keyboard / hover indexes refer to this list */\nconst navigableOptions = computed(() =>\n groupedOptions.value\n ? groupedOptions.value.flatMap(([, list]) => list)\n : processedOptions.value,\n);\n\n// With autoHighlight the first enabled option is active until the user\n// moves the highlight.\nconst activeIndex = computed(() =>\n focusedIndex.value >= 0\n ? focusedIndex.value\n : props.autoHighlight && shown.value\n ? navigableOptions.value.findIndex((option) => !option.disabled)\n : -1,\n);\n\nfunction moveFocus(step: 1 | -1) {\n const list = navigableOptions.value;\n const count = list.length;\n if (count === 0) return;\n // from \"nothing focused\", ArrowDown starts at the first option and\n // ArrowUp at the last one\n let index =\n activeIndex.value >= 0 ? activeIndex.value : step === 1 ? -1 : count;\n for (let i = 0; i < count; i += 1) {\n index = (index + step + count) % count;\n if (!list[index].disabled) {\n focusedIndex.value = index;\n return;\n }\n }\n}\n\nfunction handleOptionSelect(option: AutoCompleteOption) {\n if (option.disabled) return;\n if (props.fillOnSelect) inputValue.value = option.label;\n close();\n emit(\"select\", option);\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (\n blocked.value ||\n composing ||\n event.isComposing ||\n event.keyCode === 229\n ) {\n return;\n }\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!visible.value) open();\n moveFocus(1);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n if (!visible.value) open();\n moveFocus(-1);\n break;\n case \"Enter\": {\n const option = shown.value\n ? navigableOptions.value[activeIndex.value]\n : undefined;\n const text = inputValue.value.trim();\n if (option) {\n event.preventDefault();\n handleOptionSelect(option);\n } else if (hasSubmitListener() && text) {\n // No active option: submit the typed text (e.g. a search).\n event.preventDefault();\n emit(\"submit\", text);\n close();\n }\n break;\n }\n case \"Escape\":\n // Open: the dropdown's dismissable layer closes it (topmost only).\n // Closed: clears the text (APG combobox), `change(\"\")`.\n if (event !== closingEscape && !shown.value && inputValue.value !== \"\") {\n event.preventDefault();\n inputValue.value = \"\";\n focusedIndex.value = -1;\n }\n break;\n default:\n break;\n }\n}\n\nfunction handleInputChange(next: string) {\n inputValue.value = next;\n focusedIndex.value = -1;\n open();\n}\n\nfunction handleBlur(event: FocusEvent) {\n const next = event.relatedTarget as Node | null;\n const dropdown = panel.value?.element;\n if (next && (dropdown?.contains(next) || container.value?.contains(next))) {\n return;\n }\n close();\n}\n\nfunction handleOptionClick(option: AutoCompleteOption) {\n if (option.disabled || composing) return;\n handleOptionSelect(option);\n emit(\"optionClick\", option);\n input.value?.focus();\n}\n\nfunction onOptionKeyDown(event: KeyboardEvent, option: AutoCompleteOption) {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n handleOptionClick(option);\n}\n\n// Clicking the still-focused input (after a pick or Escape) reopens the\n// dropdown; focus alone does not fire again.\nfunction onInputClick() {\n if (!visible.value) open();\n}\n\nonMounted(() => {\n input.value = container.value?.querySelector(\"input\") ?? null;\n});\n\nconst optionId = (index: number) => `${listboxId}-option-${index}`;\nconst activeOptionId = computed(() =>\n shown.value && activeIndex.value >= 0\n ? optionId(activeIndex.value)\n : undefined,\n);\n\n// Keep the keyboard-focused option scrolled into view\nwatch(\n activeOptionId,\n (id) => {\n if (!id) return;\n const el = container.value?.ownerDocument.getElementById(id);\n el?.scrollIntoView?.({ block: \"nearest\" });\n },\n { flush: \"post\" },\n);\n\n/** Combobox semantics on the inner <input> (after `inputProps`: they win) */\nconst inputBindings = computed(() => ({\n ...props.inputProps,\n id: inputId.value,\n disabled: field.value.disabled,\n readOnly: field.value.readOnly,\n name: props.name,\n modelValue: inputValue.value,\n \"onUpdate:modelValue\": handleInputChange,\n role: \"combobox\",\n \"aria-autocomplete\": \"list\",\n \"aria-expanded\": String(shown.value),\n \"aria-controls\": shown.value ? listboxId : undefined,\n \"aria-activedescendant\": activeOptionId.value,\n // Closed with text: Escape clears it instead of closing an enclosing\n // Modal / Drawer / Popover\n [ESCAPE_CONSUMER_ATTRIBUTE]:\n !shown.value && inputValue.value !== \"\" ? \"\" : undefined,\n}));\n\nconst panelOffset = computed(() => ({\n mainAxis: vertical.value ? props.offset.y : props.offset.x,\n crossAxis: vertical.value ? props.offset.x : props.offset.y,\n}));\n\n/**\n * The Escape that closed the dropdown (the layer handles it before the\n * input's own listener, and Vue state updates synchronously): it must not\n * also clear the text.\n */\nlet closingEscape: KeyboardEvent | null = null;\nfunction onEscapeKeyDown(event: KeyboardEvent) {\n closingEscape = event;\n // Escape during IME composition cancels the composition only\n if (composing || event.isComposing) event.preventDefault();\n}\n\nconst rootAttrs = computed(() => ({\n ...attrs,\n ...hooks(\"autocomplete\", \"root\", {\n state: shown.value ? \"open\" : \"closed\",\n disabled: field.value.disabled,\n readonly: field.value.readOnly,\n loading: props.loading,\n }),\n}));\n\n/** Sections of the list: groups (with a heading unless \"\") or every option */\nconst sections = computed(() => {\n const groups = groupedOptions.value;\n if (!groups) {\n return [\n {\n key: \"all\",\n group: \"\",\n items: processedOptions.value.map((option, index) => ({\n option,\n index,\n })),\n },\n ];\n }\n const order = navigableOptions.value;\n return groups.map(([group, list], groupIndex) => ({\n key: `${groupIndex}-${group}`,\n group,\n items: list.map((option) => ({ option, index: order.indexOf(option) })),\n }));\n});\n\n/** An option of the listbox (`index` in display order) */\nconst OptionRow: FunctionalComponent<{\n option: AutoCompleteOption;\n index: number;\n}> = ({ option, index }) => {\n const active = activeIndex.value === index;\n const highlighted = hoveredIndex.value === index || active;\n const icon = option.icon;\n const content =\n props.mode === \"custom\" && slots.option\n ? slots.option({ option })\n : h(\"div\", { class: styles.basicOption }, [\n icon\n ? h(\n \"span\",\n { class: styles.icon },\n (typeof icon === \"function\"\n ? (icon as () => VNodeChild)()\n : icon) as never,\n )\n : null,\n h(\"div\", { class: styles.content }, [\n h(\"div\", { class: styles.label }, option.label),\n option.description\n ? h(\"div\", { class: styles.description }, option.description)\n : null,\n ]),\n ]);\n return h(\n \"div\",\n {\n class: [\n styles.optionItem,\n option.disabled && styles.disabled,\n option.highlight && styles.highlight,\n highlighted && styles.active,\n ],\n style: option.style,\n role: \"option\",\n // Focus stays in the input (aria-activedescendant); -1 keeps the\n // option out of the tab order while making it programmatically\n // focusable.\n tabindex: -1,\n id: optionId(index),\n \"aria-selected\": active,\n \"aria-disabled\": option.disabled || undefined,\n // keep focus (and the open dropdown) in the input while clicking\n onMousedown: (event: MouseEvent) => event.preventDefault(),\n onClick: () => handleOptionClick(option),\n onKeydown: (event: KeyboardEvent) => onOptionKeyDown(event, option),\n onMouseenter: () => (hoveredIndex.value = index),\n onMouseleave: () => (hoveredIndex.value = -1),\n ...hooks(\"autocomplete\", \"item\", {\n highlighted,\n disabled: option.disabled,\n }),\n },\n content as never,\n );\n};\nOptionRow.props = [\"option\", \"index\"];\n</script>\n\n<template>\n <div\n ref=\"container\"\n :class=\"styles.autoComplete\"\n v-bind=\"rootAttrs\"\n @compositionstart=\"setComposing(true)\"\n @compositionend=\"setComposing(false)\"\n >\n <label\n v-if=\"label\"\n :for=\"inputId\"\n :class=\"styles.label\"\n v-bind=\"hooks('autocomplete', 'label')\"\n >\n {{ label }}\n </label>\n <Input\n v-bind=\"inputBindings\"\n @focus=\"open\"\n @blur=\"handleBlur\"\n @keydown=\"handleKeyDown\"\n @click=\"onInputClick\"\n />\n\n <FloatingPanel\n ref=\"panel\"\n :open=\"shown\"\n :anchor=\"container\"\n :placement=\"PLACEMENT[placement]\"\n :offset=\"panelOffset\"\n match-anchor-width=\"min\"\n :branches=\"() => [container]\"\n :return-focus-on-escape=\"() => input\"\n :class=\"[styles.popup, dropdownClassName]\"\n v-bind=\"hooks('autocomplete', 'content', { state: 'open' })\"\n @escape-key-down=\"onEscapeKeyDown\"\n @dismiss=\"close\"\n >\n <div :class=\"[styles.dropdown, animation && styles.animated]\">\n <!-- While open the listbox always exists (aria-controls target);\n loading / empty states are presentational rows inside it. -->\n <div\n :id=\"listboxId\"\n :class=\"styles.optionList\"\n role=\"listbox\"\n :aria-label=\"label\"\n :aria-busy=\"loading || undefined\"\n v-bind=\"hooks('autocomplete', 'list')\"\n >\n <div\n v-if=\"loading\"\n role=\"presentation\"\n :class=\"styles.loading\"\n v-bind=\"hooks('autocomplete', 'loading')\"\n >\n <ProgressIndicator />\n </div>\n <template v-else-if=\"processedOptions.length > 0\">\n <template v-for=\"section in sections\" :key=\"section.key\">\n <!-- ungrouped options: no heading -->\n <template v-if=\"section.group === ''\">\n <OptionRow\n v-for=\"item in section.items\"\n :key=\"item.option.value\"\n :option=\"item.option\"\n :index=\"item.index\"\n />\n </template>\n <div\n v-else\n :class=\"styles.optionGroup\"\n role=\"group\"\n :aria-label=\"section.group\"\n >\n <div\n :class=\"styles.groupLabel\"\n aria-hidden=\"true\"\n v-bind=\"hooks('autocomplete', 'group-label')\"\n >\n {{ section.group }}\n </div>\n <OptionRow\n v-for=\"item in section.items\"\n :key=\"item.option.value\"\n :option=\"item.option\"\n :index=\"item.index\"\n />\n </div>\n </template>\n </template>\n <div\n v-else\n role=\"presentation\"\n :class=\"styles.empty\"\n v-bind=\"hooks('autocomplete', 'empty')\"\n >\n <slot name=\"empty\"><Empty v-bind=\"emptyProps\" /></slot>\n </div>\n </div>\n </div>\n </FloatingPanel>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,IAAM+B,IAAQC,GAsBRC,IAAOH,GAiBPI,IAAQlC,GAAA,GAORoC,KAAY;GAChB,KAAK;GACL,QAAQ;GACR,MAAM;GACN,OAAO;EACT,GAEMC,KAAQC,GAAS,GACjBC,KAAWC,GAAmB,GAE9BC,WAA0B,CAAC,CAACF,IAAU,MAAM,OAAO,UACnDG,IAAaC,EAAwBZ,GAAO,cAAc;GAC9D,aAAa;GACb,UAAU;GACV,WAAW,MAASE,EAAK,UAAUW,CAAI;GACvC,MAAM;EACR,CAAC,G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AA,GAAAe,EAKE8F,GAAA;KAHC,KAAKqB,EAAK,OAAO;KACjB,QAAQA,EAAK;KACb,OAAOA,EAAK;qCAGjBlI,GAAAA,GAAAA,MAAAA,EAAA,GAAAC,EAmBM,OAAA;;KAjBH,OAAKU,EAAER,EAAAqB,CAAA,CAAM,CAAC,WAAW;KAC1B,MAAK;KACJ,cAAYwG,EAAQ;IAErBtH,GAAAA,CAAAA,EAMM,OANNR,EAMM;KALH,OAAOC,EAAAqB,CAAA,CAAM,CAAC;KACf,eAAY;IACJ,GAAA,EAAA,SAAA,GAAA,GAAArB,EAAAsG,CAAA,CAAK,CAAA,gBAAA,aAAA,CAAA,GAAArG,EAEV4H,EAAQ,KAAK,GAAA,EAAA,IAElBhI,EAAA,EAAA,GAAAC,EAKEY,GAAA,MAAAC,EAJekH,EAAQ,QAAhB,OADThI,EAAA,GAAAe,EAKE8F,GAAA;KAHC,KAAKqB,EAAK,OAAO;KACjB,QAAQA,EAAK;KACb,OAAOA,EAAK;+DAKrBlI,GAAAA,GAAAA,MAAAA,EAAA,GAAAC,EAOM,OAPNC,EAOM;;KALJ,MAAK;KACJ,OAAOC,EAAAqB,CAAA,CAAM,CAAC;IACP,GAAArB,EAAAsG,CAAA,CAAK,CAAA,gBAAA,OAAA,CAAA,GAAA,CAEbzF,GAAuDoH,EAAA,QAAA,SAAA,CAAA,SAAA,CAApC9H,EAA6BH,EAAAc,CAAA,GAAAC,GAAAC,GAAdY,EAAA,UAAU,CAAA,GAAA,MAAA,EAAA,CAAA,CAAA,CAAA,GAAA,EAAA,EAAA,GAAA,IAAAL,EAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"AutoComplete.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_createCommentVNode","_createVNode","Input","FloatingPanel","_withCtx","_createElementVNode","_normalizeClass","ProgressIndicator","_Fragment","_renderList","_createBlock","_renderSlot","Empty","_normalizeProps","_guardReactiveProps","Input_default","FloatingPanel_default","Empty_default","ProgressIndicator_default","styles","_hoisted_1","_hoisted_2","_hoisted_3","AutoComplete_vue_vue_type_script_setup_true_lang_default","__emit","props","__props","emit","slots","useSlots","PLACEMENT","attrs","useAttrs","instance","getCurrentInstance","hasSubmitListener","inputValue","useControllable","next","visible","ref","setVisible","focusedValue","hoveredIndex","container","shallowRef","input","panel","vertical","computed","baseId","useId","listboxId","composing","setComposing","value","inputReadOnly","field","useFormControlProps","inputId","blocked","shown","open","close","processedOptions","search","result","option","groupedOptions","groupBy","runs","group","last","groups","list","navigableOptions","interactiveOptions","activeIndex","resolveActiveOptionIndex","moveFocus","count","index","step","handleOptionSelect","handleKeyDown","event","text","closingEscape","handleInputChange","handleBlur","dropdown","handleOptionClick","onOptionKeyDown","onInputClick","optionId","activeOptionId","id","inputBindings","ESCAPE_CONSUMER_ATTRIBUTE","panelOffset","onEscapeKeyDown","rootAttrs","hooks","sections","order","groupIndex","OptionRow","active","highlighted","icon","content","h","openBlock","createElementBlock","mergeProps","unref","_cache","toDisplayString","createCommentVNode","createVNode","withCtx","createElementVNode","normalizeClass","Fragment","renderList","section","createBlock","item","renderSlot","_ctx","normalizeProps","guardReactiveProps"],"sources":["../../../../../vue/src/components/AutoComplete/AutoComplete.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * AutoComplete: a text input (combobox) that suggests options from a list.\n * Supports grouping, custom rendering (`option` slot) and async loading; the\n * input text is `v-model` (or `defaultValue`). Focus stays in the input\n * (`aria-activedescendant`). For picking several values use `TagInput`.\n */\nimport {\n computed,\n getCurrentInstance,\n h,\n onMounted,\n ref,\n shallowRef,\n useAttrs,\n useId,\n watch,\n type FunctionalComponent,\n type VNodeChild,\n} from \"vue\";\nimport { ESCAPE_CONSUMER_ATTRIBUTE } from \"@minerva/dom\";\nimport { resolveActiveOptionIndex } from \"@minerva/core\";\nimport styles from \"@react-styles/components/AutoComplete/autoComplete.module.scss\";\nimport FloatingPanel from \"../../internal/FloatingPanel.vue\";\nimport { hooks } from \"../../internal/hooks\";\nimport { useControllable } from \"../../internal/controllable\";\nimport { useFormControlProps } from \"../../internal/form-control\";\nimport { Input } from \"../Input\";\nimport { Empty } from \"../Empty\";\nimport { ProgressIndicator } from \"../ProgressIndicator\";\nimport type { AutoCompleteOption, AutoCompleteProps } from \"./types\";\n\ndefineOptions({ name: \"AutoComplete\", inheritAttrs: false });\n\nconst props = withDefaults(defineProps<AutoCompleteProps>(), {\n name: undefined,\n label: undefined,\n mode: \"basic\",\n modelValue: undefined,\n options: () => [],\n defaultValue: undefined,\n groupBy: undefined,\n loading: false,\n inputProps: undefined,\n emptyProps: undefined,\n dropdownClassName: undefined,\n placement: \"bottom\",\n offset: () => ({ x: 0, y: 4 }),\n animation: true,\n filterOption: undefined,\n sortOption: undefined,\n autoHighlight: false,\n fillOnSelect: true,\n groupMode: \"first\",\n});\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n /** The input text changed (typing or selecting an option) */\n change: [value: string];\n /** An option was picked (mouse or keyboard) */\n select: [option: AutoCompleteOption];\n /** An option was clicked with the mouse */\n optionClick: [option: AutoCompleteOption];\n /** The dropdown opened or closed */\n dropdownVisibleChange: [visible: boolean];\n /**\n * Enter was pressed while no option is active, with the trimmed text\n * (e.g. to run a search); the dropdown closes\n */\n submit: [value: string];\n}>();\n\nconst slots = defineSlots<{\n /** Custom option content (`mode=\"custom\"`, React `renderOption`) */\n option?: (props: { option: AutoCompleteOption }) => unknown;\n /** Custom content shown when no option matches (React `renderEmpty`) */\n empty?: () => unknown;\n}>();\n\nconst PLACEMENT = {\n top: \"top-start\",\n bottom: \"bottom-start\",\n left: \"left-start\",\n right: \"right-start\",\n} as const;\n\nconst attrs = useAttrs();\nconst instance = getCurrentInstance();\n/** Whether a `submit` listener is bound (React: `onSubmit` is set) */\nconst hasSubmitListener = () => !!instance?.vnode.props?.onSubmit;\nconst inputValue = useControllable<string>(props, \"modelValue\", {\n defaultProp: \"defaultValue\",\n fallback: \"\",\n onChange: (next) => emit(\"change\", next),\n name: \"AutoComplete\",\n});\n\nconst visible = ref(false);\nconst setVisible = (next: boolean) => {\n if (visible.value === next) return;\n visible.value = next;\n emit(\"dropdownVisibleChange\", next);\n};\n// Keyboard highlight, by option identity (survives async option updates)\nconst focusedValue = ref<string | number | null>(null);\nconst hoveredIndex = ref(-1);\nconst container = shallowRef<HTMLDivElement | null>(null);\nconst input = shallowRef<HTMLInputElement | null>(null);\nconst panel = ref<{ element: HTMLElement | null } | null>(null);\nconst vertical = computed(\n () => props.placement === \"top\" || props.placement === \"bottom\",\n);\n\nconst baseId = useId();\nconst listboxId = `${baseId}-listbox`;\n// IME composition in progress: Enter / arrows belong to the IME.\nlet composing = false;\nconst setComposing = (value: boolean) => {\n composing = value;\n};\n\nconst inputReadOnly = () =>\n (props.inputProps?.readOnly ?? props.inputProps?.readonly) as\n boolean | undefined;\n\n// FormControl wiring (id, disabled / read-only state). The input's own\n// disabled / readOnly props still apply.\nconst field = useFormControlProps(() => ({\n id: props.inputProps?.id as string | undefined,\n disabled: props.inputProps?.disabled as boolean | undefined,\n readOnly: inputReadOnly(),\n}));\nconst inputId = computed(() => field.value.id ?? `${baseId}-input`);\nconst blocked = computed(() => field.value.disabled || field.value.readOnly);\n// A disabled / read-only field never shows (or keeps) the dropdown.\nconst shown = computed(() => visible.value && !blocked.value);\n\nfunction open() {\n if (!blocked.value) setVisible(true);\n}\nfunction close() {\n setVisible(false);\n focusedValue.value = null;\n}\n\nconst processedOptions = computed(() => {\n const value = inputValue.value;\n const search = value.toLowerCase();\n const result = props.options.filter((option) =>\n props.filterOption\n ? props.filterOption(value, option)\n : option.label.toLowerCase().includes(search),\n );\n return props.sortOption ? [...result].sort(props.sortOption) : result;\n});\n\n/** Groups in order of first appearance, or runs of adjacent options */\nconst groupedOptions = computed<[string, AutoCompleteOption[]][] | null>(() => {\n const groupBy = props.groupBy;\n if (!groupBy) return null;\n if (props.groupMode === \"adjacent\") {\n const runs: [string, AutoCompleteOption[]][] = [];\n processedOptions.value.forEach((option) => {\n const group = groupBy(option);\n const last = runs[runs.length - 1];\n if (last && last[0] === group) last[1].push(option);\n else runs.push([group, [option]]);\n });\n return runs;\n }\n const groups = new Map<string, AutoCompleteOption[]>();\n processedOptions.value.forEach((option) => {\n const group = groupBy(option);\n const list = groups.get(group);\n if (list) list.push(option);\n else groups.set(group, [option]);\n });\n return Array.from(groups.entries());\n});\n\n/** Options in display order; keyboard / hover indexes refer to this list */\nconst navigableOptions = computed(() =>\n groupedOptions.value\n ? groupedOptions.value.flatMap(([, list]) => list)\n : processedOptions.value,\n);\n\n// Options the keyboard can reach: none while loading (they are hidden).\nconst interactiveOptions = computed(() =>\n props.loading ? [] : navigableOptions.value,\n);\n\n// With autoHighlight the first enabled option is active until the user\n// moves the highlight; a highlight whose option is gone falls back.\nconst activeIndex = computed(() =>\n resolveActiveOptionIndex(\n interactiveOptions.value,\n focusedValue.value,\n props.autoHighlight && shown.value,\n ),\n);\n\nfunction moveFocus(step: 1 | -1) {\n const list = interactiveOptions.value;\n const count = list.length;\n if (count === 0) return;\n // from \"nothing focused\", ArrowDown starts at the first option and\n // ArrowUp at the last one\n let index =\n activeIndex.value >= 0 ? activeIndex.value : step === 1 ? -1 : count;\n for (let i = 0; i < count; i += 1) {\n index = (index + step + count) % count;\n if (!list[index].disabled) {\n focusedValue.value = list[index].value;\n return;\n }\n }\n}\n\nfunction handleOptionSelect(option: AutoCompleteOption) {\n if (option.disabled) return;\n if (props.fillOnSelect) inputValue.value = option.label;\n close();\n emit(\"select\", option);\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (\n blocked.value ||\n composing ||\n event.isComposing ||\n event.keyCode === 229\n ) {\n return;\n }\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!visible.value) open();\n moveFocus(1);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n if (!visible.value) open();\n moveFocus(-1);\n break;\n case \"Enter\": {\n const option = shown.value\n ? interactiveOptions.value[activeIndex.value]\n : undefined;\n const text = inputValue.value.trim();\n if (option) {\n event.preventDefault();\n handleOptionSelect(option);\n } else if (hasSubmitListener() && text) {\n // No active option: submit the typed text (e.g. a search).\n event.preventDefault();\n emit(\"submit\", text);\n close();\n }\n break;\n }\n case \"Escape\":\n // Open: the dropdown's dismissable layer closes it (topmost only).\n // Closed: clears the text (APG combobox), `change(\"\")`.\n if (event !== closingEscape && !shown.value && inputValue.value !== \"\") {\n event.preventDefault();\n inputValue.value = \"\";\n focusedValue.value = null;\n }\n break;\n default:\n break;\n }\n}\n\nfunction handleInputChange(next: string) {\n inputValue.value = next;\n focusedValue.value = null;\n open();\n}\n\nfunction handleBlur(event: FocusEvent) {\n const next = event.relatedTarget as Node | null;\n const dropdown = panel.value?.element;\n if (next && (dropdown?.contains(next) || container.value?.contains(next))) {\n return;\n }\n close();\n}\n\nfunction handleOptionClick(option: AutoCompleteOption) {\n if (option.disabled || composing) return;\n handleOptionSelect(option);\n emit(\"optionClick\", option);\n input.value?.focus();\n}\n\nfunction onOptionKeyDown(event: KeyboardEvent, option: AutoCompleteOption) {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n handleOptionClick(option);\n}\n\n// Clicking the still-focused input (after a pick or Escape) reopens the\n// dropdown; focus alone does not fire again.\nfunction onInputClick() {\n if (!visible.value) open();\n}\n\nonMounted(() => {\n input.value = container.value?.querySelector(\"input\") ?? null;\n});\n\nconst optionId = (index: number) => `${listboxId}-option-${index}`;\nconst activeOptionId = computed(() =>\n shown.value && activeIndex.value >= 0\n ? optionId(activeIndex.value)\n : undefined,\n);\n\n// Keep the keyboard-focused option scrolled into view\nwatch(\n activeOptionId,\n (id) => {\n if (!id) return;\n const el = container.value?.ownerDocument.getElementById(id);\n el?.scrollIntoView?.({ block: \"nearest\" });\n },\n { flush: \"post\" },\n);\n\n/** Combobox semantics on the inner <input> (after `inputProps`: they win) */\nconst inputBindings = computed(() => ({\n ...props.inputProps,\n id: inputId.value,\n disabled: field.value.disabled,\n readOnly: field.value.readOnly,\n name: props.name,\n modelValue: inputValue.value,\n \"onUpdate:modelValue\": handleInputChange,\n role: \"combobox\",\n \"aria-autocomplete\": \"list\",\n \"aria-expanded\": String(shown.value),\n \"aria-controls\": shown.value ? listboxId : undefined,\n \"aria-activedescendant\": activeOptionId.value,\n // Closed with text: Escape clears it instead of closing an enclosing\n // Modal / Drawer / Popover\n [ESCAPE_CONSUMER_ATTRIBUTE]:\n !shown.value && inputValue.value !== \"\" ? \"\" : undefined,\n}));\n\nconst panelOffset = computed(() => ({\n mainAxis: vertical.value ? props.offset.y : props.offset.x,\n crossAxis: vertical.value ? props.offset.x : props.offset.y,\n}));\n\n/**\n * The Escape that closed the dropdown (the layer handles it before the\n * input's own listener, and Vue state updates synchronously): it must not\n * also clear the text.\n */\nlet closingEscape: KeyboardEvent | null = null;\nfunction onEscapeKeyDown(event: KeyboardEvent) {\n closingEscape = event;\n // Escape during IME composition cancels the composition only\n if (composing || event.isComposing) event.preventDefault();\n}\n\nconst rootAttrs = computed(() => ({\n ...attrs,\n ...hooks(\"autocomplete\", \"root\", {\n state: shown.value ? \"open\" : \"closed\",\n disabled: field.value.disabled,\n readonly: field.value.readOnly,\n loading: props.loading,\n }),\n}));\n\n/** Sections of the list: groups (with a heading unless \"\") or every option */\nconst sections = computed(() => {\n const groups = groupedOptions.value;\n if (!groups) {\n return [\n {\n key: \"all\",\n group: \"\",\n items: processedOptions.value.map((option, index) => ({\n option,\n index,\n })),\n },\n ];\n }\n const order = navigableOptions.value;\n return groups.map(([group, list], groupIndex) => ({\n key: `${groupIndex}-${group}`,\n group,\n items: list.map((option) => ({ option, index: order.indexOf(option) })),\n }));\n});\n\n/** An option of the listbox (`index` in display order) */\nconst OptionRow: FunctionalComponent<{\n option: AutoCompleteOption;\n index: number;\n}> = ({ option, index }) => {\n const active = activeIndex.value === index;\n const highlighted = hoveredIndex.value === index || active;\n const icon = option.icon;\n const content =\n props.mode === \"custom\" && slots.option\n ? slots.option({ option })\n : h(\"div\", { class: styles.basicOption }, [\n icon\n ? h(\n \"span\",\n { class: styles.icon },\n (typeof icon === \"function\"\n ? (icon as () => VNodeChild)()\n : icon) as never,\n )\n : null,\n h(\"div\", { class: styles.content }, [\n h(\"div\", { class: styles.label }, option.label),\n option.description\n ? h(\"div\", { class: styles.description }, option.description)\n : null,\n ]),\n ]);\n return h(\n \"div\",\n {\n class: [\n styles.optionItem,\n option.disabled && styles.disabled,\n option.highlight && styles.highlight,\n highlighted && styles.active,\n ],\n style: option.style,\n role: \"option\",\n // Focus stays in the input (aria-activedescendant); -1 keeps the\n // option out of the tab order while making it programmatically\n // focusable.\n tabindex: -1,\n id: optionId(index),\n \"aria-selected\": active,\n \"aria-disabled\": option.disabled || undefined,\n // keep focus (and the open dropdown) in the input while clicking\n onMousedown: (event: MouseEvent) => event.preventDefault(),\n onClick: () => handleOptionClick(option),\n onKeydown: (event: KeyboardEvent) => onOptionKeyDown(event, option),\n onMouseenter: () => (hoveredIndex.value = index),\n onMouseleave: () => (hoveredIndex.value = -1),\n ...hooks(\"autocomplete\", \"item\", {\n highlighted,\n disabled: option.disabled,\n }),\n },\n content as never,\n );\n};\nOptionRow.props = [\"option\", \"index\"];\n</script>\n\n<template>\n <div\n ref=\"container\"\n :class=\"styles.autoComplete\"\n v-bind=\"rootAttrs\"\n @compositionstart=\"setComposing(true)\"\n @compositionend=\"setComposing(false)\"\n >\n <label\n v-if=\"label\"\n :for=\"inputId\"\n :class=\"styles.label\"\n v-bind=\"hooks('autocomplete', 'label')\"\n >\n {{ label }}\n </label>\n <Input\n v-bind=\"inputBindings\"\n @focus=\"open\"\n @blur=\"handleBlur\"\n @keydown=\"handleKeyDown\"\n @click=\"onInputClick\"\n />\n\n <FloatingPanel\n ref=\"panel\"\n :open=\"shown\"\n :anchor=\"container\"\n :placement=\"PLACEMENT[placement]\"\n :offset=\"panelOffset\"\n match-anchor-width=\"min\"\n :branches=\"() => [container]\"\n :return-focus-on-escape=\"() => input\"\n :class=\"[styles.popup, dropdownClassName]\"\n v-bind=\"hooks('autocomplete', 'content', { state: 'open' })\"\n @escape-key-down=\"onEscapeKeyDown\"\n @dismiss=\"close\"\n >\n <div :class=\"[styles.dropdown, animation && styles.animated]\">\n <!-- While open the listbox always exists (aria-controls target);\n loading / empty states are presentational rows inside it. -->\n <div\n :id=\"listboxId\"\n :class=\"styles.optionList\"\n role=\"listbox\"\n :aria-label=\"label\"\n :aria-busy=\"loading || undefined\"\n v-bind=\"hooks('autocomplete', 'list')\"\n >\n <div\n v-if=\"loading\"\n role=\"presentation\"\n :class=\"styles.loading\"\n v-bind=\"hooks('autocomplete', 'loading')\"\n >\n <ProgressIndicator />\n </div>\n <template v-else-if=\"processedOptions.length > 0\">\n <template v-for=\"section in sections\" :key=\"section.key\">\n <!-- ungrouped options: no heading -->\n <template v-if=\"section.group === ''\">\n <OptionRow\n v-for=\"item in section.items\"\n :key=\"item.option.value\"\n :option=\"item.option\"\n :index=\"item.index\"\n />\n </template>\n <div\n v-else\n :class=\"styles.optionGroup\"\n role=\"group\"\n :aria-label=\"section.group\"\n >\n <div\n :class=\"styles.groupLabel\"\n aria-hidden=\"true\"\n v-bind=\"hooks('autocomplete', 'group-label')\"\n >\n {{ section.group }}\n </div>\n <OptionRow\n v-for=\"item in section.items\"\n :key=\"item.option.value\"\n :option=\"item.option\"\n :index=\"item.index\"\n />\n </div>\n </template>\n </template>\n <div\n v-else\n role=\"presentation\"\n :class=\"styles.empty\"\n v-bind=\"hooks('autocomplete', 'empty')\"\n >\n <slot name=\"empty\"><Empty v-bind=\"emptyProps\" /></slot>\n </div>\n </div>\n </div>\n </FloatingPanel>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCA,IAAM+B,IAAQC,GAsBRC,IAAOH,GAiBPI,IAAQlC,GAAA,GAORoC,KAAY;GAChB,K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AAA,EAAA,CAAA,CAAA,CAAA,GAAA,EAAA,EAAA,GAAA,IAAAL,EAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
@@ -4496,13 +4496,29 @@ function parseDayKey(text, strict = true) {
4496
4496
  return date;
4497
4497
  }
4498
4498
  //#endregion
4499
+ //#region ../core/src/decimal-places.ts
4500
+ /**
4501
+ * Decimal places needed to write `n` exactly as a fixed-point number:
4502
+ * `1.25` -> 2, `1e-7` -> 7, `1.5e-7` -> 8 (coefficient decimals plus the
4503
+ * negative exponent), `1e21` -> 0. Capped at 100 (`toFixed` limit).
4504
+ */
4505
+ function decimalPlaces(n) {
4506
+ if (!Number.isFinite(n)) return 0;
4507
+ const m = /^\d+(?:\.(\d+))?(?:e([+-]\d+))?$/i.exec(String(Math.abs(n)));
4508
+ if (!m) return 0;
4509
+ const fraction = m[1]?.length ?? 0;
4510
+ const exponent = m[2] ? Number(m[2]) : 0;
4511
+ return Math.min(100, Math.max(0, fraction - exponent));
4512
+ }
4513
+ //#endregion
4499
4514
  //#region ../core/src/number-input.ts
4500
- /** Decimal places of `step` (`0.05` -> 2); `0` for whole or missing steps. */
4515
+ /**
4516
+ * Decimal places of `step` (`0.05` -> 2, `1.25` -> 2, `1e-7` -> 7);
4517
+ * `0` for whole or missing steps.
4518
+ */
4501
4519
  function inferStepPrecision(step) {
4502
- if (!step || step >= 1) return 0;
4503
- const s = String(step);
4504
- const dot = s.indexOf(".");
4505
- return dot === -1 ? 0 : s.length - dot - 1;
4520
+ if (!step) return 0;
4521
+ return decimalPlaces(step);
4506
4522
  }
4507
4523
  /** `n` limited to `[min, max]`; a missing bound does not limit. */
4508
4524
  function clampNumber(n, min, max) {
@@ -4944,14 +4960,10 @@ function writeCaptionsPreference(storage, track) {
4944
4960
  storage?.setItem(MEDIA_CAPTIONS_STORAGE_KEY, captionsPreference(track));
4945
4961
  } catch {}
4946
4962
  }
4947
- /** Decimal places of a step (`0.05` -> 2). */
4963
+ /** Decimal places of a step (`0.05` -> 2, `1.5e-7` -> 8). */
4948
4964
  function sliderPrecision(step) {
4949
- if (!step || !Number.isFinite(step)) return 0;
4950
- const s = String(step);
4951
- const exp = s.match(/e-(\d+)$/);
4952
- if (exp) return Number(exp[1]);
4953
- const dot = s.indexOf(".");
4954
- return dot === -1 ? 0 : s.length - dot - 1;
4965
+ if (!step) return 0;
4966
+ return decimalPlaces(step);
4955
4967
  }
4956
4968
  /** `v` limited to `[min, max]`. */
4957
4969
  function clampSliderValue(v, min, max) {