@cakejp/design-system 0.20.0 → 0.21.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 (161) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/CLAUDE.md +5 -3
  3. package/MIGRATION.md +3 -3
  4. package/README.md +31 -11
  5. package/contracts/components.json +424 -62
  6. package/contracts/composition.json +38 -4
  7. package/contracts/rules.json +27 -5
  8. package/contracts/screen-patterns.json +6 -4
  9. package/dist/components/ec/admin-shell.js +62 -60
  10. package/dist/components/ec/anniversary-card.js +13 -12
  11. package/dist/components/ec/coupon-card.js +11 -11
  12. package/dist/components/ec/delivery-calendar.js +51 -45
  13. package/dist/components/ec/mypage-shell.js +80 -69
  14. package/dist/components/ec/product-card.js +93 -76
  15. package/dist/components/ec/product-carousel.js +65 -60
  16. package/dist/components/ec/product-detail-bar.js +13 -11
  17. package/dist/components/ec/product-detail-sidebar.js +60 -58
  18. package/dist/components/ec/product-list-item.js +64 -63
  19. package/dist/components/ec/product-option.js +30 -26
  20. package/dist/components/ec/rating-stars.js +27 -27
  21. package/dist/components/ec/review-card.js +32 -32
  22. package/dist/components/ec/review-form.js +37 -37
  23. package/dist/components/ec/shop-card.js +21 -19
  24. package/dist/components/foundations/accordion.js +33 -31
  25. package/dist/components/foundations/alert-dialog.js +4 -5
  26. package/dist/components/foundations/badge.js +5 -5
  27. package/dist/components/foundations/breadcrumb.js +27 -26
  28. package/dist/components/foundations/button.js +144 -25
  29. package/dist/components/foundations/calendar.js +28 -26
  30. package/dist/components/foundations/checkbox-card.js +71 -47
  31. package/dist/components/foundations/checkbox-group.js +30 -27
  32. package/dist/components/foundations/checkbox.js +69 -52
  33. package/dist/components/foundations/chip-variants.js +13 -0
  34. package/dist/components/foundations/command.js +81 -79
  35. package/dist/components/foundations/confirm-dialog.js +136 -0
  36. package/dist/components/foundations/context-menu.js +43 -38
  37. package/dist/components/foundations/data-table.js +88 -84
  38. package/dist/components/foundations/dialog.js +45 -36
  39. package/dist/components/foundations/dropdown-menu.js +47 -42
  40. package/dist/components/foundations/file-input.js +97 -67
  41. package/dist/components/foundations/hover-card.js +21 -21
  42. package/dist/components/foundations/menubar.js +75 -69
  43. package/dist/components/foundations/navigation-menu.js +31 -26
  44. package/dist/components/foundations/pagination.js +54 -50
  45. package/dist/components/foundations/popover.js +7 -7
  46. package/dist/components/foundations/progress.js +10 -6
  47. package/dist/components/foundations/radio-group.js +6 -3
  48. package/dist/components/foundations/responsive-dialog.js +73 -55
  49. package/dist/components/foundations/scroll-area.js +18 -14
  50. package/dist/components/foundations/select.js +44 -39
  51. package/dist/components/foundations/sheet.js +45 -37
  52. package/dist/components/foundations/skeleton.js +6 -6
  53. package/dist/components/foundations/skip-link.js +10 -8
  54. package/dist/components/foundations/slider.js +73 -48
  55. package/dist/components/foundations/sonner.js +5 -4
  56. package/dist/components/foundations/spinner.js +7 -5
  57. package/dist/components/foundations/switch.js +11 -10
  58. package/dist/components/foundations/tabs.js +54 -39
  59. package/dist/components/foundations/toggle-group.js +29 -21
  60. package/dist/components/foundations/toggle.js +20 -16
  61. package/dist/components/primitives/admin-side-nav.js +65 -62
  62. package/dist/components/primitives/banner-carousel.js +32 -29
  63. package/dist/components/primitives/bottom-tab-bar.js +16 -15
  64. package/dist/components/primitives/category-scroll.js +39 -29
  65. package/dist/components/primitives/category-shortcuts.js +9 -9
  66. package/dist/components/primitives/chat-composer.js +77 -74
  67. package/dist/components/primitives/chip.js +84 -61
  68. package/dist/components/primitives/combobox.js +63 -47
  69. package/dist/components/primitives/container.js +9 -9
  70. package/dist/components/primitives/content-card.js +15 -17
  71. package/dist/components/primitives/content-carousel.js +79 -68
  72. package/dist/components/primitives/date-picker.js +137 -99
  73. package/dist/components/primitives/footer.js +36 -37
  74. package/dist/components/primitives/header.js +175 -168
  75. package/dist/components/primitives/image-carousel.js +107 -87
  76. package/dist/components/primitives/image-gallery.js +32 -27
  77. package/dist/components/primitives/image-uploader.js +43 -22
  78. package/dist/components/primitives/list-item.js +59 -51
  79. package/dist/components/primitives/menu-drawer.js +36 -38
  80. package/dist/components/primitives/multi-select.js +89 -58
  81. package/dist/components/primitives/notification-list.js +10 -9
  82. package/dist/components/primitives/number-input.js +116 -105
  83. package/dist/components/primitives/scroll-row.js +21 -0
  84. package/dist/components/primitives/search-bar.js +31 -28
  85. package/dist/components/primitives/section-header.js +54 -53
  86. package/dist/components/primitives/side-nav.js +57 -56
  87. package/dist/components/primitives/sub-nav.js +13 -14
  88. package/dist/components/primitives/tag.js +4 -2
  89. package/dist/index.css +1 -1
  90. package/dist/index.js +3076 -929
  91. package/dist/lib/field-labelling.js +31 -21
  92. package/dist/lib/focus-ring.js +22 -4
  93. package/dist/lib/high-contrast.js +4 -0
  94. package/dist/lib/image-index.js +8 -0
  95. package/dist/lib/use-prefers-reduced-motion.js +21 -0
  96. package/dist/types/components/ec/admin-shell.d.ts +11 -1
  97. package/dist/types/components/ec/anniversary-card.d.ts +9 -1
  98. package/dist/types/components/ec/mypage-shell.d.ts +12 -1
  99. package/dist/types/components/ec/product-card.d.ts +13 -1
  100. package/dist/types/components/ec/product-carousel.d.ts +13 -1
  101. package/dist/types/components/ec/product-detail-bar.d.ts +12 -1
  102. package/dist/types/components/ec/product-detail-sidebar.d.ts +11 -1
  103. package/dist/types/components/ec/product-list-item.d.ts +9 -1
  104. package/dist/types/components/ec/rating-stars.d.ts +2 -0
  105. package/dist/types/components/ec/review-card.d.ts +1 -1
  106. package/dist/types/components/ec/shop-card.d.ts +8 -1
  107. package/dist/types/components/foundations/badge.d.ts +1 -1
  108. package/dist/types/components/foundations/breadcrumb.d.ts +8 -1
  109. package/dist/types/components/foundations/button.d.ts +38 -3
  110. package/dist/types/components/foundations/checkbox-card.d.ts +7 -1
  111. package/dist/types/components/foundations/checkbox.d.ts +1 -1
  112. package/dist/types/components/foundations/chip-variants.d.ts +2 -2
  113. package/dist/types/components/foundations/confirm-dialog.d.ts +61 -0
  114. package/dist/types/components/foundations/data-table.d.ts +9 -2
  115. package/dist/types/components/foundations/dialog.d.ts +16 -1
  116. package/dist/types/components/foundations/pagination.d.ts +1 -1
  117. package/dist/types/components/foundations/responsive-dialog.d.ts +2 -1
  118. package/dist/types/components/foundations/sheet.d.ts +12 -1
  119. package/dist/types/components/foundations/skeleton.d.ts +6 -0
  120. package/dist/types/components/foundations/slider.d.ts +15 -1
  121. package/dist/types/components/foundations/tabs.d.ts +7 -0
  122. package/dist/types/components/primitives/admin-side-nav.d.ts +22 -2
  123. package/dist/types/components/primitives/banner-carousel.d.ts +9 -1
  124. package/dist/types/components/primitives/bottom-tab-bar.d.ts +13 -2
  125. package/dist/types/components/primitives/category-scroll.d.ts +10 -1
  126. package/dist/types/components/primitives/category-shortcuts.d.ts +11 -2
  127. package/dist/types/components/primitives/chip.d.ts +22 -3
  128. package/dist/types/components/primitives/combobox.d.ts +7 -2
  129. package/dist/types/components/primitives/container.d.ts +3 -0
  130. package/dist/types/components/primitives/content-card.d.ts +1 -1
  131. package/dist/types/components/primitives/content-carousel.d.ts +12 -4
  132. package/dist/types/components/primitives/date-picker.d.ts +10 -3
  133. package/dist/types/components/primitives/footer.d.ts +1 -1
  134. package/dist/types/components/primitives/header.d.ts +14 -2
  135. package/dist/types/components/primitives/image-carousel.d.ts +23 -5
  136. package/dist/types/components/primitives/list-item.d.ts +10 -1
  137. package/dist/types/components/primitives/menu-drawer.d.ts +1 -1
  138. package/dist/types/components/primitives/multi-select.d.ts +7 -2
  139. package/dist/types/components/primitives/notification-list.d.ts +10 -1
  140. package/dist/types/components/primitives/number-input.d.ts +18 -5
  141. package/dist/types/components/primitives/scroll-row.d.ts +43 -0
  142. package/dist/types/components/primitives/section-header.d.ts +9 -2
  143. package/dist/types/components/primitives/side-nav.d.ts +13 -1
  144. package/dist/types/components/primitives/sub-nav.d.ts +1 -1
  145. package/dist/types/components/primitives/tag.d.ts +1 -1
  146. package/dist/types/index.d.ts +7 -1
  147. package/dist/types/lib/field-labelling.d.ts +23 -8
  148. package/dist/types/lib/focus-ring.d.ts +70 -3
  149. package/dist/types/lib/high-contrast.d.ts +25 -0
  150. package/dist/types/lib/image-index.d.ts +2 -0
  151. package/dist/types/lib/link-component.d.ts +26 -21
  152. package/dist/types/lib/use-prefers-reduced-motion.d.ts +9 -0
  153. package/package.json +11 -3
  154. package/src/components/COMPONENT_LOOKUP.md +19 -17
  155. package/src/preset-standalone.css +42 -0
  156. package/src/preset.css +20 -1
  157. package/src/styles/semantic.css +57 -0
  158. package/templates/AGENTS.md +5 -1
  159. package/templates/CLAUDE.md +3 -1
  160. package/tokens.json +49 -0
  161. package/dist/lib/link-component.js +0 -6
