@mcistudio/unoui-vue 1.0.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 (187) hide show
  1. package/README.md +95 -0
  2. package/dist/alert/Alert.vue.d.ts +67 -0
  3. package/dist/alert/index.d.ts +40 -0
  4. package/dist/alert/index.js +2 -0
  5. package/dist/attrs.d.ts +11 -0
  6. package/dist/attrs.js +16 -0
  7. package/dist/attrs.js.map +1 -0
  8. package/dist/badge/Badge.vue.d.ts +57 -0
  9. package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
  10. package/dist/badge/index.d.ts +42 -0
  11. package/dist/badge/index.js +2 -0
  12. package/dist/build.d.ts +2 -0
  13. package/dist/button/Button.vue.d.ts +46 -0
  14. package/dist/button/ButtonGroup.vue.d.ts +13 -0
  15. package/dist/button/index.d.ts +13 -0
  16. package/dist/button/index.js +2 -0
  17. package/dist/checkbox/Checkbox.vue.d.ts +47 -0
  18. package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
  19. package/dist/checkbox/index.d.ts +30 -0
  20. package/dist/checkbox/index.js +2 -0
  21. package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
  22. package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
  23. package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
  24. package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
  25. package/dist/chunks/Table-DhXmuKQd.js +330 -0
  26. package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
  27. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  28. package/dist/chunks/alert-CczW_DKs.js +190 -0
  29. package/dist/chunks/alert-CczW_DKs.js.map +1 -0
  30. package/dist/chunks/badge-BHOZeImh.js +287 -0
  31. package/dist/chunks/badge-BHOZeImh.js.map +1 -0
  32. package/dist/chunks/button-pDObrN_X.js +168 -0
  33. package/dist/chunks/button-pDObrN_X.js.map +1 -0
  34. package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
  35. package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
  36. package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
  37. package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
  38. package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
  39. package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
  40. package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
  41. package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
  42. package/dist/chunks/dropdown-0l967g7D.js +329 -0
  43. package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
  44. package/dist/chunks/form-Qeqkd-HH.js +642 -0
  45. package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
  46. package/dist/chunks/input-BDOXVCrK.js +1281 -0
  47. package/dist/chunks/input-BDOXVCrK.js.map +1 -0
  48. package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
  49. package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
  50. package/dist/chunks/message-xPfuG0EX.js +107 -0
  51. package/dist/chunks/message-xPfuG0EX.js.map +1 -0
  52. package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
  53. package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
  54. package/dist/chunks/modal-D6l1iIvE.js +81 -0
  55. package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
  56. package/dist/chunks/pagination-Bc583AQX.js +265 -0
  57. package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
  58. package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
  59. package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
  60. package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
  61. package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
  62. package/dist/chunks/radio-DnYm59xH.js +477 -0
  63. package/dist/chunks/radio-DnYm59xH.js.map +1 -0
  64. package/dist/chunks/rate-0sme__Kb.js +309 -0
  65. package/dist/chunks/rate-0sme__Kb.js.map +1 -0
  66. package/dist/chunks/select-ChTfQM5u.js +417 -0
  67. package/dist/chunks/select-ChTfQM5u.js.map +1 -0
  68. package/dist/chunks/slider-C-W5GzTP.js +724 -0
  69. package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
  70. package/dist/chunks/splitter-CgfiXY65.js +524 -0
  71. package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
  72. package/dist/chunks/switch-BULGbODP.js +327 -0
  73. package/dist/chunks/switch-BULGbODP.js.map +1 -0
  74. package/dist/chunks/tab-Dxfg1_To.js +663 -0
  75. package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
  76. package/dist/chunks/tag-BYmNsrZC.js +167 -0
  77. package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
  78. package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
  79. package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
  80. package/dist/chunks/tooltip-DMhiAqto.js +242 -0
  81. package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
  82. package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
  83. package/dist/colorpicker/color.d.ts +56 -0
  84. package/dist/colorpicker/color.js +99 -0
  85. package/dist/colorpicker/color.js.map +1 -0
  86. package/dist/colorpicker/index.d.ts +12 -0
  87. package/dist/colorpicker/index.js +2 -0
  88. package/dist/config.d.ts +55 -0
  89. package/dist/config.js +260 -0
  90. package/dist/config.js.map +1 -0
  91. package/dist/datepicker/DatePicker.vue.d.ts +82 -0
  92. package/dist/datepicker/RangePicker.vue.d.ts +87 -0
  93. package/dist/datepicker/index.d.ts +59 -0
  94. package/dist/datepicker/index.js +2 -0
  95. package/dist/drawer/Drawer.vue.d.ts +86 -0
  96. package/dist/drawer/index.d.ts +23 -0
  97. package/dist/drawer/index.js +2 -0
  98. package/dist/dropdown/Dropdown.vue.d.ts +118 -0
  99. package/dist/dropdown/index.d.ts +2 -0
  100. package/dist/dropdown/index.js +2 -0
  101. package/dist/form/Form.vue.d.ts +170 -0
  102. package/dist/form/FormItem.vue.d.ts +83 -0
  103. package/dist/form/index.d.ts +176 -0
  104. package/dist/form/index.js +2 -0
  105. package/dist/index.d.ts +31 -0
  106. package/dist/index.js +32 -0
  107. package/dist/input/Autocomplete.vue.d.ts +121 -0
  108. package/dist/input/Input.vue.d.ts +142 -0
  109. package/dist/input/InputI18n.vue.d.ts +80 -0
  110. package/dist/input/InputTag.vue.d.ts +114 -0
  111. package/dist/input/index.d.ts +41 -0
  112. package/dist/input/index.js +2 -0
  113. package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
  114. package/dist/inputOtp/index.d.ts +21 -0
  115. package/dist/inputOtp/index.js +2 -0
  116. package/dist/message/MessageContainer.vue.d.ts +11 -0
  117. package/dist/message/index.d.ts +20 -0
  118. package/dist/message/index.js +2 -0
  119. package/dist/message/types.d.ts +25 -0
  120. package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
  121. package/dist/millercolumns/index.d.ts +39 -0
  122. package/dist/millercolumns/index.js +2 -0
  123. package/dist/modal/Modal.vue.d.ts +54 -0
  124. package/dist/modal/index.d.ts +2 -0
  125. package/dist/modal/index.js +2 -0
  126. package/dist/pagination/Pagination.vue.d.ts +70 -0
  127. package/dist/pagination/index.d.ts +12 -0
  128. package/dist/pagination/index.js +2 -0
  129. package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
  130. package/dist/popconfirm/index.d.ts +36 -0
  131. package/dist/popconfirm/index.js +2 -0
  132. package/dist/progress/Progress.vue.d.ts +64 -0
  133. package/dist/progress/index.d.ts +26 -0
  134. package/dist/progress/index.js +2 -0
  135. package/dist/qrcode/QRCode.vue.d.ts +87 -0
  136. package/dist/qrcode/index.d.ts +43 -0
  137. package/dist/qrcode/index.js +2 -0
  138. package/dist/qrcode/qr.d.ts +51 -0
  139. package/dist/qrcode/qrcodegen.d.ts +94 -0
  140. package/dist/radio/Radio.vue.d.ts +52 -0
  141. package/dist/radio/RadioGroup.vue.d.ts +44 -0
  142. package/dist/radio/index.d.ts +55 -0
  143. package/dist/radio/index.js +2 -0
  144. package/dist/rate/Rate.vue.d.ts +100 -0
  145. package/dist/rate/index.d.ts +38 -0
  146. package/dist/rate/index.js +2 -0
  147. package/dist/select/Select.vue.d.ts +129 -0
  148. package/dist/select/index.d.ts +33 -0
  149. package/dist/select/index.js +2 -0
  150. package/dist/skeleton/Skeleton.vue.d.ts +31 -0
  151. package/dist/skeleton/index.d.ts +2 -0
  152. package/dist/skeleton/index.js +2 -0
  153. package/dist/slider/Slider.vue.d.ts +81 -0
  154. package/dist/slider/index.d.ts +61 -0
  155. package/dist/slider/index.js +2 -0
  156. package/dist/splitter/Splitter.vue.d.ts +63 -0
  157. package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
  158. package/dist/splitter/index.d.ts +39 -0
  159. package/dist/splitter/index.js +2 -0
  160. package/dist/style.css +2 -0
  161. package/dist/switch/Switch.vue.d.ts +97 -0
  162. package/dist/switch/index.d.ts +31 -0
  163. package/dist/switch/index.js +2 -0
  164. package/dist/tab/TabPane.vue.d.ts +32 -0
  165. package/dist/tab/Tabs.vue.d.ts +87 -0
  166. package/dist/tab/index.d.ts +78 -0
  167. package/dist/tab/index.js +2 -0
  168. package/dist/table/Table.vue.d.ts +96 -0
  169. package/dist/table/index.d.ts +3 -0
  170. package/dist/table/index.js +2 -0
  171. package/dist/table/types.d.ts +35 -0
  172. package/dist/table/types.js +0 -0
  173. package/dist/tag/Tag.vue.d.ts +46 -0
  174. package/dist/tag/index.d.ts +11 -0
  175. package/dist/tag/index.js +2 -0
  176. package/dist/timepicker/TimePicker.vue.d.ts +92 -0
  177. package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
  178. package/dist/timepicker/index.d.ts +39 -0
  179. package/dist/timepicker/index.js +2 -0
  180. package/dist/tooltip/Tooltip.vue.d.ts +79 -0
  181. package/dist/tooltip/index.d.ts +14 -0
  182. package/dist/tooltip/index.js +2 -0
  183. package/dist/uno.d.ts +32 -0
  184. package/dist/uno.js +83 -0
  185. package/dist/uno.js.map +1 -0
  186. package/dist/utils/DnD.d.ts +38 -0
  187. package/package.json +115 -0
