iryx-ui 0.4.0 → 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/README.md +293 -10
- package/dist/component-names.d.ts +1 -1
- package/dist/components/Alert.vue.d.ts +19 -4
- package/dist/components/App.vue.d.ts +1 -1
- package/dist/components/Badge.vue.d.ts +4 -3
- package/dist/components/Banner.vue.d.ts +81 -0
- package/dist/components/Combobox.vue.d.ts +112 -0
- package/dist/components/Pagination.vue.d.ts +2 -0
- package/dist/components/Select.vue.d.ts +15 -4
- package/dist/components/Table.vue.d.ts +131 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/composables/data-table.d.ts +93 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +65 -58
- package/dist/node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js +15 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/packages/iryx-ui/src/component-names.js +1 -1
- package/dist/packages/iryx-ui/src/components/Alert.vue_vue_type_script_setup_true_lang.js +51 -35
- package/dist/packages/iryx-ui/src/components/Badge.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/packages/iryx-ui/src/components/Banner.js +5 -0
- package/dist/packages/iryx-ui/src/components/Banner.vue_vue_type_script_setup_true_lang.js +93 -0
- package/dist/packages/iryx-ui/src/components/Combobox.js +5 -0
- package/dist/packages/iryx-ui/src/components/Combobox.vue_vue_type_script_setup_true_lang.js +284 -0
- package/dist/packages/iryx-ui/src/components/Pagination.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/packages/iryx-ui/src/components/Select.vue_vue_type_script_setup_true_lang.js +72 -27
- package/dist/packages/iryx-ui/src/components/Table.js +5 -0
- package/dist/packages/iryx-ui/src/components/Table.vue_vue_type_script_setup_true_lang.js +217 -0
- package/dist/packages/iryx-ui/src/components/index.js +62 -56
- package/dist/packages/iryx-ui/src/composables/data-table.js +106 -0
- package/dist/packages/iryx-ui/src/theme/alert.js +10 -21
- package/dist/packages/iryx-ui/src/theme/badge.js +37 -37
- package/dist/packages/iryx-ui/src/theme/banner.js +62 -0
- package/dist/packages/iryx-ui/src/theme/button.js +2 -2
- package/dist/packages/iryx-ui/src/theme/card.js +1 -1
- package/dist/packages/iryx-ui/src/theme/checkbox.js +1 -1
- package/dist/packages/iryx-ui/src/theme/combobox.js +29 -0
- package/dist/packages/iryx-ui/src/theme/dialog.js +2 -2
- package/dist/packages/iryx-ui/src/theme/dropdown-menu.js +4 -4
- package/dist/packages/iryx-ui/src/theme/input.js +1 -1
- package/dist/packages/iryx-ui/src/theme/number-input.js +1 -1
- package/dist/packages/iryx-ui/src/theme/pagination.js +24 -14
- package/dist/packages/iryx-ui/src/theme/presets.js +0 -42
- package/dist/packages/iryx-ui/src/theme/radio-group.js +1 -1
- package/dist/packages/iryx-ui/src/theme/select.js +5 -3
- package/dist/packages/iryx-ui/src/theme/skeleton.js +1 -1
- package/dist/packages/iryx-ui/src/theme/stat.js +4 -4
- package/dist/packages/iryx-ui/src/theme/stepper.js +1 -1
- package/dist/packages/iryx-ui/src/theme/switch.js +1 -1
- package/dist/packages/iryx-ui/src/theme/table.js +62 -0
- package/dist/packages/iryx-ui/src/theme/tabs.js +3 -3
- package/dist/packages/iryx-ui/src/theme/toast.js +11 -26
- package/dist/packages/iryx-ui/src/theme/tooltip.js +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/theme/alert.d.ts +6 -12
- package/dist/theme/badge.d.ts +15 -12
- package/dist/theme/banner.d.ts +185 -0
- package/dist/theme/button.d.ts +2 -2
- package/dist/theme/combobox.d.ts +101 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/input.d.ts +5 -5
- package/dist/theme/pagination.d.ts +33 -0
- package/dist/theme/presets.d.ts +0 -42
- package/dist/theme/select.d.ts +6 -0
- package/dist/theme/stat.d.ts +0 -3
- package/dist/theme/table.d.ts +230 -0
- package/dist/theme/toast.d.ts +0 -15
- package/package.json +1 -1
- package/theme.css +24 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { ArrowDown01Icon as e, ArrowRight01Icon as t, ArrowUp01Icon as n, UnfoldMoreIcon as r } from "../../../../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
|
+
import { useIryxUiConfig as i } from "../config.js";
|
|
3
|
+
import a from "./Icon.js";
|
|
4
|
+
import o from "./Checkbox.js";
|
|
5
|
+
import s from "./Skeleton.js";
|
|
6
|
+
import { useDataTable as c } from "../composables/data-table.js";
|
|
7
|
+
import { tableTheme as l } from "../theme/table.js";
|
|
8
|
+
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, mergeModels as y, normalizeClass as b, normalizeStyle as x, openBlock as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, useModel as D, withModifiers as O } from "vue";
|
|
9
|
+
//#region src/components/Table.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
+
var k = ["aria-label", "aria-busy"], A = ["aria-sort"], j = ["onClick"], M = { key: 1 }, N = ["colspan"], ee = ["data-selected", "onClick"], P = ["aria-expanded", "onClick"], F = ["colspan"], I = /*@__PURE__*/ v({
|
|
11
|
+
__name: "Table",
|
|
12
|
+
props: /*@__PURE__*/ y({
|
|
13
|
+
rows: { default: () => [] },
|
|
14
|
+
columns: { default: () => [] },
|
|
15
|
+
total: { default: void 0 },
|
|
16
|
+
rowKey: { default: "id" },
|
|
17
|
+
loading: { type: Boolean },
|
|
18
|
+
loadingRows: { default: 5 },
|
|
19
|
+
selectable: { type: Boolean },
|
|
20
|
+
isRowSelectable: {},
|
|
21
|
+
expandable: { type: Boolean },
|
|
22
|
+
canExpandRow: {},
|
|
23
|
+
clickableRows: { type: Boolean },
|
|
24
|
+
striped: { type: Boolean },
|
|
25
|
+
hoverable: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: void 0
|
|
28
|
+
},
|
|
29
|
+
stickyHeader: { type: Boolean },
|
|
30
|
+
size: {},
|
|
31
|
+
emptyText: { default: "No results." },
|
|
32
|
+
label: {},
|
|
33
|
+
caption: {},
|
|
34
|
+
unstyled: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
38
|
+
class: {},
|
|
39
|
+
ui: {}
|
|
40
|
+
}, {
|
|
41
|
+
sort: { default: null },
|
|
42
|
+
sortModifiers: {},
|
|
43
|
+
page: { default: 1 },
|
|
44
|
+
pageModifiers: {},
|
|
45
|
+
perPage: { default: 10 },
|
|
46
|
+
perPageModifiers: {},
|
|
47
|
+
selection: { default: () => [] },
|
|
48
|
+
selectionModifiers: {},
|
|
49
|
+
expanded: { default: () => [] },
|
|
50
|
+
expandedModifiers: {}
|
|
51
|
+
}),
|
|
52
|
+
emits: /*@__PURE__*/ y(["rowClick"], [
|
|
53
|
+
"update:sort",
|
|
54
|
+
"update:page",
|
|
55
|
+
"update:perPage",
|
|
56
|
+
"update:selection",
|
|
57
|
+
"update:expanded"
|
|
58
|
+
]),
|
|
59
|
+
setup(v, { expose: y, emit: I }) {
|
|
60
|
+
let L = v, R = I, z = D(v, "sort"), B = D(v, "page"), V = D(v, "perPage"), H = D(v, "selection"), U = D(v, "expanded"), W = c({
|
|
61
|
+
rows: () => L.rows,
|
|
62
|
+
columns: () => L.columns,
|
|
63
|
+
total: () => L.total,
|
|
64
|
+
rowKey: () => L.rowKey,
|
|
65
|
+
isRowSelectable: L.isRowSelectable,
|
|
66
|
+
sort: z,
|
|
67
|
+
page: B,
|
|
68
|
+
perPage: V,
|
|
69
|
+
selection: H,
|
|
70
|
+
expanded: U
|
|
71
|
+
}), G = i(), K = d(() => L.unstyled ?? G.unstyled), q = d(() => l({
|
|
72
|
+
size: L.size,
|
|
73
|
+
striped: L.striped,
|
|
74
|
+
hoverable: L.hoverable ?? !0,
|
|
75
|
+
stickyHeader: L.stickyHeader,
|
|
76
|
+
clickable: L.clickableRows
|
|
77
|
+
}));
|
|
78
|
+
function J(e, t) {
|
|
79
|
+
let n = L.ui?.[e];
|
|
80
|
+
return K.value ? [n, t] : q.value[e]({ class: [n, t] });
|
|
81
|
+
}
|
|
82
|
+
function Y(e) {
|
|
83
|
+
return K.value ? void 0 : q.value[e]();
|
|
84
|
+
}
|
|
85
|
+
let X = d(() => K.value ? [L.ui?.root, L.class] : q.value.root({ class: [L.ui?.root, L.class] }));
|
|
86
|
+
function Z(e) {
|
|
87
|
+
if (K.value) return;
|
|
88
|
+
let t = e.align ?? (e.numeric ? "end" : "start");
|
|
89
|
+
if (t !== "start") return t === "end" ? "text-end" : "text-center";
|
|
90
|
+
}
|
|
91
|
+
function Q(e) {
|
|
92
|
+
return !K.value && e.numeric ? "tabular-nums" : void 0;
|
|
93
|
+
}
|
|
94
|
+
function te(e, t) {
|
|
95
|
+
return typeof t.class == "function" ? t.class(e) : t.class;
|
|
96
|
+
}
|
|
97
|
+
function ne(e, t) {
|
|
98
|
+
return typeof t.hidden == "function" ? t.hidden(e) : !1;
|
|
99
|
+
}
|
|
100
|
+
let $ = d(() => W.visibleColumns.value.length + +!!L.selectable + +!!L.expandable), re = d(() => L.loading && W.pageRows.value.length === 0), ie = d(() => !L.loading && W.pageRows.value.length === 0);
|
|
101
|
+
function ae(e) {
|
|
102
|
+
if (!e.sortable) return;
|
|
103
|
+
let t = W.sortOrderFor(e);
|
|
104
|
+
return t === "asc" ? "ascending" : t === "desc" ? "descending" : "none";
|
|
105
|
+
}
|
|
106
|
+
function oe(e) {
|
|
107
|
+
L.clickableRows && R("rowClick", e);
|
|
108
|
+
}
|
|
109
|
+
return y({ table: W }), (i, c) => (S(), m("div", { class: b(X.value) }, [h("table", {
|
|
110
|
+
class: b(J("table")),
|
|
111
|
+
"aria-label": L.label,
|
|
112
|
+
"aria-busy": L.loading || void 0
|
|
113
|
+
}, [
|
|
114
|
+
L.caption || i.$slots.caption ? (S(), m("caption", {
|
|
115
|
+
key: 0,
|
|
116
|
+
class: b(J("caption"))
|
|
117
|
+
}, [w(i.$slots, "caption", {}, () => [g(T(L.caption), 1)])], 2)) : p("", !0),
|
|
118
|
+
h("thead", { class: b(J("thead")) }, [h("tr", null, [
|
|
119
|
+
L.expandable ? (S(), m("th", {
|
|
120
|
+
key: 0,
|
|
121
|
+
class: b(Y("headGutter"))
|
|
122
|
+
}, null, 2)) : p("", !0),
|
|
123
|
+
L.selectable ? (S(), m("th", {
|
|
124
|
+
key: 1,
|
|
125
|
+
class: b(Y("headGutter"))
|
|
126
|
+
}, [_(o, {
|
|
127
|
+
"model-value": E(W).headerSelection.value,
|
|
128
|
+
"aria-label": "Select all rows on this page",
|
|
129
|
+
"onUpdate:modelValue": E(W).toggleAll
|
|
130
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])], 2)) : p("", !0),
|
|
131
|
+
(S(!0), m(u, null, C(E(W).visibleColumns.value, (t) => (S(), m("th", {
|
|
132
|
+
key: t.key,
|
|
133
|
+
class: b(J("th", Z(t))),
|
|
134
|
+
style: x(t.width ? { width: t.width } : void 0),
|
|
135
|
+
"aria-sort": ae(t),
|
|
136
|
+
scope: "col"
|
|
137
|
+
}, [w(i.$slots, `header-${t.key}`, { column: t }, () => [t.sortable ? (S(), m("button", {
|
|
138
|
+
key: 0,
|
|
139
|
+
type: "button",
|
|
140
|
+
class: b(Y("sortButton")),
|
|
141
|
+
onClick: (e) => E(W).toggleSort(t)
|
|
142
|
+
}, [g(T(t.label ?? t.key) + " ", 1), _(a, {
|
|
143
|
+
icon: E(W).sortOrderFor(t) === "asc" ? E(n) : E(W).sortOrderFor(t) === "desc" ? E(e) : E(r),
|
|
144
|
+
class: b(Y("sortIcon"))
|
|
145
|
+
}, null, 8, ["icon", "class"])], 10, j)) : (S(), m(u, { key: 1 }, [g(T(t.label ?? t.key), 1)], 64))])], 14, A))), 128))
|
|
146
|
+
])], 2),
|
|
147
|
+
h("tbody", { class: b(J("tbody")) }, [re.value ? (S(!0), m(u, { key: 0 }, C(L.loadingRows, (e) => (S(), m("tr", {
|
|
148
|
+
key: `skeleton-${e}`,
|
|
149
|
+
class: b(J("tr"))
|
|
150
|
+
}, [
|
|
151
|
+
L.expandable ? (S(), m("td", {
|
|
152
|
+
key: 0,
|
|
153
|
+
class: b(Y("gutter"))
|
|
154
|
+
}, [_(s, { class: "size-4" })], 2)) : p("", !0),
|
|
155
|
+
L.selectable ? (S(), m("td", {
|
|
156
|
+
key: 1,
|
|
157
|
+
class: b(Y("gutter"))
|
|
158
|
+
}, [_(s, { class: "size-4" })], 2)) : p("", !0),
|
|
159
|
+
(S(!0), m(u, null, C(E(W).visibleColumns.value, (e) => (S(), m("td", {
|
|
160
|
+
key: e.key,
|
|
161
|
+
class: b(J("td"))
|
|
162
|
+
}, [_(s, { class: "h-4 w-24" })], 2))), 128))
|
|
163
|
+
], 2))), 128)) : ie.value ? (S(), m("tr", M, [h("td", {
|
|
164
|
+
colspan: $.value,
|
|
165
|
+
class: b(J("empty"))
|
|
166
|
+
}, [w(i.$slots, "empty", {}, () => [g(T(L.emptyText), 1)])], 10, N)])) : (S(!0), m(u, { key: 2 }, C(E(W).pageRows.value, (e) => (S(), m(u, { key: E(W).keyOf(e) }, [h("tr", {
|
|
167
|
+
class: b([J("tr"), !K.value && E(W).isSelected(e) ? "bg-primary/5" : void 0]),
|
|
168
|
+
"data-selected": E(W).isSelected(e) || void 0,
|
|
169
|
+
onClick: (t) => oe(e)
|
|
170
|
+
}, [
|
|
171
|
+
L.expandable ? (S(), m("td", {
|
|
172
|
+
key: 0,
|
|
173
|
+
class: b(Y("gutter")),
|
|
174
|
+
onClick: c[0] ||= O(() => {}, ["stop"])
|
|
175
|
+
}, [!L.canExpandRow || L.canExpandRow(e) ? (S(), m("button", {
|
|
176
|
+
key: 0,
|
|
177
|
+
type: "button",
|
|
178
|
+
class: b([Y("expandButton"), E(W).isExpanded(e) && !K.value ? "rotate-90" : void 0]),
|
|
179
|
+
"aria-expanded": E(W).isExpanded(e),
|
|
180
|
+
"aria-label": "Toggle row details",
|
|
181
|
+
onClick: (t) => E(W).toggleExpanded(e)
|
|
182
|
+
}, [_(a, { icon: E(t) }, null, 8, ["icon"])], 10, P)) : p("", !0)], 2)) : p("", !0),
|
|
183
|
+
L.selectable ? (S(), m("td", {
|
|
184
|
+
key: 1,
|
|
185
|
+
class: b(Y("gutter")),
|
|
186
|
+
onClick: c[1] ||= O(() => {}, ["stop"])
|
|
187
|
+
}, [!L.isRowSelectable || L.isRowSelectable(e) ? (S(), f(o, {
|
|
188
|
+
key: 0,
|
|
189
|
+
"model-value": E(W).isSelected(e),
|
|
190
|
+
"aria-label": "Select row",
|
|
191
|
+
"onUpdate:modelValue": (t) => E(W).toggleRow(e)
|
|
192
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])) : p("", !0)], 2)) : p("", !0),
|
|
193
|
+
(S(!0), m(u, null, C(E(W).visibleColumns.value, (t) => (S(), m("td", {
|
|
194
|
+
key: t.key,
|
|
195
|
+
class: b(J("td", [
|
|
196
|
+
Z(t),
|
|
197
|
+
Q(t),
|
|
198
|
+
te(e, t)
|
|
199
|
+
].filter(Boolean).join(" ") || void 0))
|
|
200
|
+
}, [ne(e, t) ? p("", !0) : w(i.$slots, `cell-${t.key}`, {
|
|
201
|
+
key: 0,
|
|
202
|
+
row: e,
|
|
203
|
+
column: t,
|
|
204
|
+
value: E(W).getRowValue(e, t.key)
|
|
205
|
+
}, () => [g(T(E(W).getRowValue(e, t.key)), 1)])], 2))), 128))
|
|
206
|
+
], 10, ee), L.expandable && E(W).isExpanded(e) ? (S(), m("tr", {
|
|
207
|
+
key: 0,
|
|
208
|
+
class: b([J("tr"), Y("expandedRow")])
|
|
209
|
+
}, [h("td", {
|
|
210
|
+
colspan: $.value,
|
|
211
|
+
class: b(Y("expandedCell"))
|
|
212
|
+
}, [w(i.$slots, "expanded", { row: e })], 10, F)], 2)) : p("", !0)], 64))), 128))], 2)
|
|
213
|
+
], 10, k)], 2));
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
//#endregion
|
|
217
|
+
export { I as default };
|
|
@@ -2,65 +2,71 @@ import { __exportAll as e } from "../../../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import t from "./Alert.js";
|
|
3
3
|
import n from "./App.js";
|
|
4
4
|
import r from "./Badge.js";
|
|
5
|
-
import i from "./
|
|
6
|
-
import a from "./
|
|
7
|
-
import o from "./
|
|
8
|
-
import s from "./
|
|
9
|
-
import c from "./
|
|
10
|
-
import l from "./
|
|
11
|
-
import u from "./
|
|
12
|
-
import d from "./
|
|
13
|
-
import f from "./
|
|
14
|
-
import p from "./
|
|
15
|
-
import m from "./
|
|
16
|
-
import h from "./
|
|
17
|
-
import g from "./
|
|
18
|
-
import _ from "./
|
|
19
|
-
import v from "./
|
|
20
|
-
import y from "./
|
|
21
|
-
import b from "./
|
|
22
|
-
import x from "./
|
|
23
|
-
import S from "./
|
|
24
|
-
import C from "./
|
|
25
|
-
import w from "./
|
|
26
|
-
import T from "./
|
|
27
|
-
import E from "./
|
|
28
|
-
import D from "./
|
|
29
|
-
import O from "./
|
|
30
|
-
import k from "./
|
|
31
|
-
import A from "./
|
|
5
|
+
import i from "./Banner.js";
|
|
6
|
+
import a from "./Breadcrumb.js";
|
|
7
|
+
import o from "./Button.js";
|
|
8
|
+
import s from "./ButtonGroup.js";
|
|
9
|
+
import c from "./Card.js";
|
|
10
|
+
import l from "./Checkbox.js";
|
|
11
|
+
import u from "./Combobox.js";
|
|
12
|
+
import d from "./Dialog.js";
|
|
13
|
+
import f from "./ConfirmDialog.js";
|
|
14
|
+
import p from "./DropdownMenu.js";
|
|
15
|
+
import m from "./EmptyState.js";
|
|
16
|
+
import h from "./Form.js";
|
|
17
|
+
import g from "./Label.js";
|
|
18
|
+
import _ from "./FormField.js";
|
|
19
|
+
import v from "./Input.js";
|
|
20
|
+
import y from "./NumberInput.js";
|
|
21
|
+
import b from "./Pagination.js";
|
|
22
|
+
import x from "./Progress.js";
|
|
23
|
+
import S from "./RadioGroup.js";
|
|
24
|
+
import C from "./Select.js";
|
|
25
|
+
import w from "./Separator.js";
|
|
26
|
+
import T from "./Skeleton.js";
|
|
27
|
+
import E from "./Stat.js";
|
|
28
|
+
import D from "./Stepper.js";
|
|
29
|
+
import O from "./Switch.js";
|
|
30
|
+
import k from "./Table.js";
|
|
31
|
+
import A from "./Tabs.js";
|
|
32
|
+
import j from "./Textarea.js";
|
|
33
|
+
import M from "./Toaster.js";
|
|
34
|
+
import N from "./Tooltip.js";
|
|
32
35
|
//#region src/components/index.ts
|
|
33
|
-
var
|
|
36
|
+
var P = /* @__PURE__ */ e({
|
|
34
37
|
Alert: () => t,
|
|
35
38
|
App: () => n,
|
|
36
39
|
Badge: () => r,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
40
|
+
Banner: () => i,
|
|
41
|
+
Breadcrumb: () => a,
|
|
42
|
+
Button: () => o,
|
|
43
|
+
ButtonGroup: () => s,
|
|
44
|
+
Card: () => c,
|
|
45
|
+
Checkbox: () => l,
|
|
46
|
+
Combobox: () => u,
|
|
47
|
+
ConfirmDialog: () => f,
|
|
48
|
+
Dialog: () => d,
|
|
49
|
+
DropdownMenu: () => p,
|
|
50
|
+
EmptyState: () => m,
|
|
51
|
+
Form: () => h,
|
|
52
|
+
FormField: () => _,
|
|
53
|
+
Input: () => v,
|
|
54
|
+
Label: () => g,
|
|
55
|
+
NumberInput: () => y,
|
|
56
|
+
Pagination: () => b,
|
|
57
|
+
Progress: () => x,
|
|
58
|
+
RadioGroup: () => S,
|
|
59
|
+
Select: () => C,
|
|
60
|
+
Separator: () => w,
|
|
61
|
+
Skeleton: () => T,
|
|
62
|
+
Stat: () => E,
|
|
63
|
+
Stepper: () => D,
|
|
64
|
+
Switch: () => O,
|
|
65
|
+
Table: () => k,
|
|
66
|
+
Tabs: () => A,
|
|
67
|
+
Textarea: () => j,
|
|
68
|
+
Toaster: () => M,
|
|
69
|
+
Tooltip: () => N
|
|
64
70
|
});
|
|
65
71
|
//#endregion
|
|
66
|
-
export {
|
|
72
|
+
export { P as components_exports };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { computed as e, ref as t } from "vue";
|
|
2
|
+
//#region src/composables/data-table.ts
|
|
3
|
+
function n(e, n) {
|
|
4
|
+
return e || t(n);
|
|
5
|
+
}
|
|
6
|
+
function r(e) {
|
|
7
|
+
return e == null || e === "";
|
|
8
|
+
}
|
|
9
|
+
function i(e, t) {
|
|
10
|
+
return t.split(".").reduce((e, t) => e?.[t], e);
|
|
11
|
+
}
|
|
12
|
+
function a(e, t) {
|
|
13
|
+
return typeof e == "number" && typeof t == "number" ? e - t : typeof e == "boolean" && typeof t == "boolean" ? Number(e) - Number(t) : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : String(e).localeCompare(String(t), void 0, {
|
|
14
|
+
numeric: !0,
|
|
15
|
+
sensitivity: "base"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function o(t) {
|
|
19
|
+
let o = n(t.sort, null), s = n(t.page, 1), c = n(t.perPage, 10), l = n(t.selection, []), u = n(t.expanded, []), d = e(() => t.total?.() !== void 0), f = e(() => t.rowKey?.() ?? "id"), p = e(() => t.columns().filter((e) => e.hidden !== !0)), m = e(() => {
|
|
20
|
+
let e = t.rows(), n = o.value;
|
|
21
|
+
if (d.value || !n) return e;
|
|
22
|
+
let s = t.columns().find((e) => (e.sortKey ?? e.key) === n.key)?.key ?? n.key, c = n.order === "asc" ? 1 : -1;
|
|
23
|
+
return [...e].sort((e, t) => {
|
|
24
|
+
let n = i(e, s), o = i(t, s);
|
|
25
|
+
return r(n) || r(o) ? r(n) && r(o) ? 0 : r(n) ? 1 : -1 : a(n, o) * c;
|
|
26
|
+
});
|
|
27
|
+
}), h = e(() => t.total?.() ?? m.value.length), g = e(() => Math.max(1, Math.ceil(h.value / Math.max(1, c.value)))), _ = e(() => {
|
|
28
|
+
if (d.value) return m.value;
|
|
29
|
+
let e = (s.value - 1) * c.value;
|
|
30
|
+
return m.value.slice(e, e + c.value);
|
|
31
|
+
});
|
|
32
|
+
function v(e) {
|
|
33
|
+
return i(e, f.value);
|
|
34
|
+
}
|
|
35
|
+
function y(e) {
|
|
36
|
+
if (!e.sortable) return;
|
|
37
|
+
let t = e.sortKey ?? e.key, n = o.value;
|
|
38
|
+
n?.key === t ? n.order === "asc" ? o.value = {
|
|
39
|
+
key: t,
|
|
40
|
+
order: "desc"
|
|
41
|
+
} : o.value = null : o.value = {
|
|
42
|
+
key: t,
|
|
43
|
+
order: "asc"
|
|
44
|
+
}, s.value = 1;
|
|
45
|
+
}
|
|
46
|
+
function b(e) {
|
|
47
|
+
let t = e.sortKey ?? e.key;
|
|
48
|
+
return o.value?.key === t ? o.value.order : null;
|
|
49
|
+
}
|
|
50
|
+
let x = e(() => _.value.filter((e) => !t.isRowSelectable || t.isRowSelectable(e)));
|
|
51
|
+
function S(e) {
|
|
52
|
+
return l.value.includes(v(e));
|
|
53
|
+
}
|
|
54
|
+
function C(e) {
|
|
55
|
+
if (t.isRowSelectable && !t.isRowSelectable(e)) return;
|
|
56
|
+
let n = v(e);
|
|
57
|
+
l.value = S(e) ? l.value.filter((e) => e !== n) : [...l.value, n];
|
|
58
|
+
}
|
|
59
|
+
let w = e(() => {
|
|
60
|
+
let e = x.value;
|
|
61
|
+
if (e.length === 0) return !1;
|
|
62
|
+
let t = e.filter(S).length;
|
|
63
|
+
return t === 0 ? !1 : t === e.length ? !0 : "indeterminate";
|
|
64
|
+
});
|
|
65
|
+
function T(e) {
|
|
66
|
+
let t = x.value.map(v);
|
|
67
|
+
if (e === !0) {
|
|
68
|
+
let e = new Set(l.value);
|
|
69
|
+
t.forEach((t) => e.add(t)), l.value = [...e];
|
|
70
|
+
} else {
|
|
71
|
+
let e = new Set(t);
|
|
72
|
+
l.value = l.value.filter((t) => !e.has(t));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function E(e) {
|
|
76
|
+
return u.value.includes(v(e));
|
|
77
|
+
}
|
|
78
|
+
function D(e) {
|
|
79
|
+
let t = v(e);
|
|
80
|
+
u.value = E(e) ? u.value.filter((e) => e !== t) : [...u.value, t];
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
sort: o,
|
|
84
|
+
page: s,
|
|
85
|
+
perPage: c,
|
|
86
|
+
selection: l,
|
|
87
|
+
expanded: u,
|
|
88
|
+
isServerMode: d,
|
|
89
|
+
visibleColumns: p,
|
|
90
|
+
pageRows: _,
|
|
91
|
+
total: h,
|
|
92
|
+
pageCount: g,
|
|
93
|
+
keyOf: v,
|
|
94
|
+
toggleSort: y,
|
|
95
|
+
sortOrderFor: b,
|
|
96
|
+
headerSelection: w,
|
|
97
|
+
isSelected: S,
|
|
98
|
+
toggleRow: C,
|
|
99
|
+
toggleAll: T,
|
|
100
|
+
isExpanded: E,
|
|
101
|
+
toggleExpanded: D,
|
|
102
|
+
getRowValue: i
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { i as getRowValue, o as useDataTable };
|
|
@@ -2,31 +2,20 @@ import { tv as e } from "tailwind-variants";
|
|
|
2
2
|
//#region src/theme/alert.ts
|
|
3
3
|
var t = e({
|
|
4
4
|
slots: {
|
|
5
|
-
root: "flex w-full gap-3 rounded-
|
|
6
|
-
icon: "mt-
|
|
5
|
+
root: "flex w-full gap-3 rounded-xl border border-border bg-background p-4 shadow-xs",
|
|
6
|
+
icon: "mt-px shrink-0 [&_svg]:size-4.5",
|
|
7
7
|
content: "min-w-0 flex-1",
|
|
8
|
-
title: "text-sm font-medium",
|
|
9
|
-
description: "text-sm
|
|
10
|
-
|
|
8
|
+
title: "text-sm font-medium text-foreground",
|
|
9
|
+
description: "text-sm text-muted-foreground",
|
|
10
|
+
actions: "mt-3 flex flex-wrap items-center gap-2",
|
|
11
|
+
close: "-m-1 shrink-0 self-start rounded-lg p-1 text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-primary/50 [&_svg]:size-4"
|
|
11
12
|
},
|
|
12
13
|
variants: {
|
|
13
14
|
variant: {
|
|
14
|
-
info: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
success: {
|
|
19
|
-
root: "border-success-border bg-success-muted text-success-muted-foreground",
|
|
20
|
-
icon: "text-success"
|
|
21
|
-
},
|
|
22
|
-
warning: {
|
|
23
|
-
root: "border-warning-border bg-warning-muted text-warning-muted-foreground",
|
|
24
|
-
icon: "text-warning"
|
|
25
|
-
},
|
|
26
|
-
danger: {
|
|
27
|
-
root: "border-danger-border bg-danger-muted text-danger-muted-foreground",
|
|
28
|
-
icon: "text-danger"
|
|
29
|
-
}
|
|
15
|
+
info: { icon: "text-info" },
|
|
16
|
+
success: { icon: "text-success" },
|
|
17
|
+
warning: { icon: "text-warning" },
|
|
18
|
+
danger: { icon: "text-danger" }
|
|
30
19
|
},
|
|
31
20
|
withTitle: { true: { description: "mt-1" } }
|
|
32
21
|
},
|
|
@@ -2,8 +2,8 @@ import { tv as e } from "tailwind-variants";
|
|
|
2
2
|
//#region src/theme/badge.ts
|
|
3
3
|
var t = e({
|
|
4
4
|
slots: {
|
|
5
|
-
root: "inline-flex shrink-0 items-center rounded-
|
|
6
|
-
dot: "rounded-full
|
|
5
|
+
root: "inline-flex shrink-0 items-center rounded-md border font-medium whitespace-nowrap [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
6
|
+
dot: "rounded-full"
|
|
7
7
|
},
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
@@ -13,21 +13,21 @@ var t = e({
|
|
|
13
13
|
danger: {},
|
|
14
14
|
info: {}
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
withDot: {
|
|
17
|
+
true: { root: "border-border bg-background text-foreground" },
|
|
18
|
+
false: {}
|
|
19
19
|
},
|
|
20
20
|
size: {
|
|
21
21
|
sm: {
|
|
22
|
-
root: "h-5 gap-1 px-
|
|
22
|
+
root: "h-5 gap-1 px-1.5 text-xs has-[[data-icon=inline-end]]:pr-1 has-[[data-icon=inline-start]]:pl-1 [&_svg]:size-3",
|
|
23
23
|
dot: "size-1.5"
|
|
24
24
|
},
|
|
25
25
|
md: {
|
|
26
|
-
root: "h-6 gap-1.5 px-2
|
|
26
|
+
root: "h-6 gap-1.5 px-2 text-xs has-[[data-icon=inline-end]]:pr-1.5 has-[[data-icon=inline-start]]:pl-1.5 [&_svg]:size-3.5",
|
|
27
27
|
dot: "size-2"
|
|
28
28
|
},
|
|
29
29
|
lg: {
|
|
30
|
-
root: "h-7 gap-1.5 px-
|
|
30
|
+
root: "h-7 gap-1.5 px-2.5 text-sm has-[[data-icon=inline-end]]:pr-2 has-[[data-icon=inline-start]]:pl-2 [&_svg]:size-4",
|
|
31
31
|
dot: "size-2"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -35,58 +35,58 @@ var t = e({
|
|
|
35
35
|
compoundVariants: [
|
|
36
36
|
{
|
|
37
37
|
variant: "neutral",
|
|
38
|
-
|
|
39
|
-
class: { root: "bg-muted text-muted-foreground" }
|
|
38
|
+
withDot: !1,
|
|
39
|
+
class: { root: "border-border bg-muted text-muted-foreground" }
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
variant: "
|
|
43
|
-
|
|
44
|
-
class: { root: "bg-
|
|
42
|
+
variant: "success",
|
|
43
|
+
withDot: !1,
|
|
44
|
+
class: { root: "border-success-border bg-success-muted text-success-muted-foreground" }
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
variant: "
|
|
48
|
-
|
|
49
|
-
class: { root: "bg-
|
|
47
|
+
variant: "warning",
|
|
48
|
+
withDot: !1,
|
|
49
|
+
class: { root: "border-warning-border bg-warning-muted text-warning-muted-foreground" }
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
variant: "
|
|
53
|
-
|
|
54
|
-
class: { root: "bg-
|
|
52
|
+
variant: "danger",
|
|
53
|
+
withDot: !1,
|
|
54
|
+
class: { root: "border-danger-border bg-danger-muted text-danger-muted-foreground" }
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
variant: "
|
|
58
|
-
|
|
59
|
-
class: { root: "bg-
|
|
57
|
+
variant: "info",
|
|
58
|
+
withDot: !1,
|
|
59
|
+
class: { root: "border-info-border bg-info-muted text-info-muted-foreground" }
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
|
-
variant: "
|
|
63
|
-
|
|
64
|
-
class: {
|
|
62
|
+
variant: "neutral",
|
|
63
|
+
withDot: !0,
|
|
64
|
+
class: { dot: "bg-muted-foreground" }
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
|
-
variant: "
|
|
68
|
-
|
|
69
|
-
class: {
|
|
67
|
+
variant: "success",
|
|
68
|
+
withDot: !0,
|
|
69
|
+
class: { dot: "bg-success" }
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
variant: "
|
|
73
|
-
|
|
74
|
-
class: {
|
|
72
|
+
variant: "warning",
|
|
73
|
+
withDot: !0,
|
|
74
|
+
class: { dot: "bg-warning" }
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
|
-
variant: "
|
|
78
|
-
|
|
79
|
-
class: {
|
|
77
|
+
variant: "danger",
|
|
78
|
+
withDot: !0,
|
|
79
|
+
class: { dot: "bg-danger" }
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
variant: "info",
|
|
83
|
-
|
|
84
|
-
class: {
|
|
83
|
+
withDot: !0,
|
|
84
|
+
class: { dot: "bg-info" }
|
|
85
85
|
}
|
|
86
86
|
],
|
|
87
87
|
defaultVariants: {
|
|
88
88
|
variant: "neutral",
|
|
89
|
-
|
|
89
|
+
withDot: !1,
|
|
90
90
|
size: "md"
|
|
91
91
|
}
|
|
92
92
|
});
|