@@ -14,6 +14,7 @@
14
14
  * | notifications | NotificationItem[] | — | 通知アイテム |
15
15
  * | variant | "vertical"\|"horizontal" | "vertical" | レイアウト |
16
16
  * | emptyMessage | string | — | 空の場合のメッセージ |
17
+ * | linkComponent | LinkComponent | "a" | リンクの描画に使うコンポーネント(next/link 等) |
17
18
  *
18
19
  * ### AI 向け使用ルール
19
20
  * - `vertical`: フロントの通知モーダル等(未読ドット + メッセージ上 + 日付下)
@@ -21,6 +22,7 @@
21
22
  * - 空の場合はベルアイコン + メッセージ表示
22
23
  */
23
24
  import * as React from "react";
25
+ import type { LinkComponent } from "../../lib/link-component";
24
26
  export interface NotificationItem {
25
27
  /** 通知ID */
26
28
  id: string;
@@ -40,6 +42,13 @@ export interface NotificationListProps extends React.HTMLAttributes<HTMLDivEleme
40
42
  variant?: "vertical" | "horizontal";
41
43
  /** 空の場合のメッセージ */
42
44
  emptyMessage?: string;
45
+ /**
46
+ * リンクの描画に使うコンポーネント(既定 `a`)。`href` を持つ通知だけが対象で、
47
+ * `href` の無い通知は従来どおり `<div>`。
48
+ * `next/link` 等を渡すとクライアント遷移になる(#236)。
49
+ * この部品は Server Component のまま使える。
50
+ */
51
+ linkComponent?: LinkComponent;
43
52
  }
44
- declare function NotificationList({ notifications, variant, emptyMessage, className, ...props }: NotificationListProps): import("react/jsx-runtime").JSX.Element;
53
+ declare function NotificationList({ notifications, variant, emptyMessage, linkComponent, className, ...props }: NotificationListProps): import("react/jsx-runtime").JSX.Element;
45
54
  export { NotificationList };
@@ -14,7 +14,10 @@ export interface NumberInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
14
14
  onChange?: (value: number) => void;
15
15
  /** 無効状態 */
16
16
  disabled?: boolean;
