iryx-ui 0.26.0 → 0.27.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/AppShell.vue.d.ts +12 -11
- package/dist/components/AppShell.vue_vue_type_script_setup_true_lang.js +76 -61
- package/dist/components/Breadcrumb.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/DropdownMenu.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/components/DropdownMenuItems.vue_vue_type_script_setup_true_lang.js +12 -8
- package/dist/components/Sidebar.vue.d.ts +11 -5
- package/dist/components/Sidebar.vue_vue_type_script_setup_true_lang.js +172 -92
- package/dist/composables/dropdown-menu.d.ts +3 -1
- package/dist/composables/sidebar.d.ts +3 -0
- package/dist/composables/sidebar.js +7 -6
- package/dist/index.js +166 -166
- package/dist/theme/app-shell.d.ts +27 -6
- package/dist/theme/app-shell.js +26 -9
- package/dist/theme/avatar.js +1 -1
- package/dist/theme/presets.d.ts +1 -0
- package/dist/theme/presets.js +1 -0
- package/dist/theme/sidebar.d.ts +24 -0
- package/dist/theme/sidebar.js +9 -2
- package/package.json +1 -1
- package/theme.css +4 -0
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { useIryxUiConfig as e } from "../config.js";
|
|
2
2
|
import t from "./Icon.js";
|
|
3
|
-
import { isSidebarGroup as n,
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { isSidebarGroup as n, sidebarPlacementKey as r, toSidebarSections as i } from "../composables/sidebar.js";
|
|
4
|
+
import a from "./Tooltip.js";
|
|
5
|
+
import o from "./DropdownMenu.js";
|
|
6
|
+
import { sidebarTheme as s } from "../theme/sidebar.js";
|
|
7
|
+
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, inject as _, mergeModels as v, normalizeClass as y, openBlock as b, ref as x, renderList as S, renderSlot as C, resolveDynamicComponent as w, toDisplayString as T, unref as E, useModel as D, withCtx as O } from "vue";
|
|
8
|
+
import { ArrowRight01Icon as k } from "@hugeicons/core-free-icons";
|
|
9
|
+
import { CollapsibleContent as A, CollapsibleRoot as j, CollapsibleTrigger as M, Primitive as N } from "reka-ui";
|
|
8
10
|
//#region src/components/Sidebar.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var
|
|
11
|
+
var P = [
|
|
12
|
+
"aria-label",
|
|
13
|
+
"disabled",
|
|
14
|
+
"data-active",
|
|
15
|
+
"data-disabled"
|
|
16
|
+
], F = /*@__PURE__*/ g({
|
|
10
17
|
__name: "Sidebar",
|
|
11
|
-
props: /*@__PURE__*/
|
|
18
|
+
props: /*@__PURE__*/ v({
|
|
12
19
|
items: {},
|
|
13
20
|
side: { default: "left" },
|
|
14
21
|
label: { default: "Sidebar" },
|
|
@@ -31,61 +38,113 @@ var O = /*@__PURE__*/ f({
|
|
|
31
38
|
collapsedModifiers: {}
|
|
32
39
|
}),
|
|
33
40
|
emits: ["update:collapsed"],
|
|
34
|
-
setup(
|
|
35
|
-
let
|
|
36
|
-
side:
|
|
37
|
-
collapsed:
|
|
41
|
+
setup(g) {
|
|
42
|
+
let v = g, F = D(g, "collapsed"), I = _(r, void 0), L = l(() => F.value && I !== "drawer"), R = e(), z = l(() => v.unstyled ?? R.unstyled), B = l(() => i(v.items)), V = l(() => s({
|
|
43
|
+
side: v.side,
|
|
44
|
+
collapsed: L.value,
|
|
45
|
+
inShell: I !== void 0
|
|
38
46
|
}));
|
|
39
|
-
function
|
|
40
|
-
let t =
|
|
41
|
-
return
|
|
47
|
+
function H(e) {
|
|
48
|
+
let t = v.ui?.[e];
|
|
49
|
+
return z.value ? t : V.value[e]({ class: t });
|
|
42
50
|
}
|
|
43
|
-
let
|
|
44
|
-
function
|
|
51
|
+
let U = l(() => v.side === "right" ? "left" : "right"), W = x({}), G = (e, t) => `${e}:${t.label}`, K = (e) => e.href ? "a" : "button", q = (e) => [...e.label][0], J = (e) => e.badge === void 0 ? e.label : `${e.label} (${e.badge})`;
|
|
52
|
+
function Y(e) {
|
|
53
|
+
return (e.items ?? []).map((e) => ({
|
|
54
|
+
label: e.label,
|
|
55
|
+
icon: e.icon,
|
|
56
|
+
disabled: e.disabled,
|
|
57
|
+
href: e.href,
|
|
58
|
+
onSelect: e.onSelect
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
function X(e, t) {
|
|
45
62
|
if (e.disabled) {
|
|
46
63
|
t.preventDefault();
|
|
47
64
|
return;
|
|
48
65
|
}
|
|
49
66
|
e.onSelect?.();
|
|
50
67
|
}
|
|
51
|
-
let
|
|
52
|
-
return (e, r) => (
|
|
68
|
+
let Z = (e) => e.label;
|
|
69
|
+
return (e, r) => (b(), u(E(N), {
|
|
53
70
|
as: "nav",
|
|
54
|
-
"aria-label":
|
|
55
|
-
"data-collapsed":
|
|
56
|
-
class:
|
|
71
|
+
"aria-label": v.label,
|
|
72
|
+
"data-collapsed": L.value ? "" : void 0,
|
|
73
|
+
class: y(z.value ? [v.ui?.root, v.class] : V.value.root({ class: [v.ui?.root, v.class] }))
|
|
57
74
|
}, {
|
|
58
|
-
default:
|
|
59
|
-
e.$slots.header ? (
|
|
75
|
+
default: O(() => [
|
|
76
|
+
e.$slots.header ? (b(), f("div", {
|
|
60
77
|
key: 0,
|
|
61
|
-
class:
|
|
62
|
-
}, [
|
|
63
|
-
|
|
78
|
+
class: y(H("header"))
|
|
79
|
+
}, [C(e.$slots, "header", { collapsed: L.value })], 2)) : d("", !0),
|
|
80
|
+
p("div", { class: y(H("nav")) }, [C(e.$slots, "default", { collapsed: L.value }, () => [(b(!0), f(c, null, S(B.value, (r, i) => (b(), f("div", {
|
|
64
81
|
key: r.section || i,
|
|
65
|
-
class:
|
|
66
|
-
}, [r.section ? (
|
|
82
|
+
class: y(H("section"))
|
|
83
|
+
}, [r.section ? (b(), f("p", {
|
|
67
84
|
key: 0,
|
|
68
|
-
class:
|
|
69
|
-
},
|
|
85
|
+
class: y(H("sectionLabel"))
|
|
86
|
+
}, T(r.section), 3)) : d("", !0), (b(!0), f(c, null, S(r.items, (r) => (b(), f(c, { key: r.label }, [E(n)(r) && L.value ? (b(), u(a, {
|
|
70
87
|
key: 0,
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
text: J(r),
|
|
89
|
+
side: U.value,
|
|
90
|
+
unstyled: z.value
|
|
91
|
+
}, {
|
|
92
|
+
trigger: O(() => [h(o, {
|
|
93
|
+
items: Y(r),
|
|
94
|
+
side: U.value,
|
|
95
|
+
unstyled: z.value
|
|
96
|
+
}, {
|
|
97
|
+
trigger: O(() => [p("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
"aria-label": Z(r),
|
|
100
|
+
disabled: r.disabled,
|
|
101
|
+
"data-active": r.active ? "" : void 0,
|
|
102
|
+
"data-disabled": r.disabled ? "" : void 0,
|
|
103
|
+
class: y(H("link"))
|
|
104
|
+
}, [C(e.$slots, "link", {
|
|
105
|
+
link: r,
|
|
106
|
+
collapsed: L.value
|
|
107
|
+
}, () => [r.icon ? (b(), u(t, {
|
|
108
|
+
key: 0,
|
|
109
|
+
icon: r.icon
|
|
110
|
+
}, null, 8, ["icon"])) : (b(), f("span", {
|
|
111
|
+
key: 1,
|
|
112
|
+
"aria-hidden": "true",
|
|
113
|
+
class: y(H("linkInitial"))
|
|
114
|
+
}, T(q(r)), 3))])], 10, P)]),
|
|
115
|
+
header: O(() => [m(T(r.label), 1)]),
|
|
116
|
+
_: 2
|
|
117
|
+
}, 1032, [
|
|
118
|
+
"items",
|
|
119
|
+
"side",
|
|
120
|
+
"unstyled"
|
|
121
|
+
])]),
|
|
122
|
+
_: 2
|
|
123
|
+
}, 1032, [
|
|
124
|
+
"text",
|
|
125
|
+
"side",
|
|
126
|
+
"unstyled"
|
|
127
|
+
])) : E(n)(r) ? (b(), u(E(j), {
|
|
128
|
+
key: 1,
|
|
129
|
+
open: W.value[G(i, r)] ?? r.defaultOpen ?? !1,
|
|
130
|
+
disabled: r.disabled,
|
|
131
|
+
"onUpdate:open": (e) => W.value[G(i, r)] = e
|
|
73
132
|
}, {
|
|
74
|
-
default:
|
|
75
|
-
"aria-label":
|
|
133
|
+
default: O(() => [h(E(M), {
|
|
134
|
+
"aria-label": Z(r),
|
|
76
135
|
"data-active": r.active ? "" : void 0,
|
|
77
136
|
"data-disabled": r.disabled ? "" : void 0,
|
|
78
|
-
class:
|
|
137
|
+
class: y(H("link"))
|
|
79
138
|
}, {
|
|
80
|
-
default:
|
|
81
|
-
r.icon ? (
|
|
139
|
+
default: O(() => [
|
|
140
|
+
r.icon ? (b(), u(t, {
|
|
82
141
|
key: 0,
|
|
83
142
|
icon: r.icon
|
|
84
|
-
}, null, 8, ["icon"])) :
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
icon:
|
|
88
|
-
class:
|
|
143
|
+
}, null, 8, ["icon"])) : d("", !0),
|
|
144
|
+
p("span", { class: y(H("linkLabel")) }, T(r.label), 3),
|
|
145
|
+
h(t, {
|
|
146
|
+
icon: E(k),
|
|
147
|
+
class: y(H("groupIcon"))
|
|
89
148
|
}, null, 8, ["icon", "class"])
|
|
90
149
|
]),
|
|
91
150
|
_: 2
|
|
@@ -94,29 +153,29 @@ var O = /*@__PURE__*/ f({
|
|
|
94
153
|
"data-active",
|
|
95
154
|
"data-disabled",
|
|
96
155
|
"class"
|
|
97
|
-
]),
|
|
98
|
-
default:
|
|
156
|
+
]), h(E(A), { class: y(H("groupContent")) }, {
|
|
157
|
+
default: O(() => [p("div", { class: y(H("groupInner")) }, [(b(!0), f(c, null, S(r.items, (e) => (b(), u(w(K(e)), {
|
|
99
158
|
key: e.label,
|
|
100
159
|
href: e.href,
|
|
101
160
|
type: e.href ? void 0 : "button",
|
|
102
|
-
"aria-label":
|
|
161
|
+
"aria-label": Z(e),
|
|
103
162
|
"aria-current": e.active ? "page" : void 0,
|
|
104
163
|
"aria-disabled": e.disabled || void 0,
|
|
105
164
|
"data-active": e.active ? "" : void 0,
|
|
106
165
|
"data-disabled": e.disabled ? "" : void 0,
|
|
107
|
-
class:
|
|
108
|
-
onClick: (t) =>
|
|
166
|
+
class: y(H("link")),
|
|
167
|
+
onClick: (t) => X(e, t)
|
|
109
168
|
}, {
|
|
110
|
-
default:
|
|
111
|
-
e.icon ? (
|
|
169
|
+
default: O(() => [
|
|
170
|
+
e.icon ? (b(), u(t, {
|
|
112
171
|
key: 0,
|
|
113
172
|
icon: e.icon
|
|
114
|
-
}, null, 8, ["icon"])) :
|
|
115
|
-
|
|
116
|
-
e.badge === void 0 ?
|
|
173
|
+
}, null, 8, ["icon"])) : d("", !0),
|
|
174
|
+
p("span", { class: y(H("linkLabel")) }, T(e.label), 3),
|
|
175
|
+
e.badge === void 0 ? d("", !0) : (b(), f("span", {
|
|
117
176
|
key: 1,
|
|
118
|
-
class:
|
|
119
|
-
},
|
|
177
|
+
class: y(H("linkBadge"))
|
|
178
|
+
}, T(e.badge), 3))
|
|
120
179
|
]),
|
|
121
180
|
_: 2
|
|
122
181
|
}, 1032, [
|
|
@@ -133,48 +192,69 @@ var O = /*@__PURE__*/ f({
|
|
|
133
192
|
_: 2
|
|
134
193
|
}, 1032, ["class"])]),
|
|
135
194
|
_: 2
|
|
136
|
-
}, 1032, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
onClick: (e) => F(r, e)
|
|
195
|
+
}, 1032, [
|
|
196
|
+
"open",
|
|
197
|
+
"disabled",
|
|
198
|
+
"onUpdate:open"
|
|
199
|
+
])) : (b(), u(a, {
|
|
200
|
+
key: 2,
|
|
201
|
+
text: J(r),
|
|
202
|
+
side: U.value,
|
|
203
|
+
disabled: !L.value,
|
|
204
|
+
unstyled: z.value
|
|
147
205
|
}, {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
r.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
206
|
+
trigger: O(() => [(b(), u(w(K(r)), {
|
|
207
|
+
href: r.href,
|
|
208
|
+
type: r.href ? void 0 : "button",
|
|
209
|
+
"aria-label": Z(r),
|
|
210
|
+
"aria-current": r.active ? "page" : void 0,
|
|
211
|
+
"aria-disabled": r.disabled || void 0,
|
|
212
|
+
"data-active": r.active ? "" : void 0,
|
|
213
|
+
"data-disabled": r.disabled ? "" : void 0,
|
|
214
|
+
class: y(H("link")),
|
|
215
|
+
onClick: (e) => X(r, e)
|
|
216
|
+
}, {
|
|
217
|
+
default: O(() => [C(e.$slots, "link", {
|
|
218
|
+
link: r,
|
|
219
|
+
collapsed: L.value
|
|
220
|
+
}, () => [
|
|
221
|
+
r.icon ? (b(), u(t, {
|
|
222
|
+
key: 0,
|
|
223
|
+
icon: r.icon
|
|
224
|
+
}, null, 8, ["icon"])) : L.value ? (b(), f("span", {
|
|
225
|
+
key: 1,
|
|
226
|
+
"aria-hidden": "true",
|
|
227
|
+
class: y(H("linkInitial"))
|
|
228
|
+
}, T(q(r)), 3)) : d("", !0),
|
|
229
|
+
p("span", { class: y(H("linkLabel")) }, T(r.label), 3),
|
|
230
|
+
r.badge === void 0 ? d("", !0) : (b(), f("span", {
|
|
231
|
+
key: 2,
|
|
232
|
+
class: y(H("linkBadge"))
|
|
233
|
+
}, T(r.badge), 3))
|
|
234
|
+
])]),
|
|
235
|
+
_: 2
|
|
236
|
+
}, 1032, [
|
|
237
|
+
"href",
|
|
238
|
+
"type",
|
|
239
|
+
"aria-label",
|
|
240
|
+
"aria-current",
|
|
241
|
+
"aria-disabled",
|
|
242
|
+
"data-active",
|
|
243
|
+
"data-disabled",
|
|
244
|
+
"class",
|
|
245
|
+
"onClick"
|
|
246
|
+
]))]),
|
|
162
247
|
_: 2
|
|
163
248
|
}, 1032, [
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"aria-disabled",
|
|
169
|
-
"data-active",
|
|
170
|
-
"data-disabled",
|
|
171
|
-
"class",
|
|
172
|
-
"onClick"
|
|
249
|
+
"text",
|
|
250
|
+
"side",
|
|
251
|
+
"disabled",
|
|
252
|
+
"unstyled"
|
|
173
253
|
]))], 64))), 128))], 2))), 128))])], 2),
|
|
174
|
-
e.$slots.footer ? (
|
|
254
|
+
e.$slots.footer ? (b(), f("div", {
|
|
175
255
|
key: 1,
|
|
176
|
-
class:
|
|
177
|
-
}, [
|
|
256
|
+
class: y(H("footer"))
|
|
257
|
+
}, [C(e.$slots, "footer", { collapsed: L.value })], 2)) : d("", !0)
|
|
178
258
|
]),
|
|
179
259
|
_: 3
|
|
180
260
|
}, 8, [
|
|
@@ -185,4 +265,4 @@ var O = /*@__PURE__*/ f({
|
|
|
185
265
|
}
|
|
186
266
|
});
|
|
187
267
|
//#endregion
|
|
188
|
-
export {
|
|
268
|
+
export { F as default };
|
|
@@ -6,6 +6,8 @@ export interface DropdownMenuItemOption {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
/** Style the item as destructive. */
|
|
8
8
|
danger?: boolean;
|
|
9
|
+
/** Renders the item as a link. */
|
|
10
|
+
href?: string;
|
|
9
11
|
/** Run when the item is chosen. Omit on an entry that opens a submenu. */
|
|
10
12
|
onSelect?: () => void;
|
|
11
13
|
/** Nested entries. Turns this item into a submenu trigger. */
|
|
@@ -15,7 +17,7 @@ export interface DropdownMenuItemOption {
|
|
|
15
17
|
* One row of a menu.
|
|
16
18
|
*
|
|
17
19
|
* `'-'` renders a separator. An option with `items` opens a submenu, and one
|
|
18
|
-
* with
|
|
20
|
+
* with none of `items`, `href` or `onSelect` is a non-interactive group label.
|
|
19
21
|
*/
|
|
20
22
|
export type DropdownMenuEntry = DropdownMenuItemOption | '-';
|
|
21
23
|
export declare function isSeparator(entry: DropdownMenuEntry): entry is '-';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
1
2
|
import type { IconLike } from './icon';
|
|
2
3
|
export interface SidebarLink {
|
|
3
4
|
label: string;
|
|
@@ -29,6 +30,8 @@ export interface SidebarSection {
|
|
|
29
30
|
items: SidebarLink[];
|
|
30
31
|
}
|
|
31
32
|
export type SidebarItems = (SidebarLink | SidebarSection)[];
|
|
33
|
+
/** Provided by `IAppShell` around each copy of its sidebar slot. */
|
|
34
|
+
export declare const sidebarPlacementKey: InjectionKey<'column' | 'drawer'>;
|
|
32
35
|
export declare function isSidebarSection(item: SidebarLink | SidebarSection): item is SidebarSection;
|
|
33
36
|
/** Normalise to sections, so the template has a single path to render. */
|
|
34
37
|
export declare function toSidebarSections(items: SidebarItems | undefined): SidebarSection[];
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
//#region src/composables/sidebar.ts
|
|
2
|
-
|
|
2
|
+
var e = Symbol.for("iryx-ui:sidebar-placement");
|
|
3
|
+
function t(e) {
|
|
3
4
|
return typeof e.section == "string";
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
+
function n(e) {
|
|
6
7
|
let n = [], r;
|
|
7
|
-
for (let i of
|
|
8
|
-
if (
|
|
8
|
+
for (let i of e ?? []) {
|
|
9
|
+
if (t(i)) {
|
|
9
10
|
n.push(i), r = void 0;
|
|
10
11
|
continue;
|
|
11
12
|
}
|
|
@@ -16,8 +17,8 @@ function t(t) {
|
|
|
16
17
|
}
|
|
17
18
|
return n;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function r(e) {
|
|
20
21
|
return Array.isArray(e.items) && e.items.length > 0;
|
|
21
22
|
}
|
|
22
23
|
//#endregion
|
|
23
|
-
export {
|
|
24
|
+
export { r as isSidebarGroup, t as isSidebarSection, e as sidebarPlacementKey, n as toSidebarSections };
|