@astryx-vue/core 0.12.1 → 0.13.0

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 (136) hide show
  1. package/dist/AppShell/index.d.ts +1 -1
  2. package/dist/AvatarGroup/index.d.ts +1 -1
  3. package/dist/Banner/index.d.ts +1 -1
  4. package/dist/BottomSheet/index.d.ts +1 -1
  5. package/dist/Button/index.d.ts +1 -1
  6. package/dist/ButtonGroup/index.d.ts +1 -1
  7. package/dist/Calendar/index.d.ts +1 -1
  8. package/dist/Card/index.d.ts +1 -1
  9. package/dist/Carousel/index.d.ts +1 -1
  10. package/dist/Chat/index.d.ts +1 -1
  11. package/dist/CheckboxInput/index.d.ts +1 -1
  12. package/dist/CheckboxList/index.d.ts +1 -1
  13. package/dist/ClickableCard/index.d.ts +1 -1
  14. package/dist/Code/index.d.ts +1 -1
  15. package/dist/Collapsible/index.d.ts +1 -1
  16. package/dist/ComplexSelector/index.d.ts +1 -1
  17. package/dist/ComplexSelector/index.js +1 -1
  18. package/dist/{ComplexSelector-B_5mzJjR.js → ComplexSelector-Dmbep7M7.js} +165 -49
  19. package/dist/ContextMenu/index.d.ts +1 -1
  20. package/dist/DateInput/index.d.ts +1 -1
  21. package/dist/DateRangeInput/index.d.ts +1 -1
  22. package/dist/DateTimeInput/index.d.ts +1 -1
  23. package/dist/Dialog/index.d.ts +1 -1
  24. package/dist/Divider/index.d.ts +1 -1
  25. package/dist/Drawer/index.d.ts +1 -1
  26. package/dist/FileInput/index.d.ts +1 -1
  27. package/dist/HoverCard/index.d.ts +1 -1
  28. package/dist/InfoTip/index.d.ts +1 -1
  29. package/dist/InternationalizationProvider/index.d.ts +1 -1
  30. package/dist/InternationalizationProvider/index.js +1 -1
  31. package/dist/{InternationalizationProvider-CyDjQn5Z.js → InternationalizationProvider-BYU2MRtX.js} +1 -1
  32. package/dist/Link/index.d.ts +1 -1
  33. package/dist/List/index.d.ts +1 -1
  34. package/dist/MetadataList/index.d.ts +1 -1
  35. package/dist/MoreMenu/index.d.ts +1 -1
  36. package/dist/MultiSelector/index.d.ts +1 -1
  37. package/dist/MultiSelector/index.js +1 -1
  38. package/dist/{MultiSelector-BdedjB6u.js → MultiSelector-BXIpOmSU.js} +105 -50
  39. package/dist/NavItem/index.d.ts +1 -1
  40. package/dist/NumberInput/index.d.ts +1 -1
  41. package/dist/OverflowList/index.d.ts +1 -1
  42. package/dist/Overlay/index.d.ts +1 -1
  43. package/dist/Pagination/index.d.ts +1 -1
  44. package/dist/Pagination/index.js +1 -1
  45. package/dist/{Pagination-uttop2ls.js → Pagination-eeM9SNsG.js} +1 -1
  46. package/dist/Popover/index.d.ts +1 -1
  47. package/dist/PowerSearch/index.d.ts +1 -1
  48. package/dist/PowerSearch/index.js +1 -1
  49. package/dist/{PowerSearch-DDuYfvNh.js → PowerSearch-CaqFxaFb.js} +7 -7
  50. package/dist/ProgressBar/index.d.ts +1 -1
  51. package/dist/Radio/index.d.ts +1 -1
  52. package/dist/RadioList/index.d.ts +1 -1
  53. package/dist/ScrollableArea/index.d.ts +1 -1
  54. package/dist/SelectableCard/index.d.ts +1 -1
  55. package/dist/Selector/index.d.ts +1 -1
  56. package/dist/Selector/index.js +1 -1
  57. package/dist/{Selector-OpczmkqS.js → Selector-DP012yul.js} +8 -43
  58. package/dist/SideNav/index.d.ts +1 -1
  59. package/dist/Stepper/index.d.ts +1 -1
  60. package/dist/Switch/index.d.ts +1 -1
  61. package/dist/TabList/index.d.ts +1 -1
  62. package/dist/Table/index.d.ts +1 -1
  63. package/dist/Table/index.js +1 -1
  64. package/dist/{Table-_pSoEiGP.js → Table-YDS_Hj1L.js} +5 -5
  65. package/dist/TextArea/index.d.ts +1 -1
  66. package/dist/TextInput/index.d.ts +1 -1
  67. package/dist/TimeInput/index.d.ts +1 -1
  68. package/dist/Timestamp/index.d.ts +1 -1
  69. package/dist/ToggleButton/index.d.ts +1 -1
  70. package/dist/Token/index.d.ts +1 -1
  71. package/dist/Tokenizer/index.d.ts +1 -1
  72. package/dist/Tokenizer/index.js +1 -1
  73. package/dist/{Tokenizer-BNazaZsP.js → Tokenizer-CY0ymjYr.js} +107 -48
  74. package/dist/Toolbar/index.d.ts +1 -1
  75. package/dist/Tooltip/index.d.ts +1 -1
  76. package/dist/TopNav/index.d.ts +1 -1
  77. package/dist/TreeList/index.d.ts +1 -1
  78. package/dist/Typeahead/index.d.ts +1 -1
  79. package/dist/Typeahead/index.js +2 -2
  80. package/dist/{Typeahead-BgQVQw-0.js → Typeahead-ByeXwX8E.js} +46 -11
  81. package/dist/composables/index.d.ts +2 -1
  82. package/dist/composables/index.js +1 -1
  83. package/dist/{index-Cb-HJUhK.d.ts → index--tm6L1ot.d.ts} +2 -2
  84. package/dist/{index-TXcNH86P.d.ts → index-B1eCxBCY.d.ts} +1 -1
  85. package/dist/{index-BuubzuE8.d.ts → index-BDZCJ9ri.d.ts} +2 -2
  86. package/dist/{index-wY6dKz6c.d.ts → index-BEZ4ezJk.d.ts} +2 -2
  87. package/dist/{index-a1jCiQP7.d.ts → index-BcJzA5j_.d.ts} +8 -8
  88. package/dist/{index-CTjkJP4x.d.ts → index-Bgk1Rj2A.d.ts} +1 -1
  89. package/dist/{index-CuW4AQ7M.d.ts → index-BhxqUt3y.d.ts} +2 -2
  90. package/dist/{index-Bmqz1lVz.d.ts → index-BpprL2SN.d.ts} +1 -1
  91. package/dist/{index-CGDmjlec.d.ts → index-Buxb8Onp.d.ts} +60 -60
  92. package/dist/{index-DhcjuwQq.d.ts → index-C5e2rZML.d.ts} +3 -3
  93. package/dist/{index-D05JGsT3.d.ts → index-C8wfe0Mr.d.ts} +1 -1
  94. package/dist/{index-DFLPv9io.d.ts → index-CP-fJFcJ.d.ts} +1 -1
  95. package/dist/{index-_5purQow.d.ts → index-CfHBwR3F.d.ts} +10 -8
  96. package/dist/{index-CM2L3SUw.d.ts → index-D1J81rYJ.d.ts} +15 -0
  97. package/dist/{index-CKtrcglY.d.ts → index-D1RIIzDd.d.ts} +6 -6
  98. package/dist/{index-DydQ5Ngj.d.ts → index-D7YRtteD.d.ts} +1 -1
  99. package/dist/{index-CBOv5j3c.d.ts → index-DDrL_-hJ.d.ts} +2 -2
  100. package/dist/{index-BmYnVNI-.d.ts → index-DE1genab.d.ts} +14 -2
  101. package/dist/{index-D-YoRrfP.d.ts → index-DKuoSloc.d.ts} +2 -44
  102. package/dist/{index-Cy1rEWC-.d.ts → index-DMcf0QeR.d.ts} +2 -2
  103. package/dist/{index-B3FE7s7V.d.ts → index-DPH5yoAr.d.ts} +4 -4
  104. package/dist/{index-Q1oG9yIT.d.ts → index-DPklTi3o.d.ts} +1 -1
  105. package/dist/{index-B44fLswd.d.ts → index-DYabo8TI.d.ts} +2 -2
  106. package/dist/{index-O9y23OPJ.d.ts → index-DneQgJfI.d.ts} +1 -1
  107. package/dist/{index-C1zwvxPH.d.ts → index-KcCNhdAw.d.ts} +2 -2
  108. package/dist/{index-utZGF4GR.d.ts → index-NOXYEdOI.d.ts} +1 -1
  109. package/dist/{index-lmd9LZKB.d.ts → index-PffxihMx.d.ts} +1 -1
  110. package/dist/{index-COgrQZIL.d.ts → index-YKCx03zD.d.ts} +2 -2
  111. package/dist/{index-mkbGYz8f.d.ts → index-YfMHAQ_D.d.ts} +9 -2
  112. package/dist/{index-CLHJybQY.d.ts → index-ul1hNxih.d.ts} +1 -1
  113. package/dist/{index-9tZJgo0R.d.ts → index-x0rjeitC.d.ts} +2 -2
  114. package/dist/index.d.ts +34 -33
  115. package/dist/index.js +15 -15
  116. package/dist/{loadCatalog-XbgoqaRp.js → loadCatalog-BtQRPyzj.js} +6 -2
  117. package/dist/{loadCatalog-CQEYXGuI.d.ts → loadCatalog-Kp7aQZpL.d.ts} +3 -0
  118. package/dist/locale/index.d.ts +2 -2
  119. package/dist/locale/index.js +4 -4
  120. package/dist/{locale-BwnZeppK.js → locale-DET_YkFW.js} +1 -1
  121. package/dist/selectorEscape-BppRdqpc.js +52 -0
  122. package/dist/{useAnchoredListbox-CuRfVgKl.js → stillPointerGate-Bh02Mfnw.js} +19 -1
  123. package/dist/{tokenizer-DSka5PJD.js → tokenizer-ChiAuPN-.js} +5 -1
  124. package/dist/{searchResultMessage-BEqDlHdV.js → triggerVariant-BDVvyLtv.js} +18 -18
  125. package/dist/{useCombobox-CTo5C-gc.js → useCombobox-D374_pT8.js} +32 -8
  126. package/dist/useInputStatusIcon-B6m_t8cK.d.ts +45 -0
  127. package/dist/{useOptionActionGrid-CkJcuvaU.js → useOptionActionGrid-C7ibYM_A.js} +15 -1
  128. package/dist/{TypeaheadMenu-BOzaCvSb.js → useTypeaheadAnnouncement-MbuZumTd.js} +75 -33
  129. package/package.json +1 -1
  130. package/styles/complex-selector.css +24 -1
  131. package/styles/multi-selector.css +10 -0
  132. package/styles/selector.css +10 -0
  133. package/styles/tokenizer.css +64 -0
  134. package/styles/typeahead.css +28 -0
  135. package/dist/triggerVariant-BsL8jMHs.js +0 -16
  136. package/dist/{index-J6YRJ7Ul.d.ts → index-BqhgeAT4.d.ts} +1 -1