17
- /** エラー状態 */
17
+ /**
18
+ * エラー状態。見た目の赤枠に加えて、入力欄に aria-invalid を付ける。
19
+ * FormField 配下では FormField の error があると自動で true(明示指定が優先)
20
+ */
18
21
  error?: boolean;
19
22
  /** サイズ(md = Pattern 2 サークル / sm = Pattern 1 ピル) */
20
23
  size?: "sm" | "md";
@@ -28,11 +31,13 @@ export interface NumberInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
28
31
  formatOptions?: Intl.NumberFormatOptions;
29
32
  /** formatOptions のロケール */
30
33
  locale?: string;
31
- /** 入力欄の id。FormField / FieldLabel の htmlFor と揃える */
34
+ /** 入力欄の id。FormField 配下では未指定でも FormField の htmlFor と同じ id になる */
32
35
  inputId?: string;
33
36
  /**
34
37
  * 入力欄・増減ボタンの読み上げラベル。既定はカート数量向けの「数量」。
35
- * 価格・在庫など数量以外に使うときは必ず指定する(例: "販売価格")
38
+ * 価格・在庫など数量以外に使うときは必ず指定する(例: "販売価格")。
39
+ * FormField 配下で未指定のときは FormField のラベルが名前になる
40
+ * (入力欄・グループ = ラベル、増減ボタン = 「ラベル 減らす / 増やす」)
36
41
  */
37
42
  label?: string;
38
43
  }
@@ -54,7 +59,15 @@ export interface NumberInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
54
59
  *
55
60
  * ### ステート
56
61
  * - `disabled`: 全要素のテキスト/アイコンが `Text/Disable` (#B7B5B4)
57
- * - `error`: コンパクト型は赤枠(2px)、サークル型は数値コンテナが赤枠
62
+ * - `error`: コンパクト型は赤枠(2px)、サークル型は数値コンテナが赤枠。入力欄に `aria-invalid` が付く
63
+ *
64
+ * ### FormField との組み合わせ
65
+ * FormField の children に置くと、入力欄が id(label の htmlFor と一致)・aria-describedby
66
+ * (説明・エラー文)・エラー状態(FormField の error)を受け取る。`label` を指定しなければ
67
+ * 名前も FormField のラベルになる。FormField の外の DOM は変わらない。
68
+ * - 上限・下限: 対応するボタンは `aria-disabled`(native の `disabled` にしない)。
69
+ * native で無効化すると、押した直後にボタンがフォーカスを失って body に落ちるため。
70
+ * 部品全体の `disabled` は従来どおり native の `disabled`(Tab 順から外す)
58
71
  * - `showTrash`: 値が min のとき − がゴミ箱アイコンに変化
59
72
  *
60
73
  * ### AI 向け使用ルール
@@ -71,7 +84,7 @@ export interface NumberInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
71
84
  * 同じものを探した人が見つけられず別実装が生まれた。機能名に改名し、
72
85
  * 旧名は deprecated alias として残している。
73
86
  */
74
- declare function NumberInput({ className, value, defaultValue, min, max, step, onChange, disabled, error, size, editable, showTrash, onDelete, formatOptions, locale, inputId, label, ...props }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
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;
75
88
  export { NumberInput };
76
89
  /**
77
90
  * @deprecated 用途名(カート数量)ではなく機能名の `NumberInput` を使ってください。
@@ -0,0 +1,43 @@
1
+ import * as React from "react";
2
+ export interface ScrollRowProps extends React.ComponentProps<"div"> {
3
+ /**
4
+ * `Container` の gutter 分だけ左右へはみ出し、Container の外縁(SP では画面端)までスクロールさせる(既定 true)。
5
+ * 端の余白(padding / scroll-padding)は gutter と同じなので、1 枚目の左端は見出しとそろう。
6
+ * PC でも同じ(gutter 24px の中までスクロールする)。`Container` の外に置いたときは何も起きない(はみ出し・余白とも 0)。
7
+ * 余白を持つ親(Card 等)の中に置くときは false にする。
8
+ */
9
+ bleed?: boolean;
10
+ /** 子要素の左端でスナップさせる。スナップ後も端の余白を保つ */
11
+ snap?: boolean;
12
+ }
13
+ /**
14
+ * ScrollRow — 横スクロールの行
15
+ *
16
+ * カード・絵柄・タグなどを横 1 列に並べて横スクロールさせる薄いレイアウト primitive。
17
+ * `Container` の中に置くと、Container の gutter(CSS 変数 `--Container-Gutter`)を読んで
18
+ * 「外へはみ出す + 同じ幅の端の余白 + 同じ幅の scroll-padding」を付ける。
19
+ * 画面ごとに `-mx-4 px-4 scroll-px-4` を手で当てる必要が無く、gutter が変わる幅(md 以上 24px)や
20
+ * `gutter="tight"` にも自動で追従する。
21
+ *
22
+ * - 子要素は縮まない(`shrink-0`)。幅は子要素側で決める(`snap` 時の `snap-start` も含め、子の class より優先される)
23
+ * - 間隔は 12px(`gap-3`)。変えるときは `className` で上書きする
24
+ * - 上下に 4px の余白を持ち、同じだけ負のマージンで打ち消す(高さは子要素と同じ)。横スクロールの行は
25
+ * 上下にもはみ出しを切り取るため、子のフォーカスリングが切れないようにする
26
+ * - カテゴリ(丸いアイコン+名前)の列は `CategoryScroll`、自動再生・ドット付きのバナーは
27
+ * `ContentCarousel` を使う
28
+ *
29
+ * ### インポート
30
+ * ```tsx
31
+ * import { ScrollRow } from '../../components/primitives/scroll-row'
32
+ * ```
33
+ *
34
+ * ### AI 向け使用ルール
35
+ *
36
+ * - `Container` の直下(左右の余白を足さない親の中)に置く。外側に `-mx-*` を足さない(二重にはみ出す)
37
+ * - Card など余白を持つ親の中、または Container の `className` で左右の余白を変えた中では `bleed={false}`。
38
+ * gutter の変数は Container の子孫すべてに届くため、そのままだと gutter 分はみ出す
39
+ * - 端の余白をやめたいときは `className="px-0"` ではなく `bleed={false}` を使う
40
+ * - 中にリンクやボタンが無い(キーボードで届かない)なら、`tabIndex={0}`・`role="region"`・`aria-label` を渡す
41
+ */
42
+ declare function ScrollRow({ bleed, snap, className, ...props }: ScrollRowProps): import("react/jsx-runtime").JSX.Element;
43
+ export { ScrollRow };
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import type { LinkComponent } from "../../lib/link-component";
2
3
  export type SectionHeaderSize = "3xl" | "2xl" | "xl" | "lg" | "md" | "sm";
3
4
  export type SectionHeaderDesktopSize = "5xl" | "4xl";
4
5
  export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -38,6 +39,12 @@ export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
38
39
  align?: "start" | "center";
39
40
  /** タイトルの上に置くスロット(Badge 等の eyebrow ラベル)。中央寄せ見出しで特に有用。 */
40
41
  eyebrow?: React.ReactNode;
42
+ /**
43
+ * `moreHref` のリンク(タイトル行のリンクと「もっと見る」)の描画に使うコンポーネント(既定 `a`)。
44
+ * `next/link` 等を渡すとクライアント遷移になる(#236)。
45
+ * この部品は Server Component のまま使える。
46
+ */
47
+ linkComponent?: LinkComponent;
41
48
  }
