@geckou/ui-vue 0.13.0 → 0.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/README.md
CHANGED
|
@@ -301,6 +301,16 @@ const articles = ref<any[]>([])
|
|
|
301
301
|
|
|
302
302
|
定義例はデモの `demo/styles/base.scss` を参照。
|
|
303
303
|
|
|
304
|
+
## 0.14.0 の変更
|
|
305
|
+
|
|
306
|
+
- `DropdownUi` が Escape で閉じ、トリガーへフォーカスを戻す。処理したときは
|
|
307
|
+
`preventDefault()` するので、`ModalBox` の中に置いてもダイアログまで閉じない
|
|
308
|
+
- `DropdownUi` / `SlideDownUi` のトリガーに `aria-controls` が付き、
|
|
309
|
+
`DropdownUi` には `aria-haspopup="true"` も付く
|
|
310
|
+
- `DropdownUi` / `SlideDownUi` の中身の高さを `ResizeObserver` で測るようにした。
|
|
311
|
+
`onUpdated` だけでは、スロットの中の子コンポーネントが自前の状態で伸縮したときに
|
|
312
|
+
高さがずれていた
|
|
313
|
+
|
|
304
314
|
## 0.13.0 の変更
|
|
305
315
|
|
|
306
316
|
- `BasicButton` はローディング中に `disabled` にしない(押した瞬間にフォーカスが
|
|
@@ -12,6 +12,7 @@ declare function __VLS_template(): {
|
|
|
12
12
|
};
|
|
13
13
|
refs: {
|
|
14
14
|
root: HTMLDivElement;
|
|
15
|
+
trigger: HTMLButtonElement;
|
|
15
16
|
contents: HTMLDivElement;
|
|
16
17
|
};
|
|
17
18
|
rootEl: HTMLDivElement;
|
|
@@ -27,6 +28,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
|
|
27
28
|
contentsWidth: string;
|
|
28
29
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
29
30
|
root: HTMLDivElement;
|
|
31
|
+
trigger: HTMLButtonElement;
|
|
30
32
|
contents: HTMLDivElement;
|
|
31
33
|
}, HTMLDivElement>;
|
|
32
34
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useClickOutside as
|
|
4
|
-
|
|
1
|
+
import { defineComponent as D, ref as s, onMounted as C, onBeforeUnmount as z, openBlock as c, createElementBlock as m, normalizeClass as a, withKeys as B, createElementVNode as y, normalizeStyle as b, withModifiers as A, renderSlot as g, createBlock as H, createCommentVNode as h } from "vue";
|
|
2
|
+
import S from "./Icon/KeyboardArrowDownIcon.vue.js";
|
|
3
|
+
import { useClickOutside as I } from "../scripts/use-click-outside.js";
|
|
4
|
+
import { nextUniqueId as O } from "../scripts/unique-id.js";
|
|
5
|
+
const V = ["disabled", "aria-expanded", "aria-haspopup", "aria-controls"], R = ["inert"], N = /* @__PURE__ */ D({
|
|
5
6
|
__name: "DropdownUi",
|
|
6
7
|
props: {
|
|
7
8
|
isHiddenArrow: { type: Boolean, default: !1 },
|
|
@@ -9,57 +10,72 @@ const B = ["disabled", "aria-expanded"], z = ["inert"], E = /* @__PURE__ */ h({
|
|
|
9
10
|
isDisabled: { type: Boolean, default: !1 },
|
|
10
11
|
contentsWidth: { default: "auto" }
|
|
11
12
|
},
|
|
12
|
-
setup(n, { expose:
|
|
13
|
-
const t =
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
setup(n, { expose: $ }) {
|
|
14
|
+
const t = s(!1), d = s(null), i = s(null), u = s(null), f = s(0), v = O("dropdown") + "_panel", k = () => t.value = !t.value, l = () => t.value = !1, w = (e) => {
|
|
15
|
+
var r;
|
|
16
|
+
t.value && (e.preventDefault(), l(), (r = u.value) == null || r.focus());
|
|
17
|
+
}, p = () => {
|
|
18
|
+
const e = i.value;
|
|
19
|
+
e && (f.value = e.clientHeight);
|
|
16
20
|
};
|
|
17
|
-
|
|
21
|
+
I(d, () => l());
|
|
22
|
+
let o = null;
|
|
23
|
+
return C(() => {
|
|
24
|
+
p();
|
|
25
|
+
const e = i.value;
|
|
26
|
+
!e || typeof ResizeObserver > "u" || (o = new ResizeObserver(p), o.observe(e));
|
|
27
|
+
}), z(() => o == null ? void 0 : o.disconnect()), $({ isContentsOpened: t, close: l }), (e, r) => (c(), m("div", {
|
|
18
28
|
ref_key: "root",
|
|
19
|
-
ref:
|
|
20
|
-
class:
|
|
29
|
+
ref: d,
|
|
30
|
+
class: a(e.$style.drop_down_box),
|
|
31
|
+
onKeydown: B(w, ["escape"])
|
|
21
32
|
}, [
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
y("button", {
|
|
34
|
+
ref_key: "trigger",
|
|
35
|
+
ref: u,
|
|
36
|
+
class: a(e.$style.button),
|
|
24
37
|
disabled: n.isDisabled,
|
|
25
38
|
"aria-expanded": t.value,
|
|
39
|
+
"aria-haspopup": e.$slots.contents ? "true" : void 0,
|
|
40
|
+
"aria-controls": e.$slots.contents ? v : void 0,
|
|
26
41
|
type: "button",
|
|
27
|
-
style:
|
|
42
|
+
style: b({
|
|
28
43
|
"--trigger-color": n.isDisabled || !e.$slots.contents ? "var(--text-color)" : "var(--link-color)",
|
|
29
44
|
cursor: n.isDisabled || !e.$slots.contents ? "auto" : "pointer"
|
|
30
45
|
}),
|
|
31
|
-
onClick:
|
|
46
|
+
onClick: A(k, ["prevent"])
|
|
32
47
|
}, [
|
|
33
|
-
|
|
34
|
-
n.isHiddenArrow || !e.$slots.contents || n.isDisabled ?
|
|
48
|
+
g(e.$slots, "trigger"),
|
|
49
|
+
n.isHiddenArrow || !e.$slots.contents || n.isDisabled ? h("", !0) : (c(), H(S, {
|
|
35
50
|
key: 0,
|
|
36
|
-
class:
|
|
51
|
+
class: a([e.$style.icon, { [e.$style.open]: t.value }])
|
|
37
52
|
}, null, 8, ["class"]))
|
|
38
|
-
], 14,
|
|
39
|
-
e.$slots.contents ? (
|
|
53
|
+
], 14, V),
|
|
54
|
+
e.$slots.contents ? (c(), m("div", {
|
|
40
55
|
key: 0,
|
|
41
|
-
|
|
56
|
+
id: v,
|
|
57
|
+
class: a(e.$style.contents),
|
|
42
58
|
inert: !t.value || void 0,
|
|
43
|
-
style:
|
|
59
|
+
style: b({
|
|
44
60
|
boxShadow: t.value ? "var(--box-shadow)" : "none",
|
|
45
|
-
blockSize: t.value ? `${
|
|
61
|
+
blockSize: t.value ? `${f.value}px` : 0,
|
|
46
62
|
inlineSize: n.contentsWidth,
|
|
47
63
|
right: n.contentAlignment === "right" ? "calc(var(--bv) * -0.5)" : "auto",
|
|
48
64
|
left: n.contentAlignment === "left" ? "calc(var(--bv) * -0.5)" : "auto",
|
|
49
65
|
zIndex: "2"
|
|
50
66
|
})
|
|
51
67
|
}, [
|
|
52
|
-
|
|
68
|
+
y("div", {
|
|
53
69
|
ref_key: "contents",
|
|
54
|
-
ref:
|
|
55
|
-
onClick:
|
|
70
|
+
ref: i,
|
|
71
|
+
onClick: l
|
|
56
72
|
}, [
|
|
57
|
-
|
|
73
|
+
g(e.$slots, "contents")
|
|
58
74
|
], 512)
|
|
59
|
-
], 14,
|
|
60
|
-
],
|
|
75
|
+
], 14, R)) : h("", !0)
|
|
76
|
+
], 34));
|
|
61
77
|
}
|
|
62
78
|
});
|
|
63
79
|
export {
|
|
64
|
-
|
|
80
|
+
N as default
|
|
65
81
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useClickOutside as
|
|
4
|
-
|
|
1
|
+
import { defineComponent as k, ref as l, onMounted as C, onBeforeUnmount as $, watch as B, openBlock as v, createElementBlock as O, normalizeClass as t, normalizeStyle as y, createElementVNode as i, withModifiers as w, renderSlot as m, createBlock as D, createCommentVNode as H } from "vue";
|
|
2
|
+
import z from "./Icon/KeyboardArrowDownIcon.vue.js";
|
|
3
|
+
import { useClickOutside as I } from "../scripts/use-click-outside.js";
|
|
4
|
+
import { nextUniqueId as S } from "../scripts/unique-id.js";
|
|
5
|
+
const U = ["disabled", "aria-expanded"], V = ["inert"], R = /* @__PURE__ */ k({
|
|
5
6
|
__name: "SlideDownUi",
|
|
6
7
|
props: {
|
|
7
8
|
isOpened: { type: [Boolean, null], default: null },
|
|
@@ -10,57 +11,65 @@ const S = ["disabled", "aria-expanded"], z = ["inert"], U = /* @__PURE__ */ h({
|
|
|
10
11
|
isDisableClickOutside: { type: Boolean },
|
|
11
12
|
duration: { default: 0.3 }
|
|
12
13
|
},
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
},
|
|
14
|
+
setup(a, { expose: g }) {
|
|
15
|
+
const s = a, n = l(s.isOpened || !1), d = l(null), r = l(null), c = l(0), u = S("slide_down") + "_panel", b = () => n.value = !n.value, p = () => n.value = !1, h = () => {
|
|
16
|
+
s.isDisableClickOutside || p();
|
|
17
|
+
}, f = () => {
|
|
17
18
|
const e = r.value;
|
|
18
|
-
e && (
|
|
19
|
+
e && (c.value = e.clientHeight);
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
I(d, () => h());
|
|
22
|
+
let o = null;
|
|
23
|
+
return C(() => {
|
|
24
|
+
f();
|
|
25
|
+
const e = r.value;
|
|
26
|
+
!e || typeof ResizeObserver > "u" || (o = new ResizeObserver(f), o.observe(e));
|
|
27
|
+
}), $(() => o == null ? void 0 : o.disconnect()), B(
|
|
28
|
+
() => s.isOpened,
|
|
22
29
|
(e) => {
|
|
23
|
-
typeof e == "boolean" && (
|
|
30
|
+
typeof e == "boolean" && (n.value = e);
|
|
24
31
|
}
|
|
25
|
-
),
|
|
32
|
+
), g({ isOpenedContents: n, close: p }), (e, _) => (v(), O("div", {
|
|
26
33
|
ref_key: "root",
|
|
27
|
-
ref:
|
|
28
|
-
class:
|
|
29
|
-
style:
|
|
34
|
+
ref: d,
|
|
35
|
+
class: t({ [e.$style.opened]: n.value }),
|
|
36
|
+
style: y({ "--accordion-toggle-duration": `${s.duration}s` })
|
|
30
37
|
}, [
|
|
31
|
-
|
|
32
|
-
class:
|
|
33
|
-
disabled:
|
|
34
|
-
"aria-expanded":
|
|
38
|
+
i("button", {
|
|
39
|
+
class: t(e.$style.trigger),
|
|
40
|
+
disabled: a.isDisabled,
|
|
41
|
+
"aria-expanded": n.value,
|
|
42
|
+
"aria-controls": u,
|
|
35
43
|
type: "button",
|
|
36
|
-
onClick:
|
|
44
|
+
onClick: w(b, ["prevent"])
|
|
37
45
|
}, [
|
|
38
|
-
|
|
39
|
-
class:
|
|
46
|
+
i("div", {
|
|
47
|
+
class: t(e.$style.trigger_content)
|
|
40
48
|
}, [
|
|
41
|
-
|
|
49
|
+
m(e.$slots, "trigger")
|
|
42
50
|
], 2),
|
|
43
|
-
|
|
51
|
+
a.isHiddenArrow ? H("", !0) : (v(), D(z, {
|
|
44
52
|
key: 0,
|
|
45
|
-
class:
|
|
53
|
+
class: t(e.$style.icon)
|
|
46
54
|
}, null, 8, ["class"]))
|
|
47
|
-
], 10,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
], 10, U),
|
|
56
|
+
i("div", {
|
|
57
|
+
id: u,
|
|
58
|
+
style: y({ height: n.value ? `${c.value}px` : 0 }),
|
|
59
|
+
class: t(e.$style.contents),
|
|
60
|
+
inert: !n.value || void 0
|
|
52
61
|
}, [
|
|
53
|
-
|
|
62
|
+
i("div", {
|
|
54
63
|
ref_key: "contents",
|
|
55
64
|
ref: r,
|
|
56
|
-
class:
|
|
65
|
+
class: t(e.$style.container)
|
|
57
66
|
}, [
|
|
58
|
-
|
|
67
|
+
m(e.$slots, "default")
|
|
59
68
|
], 2)
|
|
60
|
-
], 14,
|
|
69
|
+
], 14, V)
|
|
61
70
|
], 6));
|
|
62
71
|
}
|
|
63
72
|
});
|
|
64
73
|
export {
|
|
65
|
-
|
|
74
|
+
R as default
|
|
66
75
|
};
|