@geckou/ui-react 0.5.0 → 0.5.1

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.
@@ -22,33 +22,35 @@ function I({
22
22
  isShown: r,
23
23
  size: s = "medium",
24
24
  onClose: o,
25
- header: m,
25
+ header: i,
26
26
  footer: u,
27
27
  children: p,
28
28
  ariaLabel: f
29
29
  }) {
30
- const c = b(), i = n(null), v = n(g());
30
+ const c = b(), m = n(null), v = n(g());
31
31
  d(() => {
32
32
  const e = v.current;
33
33
  return e.toggle(r), () => e.release();
34
34
  }, [r]);
35
- const a = n(null);
35
+ const l = n(null);
36
36
  return d(() => {
37
- var e, l;
37
+ var e, a;
38
38
  if (r) {
39
- a.current ?? (a.current = document.activeElement), (e = i.current) == null || e.focus();
39
+ l.current ?? (l.current = document.activeElement), (e = m.current) == null || e.focus();
40
40
  return;
41
41
  }
42
- (l = a.current) == null || l.focus(), a.current = null;
42
+ (a = l.current) == null || a.focus(), l.current = null;
43
43
  }, [r]), d(() => {
44
44
  if (!r)
45
45
  return;
46
- const e = (l) => {
47
- if (l.key === "Escape") {
48
- o();
49
- return;
46
+ const e = (a) => {
47
+ if (!a.defaultPrevented) {
48
+ if (a.key === "Escape") {
49
+ o();
50
+ return;
51
+ }
52
+ w(m.current, a, document.activeElement);
50
53
  }
51
- w(i.current, l, document.activeElement);
52
54
  };
53
55
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
54
56
  }, [r, o]), /* @__PURE__ */ t(
@@ -63,20 +65,20 @@ function I({
63
65
  children: /* @__PURE__ */ x(
64
66
  "div",
65
67
  {
66
- ref: i,
68
+ ref: m,
67
69
  role: "dialog",
68
70
  "aria-modal": "true",
69
- "aria-labelledby": m ? c : void 0,
70
- "aria-label": m ? void 0 : f ?? "ダイアログ",
71
+ "aria-labelledby": i ? c : void 0,
72
+ "aria-label": i ? void 0 : f ?? "ダイアログ",
71
73
  tabIndex: -1,
72
74
  className: `relative flex max-h-full w-full cursor-auto flex-col rounded-[var(--radius-small,0.1875rem)] bg-white drop-shadow-[0_0_6px_#33333355] ${h[s]}`,
73
75
  children: [
74
- m && /* @__PURE__ */ t(
76
+ i && /* @__PURE__ */ t(
75
77
  "header",
76
78
  {
77
79
  id: c,
78
80
  className: "border-b border-[#eee] px-[var(--sp-large,1.5rem)] py-[var(--sp-medium,0.75rem)] max-md:p-[var(--sp-medium,0.75rem)] [&>h2]:font-bold [&>h2]:text-[var(--fs-large,0.875rem)]",
79
- children: m
81
+ children: i
80
82
  }
81
83
  ),
82
84
  /* @__PURE__ */ t("div", { className: "flex-auto overflow-auto p-[var(--sp-large,1.5rem)] max-md:p-[var(--sp-medium,0.75rem)]", children: p }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geckou/ui-react",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "A set of reusable React UI components (forms) by Geckou",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -40,7 +40,7 @@
40
40
  "react-dom": "^19.0.0"
41
41
  },
42
42
  "dependencies": {
43
- "@geckou/ui-core": "^0.4.0"
43
+ "@geckou/ui-core": "^0.5.0"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "vite build && node scripts/copy-assets.mjs",