@kernel4632/kima 0.0.0-stage → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -2
  3. package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
  4. package/dist/kima-elements-core.js +53209 -0
  5. package/dist/kima-elements.js +126371 -0
  6. package/dist/kima-theme.js +1583 -0
  7. package/dist/kima.js +141 -0
  8. package/dist/style.css +2 -0
  9. package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
  10. package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
  11. package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
  12. package/dist/vue/components/advanced-input/editable.ce.js +160 -0
  13. package/dist/vue/components/advanced-input/mention.ce.js +181 -0
  14. package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
  15. package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
  16. package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
  17. package/dist/vue/components/content/chart.ce.js +282 -0
  18. package/dist/vue/components/content/code-editor.ce.js +309 -0
  19. package/dist/vue/components/content/equation.ce.js +69 -0
  20. package/dist/vue/components/content/heatmap.ce.js +148 -0
  21. package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
  22. package/dist/vue/components/core/badge.ce.js +66 -0
  23. package/dist/vue/components/core/button-group.ce.js +142 -0
  24. package/dist/vue/components/core/button.ce.js +73 -0
  25. package/dist/vue/components/core/card.ce.js +73 -0
  26. package/dist/vue/components/core/cascader.ce.js +329 -0
  27. package/dist/vue/components/core/checkbox.ce.js +116 -0
  28. package/dist/vue/components/core/code-block.ce.js +108 -0
  29. package/dist/vue/components/core/combobox.ce.js +354 -0
  30. package/dist/vue/components/core/date-picker.ce.js +433 -0
  31. package/dist/vue/components/core/dialog.ce.js +118 -0
  32. package/dist/vue/components/core/divider.ce.js +49 -0
  33. package/dist/vue/components/core/drawer.ce.js +235 -0
  34. package/dist/vue/components/core/empty-state.ce.js +58 -0
  35. package/dist/vue/components/core/icon-button.ce.js +93 -0
  36. package/dist/vue/components/core/icon.ce.js +42 -0
  37. package/dist/vue/components/core/layout.ce.js +68 -0
  38. package/dist/vue/components/core/menu.ce.js +178 -0
  39. package/dist/vue/components/core/notification.ce.js +158 -0
  40. package/dist/vue/components/core/pagination.ce.js +158 -0
  41. package/dist/vue/components/core/progress.ce.js +49 -0
  42. package/dist/vue/components/core/select.ce.js +325 -0
  43. package/dist/vue/components/core/slider.ce.js +116 -0
  44. package/dist/vue/components/core/switch.ce.js +100 -0
  45. package/dist/vue/components/core/tabs.ce.js +193 -0
  46. package/dist/vue/components/core/text-field.ce.js +194 -0
  47. package/dist/vue/components/core/time-picker.ce.js +486 -0
  48. package/dist/vue/components/core/tooltip.ce.js +125 -0
  49. package/dist/vue/components/core/tree.ce.js +248 -0
  50. package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
  51. package/dist/vue/components/data/copy-button.ce.js +75 -0
  52. package/dist/vue/components/data/image-preview.ce.js +226 -0
  53. package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
  54. package/dist/vue/components/data/long-text.ce.js +70 -0
  55. package/dist/vue/components/data/relative-time.ce.js +77 -0
  56. package/dist/vue/components/data/ring-progress.ce.js +87 -0
  57. package/dist/vue/components/data/table.ce.js +491 -0
  58. package/dist/vue/components/data/virtual-table.ce.js +178 -0
  59. package/dist/vue/components/data/virtual-tree.ce.js +213 -0
  60. package/dist/vue/components/display/alert.ce.js +101 -0
  61. package/dist/vue/components/display/avatar-group.ce.js +65 -0
  62. package/dist/vue/components/display/avatar.ce.js +84 -0
  63. package/dist/vue/components/display/blockquote.ce.js +44 -0
  64. package/dist/vue/components/display/countdown.ce.js +77 -0
  65. package/dist/vue/components/display/descriptions.ce.js +43 -0
  66. package/dist/vue/components/display/highlight.ce.js +48 -0
  67. package/dist/vue/components/display/image.ce.js +146 -0
  68. package/dist/vue/components/display/list.ce.js +68 -0
  69. package/dist/vue/components/display/result.ce.js +57 -0
  70. package/dist/vue/components/display/skeleton.ce.js +67 -0
  71. package/dist/vue/components/display/spinner.ce.js +42 -0
  72. package/dist/vue/components/display/statistic.ce.js +71 -0
  73. package/dist/vue/components/display/timeline.ce.js +59 -0
  74. package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
  75. package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
  76. package/dist/vue/components/form-completion/date-field.ce.js +131 -0
  77. package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
  78. package/dist/vue/components/form-completion/form.ce.js +248 -0
  79. package/dist/vue/components/form-completion/json-input.ce.js +114 -0
  80. package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
  81. package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
  82. package/dist/vue/components/form-completion/time-field.ce.js +120 -0
  83. package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
  84. package/dist/vue/components/foundation/banner.ce.js +106 -0
  85. package/dist/vue/components/foundation/error-state.ce.js +108 -0
  86. package/dist/vue/components/foundation/field-group.ce.js +146 -0
  87. package/dist/vue/components/foundation/flex.ce.js +60 -0
  88. package/dist/vue/components/foundation/grid.ce.js +52 -0
  89. package/dist/vue/components/foundation/input-group.ce.js +34 -0
  90. package/dist/vue/components/foundation/page-header.ce.js +55 -0
  91. package/dist/vue/components/foundation/time-display.ce.js +129 -0
  92. package/dist/vue/components/foundation/typography.ce.js +71 -0
  93. package/dist/vue/components/input/checkbox-group.ce.js +93 -0
  94. package/dist/vue/components/input/field.ce.js +74 -0
  95. package/dist/vue/components/input/file-upload.ce.js +142 -0
  96. package/dist/vue/components/input/number-field.ce.js +103 -0
  97. package/dist/vue/components/input/pin-input.ce.js +112 -0
  98. package/dist/vue/components/input/radio-group.ce.js +96 -0
  99. package/dist/vue/components/input/rating.ce.js +115 -0
  100. package/dist/vue/components/input/tags-input.ce.js +153 -0
  101. package/dist/vue/components/input/textarea.ce.js +180 -0
  102. package/dist/vue/components/input/toggle.ce.js +58 -0
  103. package/dist/vue/components/interaction/chip.ce.js +95 -0
  104. package/dist/vue/components/interaction/command.ce.js +161 -0
  105. package/dist/vue/components/interaction/context-menu.ce.js +113 -0
  106. package/dist/vue/components/interaction/hover-card.ce.js +92 -0
  107. package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
  108. package/dist/vue/components/interaction/menubar.ce.js +134 -0
  109. package/dist/vue/components/interaction/multi-select.ce.js +264 -0
  110. package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
  111. package/dist/vue/components/interaction/popover.ce.js +83 -0
  112. package/dist/vue/components/interaction/tree-select.ce.js +195 -0
  113. package/dist/vue/components/navigation/accordion.ce.js +114 -0
  114. package/dist/vue/components/navigation/anchor.ce.js +125 -0
  115. package/dist/vue/components/navigation/back-top.ce.js +67 -0
  116. package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
  117. package/dist/vue/components/navigation/carousel.ce.js +114 -0
  118. package/dist/vue/components/navigation/collapsible.ce.js +57 -0
  119. package/dist/vue/components/navigation/link.ce.js +62 -0
  120. package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
  121. package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
  122. package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
  123. package/dist/vue/components/navigation/splitter.ce.js +131 -0
  124. package/dist/vue/components/navigation/stepper.ce.js +74 -0
  125. package/dist/vue/components/navigation/toolbar.ce.js +93 -0
  126. package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
  127. package/dist/vue/components/shell/app-shell.ce.js +87 -0
  128. package/dist/vue/components/shell/config-provider.ce.js +110 -0
  129. package/dist/vue/components/shell/marquee.ce.js +92 -0
  130. package/dist/vue/components/shell/masonry.ce.js +50 -0
  131. package/dist/vue/components/shell/sidebar.ce.js +125 -0
  132. package/dist/vue/components/utility/affix.ce.js +64 -0
  133. package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
  134. package/dist/vue/components/utility/animated-number.ce.js +66 -0
  135. package/dist/vue/components/utility/float-button.ce.js +104 -0
  136. package/dist/vue/components/utility/listbox.ce.js +81 -0
  137. package/dist/vue/components/utility/loading-bar.ce.js +85 -0
  138. package/dist/vue/components/utility/log-viewer.ce.js +124 -0
  139. package/dist/vue/components/utility/notification-queue.ce.js +109 -0
  140. package/dist/vue/components/utility/progress-group.ce.js +59 -0
  141. package/dist/vue/components/utility/qr-code.ce.js +62 -0
  142. package/dist/vue/components/utility/tag-group.ce.js +124 -0
  143. package/dist/vue/components/utility/tour.ce.js +214 -0
  144. package/dist/vue/components/utility/virtual-select.ce.js +207 -0
  145. package/dist/vue/components/utility/watermark.ce.js +44 -0
  146. package/dist/vue/internal/menu-items.js +184 -0
  147. package/dist/vue/internal/navigation-items.js +110 -0
  148. package/dist/vue/utils/code-highlight.js +142 -0
  149. package/dist/vue/utils/config.js +47 -0
  150. package/dist/vue/utils/content-motion.js +37 -0
  151. package/dist/vue/utils/content.js +83 -0
  152. package/dist/vue/utils/display-status.js +31 -0
  153. package/dist/vue/utils/foundation.js +65 -0
  154. package/dist/vue/utils/input-state.js +38 -0
  155. package/dist/vue/utils/interaction.js +103 -0
  156. package/dist/vue/utils/local-date.js +48 -0
  157. package/dist/vue/utils/motion.js +80 -0
  158. package/dist/vue/utils/native-slots.js +30 -0
  159. package/dist/vue/utils/navigation.js +44 -0
  160. package/dist/vue/utils/notifications.js +60 -0
  161. package/dist/vue/utils/qr.js +20 -0
  162. package/dist/vue/utils/remote-options.js +65 -0
  163. package/dist/vue/utils/ripple.js +20 -0
  164. package/dist/vue/utils/scoped-slots.js +22 -0
  165. package/dist/vue/utils/shell.js +43 -0
  166. package/dist/vue/utils/theme.js +50 -0
  167. package/dist/vue/utils/utility-choice.js +56 -0
  168. package/package.json +105 -4