@@ -17,15 +17,15 @@ import { t as fieldMessages } from "../field-CehUqCe0.js";
17
17
  import { t as checkboxListMessages } from "../checkbox-list-uI6q4y3V.js";
18
18
  import { t as citationMessages } from "../citation-h6fyz-JH.js";
19
19
  import { t as commandPaletteMessages } from "../command-palette-g8Mnclgo.js";
20
+ import { t as inputMessages } from "../input-DUSvqqG_.js";
20
21
  import { t as selectorMessages } from "../selector-BmGLjm94.js";
21
22
  import { t as popoverMessages } from "../popover-DxCyd_Ua.js";
22
23
  import { t as contextMenuMessages } from "../context-menu-9i6CObx3.js";
23
24
  import { t as dateInputMessages } from "../date-input-CiEBtStM.js";
24
- import { _ as buttonMessages, a as transferListMessages, c as richTextEditorMessages, d as emojiPickerMessages, f as commentsMessages, g as codeBlockMessages, h as commentComposerMessages, i as useAstryxMessages, l as powerSearchMessages, o as transferListSelectorMessages, s as tableMessages, t as loadAstryxCatalog, u as listInputMessages, v as breadcrumbsMessages, y as alertDialogMessages } from "../loadCatalog-XbgoqaRp.js";
25
+ import { _ as buttonMessages, a as transferListMessages, c as richTextEditorMessages, d as emojiPickerMessages, f as commentsMessages, g as codeBlockMessages, h as commentComposerMessages, i as useAstryxMessages, l as powerSearchMessages, o as transferListSelectorMessages, s as tableMessages, t as loadAstryxCatalog, u as listInputMessages, v as breadcrumbsMessages, y as alertDialogMessages } from "../loadCatalog-BtQRPyzj.js";
25
26
  import { t as dateRangeInputMessages } from "../date-range-input-WnkVv8HN.js";
