@astryx-vue/core 0.17.0 → 0.19.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 (122) hide show
  1. package/dist/AvatarGroup/index.d.ts +1 -1
  2. package/dist/Banner/index.d.ts +1 -1
  3. package/dist/BottomSheet/index.d.ts +1 -1
  4. package/dist/ButtonGroup/index.d.ts +1 -1
  5. package/dist/Calendar/index.d.ts +1 -1
  6. package/dist/Calendar/index.js +1 -1
  7. package/dist/{Calendar-Bk2nGoT-.js → Calendar-DSRNuw3y.js} +37 -13
  8. package/dist/Carousel/index.d.ts +1 -1
  9. package/dist/Center/index.d.ts +1 -1
  10. package/dist/Chat/index.js +1 -1
  11. package/dist/{Chat-Wq7e98zS.js → Chat-CXwXzlZ0.js} +1 -1
  12. package/dist/CheckboxInput/index.d.ts +1 -1
  13. package/dist/CheckboxList/index.d.ts +1 -1
  14. package/dist/ClickableCard/index.d.ts +1 -1
  15. package/dist/Collapsible/index.d.ts +1 -1
  16. package/dist/Collapsible/index.js +1 -1
  17. package/dist/{Collapsible-Dk9BQQbT.js → Collapsible-ExzU7vC0.js} +104 -40
  18. package/dist/ContextMenu/index.d.ts +1 -1
  19. package/dist/DateInput/index.d.ts +1 -1
  20. package/dist/DateInput/index.js +1 -1
  21. package/dist/{DateInput-BitZfGEY.js → DateInput-s2H0orUW.js} +3 -3
  22. package/dist/DateRangeInput/index.d.ts +1 -1
  23. package/dist/DateRangeInput/index.js +1 -1
  24. package/dist/{DateRangeInput-kxXBsUTU.js → DateRangeInput-Dn9I2PMM.js} +7 -7
  25. package/dist/DateTimeInput/index.d.ts +1 -1
  26. package/dist/DateTimeInput/index.js +1 -1
  27. package/dist/{DateTimeInput-Cfkuec_h.js → DateTimeInput-BR_tdURg.js} +47 -17
  28. package/dist/Dialog/index.d.ts +1 -1
  29. package/dist/Drawer/index.d.ts +1 -1
  30. package/dist/FileInput/index.d.ts +1 -1
  31. package/dist/HoverCard/index.d.ts +1 -1
  32. package/dist/HoverCard/index.js +1 -1
  33. package/dist/{HoverCard-DVPLeccv.js → HoverCard-FHYH3VXg.js} +50 -2
  34. package/dist/InfoTip/index.d.ts +1 -1
  35. package/dist/InternationalizationProvider/index.d.ts +1 -1
  36. package/dist/InternationalizationProvider/index.js +1 -1
  37. package/dist/{InternationalizationProvider-Dr5GE6f0.js → InternationalizationProvider-Ddo_-tLK.js} +1 -1
  38. package/dist/Link/index.d.ts +1 -1
  39. package/dist/{MediaTheme-Bkj-_DFN.js → MediaTheme-DfcdEWx-.js} +2 -36
  40. package/dist/MoreMenu/index.d.ts +1 -1
  41. package/dist/MultiSelector/index.d.ts +1 -1
  42. package/dist/NumberInput/index.d.ts +1 -1
  43. package/dist/NumberInput/index.js +1 -1
  44. package/dist/{NumberInput-BPeesTRv.js → NumberInput-BsWTXomE.js} +2 -23
  45. package/dist/OverflowList/index.d.ts +1 -1
  46. package/dist/PowerSearch/index.d.ts +1 -1
  47. package/dist/PowerSearch/index.js +1 -1
  48. package/dist/{PowerSearch-BAOqpQag.js → PowerSearch-CDEn08Pe.js} +6 -6
  49. package/dist/Radio/index.d.ts +1 -1
  50. package/dist/RadioList/index.d.ts +1 -1
  51. package/dist/ScrollableArea/index.d.ts +1 -1
  52. package/dist/SelectableCard/index.d.ts +1 -1
  53. package/dist/Selector/index.d.ts +1 -1
  54. package/dist/SideNav/index.d.ts +1 -1
  55. package/dist/Switch/index.d.ts +1 -1
  56. package/dist/Table/index.d.ts +1 -1
  57. package/dist/Table/index.js +1 -1
  58. package/dist/{Table-CRKljXg4.js → Table-WukSceMV.js} +376 -5
  59. package/dist/TextArea/index.d.ts +1 -1
  60. package/dist/TextInput/index.d.ts +1 -1
  61. package/dist/Theme/index.js +3 -2
  62. package/dist/{Theme-iqi6AvU_.js → Theme-1RJVaRgz.js} +3 -38
  63. package/dist/{TimeField-CBWgdA1Y.js → TimeField-BM-rVFhC.js} +419 -140
  64. package/dist/TimeInput/index.d.ts +2 -2
  65. package/dist/TimeInput/index.js +1 -1
  66. package/dist/{TimeInput-8ASOMV3B.js → TimeInput-CkZfhhAr.js} +28 -8
  67. package/dist/Timer/index.d.ts +1 -1
  68. package/dist/Timer/index.js +1 -1
  69. package/dist/{Timer-C8evnsTE.js → Timer-DiIs5GLA.js} +24 -15
  70. package/dist/Timestamp/index.d.ts +1 -1
  71. package/dist/Timestamp/index.js +1 -1
  72. package/dist/{Timestamp-CgvZe6vH.js → Timestamp-D9Jyk9sD.js} +152 -96
  73. package/dist/Toast/index.js +1 -1
  74. package/dist/{Toast-CzbqvHDN.js → Toast-D4Q6wvYu.js} +1 -1
  75. package/dist/ToggleButton/index.d.ts +1 -1
  76. package/dist/Token/index.d.ts +1 -1
  77. package/dist/Toolbar/index.d.ts +1 -1
  78. package/dist/Tooltip/index.d.ts +1 -1
  79. package/dist/TopNav/index.d.ts +1 -1
  80. package/dist/TreeList/index.d.ts +1 -1
  81. package/dist/TreeList/index.js +1 -1
  82. package/dist/{TreeList-CNj4KnHH.js → TreeList-ugSF9DWj.js} +117 -2
  83. package/dist/composables/index.d.ts +3 -2
  84. package/dist/composables/index.js +3 -3
  85. package/dist/{composables-BKHcPgN0.js → composables-BgfubKnk.js} +39 -332
  86. package/dist/{format-CMHyAMn3.js → format-mffyPc-L.js} +34 -4
  87. package/dist/handle-BPXdHbkr.js +458 -0
  88. package/dist/{index-9eluGe3a.d.ts → index-BA8exXNP.d.ts} +2 -1
  89. package/dist/{index-tuNsmJxw.d.ts → index-BLnvQ4Oj.d.ts} +9 -2
  90. package/dist/{index-B0iRA00v.d.ts → index-BapQGST1.d.ts} +2 -2
  91. package/dist/{index-D31bgBoy.d.ts → index-BdZCLUgY.d.ts} +1 -1
  92. package/dist/{index-DK0Wdo9N.d.ts → index-C9OzEvE_.d.ts} +3 -3
  93. package/dist/{index-CbA8rR_b.d.ts → index-CBOv5j3c.d.ts} +1 -1
  94. package/dist/{index-CMLnSg3T.d.ts → index-CKnr0JlT.d.ts} +7 -0
  95. package/dist/{index-C1qJlC65.d.ts → index-CQ-sq76o.d.ts} +1 -1
  96. package/dist/{index-85RFPeV0.d.ts → index-CULdl3Dg.d.ts} +3 -3
  97. package/dist/{index-BxWCX2pJ.d.ts → index-DFLPv9io.d.ts} +3 -3
  98. package/dist/{index-DofC9Rll.d.ts → index-Otl047R1.d.ts} +1 -1
  99. package/dist/{index-BKnyTWPM.d.ts → index-ZbNwGVkS.d.ts} +1 -1
  100. package/dist/{index-DYabo8TI.d.ts → index-eCp-ElSp.d.ts} +1 -1
  101. package/dist/{index-B95VIgRl.d.ts → index-t27MvEzT.d.ts} +70 -23
  102. package/dist/{index-wY6dKz6c.d.ts → index-yQc-te9a.d.ts} +7 -0
  103. package/dist/index.d.ts +19 -18
  104. package/dist/index.js +25 -24
  105. package/dist/landing-Bs0aMIsR.js +2049 -0
  106. package/dist/{loadCatalog-BJwcyX8i.d.ts → loadCatalog-C4h9SmJs.d.ts} +2 -0
  107. package/dist/{loadCatalog-C1kms5sO.js → loadCatalog-DsEKSY3U.js} +5 -1
  108. package/dist/locale/index.d.ts +2 -2
  109. package/dist/locale/index.js +4 -4
  110. package/dist/{locale-CHhsd9Mq.js → locale-C-Y-13BP.js} +1 -1
  111. package/dist/motionTokenDefaults-EFzpiAF5.js +38 -0
  112. package/dist/timeFormat-CqrwFE42.js +203 -0
  113. package/dist/{timestamp-BMYQsFDj.js → timestamp-saJUedIU.js} +4 -2
  114. package/dist/tokenName-0U-WEH09.js +36 -0
  115. package/dist/unicodeDigits-_BYIJcAu.js +46 -0
  116. package/dist/useAnimatedLayout-C0koWm4a.d.ts +56 -0
  117. package/dist/{useTimeValue-_XW9g2V1.js → useTimeValue-CcKrnO8z.js} +13 -6
  118. package/package.json +1 -1
  119. package/styles/calendar.css +5 -1
  120. package/styles/table.css +19 -0
  121. package/styles/timestamp.css +22 -10
  122. package/dist/{index-D8lv2BiD.d.ts → index-J6YRJ7Ul.d.ts} +1 -1