@@ -0,0 +1,108 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "./button.ce.js";
3
+ import { highlightCodeLines as n } from "../../utils/code-highlight.js";
4
+ /* empty css */
5
+ import { Fragment as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, getCurrentInstance as f, mergeProps as p, normalizeClass as m, normalizeStyle as h, openBlock as g, ref as _, renderList as v, toDisplayString as y, useAttrs as b, watch as x, withCtx as S } from "vue";
6
+ // src/components/core/code-block.ce.vue
7
+ var C = { class: "kima-code-block__toolbar" }, w = { class: "kima-code-block__meta" }, T = {
8
+ key: 0,
9
+ class: "kima-code-block__filename"
10
+ }, E = { class: "kima-code-block__language" }, D = { class: "kima-code-block__actions" }, O = ["aria-label"], k = { class: "kima-code-block__code" }, A = ["innerHTML"], j = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
11
+ __name: "code-block.ce",
12
+ props: {
13
+ code: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ language: {
18
+ type: String,
19
+ default: "text"
20
+ },
21
+ filename: {
22
+ type: String,
23
+ default: ""
24
+ },
25
+ label: {
26
+ type: String,
27
+ default: "代码"
28
+ },
29
+ lineNumbers: Boolean,
30
+ wrap: Boolean,
31
+ copyable: {
32
+ type: Boolean,
33
+ default: !0
34
+ }
35
+ },
36
+ emits: ["copy", "copy-error"],
37
+ setup(e, { emit: j }) {
38
+ let M = e, N = j, P = b(), F = !!f()?.ce, I = a(() => F ? {
39
+ ...P,
40
+ id: void 0
41
+ } : P), L = _(M.wrap), R = _(!1), z = _("");
42
+ x(() => M.wrap, (e) => {
43
+ L.value = e;
44
+ }), x(() => M.code, () => {
45
+ z.value = "";
46
+ });
47
+ let B = a(() => n(M.code, M.language));
48
+ async function V() {
49
+ if (R.value) return;
50
+ let e = M.code;
51
+ R.value = !0, z.value = "";
52
+ try {
53
+ await navigator.clipboard.writeText(e), e === M.code && (z.value = "已复制"), N("copy", e);
54
+ } catch {
55
+ z.value = "复制失败,请选择代码手动复制", N("copy-error");
56
+ } finally {
57
+ R.value = !1;
58
+ }
59
+ }
60
+ return (n, a) => (g(), c("figure", p(I.value, { class: ["kima-code-block", { "kima-code-block--wrap": L.value }] }), [
61
+ l("figcaption", C, [l("div", w, [e.filename ? (g(), c("span", T, y(e.filename), 1)) : s("", !0), l("span", E, y(e.language), 1)]), l("div", D, [d(t, {
62
+ variant: "text",
63
+ "aria-pressed": L.value,
64
+ onClick: a[0] ||= (e) => L.value = !L.value
65
+ }, {
66
+ default: S(() => [...a[1] ||= [u("换行", -1)]]),
67
+ _: 1
68
+ }, 8, ["aria-pressed"]), e.copyable ? (g(), o(t, {
69
+ key: 0,
70
+ variant: "text",
71
+ loading: R.value,
72
+ "aria-label": "复制代码",
73
+ onClick: V
74
+ }, {
75
+ default: S(() => [d(i, {
76
+ name: "kima-fade",
77
+ mode: "out-in"
78
+ }, {
79
+ default: S(() => [(g(), c("span", { key: z.value === "已复制" }, y(z.value === "已复制" ? "已复制" : "复制"), 1))]),
80
+ _: 1
81
+ })]),
82
+ _: 1
83
+ }, 8, ["loading"])) : s("", !0)])]),
84
+ l("pre", {
85
+ class: "kima-code-block__viewport",
86
+ tabindex: "0",
87
+ role: "region",
88
+ "aria-label": e.filename || e.label
89
+ }, [l("code", k, [(g(!0), c(r, null, v(B.value, (t, n) => (g(), c("span", {
90
+ key: n,
91
+ class: "kima-code-block__line"
92
+ }, [e.lineNumbers ? (g(), c("span", {
93
+ key: 0,
94
+ class: "kima-code-block__number",
95
+ "aria-hidden": "true",
96
+ style: h({ width: `${String(B.value.length).length}ch` })
97
+ }, y(n + 1), 5)) : s("", !0), l("span", {
98
+ class: "kima-code-block__text",
99
+ innerHTML: t || "​"
100
+ }, null, 8, A)]))), 128))])], 8, O),
101
+ l("span", {
102
+ class: m(["kima-code-block__status", { "kima-code-block__status--error": z.value && z.value !== "已复制" }]),
103
+ role: "status"
104
+ }, y(z.value), 3)
105
+ ], 16));
106
+ }
107
+ }), [["__scopeId", "data-v-6ddc49c8"]]);
108
+ export { j as default };
@@ -0,0 +1,354 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import n from "./icon.ce.js";
4
+ import { useRemoteOptions as r } from "../../utils/remote-options.js";
5
+ /* empty css */
6
+ import { Fragment as ee, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as te, createVNode as u, getCurrentInstance as ne, mergeProps as re, nextTick as d, normalizeClass as ie, onBeforeUnmount as ae, onMounted as oe, openBlock as f, ref as p, renderList as se, shallowRef as m, toDisplayString as h, unref as g, useAttrs as ce, useHost as le, useId as ue, watch as _, withCtx as v, withModifiers as y } from "vue";
7
+ import { ArrowDown01Icon as de, Cancel01Icon as fe, Search01Icon as pe, Tick01Icon as me } from "@hugeicons/core-free-icons";
8
+ // src/components/core/combobox.ce.vue
9
+ var he = ["aria-disabled"], ge = [
10
+ "value",
11
+ "placeholder",
12
+ "readonly",
13
+ "disabled",
14
+ "aria-expanded",
15
+ "aria-label",
16
+ "aria-required",
17
+ "aria-activedescendant"
18
+ ], _e = ["disabled"], ve = ["disabled"], ye = [
19
+ "name",
20
+ "value",
21
+ "required",
22
+ "disabled"
23
+ ], be = {
24
+ key: 0,
25
+ class: "kima-combobox__popup"
26
+ }, xe = ["aria-busy"], Se = {
27
+ key: 0,
28
+ class: "kima-combobox__status",
29
+ role: "status"
30
+ }, Ce = {
31
+ key: 1,
32
+ class: "kima-combobox__status kima-combobox__status--error",
33
+ role: "alert"
34
+ }, we = [
35
+ "id",
36
+ "aria-selected",
37
+ "aria-disabled",
38
+ "onClick"
39
+ ], Te = { class: "kima-combobox__option-copy" }, Ee = { class: "kima-combobox__option-label" }, De = {
40
+ key: 0,
41
+ class: "kima-combobox__option-description"
42
+ }, Oe = {
43
+ key: 2,
44
+ class: "kima-combobox__empty",
45
+ role: "status"
46
+ }, ke = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
47
+ __name: "combobox.ce",
48
+ props: {
49
+ modelValue: {
50
+ type: [
51
+ String,
52
+ Number,
53
+ Boolean
54
+ ],
55
+ default: null
56
+ },
57
+ items: {
58
+ type: Array,
59
+ default: () => []
60
+ },
61
+ label: {
62
+ type: String,
63
+ default: ""
64
+ },
65
+ placeholder: {
66
+ type: String,
67
+ default: "请选择或输入"
68
+ },
69
+ name: String,
70
+ required: Boolean,
71
+ disabled: Boolean,
72
+ clearable: Boolean,
73
+ searchable: {
74
+ type: Boolean,
75
+ default: !0
76
+ },
77
+ open: Boolean,
78
+ freeSolo: Boolean,
79
+ loader: {
80
+ type: Function,
81
+ default: void 0
82
+ },
83
+ debounce: {
84
+ type: Number,
85
+ default: 200
86
+ },
87
+ retry: {
88
+ type: Number,
89
+ default: 0
90
+ }
91
+ },
92
+ emits: [
93
+ "input",
94
+ "update:modelValue",
95
+ "change",
96
+ "update:open",
97
+ "options-loading",
98
+ "options-load",
99
+ "options-error"
100
+ ],
101
+ setup(t, { emit: ke }) {
102
+ let b = t, x = ke, S = ce(), Ae = ne()?.ce ? le() : null, je = a(() => Ae ? {
103
+ ...S,
104
+ id: void 0
105
+ } : S), C = p(null), w = p(null);
106
+ e(w);
107
+ let T = p(null), E = p(null), D = p([]), O = p(""), k = p(-1), A = m(b.modelValue), j = m(b.modelValue), M = p(b.open && !b.disabled), Me = `kima-combobox-${ue()}`, Ne = `${Me}-input`, N = `${Me}-listbox`, P, F, I, L = !0, Pe = a(() => b.loader), Fe = a(() => O.value), { items: Ie, loading: R, error: z, retry: Le } = r(Pe, Fe, a(() => b.debounce), a(() => b.retry), x), B = a(() => typeof b.loader == "function" ? Ie.value : b.items), Re = a(() => B.value.find((e) => Object.is(e?.value, A.value)) || null), V = a(() => {
108
+ let e = b.searchable ? O.value.trim().toLocaleLowerCase() : "";
109
+ return typeof b.loader == "function" || !e ? B.value : B.value.filter((t) => `${t?.label || ""} ${t?.description || ""}`.toLocaleLowerCase().includes(e));
110
+ }), ze = a(() => A.value === null || A.value === void 0 ? "" : String(A.value)), Be = a(() => M.value && k.value >= 0 ? `${N}-option-${k.value}` : void 0), Ve = a(() => b.clearable && (A.value !== null && A.value !== void 0 && A.value !== "" || O.value.length > 0));
111
+ function He(e, t) {
112
+ e ? D.value[t] = e : delete D.value[t];
113
+ }
114
+ function H() {
115
+ return V.value.flatMap((e, t) => e?.disabled ? [] : [t]);
116
+ }
117
+ function U() {
118
+ return H()[0] ?? -1;
119
+ }
120
+ function Ue() {
121
+ let e = H();
122
+ return e[e.length - 1] ?? -1;
123
+ }
124
+ function W() {
125
+ let e = V.value.findIndex((e) => Object.is(e?.value, A.value) && !e.disabled);
126
+ return e >= 0 ? e : U();
127
+ }
128
+ function G(e, t = !1) {
129
+ e < 0 || !V.value[e] || V.value[e].disabled || (k.value = e, d(() => {
130
+ t && D.value[e]?.focus(), D.value[e]?.scrollIntoView({ block: "nearest" });
131
+ }));
132
+ }
133
+ function We(e) {
134
+ let t = H();
135
+ if (!t.length) return;
136
+ let n = t.indexOf(k.value);
137
+ G(t[n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length]);
138
+ }
139
+ function K(e) {
140
+ Object.is(e, j.value) || (j.value = e, x("change", e));
141
+ }
142
+ function q(e, t = !1) {
143
+ Object.is(e, A.value) || (A.value = e, x("update:modelValue", e)), t && K(e);
144
+ }
145
+ function J() {
146
+ return Re.value ? Re.value.label : "";
147
+ }
148
+ function Y() {
149
+ b.disabled || M.value || (M.value = !0, k.value = W(), x("update:open", !0));
150
+ }
151
+ function X(e = !0) {
152
+ M.value && (L = e, M.value = !1, x("update:open", !1));
153
+ }
154
+ function Z() {
155
+ if (b.freeSolo) {
156
+ let e = O.value === "" ? null : O.value;
157
+ q(e), K(e);
158
+ } else O.value = J();
159
+ }
160
+ function Ge(e) {
161
+ b.disabled || e?.disabled || (O.value = e.label, q(e.value, !0), X(!0));
162
+ }
163
+ function Ke() {
164
+ let e = V.value[k.value];
165
+ e ? Ge(e) : b.freeSolo && (Z(), X(!0));
166
+ }
167
+ function qe() {
168
+ O.value = "", q(null, !0), X(!0), d(() => T.value?.focus());
169
+ }
170
+ function Je(e) {
171
+ b.disabled || (O.value = e.target.value, x("input", O.value), M.value || Y(), b.freeSolo && q(O.value === "" ? null : O.value));
172
+ }
173
+ function Ye(e) {
174
+ b.disabled || e.isComposing || (e.key === "Tab" ? (Z(), X(!1)) : [
175
+ "ArrowDown",
176
+ "ArrowUp",
177
+ "Home",
178
+ "End",
179
+ "Enter",
180
+ " ",
181
+ "Escape"
182
+ ].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === "Escape" ? (O.value = J(), X(!0)) : M.value ? e.key === "ArrowDown" ? We(1) : e.key === "ArrowUp" ? We(-1) : e.key === "Home" ? G(U()) : e.key === "End" ? G(Ue()) : Ke() : (Y(), e.key === "ArrowUp" || e.key === "End" ? d(() => G(Ue())) : e.key === "Home" && d(() => G(U())))));
183
+ }
184
+ function Q(e) {
185
+ M.value && !e.composedPath().includes(C.value) && (Z(), X(!1));
186
+ }
187
+ function Xe(e) {
188
+ e.preventDefault(), d(() => T.value?.focus());
189
+ }
190
+ function $(e) {
191
+ queueMicrotask(() => {
192
+ if (e.defaultPrevented) return;
193
+ let t = !Object.is(A.value, I);
194
+ A.value = I, j.value = I, O.value = B.value.find((e) => Object.is(e?.value, I))?.label || (b.freeSolo && I != null ? String(I) : ""), X(!1), E.value && (E.value.value = I == null ? "" : String(I)), t && x("update:modelValue", I);
195
+ });
196
+ }
197
+ return _(() => b.modelValue, (e) => {
198
+ A.value = e, j.value = e, O.value = B.value.find((t) => Object.is(t?.value, e))?.label || (b.freeSolo && e != null ? String(e) : "");
199
+ }), _(() => b.items, () => {
200
+ M.value || (O.value = J());
201
+ }, { deep: !0 }), _(() => b.open, (e) => {
202
+ M.value = e && !b.disabled, M.value && (k.value = W());
203
+ }), _(() => b.disabled, (e) => {
204
+ e && X(!1);
205
+ }), _(V, () => {
206
+ k.value = W();
207
+ }), _(M, (e, t) => {
208
+ (e || t && L) && d(() => T.value?.focus()), L = !0;
209
+ }, { immediate: !0 }), oe(() => {
210
+ I = A.value, O.value = J() || (b.freeSolo && I != null ? String(I) : ""), F = E.value?.form, F?.addEventListener("reset", $), P = C.value.ownerDocument, P.addEventListener("pointerdown", Q), P.addEventListener("focusin", Q);
211
+ }), ae(() => {
212
+ F?.removeEventListener("reset", $), P?.removeEventListener("pointerdown", Q), P?.removeEventListener("focusin", Q);
213
+ }), (e, r) => (f(), c("div", re({
214
+ ref_key: "root",
215
+ ref: C
216
+ }, je.value, { class: ["kima-combobox", {
217
+ "kima-combobox--open": M.value,
218
+ "kima-combobox--disabled": t.disabled
219
+ }] }), [
220
+ l("div", {
221
+ ref_key: "control",
222
+ ref: w,
223
+ class: "kima-combobox__control",
224
+ "aria-disabled": t.disabled || void 0
225
+ }, [
226
+ t.searchable ? (f(), o(n, {
227
+ key: 0,
228
+ class: "kima-combobox__search-icon",
229
+ icon: g(pe),
230
+ size: 18,
231
+ "aria-hidden": "true"
232
+ }, null, 8, ["icon"])) : s("", !0),
233
+ l("input", {
234
+ id: Ne,
235
+ ref_key: "input",
236
+ ref: T,
237
+ class: "kima-combobox__input",
238
+ type: "text",
239
+ role: "combobox",
240
+ value: O.value,
241
+ placeholder: t.placeholder,
242
+ readonly: !t.searchable,
243
+ disabled: t.disabled,
244
+ "aria-expanded": M.value,
245
+ "aria-controls": N,
246
+ "aria-haspopup": "listbox",
247
+ "aria-autocomplete": "list",
248
+ "aria-label": g(S)["aria-label"] || g(S).ariaLabel || t.label || void 0,
249
+ "aria-required": t.required || void 0,
250
+ "aria-activedescendant": Be.value,
251
+ onFocus: Y,
252
+ onClick: Y,
253
+ onInput: y(Je, ["stop"]),
254
+ onChange: y(Z, ["stop"]),
255
+ onKeydown: Ye
256
+ }, null, 40, ge),
257
+ u(i, { name: "kima-fade" }, {
258
+ default: v(() => [Ve.value ? (f(), c("button", {
259
+ key: 0,
260
+ class: "kima-combobox__clear",
261
+ type: "button",
262
+ "aria-label": "清除输入",
263
+ title: "清除输入",
264
+ disabled: t.disabled,
265
+ onClick: qe
266
+ }, [u(n, {
267
+ icon: g(fe),
268
+ size: 18,
269
+ "aria-hidden": "true"
270
+ }, null, 8, ["icon"])], 8, _e)) : s("", !0)]),
271
+ _: 1
272
+ }),
273
+ l("button", {
274
+ class: "kima-combobox__toggle",
275
+ type: "button",
276
+ disabled: t.disabled,
277
+ "aria-label": "显示选项",
278
+ onMousedown: r[0] ||= y(() => {}, ["prevent"]),
279
+ onClick: r[1] ||= (e) => M.value ? X(!0) : Y()
280
+ }, [u(n, {
281
+ class: "kima-combobox__arrow",
282
+ icon: g(de),
283
+ size: 20,
284
+ "aria-hidden": "true"
285
+ }, null, 8, ["icon"])], 40, ve)
286
+ ], 8, he),
287
+ l("input", {
288
+ ref_key: "nativeInput",
289
+ ref: E,
290
+ class: "kima-combobox__native",
291
+ type: "text",
292
+ name: t.name,
293
+ value: ze.value,
294
+ required: t.required,
295
+ disabled: t.disabled,
296
+ tabindex: "-1",
297
+ "aria-hidden": "true",
298
+ onInput: r[2] ||= y(() => {}, ["stop"]),
299
+ onChange: r[3] ||= y(() => {}, ["stop"]),
300
+ onInvalid: Xe
301
+ }, null, 40, ye),
302
+ u(i, {
303
+ name: "kima-popup",
304
+ onBeforeEnter: r[6] ||= (e) => {
305
+ e.inert = !1, e.removeAttribute("aria-hidden");
306
+ },
307
+ onBeforeLeave: r[7] ||= (e) => {
308
+ e.inert = !0, e.setAttribute("aria-hidden", "true");
309
+ }
310
+ }, {
311
+ default: v(() => [M.value ? (f(), c("div", be, [l("div", {
312
+ id: N,
313
+ class: "kima-combobox__options",
314
+ role: "listbox",
315
+ "aria-labelledby": Ne,
316
+ "aria-busy": g(R) || void 0
317
+ }, [
318
+ g(R) ? (f(), c("div", Se, "加载中…")) : g(z) ? (f(), c("div", Ce, [te(h(g(z)) + " ", 1), l("button", {
319
+ type: "button",
320
+ onClick: r[4] ||= (...e) => g(Le) && g(Le)(...e)
321
+ }, "重试")])) : s("", !0),
322
+ (f(!0), c(ee, null, se(V.value, (e, t) => (f(), c("div", {
323
+ id: `${N}-option-${t}`,
324
+ key: t,
325
+ ref_for: !0,
326
+ ref: (e) => He(e, t),
327
+ class: ie(["kima-combobox__option", {
328
+ "kima-combobox__option--active": t === k.value,
329
+ "kima-combobox__option--selected": Object.is(e.value, A.value)
330
+ }]),
331
+ role: "option",
332
+ "aria-selected": Object.is(e.value, A.value),
333
+ "aria-disabled": e.disabled || void 0,
334
+ tabindex: "-1",
335
+ onPointerdown: r[5] ||= y(() => {}, ["prevent"]),
336
+ onClick: (t) => Ge(e)
337
+ }, [l("span", Te, [l("span", Ee, h(e.label), 1), e.description ? (f(), c("span", De, h(e.description), 1)) : s("", !0)]), u(i, { name: "kima-fade" }, {
338
+ default: v(() => [Object.is(e.value, A.value) ? (f(), o(n, {
339
+ key: 0,
340
+ class: "kima-combobox__check",
341
+ icon: g(me),
342
+ size: 18,
343
+ "aria-hidden": "true"
344
+ }, null, 8, ["icon"])) : s("", !0)]),
345
+ _: 2
346
+ }, 1024)], 42, we))), 128)),
347
+ !g(R) && !g(z) && V.value.length === 0 ? (f(), c("div", Oe, "没有匹配选项")) : s("", !0)
348
+ ], 8, xe)])) : s("", !0)]),
349
+ _: 1
350
+ })
351
+ ], 16));
352
+ }
353
+ }), [["__scopeId", "data-v-6980ff65"]]);
354
+ export { ke as default };