26
27
  import { n as dateTimeInputMessages, t as timeInputMessages } from "../time-input-CKOsh84E.js";
27
28
  import { t as dialogMessages } from "../dialog-CNjGcdd1.js";
28
- import { t as inputMessages } from "../input-DUSvqqG_.js";
29
29
  import { t as lightboxMessages } from "../lightbox-BbwxSHdB.js";
30
30
  import { t as markdownMessages } from "../markdown-JcCeKquw.js";
31
31
  import { t as metadataListMessages } from "../metadata-list-BEmAuMYs.js";
@@ -44,8 +44,8 @@ import { t as thumbnailMessages } from "../thumbnail-BI82Ijpj.js";
44
44
  import { t as timestampMessages } from "../timestamp-CFBVCsHF.js";
45
45
  import { t as toastMessages } from "../toast-BvAnX6Vc.js";
46
46
  import { t as tokenMessages } from "../token-DcbdjdZ2.js";
47
- import { t as tokenizerMessages } from "../tokenizer-DSka5PJD.js";
47
+ import { t as tokenizerMessages } from "../tokenizer-ChiAuPN-.js";
48
48
  import { t as treeListMessages } from "../tree-list-NZ1EZhtd.js";
49
49
  import { t as typeaheadMessages } from "../typeahead-RkZw0Ktn.js";
50
- import { n as useLocale, r as useCollator, t as useTranslator } from "../locale-BwnZeppK.js";
50
+ import { n as useLocale, r as useCollator, t as useTranslator } from "../locale-DET_YkFW.js";
51
51
  export { alertDialogMessages, astryxLocaleKey, astryxMessagesKey, avatarGroupMessages, bannerMessages, breadcrumbsMessages, buttonMessages, calendarMessages, carouselMessages, chatMessages, checkboxListMessages, citationMessages, codeBlockMessages, commandPaletteMessages, commentComposerMessages, commentsMessages, contextMenuMessages, dateInputMessages, dateRangeInputMessages, dateTimeInputMessages, dialogMessages, dropdownMenuMessages, emojiPickerMessages, fieldMessages, fileInputMessages, formatCalendarMonth, infoTipMessages, inputMessages, kbdMessages, keyboardHintMessages, layoutMessages, lightboxMessages, listInputMessages, loadAstryxCatalog, markdownMessages, metadataListMessages, moreMenuMessages, multiSelectorMessages, navMessages, normalizeLocale, numberInputMessages, outlineMessages, paginationMessages, popoverMessages, powerSearchMessages, provideAstryxLocale, richTextEditorMessages, selectorMessages, sliderMessages, spinnerMessages, stepperMessages, switchMessages, tabListMessages, tableMessages, textAreaMessages, textInputMessages, thumbnailMessages, timeInputMessages, timestampMessages, toastMessages, tokenMessages, tokenizerMessages, transferListMessages, transferListSelectorMessages, treeListMessages, typeaheadMessages, useAstryxLocale, useAstryxMessages, useCollator, useComponentMessages, useLocale, useTranslator, weekdayNames };
@@ -1,5 +1,5 @@
1
1
  import { a as useAstryxLocale } from "./context-B8IEFCDR.js";
2
- import { i as useAstryxMessages, n as upstreamMessageMap } from "./loadCatalog-XbgoqaRp.js";
2
+ import { i as useAstryxMessages, n as upstreamMessageMap } from "./loadCatalog-BtQRPyzj.js";
3
3
  import { computed, toValue } from "vue";
4
4
  //#region src/locale/useCollator.ts
5
5
  /**
@@ -0,0 +1,52 @@
1
+ import { a as isImeKeyEvent } from "./layerDepth-BF74Cctw.js";
2
+ import { t as useAnnounce } from "./announce-B210eJVf.js";
3
+ import { n as focusElement } from "./focus-l8jVTcqd.js";
4
+ import { nextTick, onScopeDispose, toValue, watch } from "vue";
5
+ //#region src/composables/internal/busyAnnouncement.ts
6
+ /**
7
+ * 控件里的忙碌 Spinner 只是装饰(不对读屏暴露),忙碌状态由控件自己播报:
8
+ * 每次进入忙碌只念一次,重新渲染不重复,忙完之后再次忙碌会再念。
9
+ */
10
+ function useBusyAnnouncement(isBusy, message) {
11
+ const announce = useAnnounce();
12
+ watch(() => toValue(isBusy), (busy) => {
13
+ if (busy) announce(toValue(message));
14
+ }, { immediate: true });
15
+ }
16
+ //#endregion
17
+ //#region src/Selector/selectorEscape.ts
18
+ /** 弹出层关掉后,焦点回到触发按钮,而不是掉到 body。 */
19
+ function focusSelectorTrigger(field) {
20
+ const trigger = field?.querySelector(".astryx-selector-trigger");
21
+ if (trigger) nextTick(() => focusElement(trigger));
22
+ }
23
+ function focusInside(layer) {
24
+ const active = document.activeElement;
25
+ return layer != null && active instanceof Node && layer.contains(active);
26
+ }
27
+ /**
28
+ * 搜索框已经处理过的 Escape 会带 preventDefault,这里接选项和操作按钮。
29
+ * 焦点在弹出层里才送回触发器,免得抢走外面已经拿到焦点的控件。
30
+ */
31
+ function onSelectorListboxEscape(event, options) {
32
+ if (event.key !== "Escape" || event.defaultPrevented || isImeKeyEvent(event) || !options.isOpen) return;
33
+ if (!focusInside(options.layer)) return;
34
+ event.preventDefault();
35
+ options.close();
36
+ options.focusTrigger();
37
+ }
38
+ /** 文档级 Escape。焦点还在层里才送回触发器,点外面关掉时不动焦点。 */
39
+ function dismissSelectorEscape(layer, close, focusTrigger) {
40
+ const inside = focusInside(layer);
41
+ close();
42
+ if (inside) focusTrigger();
43
+ }
44
+ function bindListboxEscape(layer, onKeyDown) {
45
+ watch(layer, (el, prev) => {
46
+ prev?.removeEventListener("keydown", onKeyDown);
47
+ el?.addEventListener("keydown", onKeyDown);
48
+ }, { flush: "sync" });
49
+ onScopeDispose(() => layer.value?.removeEventListener("keydown", onKeyDown));
50
+ }
51
+ //#endregion
52
+ export { useBusyAnnouncement as a, onSelectorListboxEscape as i, dismissSelectorEscape as n, focusSelectorTrigger as r, bindListboxEscape as t };
@@ -57,4 +57,22 @@ function scrollOptionIntoView(layer, id) {
57
57
  else if (optionRect.bottom > layerRect.bottom) layer.scrollTop += optionRect.bottom - layerRect.bottom;
58
58
  }
