@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.
- package/LICENSE +21 -0
- package/README.md +166 -2
- package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
- package/dist/kima-elements-core.js +53209 -0
- package/dist/kima-elements.js +126371 -0
- package/dist/kima-theme.js +1583 -0
- package/dist/kima.js +141 -0
- package/dist/style.css +2 -0
- package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
- package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
- package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
- package/dist/vue/components/advanced-input/editable.ce.js +160 -0
- package/dist/vue/components/advanced-input/mention.ce.js +181 -0
- package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
- package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
- package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
- package/dist/vue/components/content/chart.ce.js +282 -0
- package/dist/vue/components/content/code-editor.ce.js +309 -0
- package/dist/vue/components/content/equation.ce.js +69 -0
- package/dist/vue/components/content/heatmap.ce.js +148 -0
- package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
- package/dist/vue/components/core/badge.ce.js +66 -0
- package/dist/vue/components/core/button-group.ce.js +142 -0
- package/dist/vue/components/core/button.ce.js +73 -0
- package/dist/vue/components/core/card.ce.js +73 -0
- package/dist/vue/components/core/cascader.ce.js +329 -0
- package/dist/vue/components/core/checkbox.ce.js +116 -0
- package/dist/vue/components/core/code-block.ce.js +108 -0
- package/dist/vue/components/core/combobox.ce.js +354 -0
- package/dist/vue/components/core/date-picker.ce.js +433 -0
- package/dist/vue/components/core/dialog.ce.js +118 -0
- package/dist/vue/components/core/divider.ce.js +49 -0
- package/dist/vue/components/core/drawer.ce.js +235 -0
- package/dist/vue/components/core/empty-state.ce.js +58 -0
- package/dist/vue/components/core/icon-button.ce.js +93 -0
- package/dist/vue/components/core/icon.ce.js +42 -0
- package/dist/vue/components/core/layout.ce.js +68 -0
- package/dist/vue/components/core/menu.ce.js +178 -0
- package/dist/vue/components/core/notification.ce.js +158 -0
- package/dist/vue/components/core/pagination.ce.js +158 -0
- package/dist/vue/components/core/progress.ce.js +49 -0
- package/dist/vue/components/core/select.ce.js +325 -0
- package/dist/vue/components/core/slider.ce.js +116 -0
- package/dist/vue/components/core/switch.ce.js +100 -0
- package/dist/vue/components/core/tabs.ce.js +193 -0
- package/dist/vue/components/core/text-field.ce.js +194 -0
- package/dist/vue/components/core/time-picker.ce.js +486 -0
- package/dist/vue/components/core/tooltip.ce.js +125 -0
- package/dist/vue/components/core/tree.ce.js +248 -0
- package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
- package/dist/vue/components/data/copy-button.ce.js +75 -0
- package/dist/vue/components/data/image-preview.ce.js +226 -0
- package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
- package/dist/vue/components/data/long-text.ce.js +70 -0
- package/dist/vue/components/data/relative-time.ce.js +77 -0
- package/dist/vue/components/data/ring-progress.ce.js +87 -0
- package/dist/vue/components/data/table.ce.js +491 -0
- package/dist/vue/components/data/virtual-table.ce.js +178 -0
- package/dist/vue/components/data/virtual-tree.ce.js +213 -0
- package/dist/vue/components/display/alert.ce.js +101 -0
- package/dist/vue/components/display/avatar-group.ce.js +65 -0
- package/dist/vue/components/display/avatar.ce.js +84 -0
- package/dist/vue/components/display/blockquote.ce.js +44 -0
- package/dist/vue/components/display/countdown.ce.js +77 -0
- package/dist/vue/components/display/descriptions.ce.js +43 -0
- package/dist/vue/components/display/highlight.ce.js +48 -0
- package/dist/vue/components/display/image.ce.js +146 -0
- package/dist/vue/components/display/list.ce.js +68 -0
- package/dist/vue/components/display/result.ce.js +57 -0
- package/dist/vue/components/display/skeleton.ce.js +67 -0
- package/dist/vue/components/display/spinner.ce.js +42 -0
- package/dist/vue/components/display/statistic.ce.js +71 -0
- package/dist/vue/components/display/timeline.ce.js +59 -0
- package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
- package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
- package/dist/vue/components/form-completion/date-field.ce.js +131 -0
- package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
- package/dist/vue/components/form-completion/form.ce.js +248 -0
- package/dist/vue/components/form-completion/json-input.ce.js +114 -0
- package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
- package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
- package/dist/vue/components/form-completion/time-field.ce.js +120 -0
- package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
- package/dist/vue/components/foundation/banner.ce.js +106 -0
- package/dist/vue/components/foundation/error-state.ce.js +108 -0
- package/dist/vue/components/foundation/field-group.ce.js +146 -0
- package/dist/vue/components/foundation/flex.ce.js +60 -0
- package/dist/vue/components/foundation/grid.ce.js +52 -0
- package/dist/vue/components/foundation/input-group.ce.js +34 -0
- package/dist/vue/components/foundation/page-header.ce.js +55 -0
- package/dist/vue/components/foundation/time-display.ce.js +129 -0
- package/dist/vue/components/foundation/typography.ce.js +71 -0
- package/dist/vue/components/input/checkbox-group.ce.js +93 -0
- package/dist/vue/components/input/field.ce.js +74 -0
- package/dist/vue/components/input/file-upload.ce.js +142 -0
- package/dist/vue/components/input/number-field.ce.js +103 -0
- package/dist/vue/components/input/pin-input.ce.js +112 -0
- package/dist/vue/components/input/radio-group.ce.js +96 -0
- package/dist/vue/components/input/rating.ce.js +115 -0
- package/dist/vue/components/input/tags-input.ce.js +153 -0
- package/dist/vue/components/input/textarea.ce.js +180 -0
- package/dist/vue/components/input/toggle.ce.js +58 -0
- package/dist/vue/components/interaction/chip.ce.js +95 -0
- package/dist/vue/components/interaction/command.ce.js +161 -0
- package/dist/vue/components/interaction/context-menu.ce.js +113 -0
- package/dist/vue/components/interaction/hover-card.ce.js +92 -0
- package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
- package/dist/vue/components/interaction/menubar.ce.js +134 -0
- package/dist/vue/components/interaction/multi-select.ce.js +264 -0
- package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
- package/dist/vue/components/interaction/popover.ce.js +83 -0
- package/dist/vue/components/interaction/tree-select.ce.js +195 -0
- package/dist/vue/components/navigation/accordion.ce.js +114 -0
- package/dist/vue/components/navigation/anchor.ce.js +125 -0
- package/dist/vue/components/navigation/back-top.ce.js +67 -0
- package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
- package/dist/vue/components/navigation/carousel.ce.js +114 -0
- package/dist/vue/components/navigation/collapsible.ce.js +57 -0
- package/dist/vue/components/navigation/link.ce.js +62 -0
- package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
- package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
- package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
- package/dist/vue/components/navigation/splitter.ce.js +131 -0
- package/dist/vue/components/navigation/stepper.ce.js +74 -0
- package/dist/vue/components/navigation/toolbar.ce.js +93 -0
- package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
- package/dist/vue/components/shell/app-shell.ce.js +87 -0
- package/dist/vue/components/shell/config-provider.ce.js +110 -0
- package/dist/vue/components/shell/marquee.ce.js +92 -0
- package/dist/vue/components/shell/masonry.ce.js +50 -0
- package/dist/vue/components/shell/sidebar.ce.js +125 -0
- package/dist/vue/components/utility/affix.ce.js +64 -0
- package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
- package/dist/vue/components/utility/animated-number.ce.js +66 -0
- package/dist/vue/components/utility/float-button.ce.js +104 -0
- package/dist/vue/components/utility/listbox.ce.js +81 -0
- package/dist/vue/components/utility/loading-bar.ce.js +85 -0
- package/dist/vue/components/utility/log-viewer.ce.js +124 -0
- package/dist/vue/components/utility/notification-queue.ce.js +109 -0
- package/dist/vue/components/utility/progress-group.ce.js +59 -0
- package/dist/vue/components/utility/qr-code.ce.js +62 -0
- package/dist/vue/components/utility/tag-group.ce.js +124 -0
- package/dist/vue/components/utility/tour.ce.js +214 -0
- package/dist/vue/components/utility/virtual-select.ce.js +207 -0
- package/dist/vue/components/utility/watermark.ce.js +44 -0
- package/dist/vue/internal/menu-items.js +184 -0
- package/dist/vue/internal/navigation-items.js +110 -0
- package/dist/vue/utils/code-highlight.js +142 -0
- package/dist/vue/utils/config.js +47 -0
- package/dist/vue/utils/content-motion.js +37 -0
- package/dist/vue/utils/content.js +83 -0
- package/dist/vue/utils/display-status.js +31 -0
- package/dist/vue/utils/foundation.js +65 -0
- package/dist/vue/utils/input-state.js +38 -0
- package/dist/vue/utils/interaction.js +103 -0
- package/dist/vue/utils/local-date.js +48 -0
- package/dist/vue/utils/motion.js +80 -0
- package/dist/vue/utils/native-slots.js +30 -0
- package/dist/vue/utils/navigation.js +44 -0
- package/dist/vue/utils/notifications.js +60 -0
- package/dist/vue/utils/qr.js +20 -0
- package/dist/vue/utils/remote-options.js +65 -0
- package/dist/vue/utils/ripple.js +20 -0
- package/dist/vue/utils/scoped-slots.js +22 -0
- package/dist/vue/utils/shell.js +43 -0
- package/dist/vue/utils/theme.js +50 -0
- package/dist/vue/utils/utility-choice.js +56 -0
- package/package.json +99 -4
|
@@ -0,0 +1,433 @@
|
|
|
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
|
+
/* empty css */
|
|
5
|
+
import { Fragment as r, Transition as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, getCurrentInstance as ee, mergeProps as te, nextTick as u, normalizeClass as d, onBeforeUnmount as ne, onMounted as re, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g, useAttrs as ie, useHost as ae, useId as oe, watch as _, withCtx as v, withModifiers as y } from "vue";
|
|
6
|
+
import { ArrowLeft01Icon as se, ArrowRight01Icon as ce, Calendar01Icon as le, Cancel01Icon as ue } from "@hugeicons/core-free-icons";
|
|
7
|
+
// src/components/core/date-picker.ce.vue
|
|
8
|
+
var de = ["aria-disabled"], fe = [
|
|
9
|
+
"aria-expanded",
|
|
10
|
+
"aria-label",
|
|
11
|
+
"aria-required",
|
|
12
|
+
"disabled"
|
|
13
|
+
], pe = [
|
|
14
|
+
"aria-label",
|
|
15
|
+
"title",
|
|
16
|
+
"disabled"
|
|
17
|
+
], me = [
|
|
18
|
+
"name",
|
|
19
|
+
"value",
|
|
20
|
+
"required",
|
|
21
|
+
"disabled"
|
|
22
|
+
], he = { class: "kima-date-picker__head" }, ge = [
|
|
23
|
+
"aria-label",
|
|
24
|
+
"title",
|
|
25
|
+
"disabled"
|
|
26
|
+
], _e = [
|
|
27
|
+
"aria-label",
|
|
28
|
+
"title",
|
|
29
|
+
"disabled"
|
|
30
|
+
], ve = {
|
|
31
|
+
class: "kima-date-picker__row",
|
|
32
|
+
role: "row"
|
|
33
|
+
}, ye = ["aria-selected"], be = [
|
|
34
|
+
"id",
|
|
35
|
+
"data-date",
|
|
36
|
+
"aria-label",
|
|
37
|
+
"aria-current",
|
|
38
|
+
"disabled",
|
|
39
|
+
"tabindex",
|
|
40
|
+
"onClick"
|
|
41
|
+
], b = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
42
|
+
__name: "date-picker.ce",
|
|
43
|
+
props: {
|
|
44
|
+
modelValue: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: null
|
|
47
|
+
},
|
|
48
|
+
min: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
max: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: null
|
|
55
|
+
},
|
|
56
|
+
open: Boolean,
|
|
57
|
+
label: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ""
|
|
60
|
+
},
|
|
61
|
+
placeholder: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "Select date"
|
|
64
|
+
},
|
|
65
|
+
name: String,
|
|
66
|
+
disabled: Boolean,
|
|
67
|
+
required: Boolean,
|
|
68
|
+
clearable: Boolean,
|
|
69
|
+
firstDay: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: 1
|
|
72
|
+
},
|
|
73
|
+
locale: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "en-GB"
|
|
76
|
+
},
|
|
77
|
+
weekdays: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default: null
|
|
80
|
+
},
|
|
81
|
+
previousMonthLabel: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "Previous month"
|
|
84
|
+
},
|
|
85
|
+
nextMonthLabel: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "Next month"
|
|
88
|
+
},
|
|
89
|
+
clearLabel: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: "Clear date"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
emits: [
|
|
95
|
+
"update:modelValue",
|
|
96
|
+
"change",
|
|
97
|
+
"update:open"
|
|
98
|
+
],
|
|
99
|
+
setup(t, { emit: b }) {
|
|
100
|
+
let x = ie(), xe = ee()?.ce ? ae() : null, S = t, C = b, w = p(null), T = p(null), E = p(null), D = p(null);
|
|
101
|
+
e(D);
|
|
102
|
+
let O = p(S.modelValue), k = p(!1), A = p((/* @__PURE__ */ new Date()).getFullYear()), j = p((/* @__PURE__ */ new Date()).getMonth()), M = p(""), N = p(""), P, F, I = `kima-date-picker-${oe()}`, Se = `${I}-trigger`, L = `${I}-grid`, R = `${I}-title`;
|
|
103
|
+
function z(e) {
|
|
104
|
+
return String(e).padStart(2, "0");
|
|
105
|
+
}
|
|
106
|
+
function B(e, t, n) {
|
|
107
|
+
return `${e}-${z(t + 1)}-${z(n)}`;
|
|
108
|
+
}
|
|
109
|
+
function V(e) {
|
|
110
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
111
|
+
return {
|
|
112
|
+
year: t,
|
|
113
|
+
monthIndex: n - 1,
|
|
114
|
+
day: r
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function H(e) {
|
|
118
|
+
let { year: t, monthIndex: n, day: r } = V(e);
|
|
119
|
+
return new Date(t, n, r);
|
|
120
|
+
}
|
|
121
|
+
function U() {
|
|
122
|
+
let e = /* @__PURE__ */ new Date();
|
|
123
|
+
return B(e.getFullYear(), e.getMonth(), e.getDate());
|
|
124
|
+
}
|
|
125
|
+
function W(e, t) {
|
|
126
|
+
let n = H(e);
|
|
127
|
+
return n.setDate(n.getDate() + t), B(n.getFullYear(), n.getMonth(), n.getDate());
|
|
128
|
+
}
|
|
129
|
+
function G(e, t) {
|
|
130
|
+
return new Date(e, t + 1, 0).getDate();
|
|
131
|
+
}
|
|
132
|
+
function Ce(e, t) {
|
|
133
|
+
let n = new Date(e, t, 1);
|
|
134
|
+
return B(n.getFullYear(), n.getMonth(), 1);
|
|
135
|
+
}
|
|
136
|
+
function we(e, t) {
|
|
137
|
+
let n = new Date(e, t + 1, 0);
|
|
138
|
+
return B(n.getFullYear(), n.getMonth(), n.getDate());
|
|
139
|
+
}
|
|
140
|
+
function K(e) {
|
|
141
|
+
return S.min && e < S.min ? S.min : S.max && e > S.max ? S.max : e;
|
|
142
|
+
}
|
|
143
|
+
function q(e) {
|
|
144
|
+
try {
|
|
145
|
+
return new Intl.DateTimeFormat(S.locale || "en-GB", e);
|
|
146
|
+
} catch {
|
|
147
|
+
return new Intl.DateTimeFormat("en-GB", e);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
let Te = a(() => q({
|
|
151
|
+
year: "numeric",
|
|
152
|
+
month: "long"
|
|
153
|
+
})), Ee = a(() => q({ weekday: "short" })), J = a(() => q({
|
|
154
|
+
year: "numeric",
|
|
155
|
+
month: "long",
|
|
156
|
+
day: "numeric"
|
|
157
|
+
})), De = a(() => O.value ? J.value.format(H(O.value)) : S.placeholder), Y = a(() => Te.value.format(new Date(A.value, j.value, 1))), Oe = a(() => {
|
|
158
|
+
if (S.weekdays?.length === 7) return S.weekdays;
|
|
159
|
+
let e = [];
|
|
160
|
+
for (let t = 0; t < 7; t += 1) e.push(Ee.value.format(new Date(2024, 0, 7 + t)));
|
|
161
|
+
let t = S.firstDay === 0 ? 0 : 1;
|
|
162
|
+
return e.slice(t).concat(e.slice(0, t));
|
|
163
|
+
}), ke = a(() => {
|
|
164
|
+
let e = (new Date(A.value, j.value, 1).getDay() - (S.firstDay === 0 ? 0 : 1) + 7) % 7, t = [];
|
|
165
|
+
for (let n = 0; n < 42; n += 1) {
|
|
166
|
+
let r = new Date(A.value, j.value, 1 - e + n), i = B(r.getFullYear(), r.getMonth(), r.getDate());
|
|
167
|
+
t.push({
|
|
168
|
+
iso: i,
|
|
169
|
+
day: r.getDate(),
|
|
170
|
+
outside: r.getMonth() !== j.value,
|
|
171
|
+
disabled: S.min && i < S.min || S.max && i > S.max,
|
|
172
|
+
label: J.value.format(r)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return t;
|
|
176
|
+
}), Ae = a(() => Array.from({ length: 6 }, (e, t) => ke.value.slice(t * 7, t * 7 + 7))), je = a(() => !S.min || we(A.value, j.value - 1) >= S.min), Me = a(() => !S.max || Ce(A.value, j.value + 1) <= S.max);
|
|
177
|
+
function X(e) {
|
|
178
|
+
if (S.disabled) return;
|
|
179
|
+
N.value = U(), M.value = K(O.value || N.value);
|
|
180
|
+
let t = V(M.value);
|
|
181
|
+
A.value = t.year, j.value = t.monthIndex, k.value = !0, e && C("update:open", !0), u(Q);
|
|
182
|
+
}
|
|
183
|
+
function Z(e, t) {
|
|
184
|
+
k.value && (k.value = !1, e && C("update:open", !1), t && u(() => T.value?.focus()));
|
|
185
|
+
}
|
|
186
|
+
function Ne() {
|
|
187
|
+
k.value ? Z(!0, !0) : X(!0);
|
|
188
|
+
}
|
|
189
|
+
function Pe(e) {
|
|
190
|
+
e.inert = !1, e.removeAttribute("aria-hidden"), e.id = L, e.querySelectorAll("[data-date]").forEach((e) => {
|
|
191
|
+
e.id = `${L}-day-${e.dataset.date}`;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function Fe(e) {
|
|
195
|
+
e.inert = !0, e.setAttribute("aria-hidden", "true"), e.removeAttribute("id"), e.querySelectorAll("[id]").forEach((e) => e.removeAttribute("id"));
|
|
196
|
+
}
|
|
197
|
+
function Q() {
|
|
198
|
+
k.value && M.value && w.value?.querySelector(`#${L}-day-${M.value}`)?.focus();
|
|
199
|
+
}
|
|
200
|
+
function Ie(e) {
|
|
201
|
+
S.disabled || e === O.value || (O.value = e, C("update:modelValue", e), C("change", e));
|
|
202
|
+
}
|
|
203
|
+
function Le(e) {
|
|
204
|
+
e.disabled || (M.value = e.iso, Ie(e.iso), Z(!0, !0));
|
|
205
|
+
}
|
|
206
|
+
function Re() {
|
|
207
|
+
Ie(null), Z(!0, !0);
|
|
208
|
+
}
|
|
209
|
+
function ze(e) {
|
|
210
|
+
queueMicrotask(() => {
|
|
211
|
+
if (e.defaultPrevented) return;
|
|
212
|
+
let t = O.value !== F;
|
|
213
|
+
O.value = F, E.value && (E.value.value = F || ""), M.value = K(F || U()), t && C("update:modelValue", O.value);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function Be(e) {
|
|
217
|
+
e.preventDefault(), u(() => T.value?.focus());
|
|
218
|
+
}
|
|
219
|
+
function Ve(e) {
|
|
220
|
+
let t = K(e), n = V(t);
|
|
221
|
+
M.value = t, A.value = n.year, j.value = n.monthIndex, u(Q);
|
|
222
|
+
}
|
|
223
|
+
function He(e) {
|
|
224
|
+
let t = new Date(A.value, j.value + e, 1), n = t.getFullYear(), r = t.getMonth();
|
|
225
|
+
A.value = n, j.value = r;
|
|
226
|
+
let i = V(M.value);
|
|
227
|
+
Ve(K(B(n, r, Math.min(i.day, G(n, r)))));
|
|
228
|
+
}
|
|
229
|
+
function Ue(e) {
|
|
230
|
+
!S.disabled && [
|
|
231
|
+
"ArrowDown",
|
|
232
|
+
"ArrowUp",
|
|
233
|
+
"PageUp",
|
|
234
|
+
"PageDown"
|
|
235
|
+
].includes(e.key) && (e.preventDefault(), X(!0));
|
|
236
|
+
}
|
|
237
|
+
function We(e) {
|
|
238
|
+
if (e.isComposing) return;
|
|
239
|
+
if (e.key === "Escape") {
|
|
240
|
+
e.preventDefault(), Z(!0, !0);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (!e.target.closest(".kima-date-picker__day")) return;
|
|
244
|
+
let t = {
|
|
245
|
+
ArrowLeft: -1,
|
|
246
|
+
ArrowRight: 1,
|
|
247
|
+
ArrowUp: -7,
|
|
248
|
+
ArrowDown: 7
|
|
249
|
+
}, n = null;
|
|
250
|
+
if (e.key in t) n = W(M.value, t[e.key]);
|
|
251
|
+
else if (e.key === "PageUp" || e.key === "PageDown") {
|
|
252
|
+
let t = e.key === "PageUp" ? -1 : 1, r = new Date(A.value, j.value + t, 1), i = r.getFullYear(), a = r.getMonth(), o = V(M.value);
|
|
253
|
+
n = B(i, a, Math.min(o.day, G(i, a)));
|
|
254
|
+
} else if (e.key === "Home" || e.key === "End") {
|
|
255
|
+
let t = (H(M.value).getDay() - (S.firstDay === 0 ? 0 : 1) + 7) % 7;
|
|
256
|
+
n = e.key === "Home" ? W(M.value, -t) : W(M.value, 6 - t);
|
|
257
|
+
}
|
|
258
|
+
n && (e.preventDefault(), Ve(n));
|
|
259
|
+
}
|
|
260
|
+
function $(e) {
|
|
261
|
+
k.value && !e.composedPath().includes(w.value) && Z(!1, !1);
|
|
262
|
+
}
|
|
263
|
+
return _(() => S.modelValue, (e) => {
|
|
264
|
+
O.value = e;
|
|
265
|
+
}), _(() => S.open, (e) => {
|
|
266
|
+
e ? X(!1) : Z(!1, !1);
|
|
267
|
+
}, { immediate: !0 }), _(() => S.disabled, (e) => {
|
|
268
|
+
e && Z(!1, !1);
|
|
269
|
+
}), re(() => {
|
|
270
|
+
F = S.modelValue, N.value = U(), P = w.value.ownerDocument, P.addEventListener("pointerdown", $), P.addEventListener("focusin", $), E.value.form?.addEventListener("reset", ze);
|
|
271
|
+
}), ne(() => {
|
|
272
|
+
P.removeEventListener("pointerdown", $), P.removeEventListener("focusin", $);
|
|
273
|
+
}), (e, a) => (f(), s("div", te({
|
|
274
|
+
ref_key: "root",
|
|
275
|
+
ref: w
|
|
276
|
+
}, {
|
|
277
|
+
...g(x),
|
|
278
|
+
id: g(xe) ? void 0 : g(x).id
|
|
279
|
+
}, { class: ["kima-date-picker", {
|
|
280
|
+
"kima-date-picker--open": k.value,
|
|
281
|
+
"kima-date-picker--disabled": t.disabled
|
|
282
|
+
}] }), [
|
|
283
|
+
c("div", {
|
|
284
|
+
ref_key: "control",
|
|
285
|
+
ref: D,
|
|
286
|
+
class: "kima-date-picker__control",
|
|
287
|
+
"aria-disabled": t.disabled || void 0
|
|
288
|
+
}, [c("button", {
|
|
289
|
+
id: Se,
|
|
290
|
+
ref_key: "trigger",
|
|
291
|
+
ref: T,
|
|
292
|
+
class: "kima-date-picker__trigger",
|
|
293
|
+
type: "button",
|
|
294
|
+
role: "combobox",
|
|
295
|
+
"aria-haspopup": "grid",
|
|
296
|
+
"aria-expanded": k.value,
|
|
297
|
+
"aria-controls": L,
|
|
298
|
+
"aria-label": g(x)["aria-label"] || g(x).ariaLabel || t.label || t.placeholder,
|
|
299
|
+
"aria-required": t.required || void 0,
|
|
300
|
+
disabled: t.disabled,
|
|
301
|
+
onClick: Ne,
|
|
302
|
+
onKeydown: Ue
|
|
303
|
+
}, [c("span", { class: d(["kima-date-picker__trigger-label", { "kima-date-picker__trigger-label--placeholder": !O.value }]) }, h(De.value), 3), l(n, {
|
|
304
|
+
class: "kima-date-picker__icon",
|
|
305
|
+
icon: g(le),
|
|
306
|
+
size: 20,
|
|
307
|
+
"aria-hidden": "true"
|
|
308
|
+
}, null, 8, ["icon"])], 40, fe), l(i, { name: "kima-fade" }, {
|
|
309
|
+
default: v(() => [t.clearable && O.value ? (f(), s("button", {
|
|
310
|
+
key: 0,
|
|
311
|
+
class: "kima-date-picker__clear",
|
|
312
|
+
type: "button",
|
|
313
|
+
"aria-label": t.clearLabel,
|
|
314
|
+
title: t.clearLabel,
|
|
315
|
+
disabled: t.disabled,
|
|
316
|
+
onClick: y(Re, ["stop"])
|
|
317
|
+
}, [l(n, {
|
|
318
|
+
icon: g(ue),
|
|
319
|
+
size: 18,
|
|
320
|
+
"aria-hidden": "true"
|
|
321
|
+
}, null, 8, ["icon"])], 8, pe)) : o("", !0)]),
|
|
322
|
+
_: 1
|
|
323
|
+
})], 8, de),
|
|
324
|
+
c("input", {
|
|
325
|
+
ref_key: "nativeInput",
|
|
326
|
+
ref: E,
|
|
327
|
+
class: "kima-date-picker__native",
|
|
328
|
+
type: "text",
|
|
329
|
+
name: t.name,
|
|
330
|
+
value: O.value || "",
|
|
331
|
+
required: t.required,
|
|
332
|
+
disabled: t.disabled,
|
|
333
|
+
tabindex: "-1",
|
|
334
|
+
"aria-hidden": "true",
|
|
335
|
+
onInput: a[0] ||= y(() => {}, ["stop"]),
|
|
336
|
+
onChange: a[1] ||= y(() => {}, ["stop"]),
|
|
337
|
+
onInvalid: Be
|
|
338
|
+
}, null, 40, me),
|
|
339
|
+
l(i, {
|
|
340
|
+
name: "kima-popup",
|
|
341
|
+
onBeforeEnter: a[4] ||= (e) => {
|
|
342
|
+
e.inert = !1, e.removeAttribute("aria-hidden");
|
|
343
|
+
},
|
|
344
|
+
onBeforeLeave: a[5] ||= (e) => {
|
|
345
|
+
e.inert = !0, e.setAttribute("aria-hidden", "true");
|
|
346
|
+
}
|
|
347
|
+
}, {
|
|
348
|
+
default: v(() => [k.value ? (f(), s("div", {
|
|
349
|
+
key: 0,
|
|
350
|
+
class: "kima-date-picker__popup",
|
|
351
|
+
onKeydown: We
|
|
352
|
+
}, [c("div", he, [
|
|
353
|
+
c("button", {
|
|
354
|
+
class: "kima-date-picker__nav",
|
|
355
|
+
type: "button",
|
|
356
|
+
"aria-label": t.previousMonthLabel,
|
|
357
|
+
title: t.previousMonthLabel,
|
|
358
|
+
disabled: t.disabled || !je.value,
|
|
359
|
+
onClick: a[2] ||= (e) => He(-1)
|
|
360
|
+
}, [l(n, {
|
|
361
|
+
icon: g(se),
|
|
362
|
+
size: 18,
|
|
363
|
+
"aria-hidden": "true"
|
|
364
|
+
}, null, 8, ["icon"])], 8, ge),
|
|
365
|
+
c("span", {
|
|
366
|
+
id: R,
|
|
367
|
+
class: "kima-date-picker__month"
|
|
368
|
+
}, [l(i, {
|
|
369
|
+
name: "kima-fade",
|
|
370
|
+
mode: "out-in"
|
|
371
|
+
}, {
|
|
372
|
+
default: v(() => [(f(), s("span", { key: Y.value }, h(Y.value), 1))]),
|
|
373
|
+
_: 1
|
|
374
|
+
})]),
|
|
375
|
+
c("button", {
|
|
376
|
+
class: "kima-date-picker__nav",
|
|
377
|
+
type: "button",
|
|
378
|
+
"aria-label": t.nextMonthLabel,
|
|
379
|
+
title: t.nextMonthLabel,
|
|
380
|
+
disabled: t.disabled || !Me.value,
|
|
381
|
+
onClick: a[3] ||= (e) => He(1)
|
|
382
|
+
}, [l(n, {
|
|
383
|
+
icon: g(ce),
|
|
384
|
+
size: 18,
|
|
385
|
+
"aria-hidden": "true"
|
|
386
|
+
}, null, 8, ["icon"])], 8, _e)
|
|
387
|
+
]), l(i, {
|
|
388
|
+
name: "kima-fade",
|
|
389
|
+
onBeforeEnter: Pe,
|
|
390
|
+
onBeforeLeave: Fe
|
|
391
|
+
}, {
|
|
392
|
+
default: v(() => [(f(), s("div", {
|
|
393
|
+
id: L,
|
|
394
|
+
key: `${A.value}-${j.value}`,
|
|
395
|
+
class: "kima-date-picker__grid",
|
|
396
|
+
role: "grid",
|
|
397
|
+
"aria-labelledby": R
|
|
398
|
+
}, [c("div", ve, [(f(!0), s(r, null, m(Oe.value, (e, t) => (f(), s("span", {
|
|
399
|
+
key: t,
|
|
400
|
+
class: "kima-date-picker__weekday",
|
|
401
|
+
role: "columnheader"
|
|
402
|
+
}, h(e), 1))), 128))]), (f(!0), s(r, null, m(Ae.value, (e, t) => (f(), s("div", {
|
|
403
|
+
key: t,
|
|
404
|
+
class: "kima-date-picker__row",
|
|
405
|
+
role: "row"
|
|
406
|
+
}, [(f(!0), s(r, null, m(e, (e) => (f(), s("div", {
|
|
407
|
+
key: e.iso,
|
|
408
|
+
class: "kima-date-picker__cell",
|
|
409
|
+
role: "gridcell",
|
|
410
|
+
"aria-selected": e.iso === O.value
|
|
411
|
+
}, [c("button", {
|
|
412
|
+
id: `${L}-day-${e.iso}`,
|
|
413
|
+
"data-date": e.iso,
|
|
414
|
+
class: d(["kima-date-picker__day", {
|
|
415
|
+
"kima-date-picker__day--outside": e.outside,
|
|
416
|
+
"kima-date-picker__day--today": e.iso === N.value,
|
|
417
|
+
"kima-date-picker__day--selected": e.iso === O.value
|
|
418
|
+
}]),
|
|
419
|
+
type: "button",
|
|
420
|
+
"aria-label": e.label,
|
|
421
|
+
"aria-current": e.iso === N.value ? "date" : void 0,
|
|
422
|
+
disabled: e.disabled,
|
|
423
|
+
tabindex: e.iso === M.value ? 0 : -1,
|
|
424
|
+
onClick: (t) => Le(e)
|
|
425
|
+
}, h(e.day), 11, be)], 8, ye))), 128))]))), 128))]))]),
|
|
426
|
+
_: 1
|
|
427
|
+
})], 32)) : o("", !0)]),
|
|
428
|
+
_: 1
|
|
429
|
+
})
|
|
430
|
+
], 16));
|
|
431
|
+
}
|
|
432
|
+
}), [["__scopeId", "data-v-f55122f3"]]);
|
|
433
|
+
export { b as default };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
import n from "./button.ce.js";
|
|
4
|
+
import r from "./icon.ce.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, mergeProps as l, normalizeClass as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderSlot as h, toDisplayString as g, unref as _, useAttrs as v, useId as y, watch as b, withCtx as x, withModifiers as S } from "vue";
|
|
7
|
+
import { Cancel01Icon as C } from "@hugeicons/core-free-icons";
|
|
8
|
+
// src/components/core/dialog.ce.vue
|
|
9
|
+
var w = ["aria-labelledby", "aria-describedby"], T = { class: "kima-dialog__positioner" }, E = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "kima-dialog__header"
|
|
12
|
+
}, D = { class: "kima-dialog__heading" }, O = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "kima-dialog__header-slot"
|
|
15
|
+
}, k = {
|
|
16
|
+
key: 2,
|
|
17
|
+
class: "kima-dialog__body"
|
|
18
|
+
}, A = {
|
|
19
|
+
key: 3,
|
|
20
|
+
class: "kima-dialog__footer"
|
|
21
|
+
}, j = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
22
|
+
__name: "dialog.ce",
|
|
23
|
+
props: {
|
|
24
|
+
open: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !1
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
closeOnEscape: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !0
|
|
35
|
+
},
|
|
36
|
+
closeOnBackdrop: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !0
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "medium"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
emits: ["update:open", "close"],
|
|
46
|
+
setup(t, { emit: j }) {
|
|
47
|
+
let M = t, N = j, P = v(), F = m(null), { hasNativeSlot: I, isCustomElement: L } = e(F), R = i(() => L ? {
|
|
48
|
+
...P,
|
|
49
|
+
id: void 0
|
|
50
|
+
} : P), z = m(M.open), B = i(() => [
|
|
51
|
+
"small",
|
|
52
|
+
"medium",
|
|
53
|
+
"large"
|
|
54
|
+
].includes(M.size) ? M.size : "medium"), V = y(), H = `kima-dialog-title-${V}`, U = `kima-dialog-description-${V}`;
|
|
55
|
+
function W(e = "close") {
|
|
56
|
+
z.value && (z.value = !1, F.value?.open && F.value.close(), N("update:open", !1), N("close", e));
|
|
57
|
+
}
|
|
58
|
+
function G() {
|
|
59
|
+
F.value && (z.value && !F.value.open ? F.value.showModal() : !z.value && F.value.open && F.value.close());
|
|
60
|
+
}
|
|
61
|
+
function K(e) {
|
|
62
|
+
e.preventDefault(), M.closeOnEscape && W("escape");
|
|
63
|
+
}
|
|
64
|
+
function q() {
|
|
65
|
+
F.value && !F.value.open && W("native");
|
|
66
|
+
}
|
|
67
|
+
function J(e) {
|
|
68
|
+
if (e.key !== "Tab" || !F.value) return;
|
|
69
|
+
let t = [...F.value.querySelectorAll("button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])")];
|
|
70
|
+
if (!t.length) return;
|
|
71
|
+
let n = t[0], r = t[t.length - 1];
|
|
72
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
73
|
+
}
|
|
74
|
+
return b(() => M.open, (e) => {
|
|
75
|
+
z.value = e;
|
|
76
|
+
}), b(z, G, { flush: "post" }), f(G), d(() => {
|
|
77
|
+
F.value?.open && F.value.close();
|
|
78
|
+
}), (e, i) => (p(), o("dialog", l({
|
|
79
|
+
ref_key: "dialog",
|
|
80
|
+
ref: F
|
|
81
|
+
}, R.value, {
|
|
82
|
+
title: void 0,
|
|
83
|
+
class: "kima-dialog",
|
|
84
|
+
"aria-labelledby": _(P).title ? H : _(P)["aria-labelledby"],
|
|
85
|
+
"aria-describedby": [_(P)["aria-describedby"], t.description ? U : void 0].filter(Boolean).join(" ") || void 0,
|
|
86
|
+
onCancel: S(K, ["stop"]),
|
|
87
|
+
onClose: S(q, ["stop"]),
|
|
88
|
+
onKeydown: J,
|
|
89
|
+
onClick: i[1] ||= S((e) => t.closeOnBackdrop && W("backdrop"), ["self"])
|
|
90
|
+
}), [s("div", T, [s("section", { class: u(["kima-dialog__panel", `kima-dialog__panel--${B.value}`]) }, [
|
|
91
|
+
_(P).title || e.$slots.header || _(I)("header") ? (p(), o("header", E, [s("div", D, [_(P).title ? (p(), o("h2", {
|
|
92
|
+
key: 0,
|
|
93
|
+
id: H,
|
|
94
|
+
class: "kima-dialog__title"
|
|
95
|
+
}, g(_(P).title), 1)) : a("", !0), e.$slots.header || _(I)("header") ? (p(), o("div", O, [h(e.$slots, "header", {}, void 0, !0)])) : a("", !0)]), c(n, {
|
|
96
|
+
variant: "text",
|
|
97
|
+
class: "kima-dialog__close",
|
|
98
|
+
"aria-label": "关闭对话框",
|
|
99
|
+
onClick: i[0] ||= (e) => W("button")
|
|
100
|
+
}, {
|
|
101
|
+
default: x(() => [c(r, {
|
|
102
|
+
icon: _(C),
|
|
103
|
+
size: 20,
|
|
104
|
+
color: "currentColor"
|
|
105
|
+
}, null, 8, ["icon"])]),
|
|
106
|
+
_: 1
|
|
107
|
+
})])) : a("", !0),
|
|
108
|
+
t.description ? (p(), o("p", {
|
|
109
|
+
key: 1,
|
|
110
|
+
id: U,
|
|
111
|
+
class: "kima-dialog__description"
|
|
112
|
+
}, g(t.description), 1)) : a("", !0),
|
|
113
|
+
e.$slots.default || _(I)("default") ? (p(), o("div", k, [h(e.$slots, "default", {}, void 0, !0)])) : a("", !0),
|
|
114
|
+
e.$slots.footer || _(I)("footer") ? (p(), o("footer", A, [h(e.$slots, "footer", {}, void 0, !0)])) : a("", !0)
|
|
115
|
+
], 2)])], 16, w));
|
|
116
|
+
}
|
|
117
|
+
}), [["__scopeId", "data-v-1932cdee"]]);
|
|
118
|
+
export { j as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { Comment as n, Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, mergeProps as l, openBlock as u, ref as d, renderSlot as f, toDisplayString as p, useAttrs as m, useSlots as h } from "vue";
|
|
5
|
+
// src/components/core/divider.ce.vue
|
|
6
|
+
var g = ["aria-orientation"], _ = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "kima-divider__label"
|
|
9
|
+
}, v = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "kima-divider__line",
|
|
12
|
+
"aria-hidden": "true"
|
|
13
|
+
}, y = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
14
|
+
__name: "divider.ce",
|
|
15
|
+
props: {
|
|
16
|
+
vertical: Boolean,
|
|
17
|
+
inset: Boolean,
|
|
18
|
+
label: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ""
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(t) {
|
|
24
|
+
let y = t, b = h(), x = m(), S = d(null), { hasNativeSlot: C, isCustomElement: w } = e(S), T = i(() => w ? {
|
|
25
|
+
...x,
|
|
26
|
+
id: void 0
|
|
27
|
+
} : x), E = i(() => b.default?.().some((e) => e.type === n ? !1 : typeof e.children != "string" || e.children.trim().length > 0) || C("default")), D = i(() => !!y.label.trim() || E.value);
|
|
28
|
+
return (e, n) => (u(), o("div", l({
|
|
29
|
+
ref_key: "root",
|
|
30
|
+
ref: S
|
|
31
|
+
}, T.value, {
|
|
32
|
+
class: ["kima-divider", {
|
|
33
|
+
"kima-divider--vertical": t.vertical,
|
|
34
|
+
"kima-divider--inset": t.inset,
|
|
35
|
+
"kima-divider--labeled": D.value
|
|
36
|
+
}],
|
|
37
|
+
role: "separator",
|
|
38
|
+
"aria-orientation": t.vertical ? "vertical" : void 0
|
|
39
|
+
}), [
|
|
40
|
+
n[0] ||= s("span", {
|
|
41
|
+
class: "kima-divider__line",
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
}, null, -1),
|
|
44
|
+
D.value ? (u(), o("span", _, [E.value ? f(e.$slots, "default", {}, void 0, !0, 0) : (u(), o(r, { key: 1 }, [c(p(t.label), 1)], 64))])) : a("", !0),
|
|
45
|
+
D.value ? (u(), o("span", v)) : a("", !0)
|
|
46
|
+
], 16, g));
|
|
47
|
+
}
|
|
48
|
+
}), [["__scopeId", "data-v-5402a5d3"]]);
|
|
49
|
+
export { y as default };
|