@kernel4632/kima 0.0.0-stage → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +209 -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 +105 -4
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { useRipple as e } from "../../utils/ripple.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
import n from "./icon.ce.js";
|
|
4
|
+
import { presenceTransition as r } from "../../utils/motion.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { Fragment as i, Transition as ee, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, getCurrentInstance as te, mergeProps as u, nextTick as d, normalizeClass as f, onBeforeUnmount as ne, onMounted as re, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, useAttrs as ie, useHost as ae, useId as oe, watch as v, withCtx as se, withModifiers as y } from "vue";
|
|
7
|
+
import { ArrowDown01Icon as ce, Cancel01Icon as le } from "@hugeicons/core-free-icons";
|
|
8
|
+
// src/components/core/time-picker.ce.vue
|
|
9
|
+
var ue = ["aria-disabled"], de = [
|
|
10
|
+
"aria-expanded",
|
|
11
|
+
"aria-label",
|
|
12
|
+
"aria-required",
|
|
13
|
+
"disabled"
|
|
14
|
+
], fe = ["disabled"], pe = [
|
|
15
|
+
"name",
|
|
16
|
+
"value",
|
|
17
|
+
"required",
|
|
18
|
+
"disabled"
|
|
19
|
+
], me = ["aria-label"], he = {
|
|
20
|
+
class: "kima-time-picker__summary",
|
|
21
|
+
"aria-live": "polite"
|
|
22
|
+
}, ge = { class: "kima-time-picker__columns" }, _e = { class: "kima-time-picker__column" }, ve = ["aria-activedescendant"], ye = [
|
|
23
|
+
"id",
|
|
24
|
+
"aria-selected",
|
|
25
|
+
"aria-disabled",
|
|
26
|
+
"disabled",
|
|
27
|
+
"tabindex",
|
|
28
|
+
"onClick",
|
|
29
|
+
"onKeydown"
|
|
30
|
+
], be = { class: "kima-time-picker__column" }, xe = ["aria-activedescendant"], Se = [
|
|
31
|
+
"id",
|
|
32
|
+
"aria-selected",
|
|
33
|
+
"aria-disabled",
|
|
34
|
+
"disabled",
|
|
35
|
+
"tabindex",
|
|
36
|
+
"onClick",
|
|
37
|
+
"onKeydown"
|
|
38
|
+
], Ce = {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: "kima-time-picker__column kima-time-picker__column--period"
|
|
41
|
+
}, we = ["aria-activedescendant"], Te = [
|
|
42
|
+
"id",
|
|
43
|
+
"aria-selected",
|
|
44
|
+
"aria-disabled",
|
|
45
|
+
"disabled",
|
|
46
|
+
"tabindex",
|
|
47
|
+
"onClick",
|
|
48
|
+
"onKeydown"
|
|
49
|
+
], Ee = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
50
|
+
__name: "time-picker.ce",
|
|
51
|
+
props: {
|
|
52
|
+
modelValue: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: null
|
|
55
|
+
},
|
|
56
|
+
min: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: null
|
|
59
|
+
},
|
|
60
|
+
max: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: null
|
|
63
|
+
},
|
|
64
|
+
step: {
|
|
65
|
+
type: Number,
|
|
66
|
+
default: 30
|
|
67
|
+
},
|
|
68
|
+
label: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: ""
|
|
71
|
+
},
|
|
72
|
+
placeholder: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: "Select time"
|
|
75
|
+
},
|
|
76
|
+
open: Boolean,
|
|
77
|
+
required: Boolean,
|
|
78
|
+
name: String,
|
|
79
|
+
disabled: Boolean,
|
|
80
|
+
clearable: Boolean,
|
|
81
|
+
locale: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "en-GB"
|
|
84
|
+
},
|
|
85
|
+
hour12: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: null
|
|
88
|
+
},
|
|
89
|
+
mode: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: "auto"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
emits: [
|
|
95
|
+
"update:modelValue",
|
|
96
|
+
"change",
|
|
97
|
+
"update:open"
|
|
98
|
+
],
|
|
99
|
+
setup(t, { emit: Ee }) {
|
|
100
|
+
let b = t, x = Ee, S = ie(), De = te()?.ce ? ae() : null, Oe = a(() => De ? {
|
|
101
|
+
...S,
|
|
102
|
+
id: void 0
|
|
103
|
+
} : S), ke = m(null), C = m(null), Ae = m(null), je = m(null);
|
|
104
|
+
e(je);
|
|
105
|
+
let Me = m({
|
|
106
|
+
hour: [],
|
|
107
|
+
minute: [],
|
|
108
|
+
period: []
|
|
109
|
+
}), w = m(b.modelValue), T = m(!1), E = m(0), D = m(0), O = m("AM"), k = m("hour"), A = m(0), j, M, N, P, F = `kima-time-picker-${oe()}`, Ne = `${F}-trigger`, Pe = `${F}-popup`, Fe = `${F}-hours`, Ie = `${F}-minutes`, Le = `${F}-period`, Re = a(() => {
|
|
110
|
+
let e = Number(b.step);
|
|
111
|
+
return Number.isFinite(e) && e > 0 ? Math.min(60, Math.floor(e)) : 30;
|
|
112
|
+
}), ze = a(() => V(b.min)), Be = a(() => V(b.max)), I = a(() => {
|
|
113
|
+
let e = b.mode.toLowerCase();
|
|
114
|
+
if ([
|
|
115
|
+
"12",
|
|
116
|
+
"12h",
|
|
117
|
+
"12-hour"
|
|
118
|
+
].includes(e)) return !0;
|
|
119
|
+
if ([
|
|
120
|
+
"24",
|
|
121
|
+
"24h",
|
|
122
|
+
"24-hour"
|
|
123
|
+
].includes(e)) return !1;
|
|
124
|
+
if (typeof b.hour12 == "boolean") return b.hour12;
|
|
125
|
+
try {
|
|
126
|
+
let e = new Intl.DateTimeFormat(b.locale || "en-GB", { hour: "numeric" }).resolvedOptions().hourCycle;
|
|
127
|
+
return e === "h11" || e === "h12";
|
|
128
|
+
} catch {
|
|
129
|
+
return !1;
|
|
130
|
+
}
|
|
131
|
+
}), Ve = a(() => {
|
|
132
|
+
let e = [];
|
|
133
|
+
for (let t = 0; t < 60; t += Re.value) e.push(t);
|
|
134
|
+
return e;
|
|
135
|
+
}), L = a(() => {
|
|
136
|
+
let e = [];
|
|
137
|
+
if (I.value) for (let t = 1; t <= 12; t += 1) {
|
|
138
|
+
let n = W(t, O.value);
|
|
139
|
+
e.push({
|
|
140
|
+
value: n,
|
|
141
|
+
label: String(t),
|
|
142
|
+
disabled: !K(n)
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else for (let t = 0; t < 24; t += 1) e.push({
|
|
146
|
+
value: t,
|
|
147
|
+
label: B(t),
|
|
148
|
+
disabled: !K(t)
|
|
149
|
+
});
|
|
150
|
+
return e;
|
|
151
|
+
}), R = a(() => Ve.value.map((e) => ({
|
|
152
|
+
value: e,
|
|
153
|
+
label: B(e),
|
|
154
|
+
disabled: !G(E.value, e)
|
|
155
|
+
}))), He = a(() => [{
|
|
156
|
+
value: "AM",
|
|
157
|
+
label: "AM",
|
|
158
|
+
disabled: !Ge("AM")
|
|
159
|
+
}, {
|
|
160
|
+
value: "PM",
|
|
161
|
+
label: "PM",
|
|
162
|
+
disabled: !Ge("PM")
|
|
163
|
+
}]), Ue = a(() => {
|
|
164
|
+
let e = V(w.value);
|
|
165
|
+
return e === null ? b.placeholder : We(e);
|
|
166
|
+
}), z = a(() => `${F}-${k.value}-${A.value}`);
|
|
167
|
+
function B(e) {
|
|
168
|
+
return String(e).padStart(2, "0");
|
|
169
|
+
}
|
|
170
|
+
function V(e) {
|
|
171
|
+
if (typeof e != "string" || !/^\d{2}:\d{2}$/.test(e)) return null;
|
|
172
|
+
let [t, n] = e.split(":").map(Number);
|
|
173
|
+
return t > 23 || n > 59 ? null : t * 60 + n;
|
|
174
|
+
}
|
|
175
|
+
function H(e, t) {
|
|
176
|
+
return `${B(e)}:${B(t)}`;
|
|
177
|
+
}
|
|
178
|
+
function We(e) {
|
|
179
|
+
let t = new Date(2e3, 0, 1, Math.floor(e / 60), e % 60);
|
|
180
|
+
try {
|
|
181
|
+
return new Intl.DateTimeFormat(b.locale || "en-GB", {
|
|
182
|
+
hour: "numeric",
|
|
183
|
+
minute: "2-digit",
|
|
184
|
+
hour12: I.value
|
|
185
|
+
}).format(t);
|
|
186
|
+
} catch {
|
|
187
|
+
return H(Math.floor(e / 60), e % 60);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function U(e) {
|
|
191
|
+
let t = e % 12;
|
|
192
|
+
return t === 0 ? 12 : t;
|
|
193
|
+
}
|
|
194
|
+
function W(e, t) {
|
|
195
|
+
return t === "PM" ? e === 12 ? 12 : e + 12 : e === 12 ? 0 : e;
|
|
196
|
+
}
|
|
197
|
+
function G(e, t) {
|
|
198
|
+
let n = e * 60 + t;
|
|
199
|
+
return !(n % Re.value !== 0 || ze.value !== null && n < ze.value || Be.value !== null && n > Be.value);
|
|
200
|
+
}
|
|
201
|
+
function K(e) {
|
|
202
|
+
return Ve.value.some((t) => G(e, t));
|
|
203
|
+
}
|
|
204
|
+
function Ge(e) {
|
|
205
|
+
return L.value.some((t) => U(t.value) === U(E.value) && O.value === e && !t.disabled) || Array.from({ length: 12 }, (t, n) => W(n + 1, e)).some((e) => K(e));
|
|
206
|
+
}
|
|
207
|
+
function Ke() {
|
|
208
|
+
for (let e = 0; e < 1440; e += 1) if (G(Math.floor(e / 60), e % 60)) return e;
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
function qe() {
|
|
212
|
+
let e = V(w.value), t = e !== null && G(Math.floor(e / 60), e % 60) ? e : Ke();
|
|
213
|
+
E.value = Math.floor(t / 60), D.value = t % 60, O.value = E.value >= 12 ? "PM" : "AM", k.value = "hour", A.value = Math.max(0, L.value.findIndex((e) => e.value === E.value));
|
|
214
|
+
}
|
|
215
|
+
function q(e, t, n) {
|
|
216
|
+
n && (Me.value[e][t] = n);
|
|
217
|
+
}
|
|
218
|
+
function J() {
|
|
219
|
+
d(() => Me.value[k.value]?.[A.value]?.focus());
|
|
220
|
+
}
|
|
221
|
+
function Y(e = !0) {
|
|
222
|
+
b.disabled || (qe(), T.value = !0, e && x("update:open", !0), J());
|
|
223
|
+
}
|
|
224
|
+
function X(e = !0, t = !0) {
|
|
225
|
+
T.value && (T.value = !1, e && x("update:open", !1), t && d(() => {
|
|
226
|
+
T.value || C.value?.focus();
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
function Je() {
|
|
230
|
+
T.value ? X(!0, !0) : Y(!0);
|
|
231
|
+
}
|
|
232
|
+
function Ye(e) {
|
|
233
|
+
b.disabled || e === w.value || (w.value = e, x("update:modelValue", e), x("change", e));
|
|
234
|
+
}
|
|
235
|
+
function Xe() {
|
|
236
|
+
G(E.value, D.value) && (Ye(H(E.value, D.value)), X(!0, !0));
|
|
237
|
+
}
|
|
238
|
+
function Ze(e, t) {
|
|
239
|
+
if (e.disabled) return;
|
|
240
|
+
E.value = e.value, k.value = "minute";
|
|
241
|
+
let n = R.value.findIndex((e) => e.value === D.value && !e.disabled);
|
|
242
|
+
A.value = n >= 0 ? n : Math.max(0, R.value.findIndex((e) => !e.disabled)), J();
|
|
243
|
+
}
|
|
244
|
+
function Qe(e, t) {
|
|
245
|
+
e.disabled || (D.value = e.value, k.value = "minute", A.value = t, Xe());
|
|
246
|
+
}
|
|
247
|
+
function Z(e, t) {
|
|
248
|
+
e.disabled || (O.value = e.value, E.value = W(U(E.value), e.value), k.value = "period", A.value = t, J());
|
|
249
|
+
}
|
|
250
|
+
function Q(e) {
|
|
251
|
+
return e === "hour" ? L.value : e === "minute" ? R.value : He.value;
|
|
252
|
+
}
|
|
253
|
+
function $e(e, t, n) {
|
|
254
|
+
let r = Q(e), i = t + n;
|
|
255
|
+
for (; i >= 0 && i < r.length;) {
|
|
256
|
+
if (!r[i].disabled) return i;
|
|
257
|
+
i += n;
|
|
258
|
+
}
|
|
259
|
+
return t;
|
|
260
|
+
}
|
|
261
|
+
function et(e, t, n) {
|
|
262
|
+
if (n.isComposing) return;
|
|
263
|
+
if (n.key === "Escape") {
|
|
264
|
+
n.preventDefault(), X(!0, !0);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if ([
|
|
268
|
+
"ArrowUp",
|
|
269
|
+
"ArrowDown",
|
|
270
|
+
"Home",
|
|
271
|
+
"End"
|
|
272
|
+
].includes(n.key)) {
|
|
273
|
+
n.preventDefault();
|
|
274
|
+
let r = Q(e), i = n.key === "Home" ? r.findIndex((e) => !e.disabled) : n.key === "End" ? [...r].findLastIndex((e) => !e.disabled) : $e(e, t, n.key === "ArrowUp" ? -1 : 1);
|
|
275
|
+
i >= 0 && (k.value = e, A.value = i, e === "hour" && (E.value = r[i].value), e === "minute" && (D.value = r[i].value), e === "period" && Z(r[i], i), J());
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (n.key === "ArrowLeft" || n.key === "ArrowRight") {
|
|
279
|
+
n.preventDefault();
|
|
280
|
+
let t = I.value ? [
|
|
281
|
+
"hour",
|
|
282
|
+
"minute",
|
|
283
|
+
"period"
|
|
284
|
+
] : ["hour", "minute"], r = t[Math.max(0, Math.min(t.length - 1, t.indexOf(e) + (n.key === "ArrowLeft" ? -1 : 1)))];
|
|
285
|
+
k.value = r;
|
|
286
|
+
let i = Q(r);
|
|
287
|
+
A.value = Math.max(0, i.findIndex((e) => !e.disabled)), J();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (n.key !== "Enter" && n.key !== " ") return;
|
|
291
|
+
n.preventDefault();
|
|
292
|
+
let r = Q(e)[t];
|
|
293
|
+
e === "hour" ? Ze(r, t) : e === "minute" ? Qe(r, t) : Z(r, t);
|
|
294
|
+
}
|
|
295
|
+
function tt(e) {
|
|
296
|
+
b.disabled || (e.key === "Escape" && T.value ? (e.preventDefault(), X(!0, !0)) : [
|
|
297
|
+
"ArrowDown",
|
|
298
|
+
"ArrowUp",
|
|
299
|
+
"Enter",
|
|
300
|
+
" "
|
|
301
|
+
].includes(e.key) && (e.preventDefault(), T.value || Y(!0)));
|
|
302
|
+
}
|
|
303
|
+
function nt(e) {
|
|
304
|
+
e.key === "Escape" && (e.preventDefault(), X(!0, !0));
|
|
305
|
+
}
|
|
306
|
+
function rt() {
|
|
307
|
+
Ye(null), X(!0, !0), d(() => {
|
|
308
|
+
T.value || C.value?.focus();
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function $(e) {
|
|
312
|
+
T.value && !e.composedPath().includes(ke.value) && X(!1, !1);
|
|
313
|
+
}
|
|
314
|
+
function it(e) {
|
|
315
|
+
clearTimeout(P), P = setTimeout(() => {
|
|
316
|
+
if (e.defaultPrevented) return;
|
|
317
|
+
let t = w.value !== N;
|
|
318
|
+
w.value = N, X(!1, !1), t && (x("update:modelValue", w.value), x("change", w.value));
|
|
319
|
+
}, 0);
|
|
320
|
+
}
|
|
321
|
+
function at(e) {
|
|
322
|
+
e.preventDefault(), d(() => C.value?.focus());
|
|
323
|
+
}
|
|
324
|
+
return v(() => b.modelValue, (e) => {
|
|
325
|
+
w.value = e;
|
|
326
|
+
}), v(() => b.open, (e) => {
|
|
327
|
+
e ? Y(!1) : X(!1, !1);
|
|
328
|
+
}, { immediate: !0 }), v(() => b.disabled, (e) => {
|
|
329
|
+
e && X(!1, !1);
|
|
330
|
+
}), v([I, () => b.locale], () => {
|
|
331
|
+
T.value && qe();
|
|
332
|
+
}), re(() => {
|
|
333
|
+
N = b.modelValue, M = Ae.value?.form, M?.addEventListener("reset", it), j = ke.value.ownerDocument, j.addEventListener("pointerdown", $), j.addEventListener("focusin", $), T.value && J();
|
|
334
|
+
}), ne(() => {
|
|
335
|
+
clearTimeout(P), M?.removeEventListener("reset", it), j?.removeEventListener("pointerdown", $), j?.removeEventListener("focusin", $);
|
|
336
|
+
}), (e, a) => (p(), s("div", u({
|
|
337
|
+
ref_key: "root",
|
|
338
|
+
ref: ke
|
|
339
|
+
}, Oe.value, { class: ["kima-time-picker", {
|
|
340
|
+
"kima-time-picker--open": T.value,
|
|
341
|
+
"kima-time-picker--disabled": t.disabled
|
|
342
|
+
}] }), [
|
|
343
|
+
c("div", {
|
|
344
|
+
ref_key: "control",
|
|
345
|
+
ref: je,
|
|
346
|
+
class: "kima-time-picker__control",
|
|
347
|
+
"aria-disabled": t.disabled || void 0
|
|
348
|
+
}, [c("button", {
|
|
349
|
+
id: Ne,
|
|
350
|
+
ref_key: "trigger",
|
|
351
|
+
ref: C,
|
|
352
|
+
class: "kima-time-picker__trigger",
|
|
353
|
+
type: "button",
|
|
354
|
+
role: "combobox",
|
|
355
|
+
"aria-haspopup": "dialog",
|
|
356
|
+
"aria-expanded": T.value,
|
|
357
|
+
"aria-controls": Pe,
|
|
358
|
+
"aria-label": _(S)["aria-label"] || _(S).ariaLabel || t.label || t.placeholder,
|
|
359
|
+
"aria-required": t.required || void 0,
|
|
360
|
+
disabled: t.disabled,
|
|
361
|
+
onClick: Je,
|
|
362
|
+
onKeydown: tt
|
|
363
|
+
}, [c("span", { class: f(["kima-time-picker__trigger-label", { "kima-time-picker__trigger-label--placeholder": V(w.value) === null }]) }, g(Ue.value), 3), l(n, {
|
|
364
|
+
class: "kima-time-picker__arrow",
|
|
365
|
+
icon: _(ce),
|
|
366
|
+
size: 20,
|
|
367
|
+
"aria-hidden": "true"
|
|
368
|
+
}, null, 8, ["icon"])], 40, de), l(ee, u({ name: "kima-fade" }, _(r)), {
|
|
369
|
+
default: se(() => [t.clearable && w.value ? (p(), s("button", {
|
|
370
|
+
key: 0,
|
|
371
|
+
class: "kima-time-picker__clear",
|
|
372
|
+
type: "button",
|
|
373
|
+
"aria-label": "Clear time",
|
|
374
|
+
title: "Clear time",
|
|
375
|
+
disabled: t.disabled,
|
|
376
|
+
onClick: y(rt, ["stop"])
|
|
377
|
+
}, [l(n, {
|
|
378
|
+
icon: _(le),
|
|
379
|
+
size: 18,
|
|
380
|
+
"aria-hidden": "true"
|
|
381
|
+
}, null, 8, ["icon"])], 8, fe)) : o("", !0)]),
|
|
382
|
+
_: 1
|
|
383
|
+
}, 16)], 8, ue),
|
|
384
|
+
c("input", {
|
|
385
|
+
ref_key: "nativeInput",
|
|
386
|
+
ref: Ae,
|
|
387
|
+
class: "kima-time-picker__native",
|
|
388
|
+
type: "text",
|
|
389
|
+
name: t.name,
|
|
390
|
+
value: w.value || "",
|
|
391
|
+
required: t.required,
|
|
392
|
+
disabled: t.disabled,
|
|
393
|
+
tabindex: "-1",
|
|
394
|
+
"aria-hidden": "true",
|
|
395
|
+
onInput: a[0] ||= y(() => {}, ["stop"]),
|
|
396
|
+
onChange: a[1] ||= y(() => {}, ["stop"]),
|
|
397
|
+
onInvalid: at
|
|
398
|
+
}, null, 40, pe),
|
|
399
|
+
l(ee, u({ name: "kima-popup" }, _(r)), {
|
|
400
|
+
default: se(() => [T.value ? (p(), s("div", {
|
|
401
|
+
key: 0,
|
|
402
|
+
id: Pe,
|
|
403
|
+
class: "kima-time-picker__popup",
|
|
404
|
+
role: "dialog",
|
|
405
|
+
"aria-label": t.label || t.placeholder,
|
|
406
|
+
onKeydown: nt
|
|
407
|
+
}, [c("div", he, g(H(E.value, D.value)), 1), c("div", ge, [
|
|
408
|
+
c("div", _e, [a[2] ||= c("span", { class: "kima-time-picker__column-label" }, "Hour", -1), c("div", {
|
|
409
|
+
id: Fe,
|
|
410
|
+
class: "kima-time-picker__list",
|
|
411
|
+
role: "listbox",
|
|
412
|
+
"aria-label": "Hour",
|
|
413
|
+
"aria-activedescendant": k.value === "hour" ? z.value : void 0
|
|
414
|
+
}, [(p(!0), s(i, null, h(L.value, (e, t) => (p(), s("button", {
|
|
415
|
+
id: `${F}-hour-${t}`,
|
|
416
|
+
key: e.value,
|
|
417
|
+
ref_for: !0,
|
|
418
|
+
ref: (e) => q("hour", t, e),
|
|
419
|
+
class: f(["kima-time-picker__option", {
|
|
420
|
+
"kima-time-picker__option--active": k.value === "hour" && A.value === t,
|
|
421
|
+
"kima-time-picker__option--selected": e.value === E.value
|
|
422
|
+
}]),
|
|
423
|
+
type: "button",
|
|
424
|
+
role: "option",
|
|
425
|
+
"aria-selected": e.value === E.value,
|
|
426
|
+
"aria-disabled": e.disabled || void 0,
|
|
427
|
+
disabled: e.disabled,
|
|
428
|
+
tabindex: k.value === "hour" && A.value === t ? 0 : -1,
|
|
429
|
+
onClick: (n) => Ze(e, t),
|
|
430
|
+
onKeydown: (e) => et("hour", t, e)
|
|
431
|
+
}, g(e.label), 43, ye))), 128))], 8, ve)]),
|
|
432
|
+
c("div", be, [a[3] ||= c("span", { class: "kima-time-picker__column-label" }, "Minute", -1), c("div", {
|
|
433
|
+
id: Ie,
|
|
434
|
+
class: "kima-time-picker__list",
|
|
435
|
+
role: "listbox",
|
|
436
|
+
"aria-label": "Minute",
|
|
437
|
+
"aria-activedescendant": k.value === "minute" ? z.value : void 0
|
|
438
|
+
}, [(p(!0), s(i, null, h(R.value, (e, t) => (p(), s("button", {
|
|
439
|
+
id: `${F}-minute-${t}`,
|
|
440
|
+
key: e.value,
|
|
441
|
+
ref_for: !0,
|
|
442
|
+
ref: (e) => q("minute", t, e),
|
|
443
|
+
class: f(["kima-time-picker__option", {
|
|
444
|
+
"kima-time-picker__option--active": k.value === "minute" && A.value === t,
|
|
445
|
+
"kima-time-picker__option--selected": e.value === D.value
|
|
446
|
+
}]),
|
|
447
|
+
type: "button",
|
|
448
|
+
role: "option",
|
|
449
|
+
"aria-selected": e.value === D.value,
|
|
450
|
+
"aria-disabled": e.disabled || void 0,
|
|
451
|
+
disabled: e.disabled,
|
|
452
|
+
tabindex: k.value === "minute" && A.value === t ? 0 : -1,
|
|
453
|
+
onClick: (n) => Qe(e, t),
|
|
454
|
+
onKeydown: (e) => et("minute", t, e)
|
|
455
|
+
}, g(e.label), 43, Se))), 128))], 8, xe)]),
|
|
456
|
+
I.value ? (p(), s("div", Ce, [a[4] ||= c("span", { class: "kima-time-picker__column-label" }, "Period", -1), c("div", {
|
|
457
|
+
id: Le,
|
|
458
|
+
class: "kima-time-picker__list kima-time-picker__list--period",
|
|
459
|
+
role: "listbox",
|
|
460
|
+
"aria-label": "AM or PM",
|
|
461
|
+
"aria-activedescendant": k.value === "period" ? z.value : void 0
|
|
462
|
+
}, [(p(!0), s(i, null, h(He.value, (e, t) => (p(), s("button", {
|
|
463
|
+
id: `${F}-period-${t}`,
|
|
464
|
+
key: e.value,
|
|
465
|
+
ref_for: !0,
|
|
466
|
+
ref: (e) => q("period", t, e),
|
|
467
|
+
class: f(["kima-time-picker__option", {
|
|
468
|
+
"kima-time-picker__option--active": k.value === "period" && A.value === t,
|
|
469
|
+
"kima-time-picker__option--selected": e.value === O.value
|
|
470
|
+
}]),
|
|
471
|
+
type: "button",
|
|
472
|
+
role: "option",
|
|
473
|
+
"aria-selected": e.value === O.value,
|
|
474
|
+
"aria-disabled": e.disabled || void 0,
|
|
475
|
+
disabled: e.disabled,
|
|
476
|
+
tabindex: k.value === "period" && A.value === t ? 0 : -1,
|
|
477
|
+
onClick: (n) => Z(e, t),
|
|
478
|
+
onKeydown: (e) => et("period", t, e)
|
|
479
|
+
}, g(e.label), 43, Te))), 128))], 8, we)])) : o("", !0)
|
|
480
|
+
])], 40, me)) : o("", !0)]),
|
|
481
|
+
_: 1
|
|
482
|
+
}, 16)
|
|
483
|
+
], 16));
|
|
484
|
+
}
|
|
485
|
+
}), [["__scopeId", "data-v-afd1d777"]]);
|
|
486
|
+
export { Ee as default };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
import { presenceTransition as n } from "../../utils/motion.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Comment as r, Transition as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as ee, createVNode as te, mergeProps as l, nextTick as u, normalizeClass as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useAttrs as y, useId as b, useSlots as x, watch as S, withCtx as C } from "vue";
|
|
6
|
+
// src/components/core/tooltip.ce.vue
|
|
7
|
+
var w = ["aria-describedby"], T = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
8
|
+
__name: "tooltip.ce",
|
|
9
|
+
props: {
|
|
10
|
+
text: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: ""
|
|
13
|
+
},
|
|
14
|
+
position: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "bottom"
|
|
17
|
+
},
|
|
18
|
+
open: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: void 0
|
|
21
|
+
},
|
|
22
|
+
delay: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 500
|
|
25
|
+
},
|
|
26
|
+
disabled: Boolean
|
|
27
|
+
},
|
|
28
|
+
setup(t) {
|
|
29
|
+
let T = t, E = x(), D = y(), O = h(!1), k = h(null), A = h(null), j = h(!1), M = h(!1), N = h(!1), P = `kima-tooltip-${b()}`, { hasNativeSlot: F, isCustomElement: I } = e(k), L = a(() => I ? {
|
|
30
|
+
...D,
|
|
31
|
+
id: void 0
|
|
32
|
+
} : D), R = null, z = null, B, V = a(() => T.open !== void 0), H = a(() => E.content?.().some((e) => e.type === r ? !1 : typeof e.children != "string" || e.children.trim().length > 0) || F("content")), U = a(() => !!T.text.trim() || H.value), W = a(() => T.disabled || N.value || !U.value ? !1 : V.value ? T.open : O.value), G = a(() => [
|
|
33
|
+
"top",
|
|
34
|
+
"right",
|
|
35
|
+
"bottom",
|
|
36
|
+
"left"
|
|
37
|
+
].includes(T.position) ? T.position : "bottom"), K = a(() => Math.max(0, Number.isFinite(T.delay) ? T.delay : 0)), q = a(() => ({ "aria-describedby": W.value ? P : void 0 }));
|
|
38
|
+
function J() {
|
|
39
|
+
R !== null && (clearTimeout(R), R = null);
|
|
40
|
+
}
|
|
41
|
+
function Y(e) {
|
|
42
|
+
if (!e || typeof e.setAttribute != "function" || z === e) return;
|
|
43
|
+
X(), z = e;
|
|
44
|
+
let t = [...(e.getAttribute("aria-describedby") || "").split(/\s+/).filter((e) => e && e !== P), P].join(" ");
|
|
45
|
+
e.setAttribute("aria-describedby", t);
|
|
46
|
+
}
|
|
47
|
+
function X() {
|
|
48
|
+
if (!z) return;
|
|
49
|
+
let e = (z.getAttribute("aria-describedby") || "").split(/\s+/).filter((e) => e && e !== P);
|
|
50
|
+
e.length === 0 ? z.removeAttribute("aria-describedby") : z.setAttribute("aria-describedby", e.join(" ")), z = null;
|
|
51
|
+
}
|
|
52
|
+
function Z() {
|
|
53
|
+
J(), O.value = !1;
|
|
54
|
+
}
|
|
55
|
+
function Q(e = !1) {
|
|
56
|
+
N.value = !1, !(V.value || T.disabled || !U.value) && (J(), e || K.value === 0 ? O.value = !0 : R = setTimeout(() => {
|
|
57
|
+
O.value = !0, R = null;
|
|
58
|
+
}, K.value));
|
|
59
|
+
}
|
|
60
|
+
function ne() {
|
|
61
|
+
j.value = !0, Q(M.value);
|
|
62
|
+
}
|
|
63
|
+
function re() {
|
|
64
|
+
j.value = !1, M.value || Z();
|
|
65
|
+
}
|
|
66
|
+
function ie(e) {
|
|
67
|
+
M.value = !0, Q(!0), W.value && Y(e.target);
|
|
68
|
+
}
|
|
69
|
+
function ae(e) {
|
|
70
|
+
e.currentTarget?.contains(e.relatedTarget) || (M.value = !1, j.value || Z());
|
|
71
|
+
}
|
|
72
|
+
function $(e) {
|
|
73
|
+
e.key !== "Escape" || e.isComposing || !W.value && R === null || (e.preventDefault(), e.stopPropagation(), N.value = !0, Z());
|
|
74
|
+
}
|
|
75
|
+
return S(() => T.open, () => {
|
|
76
|
+
N.value = !1;
|
|
77
|
+
}), S([() => T.disabled, U], () => {
|
|
78
|
+
(T.disabled || !U.value) && Z();
|
|
79
|
+
}), S(W, (e) => {
|
|
80
|
+
e ? u(() => {
|
|
81
|
+
if (!W.value) return;
|
|
82
|
+
let e = A.value?.querySelector("button, a, input, select, textarea, [tabindex]:not([tabindex='-1'])");
|
|
83
|
+
e && Y(e);
|
|
84
|
+
}) : X();
|
|
85
|
+
}, { immediate: !0 }), p(() => {
|
|
86
|
+
B = A.value.ownerDocument, B.addEventListener("keydown", $), W.value && u(() => {
|
|
87
|
+
if (!W.value) return;
|
|
88
|
+
let e = A.value?.querySelector("button, a, input, select, textarea, [tabindex]:not([tabindex='-1'])");
|
|
89
|
+
e && Y(e);
|
|
90
|
+
});
|
|
91
|
+
}), f(() => {
|
|
92
|
+
B.removeEventListener("keydown", $), J(), X();
|
|
93
|
+
}), (e, r) => (m(), s("span", l({
|
|
94
|
+
ref_key: "root",
|
|
95
|
+
ref: k
|
|
96
|
+
}, L.value, {
|
|
97
|
+
class: ["kima-tooltip", {
|
|
98
|
+
"kima-tooltip--open": W.value,
|
|
99
|
+
"kima-tooltip--disabled": t.disabled
|
|
100
|
+
}],
|
|
101
|
+
onMouseenter: ne,
|
|
102
|
+
onMouseleave: re,
|
|
103
|
+
onFocusin: ie,
|
|
104
|
+
onFocusout: ae
|
|
105
|
+
}), [c("span", {
|
|
106
|
+
ref_key: "triggerRoot",
|
|
107
|
+
ref: A,
|
|
108
|
+
class: "kima-tooltip__trigger",
|
|
109
|
+
"aria-describedby": W.value ? P : void 0
|
|
110
|
+
}, [g(e.$slots, "trigger", {
|
|
111
|
+
triggerAttrs: q.value,
|
|
112
|
+
attrs: q.value,
|
|
113
|
+
open: W.value
|
|
114
|
+
}, () => [g(e.$slots, "default", {}, void 0, !0)], !0)], 8, w), te(i, l({ name: "kima-popup" }, v(n)), {
|
|
115
|
+
default: C(() => [W.value ? (m(), s("span", {
|
|
116
|
+
key: 0,
|
|
117
|
+
id: P,
|
|
118
|
+
class: d(["kima-tooltip__content", `kima-tooltip__content--${G.value}`]),
|
|
119
|
+
role: "tooltip"
|
|
120
|
+
}, [g(e.$slots, "content", {}, () => [ee(_(t.text), 1)], !0)], 2)) : o("", !0)]),
|
|
121
|
+
_: 3
|
|
122
|
+
}, 16)], 16));
|
|
123
|
+
}
|
|
124
|
+
}), [["__scopeId", "data-v-2c931a6a"]]);
|
|
125
|
+
export { T as default };
|