@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,74 @@
1
+ import { useNativeSlots as e } from "../../utils/native-slots.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { collapseTransition as n, presenceTransition as r } from "../../utils/motion.js";
4
+ /* empty css */
5
+ import { Transition as i, computed as a, createElementBlock as o, createElementVNode as s, createVNode as c, mergeProps as l, onBeforeUnmount as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g, useId as _, vShow as v, watch as y, withCtx as b, withDirectives as x } from "vue";
6
+ // src/components/input/field.ce.vue
7
+ var S = ["inert", "aria-hidden"], C = ["role"], w = /*#__PURE__*/ t({
8
+ __name: "field.ce",
9
+ props: {
10
+ hint: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ error: {
15
+ type: String,
16
+ default: ""
17
+ }
18
+ },
19
+ setup(t) {
20
+ let w = t, T = p(null);
21
+ e(T);
22
+ let E = `kima-field-${_()}`, D = a(() => w.error || w.hint), O = p(D.value), k = p(!!w.error);
23
+ y([D, () => w.error], ([e, t]) => {
24
+ e && (O.value = e, k.value = !!t);
25
+ });
26
+ let A = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set(), M;
27
+ function N() {
28
+ return [...T.value.querySelectorAll("input:not([type=\"hidden\"]),textarea,select,button[role=\"combobox\"],[role=\"radiogroup\"]")].filter((e) => e.closest(".kima-field") === T.value);
29
+ }
30
+ function P() {
31
+ if (T.value) for (let e of N()) {
32
+ let t = (e.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean).filter((e) => e !== E);
33
+ D.value && (t.push(E), j.add(e));
34
+ let n = t.join(" ");
35
+ (e.getAttribute("aria-describedby") || "") !== n && (n ? e.setAttribute("aria-describedby", n) : e.removeAttribute("aria-describedby")), w.error && !e.hasAttribute("aria-invalid") && (e.setAttribute("aria-invalid", "true"), A.add(e)), !w.error && A.has(e) && (e.removeAttribute("aria-invalid"), A.delete(e));
36
+ }
37
+ }
38
+ return y(D, P, { flush: "post" }), y(() => w.error, P, { flush: "post" }), d(() => {
39
+ P(), M = new MutationObserver(P), M.observe(T.value, {
40
+ childList: !0,
41
+ subtree: !0,
42
+ attributes: !0,
43
+ attributeFilter: ["aria-describedby", "aria-invalid"]
44
+ });
45
+ }), u(() => {
46
+ M?.disconnect();
47
+ for (let e of j) {
48
+ let t = (e.getAttribute("aria-describedby") || "").split(/\s+/).filter((e) => e && e !== E);
49
+ t.length ? e.setAttribute("aria-describedby", t.join(" ")) : e.removeAttribute("aria-describedby");
50
+ }
51
+ for (let e of A) e.removeAttribute("aria-invalid");
52
+ }), (e, t) => (f(), o("div", {
53
+ ref_key: "root",
54
+ ref: T,
55
+ class: "kima-field"
56
+ }, [m(e.$slots, "default", {}, void 0, !0), c(i, l({ css: !1 }, g(n)), {
57
+ default: b(() => [x(s("div", {
58
+ id: E,
59
+ class: "kima-field__messages",
60
+ inert: !D.value,
61
+ "aria-hidden": !D.value || void 0
62
+ }, [c(i, l({ name: "kima-content" }, g(r)), {
63
+ default: b(() => [(f(), o("p", {
64
+ key: `${k.value}:${O.value}`,
65
+ class: "kima-field__message",
66
+ role: k.value ? "alert" : void 0
67
+ }, h(O.value), 9, C))]),
68
+ _: 1
69
+ }, 16)], 8, S), [[v, D.value]])]),
70
+ _: 1
71
+ }, 16)], 512));
72
+ }
73
+ }, [["__scopeId", "data-v-f2ce3fc2"]]);
74
+ export { w as default };
@@ -0,0 +1,142 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import n from "../core/button.ce.js";
4
+ import { collapseTransition as r, presenceTransition as i } from "../../utils/motion.js";
5
+ import { useInputAttrs as a, useInputState as o } from "../../utils/input-state.js";
6
+ /* empty css */
7
+ import { Fragment as s, Transition as c, TransitionGroup as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, mergeProps as m, nextTick as h, normalizeClass as g, normalizeStyle as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, toRaw as S, unref as C, vShow as w, watch as T, withCtx as E, withDirectives as D, withModifiers as O } from "vue";
8
+ // src/components/input/file-upload.ce.vue
9
+ var k = ["aria-disabled"], A = ["aria-disabled"], j = [
10
+ "aria-label",
11
+ "name",
12
+ "accept",
13
+ "multiple",
14
+ "disabled",
15
+ "required"
16
+ ], M = ["inert", "aria-hidden"], N = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
17
+ __name: "file-upload.ce",
18
+ props: {
19
+ modelValue: {
20
+ type: Array,
21
+ default: () => []
22
+ },
23
+ label: {
24
+ type: String,
25
+ default: "选择文件或拖放到此处"
26
+ },
27
+ name: String,
28
+ accept: String,
29
+ multiple: Boolean,
30
+ disabled: Boolean,
31
+ required: Boolean,
32
+ maxSize: {
33
+ type: Number,
34
+ default: Infinity
35
+ },
36
+ maxFiles: {
37
+ type: Number,
38
+ default: Infinity
39
+ }
40
+ },
41
+ emits: [
42
+ "update:modelValue",
43
+ "change",
44
+ "reject"
45
+ ],
46
+ setup(t, { emit: N }) {
47
+ let P = t, F = N, I = y(null), L = y(null), R = y(!1), { attrs: z, controlAttrs: B } = a(), { local: V, update: H } = o(P, F, I, (e) => Array.isArray(e) ? e : [], () => h(U));
48
+ e(I);
49
+ function U() {
50
+ if (!L.value) return;
51
+ let e = new DataTransfer();
52
+ for (let t of V.value) t instanceof File && e.items.add(t);
53
+ L.value.files = e.files;
54
+ }
55
+ T(V, () => h(U), {
56
+ immediate: !0,
57
+ deep: !0
58
+ });
59
+ function W(e) {
60
+ return !P.accept || P.accept.split(",").some((t) => {
61
+ let n = t.trim().toLowerCase();
62
+ return n ? n.startsWith(".") ? e.name.toLowerCase().endsWith(n) : n.endsWith("/*") ? e.type.toLowerCase().startsWith(n.slice(0, -1)) : e.type.toLowerCase() === n : !1;
63
+ });
64
+ }
65
+ function G(e) {
66
+ if (P.disabled) return;
67
+ let t = [], n = Math.max(0, P.multiple ? P.maxFiles : Math.min(1, P.maxFiles));
68
+ for (let r of e) {
69
+ let e = W(r) ? r.size > P.maxSize ? "size" : t.length >= n ? "count" : "" : "accept";
70
+ e ? F("reject", {
71
+ file: r,
72
+ reason: e
73
+ }) : t.push(r);
74
+ }
75
+ H(t), h(U);
76
+ }
77
+ function K(e) {
78
+ R.value = !1, G([...e.dataTransfer.files]);
79
+ }
80
+ function q(e) {
81
+ P.disabled || H(V.value.filter((t, n) => n !== e));
82
+ }
83
+ let J = /* @__PURE__ */ new WeakMap(), Y = 0;
84
+ function X(e, t) {
85
+ let n = S(e);
86
+ J.has(n) || J.set(n, ++Y);
87
+ let r = V.value.slice(0, t).filter((e) => S(e) === n).length;
88
+ return `${J.get(n)}-${r}`;
89
+ }
90
+ return (e, a) => (v(), u("div", {
91
+ class: g(["kima-file-upload", C(z).class]),
92
+ style: _(C(z).style),
93
+ "aria-disabled": t.disabled || void 0
94
+ }, [d("div", {
95
+ ref_key: "root",
96
+ ref: I,
97
+ class: g(["kima-file-upload__drop", { "kima-file-upload__drop--active": R.value && !t.disabled }]),
98
+ "aria-disabled": t.disabled || void 0,
99
+ onDragover: a[2] ||= O((e) => R.value = !0, ["prevent"]),
100
+ onDragleave: a[3] ||= O((e) => R.value = !1, ["prevent"]),
101
+ onDrop: O(K, ["prevent"])
102
+ }, [d("input", m({
103
+ ref_key: "input",
104
+ ref: L
105
+ }, C(B), {
106
+ type: "file",
107
+ "aria-label": C(B)["aria-label"] || t.label,
108
+ name: t.name,
109
+ accept: t.accept,
110
+ multiple: t.multiple,
111
+ disabled: t.disabled,
112
+ required: t.required,
113
+ onInput: a[0] ||= O(() => {}, ["stop"]),
114
+ onChange: a[1] ||= O((e) => G([...e.target.files]), ["stop"])
115
+ }), null, 16, j), d("p", null, x(t.label), 1)], 42, A), p(c, m({ css: !1 }, C(r)), {
116
+ default: E(() => [D(d("div", {
117
+ inert: !C(V).length,
118
+ "aria-hidden": !C(V).length || void 0
119
+ }, [p(l, m({
120
+ tag: "ul",
121
+ name: "kima-list"
122
+ }, C(i), { class: "kima-file-upload__files" }), {
123
+ default: E(() => [(v(!0), u(s, null, b(C(V), (e, r) => (v(), u("li", { key: X(e, r) }, [d("span", null, x(e.name) + " · " + x(e.size) + " B", 1), p(n, {
124
+ variant: "text",
125
+ disabled: t.disabled,
126
+ "aria-label": `移除 ${e.name}`,
127
+ onClick: (e) => q(r)
128
+ }, {
129
+ default: E(() => [...a[4] ||= [f("移除", -1)]]),
130
+ _: 1
131
+ }, 8, [
132
+ "disabled",
133
+ "aria-label",
134
+ "onClick"
135
+ ])]))), 128))]),
136
+ _: 1
137
+ }, 16)], 8, M), [[w, C(V).length]])]),
138
+ _: 1
139
+ }, 16)], 14, k));
140
+ }
141
+ }), [["__scopeId", "data-v-17268263"]]);
142
+ export { N as default };
@@ -0,0 +1,103 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import n from "../core/button.ce.js";
4
+ import { useInputAttrs as r, useInputState as i } from "../../utils/input-state.js";
5
+ /* empty css */
6
+ import { createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, mergeProps as l, normalizeClass as u, normalizeStyle as d, openBlock as f, ref as p, unref as m, withCtx as h, withModifiers as g } from "vue";
7
+ // src/components/input/number-field.ce.vue
8
+ var _ = ["aria-disabled"], v = [
9
+ "aria-label",
10
+ "name",
11
+ "value",
12
+ "min",
13
+ "max",
14
+ "step",
15
+ "required",
16
+ "disabled",
17
+ "readonly",
18
+ "placeholder"
19
+ ], y = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
20
+ __name: "number-field.ce",
21
+ props: {
22
+ modelValue: {
23
+ type: Number,
24
+ default: null
25
+ },
26
+ label: String,
27
+ name: String,
28
+ disabled: Boolean,
29
+ readonly: Boolean,
30
+ required: Boolean,
31
+ min: Number,
32
+ max: Number,
33
+ step: {
34
+ type: [Number, String],
35
+ default: 1
36
+ },
37
+ placeholder: String
38
+ },
39
+ emits: ["update:modelValue", "change"],
40
+ setup(t, { expose: y, emit: b }) {
41
+ let x = t, S = b, C = p(null), w = p(null), { attrs: T, controlAttrs: E } = r(), { local: D, update: O } = i(x, S, C, (e) => Number.isFinite(e) ? e : null, (e) => {
42
+ w.value && (w.value.value = e ?? "");
43
+ });
44
+ e(C);
45
+ function k(e) {
46
+ O(Number.isFinite(e.target.valueAsNumber) ? e.target.valueAsNumber : null, !1);
47
+ }
48
+ function A(e) {
49
+ if (!(x.disabled || x.readonly)) {
50
+ if (x.step === "any") {
51
+ let t = Math.min(x.max ?? Infinity, Math.max(x.min ?? -Infinity, (D.value ?? 0) + e));
52
+ w.value.value = t;
53
+ } else e > 0 ? w.value.stepUp() : w.value.stepDown();
54
+ O(w.value.valueAsNumber), w.value.focus();
55
+ }
56
+ }
57
+ return y({ focus: () => w.value?.focus() }), (e, r) => (f(), a("div", {
58
+ ref_key: "root",
59
+ ref: C,
60
+ class: u(["kima-number-field", m(T).class]),
61
+ style: d(m(T).style),
62
+ "aria-disabled": t.disabled || void 0
63
+ }, [
64
+ c(n, {
65
+ variant: "text",
66
+ disabled: t.disabled || t.readonly || t.min != null && m(D) != null && m(D) <= t.min,
67
+ "aria-label": "减少",
68
+ onClick: r[0] ||= (e) => A(-1)
69
+ }, {
70
+ default: h(() => [...r[3] ||= [s("−", -1)]]),
71
+ _: 1
72
+ }, 8, ["disabled"]),
73
+ o("input", l({
74
+ ref_key: "input",
75
+ ref: w
76
+ }, m(E), {
77
+ type: "number",
78
+ "aria-label": m(E)["aria-label"] || t.label,
79
+ name: t.name,
80
+ value: m(D) ?? "",
81
+ min: t.min,
82
+ max: t.max,
83
+ step: t.step,
84
+ required: t.required,
85
+ disabled: t.disabled,
86
+ readonly: t.readonly,
87
+ placeholder: t.placeholder,
88
+ onInput: g(k, ["stop"]),
89
+ onChange: r[1] ||= g((e) => S("change", m(D)), ["stop"])
90
+ }), null, 16, v),
91
+ c(n, {
92
+ variant: "text",
93
+ disabled: t.disabled || t.readonly || t.max != null && m(D) != null && m(D) >= t.max,
94
+ "aria-label": "增加",
95
+ onClick: r[2] ||= (e) => A(1)
96
+ }, {
97
+ default: h(() => [...r[4] ||= [s("+", -1)]]),
98
+ _: 1
99
+ }, 8, ["disabled"])
100
+ ], 14, _));
101
+ }
102
+ }), [["__scopeId", "data-v-9eb508b4"]]);
103
+ export { y as default };
@@ -0,0 +1,112 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { useInputAttrs as n, useInputState as r } from "../../utils/input-state.js";
4
+ /* empty css */
5
+ import { Fragment as i, computed as a, createElementBlock as o, createElementVNode as s, isRef as c, mergeProps as l, normalizeClass as u, normalizeStyle as d, openBlock as f, ref as p, renderList as m, unref as h, watch as g, withModifiers as _ } from "vue";
6
+ // src/components/input/pin-input.ce.vue
7
+ var v = ["aria-disabled"], y = {
8
+ class: "kima-pin-input__cells",
9
+ "aria-hidden": "true"
10
+ }, b = [
11
+ "type",
12
+ "value",
13
+ "aria-label",
14
+ "name",
15
+ "disabled",
16
+ "readonly",
17
+ "required",
18
+ "minlength",
19
+ "maxlength",
20
+ "pattern",
21
+ "inputmode"
22
+ ], x = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
23
+ __name: "pin-input.ce",
24
+ props: {
25
+ modelValue: {
26
+ type: String,
27
+ default: ""
28
+ },
29
+ label: {
30
+ type: String,
31
+ default: "验证码"
32
+ },
33
+ name: String,
34
+ length: {
35
+ type: Number,
36
+ default: 6
37
+ },
38
+ type: {
39
+ type: String,
40
+ default: "numeric"
41
+ },
42
+ masked: Boolean,
43
+ disabled: Boolean,
44
+ readonly: Boolean,
45
+ required: Boolean
46
+ },
47
+ emits: [
48
+ "update:modelValue",
49
+ "change",
50
+ "complete"
51
+ ],
52
+ setup(t, { expose: x, emit: S }) {
53
+ let C = t, w = S, T = p(null), E = p(null), D = !1, O = a(() => Math.max(1, Math.min(12, Math.floor(C.length) || 6)));
54
+ function k(e) {
55
+ let t = String(e ?? "");
56
+ return (C.type === "numeric" ? t.replace(/[^0-9]/g, "") : t.replace(/[^a-z0-9]/gi, "").toUpperCase()).slice(0, O.value);
57
+ }
58
+ let { attrs: A, controlAttrs: j } = n(), { local: M, update: N } = r(C, w, T, k, (e) => {
59
+ D = !1, E.value && (E.value.value = e);
60
+ });
61
+ e(T), g([O, () => C.type], () => {
62
+ M.value = k(M.value);
63
+ });
64
+ function P(e) {
65
+ if (D || e.isComposing) return;
66
+ let t = k(e.target.value), n = M.value;
67
+ t !== n && N(t, !1), e.target.value = t, t.length === O.value && t !== n && w("complete", t);
68
+ }
69
+ function F(e) {
70
+ if (C.disabled || C.readonly || D) return;
71
+ e.preventDefault();
72
+ let t = E.value, n = k(e.clipboardData.getData("text")), r = t.selectionStart ?? M.value.length, i = t.selectionEnd ?? r, a = k(M.value.slice(0, r) + n + M.value.slice(i)), o = M.value;
73
+ N(a, !1), t.value = a, t.setSelectionRange(Math.min(a.length, r + n.length), Math.min(a.length, r + n.length)), a.length === O.value && a !== o && w("complete", a);
74
+ }
75
+ return x({ focus: () => E.value?.focus() }), (e, n) => (f(), o("div", {
76
+ ref_key: "root",
77
+ ref: T,
78
+ class: u(["kima-pin-input", h(A).class]),
79
+ style: d([h(A).style, { "--kima-pin-length": O.value }]),
80
+ "aria-disabled": t.disabled || void 0
81
+ }, [s("span", y, [(f(!0), o(i, null, m(O.value, (e) => (f(), o("span", {
82
+ key: e,
83
+ class: "kima-pin-input__cell"
84
+ }))), 128))]), s("input", l({
85
+ ref_key: "input",
86
+ ref: E
87
+ }, h(j), {
88
+ type: t.masked ? "password" : "text",
89
+ value: h(M),
90
+ "aria-label": h(j)["aria-label"] || t.label,
91
+ name: t.name,
92
+ disabled: t.disabled,
93
+ readonly: t.readonly,
94
+ required: t.required,
95
+ minlength: O.value,
96
+ maxlength: O.value,
97
+ pattern: t.type === "numeric" ? `[0-9]{${O.value}}` : `[A-Za-z0-9]{${O.value}}`,
98
+ inputmode: t.type === "numeric" ? "numeric" : "text",
99
+ autocomplete: "one-time-code",
100
+ autocapitalize: "characters",
101
+ spellcheck: "false",
102
+ onInput: _(P, ["stop"]),
103
+ onPaste: F,
104
+ onChange: n[0] ||= _((e) => w("change", h(M)), ["stop"]),
105
+ onCompositionstart: n[1] ||= (e) => c(D) ? D.value = !0 : D = !0,
106
+ onCompositionend: n[2] ||= (e) => {
107
+ c(D) ? D.value = !1 : D = !1, P(e);
108
+ }
109
+ }), null, 16, b)], 14, v));
110
+ }
111
+ }), [["__scopeId", "data-v-0d93e989"]]);
112
+ export { x as default };
@@ -0,0 +1,96 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { useInputAttrs as n, useInputState as r } from "../../utils/input-state.js";
4
+ /* empty css */
5
+ import { Fragment as i, computed as a, createElementBlock as o, createElementVNode as s, mergeProps as c, normalizeClass as l, openBlock as u, ref as d, renderList as f, toDisplayString as p, unref as m, withModifiers as h } from "vue";
6
+ // src/components/input/radio-group.ce.vue
7
+ var g = [
8
+ "aria-label",
9
+ "aria-required",
10
+ "aria-orientation",
11
+ "disabled",
12
+ "aria-disabled"
13
+ ], _ = [
14
+ "name",
15
+ "value",
16
+ "checked",
17
+ "disabled",
18
+ "required",
19
+ "tabindex",
20
+ "onChange"
21
+ ], v = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
22
+ __name: "radio-group.ce",
23
+ props: {
24
+ modelValue: {
25
+ type: [String, Number],
26
+ default: ""
27
+ },
28
+ options: {
29
+ type: Array,
30
+ default: () => []
31
+ },
32
+ label: String,
33
+ name: String,
34
+ disabled: Boolean,
35
+ required: Boolean,
36
+ orientation: {
37
+ type: String,
38
+ default: "vertical"
39
+ }
40
+ },
41
+ emits: ["update:modelValue", "change"],
42
+ setup(t, { emit: v }) {
43
+ let y = t, b = v, x = d(null), { attrs: S, controlAttrs: C } = n(), w = a(() => y.options.map((e) => typeof e == "object" ? e : {
44
+ value: e,
45
+ label: String(e)
46
+ })), { local: T, update: E } = r(y, b, x);
47
+ e(x);
48
+ let D = a(() => {
49
+ let e = w.value.findIndex((e) => e.value === T.value && !e.disabled);
50
+ return e < 0 ? w.value.findIndex((e) => !e.disabled) : e;
51
+ });
52
+ function O(e) {
53
+ if (y.disabled || ![
54
+ "ArrowRight",
55
+ "ArrowLeft",
56
+ "ArrowDown",
57
+ "ArrowUp",
58
+ "Home",
59
+ "End"
60
+ ].includes(e.key)) return;
61
+ e.preventDefault();
62
+ let t = [...x.value.querySelectorAll("input[type=\"radio\"]:not(:disabled)")];
63
+ if (!t.length) return;
64
+ let n = getComputedStyle(x.value).direction === "rtl", r = e.key === "ArrowUp" || e.key === (n ? "ArrowRight" : "ArrowLeft"), i = t.indexOf(e.target), a = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (i + (r ? -1 : 1) + t.length) % t.length;
65
+ t[a].focus(), t[a].click();
66
+ }
67
+ return (e, n) => (u(), o("fieldset", c({
68
+ ref_key: "root",
69
+ ref: x
70
+ }, m(C), {
71
+ class: ["kima-radio-group", m(S).class],
72
+ style: m(S).style,
73
+ role: "radiogroup",
74
+ "aria-label": m(C)["aria-label"] || t.label,
75
+ "aria-required": t.required || void 0,
76
+ "aria-orientation": t.orientation,
77
+ disabled: t.disabled,
78
+ "aria-disabled": t.disabled || void 0,
79
+ onKeydown: O
80
+ }), [(u(!0), o(i, null, f(w.value, (e, r) => (u(), o("label", {
81
+ key: e.value,
82
+ class: l(["kima-radio-group__item", { "kima-radio-group__item--disabled": e.disabled }])
83
+ }, [s("input", {
84
+ type: "radio",
85
+ name: t.name,
86
+ value: e.value,
87
+ checked: m(T) === e.value,
88
+ disabled: t.disabled || e.disabled,
89
+ required: t.required,
90
+ tabindex: r === D.value ? 0 : -1,
91
+ onInput: n[0] ||= h(() => {}, ["stop"]),
92
+ onChange: h((t) => m(E)(e.value), ["stop"])
93
+ }, null, 40, _), s("span", null, p(e.label), 1)], 2))), 128))], 16, g));
94
+ }
95
+ }), [["__scopeId", "data-v-30add112"]]);
96
+ export { v as default };
@@ -0,0 +1,115 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import n from "../core/button.ce.js";
4
+ import r from "../core/icon.ce.js";
5
+ import { useInputAttrs as i, useInputState as a } from "../../utils/input-state.js";
6
+ /* empty css */
7
+ import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, mergeProps as m, normalizeClass as h, normalizeStyle as g, openBlock as _, ref as v, renderList as y, unref as b, withCtx as x, withModifiers as S } from "vue";
8
+ import { StarIcon as C } from "@hugeicons/core-free-icons";
9
+ // src/components/input/rating.ce.vue
10
+ var w = [
11
+ "aria-label",
12
+ "aria-required",
13
+ "aria-disabled",
14
+ "aria-readonly"
15
+ ], T = [
16
+ "name",
17
+ "value",
18
+ "checked",
19
+ "aria-label",
20
+ "disabled",
21
+ "required",
22
+ "tabindex",
23
+ "aria-readonly",
24
+ "onChange"
25
+ ], E = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
26
+ __name: "rating.ce",
27
+ props: {
28
+ modelValue: {
29
+ type: Number,
30
+ default: 0
31
+ },
32
+ label: {
33
+ type: String,
34
+ default: "评分"
35
+ },
36
+ name: String,
37
+ max: {
38
+ type: Number,
39
+ default: 5
40
+ },
41
+ disabled: Boolean,
42
+ readonly: Boolean,
43
+ required: Boolean,
44
+ clearable: Boolean
45
+ },
46
+ emits: ["update:modelValue", "change"],
47
+ setup(t, { emit: E }) {
48
+ let D = t, O = E, k = v(null), A = s(() => Math.max(1, Math.min(20, Math.floor(D.max) || 5))), { attrs: j, controlAttrs: M } = i(), { local: N, update: P } = a(D, O, k, (e) => Math.min(A.value, Math.max(0, Math.round(e) || 0)));
49
+ e(k);
50
+ function F(e) {
51
+ if (![
52
+ "ArrowRight",
53
+ "ArrowLeft",
54
+ "ArrowUp",
55
+ "ArrowDown",
56
+ "Home",
57
+ "End",
58
+ " "
59
+ ].includes(e.key)) return;
60
+ if (D.readonly || D.disabled) {
61
+ e.preventDefault();
62
+ return;
63
+ }
64
+ if (e.key === " ") return;
65
+ e.preventDefault();
66
+ let t = getComputedStyle(k.value).direction === "rtl", n = e.key === "ArrowUp" || e.key === (t ? "ArrowLeft" : "ArrowRight"), r = e.key === "Home" ? 1 : e.key === "End" ? A.value : Math.max(1, Math.min(A.value, N.value + (n ? 1 : -1)));
67
+ P(r), k.value.querySelectorAll("input[type=\"radio\"]")[r - 1]?.focus();
68
+ }
69
+ return (e, i) => (_(), u("div", {
70
+ class: h(["kima-rating-wrap", b(j).class]),
71
+ style: g(b(j).style)
72
+ }, [d("div", m({
73
+ ref_key: "root",
74
+ ref: k
75
+ }, b(M), {
76
+ class: "kima-rating",
77
+ role: "radiogroup",
78
+ "aria-label": b(M)["aria-label"] || t.label,
79
+ "aria-required": t.required || void 0,
80
+ "aria-disabled": t.disabled || void 0,
81
+ "aria-readonly": t.readonly || void 0,
82
+ onKeydown: F
83
+ }), [(_(!0), u(o, null, y(A.value, (e) => (_(), u("label", {
84
+ key: e,
85
+ class: h(["kima-rating__star", { "kima-rating__star--filled": e <= b(N) }])
86
+ }, [d("input", {
87
+ type: "radio",
88
+ name: t.name,
89
+ value: e,
90
+ checked: e === b(N),
91
+ "aria-label": `${e} / ${A.value}`,
92
+ disabled: t.disabled,
93
+ required: t.required,
94
+ tabindex: e === (b(N) || 1) ? 0 : -1,
95
+ "aria-readonly": t.readonly || void 0,
96
+ onClick: i[0] ||= (e) => t.readonly && e.preventDefault(),
97
+ onInput: i[1] ||= S(() => {}, ["stop"]),
98
+ onChange: S((t) => b(P)(e), ["stop"])
99
+ }, null, 40, T), p(r, {
100
+ icon: b(C),
101
+ size: 28,
102
+ "aria-hidden": "true"
103
+ }, null, 8, ["icon"])], 2))), 128))], 16, w), t.clearable && !t.readonly ? (_(), c(n, {
104
+ key: 0,
105
+ variant: "text",
106
+ disabled: t.disabled || !b(N),
107
+ "aria-label": "清除评分",
108
+ onClick: i[2] ||= (e) => b(P)(0)
109
+ }, {
110
+ default: x(() => [...i[3] ||= [f("清除", -1)]]),
111
+ _: 1
112
+ }, 8, ["disabled"])) : l("", !0)], 6));
113
+ }
114
+ }), [["__scopeId", "data-v-23c50b69"]]);
115
+ export { E as default };