@@ -0,0 +1,1059 @@
1
+ import { r as e } from "./button-pDObrN_X.js";
2
+ import { getUiExposeAttrs as t } from "../attrs.js";
3
+ import { t as n } from "./dropdown-0l967g7D.js";
4
+ import { cva as r } from "class-variance-authority";
5
+ import { Fragment as i, computed as a, createBlock as ee, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as te, createVNode as l, defineComponent as u, mergeProps as ne, nextTick as re, normalizeClass as d, normalizeStyle as ie, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g, useAttrs as ae, watch as _, withCtx as v, withModifiers as oe } from "vue";
6
+ import { clsx as se } from "clsx";
7
+ import y from "dayjs";
8
+ import ce from "dayjs/plugin/customParseFormat";
9
+ //#region src/timepicker/TimePicker.vue?vue&type=script&setup=true&lang.ts
10
+ var le = ["tabindex", "aria-expanded"], b = ["title"], x = ["name", "value"], ue = { class: "flex shrink-0 items-center gap-1 pr-2 text-tertiary" }, S = {
11
+ class: "max-h-[224px] overflow-y-auto p-1",
12
+ "data-ui-timepicker-scroll": "true"
13
+ }, de = [
14
+ "data-ui-timepicker-value",
15
+ "data-ui-timepicker-selected",
16
+ "disabled",
17
+ "onClick"
18
+ ], C = {
19
+ class: "max-h-[224px] overflow-y-auto p-1",
20
+ "data-ui-timepicker-scroll": "true"
21
+ }, w = [
22
+ "data-ui-timepicker-value",
23
+ "data-ui-timepicker-selected",
24
+ "disabled",
25
+ "onClick"
26
+ ], T = {
27
+ class: "max-h-[224px] overflow-y-auto p-1",
28
+ "data-ui-timepicker-scroll": "true"
29
+ }, fe = [
30
+ "data-ui-timepicker-value",
31
+ "data-ui-timepicker-selected",
32
+ "disabled",
33
+ "onClick"
34
+ ], pe = {
35
+ key: 3,
36
+ class: "min-w-0"
37
+ }, E = {
38
+ class: "max-h-[224px] overflow-y-auto p-1",
39
+ "data-ui-timepicker-scroll": "true"
40
+ }, me = [
41
+ "data-ui-timepicker-value",
42
+ "data-ui-timepicker-selected",
43
+ "disabled",
44
+ "onClick"
45
+ ], D = {
46
+ key: 0,
47
+ class: "flex min-h-11 items-center justify-between gap-3 border-t border-medium px-3 py-2"
48
+ }, O = ["disabled"], k = { key: 1 }, he = { class: "flex min-w-0 items-center justify-end gap-2" }, ge = {
49
+ key: 0,
50
+ class: "min-w-0 truncate font-mono text-xs text-tertiary"
51
+ }, _e = "HH:mm:ss", ve = "h:mm:ss A", A = /* @__PURE__ */ u({
52
+ inheritAttrs: !1,
53
+ __name: "TimePicker",
54
+ props: {
55
+ modelValue: { default: void 0 },
56
+ format: { default: void 0 },
57
+ valueFormat: { default: void 0 },
58
+ placeholder: { default: "请选择时间" },
59
+ size: { default: "md" },
60
+ disabled: {
61
+ type: Boolean,
62
+ default: !1
63
+ },
64
+ clearable: {
65
+ type: Boolean,
66
+ default: !1
67
+ },
68
+ hourStep: { default: 1 },
69
+ minuteStep: { default: 1 },
70
+ secondStep: { default: 1 },
71
+ use12Hours: {
72
+ type: Boolean,
73
+ default: !1
74
+ },
75
+ showSecond: {
76
+ type: Boolean,
77
+ default: void 0
78
+ },
79
+ disabledTime: {
80
+ type: Function,
81
+ default: void 0
82
+ },
83
+ hideDisabledOptions: {
84
+ type: Boolean,
85
+ default: !1
86
+ },
87
+ needConfirm: {
88
+ type: Boolean,
89
+ default: !1
90
+ },
91
+ showNow: {
92
+ type: Boolean,
93
+ default: !0
94
+ },
95
+ suffixIcon: { default: "i-lucide:clock-3" },
96
+ clearIcon: { default: "i-lucide:x" },
97
+ teleportedWidth: { default: void 0 },
98
+ name: { default: void 0 }
99
+ },
100
+ emits: [
101
+ "update:modelValue",
102
+ "change",
103
+ "clear",
104
+ "ok",
105
+ "visible-change",
106
+ "focus",
107
+ "blur"
108
+ ],
109
+ setup(r, { expose: l, emit: u }) {
110
+ y.extend(ce);
111
+ let A = r, j = u, ye = ae(), M = p(!1), be = p(!1), N = p(null), xe = p(null), Se = p(null), Ce = p(!1), P = a(() => A.format || (A.use12Hours ? ve : _e)), we = a(() => B(P.value, /[HhKk]/) || !B(P.value, /[ms]/)), F = a(() => B(P.value, /m/)), I = a(() => A.showSecond ?? B(P.value, /s/)), L = a(() => A.use12Hours || B(P.value, /[aA]/)), Te = a(() => [
112
+ we.value,
113
+ F.value,
114
+ I.value,
115
+ L.value
116
+ ].filter(Boolean).length || 1), Ee = a(() => A.teleportedWidth || `${Math.max(168, Te.value * 64 + 16)}px`), R = a(() => Ve(A.modelValue)), z = a(() => N.value || R.value || U(y())), De = a(() => R.value?.format(P.value) || ""), Oe = a(() => R.value?.format(A.valueFormat || P.value) || ""), ke = a(() => !!R.value), Ae = a(() => A.clearable && ke.value && !A.disabled), je = a(() => z.value.hour() >= 12 ? "pm" : "am"), Me = a(() => J(U(y()))), Ne = a(() => se(ye.class, He({
117
+ size: A.size,
118
+ focused: M.value || be.value,
119
+ disabled: A.disabled
120
+ }))), Pe = a(() => ({ gridTemplateColumns: `repeat(${Te.value}, minmax(0, 1fr))` })), Fe = a(() => {
121
+ if (!we.value) return [];
122
+ let e = A.use12Hours ? Ke(z.value.hour()) : z.value.hour();
123
+ return Ge(G(A.use12Hours ? W(1, 12, A.hourStep) : W(0, 23, A.hourStep), e, A.use12Hours ? 12 : 23), "hour");
124
+ }), Ie = a(() => F.value ? Ge(G(W(0, 59, A.minuteStep), z.value.minute(), 59), "minute") : []), Le = a(() => I.value ? Ge(G(W(0, 59, A.secondStep), z.value.second(), 59), "second") : []), Re = a(() => [{
125
+ value: "am",
126
+ label: "AM",
127
+ disabled: J(q("meridiem", "am"))
128
+ }, {
129
+ value: "pm",
130
+ label: "PM",
131
+ disabled: J(q("meridiem", "pm"))
132
+ }]);
133
+ _(M, (e) => {
134
+ j("visible-change", e), e && (N.value = R.value, Z());
135
+ }), _(() => [P.value, A.showSecond], () => {
136
+ re(() => {
137
+ N.value &&= U(N.value);
138
+ });
139
+ }), _(() => A.modelValue, () => {
140
+ if (M.value) {
141
+ if (Ce.value) {
142
+ Ce.value = !1;
143
+ return;
144
+ }
145
+ Z();
146
+ }
147
+ });
148
+ function B(e, t) {
149
+ return t.test(e.replace(/\[[^\]]*]/g, ""));
150
+ }
151
+ function ze() {
152
+ return Array.from(new Set([
153
+ A.valueFormat,
154
+ P.value,
155
+ A.format,
156
+ _e,
157
+ "HH:mm",
158
+ "HH",
159
+ "H:mm:ss",
160
+ "H:mm",
161
+ ve,
162
+ "h:mm A",
163
+ "h:mm a",
164
+ "h:mm:ss a",
165
+ "YYYY-MM-DD HH:mm:ss",
166
+ "YYYY-MM-DD HH:mm"
167
+ ].filter(Boolean)));
168
+ }
169
+ function Be(e, t) {
170
+ for (let n of t) {
171
+ let t = y(e, n, !0);
172
+ if (t.isValid()) return t;
173
+ }
174
+ let n = y(e);
175
+ return n.isValid() ? n : null;
176
+ }
177
+ function V(e) {
178
+ if (e == null || e === "") return null;
179
+ if (y.isDayjs(e)) return e.isValid() ? U(e) : null;
180
+ if (e instanceof Date || typeof e == "number") {
181
+ let t = y(e);
182
+ return t.isValid() ? U(t) : null;
183
+ }
184
+ if (typeof e == "string") {
185
+ let t = Be(e, ze());
186
+ return t ? U(t) : null;
187
+ }
188
+ return null;
189
+ }
190
+ function Ve(e) {
191
+ return V(e);
192
+ }
193
+ function U(e) {
194
+ let t = e.millisecond(0);
195
+ return F.value || (t = t.minute(0)), I.value || (t = t.second(0)), t;
196
+ }
197
+ function We(e) {
198
+ let t = U(e);
199
+ return A.valueFormat ? t.format(A.valueFormat) : y.isDayjs(A.modelValue) ? t : A.modelValue instanceof Date ? t.toDate() : typeof A.modelValue == "number" ? t.valueOf() : t.format(P.value);
200
+ }
201
+ function W(e, t, n) {
202
+ let r = Number.isFinite(n) && n && n > 0 ? Math.floor(n) : 1, i = [];
203
+ for (let n = e; n <= t; n += r) i.push(n);
204
+ return i;
205
+ }
206
+ function G(e, t, n) {
207
+ let r = Math.min(n, Math.max(0, t));
208
+ return e.includes(r) ? e : [...e, r].sort((e, t) => e - t);
209
+ }
210
+ function Ge(e, t) {
211
+ return e.map((e) => ({
212
+ value: e,
213
+ label: String(e).padStart(2, "0"),
214
+ disabled: Je(t, e)
215
+ })).filter((e) => !(A.hideDisabledOptions && e.disabled));
216
+ }
217
+ function Ke(e) {
218
+ return e % 12 || 12;
219
+ }
220
+ function qe(e, t) {
221
+ return !A.use12Hours && !L.value ? e : t === "pm" ? e === 12 ? 12 : e + 12 : e === 12 ? 0 : e;
222
+ }
223
+ function K(e) {
224
+ return A.disabledTime?.(e) ?? {};
225
+ }
226
+ function q(e, t) {
227
+ let n = z.value;
228
+ if (e === "hour" && typeof t == "number") return U(n.hour(qe(t, je.value)));
229
+ if (e === "minute" && typeof t == "number") return U(n.minute(t));
230
+ if (e === "second" && typeof t == "number") return U(n.second(t));
231
+ if (e === "meridiem" && typeof t == "string") {
232
+ let e = n.hour();
233
+ if (t === "pm" && e < 12) return U(n.hour(e + 12));
234
+ if (t === "am" && e >= 12) return U(n.hour(e - 12));
235
+ }
236
+ return U(n);
237
+ }
238
+ function J(e) {
239
+ let t = K(e);
240
+ return !!(t.disabledHours?.().includes(e.hour()) || t.disabledMinutes?.(e.hour()).includes(e.minute()) || I.value && t.disabledSeconds?.(e.hour(), e.minute()).includes(e.second()));
241
+ }
242
+ function Je(e, t) {
243
+ let n = q(e, t);
244
+ return e === "hour" ? !!K(n).disabledHours?.().includes(n.hour()) : e === "minute" ? !!K(n).disabledMinutes?.(n.hour()).includes(n.minute()) : !!K(n).disabledSeconds?.(n.hour(), n.minute()).includes(n.second());
245
+ }
246
+ function Ye() {
247
+ Ce.value = !0, re(() => {
248
+ Ce.value = !1;
249
+ });
250
+ }
251
+ function Y(e, t, n = !1, r = !0) {
252
+ let i = U(e);
253
+ if (J(i)) return;
254
+ let a = We(i), ee = i.format(P.value);
255
+ N.value = i, !t && !r && Ye(), j("update:modelValue", a), j("change", a, ee), n && j("ok", a, ee), t ? M.value = !1 : r && Z();
256
+ }
257
+ function Xe(e) {
258
+ e?.stopPropagation(), N.value = null, j("update:modelValue", null), j("change", null, ""), j("clear"), M.value = !1;
259
+ }
260
+ function Ze(e, t) {
261
+ let n = q(e, t);
262
+ J(n) || (N.value = n, A.needConfirm || Y(n, !1, !1, !1));
263
+ }
264
+ function Qe() {
265
+ let e = U(y());
266
+ if (!J(e)) {
267
+ if (N.value = e, A.needConfirm) {
268
+ Z();
269
+ return;
270
+ }
271
+ Y(e, !1);
272
+ }
273
+ }
274
+ function $e() {
275
+ Y(N.value || R.value || y(), !0, !0);
276
+ }
277
+ function X(e, t) {
278
+ return e === "hour" && typeof t == "number" ? A.use12Hours ? Ke(z.value.hour()) === t : z.value.hour() === t : e === "minute" && typeof t == "number" ? z.value.minute() === t : e === "second" && typeof t == "number" ? z.value.second() === t : e === "meridiem" ? je.value === t : !1;
279
+ }
280
+ function et(e) {
281
+ A.disabled || (M.value = e);
282
+ }
283
+ function tt() {
284
+ et(!M.value);
285
+ }
286
+ function nt(e) {
287
+ e.key === "Enter" || e.key === " " || e.key === "ArrowDown" ? (e.preventDefault(), et(!0)) : e.key === "Escape" && (e.preventDefault(), et(!1));
288
+ }
289
+ function rt(e) {
290
+ be.value = !0, j("focus", e);
291
+ }
292
+ function it(e) {
293
+ be.value = !1, j("blur", e);
294
+ }
295
+ function at() {
296
+ xe.value?.focus();
297
+ }
298
+ function ot() {
299
+ xe.value?.blur();
300
+ }
301
+ function Z() {
302
+ re(() => {
303
+ (Se.value?.querySelectorAll("[data-ui-timepicker-scroll=\"true\"]"))?.forEach((e) => {
304
+ let t = e.querySelector("[data-ui-timepicker-selected=\"true\"]");
305
+ if (!t) return;
306
+ let n = t.offsetTop - (e.clientHeight - t.clientHeight) / 2, r = Math.max(0, n);
307
+ typeof e.scrollTo == "function" ? e.scrollTo({
308
+ top: r,
309
+ behavior: "auto"
310
+ }) : e.scrollTop = r;
311
+ });
312
+ });
313
+ }
314
+ return l({
315
+ blur: ot,
316
+ clear: Xe,
317
+ focus: at
318
+ }), (a, l) => (f(), ee(g(n), {
319
+ open: M.value,
320
+ "onUpdate:open": l[0] ||= (e) => M.value = e,
321
+ width: Ee.value,
322
+ "min-width": Ee.value,
323
+ "focus-on-open": !1,
324
+ "content-class": "ui-timepicker-dropdown"
325
+ }, {
326
+ trigger: v(() => [c("div", ne({
327
+ ref_key: "triggerRef",
328
+ ref: xe
329
+ }, g(t)(g(ye)), {
330
+ class: Ne.value,
331
+ style: g(ye).style,
332
+ "data-ui-timepicker": "true",
333
+ tabindex: r.disabled ? void 0 : 0,
334
+ role: "combobox",
335
+ "aria-expanded": M.value,
336
+ "aria-haspopup": "dialog",
337
+ onClick: oe(tt, ["stop"]),
338
+ onKeydown: nt,
339
+ onFocus: rt,
340
+ onBlur: it
341
+ }), [
342
+ c("span", {
343
+ class: d(g(Ue)({ size: r.size })),
344
+ title: De.value
345
+ }, [c("span", { class: d(De.value ? "text-primary" : "text-tertiary/60") }, h(De.value || r.placeholder), 3)], 10, b),
346
+ r.name ? (f(), s("input", {
347
+ key: 0,
348
+ type: "hidden",
349
+ name: r.name,
350
+ value: Oe.value
351
+ }, null, 8, x)) : o("", !0),
352
+ c("span", ue, [Ae.value ? (f(), s("button", {
353
+ key: 0,
354
+ type: "button",
355
+ "aria-label": "清空",
356
+ class: "flex size-4 items-center justify-center rounded-full bg-tertiary/90 text-tertiary/60 opacity-0 transition-all duration-150 hover:bg-tertiary hover:text-tertiary group-hover/ui-timepicker:opacity-100 group-focus-within/ui-timepicker:opacity-100",
357
+ onClick: Xe
358
+ }, [c("span", { class: d([r.clearIcon, "size-3"]) }, null, 2)])) : o("", !0), c("span", { class: d([r.suffixIcon, "size-4"]) }, null, 2)])
359
+ ], 16, le)]),
360
+ default: v(() => [c("div", {
361
+ ref_key: "panelRef",
362
+ ref: Se,
363
+ class: "select-none bg-primary text-primary"
364
+ }, [c("div", {
365
+ class: "grid",
366
+ style: ie(Pe.value)
367
+ }, [
368
+ we.value ? (f(), s("div", {
369
+ key: 0,
370
+ class: d(["min-w-0", F.value || I.value || L.value ? "border-r border-medium" : ""])
371
+ }, [l[1] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "时", -1), c("div", S, [(f(!0), s(i, null, m(Fe.value, (e) => (f(), s("button", {
372
+ key: e.value,
373
+ type: "button",
374
+ "data-ui-timepicker-unit": "hour",
375
+ "data-ui-timepicker-value": e.value,
376
+ "data-ui-timepicker-selected": X("hour", e.value) ? "true" : void 0,
377
+ class: d(g(H)({
378
+ selected: X("hour", e.value),
379
+ disabled: e.disabled
380
+ })),
381
+ disabled: e.disabled,
382
+ onClick: (t) => Ze("hour", e.value)
383
+ }, h(e.label), 11, de))), 128))])], 2)) : o("", !0),
384
+ F.value ? (f(), s("div", {
385
+ key: 1,
386
+ class: d(["min-w-0", I.value || L.value ? "border-r border-medium" : ""])
387
+ }, [l[2] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "分", -1), c("div", C, [(f(!0), s(i, null, m(Ie.value, (e) => (f(), s("button", {
388
+ key: e.value,
389
+ type: "button",
390
+ "data-ui-timepicker-unit": "minute",
391
+ "data-ui-timepicker-value": e.value,
392
+ "data-ui-timepicker-selected": X("minute", e.value) ? "true" : void 0,
393
+ class: d(g(H)({
394
+ selected: X("minute", e.value),
395
+ disabled: e.disabled
396
+ })),
397
+ disabled: e.disabled,
398
+ onClick: (t) => Ze("minute", e.value)
399
+ }, h(e.label), 11, w))), 128))])], 2)) : o("", !0),
400
+ I.value ? (f(), s("div", {
401
+ key: 2,
402
+ class: d(["min-w-0", L.value ? "border-r border-medium" : ""])
403
+ }, [l[3] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "秒", -1), c("div", T, [(f(!0), s(i, null, m(Le.value, (e) => (f(), s("button", {
404
+ key: e.value,
405
+ type: "button",
406
+ "data-ui-timepicker-unit": "second",
407
+ "data-ui-timepicker-value": e.value,
408
+ "data-ui-timepicker-selected": X("second", e.value) ? "true" : void 0,
409
+ class: d(g(H)({
410
+ selected: X("second", e.value),
411
+ disabled: e.disabled
412
+ })),
413
+ disabled: e.disabled,
414
+ onClick: (t) => Ze("second", e.value)
415
+ }, h(e.label), 11, fe))), 128))])], 2)) : o("", !0),
416
+ L.value ? (f(), s("div", pe, [l[4] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "午别", -1), c("div", E, [(f(!0), s(i, null, m(Re.value, (e) => (f(), s("button", {
417
+ key: e.value,
418
+ type: "button",
419
+ "data-ui-timepicker-unit": "meridiem",
420
+ "data-ui-timepicker-value": e.value,
421
+ "data-ui-timepicker-selected": X("meridiem", e.value) ? "true" : void 0,
422
+ class: d(g(H)({
423
+ selected: X("meridiem", e.value),
424
+ disabled: e.disabled
425
+ })),
426
+ disabled: e.disabled,
427
+ onClick: (t) => Ze("meridiem", e.value)
428
+ }, h(e.label), 11, me))), 128))])])) : o("", !0)
429
+ ], 4), r.showNow || r.needConfirm ? (f(), s("div", D, [r.showNow ? (f(), s("button", {
430
+ key: 0,
431
+ type: "button",
432
+ class: "text-xs text-brand-500 transition-colors hover:text-brand-600 disabled:pointer-events-none disabled:opacity-40",
433
+ disabled: Me.value,
434
+ onClick: Qe
435
+ }, "此刻", 8, O)) : (f(), s("span", k)), c("div", he, [r.needConfirm ? (f(), s("span", ge, h(z.value.format(P.value)), 1)) : o("", !0), r.needConfirm ? (f(), ee(g(e), {
436
+ key: 1,
437
+ size: "sm",
438
+ onClick: $e
439
+ }, {
440
+ default: v(() => [...l[5] ||= [te("确定", -1)]]),
441
+ _: 1
442
+ })) : o("", !0)])])) : o("", !0)], 512)]),
443
+ _: 1
444
+ }, 8, [
445
+ "open",
446
+ "width",
447
+ "min-width"
448
+ ]));
449
+ }
450
+ }), j = ["tabindex", "aria-expanded"], ye = ["name", "value"], M = { class: "flex shrink-0 items-center gap-1 pr-2 text-tertiary" }, be = { class: "grid grid-cols-2" }, N = { class: "min-w-0 border-r border-medium" }, xe = { class: "flex h-10 items-center justify-between border-b border-medium px-3" }, Se = {
451
+ class: "max-h-[224px] overflow-y-auto p-1",
452
+ "data-ui-time-range-picker-scroll": "true"
453
+ }, Ce = [
454
+ "data-ui-timepicker-value",
455
+ "data-ui-time-range-picker-selected",
456
+ "disabled",
457
+ "onClick"
458
+ ], P = {
459
+ class: "max-h-[224px] overflow-y-auto p-1",
460
+ "data-ui-time-range-picker-scroll": "true"
461
+ }, we = [
462
+ "data-ui-timepicker-value",
463
+ "data-ui-time-range-picker-selected",
464
+ "disabled",
465
+ "onClick"
466
+ ], F = {
467
+ class: "max-h-[224px] overflow-y-auto p-1",
468
+ "data-ui-time-range-picker-scroll": "true"
469
+ }, I = [
470
+ "data-ui-timepicker-value",
471
+ "data-ui-time-range-picker-selected",
472
+ "disabled",
473
+ "onClick"
474
+ ], L = {
475
+ key: 3,
476
+ class: "min-w-0"
477
+ }, Te = {
478
+ class: "max-h-[224px] overflow-y-auto p-1",
479
+ "data-ui-time-range-picker-scroll": "true"
480
+ }, Ee = [
481
+ "data-ui-timepicker-value",
482
+ "data-ui-time-range-picker-selected",
483
+ "disabled",
484
+ "onClick"
485
+ ], R = { class: "min-w-0" }, z = { class: "flex h-10 items-center justify-between gap-2 border-b border-medium px-3" }, De = {
486
+ key: 0,
487
+ class: "rounded border border-medium px-2 py-1 text-xs text-brand-500"
488
+ }, Oe = {
489
+ class: "max-h-[224px] overflow-y-auto p-1",
490
+ "data-ui-time-range-picker-scroll": "true"
491
+ }, ke = [
492
+ "data-ui-timepicker-value",
493
+ "data-ui-time-range-picker-selected",
494
+ "disabled",
495
+ "onClick"
496
+ ], Ae = {
497
+ class: "max-h-[224px] overflow-y-auto p-1",
498
+ "data-ui-time-range-picker-scroll": "true"
499
+ }, je = [
500
+ "data-ui-timepicker-value",
501
+ "data-ui-time-range-picker-selected",
502
+ "disabled",
503
+ "onClick"
504
+ ], Me = {
505
+ class: "max-h-[224px] overflow-y-auto p-1",
506
+ "data-ui-time-range-picker-scroll": "true"
507
+ }, Ne = [
508
+ "data-ui-timepicker-value",
509
+ "data-ui-time-range-picker-selected",
510
+ "disabled",
511
+ "onClick"
512
+ ], Pe = {
513
+ key: 3,
514
+ class: "min-w-0"
515
+ }, Fe = {
516
+ class: "max-h-[224px] overflow-y-auto p-1",
517
+ "data-ui-time-range-picker-scroll": "true"
518
+ }, Ie = [
519
+ "data-ui-timepicker-value",
520
+ "data-ui-time-range-picker-selected",
521
+ "disabled",
522
+ "onClick"
523
+ ], Le = { class: "flex min-h-11 items-center justify-between gap-3 border-t border-medium px-3 py-2" }, Re = { class: "flex min-w-0 items-center justify-end gap-2" }, B = { class: "min-w-0 truncate font-mono text-xs text-tertiary" }, ze = "HH:mm:ss", Be = "h:mm:ss A", V = /* @__PURE__ */ u({
524
+ inheritAttrs: !1,
525
+ __name: "TimeRangePicker",
526
+ props: {
527
+ modelValue: { default: void 0 },
528
+ format: { default: void 0 },
529
+ valueFormat: { default: void 0 },
530
+ placeholder: { default: () => ["开始时间", "结束时间"] },
531
+ separatorIcon: { default: "i-ant-design:swap-right-outlined" },
532
+ size: { default: "md" },
533
+ disabled: {
534
+ type: Boolean,
535
+ default: !1
536
+ },
537
+ clearable: {
538
+ type: Boolean,
539
+ default: !1
540
+ },
541
+ hourStep: { default: 1 },
542
+ minuteStep: { default: 1 },
543
+ secondStep: { default: 1 },
544
+ use12Hours: {
545
+ type: Boolean,
546
+ default: !1
547
+ },
548
+ showSecond: {
549
+ type: Boolean,
550
+ default: void 0
551
+ },
552
+ disabledTime: {
553
+ type: Function,
554
+ default: void 0
555
+ },
556
+ hideDisabledOptions: {
557
+ type: Boolean,
558
+ default: !1
559
+ },
560
+ suffixIcon: { default: "i-lucide:clock-3" },
561
+ clearIcon: { default: "i-lucide:x" },
562
+ teleportedWidth: { default: void 0 },
563
+ name: { default: void 0 }
564
+ },
565
+ emits: [
566
+ "update:modelValue",
567
+ "change",
568
+ "clear",
569
+ "ok",
570
+ "calendar-change",
571
+ "visible-change",
572
+ "focus",
573
+ "blur"
574
+ ],
575
+ setup(r, { expose: u, emit: le }) {
576
+ y.extend(ce);
577
+ let b = r, x = le, ue = ae(), S = p(!1), de = p(!1), C = p("start"), w = p(null), T = p(null), fe = p(null), pe = p(null), E = a(() => b.format || (b.use12Hours ? Be : ze)), me = a(() => Y(E.value, /[HhKk]/) || !Y(E.value, /[ms]/)), D = a(() => Y(E.value, /m/)), O = a(() => b.showSecond ?? Y(E.value, /s/)), k = a(() => b.use12Hours || Y(E.value, /[aA]/)), he = a(() => [
578
+ me.value,
579
+ D.value,
580
+ O.value,
581
+ k.value
582
+ ].filter(Boolean).length || 1), ge = a(() => Math.max(168, he.value * 64 + 16)), _e = a(() => b.teleportedWidth || `${ge.value * 2}px`), ve = a(() => $e(b.modelValue)), A = a(() => ve.value[0]), V = a(() => ve.value[1]), Ve = a(() => mt(A.value, V.value)), U = a(() => w.value || A.value || X(y())), We = a(() => T.value || V.value || U.value), W = a(() => A.value?.format(E.value) || ""), G = a(() => V.value?.format(E.value) || ""), Ge = a(() => !!(A.value || V.value)), Ke = a(() => b.clearable && Ge.value && !b.disabled), qe = a(() => !A.value && !V.value ? "" : [A.value, V.value].map((e) => e?.format(b.valueFormat || E.value) || "").join(",")), K = a(() => mt(w.value, T.value)), q = a(() => ht(K.value)), J = a(() => !!(w.value && T.value)), Je = a(() => se(ue.class, He({
583
+ size: b.size,
584
+ focused: S.value || de.value,
585
+ disabled: b.disabled
586
+ }))), Ye = a(() => ({ gridTemplateColumns: `repeat(${he.value}, minmax(0, 1fr))` }));
587
+ _(S, (e) => {
588
+ x("visible-change", e), e && (w.value = A.value, T.value = V.value, kt());
589
+ }), _(() => b.modelValue, () => {
590
+ S.value && (w.value = A.value, T.value = V.value, kt());
591
+ }), _(() => [E.value, b.showSecond], () => {
592
+ re(() => {
593
+ w.value &&= X(w.value), T.value &&= X(T.value);
594
+ });
595
+ });
596
+ function Y(e, t) {
597
+ return t.test(e.replace(/\[[^\]]*]/g, ""));
598
+ }
599
+ function Xe() {
600
+ return Array.from(new Set([
601
+ b.valueFormat,
602
+ E.value,
603
+ b.format,
604
+ ze,
605
+ "HH:mm",
606
+ "HH",
607
+ "H:mm:ss",
608
+ "H:mm",
609
+ Be,
610
+ "h:mm A",
611
+ "h:mm a",
612
+ "h:mm:ss a",
613
+ "YYYY-MM-DD HH:mm:ss",
614
+ "YYYY-MM-DD HH:mm"
615
+ ].filter(Boolean)));
616
+ }
617
+ function Ze(e, t) {
618
+ for (let n of t) {
619
+ let t = y(e, n, !0);
620
+ if (t.isValid()) return t;
621
+ }
622
+ let n = y(e);
623
+ return n.isValid() ? n : null;
624
+ }
625
+ function Qe(e) {
626
+ if (e == null || e === "") return null;
627
+ if (y.isDayjs(e)) return e.isValid() ? X(e) : null;
628
+ if (e instanceof Date || typeof e == "number") {
629
+ let t = y(e);
630
+ return t.isValid() ? X(t) : null;
631
+ }
632
+ if (typeof e == "string") {
633
+ let t = Ze(e, Xe());
634
+ return t ? X(t) : null;
635
+ }
636
+ return null;
637
+ }
638
+ function $e(e) {
639
+ return Array.isArray(e) ? [Qe(e[0]), Qe(e[1])] : [null, null];
640
+ }
641
+ function X(e) {
642
+ let t = e.millisecond(0);
643
+ return D.value || (t = t.minute(0)), O.value || (t = t.second(0)), t;
644
+ }
645
+ function et(e) {
646
+ return Array.isArray(b.modelValue) ? b.modelValue[e] : void 0;
647
+ }
648
+ function tt(e, t) {
649
+ let n = X(e);
650
+ if (b.valueFormat) return n.format(b.valueFormat);
651
+ let r = et(t);
652
+ return y.isDayjs(r) ? n : r instanceof Date ? n.toDate() : typeof r == "number" ? n.valueOf() : n.format(E.value);
653
+ }
654
+ function nt(e, t, n) {
655
+ let r = Number.isFinite(n) && n && n > 0 ? Math.floor(n) : 1, i = [];
656
+ for (let n = e; n <= t; n += r) i.push(n);
657
+ return i;
658
+ }
659
+ function rt(e, t, n) {
660
+ let r = Math.min(n, Math.max(0, t));
661
+ return e.includes(r) ? e : [...e, r].sort((e, t) => e - t);
662
+ }
663
+ function it(e) {
664
+ return e % 12 || 12;
665
+ }
666
+ function at(e, t) {
667
+ return !b.use12Hours && !k.value ? e : t === "pm" ? e === 12 ? 12 : e + 12 : e === 12 ? 0 : e;
668
+ }
669
+ function ot(e) {
670
+ return e === "start" ? U.value : We.value;
671
+ }
672
+ function Z(e) {
673
+ return ot(e).hour() >= 12 ? "pm" : "am";
674
+ }
675
+ function st(e, t, n) {
676
+ let r = ot(e);
677
+ if (t === "hour" && typeof n == "number") return X(r.hour(at(n, Z(e))));
678
+ if (t === "minute" && typeof n == "number") return X(r.minute(n));
679
+ if (t === "second" && typeof n == "number") return X(r.second(n));
680
+ if (t === "meridiem" && typeof n == "string") {
681
+ let e = r.hour();
682
+ if (n === "pm" && e < 12) return X(r.hour(e + 12));
683
+ if (n === "am" && e >= 12) return X(r.hour(e - 12));
684
+ }
685
+ return X(r);
686
+ }
687
+ function ct(e, t) {
688
+ return b.disabledTime?.(e, t) ?? {};
689
+ }
690
+ function lt(e, t) {
691
+ let n = ct(e, t);
692
+ return !!(n.disabledHours?.().includes(e.hour()) || n.disabledMinutes?.(e.hour()).includes(e.minute()) || O.value && n.disabledSeconds?.(e.hour(), e.minute()).includes(e.second()));
693
+ }
694
+ function ut(e, t, n) {
695
+ let r = st(e, t, n);
696
+ return t === "hour" ? !!ct(r, e).disabledHours?.().includes(r.hour()) : t === "minute" ? !!ct(r, e).disabledMinutes?.(r.hour()).includes(r.minute()) : !!ct(r, e).disabledSeconds?.(r.hour(), r.minute()).includes(r.second());
697
+ }
698
+ function dt(e, t) {
699
+ let n = ot(e), r, i, a;
700
+ return t === "hour" ? (i = b.use12Hours ? it(n.hour()) : n.hour(), a = b.use12Hours ? 12 : 23, r = b.use12Hours ? nt(1, 12, b.hourStep) : nt(0, 23, b.hourStep)) : t === "minute" ? (i = n.minute(), a = 59, r = nt(0, 59, b.minuteStep)) : (i = n.second(), a = 59, r = nt(0, 59, b.secondStep)), rt(r, i, a).map((n) => ({
701
+ value: n,
702
+ label: String(n).padStart(2, "0"),
703
+ disabled: ut(e, t, n)
704
+ })).filter((e) => !(b.hideDisabledOptions && e.disabled));
705
+ }
706
+ function ft(e) {
707
+ return [{
708
+ value: "am",
709
+ label: "AM",
710
+ disabled: lt(st(e, "meridiem", "am"), e)
711
+ }, {
712
+ value: "pm",
713
+ label: "PM",
714
+ disabled: lt(st(e, "meridiem", "pm"), e)
715
+ }];
716
+ }
717
+ function Q(e, t, n) {
718
+ let r = ot(e);
719
+ return t === "hour" && typeof n == "number" ? b.use12Hours ? it(r.hour()) === n : r.hour() === n : t === "minute" && typeof n == "number" ? r.minute() === n : t === "second" && typeof n == "number" ? r.second() === n : t === "meridiem" ? Z(e) === n : !1;
720
+ }
721
+ function pt(e) {
722
+ return e.hour() * 60 * 60 + e.minute() * 60 + e.second();
723
+ }
724
+ function mt(e, t) {
725
+ return !e || !t ? 0 : +(pt(t) < pt(e));
726
+ }
727
+ function ht(e) {
728
+ return {
729
+ endDayOffset: e,
730
+ crossesDay: e === 1
731
+ };
732
+ }
733
+ function gt() {
734
+ return !w.value && !T.value ? null : [w.value ? tt(w.value, 0) : null, T.value ? tt(T.value, 1) : null];
735
+ }
736
+ function _t() {
737
+ return [w.value?.format(E.value) || "", T.value?.format(E.value) || ""];
738
+ }
739
+ function vt() {
740
+ x("calendar-change", gt(), _t(), q.value);
741
+ }
742
+ function $(e, t, n) {
743
+ let r = st(e, t, n);
744
+ lt(r, e) || (e === "start" ? w.value = r : T.value = r, C.value = e, vt());
745
+ }
746
+ function yt() {
747
+ let e = X(y());
748
+ lt(e, C.value) || (C.value === "start" ? w.value = e : T.value = e, vt(), kt());
749
+ }
750
+ function bt() {
751
+ if (!J.value) return;
752
+ let e = gt(), t = _t(), n = q.value;
753
+ x("update:modelValue", e), x("change", e, t, n), x("ok", e, t, n), S.value = !1;
754
+ }
755
+ function xt(e) {
756
+ e?.stopPropagation(), w.value = null, T.value = null, x("update:modelValue", null), x("change", null, ["", ""], ht(0)), x("clear"), S.value = !1;
757
+ }
758
+ function St(e) {
759
+ b.disabled || (S.value = e);
760
+ }
761
+ function Ct() {
762
+ St(!S.value);
763
+ }
764
+ function wt(e) {
765
+ e.key === "Enter" || e.key === " " || e.key === "ArrowDown" ? (e.preventDefault(), St(!0)) : e.key === "Escape" && (e.preventDefault(), St(!1));
766
+ }
767
+ function Tt(e) {
768
+ de.value = !0, x("focus", e);
769
+ }
770
+ function Et(e) {
771
+ de.value = !1, x("blur", e);
772
+ }
773
+ function Dt() {
774
+ fe.value?.focus();
775
+ }
776
+ function Ot() {
777
+ fe.value?.blur();
778
+ }
779
+ function kt() {
780
+ re(() => {
781
+ (pe.value?.querySelectorAll("[data-ui-time-range-picker-scroll=\"true\"]"))?.forEach((e) => {
782
+ let t = e.querySelector("[data-ui-time-range-picker-selected=\"true\"]");
783
+ if (!t) return;
784
+ let n = t.offsetTop - (e.clientHeight - t.clientHeight) / 2, r = Math.max(0, n);
785
+ typeof e.scrollTo == "function" ? e.scrollTo({
786
+ top: r,
787
+ behavior: "auto"
788
+ }) : e.scrollTop = r;
789
+ });
790
+ });
791
+ }
792
+ return u({
793
+ blur: Ot,
794
+ clear: xt,
795
+ focus: Dt
796
+ }), (a, u) => (f(), ee(g(n), {
797
+ open: S.value,
798
+ "onUpdate:open": u[2] ||= (e) => S.value = e,
799
+ width: _e.value,
800
+ "min-width": _e.value,
801
+ "focus-on-open": !1,
802
+ "content-class": "ui-timepicker-dropdown"
803
+ }, {
804
+ trigger: v(() => [c("div", ne({
805
+ ref_key: "triggerRef",
806
+ ref: fe
807
+ }, g(t)(g(ue)), {
808
+ class: Je.value,
809
+ style: g(ue).style,
810
+ "data-ui-time-range-picker": "true",
811
+ tabindex: r.disabled ? void 0 : 0,
812
+ role: "combobox",
813
+ "aria-expanded": S.value,
814
+ "aria-haspopup": "dialog",
815
+ onClick: oe(Ct, ["stop"]),
816
+ onKeydown: wt,
817
+ onFocus: Tt,
818
+ onBlur: Et
819
+ }), [
820
+ c("span", { class: d([g(Ue)({ size: r.size }), "flex min-w-0 items-center"]) }, [
821
+ c("span", { class: d(["min-w-0 flex-1 truncate", W.value ? "text-primary" : "text-tertiary/60"]) }, h(W.value || r.placeholder[0]), 3),
822
+ c("span", { class: d([r.separatorIcon, "mx-2 size-4 shrink-0 text-tertiary"]) }, null, 2),
823
+ c("span", { class: d(["min-w-0 flex-1 truncate text-right", G.value ? "text-primary" : "text-tertiary/60"]) }, h(G.value ? `${Ve.value === 1 ? "次日 " : ""}${G.value}` : r.placeholder[1]), 3)
824
+ ], 2),
825
+ r.name ? (f(), s("input", {
826
+ key: 0,
827
+ type: "hidden",
828
+ name: r.name,
829
+ value: qe.value
830
+ }, null, 8, ye)) : o("", !0),
831
+ c("span", M, [Ke.value ? (f(), s("button", {
832
+ key: 0,
833
+ type: "button",
834
+ "aria-label": "清空",
835
+ class: "flex size-4 items-center justify-center rounded-full bg-tertiary/90 text-tertiary/60 opacity-0 transition-all duration-150 hover:bg-tertiary hover:text-tertiary group-hover/ui-timepicker:opacity-100 group-focus-within/ui-timepicker:opacity-100",
836
+ onClick: xt
837
+ }, [c("span", { class: d([r.clearIcon, "size-3"]) }, null, 2)])) : o("", !0), c("span", { class: d([r.suffixIcon, "size-4"]) }, null, 2)])
838
+ ], 16, j)]),
839
+ default: v(() => [c("div", {
840
+ ref_key: "panelRef",
841
+ ref: pe,
842
+ class: "select-none bg-primary text-primary"
843
+ }, [c("div", be, [c("section", N, [c("div", xe, [c("button", {
844
+ type: "button",
845
+ class: d(["rounded px-1 text-sm font-bold transition-colors hover:bg-secondary hover:text-brand", C.value === "start" ? "text-brand" : "text-primary"]),
846
+ onClick: u[0] ||= (e) => C.value = "start"
847
+ }, "开始时间", 2)]), c("div", {
848
+ class: "grid",
849
+ style: ie(Ye.value)
850
+ }, [
851
+ me.value ? (f(), s("div", {
852
+ key: 0,
853
+ class: d(["min-w-0", D.value || O.value || k.value ? "border-r border-medium" : ""])
854
+ }, [u[3] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "时", -1), c("div", Se, [(f(!0), s(i, null, m(dt("start", "hour"), (e) => (f(), s("button", {
855
+ key: e.value,
856
+ type: "button",
857
+ "data-ui-time-range-picker-side": "start",
858
+ "data-ui-timepicker-unit": "hour",
859
+ "data-ui-timepicker-value": e.value,
860
+ "data-ui-time-range-picker-selected": Q("start", "hour", e.value) ? "true" : void 0,
861
+ class: d(g(H)({
862
+ selected: Q("start", "hour", e.value),
863
+ disabled: e.disabled
864
+ })),
865
+ disabled: e.disabled,
866
+ onClick: (t) => $("start", "hour", e.value)
867
+ }, h(e.label), 11, Ce))), 128))])], 2)) : o("", !0),
868
+ D.value ? (f(), s("div", {
869
+ key: 1,
870
+ class: d(["min-w-0", O.value || k.value ? "border-r border-medium" : ""])
871
+ }, [u[4] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "分", -1), c("div", P, [(f(!0), s(i, null, m(dt("start", "minute"), (e) => (f(), s("button", {
872
+ key: e.value,
873
+ type: "button",
874
+ "data-ui-time-range-picker-side": "start",
875
+ "data-ui-timepicker-unit": "minute",
876
+ "data-ui-timepicker-value": e.value,
877
+ "data-ui-time-range-picker-selected": Q("start", "minute", e.value) ? "true" : void 0,
878
+ class: d(g(H)({
879
+ selected: Q("start", "minute", e.value),
880
+ disabled: e.disabled
881
+ })),
882
+ disabled: e.disabled,
883
+ onClick: (t) => $("start", "minute", e.value)
884
+ }, h(e.label), 11, we))), 128))])], 2)) : o("", !0),
885
+ O.value ? (f(), s("div", {
886
+ key: 2,
887
+ class: d(["min-w-0", k.value ? "border-r border-medium" : ""])
888
+ }, [u[5] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "秒", -1), c("div", F, [(f(!0), s(i, null, m(dt("start", "second"), (e) => (f(), s("button", {
889
+ key: e.value,
890
+ type: "button",
891
+ "data-ui-time-range-picker-side": "start",
892
+ "data-ui-timepicker-unit": "second",
893
+ "data-ui-timepicker-value": e.value,
894
+ "data-ui-time-range-picker-selected": Q("start", "second", e.value) ? "true" : void 0,
895
+ class: d(g(H)({
896
+ selected: Q("start", "second", e.value),
897
+ disabled: e.disabled
898
+ })),
899
+ disabled: e.disabled,
900
+ onClick: (t) => $("start", "second", e.value)
901
+ }, h(e.label), 11, I))), 128))])], 2)) : o("", !0),
902
+ k.value ? (f(), s("div", L, [u[6] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "午别", -1), c("div", Te, [(f(!0), s(i, null, m(ft("start"), (e) => (f(), s("button", {
903
+ key: e.value,
904
+ type: "button",
905
+ "data-ui-time-range-picker-side": "start",
906
+ "data-ui-timepicker-unit": "meridiem",
907
+ "data-ui-timepicker-value": e.value,
908
+ "data-ui-time-range-picker-selected": Q("start", "meridiem", e.value) ? "true" : void 0,
909
+ class: d(g(H)({
910
+ selected: Q("start", "meridiem", e.value),
911
+ disabled: e.disabled
912
+ })),
913
+ disabled: e.disabled,
914
+ onClick: (t) => $("start", "meridiem", e.value)
915
+ }, h(e.label), 11, Ee))), 128))])])) : o("", !0)
916
+ ], 4)]), c("section", R, [c("div", z, [c("button", {
917
+ type: "button",
918
+ class: d(["rounded px-1 text-sm font-bold transition-colors hover:bg-secondary hover:text-brand", C.value === "end" ? "text-brand" : "text-primary"]),
919
+ onClick: u[1] ||= (e) => C.value = "end"
920
+ }, "结束时间", 2), K.value === 1 ? (f(), s("span", De, "次日")) : o("", !0)]), c("div", {
921
+ class: "grid",
922
+ style: ie(Ye.value)
923
+ }, [
924
+ me.value ? (f(), s("div", {
925
+ key: 0,
926
+ class: d(["min-w-0", D.value || O.value || k.value ? "border-r border-medium" : ""])
927
+ }, [u[7] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "时", -1), c("div", Oe, [(f(!0), s(i, null, m(dt("end", "hour"), (e) => (f(), s("button", {
928
+ key: e.value,
929
+ type: "button",
930
+ "data-ui-time-range-picker-side": "end",
931
+ "data-ui-timepicker-unit": "hour",
932
+ "data-ui-timepicker-value": e.value,
933
+ "data-ui-time-range-picker-selected": Q("end", "hour", e.value) ? "true" : void 0,
934
+ class: d(g(H)({
935
+ selected: Q("end", "hour", e.value),
936
+ disabled: e.disabled
937
+ })),
938
+ disabled: e.disabled,
939
+ onClick: (t) => $("end", "hour", e.value)
940
+ }, h(e.label), 11, ke))), 128))])], 2)) : o("", !0),
941
+ D.value ? (f(), s("div", {
942
+ key: 1,
943
+ class: d(["min-w-0", O.value || k.value ? "border-r border-medium" : ""])
944
+ }, [u[8] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "分", -1), c("div", Ae, [(f(!0), s(i, null, m(dt("end", "minute"), (e) => (f(), s("button", {
945
+ key: e.value,
946
+ type: "button",
947
+ "data-ui-time-range-picker-side": "end",
948
+ "data-ui-timepicker-unit": "minute",
949
+ "data-ui-timepicker-value": e.value,
950
+ "data-ui-time-range-picker-selected": Q("end", "minute", e.value) ? "true" : void 0,
951
+ class: d(g(H)({
952
+ selected: Q("end", "minute", e.value),
953
+ disabled: e.disabled
954
+ })),
955
+ disabled: e.disabled,
956
+ onClick: (t) => $("end", "minute", e.value)
957
+ }, h(e.label), 11, je))), 128))])], 2)) : o("", !0),
958
+ O.value ? (f(), s("div", {
959
+ key: 2,
960
+ class: d(["min-w-0", k.value ? "border-r border-medium" : ""])
961
+ }, [u[9] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "秒", -1), c("div", Me, [(f(!0), s(i, null, m(dt("end", "second"), (e) => (f(), s("button", {
962
+ key: e.value,
963
+ type: "button",
964
+ "data-ui-time-range-picker-side": "end",
965
+ "data-ui-timepicker-unit": "second",
966
+ "data-ui-timepicker-value": e.value,
967
+ "data-ui-time-range-picker-selected": Q("end", "second", e.value) ? "true" : void 0,
968
+ class: d(g(H)({
969
+ selected: Q("end", "second", e.value),
970
+ disabled: e.disabled
971
+ })),
972
+ disabled: e.disabled,
973
+ onClick: (t) => $("end", "second", e.value)
974
+ }, h(e.label), 11, Ne))), 128))])], 2)) : o("", !0),
975
+ k.value ? (f(), s("div", Pe, [u[10] ||= c("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "午别", -1), c("div", Fe, [(f(!0), s(i, null, m(ft("end"), (e) => (f(), s("button", {
976
+ key: e.value,
977
+ type: "button",
978
+ "data-ui-time-range-picker-side": "end",
979
+ "data-ui-timepicker-unit": "meridiem",
980
+ "data-ui-timepicker-value": e.value,
981
+ "data-ui-time-range-picker-selected": Q("end", "meridiem", e.value) ? "true" : void 0,
982
+ class: d(g(H)({
983
+ selected: Q("end", "meridiem", e.value),
984
+ disabled: e.disabled
985
+ })),
986
+ disabled: e.disabled,
987
+ onClick: (t) => $("end", "meridiem", e.value)
988
+ }, h(e.label), 11, Ie))), 128))])])) : o("", !0)
989
+ ], 4)])]), c("div", Le, [c("button", {
990
+ type: "button",
991
+ class: "text-xs text-brand-500 transition-colors hover:text-brand-600",
992
+ onClick: yt
993
+ }, "此刻"), c("div", Re, [c("span", B, h(_t()[0] || r.placeholder[0]) + " - " + h(K.value === 1 ? "次日 " : "") + h(_t()[1] || r.placeholder[1]), 1), l(g(e), {
994
+ size: "sm",
995
+ disabled: !J.value,
996
+ onClick: bt
997
+ }, {
998
+ default: v(() => [...u[11] ||= [te("确定", -1)]]),
999
+ _: 1
1000
+ }, 8, ["disabled"])])])], 512)]),
1001
+ _: 1
1002
+ }, 8, [
1003
+ "open",
1004
+ "width",
1005
+ "min-width"
1006
+ ]));
1007
+ }
1008
+ }), Ve = {
1009
+ sm: "h-[calc(1.75rem+2px)] text-sm/5",
1010
+ md: "h-[calc(2rem+2px)] text-base/4",
1011
+ lg: "h-[calc(2.25rem+2px)] text-lg/5"
1012
+ }, He = r("group/ui-timepicker relative flex w-full min-w-0 items-center overflow-hidden border bg-primary text-primary transition-colors duration-150", {
1013
+ variants: {
1014
+ size: {
1015
+ sm: `${Ve.sm} rounded-md`,
1016
+ md: `${Ve.md} rounded-md`,
1017
+ lg: `${Ve.lg} rounded-md`
1018
+ },
1019
+ focused: {
1020
+ true: "border-brand ring-2 ring-brand/15",
1021
+ false: "border-medium hover:border-brand/40"
1022
+ },
1023
+ disabled: {
1024
+ true: "cursor-not-allowed bg-tertiary/20 text-tertiary opacity-70 hover:border-medium",
1025
+ false: "cursor-pointer"
1026
+ }
1027
+ },
1028
+ defaultVariants: {
1029
+ size: "md",
1030
+ focused: !1,
1031
+ disabled: !1
1032
+ }
1033
+ }), Ue = r("min-w-0 flex-1 truncate py-0", {
1034
+ variants: { size: {
1035
+ sm: "px-2 text-sm/5",
1036
+ md: "px-3 text-base/4",
1037
+ lg: "px-4 text-lg/5"
1038
+ } },
1039
+ defaultVariants: { size: "md" }
1040
+ }), H = r("flex h-8 w-full items-center justify-center rounded text-xs font-mono transition-colors duration-150", {
1041
+ variants: {
1042
+ selected: {
1043
+ true: "bg-brand-500 text-brand-50 hover:bg-brand-500",
1044
+ false: "text-primary hover:bg-secondary"
1045
+ },
1046
+ disabled: {
1047
+ true: "pointer-events-none text-tertiary opacity-40",
1048
+ false: ""
1049
+ }
1050
+ },
1051
+ defaultVariants: {
1052
+ selected: !1,
1053
+ disabled: !1
1054
+ }
1055
+ });
1056
+ //#endregion
1057
+ export { A as a, V as i, Ue as n, He as r, H as t };
1058
+
1059
+ //# sourceMappingURL=timepicker-DsGIdcf8.js.map