@@ -8,15 +8,17 @@ import { t as useButtonTooltip } from "./useButtonTooltip-DjCaZMp_.js";
8
8
  import { t as useMediaQuery } from "./useMediaQuery-BzXGT1Aw.js";
9
9
  import { t as _sfc_main$6 } from "./FieldIcon-DMtfe1Ne.js";
10
10
  import { t as _sfc_main$7 } from "./IconButton-Du2XBBAX.js";
11
- import { o as useComponentMessages } from "./context-B8IEFCDR.js";
12
- import { a as parseISOTime, i as parseDisplayTime, n as formatISOTime, o as resolveTimeSurface, r as isTimeInRange, s as shiftTime, t as formatDisplayTime } from "./useTimeValue-_XW9g2V1.js";
11
+ import { a as useAstryxLocale, o as useComponentMessages } from "./context-B8IEFCDR.js";
12
+ import { a as resolveHourFormat, r as isLocaleTimeComplete } from "./timeFormat-CqrwFE42.js";
13
+ import { a as parseISOTime, i as parseDisplayTime, n as formatISOTime, o as resolveTimeSurface, r as isTimeInRange, s as shiftTime, t as formatDisplayTime } from "./useTimeValue-CcKrnO8z.js";
13
14
  import { t as useScrollbars } from "./useScrollbars-Ch0xqJWO.js";
14
15
  import { t as _sfc_main$8 } from "./Spinner-DEVPDsD0.js";
15
- import { i as useAriaRequired } from "./context-DsNhYm5O.js";
16
+ import { a as useEntryErrorBehavior, i as useAriaRequired } from "./context-DsNhYm5O.js";
17
+ import { t as useBusyAnnouncement } from "./busyAnnouncement-CExubuYm.js";
16
18
  import { t as dateInputMessages } from "./date-input-rUD8YAow.js";
17
19
  import { t as _sfc_main$9 } from "./PickerWheel-DNX3yrUd.js";
18
20
  import { n as dateTimeInputMessages, t as timeInputMessages } from "./time-input-CKOsh84E.js";
19
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, openBlock, renderList, shallowRef, toDisplayString, unref, useAttrs, useId, useModel, useTemplateRef, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
21
+ import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onScopeDispose, openBlock, ref, renderList, shallowRef, toDisplayString, unref, useAttrs, useId, useModel, useTemplateRef, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
20
22
  import "../styles/layer.css";
21
23
  import "../styles/date-input.css";
22
24
  import "../styles/bordered-control.css";
@@ -27,7 +29,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
27
29
  __name: "TouchTimeWheels",