42
49
  /**
43
50
  * セクションヘッダーコンポーネント
@@ -48,7 +55,7 @@ export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
48
55
  * Figma準拠:
49
56
  * - 6段階のサイズ(3xl〜sm)で見出し階層を表現
50
57
  * - タイトル行: タイトル(左)+ もっと見る(右)を items-baseline で配置
51
- * - もっと見る: Bold 14px、オレンジ(accent-primary)
58
+ * - もっと見る: typo-label-lg、グレー(Text-Medium-Emphasis)+ 常時下線(ブランド色は使わない。hover で濃いグレー)
52
59
  * - キャプション: 3xl〜lg は 16px / md〜sm は 14px
53
60
  *
54
61
  * ### AI 向け使用ルール
@@ -63,5 +70,5 @@ export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
63
70
  * - `action` に任意の ReactNode(Button 等)を渡して右側にアクションを配置可能
64
71
  * - `align="center"` でランディング/ガイド系の中央寄せ大見出しに切替(`eyebrow` に Badge 等を載せられる)
65
72
  */
66
- declare function SectionHeader({ className, title, subtitle, moreHref, moreLabel, onMoreClick, action, onPrev, onNext, prevDisabled, nextDisabled, size, desktopSize, as, align, eyebrow, ...props }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
73
+ declare function SectionHeader({ className, title, subtitle, moreHref, moreLabel, onMoreClick, action, onPrev, onNext, prevDisabled, nextDisabled, size, desktopSize, as, align, eyebrow, linkComponent, ...props }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
67
74
  export { SectionHeader };
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import type { LinkComponent } from "../../lib/link-component";
2
3
  export interface SideNavItem {
3
4
  /** Lucide / iconsax アイコン等の ReactNode */
4
5
  icon: React.ReactNode;
@@ -42,6 +43,12 @@ export interface SideNavProps extends React.HTMLAttributes<HTMLElement> {
42
43
  groups: SideNavGroup[];
43
44
  /** aria-label */
44
45
  ariaLabel?: string;
46
+ /**
47
+ * リンクの描画に使うコンポーネント(既定 `a`)。
48
+ * `next/link` 等を渡すとクライアント遷移になる(#236)。
49
+ * 項目の `onClick`(`storyId` 指定時の遷移の差し替え)と `aria-current` は linkComponent 経由でも保たれる。
50
+ */
51
+ linkComponent?: LinkComponent;
45
52
  }
46
53
  /**
47
54
  * サイドナビゲーション
@@ -78,6 +85,11 @@ export interface SideNavProps extends React.HTMLAttributes<HTMLElement> {
78
85
  * | activeMatch | "exact" \| "prefix" | "exact" | currentPath の照合方法。prefix は配下ページ全体でアクティブ |
79
86
  * | isActive | (item) => boolean | — | アクティブ判定を上書きする述語(最優先) |
80
87
  * | ariaLabel | string | "サイドメニュー" | aria-label |
88
+ * | linkComponent | LinkComponent | "a" | リンクの描画に使うコンポーネント(next/link 等) |
89
+ *
90
+ * 全項目の `<a>` に `onClick`(`storyId` 指定時の遷移の差し替え)を付けるため、React Server Components
91
+ * では Server Component から描けない(`Event handlers cannot be passed to Client Component props` で落ちる)。
92
+ * Next.js App Router では呼び出し側のファイルを `"use client"` にする(`linkComponent` の有無によらない)。
81
93
  */
82
- declare function SideNav({ activeMenu, currentPath, activeMatch, isActive, groups, ariaLabel, className, ...props }: SideNavProps): import("react/jsx-runtime").JSX.Element;
94
+ declare function SideNav({ activeMenu, currentPath, activeMatch, isActive, groups, ariaLabel, linkComponent, className, ...props }: SideNavProps): import("react/jsx-runtime").JSX.Element;
83
95
  export { SideNav };
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { type LinkComponent } from "../../lib/link-component";
2
+ import type { LinkComponent } from "../../lib/link-component";
3
3
  export interface SubNavItem {
4
4
  /** 表示ラベル */
5
5
  label: string;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const tagVariants: (props?: {
4
- variant?: "accent" | "default" | "success" | "info" | "warning" | "caution" | "sale" | "info-fill" | "timesale" | "berry" | "coupon";
4
+ variant?: "accent" | "image" | "default" | "success" | "info" | "warning" | "caution" | "sale" | "info-fill" | "timesale" | "berry" | "coupon";
5
5
  size?: "sm" | "md";
6
6
  } & import("class-variance-authority/types").ClassProp) => string;
7
7
  export interface TagProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof tagVariants> {
@@ -1,6 +1,8 @@
1
1
  import "./index.css";
2
2
  export { cn } from "./lib/utils";
3
- export { FOCUS_RING, FOCUS_RING_WITHIN, FOCUS_RING_INSET } from "./lib/focus-ring";
3
+ export { FOCUS_RING, FOCUS_RING_WITHIN, FOCUS_RING_INSET, FOCUS_RING_ONLY } from "./lib/focus-ring";
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
+ export type { LinkComponent } from "./lib/link-component";
4
6
  export { toast } from "sonner";
5
7
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./components/foundations/accordion";
6
8
  export { Alert, AlertDescription, AlertTitle } from "./components/foundations/alert";
@@ -19,6 +21,8 @@ export { CheckboxGroup, CheckboxGroupItem } from "./components/foundations/check
19
21
  export type { CheckboxGroupProps } from "./components/foundations/checkbox-group";
20
22
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/foundations/collapsible";
21
23
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "./components/foundations/command";
24
+ export { ConfirmDialogProvider, useConfirm } from "./components/foundations/confirm-dialog";
25
+ export type { ConfirmDialogProviderProps, ConfirmFn, ConfirmOptions } from "./components/foundations/confirm-dialog";
22
26
  export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from "./components/foundations/context-menu";
23
27
  export { DataTable, DataTableTable, DataTableHeader, DataTableBody, DataTableRow, DataTableHead, DataTableCell, DataTableAvatarCell, DataTableImageCell, DataTableLinkCell, DataTableCheckboxCell, DataTableActionCell, DataTableInputCell, DataTableSelectCell, DataTableNumberCell, DataTableDragHandleCell, DataTableBulkActions, DataTableSectionRow, DataTableAddRow, DataTableEmptyState, } from "./components/foundations/data-table";
24
28
  export type { SortDirection } from "./components/foundations/data-table";
@@ -155,6 +159,8 @@ export type { SearchBarProps } from "./components/primitives/search-bar";
155
159
  export { SearchPanel } from "./components/primitives/search-panel";
156
160
  export type { SearchPanelProps } from "./components/primitives/search-panel";
157
161
  export { Container, containerVariants } from "./components/primitives/container";
162
+ export { ScrollRow } from "./components/primitives/scroll-row";
163
+ export type { ScrollRowProps } from "./components/primitives/scroll-row";
158
164
  export { Section, sectionVariants, sectionScrimVariants } from "./components/primitives/section";
159
165
  export type { SectionProps, SectionScrim } from "./components/primitives/section";
160
166
  export { SectionHeader } from "./components/primitives/section-header";
@@ -2,9 +2,8 @@
2
2
  * ## フィールドのラベル関連付け(DS 全体の方針 / issue #202)
3
3
  *
4
4
  * Radix ベースのコントロール(Select / Switch / Checkbox / Slider 等)は
5
- * `<button>` や `<span role="...">` として描画されるため、**隣に `<Label htmlFor>` を
6
- * 置いてもアクセシブルネームにならない**(`<label for>` が名前を与えるのは
7
- * labelable な要素だけで、`<button>` は対象外)。
5
+ * `<button>` や `<span role="...">` として描画される。単一フィールドは context の
6
+ * `aria-labelledby`、複数選択肢は各コントロールの native label または明示的な ARIA 名を使う。
8
7
  *
9
8
  * そこで DS は次の方針を採る:
10
9
  *
@@ -13,6 +12,8 @@
13
12
  * 2. コントロール側は `aria-labelledby` を **既定値として** その id にする。
14
13
  * 利用側が `aria-label` / `aria-labelledby` を明示した場合はそちらを優先する。
15
14
  * 3. ラッパー無しで単体利用するときは、利用側が `aria-label`(日本語)を書く。
15
+ * 4. ラッパーの説明・エラーは `aria-describedby` に、エラーの有無は `aria-invalid` に載せる。
16
+ * `aria-describedby` は利用側の指定と **連結** し、`aria-invalid` は利用側の明示値を優先する。
16
17
  *
17
18
  * `<label for>` が有効なネイティブ入力(Input / Textarea)は従来どおり
18
19
  * `htmlFor` ↔ `id` の関連付けで足りるため、context の `controlId` を使う。
@@ -36,31 +37,45 @@ export interface FieldLabellingValue {
36
37
  declare const FieldLabellingContext: React.Context<FieldLabellingValue>;
37
38
  /** ラッパー内かどうかを問わず使える。ラッパー外では null。 */
38
39
  declare function useFieldLabelling(): FieldLabellingValue | null;
40
+ type AriaInvalid = React.AriaAttributes["aria-invalid"];
41
+ /**
42
+ * 空白区切りの id 列を連結する。空と重複は除く(順序は最初に現れた位置を保つ)。
43
+ * どれも無ければ undefined。
44
+ */
45
+ declare function mergeIdRefs(...lists: Array<string | undefined>): string | undefined;
39
46
  /**
40
47
  * Radix トリガー系コントロール向けの aria 属性を解決する。
41
48
  *
42
- * 利用側の明示指定(aria-label / aria-labelledby / id / aria-describedby)を必ず優先し、
43
- * 何も指定が無いときだけラッパーの id を当てる。
49
+ * - 名前(aria-label / aria-labelledby)と id は利用側の明示指定を必ず優先し、
50
+ * 何も指定が無いときだけラッパーの id を当てる。
51
+ * - aria-describedby は **連結** する。利用側が指定してもラッパーの説明・エラーの id を
52
+ * 落とさない(エラー文が読み上げから消えるのを防ぐ)。同じ id は 1 回だけにする。
53
+ * - aria-invalid は利用側の明示値を優先し、無ければラッパーに error があるとき true。
44
54
  */
45
55
  declare function resolveFieldAria(props: {
46
56
  id?: string;
47
57
  "aria-label"?: string;
48
58
  "aria-labelledby"?: string;
49
59
  "aria-describedby"?: string;
50
- }, field: FieldLabellingValue | null): {
60
+ "aria-invalid"?: AriaInvalid;
61
+ }, field: FieldLabellingValue | null, suppressDefaultLabelledBy?: boolean): {
51
62
  id?: string;
52
63
  "aria-labelledby"?: string;
53
64
  "aria-describedby"?: string;
65
+ "aria-invalid"?: AriaInvalid;
54
66
  };
55
67
  /**
56
68
  * ネイティブ入力(Input / Textarea)向け。
57
- * 名前は `<label for>` ↔ `id` で付くので、ここでは id と説明の関連付けだけ行う。
69
+ * 名前は `<label for>` ↔ `id` で付くので、ここでは id・説明の関連付け・エラー状態だけ扱う。
70
+ * aria-describedby の連結と aria-invalid の扱いは {@link resolveFieldAria} と同じ。
58
71
  */
59
72
  declare function resolveNativeFieldAria(props: {
60
73
  id?: string;
61
74
  "aria-describedby"?: string;
75
+ "aria-invalid"?: AriaInvalid;
62
76
  }, field: FieldLabellingValue | null): {
63
77
  id?: string;
64
78
  "aria-describedby"?: string;
79
+ "aria-invalid"?: AriaInvalid;
65
80
  };
66
- export { FieldLabellingContext, useFieldLabelling, resolveFieldAria, resolveNativeFieldAria, };
81
+ export { FieldLabellingContext, useFieldLabelling, resolveFieldAria, resolveNativeFieldAria, mergeIdRefs, };
@@ -18,13 +18,63 @@
18
18
  * `hover:not-focus-within:*` と書いてフォーカス中は hover を抑制すること。
19
19
  * この順序は `__tests__/focus-visible-contract.test.ts` で固定している。
20
20
  */
21
+ /**
22
+ * 強制配色(forced-colors / Windows のハイコントラスト)用のフォーカス表示。
23
+ *
24
+ * DS のリングは `box-shadow` で描くが、forced-colors ではブラウザが box-shadow を描かない。
25
+ * さらに多くの部品は `outline-none` なので、そのままだとキーボードで動かしても現在地がどこにも
26
+ * 出ない(WCAG 2.4.7)。そこで `forced-colors:` でだけ実線の輪郭線(outline)を足す。
27
+ * 色は OS の選択色 `Highlight`(ブラウザ標準のフォーカスリングと同じ色)。
28
+ * `forced-colors` 以外では何も効かないので、通常表示は変わらない。
29
+ *
30
+ * - `outline-solid` が要る: 部品の `outline-none` は `outline-style: none` で、
31
+ * `outline-2` だけでは上書きできない(`outline-solid` が `outline-style` を実線にする)
32
+ * - 輪郭線は `outline-offset` だけ離して描くのでレイアウトは動かない
33
+ *
34
+ * {@link FOCUS_RING} / {@link FOCUS_RING_WITHIN} / {@link FOCUS_RING_INSET} / {@link FOCUS_RING_ONLY} はこれを含むので、
35
+ * それらを使う部品は何もしなくてよい。`focus-visible:ring-*` を自前で書いている部品だけ、
36
+ * リングと一緒にこれを足す(`FOCUS_RING_*` 定数に寄せられるなら寄せる)。
37
+ *
38
+ * @example
39
+ * <button className={cn("outline-none focus-visible:ring-2 ...", FORCED_COLORS_FOCUS)} />
40
+ */
41
+ export declare const FORCED_COLORS_FOCUS = "forced-colors:focus-visible:outline-solid forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]";
42
+ /**
43
+ * {@link FORCED_COLORS_FOCUS} の `focus-within` 版。ラッパーが枠を描く合成コントロール用
44
+ * ({@link FOCUS_RING_WITHIN} と対)。内側の要素にも outline が付く部品は、二重にならないよう
45
+ * 内側へ `forced-colors:focus-visible:outline-none` を足すこと。
46
+ */
47
+ export declare const FORCED_COLORS_FOCUS_WITHIN = "forced-colors:focus-within:outline-solid forced-colors:focus-within:outline-2 forced-colors:focus-within:outline-offset-2 forced-colors:focus-within:outline-[Highlight]";
48
+ /**
49
+ * {@link FORCED_COLORS_FOCUS} の内側版。`overflow-hidden` の内側にある要素用
50
+ * ({@link FOCUS_RING_INSET} と対。外向きの輪郭線は切り取られるので内側に描く)。
51
+ */
52
+ export declare const FORCED_COLORS_FOCUS_INSET = "forced-colors:focus-visible:outline-solid forced-colors:focus-visible:outline-2 forced-colors:focus-visible:-outline-offset-2 forced-colors:focus-visible:outline-[Highlight]";
53
+ /**
54
+ * メニュー項目(DropdownMenu / ContextMenu / Menubar / Select の項目)の「いま選んでいる位置」の
55
+ * forced-colors 表示。通常表示は `focus:bg-accent`(薄い地)で示すが、forced-colors では地が Canvas に
56
+ * 置き換わり、どの項目にフォーカスがあるか分からない。OS の選択色(Highlight / HighlightText)で塗る
57
+ * (OS 標準のメニューと同じ見え方)。中のアイコン・ショートカット文字も読めるよう子孫の文字色も揃え、
58
+ * destructive など他の `focus:bg-*` に負けないよう `!` を付ける。
59
+ *
60
+ * 項目は `outline-none` にしておくこと。`outline-hidden` は forced-colors で常時 2px の輪郭線を出すため、
61
+ * 全項目に枠が付いて選択位置が埋もれる。
62
+ */
63
+ export declare const FORCED_COLORS_MENU_ITEM = "forced-colors:focus:bg-[Highlight]! forced-colors:focus:text-[HighlightText]! forced-colors:focus:[&_*]:text-[HighlightText]!";
64
+ /** {@link FORCED_COLORS_MENU_ITEM} の cmdk(Command)版。選択中の項目は focus ではなく `data-selected` で示される。 */
65
+ export declare const FORCED_COLORS_COMMAND_ITEM = "forced-colors:data-[selected=true]:bg-[Highlight]! forced-colors:data-[selected=true]:text-[HighlightText]! forced-colors:data-[selected=true]:[&_*]:text-[HighlightText]!";
21
66
  /**
22
67
  * 要素自身がフォーカスを受け取るコントロール用(input / button / trigger 等)。
23
68
  *
69
+ * リングの色は既定では従来どおり緑の 50% 透過。**枠幅 0 の要素**(枠なしの Button・NumberInput(sm) の
70
+ * ボタン等)では緑の枠が出ずリングだけが手がかりになり、50% のリングは 3:1 に届かないため、
71
+ * 高コントラスト(`prefers-contrast: more` / `data-contrast="more"`)のときだけ `--Focus-Ring-Control`
72
+ * (不透明な緑)に切り替わる({@link FOCUS_RING_ONLY} と同じ色指定)。
73
+ *
24
74
  * @example
25
75
  * <input className={cn("border ...", FOCUS_RING)} />
26
76
  */
27
- export declare const FOCUS_RING = "focus-visible:border-[var(--Focus-High-Emphasis)] focus-visible:ring-[3px] focus-visible:ring-[var(--Focus-High-Emphasis)]/50";
77
+ export declare const FOCUS_RING: string;
28
78
  /**
29
79
  * ラッパーが枠を描き、内側の要素がフォーカスを受け取る合成コントロール用
30
80
  * (SearchBar の枠、FileInput の label 等)。
@@ -34,9 +84,26 @@ export declare const FOCUS_RING = "focus-visible:border-[var(--Focus-High-Emphas
34
84
  * @example
35
85
  * <div className={cn("border hover:not-focus-within:border-x", FOCUS_RING_WITHIN)}>
36
86
  */
37
- export declare const FOCUS_RING_WITHIN = "focus-within:border-[var(--Focus-High-Emphasis)] focus-within:ring-[3px] focus-within:ring-[var(--Focus-High-Emphasis)]/50";
87
+ export declare const FOCUS_RING_WITHIN: string;
88
+ /**
89
+ * リングだけ(枠の色は変えない)でフォーカスを示す部品用。Switch / ListItem / カルーセル等。
90
+ *
91
+ * 既定は {@link FOCUS_RING} と同じ緑の 50% リング(`--Focus-High-Emphasis` を 50% 透過)。
92
+ * 50% のリングは白地に対して 3:1 に届かないため、高コントラスト
93
+ * (`prefers-contrast: more` / `data-contrast="more"`)のときだけ `--Focus-Ring-Control`
94
+ * (不透明な緑)に切り替わる。`--Focus-Ring-Control` は semantic.css の高コントラスト節でだけ宣言され、
95
+ * 未宣言のときはフォールバックの 50% リングになるので、既定の見た目は変わらない。
96
+ *
97
+ * 枠も緑にできる部品は、これではなく {@link FOCUS_RING} を使う。
98
+ * `ring-[var(--Focus-High-Emphasis)]/50` を直接書かない(高コントラスト時に切り替わらない)。
99
+ *
100
+ * @example
101
+ * <button className={cn("outline-none", FOCUS_RING_ONLY)} />
102
+ */
103
+ export declare const FOCUS_RING_ONLY: string;
38
104
  /**
39
105
  * `overflow-hidden` なコンテナの内側にある要素用(リングが外にはみ出すと
40
106
  * 切り取られてしまうため内側に描く)。SearchBar の検索ボタン等。
107
+ * リングの色は {@link FOCUS_RING_ONLY} と同じ(高コントラスト時に切り替わる)。
41
108
  */
42
- export declare const FOCUS_RING_INSET = "focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-[var(--Focus-High-Emphasis)]/50";
109
+ export declare const FOCUS_RING_INSET: string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 高コントラスト(`prefers-contrast: more` / `data-contrast="more"`)のときだけ現れる輪郭。
3
+ *
4
+ * 枠を持たず、地の色だけで形を示している操作部品(Combobox / MultiSelect のトリガー、
5
+ * NumberInput size="sm" の丸型の地)は、既定では背景との差が 3:1 に届かない
6
+ * (WCAG 1.4.11・issue #301)。既定の見た目は変えず、高コントラストのときだけ
7
+ * `--Border-Control`(semantic.css の高コントラスト節でだけ宣言される)の 1px の線を内側に描く。
8
+ *
9
+ * - 未宣言のとき(= 既定)は透明の outline なので何も見えない。レイアウトにも影響しない
10
+ * (border と違い要素の内側の寸法を変えない)。
11
+ * - outline-offset を -1px にして、`overflow-hidden` の親に切り取られないよう要素の内側に収める。
12
+ * - outline-solid は Button 基底の `outline-none`(outline-style: none)を打ち消すために必要。
13
+ * - エラー(aria-invalid)のときは outline を透明にする。トリガーのエラーの赤枠は内側リング(inset-ring・
14
+ * Border-Caution)で描いており、高コントラストの灰色の outline が同じ画素に重なると赤が隠れるため。
15
+ * outline を赤にすると、既定でも角丸のアンチエイリアス部分で赤の outline と赤の内側リングが重なって
16
+ * 濃くなる(main と画素が変わる)ので、赤にはせず透明にして、赤の内側リング(4.6:1 以上)をそのまま見せる。
17
+ * 既定の outline は元から透明なので、既定の表示は変わらない。
18
+ * - forced-colors(Windows のハイコントラスト)では透明の outline も表示色で描かれるため、
19
+ * 境界の無かったトリガーに線が出る(意図した挙動)。エラー時の CanvasText は各部品の
20
+ * `forced-colors:aria-invalid:outline-[CanvasText]` が上書きする。
21
+ *
22
+ * 枠を持つ部品は、これではなく `border-[var(--Border-Control,var(--Border-Medium-Emphasis))]` の形で
23
+ * 枠の色そのものを切り替える。
24
+ */
25
+ export declare const HIGH_CONTRAST_OUTLINE = "outline-solid outline-1 -outline-offset-1 outline-[color:var(--Border-Control,transparent)] aria-invalid:outline-transparent";
@@ -0,0 +1,2 @@
1
+ /** images 更新時に、現在の画像を維持しつつ有効な index へ補正する。 */
2
+ export declare function reconcileImageIndex(previousImages: string[], images: string[], currentIndex: number): number;
@@ -2,34 +2,39 @@ import type * as React from "react";
2
2
  /**
3
3
  * リンクの描画に使うコンポーネント(#236)
4
4
  *
5
- * DS 内でリンクを複数描く部品(Footer / MenuDrawer / SubNav / Pagination)は
6
- * 素の `<a>` を描くため、Next.js の `next/link` 等を差し込めずクライアント遷移に
7
- * ならない。`asChild` は複数リンクを内部で描く部品には向かないため、
8
- * 「リンク実装そのもの」を差し替える prop を共通の型で用意する。
5
+ * DS 内でリンクを描く部品は素の `<a>` を描くため、Next.js の `next/link` 等を
6
+ * 差し込めずクライアント遷移にならない。`asChild` は複数リンクを内部で描く部品には
7
+ * 向かないため、「リンク実装そのもの」を差し替える prop を共通の型で用意する。
9
8
  *
10
9
  * 例: `<Footer linkComponent={Link} … />`(next/link をそのまま渡せる)
11
10
  *
12
- * ⚠️ `Footer` / `MenuDrawer` は Client Component。React Server Components では
13
- * Server Component からこの prop を渡すと client 境界を越えて関数を渡すことに
14
- * なり、`Functions cannot be passed directly to Client Components` で落ちる。
11
+ * 対応部品: Footer / MenuDrawer / SubNav / Pagination(PaginationLink・Previous・Next)/
12
+ * ContentCard / AdminSideNav / SideNav / BottomTabBar / Header / AdminShell / MypageShell /
13
+ * BreadcrumbLink / ListItem / SectionHeader / ProductCard / ProductListItem / ShopCard /
14
+ * ProductCarousel / ProductDetailBar / ProductDetailSidebar / BannerCarousel / ImageCarousel /
15
+ * CategoryScroll / CategoryShortcuts / NotificationList / AnniversaryCard / DataTableLinkCell / Chip。
16
+ * 未指定なら従来どおり素の `<a>`。`external: true` を持つ Footer / DataTableLinkCell の外部リンクは
17
+ * 常に素の `<a target="_blank">`。
18
+ *
19
+ * ⚠️ Client Component の部品(`Footer` / `MenuDrawer` / `Header` / `AdminSideNav` / `AdminShell` /
20
+ * `ListItem` / `ImageCarousel`。`MypageShell` も内部で `Header` へ渡す)は、React Server Components
21
+ * では Server Component からこの prop を渡すと client 境界を越えて関数を渡すことになり、
22
+ * `Functions cannot be passed directly to Client Components` で落ちる。
15
23
  * Next.js App Router では、この prop を使う呼び出し側を `"use client"` にする
16
24
  * (エラーメッセージは `"use server"` を示唆するが、正解は逆)。
17
25
  *
18
- * `Pagination` / `SubNav` / `ContentCard` は Server Component のまま使えるため、
19
- * この prop を使うだけで呼び出し側を `"use client"` にする必要はない。
26
+ * ⚠️ 内部で host 要素(`<a>` / `<button>`)にイベントハンドラを直接付ける部品は、`"use client"` を持たなくても
27
+ * Server Component から描けない(`Event handlers cannot be passed to Client Component props` で落ちる。
28
+ * `linkComponent` の有無によらない)。呼び出し側を `"use client"` にする。無条件: `SideNav`(全項目の
29
+ * `onClick`)/ `ProductDetailBar`(全タブの `onClick`)。条件付き: `ProductCard` / `ProductCarousel`
30
+ * (`shopHref` 指定時のショップ名リンク、`showCartButton` 指定時のカートボタン)/ `ProductDetailSidebar`
31
+ * (`sizeOptions` 指定時)/ `Chip`(`removable` 指定時)。`MypageShell` も内部で `SideNav` を描く。
32
+ *
33
+ * それ以外(`Pagination` / `SubNav` / `ContentCard` / `BottomTabBar` / `SectionHeader` / `ProductListItem` /
34
+ * `ShopCard` / `BannerCarousel` / `CategoryScroll` / `CategoryShortcuts` / `NotificationList` /
35
+ * `AnniversaryCard` / `DataTableLinkCell` / `BreadcrumbLink`、および上の条件付きの部品の条件外)は
36
+ * Server Component のまま使えるため、この prop を使うだけで呼び出し側を `"use client"` にする必要はない。
20
37
  */
21
38
  export type LinkComponent = React.ComponentType<React.AnchorHTMLAttributes<HTMLAnchorElement> & {
22
39
  href: string;
23
40
  }>;
24
- /**
25
- * 実際に使うリンク実装を決める。
26
- *
27
- * 外部リンク(`target="_blank"` を付けるもの)は framework のリンク部品に通す
28
- * 意味が無いため、常に素の `<a>` にフォールバックする。
29
- *
30
- * `isExternal` を渡せるのは、項目に `external` フラグを持つ `Footer` だけ。
31
- * MenuDrawer / SubNav / Pagination の項目に `external` は無く、渡した href は
32
- * すべて `linkComponent` で描かれる(外部 URL を出し分けたい場合は consumer 側で
33
- * ラップする)。
34
- */
35
- export declare function resolveLinkComponent(linkComponent: LinkComponent | undefined, isExternal?: boolean): React.ElementType;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 利用者が OS の「視差効果を減らす / アニメーションを減らす」(prefers-reduced-motion: reduce)を
3
+ * 選んでいるかを返す。設定の変更にも追従する。
4
+ *
5
+ * CSS で止められない動き(JS の自動再生・`scrollTo({ behavior: "smooth" })` など)を
6
+ * 止める判定に使う。CSS のアニメーションは `motion-reduce:` バリアントや
7
+ * `--Motion-Duration-*` トークンで止める。
8
+ */
9
+ export declare function usePrefersReducedMotion(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakejp/design-system",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "description": "Cake.jp Design System — UI コンポーネント・カラートークン・タイポグラフィ",
6
6
  "license": "UNLICENSED",
@@ -96,11 +96,19 @@
96
96
  "generate:lint-rules": "node scripts/generate-lint-rules.mjs",
97
97
  "generate:lookup": "node scripts/generate-component-lookup.mjs",
98
98
  "lint:contrast": "node scripts/check-contrast.mjs",
99
- "check": "tsc --noEmit -p tsconfig.app.json && npm run typecheck:stories && bash scripts/check-deps.sh && bash scripts/check-drift.sh && bash scripts/check-docs-drift.sh && bash scripts/lint-scratch.sh && bash scripts/check-story-reuse.sh && bash scripts/check-responsive.sh && node scripts/check-border-color.mjs && npm run lint:contrast && bash scripts/lint-scratch.sh --components && bash scripts/check-generated-drift.sh && bash scripts/check-agents-mirror.sh",
99
+ "lint:css-vars": "node scripts/check-css-vars.mjs",
100
+ "lint:vrt-baselines": "node scripts/check-vrt-baselines.mjs",
101
+ "check": "tsc --noEmit -p tsconfig.app.json && npm run typecheck:stories && bash scripts/check-deps.sh && bash scripts/check-drift.sh && bash scripts/check-docs-drift.sh && bash scripts/lint-scratch.sh && bash scripts/check-story-reuse.sh && bash scripts/check-responsive.sh && node scripts/check-border-color.mjs && node scripts/check-css-vars.mjs && npm run lint:contrast && bash scripts/lint-scratch.sh --components && bash scripts/check-generated-drift.sh && bash scripts/check-agents-mirror.sh && node scripts/check-vrt-baselines.mjs",
100
102
  "test": "vitest run --config vitest.config.ts",
101
103
  "test:interaction": "vitest run --config vitest.storybook.config.ts",
102
104
  "test:a11y": "vitest run --config vitest.a11y.config.ts",
103
- "check:consumer-types": "node scripts/check-consumer-types.mjs"
105
+ "test:interaction:webkit": "CAKE_BROWSER=webkit vitest run --config vitest.storybook.config.ts",
106
+ "test:a11y:webkit": "CAKE_BROWSER=webkit vitest run --config vitest.a11y.config.ts",
107
+ "test:forced-colors": "vitest run --config vitest.forced-colors.config.ts",
108
+ "test:vrt": "vitest run --config vitest.vrt.config.ts",
109
+ "test:vrt:docker": "bash scripts/vrt-docker.sh",
110
+ "check:consumer-types": "node scripts/check-consumer-types.mjs",
111
+ "check:hydration": "node scripts/check-hydration.mjs"
104
112
  },
105
113
  "dependencies": {
106
114
  "class-variance-authority": "^0.7.1",