@cakejp/design-system 0.22.1 → 0.23.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.
Files changed (119) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/CLAUDE.md +3 -1
  3. package/MIGRATION.md +43 -0
  4. package/UPDATING.md +1 -1
  5. package/bin/check-tokens.mjs +20 -0
  6. package/contracts/components.json +87 -25
  7. package/contracts/composition.json +9 -9
  8. package/contracts/rules.json +1 -1
  9. package/contracts/screen-patterns.json +1 -1
  10. package/dist/components/ec/admin-shell.js +7 -7
  11. package/dist/components/ec/anniversary-card.js +1 -1
  12. package/dist/components/ec/chart-controls.js +7 -7
  13. package/dist/components/ec/coupon-card.js +10 -10
  14. package/dist/components/ec/delivery-calendar.js +1 -1
  15. package/dist/components/ec/mypage-shell.js +1 -1
  16. package/dist/components/ec/order-section.js +1 -1
  17. package/dist/components/ec/order-summary.js +7 -5
  18. package/dist/components/ec/product-card.js +32 -30
  19. package/dist/components/ec/product-detail-sidebar.js +1 -1
  20. package/dist/components/ec/product-list-item.js +57 -56
  21. package/dist/components/ec/product-option.js +30 -30
  22. package/dist/components/ec/review-summary.js +1 -1
  23. package/dist/components/ec/shop-card.js +7 -7
  24. package/dist/components/foundations/accordion.js +1 -1
  25. package/dist/components/foundations/alert-dialog.js +65 -43
  26. package/dist/components/foundations/alert.js +74 -68
  27. package/dist/components/foundations/badge.js +4 -4
  28. package/dist/components/foundations/button.js +15 -15
  29. package/dist/components/foundations/checkbox-card.js +18 -18
  30. package/dist/components/foundations/checkbox.js +6 -6
  31. package/dist/components/foundations/chip-variants.js +8 -8
  32. package/dist/components/foundations/data-table.js +244 -209
  33. package/dist/components/foundations/dialog.js +84 -60
  34. package/dist/components/foundations/drawer.js +61 -53
  35. package/dist/components/foundations/field.js +51 -35
  36. package/dist/components/foundations/file-input.js +1 -1
  37. package/dist/components/foundations/input.js +9 -8
  38. package/dist/components/foundations/popover.js +15 -12
  39. package/dist/components/foundations/progress.js +19 -18
  40. package/dist/components/foundations/radio-group.js +26 -23
  41. package/dist/components/foundations/select.js +9 -8
  42. package/dist/components/foundations/sheet.js +82 -59
  43. package/dist/components/foundations/skeleton.js +6 -6
  44. package/dist/components/foundations/slider.js +7 -7
  45. package/dist/components/foundations/sonner.js +9 -8
  46. package/dist/components/foundations/switch.js +3 -2
  47. package/dist/components/foundations/tabs.js +5 -5
  48. package/dist/components/foundations/textarea.js +7 -6
  49. package/dist/components/foundations/toggle-group.js +5 -5
  50. package/dist/components/primitives/admin-header.js +3 -3
  51. package/dist/components/primitives/admin-side-nav.js +101 -92
  52. package/dist/components/primitives/category-shortcuts.js +6 -6
  53. package/dist/components/primitives/chat-composer.js +1 -1
  54. package/dist/components/primitives/chip.js +25 -25
  55. package/dist/components/primitives/combobox.js +74 -63
  56. package/dist/components/primitives/content-carousel.js +64 -62
  57. package/dist/components/primitives/date-picker.js +99 -96
  58. package/dist/components/primitives/error-state.js +9 -9
  59. package/dist/components/primitives/filter-bar.js +4 -4
  60. package/dist/components/primitives/footer.js +1 -1
  61. package/dist/components/primitives/form-field.js +8 -8
  62. package/dist/components/primitives/funnel-shell.js +5 -5
  63. package/dist/components/primitives/header.js +16 -16
  64. package/dist/components/primitives/image-carousel.js +42 -41
  65. package/dist/components/primitives/image-gallery.js +61 -58
  66. package/dist/components/primitives/image-input.js +2 -2
  67. package/dist/components/primitives/image-uploader.js +1 -1
  68. package/dist/components/primitives/kebab-menu.js +20 -16
  69. package/dist/components/primitives/list-item.js +17 -17
  70. package/dist/components/primitives/menu-drawer.js +11 -11
  71. package/dist/components/primitives/multi-select.js +66 -66
  72. package/dist/components/primitives/notification-list.js +13 -13
  73. package/dist/components/primitives/number-input.js +118 -112
  74. package/dist/components/primitives/progress-steps.js +3 -3
  75. package/dist/components/primitives/search-bar.js +6 -6
  76. package/dist/components/primitives/section-nav.js +1 -1
  77. package/dist/components/primitives/side-nav.js +1 -1
  78. package/dist/components/primitives/sub-nav.js +12 -12
  79. package/dist/components/primitives/tag.js +3 -3
  80. package/dist/components/primitives/workspace-shell.js +8 -8
  81. package/dist/index.css +1 -1
  82. package/dist/index.js +1479 -704
  83. package/dist/lib/focus-restore.js +67 -0
  84. package/dist/lib/focus-ring.js +1 -1
  85. package/dist/lib/ime.js +17 -0
  86. package/dist/lib/search-normalize.js +30 -0
  87. package/dist/types/components/ec/admin-shell.d.ts +1 -1
  88. package/dist/types/components/foundations/alert-dialog.d.ts +2 -2
  89. package/dist/types/components/foundations/alert.d.ts +14 -1
  90. package/dist/types/components/foundations/card.d.ts +3 -3
  91. package/dist/types/components/foundations/confirm-dialog.d.ts +3 -3
  92. package/dist/types/components/foundations/data-table.d.ts +1 -1
  93. package/dist/types/components/foundations/dialog.d.ts +2 -2
  94. package/dist/types/components/foundations/drawer.d.ts +1 -1
  95. package/dist/types/components/foundations/field.d.ts +23 -3
  96. package/dist/types/components/foundations/popover.d.ts +1 -1
  97. package/dist/types/components/foundations/sheet.d.ts +4 -3
  98. package/dist/types/components/foundations/sonner.d.ts +3 -2
  99. package/dist/types/components/primitives/admin-side-nav.d.ts +2 -0
  100. package/dist/types/components/primitives/combobox.d.ts +6 -0
  101. package/dist/types/components/primitives/date-picker.d.ts +8 -3
  102. package/dist/types/components/primitives/funnel-shell.d.ts +1 -1
  103. package/dist/types/components/primitives/kebab-menu.d.ts +10 -1
  104. package/dist/types/components/primitives/number-input.d.ts +20 -1
  105. package/dist/types/components/primitives/progress-steps.d.ts +1 -1
  106. package/dist/types/components/primitives/section.d.ts +1 -1
  107. package/dist/types/components/primitives/workspace-shell.d.ts +2 -2
  108. package/dist/types/index.d.ts +3 -4
  109. package/dist/types/lib/focus-restore.d.ts +52 -0
  110. package/dist/types/lib/focus-ring.d.ts +3 -0
  111. package/dist/types/lib/ime.d.ts +36 -0
  112. package/dist/types/lib/search-normalize.d.ts +28 -0
  113. package/package.json +3 -1
  114. package/src/components/COMPONENT_LOOKUP.md +12 -12
  115. package/src/preset-standalone.css +43 -21
  116. package/src/preset.css +36 -18
  117. package/src/styles/primitive.css +1 -0
  118. package/src/styles/semantic.css +12 -2
  119. package/tokens.json +22 -3
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import * as n from "react";
3
+ function l(e) {
4
+ if (!(e instanceof HTMLElement) || !e.isConnected) return !1;
5
+ const t = e.ownerDocument;
6
+ return e === t.body || e === t.documentElement ? !1 : !e.matches(":disabled, [inert], [inert] *");
7
+ }
8
+ function a(e) {
9
+ const t = e.activeElement;
10
+ return t == null || t === e.body || t === e.documentElement;
11
+ }
12
+ const d = n.createContext(null), m = typeof window > "u" ? n.useEffect : n.useLayoutEffect;
13
+ function R(e, t, r) {
14
+ const s = n.useRef(null), u = n.useRef(e ?? t ?? !1), o = n.useRef(0);
15
+ m(() => {
16
+ e !== void 0 && (u.current = e);
17
+ }, [e]);
18
+ const c = n.useCallback(
19
+ (i) => {
20
+ e === void 0 && (u.current = i), r?.(i);
21
+ },
22
+ [e, r]
23
+ );
24
+ return { root: n.useMemo(
25
+ () => ({
26
+ openerRef: s,
27
+ isOpen: () => u.current,
28
+ registerContent: () => (o.current += 1, () => {
29
+ o.current -= 1;
30
+ }),
31
+ hasContent: () => o.current > 0
32
+ }),
33
+ []
34
+ ), handleOpenChange: c };
35
+ }
36
+ function p(e) {
37
+ if (typeof document > "u" || a(document) && l(e.current)) return;
38
+ const t = document.activeElement;
39
+ e.current = t instanceof HTMLElement ? t : null;
40
+ }
41
+ function C({
42
+ onOpenAutoFocus: e,
43
+ onCloseAutoFocus: t
44
+ }) {
45
+ const r = n.useContext(d), s = n.useRef(null), u = r?.openerRef ?? s;
46
+ return n.useEffect(() => r?.registerContent(), [r]), {
47
+ onOpenAutoFocus: (o) => {
48
+ p(u), e?.(o);
49
+ },
50
+ onCloseAutoFocus: (o) => {
51
+ const c = r != null && r.isOpen() && r.hasContent(), f = c ? null : u.current;
52
+ if (c || (u.current = null), t?.(o), !o.defaultPrevented) {
53
+ if (c) {
54
+ o.preventDefault();
55
+ return;
56
+ }
57
+ typeof document > "u" || !a(document) || l(f) && (o.preventDefault(), f.focus({ preventScroll: !0 }));
58
+ }
59
+ }
60
+ };
61
+ }
62
+ export {
63
+ d as OverlayFocusRootContext,
64
+ l as canRestoreFocusTo,
65
+ R as useOverlayFocusRoot,
66
+ C as useRestoreFocusToOpener
67
+ };
@@ -2,7 +2,7 @@ const o = "forced-colors:focus-visible:outline-solid forced-colors:focus-visible
2
2
  "focus-visible:border-[var(--Focus-High-Emphasis)] focus-visible:ring-[3px] focus-visible:ring-[color:var(--Focus-Ring-Control,color-mix(in_oklab,var(--Focus-High-Emphasis)_50%,transparent))]",