28
30
  props: {
29
31
  modelValue: { default: null },
30
- hourFormat: { default: "12h" },
32
+ hourFormat: {},
31
33
  hasSeconds: {
32
34
  type: Boolean,
33
35
  default: false
@@ -40,6 +42,8 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
40
42
  const props = __props;
41
43
  const emit = __emit;
42
44
  const messages = useComponentMessages({ dateTimeInput: dateTimeInputMessages });
45
+ const locale = useAstryxLocale();
46
+ const hourFormat = computed(() => resolveHourFormat(locale.value, props.hourFormat));
43
47
  const parsed = computed(() => props.modelValue ? parseISOTime(props.modelValue) : null);
44
48
  const hour24 = computed(() => parsed.value?.hours ?? 0);
45
49
  const minute = computed(() => parsed.value?.minutes ?? 0);
@@ -80,7 +84,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
80
84
  return pm ? hour + 12 : hour;
81
85
  }
82
86
  const hourOptions = computed(() => {
83
- if (props.hourFormat === "24h") return Array.from({ length: 24 }, (_, hour) => ({
87
+ if (hourFormat.value === "24h") return Array.from({ length: 24 }, (_, hour) => ({
84
88
  value: String(hour),
85
89
  label: String(hour).padStart(2, "0"),
86
90
  disabled: !hourAllowed(hour)
@@ -114,7 +118,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
114
118
  disabled: !hourAllowed(from12(hour12.value, true))
115
119
  }]);
116
120
  function onHour(value) {
117
- commit(props.hourFormat === "24h" ? Number(value) : from12(Number(value), isPm.value), minute.value, second.value);
121
+ commit(hourFormat.value === "24h" ? Number(value) : from12(Number(value), isPm.value), minute.value, second.value);
118
122
  }
119
123
  function onMeridiem(value) {
120
124
  commit(from12(hour12.value, value === "pm"), minute.value, second.value);
@@ -124,7 +128,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
124
128
  createVNode(_sfc_main$9, {
125
129
  label: unref(messages).dateTimeInput.hourWheel,
126
130
  options: hourOptions.value,
127
- "model-value": __props.hourFormat === "24h" ? String(hour24.value) : String(hour12.value),
131
+ "model-value": hourFormat.value === "24h" ? String(hour24.value) : String(hour12.value),
128
132
  "onUpdate:modelValue": onHour
129
133
  }, null, 8, [
130
134
  "label",
@@ -152,7 +156,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
152
156
  "options",
153
157
  "model-value"
154
158
  ])) : createCommentVNode("v-if", true),
155
- __props.hourFormat === "12h" ? (openBlock(), createBlock(_sfc_main$9, {
159
+ hourFormat.value === "12h" ? (openBlock(), createBlock(_sfc_main$9, {
156
160
  key: 1,
157
161
  label: unref(messages).dateTimeInput.meridiemWheel,
158
162
  options: meridiemOptions.value,
@@ -168,6 +172,296 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
168
172
  }
169
173
  });
170
174
  //#endregion
175
+ //#region src/TimeInput/useTimePresetOptions.ts
176
+ /**
177
+ * 时钟图标下的预设时间列表:按间隔生成可选时间,方向键和 Enter 在输入框里代管,
178
+ * 列表挂在字段下方,点到字段或列表里不关,点别处或按 Escape 关。
179
+ */
180
+ function useTimePresetOptions(input) {
181
+ const timeOptions = computed(() => {
182
+ const interval = input.interval();
183
+ if (interval == null || interval <= 0) return [];
184
+ const options = [];
185
+ for (let minutes = 0; minutes < 1440; minutes += interval) {
186
+ const value = formatISOTime({
187
+ hours: Math.floor(minutes / 60),
188
+ minutes: minutes % 60,
189
+ seconds: 0
190
+ }, input.hasSeconds());
191
+ if (isTimeInRange(value, input.min(), input.max())) options.push(value);
192
+ }
193
+ return options;
194
+ });
195
+ const showsOptions = computed(() => timeOptions.value.length > 0);
196
+ const isOptionsOpen = shallowRef(false);
197
+ const activeOption = shallowRef(-1);
198
+ const position = usePositionedLayer({
199
+ anchor: input.container,
200
+ layer: input.list,
201
+ isOpen: isOptionsOpen,
202
+ placement: computed(() => "below"),
203
+ alignment: computed(() => "start"),
204
+ gap: 4
205
+ });
206
+ const optionsStyle = computed(() => ({
207
+ top: `${position.position.value.top}px`,
208
+ left: `${position.position.value.left}px`
209
+ }));
210
+ function closeOptions() {
211
+ isOptionsOpen.value = false;
212
+ activeOption.value = -1;
213
+ }
214
+ useDismiss({
215
+ container: input.list,
216
+ trigger: input.container,
217
+ isEnabled: isOptionsOpen,
218
+ dismissOnEscape: "ignore",
219
+ onDismiss: closeOptions
220
+ });
221
+ function scrollActiveOption() {
222
+ const layer = input.list.value;
223
+ const index = activeOption.value;
224
+ if (!layer || index < 0) return;
225
+ const option = layer.querySelector(`[data-option-index="${index}"]`);
226
+ if (!option) return;
227
+ const layerRect = layer.getBoundingClientRect();
228
+ const optionRect = option.getBoundingClientRect();
229
+ if (optionRect.top < layerRect.top) layer.scrollTop -= layerRect.top - optionRect.top;
230
+ else if (optionRect.bottom > layerRect.bottom) layer.scrollTop += optionRect.bottom - layerRect.bottom;
231
+ }
232
+ function openOptions() {
233
+ if (input.isLocked() || !showsOptions.value || isOptionsOpen.value) return;
234
+ const value = input.value();
235
+ activeOption.value = value == null ? -1 : timeOptions.value.indexOf(value);
236
+ isOptionsOpen.value = true;
237
+ nextTick(scrollActiveOption);
238
+ }
239
+ function moveActive(step) {
240
+ const total = timeOptions.value.length;
241
+ if (total === 0) return;
242
+ const current = activeOption.value < 0 ? step > 0 ? -1 : total : activeOption.value;
243
+ activeOption.value = (current + step + total) % total;
244
+ nextTick(scrollActiveOption);
245
+ }
246
+ function selectOption(index) {
247
+ const value = timeOptions.value[index];
248
+ if (value == null || input.isLocked()) return;
249
+ input.commit(value);
250
+ closeOptions();
251
+ input.focusInput();
252
+ }
253
+ return {
254
+ timeOptions,
255
+ showsOptions,
256
+ isOptionsOpen,
257
+ activeOption,
258
+ optionsStyle,
259
+ openOptions,
260
+ closeOptions,
261
+ moveActive,
262
+ selectOption
263
+ };
264
+ }
265
+ //#endregion
266
+ //#region src/TimeInput/useTypedTime.ts
267
+ /**
268
+ * 时间文本框的打字状态:显示的文字、拒绝和提交。
269
+ *
270
+ * 一段文字只有小时、分钟(带秒时还有秒)都齐了、12 小时制还写了上下午才算完整(0 点和 13 到 23 点不用写)。
271
+ * 没打完的时候什么都不标、不念;完整却超出 `min` / `max` 的时间立刻亮出来(`complete` 下),
272
+ * 读不成时间的文字等 Enter 或失焦。拒绝亮出来时文字留在框里,字段显示为什么不收,
273
+ * `aria-invalid`,并且只念一次。之后的编辑让文字仍然不对或没打完时,拒绝继续亮着;
274
+ * 改成能收的时间或清空时立刻消失。
275
+ */
276
+ function useTypedTime(options) {
277
+ /** 打进来的文字;`null` 表示框里显示已提交的值。 */
278
+ const pending = ref(null);
279
+ /** Enter 或失焦留下了被拒的文字。 */
280
+ const isRejectionCommitted = ref(false);
281
+ /** 一次编辑让文字仍然被拒或没打完时,继续亮着的那段被拒文字。 */
282
+ const keptText = ref(null);
283
+ const isFocused = ref(false);
284
+ /** 系统时间控件被拒的那次编辑。 */
285
+ const native = shallowRef(null);
286
+ /** 这一轮打字已经报过的时间,同一个时间只报一次。 */
287
+ let reported = null;
288
+ /** Enter 或失焦刚刚留下被拒的文字。这一刻传进来的新值不顶掉文字,调用方可以在这里恢复自己的值。 */
289
+ let isRevealing = false;
290
+ function parse(text) {
291
+ const locale = options.locale();
292
+ const hasSeconds = options.hasSeconds();
293
+ const isComplete = isLocaleTimeComplete(text, locale, options.hourFormat(), hasSeconds);
294
+ const time = parseDisplayTime(text, hasSeconds, locale);
295
+ if (time == null) return {
296
+ kind: "unreadable",
297
+ isComplete
298
+ };
299
+ return {
300
+ kind: isTimeInRange(time, options.min(), options.max()) ? "value" : "outOfRange",
301
+ time,
302
+ isComplete
303
+ };
304
+ }
305
+ /** 这个结果此刻亮出来的拒绝:Enter 或失焦提交过的文字的错,或者 `complete` 下一个已经完整的时间的错。 */
306
+ function errorKind(result, isCommitted) {
307
+ if (result == null) return null;
308
+ if (result.kind === "unreadable") return isCommitted ? "unreadable" : null;
309
+ if (result.kind === "outOfRange" && (isCommitted || result.isComplete && options.behavior() === "complete")) return "outOfRange";
310
+ return null;
311
+ }
312
+ function isAccepted(result) {
313
+ return result.kind === "value" && result.isComplete;
314
+ }
315
+ const committedText = computed(() => {
316
+ const value = options.value();
317
+ return value ? options.formatCommitted(value) : "";
318
+ });
319
+ const displayValue = computed(() => pending.value ?? committedText.value);
320
+ const typed = computed(() => pending.value !== null && pending.value.trim() ? parse(pending.value) : null);
321
+ const ownError = computed(() => errorKind(typed.value, isRejectionCommitted.value));
322
+ const shown = computed(() => {
323
+ if (options.isLocked()) return null;
324
+ if (ownError.value != null && typed.value != null && pending.value !== null) return {
325
+ text: pending.value,
326
+ result: typed.value
327
+ };
328
+ if (keptText.value === null || typed.value == null || isAccepted(typed.value)) return null;
329
+ const kept = parse(keptText.value);
330
+ return errorKind(kept, true) != null ? {
331
+ text: keptText.value,
332
+ result: kept
333
+ } : null;
334
+ });
335
+ const nativeShown = computed(() => options.isLocked() ? null : native.value);
336
+ const entryError = computed(() => {
337
+ if (shown.value) {
338
+ const { result, text } = shown.value;
339
+ return result.kind === "unreadable" ? {
340
+ kind: "unreadable",
341
+ text
342
+ } : {
343
+ kind: "outOfRange",
344
+ text,
345
+ time: result.time
346
+ };
347
+ }
348
+ return nativeShown.value ? {
349
+ kind: "outOfRange",
350
+ text: nativeShown.value.text,
351
+ time: nativeShown.value.time
352
+ } : null;
353
+ });
354
+ const message = computed(() => {
355
+ if (entryError.value == null) return null;
356
+ const messages = options.messages();
357
+ return entryError.value.kind === "unreadable" ? messages.invalidTime : messages.outOfRange;
358
+ });
359
+ const callerError = computed(() => {
360
+ const status = options.status();
361
+ return status?.type === "error" && status.message ? status.message : null;
362
+ });
363
+ const fieldStatus = computed(() => message.value != null && callerError.value == null ? {
364
+ type: "error",
365
+ message: message.value
366
+ } : options.status());
367
+ const repeat = shallowRef(null);
368
+ watch(() => message.value != null, (rejected) => {
369
+ repeat.value = rejected ? callerError.value : null;
370
+ });
371
+ watch(callerError, (next) => {
372
+ if (repeat.value !== null && repeat.value !== next) repeat.value = null;
373
+ });
374
+ const alertMessage = computed(() => message.value != null && repeat.value != null && repeat.value === callerError.value ? repeat.value : "");
375
+ function sameError(a, b) {
376
+ return a === b || a != null && b != null && a.kind === b.kind && a.text === b.text && a.time === b.time;
377
+ }
378
+ let lastReport = null;
379
+ watch(entryError, (next) => {
380
+ if (sameError(next, lastReport)) return;
381
+ lastReport = next;
382
+ options.reportEntryError(next);
383
+ });
384
+ onScopeDispose(() => {
385
+ if (lastReport != null) options.reportEntryError(null);
386
+ });
387
+ function reset() {
388
+ pending.value = null;
389
+ isRejectionCommitted.value = false;
390
+ keptText.value = null;
391
+ native.value = null;
392
+ reported = null;
393
+ }
394
+ function report(time) {
395
+ if (time === options.value() || time === reported) return;
396
+ reported = time;
397
+ options.commitValue(time);
398
+ }
399
+ function onInput(text) {
400
+ if (options.isLocked()) return;
401
+ const result = parse(text);
402
+ const isEmpty = !text.trim();
403
+ const isRejected = !isEmpty && errorKind(result, false) != null;
404
+ const shownText = shown.value?.text ?? null;
405
+ keptText.value = isRejected || isEmpty || isAccepted(result) ? null : shownText;
406
+ pending.value = text;
407
+ isRejectionCommitted.value = false;
408
+ native.value = null;
409
+ if (result.kind === "value" && result.isComplete) report(result.time);
410
+ }
411
+ function commit() {
412
+ if (pending.value === null || options.isLocked()) return;
413
+ if (!pending.value.trim()) {
414
+ if (options.value()) options.commitValue(null);
415
+ reset();
416
+ return;
417
+ }
418
+ const result = parse(pending.value);
419
+ if (result.kind !== "value") {
420
+ isRejectionCommitted.value = true;
421
+ keptText.value = null;
422
+ isRevealing = true;
423
+ nextTick(() => {
424
+ isRevealing = false;
425
+ });
426
+ return;
427
+ }
428
+ report(result.time);
429
+ reported = null;
430
+ reset();
431
+ }
432
+ watch(() => options.value() ?? null, (time) => {
433
+ if (time !== null && time === reported) return;
434
+ reported = null;
435
+ native.value = null;
436
+ if (pending.value !== null && !isRevealing) reset();
437
+ });
438
+ watch(options.isLocked, (locked) => {
439
+ const result = typed.value;
440
+ if (locked || isFocused.value || result?.kind !== "value" || result.time !== reported) return;
441
+ reset();
442
+ });
443
+ return {
444
+ displayValue,
445
+ fieldStatus,
446
+ message,
447
+ isInvalid: computed(() => entryError.value != null),
448
+ alertMessage,
449
+ onInput,
450
+ commit,
451
+ onFocus: () => {
452
+ isFocused.value = true;
453
+ },
454
+ onBlur: () => {
455
+ isFocused.value = false;
456
+ commit();
457
+ },
458
+ reset,
459
+ rejectNative: (rejection) => {
460
+ native.value = rejection;
461
+ }
462
+ };
463
+ }
464
+ //#endregion
171
465
  //#region src/TimeInput/TimeField.vue
172
466
  const _hoisted_1 = [
173
467
  "data-size",
@@ -218,13 +512,19 @@ const _hoisted_4 = [
218
512
  "aria-describedby",
219
513
  "aria-required",
220
514
  "aria-invalid",
515
+ "name",
221
516
  "aria-expanded",
222
517
  "aria-controls",
223
518
  "aria-autocomplete",
224
519
  "aria-activedescendant"
225
520
  ];
226
- const _hoisted_5 = ["aria-label"];
227
- const _hoisted_6 = [
521
+ const _hoisted_5 = ["name", "value"];
522
+ const _hoisted_6 = {
523
+ class: "astryx-date-input-alert",
524
+ role: "alert"
525
+ };
526
+ const _hoisted_7 = ["aria-label"];
527
+ const _hoisted_8 = [
228
528
  "id",
229
529
  "aria-selected",
230
530
  "data-option-index",
@@ -240,7 +540,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
240
540
  describedBy: {},
241
541
  labelledBy: {},
242
542
  placeholder: {},
243
- hourFormat: { default: "12h" },
543
+ hourFormat: {},
244
544
  hasSeconds: {
245
545
  type: Boolean,
246
546
  default: false
@@ -265,6 +565,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
265
565
  optionsLabel: {},
266
566
  disabledMessage: {},
267
567
  status: {},
568
+ entryErrorBehavior: {},
268
569
  controlClass: { type: [
269
570
  Boolean,
270
571
  null,
@@ -283,9 +584,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
283
584
  "modelValue": { default: null },
284
585
  "modelModifiers": {}
285
586
  }),
286
- emits: ["update:modelValue"],
287
- setup(__props) {
587
+ emits: /*@__PURE__*/ mergeModels(["entryErrorChange", "messageChange"], ["update:modelValue"]),
588
+ setup(__props, { emit: __emit }) {
288
589
  const props = __props;
590
+ const emit = __emit;
289
591
  const model = useModel(__props, "modelValue");
290
592
  const attrs = useAttrs();
291
593
  const ariaRequired = useAriaRequired(props);
@@ -293,10 +595,12 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
293
595
  dateInput: dateInputMessages,
294
596
  timeInput: timeInputMessages
295
597
  });
598
+ const locale = useAstryxLocale();
599
+ const hourFormat = computed(() => resolveHourFormat(locale.value, props.hourFormat));
600
+ const entryErrorBehavior = useEntryErrorBehavior(() => props.entryErrorBehavior);
296
601
  const sheetOpen = shallowRef(false);
297
602
  const coarse = useMediaQuery("(pointer: coarse)");
298
603
  const focused = shallowRef(false);
299
- const draft = shallowRef("");
300
604
  const container = useTemplateRef("container");
301
605
  const optionsRef = useTemplateRef("options");
302
606
  useScrollbars(optionsRef);
@@ -318,10 +622,35 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
318
622
  needsTypedField: props.optionInterval != null
319
623
  }));
320
624
  const clearLabel = computed(() => props.clearLabel ?? messages.value.timeInput.clear(props.label));
321
- const formatHint = computed(() => props.hourFormat === "24h" || props.hasSeconds ? messages.value.timeInput.formatHint24 : messages.value.timeInput.formatHint12);
322
- watch(() => model.value, (value) => {
323
- if (!focused.value) draft.value = value ? formatDisplayTime(value, props.hourFormat, props.hasSeconds) : "";
324
- }, { immediate: true });
625
+ const formatHint = computed(() => hourFormat.value === "24h" || props.hasSeconds ? messages.value.timeInput.formatHint24 : messages.value.timeInput.formatHint12);
626
+ function formatCommitted(value) {
627
+ return formatDisplayTime(value, hourFormat.value, props.hasSeconds, locale.value);
628
+ }
629
+ const typed = useTypedTime({
630
+ value: () => model.value,
631
+ locale: () => locale.value,
632
+ hourFormat: () => hourFormat.value,
633
+ hasSeconds: () => props.hasSeconds,
634
+ min: () => props.min,
635
+ max: () => props.max,
636
+ isLocked: () => locked.value,
637
+ behavior: () => entryErrorBehavior.value,
638
+ status: () => props.status,
639
+ messages: () => messages.value.timeInput,
640
+ commitValue: (value) => {
641
+ model.value = value;
642
+ },
643
+ formatCommitted,
644
+ reportEntryError: (error) => emit("entryErrorChange", error)
645
+ });
646
+ const status = typed.fieldStatus;
647
+ const draft = typed.displayValue;
648
+ watch(typed.message, (message) => emit("messageChange", message), { immediate: true });
649
+ watch(() => surface.value, () => typed.reset());
650
+ watch(() => props.isDisabled, (disabled) => {
651
+ if (disabled) typed.reset();
652
+ });
653
+ useBusyAnnouncement(() => busy.value, () => props.loadingLabel ?? messages.value.timeInput.loading, () => (surface.value === "sheet" && sheetOpen.value ? document.getElementById(sheetId) : null) ?? container.value);
325
654
  const shownPlaceholder = computed(() => {
326
655
  if (focused.value && !draft.value) return formatHint.value;
327
656
  return props.placeholder ?? messages.value.timeInput.placeholder;
@@ -329,23 +658,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
329
658
  function commit(value) {
330
659
  if (locked.value) return;
331
660
  model.value = value;
332
- draft.value = value ? formatDisplayTime(value, props.hourFormat, props.hasSeconds) : "";
333
- }
334
- function commitText(text) {
335
- if (!text.trim()) {
336
- commit(null);
337
- return;
338
- }
339
- const parsed = parseDisplayTime(text, props.hasSeconds);
340
- if (parsed == null || !isTimeInRange(parsed, props.min, props.max)) {
341
- draft.value = model.value ? formatDisplayTime(model.value, props.hourFormat, props.hasSeconds) : "";
342
- return;
343
- }
344
- commit(parsed);
661
+ typed.reset();
345
662
  }
346
663
  function onInput(event) {
347
- if (locked.value) return;
348
- draft.value = event.target.value;
664
+ typed.onInput(event.target.value);
349
665
  }
350
666
  function onNativeInput(event) {
351
667
  if (locked.value) return;
@@ -355,46 +671,35 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
355
671
  return;
356
672
  }
357
673
  const parsed = parseDisplayTime(value, props.hasSeconds);
358
- if (parsed == null || !isTimeInRange(parsed, props.min, props.max)) return;
674
+ if (parsed == null) return;
675
+ if (!isTimeInRange(parsed, props.min, props.max)) {
676
+ typed.rejectNative({
677
+ text: value,
678
+ time: parsed
679
+ });
680
+ return;
681
+ }
359
682
  commit(parsed);
360
683
  }
361
- const timeOptions = computed(() => {
362
- const interval = props.optionInterval;
363
- if (interval == null || interval <= 0) return [];
364
- const options = [];
365
- for (let minutes = 0; minutes < 1440; minutes += interval) {
366
- const value = formatISOTime({
367
- hours: Math.floor(minutes / 60),
368
- minutes: minutes % 60,
369
- seconds: 0
370
- }, props.hasSeconds);
371
- if (isTimeInRange(value, props.min, props.max)) options.push(value);
372
- }
373
- return options;
684
+ /** 系统时间控件失焦时回到已提交的时间,被拒的那次编辑仍然亮着。 */
685
+ function onNativeBlur(event) {
686
+ disabledTooltip.onBlur();
687
+ const input = event.target;
688
+ if (input instanceof HTMLInputElement) input.value = model.value ?? "";
689
+ }
690
+ const { timeOptions, showsOptions, isOptionsOpen, activeOption, optionsStyle, openOptions, closeOptions, moveActive, selectOption } = useTimePresetOptions({
691
+ interval: () => props.optionInterval,
692
+ hasSeconds: () => props.hasSeconds,
693
+ min: () => props.min,
694
+ max: () => props.max,
695
+ isLocked: () => locked.value,
696
+ value: () => model.value,
697
+ container,
698
+ list: optionsRef,
699
+ commit,
700
+ focusInput
374
701
  });
375
- const showsOptions = computed(() => timeOptions.value.length > 0);
376
702
  const resolvedOptionsLabel = computed(() => props.optionsLabel ?? `${props.label ?? messages.value.timeInput.placeholder} options`);
377
- const isOptionsOpen = shallowRef(false);
378
- const activeOption = shallowRef(-1);
379
- const optionsPosition = usePositionedLayer({
380
- anchor: container,
381
- layer: optionsRef,
382
- isOpen: isOptionsOpen,
383
- placement: computed(() => "below"),
384
- alignment: computed(() => "start"),
385
- gap: 4
386
- });
387
- const optionsStyle = computed(() => ({
388
- top: `${optionsPosition.position.value.top}px`,
389
- left: `${optionsPosition.position.value.left}px`
390
- }));
391
- useDismiss({
392
- container: optionsRef,
393
- trigger: container,
394
- isEnabled: isOptionsOpen,
395
- dismissOnEscape: "ignore",
396
- onDismiss: () => closeOptions()
397
- });
398
703
  function openSheet() {
399
704
  if (!locked.value) sheetOpen.value = true;
400
705
  }
@@ -419,9 +724,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
419
724
  else moveActive(event.key === "ArrowDown" ? 1 : -1);
420
725
  return;
421
726
  }
422
- if (event.key === "Enter" && isOptionsOpen.value) {
423
- event.preventDefault();
424
- if (activeOption.value >= 0) selectOption(activeOption.value);
727
+ if (event.key === "Enter") {
728
+ if (isOptionsOpen.value) {
729
+ event.preventDefault();
730
+ if (activeOption.value >= 0) selectOption(activeOption.value);
731
+ return;
732
+ }
733
+ typed.commit();
425
734
  return;
426
735
  }
427
736
  if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
@@ -432,10 +741,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
432
741
  }
433
742
  async function onBlur() {
434
743
  focused.value = false;
744
+ typed.onBlur();
435
745
  disabledTooltip.onBlur();
436
746
  if (surface.value === "text") {
437
- if (locked.value) draft.value = model.value ? formatDisplayTime(model.value, props.hourFormat, props.hasSeconds) : "";
438
- else commitText(draft.value);
439
747
  await nextTick();
440
748
  const input = container.value?.querySelector("input");
441
749
  if (input instanceof HTMLInputElement) input.value = draft.value;
@@ -443,6 +751,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
443
751
  }
444
752
  function onInputFocus(event) {
445
753
  focused.value = true;
754
+ typed.onFocus();
446
755
  disabledTooltip.onFocus(event);
447
756
  }
448
757
  function resolvedDescribedBy() {
@@ -452,45 +761,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
452
761
  if (locked.value) return;
453
762
  commit(null);
454
763
  }
455
- function optionIndexFor(value) {
456
- if (value == null) return -1;
457
- return timeOptions.value.indexOf(value);
458
- }
459
- function openOptions() {
460
- if (locked.value || !showsOptions.value || isOptionsOpen.value) return;
461
- activeOption.value = optionIndexFor(model.value);
462
- isOptionsOpen.value = true;
463
- nextTick(() => scrollActiveOption());
464
- }
465
- function closeOptions() {
466
- isOptionsOpen.value = false;
467
- activeOption.value = -1;
468
- }
469
- function scrollActiveOption() {
470
- const layer = optionsRef.value;
471
- const index = activeOption.value;
472
- if (!layer || index < 0) return;
473
- const option = layer.querySelector(`[data-option-index="${index}"]`);
474
- if (!option) return;
475
- const layerRect = layer.getBoundingClientRect();
476
- const optionRect = option.getBoundingClientRect();
477
- if (optionRect.top < layerRect.top) layer.scrollTop -= layerRect.top - optionRect.top;
478
- else if (optionRect.bottom > layerRect.bottom) layer.scrollTop += optionRect.bottom - layerRect.bottom;
479
- }
480
- function moveActive(step) {
481
- const total = timeOptions.value.length;
482
- if (total === 0) return;
483
- const current = activeOption.value < 0 ? step > 0 ? -1 : total : activeOption.value;
484
- activeOption.value = (current + step + total) % total;
485
- nextTick(() => scrollActiveOption());
486
- }
487
- function selectOption(index) {
488
- const value = timeOptions.value[index];
489
- if (value == null || locked.value) return;
490
- commit(value);
491
- closeOptions();
492
- focusInput();
493
- }
494
764
  function focusInput() {
495
765
  container.value?.querySelector("input")?.focus({ preventScroll: true });
496
766
  }
@@ -516,11 +786,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
516
786
  class: normalizeClass(["astryx-time-input astryx-bordered-control", __props.controlClass]),
517
787
  style: normalizeStyle(__props.controlStyle),
518
788
  "data-size": __props.size,
519
- "data-status": __props.status?.type,
789
+ "data-status": unref(status)?.type,
520
790
  "data-disabled": __props.isDisabled || void 0,
521
791
  "data-loading": busy.value || void 0,
522
792
  "data-presentation": surface.value === "sheet" ? "bottom-sheet" : surface.value === "native" ? "native" : "text",
523
- "data-options-open": isOptionsOpen.value || void 0,
793
+ "data-options-open": unref(isOptionsOpen) || void 0,
524
794
  onPointerenter: _cache[0] || (_cache[0] = (...args) => unref(disabledTooltip).onPointerEnter && unref(disabledTooltip).onPointerEnter(...args)),
525
795
  onPointerleave: _cache[1] || (_cache[1] = (...args) => unref(disabledTooltip).onPointerLeave && unref(disabledTooltip).onPointerLeave(...args)),
526
796
  onClick: onControlClick
@@ -545,8 +815,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
545
815
  "aria-labelledby": __props.labelledBy,
546
816
  "aria-describedby": resolvedDescribedBy(),
547
817
  "aria-required": unref(ariaRequired),
548
- "aria-invalid": __props.status?.type === "error" || void 0,
549
- onInput: onNativeInput
818
+ "aria-invalid": unref(status)?.type === "error" || void 0,
819
+ onInput: onNativeInput,
820
+ onBlur: onNativeBlur
550
821
  }), null, 16, _hoisted_2)) : surface.value === "sheet" ? (openBlock(), createElementBlock("input", mergeProps({ key: 1 }, unref(attrs), {
551
822
  id: __props.inputId,
552
823
  class: "astryx-time-input-control",
@@ -558,7 +829,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
558
829
  "aria-haspopup": "dialog",
559
830
  "aria-expanded": sheetOpen.value,
560
831
  "aria-controls": sheetId,
561
- value: draft.value,
832
+ value: unref(draft),
562
833
  placeholder: shownPlaceholder.value,
563
834
  "aria-disabled": __props.isDisabled || void 0,
564
835
  "aria-busy": busy.value || void 0,
@@ -566,7 +837,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
566
837
  "aria-labelledby": __props.labelledBy,
567
838
  "aria-describedby": resolvedDescribedBy(),
568
839
  "aria-required": unref(ariaRequired),
569
- "aria-invalid": __props.status?.type === "error" || void 0,
840
+ "aria-invalid": unref(status)?.type === "error" || void 0,
570
841
  onClick: openSheet,
571
842
  onKeydown: onSheetKeydown,
572
843
  onFocus: onInputFocus
@@ -576,21 +847,22 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
576
847
  type: "text",
577
848
  inputmode: "text",
578
849
  autocomplete: "off",
579
- value: draft.value,
850
+ value: unref(draft),
580
851
  placeholder: shownPlaceholder.value,
581
852
  readonly: __props.isReadOnly || busy.value || __props.isDisabled,
582
853
  "aria-disabled": __props.isDisabled || void 0,
583
854
  "aria-busy": busy.value || void 0,
584
- role: showsOptions.value ? "combobox" : void 0,
855
+ role: unref(showsOptions) ? "combobox" : void 0,
585
856
  "aria-label": __props.labelledBy ? void 0 : __props.label,
586
857
  "aria-labelledby": __props.labelledBy,
587
858
  "aria-describedby": resolvedDescribedBy(),
588
859
  "aria-required": unref(ariaRequired),
589
- "aria-invalid": __props.status?.type === "error" || void 0,
590
- "aria-expanded": showsOptions.value ? isOptionsOpen.value : void 0,
591
- "aria-controls": showsOptions.value ? listboxId : void 0,
592
- "aria-autocomplete": showsOptions.value ? "list" : void 0,
593
- "aria-activedescendant": isOptionsOpen.value && activeOption.value >= 0 ? `${listboxId}-option-${activeOption.value}` : void 0,
860
+ "aria-invalid": unref(status)?.type === "error" || void 0,
861
+ name: unref(typed).isInvalid.value ? void 0 : unref(attrs).name,
862
+ "aria-expanded": unref(showsOptions) ? unref(isOptionsOpen) : void 0,
863
+ "aria-controls": unref(showsOptions) ? listboxId : void 0,
864
+ "aria-autocomplete": unref(showsOptions) ? "list" : void 0,
865
+ "aria-activedescendant": unref(isOptionsOpen) && unref(activeOption) >= 0 ? `${listboxId}-option-${unref(activeOption)}` : void 0,
594
866
  onInput,
595
867
  onFocus: onInputFocus,
596
868
  onBlur,
@@ -611,21 +883,28 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
611
883
  busy.value ? (openBlock(), createBlock(_sfc_main$8, {
612
884
  key: 4,
613
885
  size: "sm",
614
- "aria-label": __props.loadingLabel ?? unref(messages).timeInput.loading
615
- }, null, 8, ["aria-label"])) : __props.status ? (openBlock(), createBlock(_sfc_main$6, {
886
+ "aria-hidden": "true"
887
+ })) : unref(status) ? (openBlock(), createBlock(_sfc_main$6, {
616
888
  key: 5,
617
- type: __props.status.type
889
+ type: unref(status).type
618
890
  }, null, 8, ["type"])) : createCommentVNode("v-if", true)
619
891
  ], 46, _hoisted_1),
620
- showsDisabledMessage.value ? (openBlock(), createBlock(_sfc_main$4, {
892
+ unref(typed).isInvalid.value && unref(attrs).name ? (openBlock(), createElementBlock("input", {
621
893
  key: 0,
894
+ type: "hidden",
895
+ name: unref(attrs).name,
896
+ value: model.value ? formatCommitted(model.value) : ""
897
+ }, null, 8, _hoisted_5)) : createCommentVNode("v-if", true),
898
+ createElementVNode("div", _hoisted_6, toDisplayString(unref(typed).alertMessage.value), 1),
899
+ showsDisabledMessage.value ? (openBlock(), createBlock(_sfc_main$4, {
900
+ key: 1,
622
901
  id: disabledMessageId
623
902
  }, {
624
903
  default: withCtx(() => [createTextVNode(toDisplayString(disabledMessage.value), 1)]),
625
904
  _: 1
626
905
  })) : createCommentVNode("v-if", true),
627
906
  showsDisabledMessage.value ? (openBlock(), createBlock(_sfc_main$5, {
628
- key: 1,
907
+ key: 2,
629
908
  id: `${disabledMessageId}-tooltip`,
630
909
  anchor: container.value,
631
910
  open: unref(disabledTooltip).isOpen.value,
@@ -641,7 +920,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
641
920
  "onPointerLeave"
642
921
  ])) : createCommentVNode("v-if", true),
643
922
  surface.value === "sheet" ? (openBlock(), createBlock(_sfc_main$2, {
644
- key: 2,
923
+ key: 3,
645
924
  "is-open": sheetOpen.value,
646
925
  "onUpdate:isOpen": _cache[3] || (_cache[3] = ($event) => sheetOpen.value = $event),
647
926
  label: __props.label || unref(messages).timeInput.placeholder,
@@ -653,7 +932,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
653
932
  class: "astryx-time-touch"
654
933
  }, [createVNode(_sfc_main$1, {
655
934
  "model-value": model.value,
656
- "hour-format": __props.hourFormat,
935
+ "hour-format": hourFormat.value,
657
936
  "has-seconds": __props.hasSeconds,
658
937
  min: __props.min,
659
938
  max: __props.max,
@@ -677,21 +956,21 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
677
956
  class: "astryx-time-input-options astryx-layer",
678
957
  role: "listbox",
679
958
  "aria-label": resolvedOptionsLabel.value,
680
- style: normalizeStyle(optionsStyle.value),
959
+ style: normalizeStyle(unref(optionsStyle)),
681
960
  tabindex: "-1"
682
- }, [createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events -- 选项不进 Tab 序,键盘由输入框代管。 "), (openBlock(true), createElementBlock(Fragment, null, renderList(timeOptions.value, (option, index) => {
961
+ }, [createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events -- 选项不进 Tab 序,键盘由输入框代管。 "), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeOptions), (option, index) => {
683
962
  return openBlock(), createElementBlock("div", {
684
963
  id: `${listboxId}-option-${index}`,
685
964
  key: option,
686
- class: normalizeClass(["astryx-time-input-option", { "is-active": index === activeOption.value }]),
965
+ class: normalizeClass(["astryx-time-input-option", { "is-active": index === unref(activeOption) }]),
687
966
  role: "option",
688
967
  "aria-selected": option === model.value ? "true" : "false",
689
968
  "data-option-index": index,
690
969
  tabindex: "-1",
691
970
  onMousedown: _cache[4] || (_cache[4] = withModifiers(() => {}, ["prevent"])),
692
- onClick: ($event) => selectOption(index)
693
- }, toDisplayString(unref(formatDisplayTime)(option, __props.hourFormat, __props.hasSeconds)), 43, _hoisted_6);
694
- }), 128))], 12, _hoisted_5), [[vShow, isOptionsOpen.value]])]))
971
+ onClick: ($event) => unref(selectOption)(index)
972
+ }, toDisplayString(unref(formatDisplayTime)(option, hourFormat.value, __props.hasSeconds, unref(locale))), 43, _hoisted_8);
973
+ }), 128))], 12, _hoisted_7), [[vShow, unref(isOptionsOpen)]])]))
695
974
  ], 64);
696
975
  };
697
976
  }