59
59
  //#endregion
60
- export { useAnchoredListbox as n, scrollOptionIntoView as t };
60
+ //#region src/selectors/stillPointerGate.ts
61
+ function createStillPointerGate() {
62
+ let lastX = NaN;
63
+ let lastY = NaN;
64
+ return {
65
+ track(event) {
66
+ lastX = event.clientX;
67
+ lastY = event.clientY;
68
+ },
69
+ moved(event) {
70
+ const changed = event.clientX !== lastX || event.clientY !== lastY;
71
+ lastX = event.clientX;
72
+ lastY = event.clientY;
73
+ return changed;
74
+ }
75
+ };
76
+ }
77
+ //#endregion
78
+ export { scrollOptionIntoView as n, useAnchoredListbox as r, createStillPointerGate as t };
@@ -1,4 +1,4 @@
1
- import { r as formatCount } from "./shared-CTFb3-QO.js";
1
+ import { n as englishPlural, r as formatCount } from "./shared-CTFb3-QO.js";
2
2
  //#region src/locale/messages/tokenizer.ts
3
3
  const tokenizerMessages = {
4
4
  "en": {
@@ -11,6 +11,8 @@ const tokenizerMessages = {
11
11
  more: (count) => `+${formatCount(count, "en")} more`,
12
12
  added: (label) => `Added ${label}`,
13
13
  removed: (label) => `Removed ${label}`,
14
+ allRemoved: "All items removed",
15
+ resultCount: (count) => `${formatCount(count, "en")} ${englishPlural(count, "result", "results")}`,
14
16
  create: (query) => `Create "${query}"`
15
17
  },
16
18
  "zh-CN": {
@@ -23,6 +25,8 @@ const tokenizerMessages = {
23
25
  more: (count) => `另外 ${formatCount(count, "zh-CN")} 个`,
24
26
  added: (label) => `已添加${label}`,
25
27
  removed: (label) => `已移除${label}`,
28
+ allRemoved: "已移除全部",
29
+ resultCount: (count) => `找到 ${formatCount(count, "zh-CN")} 个结果`,
26
30
  create: (query) => `创建「${query}」`
27
31
  }
28
32
  };
@@ -3,10 +3,11 @@ import { t as _sfc_main$2 } from "./ButtonTooltip-CNKOQHYR.js";
3
3
  import { t as useButtonTooltip } from "./useButtonTooltip-DjCaZMp_.js";
4
4
  import { o as useComponentMessages } from "./context-B8IEFCDR.js";
5
5
  import { t as inputMessages } from "./input-DUSvqqG_.js";
6
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, openBlock, unref, useId, useTemplateRef, withModifiers } from "vue";
6
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, openBlock, unref, useId, useTemplateRef, withModifiers } from "vue";
7
7
  //#region src/Field/StatusGlyph.vue
8
8
  const _hoisted_1 = ["data-status", "aria-label"];
