iryx-ui 0.25.0 → 0.26.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/dist/components/CommandPalette.vue.d.ts +12 -0
- package/dist/components/CommandPalette.vue_vue_type_script_setup_true_lang.js +122 -85
- package/dist/components/DateRangePicker.vue.d.ts +14 -2
- package/dist/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +111 -70
- package/dist/components/Tabs.vue.d.ts +7 -6
- package/dist/components/Tabs.vue_vue_type_script_setup_true_lang.js +65 -30
- package/dist/composables/command-palette.d.ts +7 -0
- package/dist/composables/command-palette.js +8 -2
- package/dist/composables/date.d.ts +25 -0
- package/dist/composables/date.js +59 -16
- package/dist/composables/scroll-fade.d.ts +1 -1
- package/dist/index.js +133 -133
- package/dist/theme/date-picker.d.ts +9 -0
- package/dist/theme/date-picker.js +3 -0
- package/dist/theme/tabs.d.ts +18 -3
- package/dist/theme/tabs.js +20 -12
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ export interface TabsProps {
|
|
|
22
22
|
/** Override classes per element, e.g. `{ list: 'w-full' }`. */
|
|
23
23
|
ui?: {
|
|
24
24
|
root?: string;
|
|
25
|
+
frame?: string;
|
|
25
26
|
list?: string;
|
|
26
27
|
indicator?: string;
|
|
27
28
|
trigger?: string;
|
|
@@ -33,19 +34,19 @@ type __VLS_ModelProps = {
|
|
|
33
34
|
modelValue?: string | undefined;
|
|
34
35
|
};
|
|
35
36
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
36
|
-
declare var
|
|
37
|
+
declare var __VLS_21: {}, __VLS_29: {
|
|
37
38
|
item: TabsItem;
|
|
38
|
-
},
|
|
39
|
+
}, __VLS_36: {}, __VLS_45: string, __VLS_46: {
|
|
39
40
|
item: TabsItem;
|
|
40
41
|
};
|
|
41
42
|
type __VLS_Slots = {} & {
|
|
42
|
-
[K in NonNullable<typeof
|
|
43
|
+
[K in NonNullable<typeof __VLS_45>]?: (props: typeof __VLS_46) => any;
|
|
43
44
|
} & {
|
|
44
|
-
list?: (props: typeof
|
|
45
|
+
list?: (props: typeof __VLS_21) => any;
|
|
45
46
|
} & {
|
|
46
|
-
trigger?: (props: typeof
|
|
47
|
+
trigger?: (props: typeof __VLS_29) => any;
|
|
47
48
|
} & {
|
|
48
|
-
default?: (props: typeof
|
|
49
|
+
default?: (props: typeof __VLS_36) => any;
|
|
49
50
|
};
|
|
50
51
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
52
|
"update:modelValue": (value: string | undefined) => any;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useIryxUiConfig as e } from "../config.js";
|
|
2
2
|
import t from "./Icon.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { scrollFadeMask as n, useScrollEdges as r } from "../composables/scroll-fade.js";
|
|
4
|
+
import { tabsTheme as i } from "../theme/tabs.js";
|
|
5
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, mergeModels as m, nextTick as h, normalizeClass as g, normalizeStyle as _, onMounted as v, openBlock as y, ref as b, renderList as x, renderSlot as S, toDisplayString as C, unref as w, useModel as T, watch as E, withCtx as D } from "vue";
|
|
6
|
+
import { TabsContent as O, TabsIndicator as k, TabsList as A, TabsRoot as j, TabsTrigger as M } from "reka-ui";
|
|
6
7
|
//#region src/components/Tabs.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var
|
|
8
|
+
var N = 24, P = /*@__PURE__*/ p({
|
|
8
9
|
__name: "Tabs",
|
|
9
|
-
props: /*@__PURE__*/
|
|
10
|
+
props: /*@__PURE__*/ m({
|
|
10
11
|
items: {},
|
|
11
12
|
variant: {},
|
|
12
13
|
orientation: {},
|
|
@@ -27,29 +28,57 @@ var T = /*@__PURE__*/ u({
|
|
|
27
28
|
modelModifiers: {}
|
|
28
29
|
}),
|
|
29
30
|
emits: ["update:modelValue"],
|
|
30
|
-
setup(
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
setup(p) {
|
|
32
|
+
let m = p, P = o(() => (m.items ?? []).map((e) => typeof e == "string" ? { label: e } : e)), F = (e) => e.value ?? e.label, I = T(p, "modelValue"), L = b(), R = o(() => L.value?.$el), z = o(() => m.orientation === "vertical" ? "vertical" : "horizontal"), { atStart: B, atEnd: V, overflowing: H } = r(R, z), U = o(() => {
|
|
33
|
+
if (!H.value) return;
|
|
34
|
+
let e = n({
|
|
35
|
+
orientation: z.value,
|
|
36
|
+
size: `${N}px`,
|
|
37
|
+
fadeStart: !B.value,
|
|
38
|
+
fadeEnd: !V.value
|
|
39
|
+
});
|
|
40
|
+
return e ? {
|
|
41
|
+
maskImage: e,
|
|
42
|
+
WebkitMaskImage: e
|
|
43
|
+
} : void 0;
|
|
44
|
+
});
|
|
45
|
+
function W() {
|
|
46
|
+
let e = R.value, t = e?.querySelector("[role=\"tab\"][data-state=\"active\"]");
|
|
47
|
+
if (!e || !t) return;
|
|
48
|
+
let n = z.value === "vertical", r = n ? t.offsetTop : t.offsetLeft, i = r + (n ? t.offsetHeight : t.offsetWidth), a = n ? e.scrollTop : e.scrollLeft, o = n ? e.clientHeight : e.clientWidth, s = a;
|
|
49
|
+
r < a + N ? s = r - N : i > a + o - N && (s = i - o + N), s !== a && (n ? e.scrollTop = Math.max(0, s) : e.scrollLeft = Math.max(0, s));
|
|
50
|
+
}
|
|
51
|
+
v(() => void h(W)), E(I, () => void h(W));
|
|
52
|
+
let G = e(), K = o(() => m.unstyled ?? G.unstyled), q = o(() => i({
|
|
53
|
+
variant: m.variant,
|
|
54
|
+
orientation: m.orientation
|
|
55
|
+
})), J = o(() => K.value ? [m.ui?.root, m.class] : q.value.root({ class: [m.ui?.root, m.class] })), Y = o(() => K.value ? m.ui?.frame : q.value.frame({ class: m.ui?.frame })), X = o(() => K.value ? m.ui?.list : q.value.list({ class: m.ui?.list })), Z = o(() => K.value ? m.ui?.indicator : q.value.indicator({ class: m.ui?.indicator })), Q = o(() => K.value ? m.ui?.trigger : q.value.trigger({ class: m.ui?.trigger })), $ = o(() => K.value ? m.ui?.content : q.value.content({ class: m.ui?.content }));
|
|
56
|
+
return (e, n) => (y(), s(w(j), {
|
|
57
|
+
modelValue: I.value,
|
|
58
|
+
"onUpdate:modelValue": n[0] ||= (e) => I.value = e,
|
|
59
|
+
"default-value": P.value[0] ? F(P.value[0]) : void 0,
|
|
60
|
+
orientation: m.orientation,
|
|
61
|
+
class: g(J.value)
|
|
41
62
|
}, {
|
|
42
|
-
default:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
63
|
+
default: D(() => [u("div", { class: g(Y.value) }, [f(w(A), {
|
|
64
|
+
ref_key: "list",
|
|
65
|
+
ref: L,
|
|
66
|
+
class: g(X.value),
|
|
67
|
+
style: _(U.value),
|
|
68
|
+
"data-overflowing": w(H) ? "" : void 0,
|
|
69
|
+
"data-at-start": w(B) ? "" : void 0,
|
|
70
|
+
"data-at-end": w(V) ? "" : void 0
|
|
71
|
+
}, {
|
|
72
|
+
default: D(() => [f(w(k), { class: g(Z.value) }, null, 8, ["class"]), S(e.$slots, "list", {}, () => [(y(!0), l(a, null, x(P.value, (n) => (y(), s(w(M), {
|
|
73
|
+
key: F(n),
|
|
74
|
+
value: F(n),
|
|
46
75
|
disabled: n.disabled,
|
|
47
|
-
class:
|
|
76
|
+
class: g(Q.value)
|
|
48
77
|
}, {
|
|
49
|
-
default:
|
|
78
|
+
default: D(() => [S(e.$slots, "trigger", { item: n }, () => [n.icon ? (y(), s(t, {
|
|
50
79
|
key: 0,
|
|
51
80
|
icon: n.icon
|
|
52
|
-
}, null, 8, ["icon"])) :
|
|
81
|
+
}, null, 8, ["icon"])) : c("", !0), d(" " + C(n.label), 1)])]),
|
|
53
82
|
_: 2
|
|
54
83
|
}, 1032, [
|
|
55
84
|
"value",
|
|
@@ -57,13 +86,19 @@ var T = /*@__PURE__*/ u({
|
|
|
57
86
|
"class"
|
|
58
87
|
]))), 128))])]),
|
|
59
88
|
_: 3
|
|
60
|
-
}, 8, [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
89
|
+
}, 8, [
|
|
90
|
+
"class",
|
|
91
|
+
"style",
|
|
92
|
+
"data-overflowing",
|
|
93
|
+
"data-at-start",
|
|
94
|
+
"data-at-end"
|
|
95
|
+
])], 2), S(e.$slots, "default", {}, () => [(y(!0), l(a, null, x(P.value, (t) => (y(), s(w(O), {
|
|
96
|
+
key: F(t),
|
|
97
|
+
value: F(t),
|
|
98
|
+
"force-mount": m.keepMounted || void 0,
|
|
99
|
+
class: g($.value)
|
|
65
100
|
}, {
|
|
66
|
-
default:
|
|
101
|
+
default: D(() => [S(e.$slots, F(t), { item: t })]),
|
|
67
102
|
_: 2
|
|
68
103
|
}, 1032, [
|
|
69
104
|
"value",
|
|
@@ -80,4 +115,4 @@ var T = /*@__PURE__*/ u({
|
|
|
80
115
|
}
|
|
81
116
|
});
|
|
82
117
|
//#endregion
|
|
83
|
-
export {
|
|
118
|
+
export { P as default };
|
|
@@ -2,6 +2,11 @@ import type { IconLike } from './icon';
|
|
|
2
2
|
export interface CommandItem {
|
|
3
3
|
/** What the reader searches for and reads. */
|
|
4
4
|
label: string;
|
|
5
|
+
/**
|
|
6
|
+
* Stable identity for the recent list. Falls back to the group and label,
|
|
7
|
+
* so set it when a label can change (a translated app, a renamed page).
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
5
10
|
icon?: IconLike;
|
|
6
11
|
/**
|
|
7
12
|
* Displayed at the trailing edge, split on spaces into separate keys.
|
|
@@ -27,6 +32,8 @@ export type CommandEntry = CommandItem | CommandGroup;
|
|
|
27
32
|
export declare function isCommandGroup(entry: CommandEntry): entry is CommandGroup;
|
|
28
33
|
/** Normalise to groups, so the template has a single path to render. */
|
|
29
34
|
export declare function toCommandGroups(entries: CommandEntry[] | undefined): CommandGroup[];
|
|
35
|
+
export declare function commandId(item: CommandItem, group: string): string;
|
|
36
|
+
export declare function pushRecent(recent: string[], id: string, limit: number): string[];
|
|
30
37
|
/**
|
|
31
38
|
* Everything a query should match against: the label, the group it sits in,
|
|
32
39
|
* and any keywords. Joined rather than tested separately so a query spanning
|
|
@@ -18,15 +18,21 @@ function n(e) {
|
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
20
|
function r(e, t) {
|
|
21
|
+
return e.id ?? `${t}/${e.label}`;
|
|
22
|
+
}
|
|
23
|
+
function i(e, t, n) {
|
|
24
|
+
return [t, ...e.filter((e) => e !== t)].slice(0, Math.max(0, n));
|
|
25
|
+
}
|
|
26
|
+
function a(e, t) {
|
|
21
27
|
return [
|
|
22
28
|
e.label,
|
|
23
29
|
t,
|
|
24
30
|
...e.keywords ?? []
|
|
25
31
|
].join(" ");
|
|
26
32
|
}
|
|
27
|
-
function
|
|
33
|
+
function o(t, n) {
|
|
28
34
|
let r = n.toLowerCase().split("+").map((e) => e.trim()), i = r.at(-1) ?? "", a = r.includes("mod"), o = r.includes("ctrl") || r.includes("control"), s = r.includes("meta") || r.includes("cmd"), c = r.includes("shift"), l = r.includes("alt") || r.includes("option"), u = e() ? t.metaKey : t.ctrlKey;
|
|
29
35
|
return a && !u || o && !t.ctrlKey || s && !t.metaKey || c !== t.shiftKey || l !== t.altKey ? !1 : t.key.toLowerCase() === i;
|
|
30
36
|
}
|
|
31
37
|
//#endregion
|
|
32
|
-
export {
|
|
38
|
+
export { a as commandHaystack, r as commandId, t as isCommandGroup, o as matchesHotkey, i as pushRecent, n as toCommandGroups };
|
|
@@ -12,6 +12,31 @@ export declare function toCalendarDate(iso: string | null | undefined): Calendar
|
|
|
12
12
|
export declare function toIsoDate(date: DateValue | null | undefined): string | null;
|
|
13
13
|
/** Today in the viewer's own zone, as an ISO date string. */
|
|
14
14
|
export declare function isoToday(): string;
|
|
15
|
+
/** One shortcut in `IDateRangePicker`'s preset list. */
|
|
16
|
+
export interface DateRangePreset {
|
|
17
|
+
label: string;
|
|
18
|
+
/** A function is re-run each time the picker opens, so "Today" stays today. */
|
|
19
|
+
range: {
|
|
20
|
+
start: string | null;
|
|
21
|
+
end: string | null;
|
|
22
|
+
} | (() => {
|
|
23
|
+
start: string | null;
|
|
24
|
+
end: string | null;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export interface CommonDateRangePresetLabels {
|
|
28
|
+
today: string;
|
|
29
|
+
yesterday: string;
|
|
30
|
+
last7Days: string;
|
|
31
|
+
last30Days: string;
|
|
32
|
+
thisMonth: string;
|
|
33
|
+
lastMonth: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The usual dashboard shortcuts, relative to today in the viewer's zone.
|
|
37
|
+
* Pass `labels` to translate them.
|
|
38
|
+
*/
|
|
39
|
+
export declare function commonDateRangePresets(labels?: Partial<CommonDateRangePresetLabels>): DateRangePreset[];
|
|
15
40
|
/**
|
|
16
41
|
* Render an ISO date for display. Returns `''` for absent or malformed input
|
|
17
42
|
* so a caller can fall back to a placeholder.
|
package/dist/composables/date.js
CHANGED
|
@@ -1,33 +1,76 @@
|
|
|
1
|
-
import { CalendarDate as e, DateFormatter as t, Time as n,
|
|
1
|
+
import { CalendarDate as e, DateFormatter as t, Time as n, endOfMonth as r, getLocalTimeZone as i, parseDate as a, startOfMonth as o, today as s } from "@internationalized/date";
|
|
2
2
|
//#region src/composables/date.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
if (!(!e || !
|
|
6
|
-
return
|
|
3
|
+
var c = /^\d{4}-\d{2}-\d{2}$/;
|
|
4
|
+
function l(e) {
|
|
5
|
+
if (!(!e || !c.test(e))) try {
|
|
6
|
+
return a(e);
|
|
7
7
|
} catch {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function u(e) {
|
|
12
12
|
return e ? `${e.year.toString().padStart(4, "0")}-${e.month.toString().padStart(2, "0")}-${e.day.toString().padStart(2, "0")}` : null;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function d() {
|
|
15
|
+
return u(s(i()));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
|
|
17
|
+
function f(e = {}) {
|
|
18
|
+
let t = {
|
|
19
|
+
today: "Today",
|
|
20
|
+
yesterday: "Yesterday",
|
|
21
|
+
last7Days: "Last 7 days",
|
|
22
|
+
last30Days: "Last 30 days",
|
|
23
|
+
thisMonth: "This month",
|
|
24
|
+
lastMonth: "Last month",
|
|
25
|
+
...e
|
|
26
|
+
}, n = () => s(i()), a = (e, t) => ({
|
|
27
|
+
start: u(e),
|
|
28
|
+
end: u(t)
|
|
29
|
+
});
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
label: t.today,
|
|
33
|
+
range: () => a(n(), n())
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: t.yesterday,
|
|
37
|
+
range: () => a(n().subtract({ days: 1 }), n().subtract({ days: 1 }))
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: t.last7Days,
|
|
41
|
+
range: () => a(n().subtract({ days: 6 }), n())
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: t.last30Days,
|
|
45
|
+
range: () => a(n().subtract({ days: 29 }), n())
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: t.thisMonth,
|
|
49
|
+
range: () => a(o(n()), r(n()))
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: t.lastMonth,
|
|
53
|
+
range: () => {
|
|
54
|
+
let e = o(n()).subtract({ months: 1 });
|
|
55
|
+
return a(e, r(e));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
];
|
|
20
59
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
60
|
+
function p(e, n, r = { dateStyle: "medium" }) {
|
|
61
|
+
let a = l(e);
|
|
62
|
+
return a ? new t(n ?? "en-US", r).format(a.toDate(i())) : "";
|
|
63
|
+
}
|
|
64
|
+
var m = /^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/;
|
|
65
|
+
function h(e) {
|
|
66
|
+
if (!e || !m.test(e)) return;
|
|
24
67
|
let [t, r, i] = e.split(":").map(Number);
|
|
25
68
|
return new n(t, r, i ?? 0);
|
|
26
69
|
}
|
|
27
|
-
function
|
|
70
|
+
function g(e) {
|
|
28
71
|
if (!e) return null;
|
|
29
72
|
let t = (e) => String(e).padStart(2, "0"), n = `${t(e.hour)}:${t(e.minute)}`;
|
|
30
73
|
return e.second ? `${n}:${t(e.second)}` : n;
|
|
31
74
|
}
|
|
32
75
|
//#endregion
|
|
33
|
-
export { e as CalendarDate, n as Time,
|
|
76
|
+
export { e as CalendarDate, n as Time, f as commonDateRangePresets, p as formatIsoDate, d as isoToday, l as toCalendarDate, u as toIsoDate, g as toIsoTime, h as toTime };
|
|
@@ -15,7 +15,7 @@ export interface ScrollEdges {
|
|
|
15
15
|
* panel that fits on a desktop overflows on a phone. A fade painted on a
|
|
16
16
|
* container that does not actually scroll is a lie about what is there.
|
|
17
17
|
*/
|
|
18
|
-
export declare function useScrollEdges(target: Ref<HTMLElement | undefined
|
|
18
|
+
export declare function useScrollEdges(target: Readonly<Ref<HTMLElement | undefined>>, axis: Readonly<Ref<'vertical' | 'horizontal'>>): ScrollEdges;
|
|
19
19
|
/**
|
|
20
20
|
* The mask that fades the edges with something past them.
|
|
21
21
|
*
|