3
3
  o
4
4
  ].join(" "), l = [
5
- "focus-within:border-[var(--Focus-High-Emphasis)] focus-within:ring-[3px] focus-within:ring-[var(--Focus-High-Emphasis)]/50",
5
+ "focus-within:border-[var(--Focus-High-Emphasis)] focus-within:ring-[3px] focus-within:ring-[color:var(--Focus-Ring-Control,color-mix(in_oklab,var(--Focus-High-Emphasis)_50%,transparent))]",
6
6
  i
7
7
  ].join(" "), t = [
8
8
  "focus-visible:ring-[3px] focus-visible:ring-[color:var(--Focus-Ring-Control,color-mix(in_oklab,var(--Focus-High-Emphasis)_50%,transparent))]",
@@ -0,0 +1,17 @@
1
+ function n(e) {
2
+ const r = e.nativeEvent ?? e;
3
+ return r.isComposing === !0 || r.keyCode === 229;
4
+ }
5
+ function o(e) {
6
+ return n(e) ? (e.preventDefault(), !0) : !1;
7
+ }
8
+ function u(e) {
9
+ return (r) => {
10
+ e?.(r), o(r);
11
+ };
12
+ }
13
+ export {
14
+ u as composeEscapeKeyDownWithImeGuard,
15
+ o as guardEscapeDuringIme,
16
+ n as isImeComposing
17
+ };
@@ -0,0 +1,30 @@
1
+ const A = new RegExp("\\p{Script=Han}", "u"), m = 12449, C = 12534, K = 96, S = "ゖ", h = new Set([12438, 12369, 12437, 12364].map((n) => String.fromCharCode(n)));
2
+ function a(n) {
3
+ return Array.from(n.normalize("NFKC").toLowerCase(), (t) => {
4
+ const r = t.charCodeAt(0);
5
+ return r >= m && r <= C ? String.fromCharCode(r - K) : t;
6
+ }).join("");
7
+ }
8
+ function i(n, t) {
9
+ const r = Array.from(n);
10
+ return r.map((e, o) => {
11
+ if (!h.has(e)) return e;
12
+ const s = r[o - 1], c = r[o + 1], u = s === void 0 ? t : A.test(s), f = c === void 0 || A.test(c);
13
+ return u && f ? S : e;
14
+ }).join("");
15
+ }
16
+ function N(n, t) {
17
+ const r = a(t.trim());
18
+ if (r === "") return !0;
19
+ const e = i(r, !0);
20
+ return n.some((o) => {
21
+ if (!o) return !1;
22
+ const s = a(o);
23
+ return s.includes(r) || i(s, !1).includes(e);
24
+ });
25
+ }
26
+ export {
27
+ N as matchesSearch,
28
+ i as normalizeKeVariants,
29
+ a as normalizeSearchText
30
+ };
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * ## 配下 Card のサーフェス
19
19
  *
20
- * 地が Surface-Secondary なので、シェルが配下 `Card` の既定サーフェスを白にする文脈
20
+ * 地が Surface-Neutral-Secondary なので、シェルが配下 `Card` の既定サーフェスを白にする文脈
21
21
  * (`--card-surface`)を宣言する。`Card` は `surface` 未指定のまま地から浮く(#150)。
22
22
  *
23
23
  * 参照元:
@@ -1,11 +1,11 @@
1
1
  import * as React from "react";
2
2
  import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
3
3
  import { Button } from "../../components/foundations/button";
4
- declare function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function AlertDialog({ open, defaultOpen, onOpenChange, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
5
5
  declare function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
- declare function AlertDialogContent({ className, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
8
+ declare function AlertDialogContent({ className, size, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
9
9
  size?: "default" | "sm";
10
10
  }): import("react/jsx-runtime").JSX.Element;
11
11
  declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
@@ -25,7 +25,20 @@ import { type VariantProps } from "class-variance-authority";
25
25
  declare const alertVariants: (props?: {
26
26
  variant?: "success" | "info" | "error" | "warning" | "inline-info" | "inline-caution" | "inline-warning";
27
27
  } & import("class-variance-authority/types").ClassProp) => string;
28
+ /**
29
+ * 読み上げの強さ(ライブリージョンの種類)。
30
+ * - `"alert"`: 即時に割り込んで読み上げる。エラー・警告向け
31
+ * - `"status"`: 読み上げ中の内容を遮らず、区切りで読み上げる。補足・成功向け
32
+ * - `"off"`: 読み上げ領域にしない(role を付けない)。画面表示時から出ている静的な補足向け
33
+ */
34
+ type AlertLive = "alert" | "status" | "off";
28
35
  type AlertProps = React.ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
36
+ /**
37
+ * 読み上げの強さ。未指定は variant で決まる
38
+ * (error / warning / inline-caution / inline-warning は "alert"、success / info / inline-info は "status")。
39
+ * "off" で role を付けない。`role` を直接渡した場合はそちらが優先。
40
+ */
41
+ live?: AlertLive;
29
42
  /**
30
43
  * prop-based API のタイトル(旧 Banner.title 相当)。
31
44
  * children と排他(children 優先)。bordered / inline 両 variant で有効。
@@ -38,7 +51,7 @@ type AlertProps = React.ComponentProps<"div"> & VariantProps<typeof alertVariant
38
51
  /** 右側アクション(Button など、旧 Banner.action 相当) */
39
52
  action?: React.ReactNode;
40
53
  };
41
- declare function Alert({ className, variant, children, title, description, icon, action, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element;
54
+ declare function Alert({ className, variant, children, title, description, icon, action, live, role, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element;
42
55
  declare const alertTitleVariants: Record<string, string>;
43
56
  declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
44
57
  declare const alertDescriptionVariants: Record<string, string>;
@@ -9,12 +9,12 @@ import { type VariantProps } from "class-variance-authority";
9
9
  * ## サーフェス文脈の伝播(#150)
10
10
  *
11
11
  * `Section background="subtle" | "accent-subtle"` は配下に `--card-surface: var(--Surface-Primary)`
12
- * を流す。そのため**グレー地の Section に置いた Card は `surface` 未指定でも自動で白**になり、
13
- * 「あとからカードを1枚足したら prop を付け忘れてグレー地に沈む」事故が構造的に起きない。
12
+ * を流す。そのため**色地の Section に置いた Card は `surface` 未指定でも自動で白**になり、
13
+ * 「あとからカードを1枚足したら prop を付け忘れて色地に沈む」事故が構造的に起きない。
14
14
  *
15
15
  * 伝播は CSS カスタムプロパティのカスケードだけで成立する(React context 不使用)。
16
16
  * したがって Card / Section は Server Component のまま使え、DS の `Section` を使わない
17
- * 自前のグレー地でも同じ効果を得られる:
17
+ * 自前の色地でも同じ効果を得られる:
18
18
  *
19
19
  * ```tsx
20
20
  * // 任意の要素にサーフェス文脈を宣言する(consumer 側の escape hatch)
@@ -31,9 +31,9 @@ interface ConfirmDialogProviderProps {
31
31
  * - 同時に複数呼ばれたら待ち行列にして 1 件ずつ表示する。
32
32
  * - Provider が unmount されたとき、未解決の confirm は false で resolve する
33
33
  * (画面遷移で await が宙に浮いたままにならないようにする)。unmount 後の呼び出しも即 false。
34
- * - 閉じた後は confirm() を呼んだ時点でフォーカスがあった要素へ戻す(Trigger を持たないため、
35
- * Radix の既定のままだと body へ落ちる)。閉じるアニメーション中に次の confirm() が来ても、
36
- * 最後に閉じたときは元の呼び出し元へ戻る。
34
+ * - 閉じた後は confirm() を呼んだ時点でフォーカスがあった要素へ戻す(AlertDialogContent の
35
+ * 共通の復帰は「開いた時点の要素」を使うため、メニューから呼んだときに戻せない。ここで上書きする)。
36
+ * 閉じるアニメーション中に次の confirm() が来ても、最後に閉じたときは元の呼び出し元へ戻る。
37
37
  */
38
38
  declare function ConfirmDialogProvider({ children }: ConfirmDialogProviderProps): import("react/jsx-runtime").JSX.Element;
39
39
  /**
@@ -8,7 +8,7 @@ declare function DataTableBody({ className, ...props }: React.ComponentProps<"tb
8
8
  declare const dataTableRowVariants: (props?: {
9
9
  state?: "default" | "selected";
10
10
  } & import("class-variance-authority/types").ClassProp) => string;
11
- declare function DataTableRow({ className, state, ...props }: React.ComponentProps<"tr"> & VariantProps<typeof dataTableRowVariants>): import("react/jsx-runtime").JSX.Element;
11
+ declare function DataTableRow({ className, state, onClick, onKeyDown, ...props }: React.ComponentProps<"tr"> & VariantProps<typeof dataTableRowVariants>): import("react/jsx-runtime").JSX.Element;
12
12
  type SortDirection = "asc" | "desc" | null;
13
13
  declare function DataTableHead({ className, sortable, sortDirection, onSort, width, srLabel, children, ...props }: React.ComponentProps<"th"> & {
14
14
  sortable?: boolean;
@@ -1,12 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { Dialog as DialogPrimitive } from "radix-ui";
3
- declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
3
+ declare function Dialog({ open, defaultOpen, onOpenChange, ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
4
  declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
5
  declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
8
  type DialogSize = "sm" | "md" | "lg" | "xl";
9
- declare function DialogContent({ className, children, showCloseButton, size, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
+ declare function DialogContent({ className, children, showCloseButton, size, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
10
10
  showCloseButton?: boolean;
11
11
  /**
12
12
  * 幅の段。sm 以上の画面で効く(SP は段に関係なく画面端から 16px を残して収まる)。
@@ -5,7 +5,7 @@ declare function DrawerTrigger({ ...props }: React.ComponentProps<typeof DrawerP
5
5
  declare function DrawerPortal({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DrawerClose({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function DrawerOverlay({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
- declare function DrawerContent({ className, children, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DrawerContent({ className, children, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
9
9
  declare function DrawerHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
10
10
  declare function DrawerFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
11
11
  declare function DrawerTitle({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
@@ -47,16 +47,35 @@ declare function Field({ className, orientation, ...props }: React.ComponentProp
47
47
  * 無効時の色を当てたもの。`htmlFor` で入力と関連付ける。
48
48
  */
49
49
  declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): import("react/jsx-runtime").JSX.Element;
50
+ /** FieldSet の子の間隔の段。sm=8px / md=16px / lg=24px */
51
+ type FieldSetGap = "sm" | "md" | "lg";
50
52
  /**
51
53
  * FieldSet — フォーム全体 or 大きなセクションの枠。
52
54
  * `<fieldset>` の既定スタイル(ブラウザ枠線・padding)をリセットし、
53
- * legend + 複数 `FieldGroup` を gap-6 の縦リズムで並べる。
55
+ * 複数 `FieldGroup` を gap-6 の縦リズムで並べる。
56
+ *
57
+ * `<legend>` は flex の並びに入らないため、`gap` 未指定のときは legend の直下の間隔が 0 になる
58
+ * (従来の見た目。既定は変えない)。`gap` を指定すると子の間隔をその段にし、legend の下にも同じ間隔を空ける。
54
59
  */
55
- declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): import("react/jsx-runtime").JSX.Element;
60
+ declare function FieldSet({ className, gap, ...props }: React.ComponentProps<"fieldset"> & {
61
+ /**
62
+ * 子の間隔(opt-in)。"sm"=8px / "md"=16px / "lg"=24px。
63
+ * 指定すると FieldLegend の下にも同じ間隔を空ける。未指定は従来どおり gap-6 で legend の直下は 0px。
64
+ * 絞り込みの選択肢グループのような詰めた並びは `gap="sm"` + `<FieldLegend size="sm">`。
65
+ */
66
+ gap?: FieldSetGap;
67
+ }): import("react/jsx-runtime").JSX.Element;
56
68
  /**
57
69
  * FieldLegend — FieldSet の見出し。`<legend>` として描画。
58
70
  */
59
- declare function FieldLegend({ className, ...props }: React.ComponentProps<"legend">): import("react/jsx-runtime").JSX.Element;
71
+ declare function FieldLegend({ className, size, ...props }: React.ComponentProps<"legend"> & {
72
+ /**
73
+ * 見出しの大きさ。
74
+ * - "md"(既定): typo-label-lg + Text-High-Emphasis(フォームのセクション見出し・従来)
75
+ * - "sm": typo-label-md + Text-Medium-Emphasis(絞り込みの選択肢グループ等の小見出し)
76
+ */
77
+ size?: "md" | "sm";
78
+ }): import("react/jsx-runtime").JSX.Element;
60
79
  /**
61
80
  * FieldGroup — 関連する複数フィールドを束ねるコンテナ。
62
81
  * section-content リズム(gap-4)で縦に並べる。
@@ -78,4 +97,5 @@ declare function FieldError({ className, children, ...props }: React.ComponentPr
78
97
  declare function FieldSeparator({ className, children, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
79
98
  export { Field, FieldLabel, FieldSet, FieldLegend, FieldGroup, FieldDescription, FieldError, FieldSeparator, };
80
99
  export { fieldVariants };
100
+ export type { FieldSetGap };
81
101
  export type FieldProps = React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { Popover as PopoverPrimitive } from "radix-ui";
3
3
  declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
4
  declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
- declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
5
+ declare function PopoverContent({ className, align, sideOffset, onEscapeKeyDown, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function PopoverHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
8
8
  declare function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { Dialog as SheetPrimitive } from "radix-ui";
3
- declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
3
+ declare function Sheet({ open, defaultOpen, onOpenChange, ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
4
  declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
5
  declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
6
6
  type SheetSize = "sm" | "md" | "lg";
7
- declare function SheetContent({ className, children, side, size, showCloseButton, autoFocus, onOpenAutoFocus, onCloseAutoFocus, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
7
+ declare function SheetContent({ className, children, side, size, showCloseButton, autoFocus, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
8
8
  side?: "top" | "right" | "bottom" | "left";
9
9
  /**
10
10
  * 幅の段。`side="left"` / `"right"` のときだけ効く(top / bottom は全幅なので無視)。
@@ -18,7 +18,8 @@ declare function SheetContent({ className, children, side, size, showCloseButton
18
18
  size?: SheetSize;
19
19
  showCloseButton?: boolean;
20
20
  /**
21
- * 開閉時のフォーカス自動移動。既定 true(Radix 既定=開いたら中へ入り、閉じたらトリガーへ戻る)。
21
+ * 開閉時のフォーカス自動移動。既定 true(開いたら中へ入り、閉じたらその回に開いた要素へ戻る。
22
+ * Trigger を使わず state で開いたときも戻る)。
22
23
  * WCAG 2.4.3 を満たすため、止めたい特別な事情があるときだけ false にする。
23
24
  */
24
25
  autoFocus?: boolean;
@@ -1,3 +1,4 @@
1
- import { type ToasterProps } from "sonner";
1
+ import { toast as sonnerToast, type ToasterProps } from "sonner";
2
2
  declare const Toaster: ({ ...props }: ToasterProps) => import("react/jsx-runtime").JSX.Element;
3
- export { Toaster };
3
+ declare const toast: typeof sonnerToast;
4
+ export { Toaster, toast };
@@ -41,6 +41,8 @@ export interface AdminSideNavProps {
41
41
  * モバイルドロワーの開閉要求ハンドラ。背景・閉じるボタンに加え、ドロワー内のリンク
42
42
  * (項目・サブ項目)を押したときも `onOpenChange(false)` が呼ばれる
43
43
  * (`linkComponent` でクライアント遷移するとページが再読み込みされず、開いたままになるため)。
44
+ * ただし Cmd/Ctrl/Shift/Alt 付きクリック・中クリック・`target="_blank"` のリンクは、
45
+ * 今の画面が移らないので閉じない。
44
46
  */
45
47
  onOpenChange?: (open: boolean) => void;
46
48
  /** nav の aria-label */
@@ -1,6 +1,10 @@
1
1
  export interface ComboboxOption {
2
2
  value: string;
3
3
  label: string;
4
+ /**
5
+ * 絞り込みに使う別名(読み・略称など)。label と同じく、大文字小文字・全角半角・
6
+ * ひらがな/カタカナ・漢字に挟まれた「ヶ/ケ/ヵ/が」の違いを区別せずに部分一致で当てる
7
+ */
4
8
  keywords?: string[];
5
9
  disabled?: boolean;
6
10
  }
@@ -28,6 +32,8 @@ export interface ComboboxProps {
28
32
  * トリガーのアクセシブルネーム(日本語)。
29
33
  * `role="combobox"` は内容からは名前が付かないため、FormField の外で単体利用する
30
34
  * ときはこれか `aria-labelledby` を指定する(未指定時は placeholder を名前に使う)。
35
+ * 選択中は、この名前(FormField 配下では FormField のラベル)の後ろに選択中の値が続く
36
+ * (例「都道府県 東京都」)。
31
37
  */
32
38
  "aria-label"?: string;
33
39
  /** ラベル要素の id を直接指定する場合 */
@@ -12,13 +12,18 @@ export interface DatePickerProps {
12
12
  max?: Date;
13
13
  /** 個別に無効化する日(Calendar の disabled マッチャーをそのまま透過) */
14
14
  disabledDates?: Matcher | Matcher[];
15
+ /**
16
+ * カレンダーを開いたときに表示する月。指定すると `value` より優先する。
17
+ * 未指定なら、値があるときは選択中の日の月、無いときは今月を開く
18
+ */
19
+ defaultMonth?: Date;
15
20
  /** trigger を無効化する */
16
21
  disabled?: boolean;
17
22
  /**
18
23
  * 選択済みの値を消すクリアボタン(×)を trigger 右端に出す。既定 false(後方互換)。
19
24
  * `value` があり `disabled` でないときだけ描画し、押すと `onChange(undefined)` を呼ぶ。
20
- * 未指定だと「カレンダーを開いて選択済みの日付を再クリック」しかクリア手段が無く、
21
- * 画面から発見できないため、任意項目(null 許容)では true にする。
25
+ * カレンダーで選択中の日を再び押しても値は消えないため、値を空に戻せるのはこの × だけ。
26
+ * 任意項目(null 許容)では true にする。
22
27
  */
23
28
  clearable?: boolean;
24
29
  /** クリアボタンの aria-label。既定「日付をクリア」 */
@@ -38,7 +43,7 @@ export interface DatePickerProps {
38
43
  */
39
44
  className?: string;
40
45
  }
41
- declare function DatePicker({ value, onChange, placeholder, min, max, disabledDates, disabled, clearable, clearLabel, id, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, className, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
46
+ declare function DatePicker({ value, onChange, placeholder, min, max, disabledDates, defaultMonth, disabled, clearable, clearLabel, id, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, className, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
42
47
  export interface DateTimePickerProps extends DatePickerProps {
43
48
  /** 分の刻み(分 Select の選択肢間隔)。既定 5 分 */
44
49
  minuteStep?: number;
@@ -86,7 +86,7 @@ export interface FunnelShellProps {
86
86
  * で表す。各ステップはドット(上)+ラベル(下)の縦積みで、コネクタ線はドット中心の
87
87
  * 高さで隣ステップ中心まで引く。ラベルは SP でも省略しない。
88
88
  * - `bottomAction` を渡すと本文の下余白はシェルが管理する(二重がけ/付け忘れの構造的防止)。
89
- * - 地が Surface-Secondary なので、配下 `Card` の既定サーフェスを白にする文脈
89
+ * - 地が Surface-Neutral-Secondary なので、配下 `Card` の既定サーフェスを白にする文脈
90
90
  * (`--card-surface`)をシェルが宣言する。`Card` は `surface` 未指定のまま地から浮く(#150)。
91
91
  *
92
92
  * 管理画面の集中編集は `WorkspaceShell`(EC 購入導線=本コンポーネント)。
@@ -13,9 +13,13 @@
13
13
  * | Prop | 型 | デフォルト | 説明 |
14
14
  * |------|-----|-----------|------|
15
15
  * | items | { label, icon?, onClick, destructive? }[] | — | メニュー項目 |
16
+ * | menuLabel | string | "メニュー" | トリガーの読み上げ名(aria-label) |
16
17
  *
17
18
  * ### AI 向け使用ルール
18
19
  * - テーブル行のアクション列に使用
20
+ * - 一覧の各行に置くときは `menuLabel` に行を特定できる名前を渡す(例: `${商品名}のメニュー`)。
21
+ * 全部「メニュー」だと読み上げで区別できない
22
+ * - 見た目は 32px のまま、当たり判定は `tap-target` で 44px に広げている。隣のボタンとの間は 12px 以上空ける
19
23
  * - DropdownMenu を内部で利用
20
24
  */
21
25
  import * as React from "react";
@@ -32,7 +36,12 @@ export interface KebabMenuItem {
32
36
  export interface KebabMenuProps {
33
37
  /** メニュー項目 */
34
38
  items: KebabMenuItem[];
39
+ /**
40
+ * トリガーボタンの読み上げ名(aria-label)。既定は「メニュー」。
41
+ * 一覧の各行に置くときは「○○のメニュー」のように対象が分かる名前にする
42
+ */
43
+ menuLabel?: string;
35
44
  /** 追加クラス */
36
45
  className?: string;
37
46
  }
38
- export declare function KebabMenu({ items, className }: KebabMenuProps): import("react/jsx-runtime").JSX.Element;
47
+ export declare function KebabMenu({ items, menuLabel, className }: KebabMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,6 @@
1
1
  import * as React from "react";
2
+ /** NumberInput の inputProps。値・id・aria・disabled 等の部品が管理する属性は除く */
3
+ export type NumberInputInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "type" | "id" | "name" | "disabled" | "inputMode" | "pattern" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-invalid" | "aria-live">;
2
4
  export interface NumberInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
3
5
  /** 現在の値(制御) */
4
6
  value?: number;
@@ -33,6 +35,23 @@ export interface NumberInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
33
35
  locale?: string;
34
36
  /** 入力欄の id。FormField 配下では未指定でも FormField の htmlFor と同じ id になる */
35
37
  inputId?: string;
38
+ /**
39
+ * フォーム送信時の名前。`<form>` の FormData に現在値(素の数値)が `name` で入る。
40
+ * editable かつ formatOptions 無しのときは表示中の入力欄に付く。表示が数値そのものでないとき
41
+ * (formatOptions で桁区切り・通貨表示する / editable=false)は、素の数値を持つ hidden input に付ける
42
+ * (`inputProps.form` で form 外から関連付けた場合は hidden input にも同じ form が付く)
43
+ */
44
+ name?: string;
45
+ /** 内部の入力欄(`<input>`)への ref。フォーカス制御・フォームライブラリの登録に使う。editable=false では入力欄が無いので null */
46
+ inputRef?: React.Ref<HTMLInputElement>;
47
+ /**
48
+ * 内部の入力欄(`<input>`)に渡す属性。onFocus / onBlur / onKeyDown 等の入力欄だけのイベントや
49
+ * autoComplete・data-* に使う(その他の props は従来どおりグループの div に付く)。
50
+ * onFocus / onBlur は部品内部の処理(編集開始・値の確定)の後に呼ぶ。onKeyDown は部品のキー処理
51
+ * (Enter で確定・矢印キーで増減)の前に呼び、preventDefault するとそれを止める。
52
+ * 値・id・name・aria・disabled は部品が管理するため渡せない
53
+ */
54
+ inputProps?: NumberInputInputProps;
36
55
  /**
37
56
  * 入力欄・増減ボタンの読み上げラベル。既定はカート数量向けの「数量」。
38
57
  * 価格・在庫など数量以外に使うときは必ず指定する(例: "販売価格")。
@@ -84,7 +103,7 @@ export interface NumberInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
84
103
  * 同じものを探した人が見つけられず別実装が生まれた。機能名に改名し、
85
104
  * 旧名は deprecated alias として残している。
86
105
  */
87
- declare function NumberInput({ className, value, defaultValue, min, max, step, onChange, disabled, error, size, editable, showTrash, onDelete, formatOptions, locale, inputId, label: labelProp, ...props }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
106
+ declare function NumberInput({ className, value, defaultValue, min, max, step, onChange, disabled, error, size, editable, showTrash, onDelete, formatOptions, locale, inputId, name, inputRef, inputProps, label: labelProp, ...props }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
88
107
  export { NumberInput };
89
108
  /**
90
109
  * @deprecated 用途名(カート数量)ではなく機能名の `NumberInput` を使ってください。
@@ -21,7 +21,7 @@ export interface ProgressStepsProps extends React.HTMLAttributes<HTMLDivElement>
21
21
  * - チェックアウト・会員登録など段階フロー画面で使用
22
22
  * - `currentStep` で現在のステップをハイライト
23
23
  * - 完了済みステップにはチェックマークアイコン
24
- * - アクティブ/完了: Brand-Cake-Orange、未到達: Surface-Tertiary
24
+ * - アクティブ/完了: Brand-Cake-Orange、未到達: Surface-Neutral-Tertiary
25
25
  */
26
26
  declare function ProgressSteps({ className, steps, currentStep, showCheckmark, ...props }: ProgressStepsProps): import("react/jsx-runtime").JSX.Element;
27
27
  export { ProgressSteps };
@@ -34,7 +34,7 @@ export interface SectionProps extends Omit<React.ComponentProps<"section">, "bac
34
34
  * `--card-surface: var(--Surface-Primary)` を配下に流すことで、**Section 配下の Card は
35
35
  * `surface` 未指定でも白**になる(`Card surface="primary"` の明示指定は従来通り優先)。
36
36
  *
37
- * 「グレー地の上の Card は白」を**構造で**保証するのが狙いで、あとからカードを足しても
37
+ * 「色地の上の Card は白」を**構造で**保証するのが狙いで、あとからカードを足しても
38
38
  * prop の付け忘れが起きない。伝播は CSS カスタムプロパティのカスケードのみで、React context は
39
39
  * 使わない(Server Component のまま使える/DS 外の要素は影響を受けない)。
40
40
  *
@@ -61,8 +61,8 @@ export interface WorkspaceShellProps {
61
61
  * - ヘッダーは既存 `Header`(variant="back")を使う。左上=戻る導線、
62
62
  * 右上=`primaryAction`(ワークスペース全体の上位アクションがある場合のみ)。
63
63
  * - `sectionNav` は編集内ナビのみ。グロナビは置かない。
64
- * - `sectionNav` は Surface-Secondary から浮いた独立パネルとして、シェル側で角丸パネルにラップされる。
65
- * - 地が Surface-Secondary なので、配下 `Card` の既定サーフェスを白にする文脈
64
+ * - `sectionNav` は Surface-Neutral-Secondary から浮いた独立パネルとして、シェル側で角丸パネルにラップされる。
65
+ * - 地が Surface-Neutral-Secondary なので、配下 `Card` の既定サーフェスを白にする文脈
66
66
  * (`--card-surface`)をシェルが宣言する。`Card` は `surface` 未指定のまま地から浮く(#150)。
67
67
  * - 標準的な編集は `AdminShell`(Standard Page(Edit)/旧 Form Page)。複雑・集中編集・没入執筆のみ本コンポーネント。
68
68
  *
@@ -3,7 +3,6 @@ export { cn } from "./lib/utils";
3
3
  export { FOCUS_RING, FOCUS_RING_WITHIN, FOCUS_RING_INSET, FOCUS_RING_ONLY } from "./lib/focus-ring";
4
4
  export { FORCED_COLORS_FOCUS, FORCED_COLORS_FOCUS_WITHIN, FORCED_COLORS_FOCUS_INSET, FORCED_COLORS_MENU_ITEM, FORCED_COLORS_COMMAND_ITEM, } from "./lib/focus-ring";
5
5
  export type { LinkComponent } from "./lib/link-component";
6
- export { toast } from "sonner";
7
6
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./components/foundations/accordion";
8
7
  export { Alert, AlertDescription, AlertTitle } from "./components/foundations/alert";
9
8
  export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/foundations/alert-dialog";
@@ -30,7 +29,7 @@ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, Di
30
29
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from "./components/foundations/drawer";
31
30
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/foundations/dropdown-menu";
32
31
  export { Field, FieldLabel, FieldSet, FieldLegend, FieldGroup, FieldDescription, FieldError, FieldSeparator, fieldVariants } from "./components/foundations/field";
33
- export type { FieldProps } from "./components/foundations/field";
32
+ export type { FieldProps, FieldSetGap } from "./components/foundations/field";
34
33
  export { FileInput, formatFileNames, validateFileSize } from "./components/foundations/file-input";
35
34
  export type { FileInputProps, FileInputError } from "./components/foundations/file-input";
36
35
  export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./components/foundations/form";
@@ -65,7 +64,7 @@ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, Tabl
65
64
  export { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/foundations/tabs";
66
65
  export { Textarea } from "./components/foundations/textarea";
67
66
  export type { TextareaProps } from "./components/foundations/textarea";
68
- export { Toaster } from "./components/foundations/sonner";
67
+ export { Toaster, toast } from "./components/foundations/sonner";
69
68
  export { Toggle, toggleVariants } from "./components/foundations/toggle";
70
69
  export { ToggleGroup, ToggleGroupItem } from "./components/foundations/toggle-group";
71
70
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/foundations/tooltip";
@@ -153,7 +152,7 @@ export type { ProgressStepsProps } from "./components/primitives/progress-steps"
153
152
  export { Timeline } from "./components/primitives/timeline";
154
153
  export type { TimelineItem, TimelineProps } from "./components/primitives/timeline";
155
154
  export { NumberInput, QuantitySelector } from "./components/primitives/number-input";
156
- export type { NumberInputProps, QuantitySelectorProps } from "./components/primitives/number-input";
155
+ export type { NumberInputProps, NumberInputInputProps, QuantitySelectorProps } from "./components/primitives/number-input";
157
156
  export { SearchBar } from "./components/primitives/search-bar";
158
157
  export type { SearchBarProps } from "./components/primitives/search-bar";
159
158
  export { SearchPanel } from "./components/primitives/search-panel";
@@ -0,0 +1,52 @@
1
+ import * as React from "react";
2
+ /**
3
+ * オーバーレイ(Dialog / Sheet / AlertDialog / Drawer)を閉じたときに、その回に開く直前に
4
+ * フォーカスがあった要素(opener)へフォーカスを戻す共通処理。
5
+ *
6
+ * Radix の既定は「Trigger へ戻す」だけなので、Trigger を使わず state で開く使い方
7
+ * (一覧の行のボタンから 1 つのダイアログを開く等)では閉じたあとのフォーカスが body に落ちる。
8
+ *
9
+ * - 記録は開くたびに上書きし、閉じるときに取り出して空に戻す(開閉をまたいで古い opener を残さない)
10
+ * - opener が DOM から消えている・disabled・inert の中・body のときは戻さず、Radix の既定に任せる
11
+ * (Safari / iOS はクリックでボタンにフォーカスが乗らないため、body が記録されることがある)
12
+ * - consumer の `onCloseAutoFocus` を先に呼び、`preventDefault()` されたら何もしない
13
+ * - 閉じた時点でフォーカスが body 以外(非モーダルで外側の要素を押した等)にあるなら奪わない
14
+ * - 戻すときは `preventScroll: true`(画面外の行へ一覧がスクロールで飛ばないように)
15
+ */
16
+ /** opener へ戻してよいか(DOM 上にあり、disabled / inert ではなく、body / html でない)。 */
17
+ export declare function canRestoreFocusTo(el: Element | null | undefined): el is HTMLElement;
18
+ /**
19
+ * Root 部品(Dialog / Sheet / AlertDialog)が持つ、開閉 1 回分の記録。
20
+ * opener を Content ごとではなく Root 側に置くことで、開いたまま consumer が Content を
21
+ * 作り直した(key の変更など)ときも記録を引き継ぐ。
22
+ */
23
+ export interface OverlayFocusRoot {
24
+ openerRef: React.RefObject<HTMLElement | null>;
25
+ /** 今開いているか(controlled なら open、uncontrolled なら onOpenChange で追う)。 */
26
+ isOpen: () => boolean;
27
+ /** Content のマウント中に数える。0 なら Content ごと外された(閉じたのと同じ扱い)。 */
28
+ registerContent: () => () => void;
29
+ hasContent: () => boolean;
30
+ }
31
+ /**
32
+ * Content が読む Root の記録。Drawer のように Root 側の記録を持たない部品は null を流して、
33
+ * 外側の Dialog などの記録を誤って使わないようにする。
34
+ */
35
+ export declare const OverlayFocusRootContext: React.Context<OverlayFocusRoot>;
36
+ /**
37
+ * Root 部品で使う。開閉状態を追い、Content へ流す記録と、Radix Root へ渡す `onOpenChange` を返す。
38
+ */
39
+ export declare function useOverlayFocusRoot(open: boolean | undefined, defaultOpen: boolean | undefined, onOpenChange: ((open: boolean) => void) | undefined): {
40
+ root: OverlayFocusRoot;
41
+ handleOpenChange: (open: boolean) => void;
42
+ };
43
+ interface AutoFocusHandlers {
44
+ onOpenAutoFocus?: (event: Event) => void;
45
+ onCloseAutoFocus?: (event: Event) => void;
46
+ }
47
+ /**
48
+ * Content 部品で使う。consumer の `onOpenAutoFocus` / `onCloseAutoFocus` を合成した
49
+ * ハンドラーを返す。Radix の Content にそのまま渡す。
50
+ */
51
+ export declare function useRestoreFocusToOpener({ onOpenAutoFocus, onCloseAutoFocus, }: AutoFocusHandlers): Required<AutoFocusHandlers>;
52
+ export {};
@@ -79,6 +79,9 @@ export declare const FOCUS_RING: string;
79
79
  * ラッパーが枠を描き、内側の要素がフォーカスを受け取る合成コントロール用
80
80
  * (SearchBar の枠、FileInput の label 等)。
81
81
  *
82
+ * リングの色は {@link FOCUS_RING} と同じ(既定は緑の 50% 透過、高コントラストのときだけ
83
+ * `--Focus-Ring-Control` の不透明な緑に切り替わる)。
84
+ *
82
85
  * hover で同じプロパティを変える場合は `hover:not-focus-within:*` で書くこと。
83
86
  *
84
87
  * @example