9
9
  const _sfc_main = /*@__PURE__*/ defineComponent({
10
+ inheritAttrs: false,
10
11
  __name: "StatusGlyph",
11
12
  props: {
12
13
  type: {},
@@ -27,8 +28,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
27
28
  return messages.value.input.statusError;
28
29
  });
29
30
  return (_ctx, _cache) => {
30
- return openBlock(), createElementBlock(Fragment, null, [showsTooltip.value ? (openBlock(), createElementBlock("button", {
31
- key: 0,
31
+ return openBlock(), createElementBlock(Fragment, null, [showsTooltip.value ? (openBlock(), createElementBlock("button", mergeProps({ key: 0 }, _ctx.$attrs, {
32
32
  ref_key: "button",
33
33
  ref: button,
34
34
  type: "button",
@@ -41,16 +41,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
41
41
  onBlur: _cache[2] || (_cache[2] = (...args) => unref(tooltip).hideImmediately && unref(tooltip).hideImmediately(...args)),
42
42
  onPointerenter: _cache[3] || (_cache[3] = (...args) => unref(tooltip).onPointerEnter && unref(tooltip).onPointerEnter(...args)),
43
43
  onPointerleave: _cache[4] || (_cache[4] = (...args) => unref(tooltip).onPointerLeave && unref(tooltip).onPointerLeave(...args))
44
- }, [createVNode(_sfc_main$1, {
44
+ }), [createVNode(_sfc_main$1, {
45
45
  icon: __props.type,
46
46
  size: "sm"
47
- }, null, 8, ["icon"])], 40, _hoisted_1)) : (openBlock(), createBlock(_sfc_main$1, {
48
- key: 1,
47
+ }, null, 8, ["icon"])], 16, _hoisted_1)) : (openBlock(), createBlock(_sfc_main$1, mergeProps({ key: 1 }, _ctx.$attrs, {
49
48
  class: "astryx-field-status-glyph",
50
49
  icon: __props.type,
51
50
  size: "sm",
52
51
  "data-status": __props.type
53
- }, null, 8, ["icon", "data-status"])), showsTooltip.value ? (openBlock(), createBlock(_sfc_main$2, {
52
+ }), null, 16, ["icon", "data-status"])), showsTooltip.value ? (openBlock(), createBlock(_sfc_main$2, {
54
53
  key: 2,
55
54
  id: tooltipId,
56
55
  anchor: anchor.value,
@@ -69,18 +68,19 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
69
68
  }
70
69
  });
71
70
  //#endregion
72
- //#region src/Selector/searchResultMessage.ts
71
+ //#region src/Field/statusPlacement.ts
73
72
  /**
74
- * 面板打开时要说的那句话。
75
- * 加载中什么都不说,因为选项还没到,不能断言「没有选项」或「没有结果」。
76
- * 创建行本身算一条结果,所以这时不报空。
73
+ * 次要和幽灵触发器把贴在控件下的状态说明挪开,避免把工具栏撑高。
74
+ * tooltip 和已经写明的 detached 保持原样。
77
75
  */
78
- function searchResultMessage(input) {
79
- if (!input.isOpen || input.isLoading) return "";
80
- const searching = input.query.trim() !== "";
81
- if (input.matchCount === 0 && !input.hasCreateRow) return searching ? input.emptySearchText : input.emptyText;
82
- if (!searching) return "";
83
- return input.resultCount(input.matchCount + (input.hasCreateRow ? 1 : 0));
76
+ function fieldStatusPlacement(variant, statusVariant) {
77
+ return (variant === "ghost" || variant === "secondary") && statusVariant === "attached" ? "detached" : statusVariant;
84
78
  }
85
79
  //#endregion
86
- export { _sfc_main as n, searchResultMessage as t };
80
+ //#region src/selectors/triggerVariant.ts
81
+ function normalizeTriggerVariant(value) {
82
+ if (value === "secondary" || value === "ghost") return value;
83
+ return "input";
84
+ }
85
+ //#endregion
86
+ export { fieldStatusPlacement as n, _sfc_main as r, normalizeTriggerVariant as t };
@@ -1,4 +1,27 @@
1
1
  import { computed, onScopeDispose, ref, watch } from "vue";
2
+ //#region src/composables/internal/typeaheadText.ts
3
+ /**
4
+ * 类型跳转(type-to-select)用的文字折叠:忽略大小写、组合符号(U+0300–U+036F)、
5
+ * 带斜杠的字母(đ ł ø ħ ŧ ƀ)以及土耳其语带点和不带点的 i。
6
+ * 类型跳转是导航不是排序,所以所有语言都按同一套规则。
7
+ */
8
+ const STROKED_LETTERS = {
9
+ đ: "d",
10
+ ł: "l",
11
+ ø: "o",
12
+ ħ: "h",
13
+ ŧ: "t",
14
+ ƀ: "b",
15
+ ı: "i"
16
+ };
17
+ function foldTypeaheadText(text) {
18
+ return text.normalize("NFD").replace(/[\u0300-\u036F]/g, "").toLowerCase().replace(/[đłøħŧƀı]/g, (char) => STROKED_LETTERS[char] ?? char);
19
+ }
20
+ /** `label` 折叠之后是否以折叠后的 `prefix` 开头。 */
21
+ function startsWithTypeahead(label, prefix) {
22
+ return foldTypeaheadText(label).startsWith(prefix);
23
+ }
24
+ //#endregion
2
25
  //#region src/composables/useCombobox.ts
3
26
  const TYPEAHEAD_RESET_MS = 750;
4
27
  /**
@@ -27,10 +50,9 @@ function useCombobox(options) {
27
50
  isOpen.value = true;
28
51
  onOpenChange?.(true);
29
52
  const currentValue = modelValue.value;
30
- if (currentValue != null) {
31
- const index = filteredOptions.value.findIndex((opt) => opt.value === currentValue);
32
- activeIndex.value = index >= 0 ? index : 0;
33
- } else activeIndex.value = 0;
53
+ const index = currentValue != null ? filteredOptions.value.findIndex((opt) => opt.value === currentValue) : -1;
54
+ if (index >= 0 && !filteredOptions.value[index]?.disabled) activeIndex.value = index;
55
+ else activeIndex.value = Math.max(0, filteredOptions.value.findIndex((opt) => !opt.disabled));
34
56
  }
35
57
  function close() {
36
58
  isOpen.value = false;
@@ -88,7 +110,7 @@ function useCombobox(options) {
88
110
  }
89
111
  function jumpToMatch(char) {
90
112
  if (typeaheadTimer !== void 0) clearTimeout(typeaheadTimer);
91
- const lower = char.toLowerCase();
113
+ const lower = foldTypeaheadText(char);
92
114
  typeaheadBuffer = typeaheadBuffer.length > 0 && [...typeaheadBuffer].every((c) => c === lower) ? lower : typeaheadBuffer + lower;
93
115
  typeaheadTimer = setTimeout(() => {
94
116
  typeaheadBuffer = "";
@@ -96,12 +118,14 @@ function useCombobox(options) {
96
118
  const options = filteredOptions.value;
97
119
  const start = activeIndex.value >= 0 ? activeIndex.value : 0;
98
120
  const offset = typeaheadBuffer.length === 1 ? 1 : 0;
99
- for (let i = 0; i < options.length; i++) {
121
+ const exact = typeaheadBuffer.length === 1 && char.toLowerCase() !== lower ? char.toLowerCase() : null;
122
+ for (const exactOnly of exact != null ? [true, false] : [false]) for (let i = 0; i < options.length; i++) {
100
123
  const index = (start + offset + i) % options.length;
101
124
  const option = options[index];
102
- if (option && !option.disabled && option.label.toLowerCase().startsWith(typeaheadBuffer)) {
125
+ if (!option || option.disabled) continue;
126
+ if (exactOnly ? option.label.toLowerCase().startsWith(exact) : startsWithTypeahead(option.label, typeaheadBuffer)) {
103
127
  activeIndex.value = index;
104
- break;
128
+ return;
105
129
  }
106
130
  }
107
131
  }
@@ -0,0 +1,45 @@
1
+ import { o as FieldStatusInput } from "./types-bAQk3F8G.js";
2
+ import { Component, ComputedRef, MaybeRefOrGetter } from "vue";
3
+ //#region src/composables/useInputStatusIcon.d.ts
4
+ /** 状态图标相对输入框的位置。 */
5
+ type InputStatusVariant = 'attached' | 'detached' | 'tooltip';
6
+ interface UseInputStatusIconOptions {
7
+ /** 输入框的状态(类型加文案),没有状态就不传。 */
8
+ status?: MaybeRefOrGetter<FieldStatusInput | undefined>;
9
+ /**
10
+ * 状态相对输入框怎么摆。`attached` 在框里画一个图标,`detached` 交给下面的
11
+ * 状态文案自己带图标,`tooltip` 画一个能用键盘够到的信息按钮。
12
+ * @default 'attached'
13
+ */
14
+ statusVariant?: MaybeRefOrGetter<InputStatusVariant>;
15
+ /**
16
+ * 输入框是否在 `InputGroup` 里,组自己会画状态。
17
+ * @default false
18
+ */
19
+ isInGroup?: MaybeRefOrGetter<boolean>;
20
+ }
21
+ interface UseInputStatusIconReturn {
22
+ /**
23
+ * 要渲染在输入框容器里的东西:`FieldIcon`(普通图标),或者 `FieldInfoTip`
24
+ * (带 tooltip 的信息按钮)。没有该画的东西时是 `null`。
25
+ * 和 `statusIconProps` 一起用:`<component :is="statusIcon" v-bind="statusIconProps" />`。
26
+ */
27
+ statusIcon: ComputedRef<Component | null>;
28
+ /** 上面那个组件要的属性。 */
29
+ statusIconProps: ComputedRef<Record<string, unknown>>;
30
+ }
31
+ /**
32
+ * 对应原版 Astryx 的 `hooks/useInputStatusIcon`。
33
+ *
34
+ * 决定输入框上那颗状态图标画什么,让同一状态下所有输入框长得一样:
35
+ * `attached` 画一个不说话的图标,文案留给下面的状态栏;`detached` 什么都不画,
36
+ * 因为状态栏自己带了图标;`tooltip` 画一个真按钮,键盘、鼠标、触摸、读屏都能
37
+ * 摸到它的说明。在 `InputGroup` 里也不画,组自己会画。
38
+ *
39
+ * 上游还会返回一个 `describedBy`,用来接进输入框的 `aria-describedby`。
40
+ * 我们这边 `Field` 已经把状态文案渲染成视觉隐藏文本并接进 `aria-describedby` 了,
41
+ * tooltip 按钮自己也带着 `aria-describedby`,所以不需要再返回一个 id。
42
+ */
43
+ declare function useInputStatusIcon(options?: UseInputStatusIconOptions): UseInputStatusIconReturn;
44
+ //#endregion
45
+ export { useInputStatusIcon as i, UseInputStatusIconOptions as n, UseInputStatusIconReturn as r, InputStatusVariant as t };
@@ -29,6 +29,20 @@ const OptionAction = defineComponent({
29
29
  }
30
30
  });
31
31
  //#endregion
32
+ //#region src/Selector/searchResultMessage.ts
33
+ /**
34
+ * 面板打开时要说的那句话。
35
+ * 加载中什么都不说,因为选项还没到,不能断言「没有选项」或「没有结果」。
36
+ * 创建行本身算一条结果,所以这时不报空。
37
+ */
38
+ function searchResultMessage(input) {
39
+ if (!input.isOpen || input.isLoading) return "";
40
+ const searching = input.query.trim() !== "";
41
+ if (input.matchCount === 0 && !input.hasCreateRow) return searching ? input.emptySearchText : input.emptyText;
42
+ if (!searching) return "";
43
+ return input.resultCount(input.matchCount + (input.hasCreateRow ? 1 : 0));
44
+ }
45
+ //#endregion
32
46
  //#region src/selectors/useOptionActionGrid.ts
33
47
  /**
34
48
  * 选项操作的键盘列。上一项、下一项仍交给列表模型。
@@ -94,4 +108,4 @@ function useOptionActionGrid(options) {
94
108
  };
95
109
  }
96
110
  //#endregion
97
- export { OptionAction as n, isOptionAction as r, useOptionActionGrid as t };
111
+ export { isOptionAction as i, searchResultMessage as n, OptionAction as r, useOptionActionGrid as t };
@@ -1,8 +1,11 @@
1
1
  import { t as characterCount } from "./characters-wTnzjkkR.js";
2
+ import { t as useAnnounce } from "./announce-B210eJVf.js";
2
3
  import { n as useAsyncSource } from "./useAsyncSource-Gk0VtE7_.js";
3
- import { t as useCombobox } from "./useCombobox-CTo5C-gc.js";
4
+ import { t as useCombobox } from "./useCombobox-D374_pT8.js";
5
+ import { n as isDevBuild, t as devPropError } from "./devBuild-G249YcdZ.js";
4
6
  import { t as _sfc_main$2 } from "./Spinner-DEVPDsD0.js";
5
- import { n as OptionAction, r as isOptionAction, t as useOptionActionGrid } from "./useOptionActionGrid-CkJcuvaU.js";
7
+ import { t as createStillPointerGate } from "./stillPointerGate-Bh02Mfnw.js";
8
+ import { i as isOptionAction, n as searchResultMessage, r as OptionAction, t as useOptionActionGrid } from "./useOptionActionGrid-C7ibYM_A.js";
6
9
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, toValue, unref, watch, withModifiers } from "vue";
7
10
  import "../styles/typeahead.css";
8
11
  //#region src/Typeahead/queryLength.ts
@@ -46,6 +49,11 @@ function useTypeaheadMenu(options) {
46
49
  if (source === previous || asyncSource.status.value !== "loading") return;
47
50
  asyncSource.status.value = "idle";
48
51
  }, { flush: "sync" });
52
+ const matchCount = computed(() => {
53
+ if (belowMinQueryLength.value) return 0;
54
+ const excluded = new Set(toValue(options.excludeIds) ?? []);
55
+ return asyncSource.items.value.filter((item) => !excluded.has(item.id)).length;
56
+ });
49
57
  const entries = computed(() => {
50
58
  const excluded = new Set(toValue(options.excludeIds) ?? []);
51
59
  const blocked = new Set((toValue(options.blockedLabels) ?? []).map((label) => label.toLowerCase()));
@@ -203,6 +211,7 @@ function useTypeaheadMenu(options) {
203
211
  error: asyncSource.error,
204
212
  activeId,
205
213
  belowMinQueryLength,
214
+ matchCount,
206
215
  setQuery,
207
216
  open,
208
217
  close,
@@ -268,6 +277,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
268
277
  },
269
278
  setup(__props) {
270
279
  const props = __props;
280
+ if (isDevBuild() && props.item == null) throw devPropError("TypeaheadItem", "item", "is required: the item to show, for example :item=\"{ id: 'nyc', label: 'New York' }\".");
271
281
  return (_ctx, _cache) => {
272
282
  return openBlock(), createElementBlock("span", {
273
283
  class: "astryx-typeahead-item",
@@ -279,32 +289,28 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
279
289
  //#endregion
280
290
  //#region src/Typeahead/TypeaheadMenu.vue
281
291
  const _hoisted_1 = {
282
- class: "astryx-typeahead-menu",
283
- role: "presentation"
284
- };
285
- const _hoisted_2 = {
286
292
  key: 0,
287
293
  class: "astryx-typeahead-state",
288
294
  role: "status"
289
295
  };
290
- const _hoisted_3 = {
296
+ const _hoisted_2 = {
291
297
  key: 1,
292
298
  class: "astryx-typeahead-state",
293
299
  role: "alert"
294
300
  };
295
- const _hoisted_4 = ["role", "aria-selected"];
296
- const _hoisted_5 = {
301
+ const _hoisted_3 = ["role", "aria-selected"];
302
+ const _hoisted_4 = {
297
303
  key: 3,
298
304
  class: "astryx-typeahead-options",
299
305
  role: "presentation"
300
306
  };
301
- const _hoisted_6 = ["role", "aria-label"];
302
- const _hoisted_7 = {
307
+ const _hoisted_5 = ["role", "aria-label"];
308
+ const _hoisted_6 = {
303
309
  key: 0,
304
310
  class: "astryx-typeahead-group-heading",
305
311
  "aria-hidden": "true"
306
312
  };
307
- const _hoisted_8 = [
313
+ const _hoisted_7 = [
308
314
  "id",
309
315
  "role",
310
316
  "aria-selected",
@@ -313,9 +319,9 @@ const _hoisted_8 = [
313
319
  "onMouseenter",
314
320
  "onClick"
315
321
  ];
316
- const _hoisted_9 = ["id", "onClick"];
317
- const _hoisted_10 = { class: "astryx-typeahead-option-copy" };
318
- const _hoisted_11 = {
322
+ const _hoisted_8 = ["id", "onClick"];
323
+ const _hoisted_9 = { class: "astryx-typeahead-option-copy" };
324
+ const _hoisted_10 = {
319
325
  key: 0,
320
326
  class: "astryx-typeahead-check",
321
327
  width: "16",
@@ -324,12 +330,12 @@ const _hoisted_11 = {
324
330
  fill: "none",
325
331
  "aria-hidden": "true"
326
332
  };
327
- const _hoisted_12 = ["id"];
328
- const _hoisted_13 = {
333
+ const _hoisted_11 = ["id"];
334
+ const _hoisted_12 = {
329
335
  key: 2,
330
336
  class: "astryx-typeahead-option-copy"
331
337
  };
332
- const _hoisted_14 = {
338
+ const _hoisted_13 = {
333
339
  key: 3,
334
340
  class: "astryx-typeahead-check",
335
341
  width: "16",
@@ -385,27 +391,36 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
385
391
  function actionId(index) {
386
392
  return `${props.listboxId}-action-${index}`;
387
393
  }
394
+ const pointerGate = createStillPointerGate();
395
+ /** 只有鼠标真的移动了才让行拿走高亮;键盘滚动让行从静止的鼠标下冒出来不算。 */
396
+ function onRowEnter(event, index) {
397
+ if (pointerGate.moved(event)) emit("highlight", index);
398
+ }
388
399
  function onOptionClick(id, disabled) {
389
400
  if (!disabled) emit("select", id);
390
401
  }
391
402
  return (_ctx, _cache) => {
392
- return openBlock(), createElementBlock("div", _hoisted_1, [props.status === "loading" && props.entries.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(_sfc_main$2, {
403
+ return openBlock(), createElementBlock("div", {
404
+ class: "astryx-typeahead-menu",
405
+ role: "presentation",
406
+ onMousemove: _cache[3] || (_cache[3] = (...args) => unref(pointerGate).track && unref(pointerGate).track(...args))
407
+ }, [props.status === "loading" && props.entries.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_sfc_main$2, {
393
408
  size: "sm",
394
409
  label: props.loadingText
395
- }, null, 8, ["label"])])) : props.status === "error" ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(props.errorText), 1)) : props.entries.length === 0 ? (openBlock(), createElementBlock("div", {
410
+ }, null, 8, ["label"])])) : props.status === "error" ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(props.errorText), 1)) : props.entries.length === 0 ? (openBlock(), createElementBlock("div", {
396
411
  key: 2,
397
412
  class: "astryx-typeahead-state",
398
413
  role: props.grid ? "presentation" : "option",
399
414
  "aria-selected": props.grid ? void 0 : "false",
400
415
  "aria-disabled": "true"
401
- }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(props.emptyText), 1)])], 8, _hoisted_4)) : (openBlock(), createElementBlock("div", _hoisted_5, [(openBlock(true), createElementBlock(Fragment, null, renderList(groups.value, (group, groupIndex) => {
416
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(props.emptyText), 1)])], 8, _hoisted_3)) : (openBlock(), createElementBlock("div", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(groups.value, (group, groupIndex) => {
402
417
  return openBlock(), createElementBlock("div", {
403
418
  key: group.heading ?? `__ungrouped-${groupIndex}`,
404
419
  class: "astryx-typeahead-group",
405
420
  role: props.grid ? group.heading ? "rowgroup" : "presentation" : group.heading ? "group" : "presentation",
406
421
  "aria-label": group.heading
407
422
  }, [
408
- group.heading ? (openBlock(), createElementBlock("div", _hoisted_7, toDisplayString(group.heading), 1)) : createCommentVNode("v-if", true),
423
+ group.heading ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(group.heading), 1)) : createCommentVNode("v-if", true),
409
424
  createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events, vue-a11y/mouse-events-have-key-events, vue-a11y/no-static-element-interactions -- 选项不进 Tab 序,方向键和 Enter 由组合框输入处理。 "),
410
425
  (openBlock(true), createElementBlock(Fragment, null, renderList(group.rows, (row) => {
411
426
  return openBlock(), createElementBlock("div", {
@@ -422,7 +437,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
422
437
  "data-option-id": row.entry.id,
423
438
  tabindex: "-1",
424
439
  onMousedown: _cache[2] || (_cache[2] = withModifiers(() => {}, ["prevent"])),
425
- onMouseenter: ($event) => emit("highlight", row.index),
440
+ onMouseenter: ($event) => onRowEnter($event, row.index),
426
441
  onClick: ($event) => props.grid ? void 0 : onOptionClick(row.entry.id, row.entry.disabled)
427
442
  }, [
428
443
  createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events -- 选项格不进 Tab 序,方向键和 Enter 由组合框输入处理。 "),
@@ -433,7 +448,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
433
448
  role: "gridcell",
434
449
  tabindex: "-1",
435
450
  onClick: ($event) => onOptionClick(row.entry.id, row.entry.disabled)
436
- }, [createElementVNode("span", _hoisted_10, [renderSlot(_ctx.$slots, "item", {
451
+ }, [createElementVNode("span", _hoisted_9, [renderSlot(_ctx.$slots, "item", {
437
452
  entry: row.entry,
438
453
  isActive: row.index === props.activeIndex,
439
454
  isSelected: Boolean(row.entry.selected)
@@ -445,13 +460,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
445
460
  disabled: row.entry.disabled
446
461
  },
447
462
  "is-disabled": row.entry.disabled
448
- }, null, 8, ["item", "is-disabled"])])]), row.entry.selected ? (openBlock(), createElementBlock("svg", _hoisted_11, [..._cache[3] || (_cache[3] = [createElementVNode("path", {
463
+ }, null, 8, ["item", "is-disabled"])])]), row.entry.selected ? (openBlock(), createElementBlock("svg", _hoisted_10, [..._cache[4] || (_cache[4] = [createElementVNode("path", {
449
464
  d: "M3.5 8.5L6.5 11.5L12.5 4.5",
450
465
  stroke: "currentColor",
451
466
  "stroke-width": "1.5",
452
467
  "stroke-linecap": "round",
453
468
  "stroke-linejoin": "round"
454
- }, null, -1)])])) : createCommentVNode("v-if", true)], 8, _hoisted_9)) : createCommentVNode("v-if", true),
469
+ }, null, -1)])])) : createCommentVNode("v-if", true)], 8, _hoisted_8)) : createCommentVNode("v-if", true),
455
470
  props.grid ? (openBlock(), createElementBlock("div", {
456
471
  key: 1,
457
472
  id: unref(isOptionAction)(row.entry.action) ? void 0 : actionId(row.index),
@@ -463,8 +478,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
463
478
  key: 0,
464
479
  node: row.entry.action,
465
480
  "dom-id": actionId(row.index)
466
- }, null, 8, ["node", "dom-id"])) : createCommentVNode("v-if", true)], 42, _hoisted_12)) : createCommentVNode("v-if", true),
467
- !props.grid ? (openBlock(), createElementBlock("span", _hoisted_13, [renderSlot(_ctx.$slots, "item", {
481
+ }, null, 8, ["node", "dom-id"])) : createCommentVNode("v-if", true)], 42, _hoisted_11)) : createCommentVNode("v-if", true),
482
+ !props.grid ? (openBlock(), createElementBlock("span", _hoisted_12, [renderSlot(_ctx.$slots, "item", {
468
483
  entry: row.entry,
469
484
  isActive: row.index === props.activeIndex,
470
485
  isSelected: Boolean(row.entry.selected)
@@ -477,19 +492,46 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
477
492
  },
478
493
  "is-disabled": row.entry.disabled
479
494
  }, null, 8, ["item", "is-disabled"])])])) : createCommentVNode("v-if", true),
