@kernel4632/kima 0.0.0-stage → 0.6.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 (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -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 +99 -4
@@ -0,0 +1,113 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { presenceTransition as t } from "../../utils/motion.js";
3
+ import { dismissInteraction as n, useInteractionRoot as r } from "../../utils/interaction.js";
4
+ import { useMenuChecks as i, useShellModel as a } from "../../utils/shell.js";
5
+ import o from "../../internal/menu-items.js";
6
+ /* empty css */
7
+ import { Transition as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createTextVNode as d, createVNode as f, isRef as p, mergeProps as m, nextTick as h, openBlock as g, renderSlot as _, unref as v, watch as y, withCtx as b } from "vue";
8
+ import { ContextMenuContent as x, ContextMenuRoot as S, ContextMenuTrigger as C } from "reka-ui";
9
+ // src/components/interaction/context-menu.ce.vue
10
+ var w = {
11
+ key: 0,
12
+ role: "status"
13
+ }, T = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
14
+ __name: "context-menu.ce",
15
+ props: {
16
+ open: Boolean,
17
+ disabled: Boolean,
18
+ items: {
19
+ type: Array,
20
+ default: () => []
21
+ },
22
+ label: {
23
+ type: String,
24
+ default: "上下文操作"
25
+ },
26
+ checked: {
27
+ type: Object,
28
+ default: () => ({})
29
+ }
30
+ },
31
+ emits: [
32
+ "update:open",
33
+ "select",
34
+ "update:checked",
35
+ "check"
36
+ ],
37
+ setup(e, { emit: T }) {
38
+ let E = e, D = T, { checked: O, check: k } = i(E, D), { root: A, forwardedAttrs: j } = r(), [M, N] = a(E, "open", D), P = !1;
39
+ function F(e) {
40
+ e && (P = !1), e && E.disabled || N(e);
41
+ }
42
+ function I(e) {
43
+ e.preventDefault(), P || A.value?.querySelector(".kima-context-menu__trigger")?.focus();
44
+ }
45
+ function L(e) {
46
+ !E.disabled && (e.key === "ContextMenu" || e.shiftKey && e.key === "F10") && (e.preventDefault(), F(!0), h(() => A.value.querySelector("[role=\"menuitem\"]:not([data-disabled])")?.focus()));
47
+ }
48
+ function R(e) {
49
+ E.disabled || e.disabled || (D("select", e.value, e), F(!1));
50
+ }
51
+ return y(() => E.disabled, (e) => {
52
+ e && F(!1);
53
+ }), (r, i) => (g(), u("div", m({
54
+ ref_key: "root",
55
+ ref: A
56
+ }, v(j), { class: "kima-context-menu" }), [f(v(S), {
57
+ open: v(M) && !e.disabled,
58
+ modal: !1,
59
+ "onUpdate:open": F
60
+ }, {
61
+ default: b(() => [f(v(C), {
62
+ as: "div",
63
+ class: "kima-context-menu__trigger",
64
+ disabled: e.disabled,
65
+ tabindex: e.disabled ? -1 : 0,
66
+ "aria-label": e.label,
67
+ "aria-haspopup": "menu",
68
+ "aria-expanded": v(M) && !e.disabled,
69
+ onKeydown: L
70
+ }, {
71
+ default: b(() => [_(r.$slots, "default", {}, () => [i[2] ||= d("右键或长按打开操作菜单", -1)], !0)]),
72
+ _: 3
73
+ }, 8, [
74
+ "disabled",
75
+ "tabindex",
76
+ "aria-label",
77
+ "aria-expanded"
78
+ ]), f(s, m({ name: "kima-popup" }, v(t)), {
79
+ default: b(() => [v(M) && !e.disabled ? (g(), c(v(x), {
80
+ key: 0,
81
+ "force-mount": "",
82
+ class: "kima-context-menu__popup",
83
+ "aria-label": e.label,
84
+ "collision-padding": 12,
85
+ "side-offset": 4,
86
+ "position-strategy": "fixed",
87
+ loop: "",
88
+ onEscapeKeyDown: i[0] ||= (e) => v(n)(e, () => F(!1)),
89
+ onInteractOutside: i[1] ||= (e) => p(P) ? P.value = !0 : P = !0,
90
+ onCloseAutoFocus: I
91
+ }, {
92
+ default: b(() => [f(o, {
93
+ items: e.items,
94
+ family: "ContextMenu",
95
+ checked: v(O),
96
+ disabled: e.disabled,
97
+ onSelect: R,
98
+ onCheck: v(k)
99
+ }, null, 8, [
100
+ "items",
101
+ "checked",
102
+ "disabled",
103
+ "onCheck"
104
+ ]), e.items.length ? l("", !0) : (g(), u("p", w, "暂无操作"))]),
105
+ _: 1
106
+ }, 8, ["aria-label"])) : l("", !0)]),
107
+ _: 1
108
+ }, 16)]),
109
+ _: 3
110
+ }, 8, ["open"])], 16));
111
+ }
112
+ }), [["__scopeId", "data-v-35d2336c"]]);
113
+ export { T as default };
@@ -0,0 +1,92 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import { presenceTransition as n } from "../../utils/motion.js";
4
+ import { dismissInteraction as r, useInteractionModel as i, useInteractionRoot as a, usePlacement as o } from "../../utils/interaction.js";
5
+ /* empty css */
6
+ import { Transition as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, mergeProps as m, openBlock as h, renderSlot as g, toDisplayString as _, unref as v, useId as y, watch as b, withCtx as x, withKeys as S, withModifiers as C } from "vue";
7
+ import { HoverCardContent as w, HoverCardRoot as T, HoverCardTrigger as E } from "reka-ui";
8
+ var D = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
9
+ __name: "hover-card.ce",
10
+ props: {
11
+ open: Boolean,
12
+ disabled: Boolean,
13
+ label: {
14
+ type: String,
15
+ default: "查看预览"
16
+ },
17
+ heading: {
18
+ type: String,
19
+ default: "预览"
20
+ },
21
+ openDelay: {
22
+ type: Number,
23
+ default: 400
24
+ },
25
+ closeDelay: {
26
+ type: Number,
27
+ default: 250
28
+ },
29
+ placement: {
30
+ type: String,
31
+ default: "bottom-start"
32
+ }
33
+ },
34
+ emits: ["update:open"],
35
+ setup(e, { emit: D }) {
36
+ let O = e, k = D, { root: A, forwardedAttrs: j } = a(), [M, N] = i(O, "open", k), P = o(O), F = `kima-hover-card-${y()}`;
37
+ function I(e) {
38
+ e && O.disabled || N(e);
39
+ }
40
+ return b(() => O.disabled, (e) => {
41
+ e && N(!1);
42
+ }), (i, a) => (h(), u("div", m({
43
+ ref_key: "root",
44
+ ref: A
45
+ }, v(j), { class: "kima-hover-card" }), [p(v(T), {
46
+ open: v(M) && !e.disabled,
47
+ "open-delay": e.openDelay,
48
+ "close-delay": e.closeDelay,
49
+ "onUpdate:open": I
50
+ }, {
51
+ default: x(() => [p(v(E), { "as-child": "" }, {
52
+ default: x(() => [p(t, {
53
+ variant: "text",
54
+ disabled: e.disabled,
55
+ "aria-expanded": v(M) && !e.disabled,
56
+ "aria-controls": v(M) ? F : void 0,
57
+ onClick: a[0] ||= (e) => I(!v(M)),
58
+ onKeydown: a[1] ||= S(C((e) => I(!1), ["stop", "prevent"]), ["esc"])
59
+ }, {
60
+ default: x(() => [g(i.$slots, "trigger", {}, () => [f(_(e.label), 1)], !0)]),
61
+ _: 3
62
+ }, 8, [
63
+ "disabled",
64
+ "aria-expanded",
65
+ "aria-controls"
66
+ ])]),
67
+ _: 3
68
+ }), p(s, m({ name: "kima-popup" }, v(n)), {
69
+ default: x(() => [v(M) && !e.disabled ? (h(), c(v(w), m({
70
+ key: 0,
71
+ id: F,
72
+ "force-mount": ""
73
+ }, v(P), {
74
+ class: "kima-hover-card__popup",
75
+ role: "region",
76
+ "aria-label": e.heading,
77
+ onEscapeKeyDown: a[2] ||= (e) => v(r)(e, () => I(!1))
78
+ }), {
79
+ default: x(() => [d("h3", null, _(e.heading), 1), g(i.$slots, "default", {}, void 0, !0)]),
80
+ _: 3
81
+ }, 16, ["aria-label"])) : l("", !0)]),
82
+ _: 3
83
+ }, 16)]),
84
+ _: 3
85
+ }, 8, [
86
+ "open",
87
+ "open-delay",
88
+ "close-delay"
89
+ ])], 16));
90
+ }
91
+ }), [["__scopeId", "data-v-0517aad7"]]);
92
+ export { D as default };
@@ -0,0 +1,70 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { presenceTransition as t } from "../../utils/motion.js";
3
+ import { useInteractionRoot as n } from "../../utils/interaction.js";
4
+ import r from "../display/spinner.ce.js";
5
+ /* empty css */
6
+ import { Transition as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, mergeProps as l, nextTick as u, normalizeClass as d, onBeforeUnmount as f, openBlock as p, ref as m, renderSlot as h, toDisplayString as g, unref as _, watch as v, withCtx as y } from "vue";
7
+ // src/components/interaction/loading-overlay.ce.vue
8
+ var b = ["aria-busy", "aria-label"], x = ["inert"], S = { class: "kima-loading-overlay__status" }, C = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
9
+ __name: "loading-overlay.ce",
10
+ props: {
11
+ loading: Boolean,
12
+ blocking: {
13
+ type: Boolean,
14
+ default: !0
15
+ },
16
+ label: {
17
+ type: String,
18
+ default: "正在加载,请稍候"
19
+ }
20
+ },
21
+ emits: ["after-load"],
22
+ setup(e, { emit: C }) {
23
+ let w = e, T = C, { root: E, forwardedAttrs: D } = n(), O = m(null), k = m(null), A;
24
+ function j(e) {
25
+ O.value?.contains(e.target) && (A = e.target);
26
+ }
27
+ return v(() => w.loading && w.blocking, async (e, t) => {
28
+ let n = E.value?.ownerDocument, r = n?.activeElement;
29
+ if (e) r && O.value?.contains(r) && (A = r), A && (r === n.body || O.value?.contains(r)) && (await u(), w.loading && w.blocking && k.value?.focus({ preventScroll: !0 }));
30
+ else if (t) {
31
+ let e = !r || r === n.body || r === k.value || r?.classList.contains("kima-loading-overlay__mask");
32
+ if (await u(), w.loading && w.blocking) return;
33
+ A?.isConnected && e && A.focus({ preventScroll: !0 }), A = null;
34
+ }
35
+ }, { flush: "pre" }), v(() => w.loading, (e, t) => {
36
+ t && !e && T("after-load");
37
+ }), f(() => {
38
+ A = null;
39
+ }), (n, u) => (p(), o("section", l({
40
+ ref_key: "root",
41
+ ref: E
42
+ }, _(D), {
43
+ class: "kima-loading-overlay",
44
+ "aria-busy": e.loading,
45
+ "aria-label": _(D)["aria-label"] || e.label
46
+ }), [s("div", {
47
+ ref_key: "content",
48
+ ref: O,
49
+ class: "kima-loading-overlay__content",
50
+ inert: e.loading && e.blocking,
51
+ onFocusin: j
52
+ }, [h(n.$slots, "default", {}, void 0, !0)], 40, x), c(i, l({ name: "kima-fade" }, _(t)), {
53
+ default: y(() => [e.loading ? (p(), o("div", {
54
+ key: 0,
55
+ ref_key: "status",
56
+ ref: k,
57
+ class: d(["kima-loading-overlay__mask", { "kima-loading-overlay__mask--passive": !e.blocking }]),
58
+ role: "status",
59
+ "aria-live": "polite",
60
+ tabindex: "-1"
61
+ }, [s("div", S, [
62
+ c(r, { decorative: "" }),
63
+ s("span", null, g(e.label), 1),
64
+ h(n.$slots, "status", {}, void 0, !0)
65
+ ])], 2)) : a("", !0)]),
66
+ _: 3
67
+ }, 16)], 16, b));
68
+ }
69
+ }), [["__scopeId", "data-v-8cce8435"]]);
70
+ export { C as default };
@@ -0,0 +1,134 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import { presenceTransition as n } from "../../utils/motion.js";
4
+ import { dismissInteraction as r, useInteractionRoot as i, usePlacement as a } from "../../utils/interaction.js";
5
+ import { useMenuChecks as o, useShellModel as s } from "../../utils/shell.js";
6
+ import c from "../../internal/menu-items.js";
7
+ /* empty css */
8
+ import { Fragment as l, Transition as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createTextVNode as h, createVNode as g, mergeProps as _, nextTick as v, openBlock as y, renderList as b, toDisplayString as x, unref as S, useId as C, watch as w, withCtx as T } from "vue";
9
+ import { MenubarContent as E, MenubarMenu as D, MenubarRoot as O, MenubarTrigger as k } from "reka-ui";
10
+ // src/components/interaction/menubar.ce.vue
11
+ var A = {
12
+ key: 0,
13
+ role: "status"
14
+ }, j = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
15
+ __name: "menubar.ce",
16
+ props: {
17
+ modelValue: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ menus: {
22
+ type: Array,
23
+ default: () => []
24
+ },
25
+ disabled: Boolean,
26
+ label: {
27
+ type: String,
28
+ default: "应用菜单"
29
+ },
30
+ placement: {
31
+ type: String,
32
+ default: "bottom-start"
33
+ },
34
+ checked: {
35
+ type: Object,
36
+ default: () => ({})
37
+ }
38
+ },
39
+ emits: [
40
+ "update:modelValue",
41
+ "select",
42
+ "update:checked",
43
+ "check"
44
+ ],
45
+ setup(e, { emit: j }) {
46
+ let M = e, N = j, { checked: P, check: F } = o(M, N), { root: I, forwardedAttrs: L } = i(), [R, z] = s(M, "modelValue", N), B = a(M), V = `kima-menubar-${C()}`, H = d(() => {
47
+ let e = M.menus.findIndex((e, t) => String(e.value ?? t) === R.value && !e.disabled);
48
+ return !M.disabled && e >= 0 ? `${V}-${e}` : "";
49
+ });
50
+ function U(e) {
51
+ let t = M.menus.findIndex((t, n) => `${V}-${n}` === e);
52
+ z(t < 0 ? "" : String(M.menus[t].value ?? t));
53
+ }
54
+ function W(e, t) {
55
+ M.disabled || t.disabled || e.disabled || (N("select", e.value, e, t), z(""));
56
+ }
57
+ w(() => M.disabled, (e) => {
58
+ e && z("");
59
+ });
60
+ function G(e, t) {
61
+ if (!["ArrowRight", "ArrowLeft"].includes(e.key) || e.isComposing || e.target.closest("[data-kima-submenu]") || e.target.hasAttribute("aria-haspopup")) return;
62
+ e.preventDefault(), e.stopPropagation();
63
+ let n = e.key === "ArrowRight" ? 1 : -1, r = t;
64
+ for (let e = 0; e < M.menus.length && (r = (r + n + M.menus.length) % M.menus.length, M.menus[r].disabled); e++);
65
+ z(String(M.menus[r].value ?? r)), v(() => (I.value?.$el || I.value)?.querySelector(`[data-kima-menu-index="${r}"] [role="menuitem"]:not([data-disabled])`)?.focus());
66
+ }
67
+ return (i, a) => (y(), f(S(O), _({
68
+ ref_key: "root",
69
+ ref: I
70
+ }, S(L), {
71
+ class: "kima-menubar",
72
+ "model-value": H.value,
73
+ "aria-label": e.label,
74
+ loop: "",
75
+ "onUpdate:modelValue": U
76
+ }), {
77
+ default: T(() => [(y(!0), m(l, null, b(e.menus, (i, o) => (y(), f(S(D), {
78
+ key: i.value ?? o,
79
+ value: `${V}-${o}`
80
+ }, {
81
+ default: T(() => [g(S(k), {
82
+ id: `${V}-${o}`,
83
+ "as-child": "",
84
+ disabled: e.disabled || i.disabled
85
+ }, {
86
+ default: T(() => [g(t, {
87
+ variant: "text",
88
+ disabled: e.disabled || i.disabled
89
+ }, {
90
+ default: T(() => [h(x(i.label), 1)]),
91
+ _: 2
92
+ }, 1032, ["disabled"])]),
93
+ _: 2
94
+ }, 1032, ["id", "disabled"]), g(u, _({ name: "kima-popup" }, { ref_for: !0 }, S(n)), {
95
+ default: T(() => [S(R) === String(i.value ?? o) && !e.disabled && !i.disabled ? (y(), f(S(E), _({
96
+ key: 0,
97
+ "force-mount": ""
98
+ }, { ref_for: !0 }, S(B), {
99
+ class: "kima-menubar__popup",
100
+ "data-kima-menu-index": o,
101
+ loop: "",
102
+ "aria-label": i.label,
103
+ onEscapeKeyDown: a[0] ||= (e) => S(r)(e, () => S(z)("")),
104
+ onKeydown: (e) => G(e, o)
105
+ }), {
106
+ default: T(() => [g(c, {
107
+ items: i.items || [],
108
+ family: "Menubar",
109
+ checked: S(P),
110
+ disabled: e.disabled || i.disabled,
111
+ onSelect: (e) => W(e, i),
112
+ onCheck: S(F)
113
+ }, null, 8, [
114
+ "items",
115
+ "checked",
116
+ "disabled",
117
+ "onSelect",
118
+ "onCheck"
119
+ ]), i.items?.length ? p("", !0) : (y(), m("p", A, "暂无操作"))]),
120
+ _: 2
121
+ }, 1040, [
122
+ "data-kima-menu-index",
123
+ "aria-label",
124
+ "onKeydown"
125
+ ])) : p("", !0)]),
126
+ _: 2
127
+ }, 1040)]),
128
+ _: 2
129
+ }, 1032, ["value"]))), 128))]),
130
+ _: 1
131
+ }, 16, ["model-value", "aria-label"]));
132
+ }
133
+ }), [["__scopeId", "data-v-c4c69411"]]);
134
+ export { j as default };
@@ -0,0 +1,264 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import n from "../core/icon.ce.js";
4
+ import { presenceTransition as r } from "../../utils/motion.js";
5
+ import { dismissInteraction as ee, useChoiceCursor as te, useInteractionModel as i, useInteractionReset as a, useInteractionRoot as o, usePlacement as s } from "../../utils/interaction.js";
6
+ import ne from "../core/icon-button.ce.js";
7
+ import re from "./chip.ce.js";
8
+ /* empty css */
9
+ import { Fragment as c, Transition as l, TransitionGroup as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, mergeProps as v, nextTick as y, openBlock as b, ref as x, renderList as S, toDisplayString as C, unref as w, useId as ie, vModelText as ae, watch as oe, withCtx as T, withDirectives as se, withKeys as ce, withModifiers as E } from "vue";
10
+ import { PopoverContent as le, PopoverRoot as ue, PopoverTrigger as de } from "reka-ui";
11
+ import { Cancel01Icon as fe, Tick01Icon as pe } from "@hugeicons/core-free-icons";
12
+ // src/components/interaction/multi-select.ce.vue
13
+ var me = { class: "kima-multi-select__control" }, he = ["aria-activedescendant"], ge = [
14
+ "aria-label",
15
+ "tabindex",
16
+ "aria-activedescendant"
17
+ ], D = [
18
+ "id",
19
+ "aria-selected",
20
+ "aria-disabled",
21
+ "data-active",
22
+ "onPointermove",
23
+ "onClick"
24
+ ], O = { key: 0 }, k = {
25
+ key: 1,
26
+ role: "status"
27
+ }, A = {
28
+ key: 0,
29
+ class: "kima-multi-select__clear"
30
+ }, j = [
31
+ "name",
32
+ "required",
33
+ "disabled"
34
+ ], M = [
35
+ "value",
36
+ "data-index",
37
+ "disabled",
38
+ "selected"
39
+ ], N = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
40
+ __name: "multi-select.ce",
41
+ props: {
42
+ modelValue: {
43
+ type: Array,
44
+ default: () => []
45
+ },
46
+ open: Boolean,
47
+ items: {
48
+ type: Array,
49
+ default: () => []
50
+ },
51
+ name: String,
52
+ required: Boolean,
53
+ disabled: Boolean,
54
+ searchable: {
55
+ type: Boolean,
56
+ default: !0
57
+ },
58
+ clearable: {
59
+ type: Boolean,
60
+ default: !0
61
+ },
62
+ label: {
63
+ type: String,
64
+ default: "多选"
65
+ },
66
+ placeholder: {
67
+ type: String,
68
+ default: "请选择多个项目"
69
+ },
70
+ placement: {
71
+ type: String,
72
+ default: "bottom-start"
73
+ }
74
+ },
75
+ emits: [
76
+ "update:modelValue",
77
+ "update:open",
78
+ "change"
79
+ ],
80
+ setup(e, { emit: N }) {
81
+ let P = e, F = N, { root: I, attrs: L, forwardedAttrs: _e } = o(), [R, z] = i(P, "modelValue", F), [B, ve] = i(P, "open", F), ye = s(P), V = x(""), H = x(null), U = x(null), W = `kima-multi-select-${ie()}`, G = d(() => Array.isArray(R.value) ? R.value : []), K = d(() => P.items.filter((e) => G.value.includes(e.value))), q = d(() => P.items.filter((e) => `${e.label} ${e.description || ""}`.toLocaleLowerCase().includes(V.value.trim().toLocaleLowerCase())));
82
+ function J(e) {
83
+ P.disabled || (z(e), F("change", [...e]));
84
+ }
85
+ function Y(e) {
86
+ P.disabled || e.disabled || J(G.value.includes(e.value) ? G.value.filter((t) => !Object.is(t, e.value)) : [...G.value, e.value]);
87
+ }
88
+ function be(e) {
89
+ e.disabled || J(G.value.filter((t) => !Object.is(t, e.value)));
90
+ }
91
+ function xe() {
92
+ J(P.items.filter((e) => e.disabled && G.value.includes(e.value)).map((e) => e.value));
93
+ }
94
+ function X(e) {
95
+ e && P.disabled || (e && !B.value && (V.value = ""), ve(e));
96
+ }
97
+ let { active: Z, activeId: Q, highlight: Se, keydown: Ce } = te(q, Y, `${W}-option`);
98
+ function $(e) {
99
+ if (!e.isComposing) {
100
+ if (e.key === " " && !P.searchable) {
101
+ e.preventDefault();
102
+ let t = q.value[Z.value];
103
+ t && Y(t);
104
+ } else Ce(e);
105
+ }
106
+ }
107
+ function we(e) {
108
+ e.preventDefault(), y(() => {
109
+ B.value && !P.disabled && (P.searchable ? H.value : U.value)?.focus();
110
+ });
111
+ }
112
+ function Te(e) {
113
+ J([...e.target.selectedOptions].map((e) => P.items[Number(e.dataset.index)].value));
114
+ }
115
+ return a(I, R, z, () => X(!1)), oe(() => P.disabled, (e) => {
116
+ e && X(!1);
117
+ }), (te, i) => (b(), m("div", v({
118
+ ref_key: "root",
119
+ ref: I
120
+ }, w(_e), { class: "kima-multi-select" }), [
121
+ _(u, v({
122
+ tag: "div",
123
+ name: "kima-list"
124
+ }, w(r), { class: "kima-multi-select__chips" }), {
125
+ default: T(() => [(b(!0), m(c, null, S(K.value, (t) => (b(), m("span", {
126
+ key: t.value,
127
+ class: "kima-multi-select__chip"
128
+ }, [_(re, {
129
+ removable: "",
130
+ label: t.label,
131
+ disabled: e.disabled || t.disabled,
132
+ value: t.value,
133
+ onRemove: (e) => be(t)
134
+ }, {
135
+ default: T(() => [g(C(t.label), 1)]),
136
+ _: 2
137
+ }, 1032, [
138
+ "label",
139
+ "disabled",
140
+ "value",
141
+ "onRemove"
142
+ ])]))), 128))]),
143
+ _: 1
144
+ }, 16),
145
+ h("div", me, [_(w(ue), {
146
+ open: w(B) && !e.disabled,
147
+ modal: !1,
148
+ "onUpdate:open": X
149
+ }, {
150
+ default: T(() => [_(w(de), { "as-child": "" }, {
151
+ default: T(() => [_(t, {
152
+ variant: "tonal",
153
+ disabled: e.disabled,
154
+ "aria-label": w(L)["aria-label"] || e.label,
155
+ "aria-required": e.required || void 0,
156
+ onKeydown: i[0] ||= ce(E((e) => X(!0), ["prevent"]), ["down"])
157
+ }, {
158
+ default: T(() => [g(C(K.value.length ? `已选择 ${K.value.length} 项` : e.placeholder), 1)]),
159
+ _: 1
160
+ }, 8, [
161
+ "disabled",
162
+ "aria-label",
163
+ "aria-required"
164
+ ])]),
165
+ _: 1
166
+ }), _(l, v({ name: "kima-popup" }, w(r)), {
167
+ default: T(() => [w(B) && !e.disabled ? (b(), f(w(le), v({
168
+ key: 0,
169
+ "force-mount": ""
170
+ }, w(ye), {
171
+ class: "kima-multi-select__popup",
172
+ "aria-label": e.label,
173
+ onOpenAutoFocus: we,
174
+ onEscapeKeyDown: i[5] ||= (e) => w(ee)(e, () => X(!1))
175
+ }), {
176
+ default: T(() => [
177
+ e.searchable ? se((b(), m("input", {
178
+ key: 0,
179
+ ref_key: "search",
180
+ ref: H,
181
+ "onUpdate:modelValue": i[1] ||= (e) => V.value = e,
182
+ class: "kima-multi-select__search",
183
+ type: "search",
184
+ role: "combobox",
185
+ "aria-expanded": "true",
186
+ "aria-autocomplete": "list",
187
+ "aria-label": "搜索选项",
188
+ "aria-controls": W,
189
+ "aria-activedescendant": w(Q),
190
+ onKeydown: $,
191
+ onInput: i[2] ||= E(() => {}, ["stop"]),
192
+ onChange: i[3] ||= E(() => {}, ["stop"])
193
+ }, null, 40, he)), [[ae, V.value]]) : p("", !0),
194
+ h("div", {
195
+ id: W,
196
+ ref_key: "panel",
197
+ ref: U,
198
+ class: "kima-multi-select__list",
199
+ role: "listbox",
200
+ "aria-multiselectable": "true",
201
+ "aria-label": e.label,
202
+ tabindex: e.searchable ? -1 : 0,
203
+ "aria-activedescendant": e.searchable ? void 0 : w(Q),
204
+ onKeydown: $
205
+ }, [(b(!0), m(c, null, S(q.value, (e, t) => (b(), m("div", {
206
+ id: `${W}-option-${t}`,
207
+ key: e.value,
208
+ class: "kima-multi-select__item",
209
+ role: "option",
210
+ "aria-selected": G.value.includes(e.value),
211
+ "aria-disabled": e.disabled || void 0,
212
+ "data-active": w(Z) === t,
213
+ onPointerdown: i[4] ||= E(() => {}, ["prevent"]),
214
+ onPointermove: (n) => !e.disabled && w(Se)(t),
215
+ onClick: (t) => Y(e)
216
+ }, [h("span", null, [g(C(e.label), 1), e.description ? (b(), m("small", O, C(e.description), 1)) : p("", !0)]), G.value.includes(e.value) ? (b(), f(n, {
217
+ key: 0,
218
+ icon: w(pe),
219
+ size: 20,
220
+ "aria-hidden": "true"
221
+ }, null, 8, ["icon"])) : p("", !0)], 40, D))), 128))], 40, ge),
222
+ q.value.length ? p("", !0) : (b(), m("p", k, "没有匹配选项"))
223
+ ]),
224
+ _: 1
225
+ }, 16, ["aria-label"])) : p("", !0)]),
226
+ _: 1
227
+ }, 16)]),
228
+ _: 1
229
+ }, 8, ["open"]), _(l, v({ name: "kima-content" }, w(r)), {
230
+ default: T(() => [e.clearable && K.value.length ? (b(), m("span", A, [_(ne, {
231
+ label: "清除选择",
232
+ disabled: e.disabled,
233
+ onClick: xe
234
+ }, {
235
+ default: T(() => [_(n, {
236
+ icon: w(fe),
237
+ size: 20
238
+ }, null, 8, ["icon"])]),
239
+ _: 1
240
+ }, 8, ["disabled"])])) : p("", !0)]),
241
+ _: 1
242
+ }, 16)]),
243
+ h("select", {
244
+ class: "kima-multi-select__native",
245
+ multiple: "",
246
+ name: e.name,
247
+ required: e.required,
248
+ disabled: e.disabled,
249
+ tabindex: "-1",
250
+ "aria-hidden": "true",
251
+ onInput: i[6] ||= E(() => {}, ["stop"]),
252
+ onChange: E(Te, ["stop"]),
253
+ onInvalid: i[7] ||= E((e) => w(I)?.querySelector("button")?.focus(), ["prevent"])
254
+ }, [(b(!0), m(c, null, S(e.items, (e, t) => (b(), m("option", {
255
+ key: e.value,
256
+ value: String(e.value),
257
+ "data-index": t,
258
+ disabled: e.disabled,
259
+ selected: G.value.includes(e.value)
260
+ }, C(e.label), 9, M))), 128))], 40, j)
261
+ ], 16));
262
+ }
263
+ }), [["__scopeId", "data-v-b5be8e98"]]);
264
+ export { N as default };