@indielayer/ui 1.13.1 → 1.14.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/docs/pages/component/accordion/index.vue +1 -1
- package/docs/pages/component/button/index.vue +1 -1
- package/docs/pages/component/checkbox/index.vue +1 -1
- package/docs/pages/component/container/index.vue +1 -1
- package/docs/pages/component/drawer/index.vue +1 -1
- package/docs/pages/component/form/index.vue +1 -1
- package/docs/pages/component/formGroup/index.vue +1 -1
- package/docs/pages/component/icon/index.vue +1 -1
- package/docs/pages/component/notifications/index.vue +1 -1
- package/docs/pages/component/pagination/index.vue +1 -1
- package/docs/pages/component/popover/index.vue +1 -1
- package/docs/pages/component/progress/index.vue +1 -1
- package/docs/pages/component/scroll/index.vue +1 -1
- package/docs/pages/component/skeleton/index.vue +1 -1
- package/docs/pages/component/slider/index.vue +1 -1
- package/docs/pages/component/spacer/index.vue +1 -1
- package/docs/pages/component/spinner/index.vue +1 -1
- package/docs/pages/component/table/index.vue +7 -0
- package/docs/pages/component/table/selectable.vue +67 -0
- package/docs/pages/component/table/usage.vue +2 -5
- package/docs/pages/component/table/virtual.vue +3 -0
- package/docs/pages/component/tag/index.vue +1 -1
- package/docs/pages/component/textarea/index.vue +1 -1
- package/docs/pages/component/toggle/index.vue +1 -1
- package/docs/pages/component/upload/index.vue +1 -1
- package/docs/search/components.json +1 -1
- package/lib/components/button/theme/Button.base.theme.js +21 -21
- package/lib/components/radio/theme/Radio.base.theme.js +24 -24
- package/lib/components/select/Select.vue.js +121 -112
- package/lib/components/table/Table.vue.d.ts +62 -8
- package/lib/components/table/Table.vue.js +273 -219
- package/lib/components/table/TableHeader.vue.d.ts +1 -1
- package/lib/components/table/TableHeader.vue.js +34 -32
- package/lib/components/table/TableRow.vue.d.ts +4 -0
- package/lib/components/table/TableRow.vue.js +3 -2
- package/lib/components/table/theme/TableHeader.base.theme.js +5 -1
- package/lib/components/table/theme/TableRow.base.theme.js +3 -3
- package/lib/composables/useFocusTrap.d.ts +9 -4
- package/lib/composables/useFocusTrap.js +42 -27
- package/lib/index.umd.js +4 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/components/button/theme/Button.base.theme.ts +1 -1
- package/src/components/radio/theme/Radio.base.theme.ts +1 -1
- package/src/components/select/Select.vue +20 -5
- package/src/components/table/Table.vue +112 -15
- package/src/components/table/TableHeader.vue +3 -3
- package/src/components/table/TableRow.vue +1 -0
- package/src/components/table/theme/TableHeader.base.theme.ts +10 -4
- package/src/components/table/theme/TableRow.base.theme.ts +2 -2
- package/src/composables/useFocusTrap.ts +73 -42
- package/src/version.ts +1 -1
|
@@ -4,6 +4,7 @@ declare const tableRowProps: {
|
|
|
4
4
|
pointer: BooleanConstructor;
|
|
5
5
|
striped: BooleanConstructor;
|
|
6
6
|
selected: BooleanConstructor;
|
|
7
|
+
singleSelect: BooleanConstructor;
|
|
7
8
|
verticalAlign: {
|
|
8
9
|
type: PropType<"top" | "bottom" | "baseline" | "middle" | "text-bottom" | "text-top">;
|
|
9
10
|
default: string;
|
|
@@ -18,6 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
18
19
|
pointer: BooleanConstructor;
|
|
19
20
|
striped: BooleanConstructor;
|
|
20
21
|
selected: BooleanConstructor;
|
|
22
|
+
singleSelect: BooleanConstructor;
|
|
21
23
|
verticalAlign: {
|
|
22
24
|
type: PropType<"top" | "bottom" | "baseline" | "middle" | "text-bottom" | "text-top">;
|
|
23
25
|
default: string;
|
|
@@ -27,6 +29,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
27
29
|
pointer: BooleanConstructor;
|
|
28
30
|
striped: BooleanConstructor;
|
|
29
31
|
selected: BooleanConstructor;
|
|
32
|
+
singleSelect: BooleanConstructor;
|
|
30
33
|
verticalAlign: {
|
|
31
34
|
type: PropType<"top" | "bottom" | "baseline" | "middle" | "text-bottom" | "text-top">;
|
|
32
35
|
default: string;
|
|
@@ -36,6 +39,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
36
39
|
selected: boolean;
|
|
37
40
|
striped: boolean;
|
|
38
41
|
pointer: boolean;
|
|
42
|
+
singleSelect: boolean;
|
|
39
43
|
verticalAlign: "top" | "bottom" | "baseline" | "middle" | "text-bottom" | "text-top";
|
|
40
44
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
41
45
|
default?(_: {}): any;
|
|
@@ -6,6 +6,7 @@ const o = {
|
|
|
6
6
|
pointer: Boolean,
|
|
7
7
|
striped: Boolean,
|
|
8
8
|
selected: Boolean,
|
|
9
|
+
singleSelect: Boolean,
|
|
9
10
|
verticalAlign: {
|
|
10
11
|
type: String,
|
|
11
12
|
default: "top",
|
|
@@ -15,10 +16,10 @@ const o = {
|
|
|
15
16
|
...A,
|
|
16
17
|
props: v,
|
|
17
18
|
setup(t) {
|
|
18
|
-
const e = t, n = m(() => e.verticalAlign === "baseline" ? "align-baseline" : e.verticalAlign === "bottom" ? "align-bottom" : e.verticalAlign === "middle" ? "align-middle" : e.verticalAlign === "text-bottom" ? "align-text-bottom" : e.verticalAlign === "text-top" ? "align-text-top" : e.verticalAlign === "top" ? "align-top" : ""), { styles: i, classes:
|
|
19
|
+
const e = t, n = m(() => e.verticalAlign === "baseline" ? "align-baseline" : e.verticalAlign === "bottom" ? "align-bottom" : e.verticalAlign === "middle" ? "align-middle" : e.verticalAlign === "text-bottom" ? "align-text-bottom" : e.verticalAlign === "text-top" ? "align-text-top" : e.verticalAlign === "top" ? "align-top" : ""), { styles: i, classes: a, className: r } = b("TableRow", {}, e);
|
|
19
20
|
return (s, x) => (p(), u("tr", {
|
|
20
21
|
style: d(l(i)),
|
|
21
|
-
class: g([l(
|
|
22
|
+
class: g([l(r), l(a).row, n.value])
|
|
22
23
|
}, [
|
|
23
24
|
f(s.$slots, "default")
|
|
24
25
|
], 6));
|
|
@@ -2,7 +2,11 @@ const s = {
|
|
|
2
2
|
classes: {
|
|
3
3
|
th: ({ props: e }) => {
|
|
4
4
|
const t = ["relative p-2.5 font-medium"];
|
|
5
|
-
return e.sortable && t.push("cursor-pointer hover:text-secondary-800 dark:hover:text-secondary-300 transition-colors duration-150 ease-in-out"),
|
|
5
|
+
return e.sortable && t.push("cursor-pointer hover:text-secondary-800 dark:hover:text-secondary-300 transition-colors duration-150 ease-in-out"), t;
|
|
6
|
+
},
|
|
7
|
+
header: ({ props: e }) => {
|
|
8
|
+
const t = ["flex items-center gap-1 select-none"];
|
|
9
|
+
return e.textAlign === "left" && t.push("justify-start"), e.textAlign === "right" && t.push("justify-end"), e.textAlign === "center" && t.push("justify-center"), e.textAlign === "justify" && t.push("justify-center"), t;
|
|
6
10
|
},
|
|
7
11
|
sortIcon: ({ props: e }) => ["stroke-2 w-3 h-3"]
|
|
8
12
|
}
|
|
@@ -2,10 +2,10 @@ const s = {
|
|
|
2
2
|
classes: {
|
|
3
3
|
row: ({ props: r }) => {
|
|
4
4
|
const e = [];
|
|
5
|
-
return r.selected && e.push("shadow-[inset_2px_0] shadow-primary-500"), r.striped ? e.push("even:bg-secondary-50 dark:even:bg-secondary-700") : e.push("border-b border-secondary-200 dark:border-secondary-700"), r.pointer && e.push("hover:bg-secondary-50 dark:hover:bg-secondary-700 cursor-pointer"), e;
|
|
5
|
+
return r.selected && r.singleSelect && e.push("shadow-[inset_2px_0] shadow-primary-500 !bg-secondary-50 dark:!bg-secondary-600"), r.striped ? e.push("even:bg-secondary-50 dark:even:bg-secondary-700") : e.push("border-b border-secondary-200 dark:border-secondary-700"), r.pointer && e.push("hover:bg-secondary-50 dark:hover:bg-secondary-700 cursor-pointer"), e;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, d = s;
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
d as default
|
|
11
11
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type MaybeRef } from 'vue';
|
|
1
|
+
import { type Ref, type ComponentPublicInstance } from 'vue';
|
|
3
2
|
export declare function useFocusTrap(): {
|
|
4
|
-
initFocusTrap: (targetRef:
|
|
5
|
-
|
|
3
|
+
initFocusTrap: (targetRef: Ref<HTMLElement | ComponentPublicInstance | null> | HTMLElement | ComponentPublicInstance | null, options?: {
|
|
4
|
+
initialFocusIndex?: number;
|
|
5
|
+
returnFocusOnClear?: boolean;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
clearFocusTrap: (options?: {
|
|
8
|
+
returnFocus?: boolean;
|
|
9
|
+
}) => void;
|
|
10
|
+
focusable: Ref<HTMLElement[], HTMLElement[]>;
|
|
6
11
|
};
|
|
@@ -1,37 +1,52 @@
|
|
|
1
|
-
import { onUnmounted as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ref as F, onUnmounted as h, unref as w, nextTick as x, watch as E } from "vue";
|
|
2
|
+
const T = 'button:not([tabindex="-1"]), [href], input, select, textarea, li, a, [tabindex]:not([tabindex="-1"])';
|
|
3
|
+
function p() {
|
|
4
|
+
const l = F([]);
|
|
5
|
+
let r = null, a = null, f = null, s = null, o = null;
|
|
6
|
+
function d(e) {
|
|
7
|
+
return e ? e.$el ? e.$el : e : null;
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
9
|
+
function m(e) {
|
|
10
|
+
const n = d(e);
|
|
11
|
+
if (!n)
|
|
10
12
|
return;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const t = n.querySelectorAll(T);
|
|
14
|
+
l.value = Array.from(t), a = l.value[0] || null, f = l.value[l.value.length - 1] || null;
|
|
13
15
|
}
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
const o = n[0], s = n[n.length - 1];
|
|
23
|
-
!b && c === s ? (e.preventDefault(), o == null || o.focus()) : b && c === o && (e.preventDefault(), s == null || s.focus());
|
|
16
|
+
const v = (e) => {
|
|
17
|
+
if (e.key !== "Tab" || l.value.length === 0)
|
|
18
|
+
return;
|
|
19
|
+
const n = e.shiftKey, t = document.activeElement, u = a, c = f;
|
|
20
|
+
if (!t) {
|
|
21
|
+
e.preventDefault(), u == null || u.focus();
|
|
22
|
+
return;
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
document.removeEventListener("keydown", r), u == null || u.disconnect();
|
|
24
|
+
!n && t === c ? (e.preventDefault(), u == null || u.focus()) : n && t === u && (e.preventDefault(), c == null || c.focus());
|
|
27
25
|
};
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
async function b(e, n) {
|
|
27
|
+
var c;
|
|
28
|
+
if (typeof window > "u" || (i(), s = document.activeElement, o = w(e), !o))
|
|
29
|
+
return;
|
|
30
|
+
await x(), m(o);
|
|
31
|
+
const t = (n == null ? void 0 : n.initialFocusIndex) ?? 0;
|
|
32
|
+
(c = l.value[t]) == null || c.focus(), document.addEventListener("keydown", v), r = new MutationObserver(() => m(o));
|
|
33
|
+
const u = d(o);
|
|
34
|
+
u && r.observe(u, { childList: !0, subtree: !0 }), typeof e == "object" && e !== null && "value" in e && E(e, (y) => {
|
|
35
|
+
i(), y !== null && b(e, n);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function i(e) {
|
|
39
|
+
document.removeEventListener("keydown", v), r == null || r.disconnect(), r = null, e != null && e.returnFocus && s && s.focus(), o = null;
|
|
40
|
+
}
|
|
41
|
+
return h(() => {
|
|
42
|
+
i({ returnFocus: !0 });
|
|
30
43
|
}), {
|
|
31
|
-
initFocusTrap:
|
|
32
|
-
clearFocusTrap:
|
|
44
|
+
initFocusTrap: b,
|
|
45
|
+
clearFocusTrap: i,
|
|
46
|
+
focusable: l
|
|
47
|
+
// expose for advanced use
|
|
33
48
|
};
|
|
34
49
|
}
|
|
35
50
|
export {
|
|
36
|
-
|
|
51
|
+
p as useFocusTrap
|
|
37
52
|
};
|