480
- !props.grid && row.entry.selected ? (openBlock(), createElementBlock("svg", _hoisted_14, [..._cache[4] || (_cache[4] = [createElementVNode("path", {
495
+ !props.grid && row.entry.selected ? (openBlock(), createElementBlock("svg", _hoisted_13, [..._cache[5] || (_cache[5] = [createElementVNode("path", {
481
496
  d: "M3.5 8.5L6.5 11.5L12.5 4.5",
482
497
  stroke: "currentColor",
483
498
  "stroke-width": "1.5",
484
499
  "stroke-linecap": "round",
485
500
  "stroke-linejoin": "round"
486
501
  }, null, -1)])])) : createCommentVNode("v-if", true)
487
- ], 42, _hoisted_8);
502
+ ], 42, _hoisted_7);
488
503
  }), 128))
489
- ], 8, _hoisted_6);
490
- }), 128))]))]);
504
+ ], 8, _hoisted_5);
505
+ }), 128))]))], 32);
491
506
  };
492
507
  }
493
508
  });
494
509
  //#endregion
495
- export { useTypeaheadMenu as i, _sfc_main$1 as n, useLatchedOptionGrid as r, _sfc_main as t };
510
+ //#region src/Typeahead/useTypeaheadAnnouncement.ts
511
+ /**
512
+ * 输入了文字、搜索落定之后,念一句结果数(点名每一条匹配,包括超出 `maxMenuItems`
513
+ * 没画出来的),或者没有结果的提示。加载中不念,因为还不知道有没有结果。
514
+ */
515
+ function useTypeaheadAnnouncement(options) {
516
+ const announce = useAnnounce();
517
+ const { menu } = options;
518
+ const message = computed(() => {
519
+ const createRows = menu.entries.value.filter((entry) => entry.create).length;
520
+ return searchResultMessage({
521
+ isOpen: menu.combobox.isOpen.value,
522
+ isLoading: menu.status.value === "loading",
523
+ query: menu.query.value,
524
+ matchCount: menu.matchCount.value,
525
+ hasCreateRow: createRows > 0,
526
+ emptyText: toValue(options.emptyText),
527
+ emptySearchText: toValue(options.emptySearchText),
528
+ resultCount: options.resultCount
529
+ });
530
+ });
531
+ watch(message, (next) => {
532
+ if (next) announce(next);
533
+ });
534
+ return message;
535
+ }
536
+ //#endregion
537
+ export { useTypeaheadMenu as a, useLatchedOptionGrid as i, _sfc_main as n, _sfc_main$1 as r, useTypeaheadAnnouncement as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astryx-vue/core",
3
3
  "type": "module",
4
- "version": "0.12.1",
4
+ "version": "0.13.0",
5
5
  "description": "Vue 3 components for the unofficial astryx-vue port of Astryx. Not affiliated with Meta.",
6
6
  "author": "ShenQingchuan",
7
7
  "license": "MIT",
@@ -119,9 +119,32 @@
119
119
  transform: rotate(180deg);
120
120
  }
121
121
 
122
+ .astryx-complex-selector-field .astryx-popover-trigger {
123
+ position: relative;
124
+ }
125
+
126
+ /* 状态图标顶替箭头的位置,文字再长也不挤它。 */
127
+ .astryx-complex-selector .astryx-field-status-glyph,
128
+ .astryx-complex-selector-status-slot {
129
+ flex-shrink: 0;
130
+ }
131
+
132
+ .astryx-complex-selector-status-slot {
133
+ width: 16px;
134
+ height: 16px;
135
+ }
136
+
137
+ /* 提示按钮不能嵌在触发器按钮里,叠在触发器末尾留出的那块空位上。 */
138
+ .astryx-complex-selector-status-tip {
139
+ position: absolute;
140
+ inset-block-start: 50%;
141
+ inset-inline-end: var(--astryx-spacing-3, 12px);
142
+ transform: translateY(-50%);
143
+ }
144
+
122
145
  .astryx-complex-selector-content {
123
146
  box-sizing: border-box;
124
- max-height: min(480px, calc(100vh - 32px));
147
+ max-height: var(--_complex-selector-max-block, min(480px, calc(100vh - 32px)));
125
148
  overflow: auto;
126
149
  padding: var(--astryx-spacing-3, 12px);
127
150
  }