@cakejp/design-system 0.19.0 → 0.20.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/CLAUDE.md +1 -0
  3. package/bin/init.js +191 -28
  4. package/contracts/components.json +43 -7
  5. package/contracts/composition.json +1 -1
  6. package/contracts/rules.json +1 -1
  7. package/contracts/screen-patterns.json +1 -1
  8. package/dist/components/ec/order-summary.js +16 -15
  9. package/dist/components/ec/product-card.js +1 -1
  10. package/dist/components/foundations/alert-dialog.js +7 -7
  11. package/dist/components/foundations/data-table.js +490 -16
  12. package/dist/components/foundations/dialog.js +13 -13
  13. package/dist/components/foundations/drawer.js +5 -5
  14. package/dist/components/foundations/sheet.js +7 -7
  15. package/dist/components/primitives/admin-header.js +1 -1
  16. package/dist/components/primitives/admin-side-nav.js +195 -86
  17. package/dist/components/primitives/bottom-tab-bar.js +20 -20
  18. package/dist/components/primitives/header.js +43 -37
  19. package/dist/components/primitives/image-uploader.js +40 -19
  20. package/dist/components/primitives/sticky-action-bar.js +2 -1
  21. package/dist/index.css +1 -1
  22. package/dist/index.js +817 -476
  23. package/dist/types/components/primitives/admin-side-nav.d.ts +3 -0
  24. package/dist/types/index.d.ts +3 -2
  25. package/dist/types/lib/link-component.d.ts +9 -0
  26. package/package.json +2 -2
  27. package/src/components/COMPONENT_LOOKUP.md +2 -2
  28. package/src/preset-standalone.css +2 -0
  29. package/src/preset.css +13 -3
  30. package/src/styles/semantic.css +10 -0
  31. package/templates/AGENTS.md +4 -2
  32. package/templates/AGENTS.stub.md +25 -0
  33. package/templates/CLAUDE.md +4 -2
  34. package/templates/CLAUDE.stub.md +25 -0
  35. package/tokens.json +9 -0
@@ -65,6 +65,9 @@ export interface AdminSideNavProps {
65
65
  *
66
66
  * メイン項目・サブメニュー項目とも 44px(WCAG 2.5.5 の最小ターゲット)以上にする。
67
67
  * 行高が小さいテキストで縦 padding だけに頼ると割り込むため、`min-h-11` で下限を固定する。
68
+ * PC のサブメニューは `DropdownMenu` の Portal / collision handling を利用し、
69
+ * viewport 端では位置と最大高を自動調整する。hover ではフォーカスを奪わず、
70
+ * Enter / Space / ArrowDown / Escape では標準のメニュー操作に従う。
68
71
  *
69
72
  * ### インポート
70
73
  * ```tsx
@@ -20,7 +20,8 @@ export type { CheckboxGroupProps } from "./components/foundations/checkbox-group
20
20
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/foundations/collapsible";
21
21
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "./components/foundations/command";
22
22
  export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from "./components/foundations/context-menu";
23
- export { DataTable } from "./components/foundations/data-table";
23
+ 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
+ export type { SortDirection } from "./components/foundations/data-table";
24
25
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/foundations/dialog";
25
26
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from "./components/foundations/drawer";
26
27
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/foundations/dropdown-menu";
@@ -209,7 +210,7 @@ export { OrderSummary } from "./components/ec/order-summary";
209
210
  export type { OrderSummaryProps, OrderSummaryLineItem } from "./components/ec/order-summary";
210
211
  export { PaymentMethodDisplay, CreditCardIcon } from "./components/ec/payment-method";
211
212
  export type { PaymentMethodDisplayProps, CreditCardIconProps, CreditCardBrand } from "./components/ec/payment-method";
212
- export { ProductCard } from "./components/ec/product-card";
213
+ export { ProductCard, BookmarkRibbonIcon } from "./components/ec/product-card";
213
214
  export type { ProductCardProps } from "./components/ec/product-card";
214
215
  export { ProductCarousel } from "./components/ec/product-carousel";
215
216
  export type { ProductCarouselProps } from "./components/ec/product-carousel";
@@ -8,6 +8,15 @@ import type * as React from "react";
8
8
  * 「リンク実装そのもの」を差し替える prop を共通の型で用意する。
9
9
  *
10
10
  * 例: `<Footer linkComponent={Link} … />`(next/link をそのまま渡せる)
11
+ *
12
+ * ⚠️ `Footer` / `MenuDrawer` は Client Component。React Server Components では
13
+ * Server Component からこの prop を渡すと client 境界を越えて関数を渡すことに
14
+ * なり、`Functions cannot be passed directly to Client Components` で落ちる。
15
+ * Next.js App Router では、この prop を使う呼び出し側を `"use client"` にする
16
+ * (エラーメッセージは `"use server"` を示唆するが、正解は逆)。
17
+ *
18
+ * `Pagination` / `SubNav` / `ContentCard` は Server Component のまま使えるため、
19
+ * この prop を使うだけで呼び出し側を `"use client"` にする必要はない。
11
20
  */
12
21
  export type LinkComponent = React.ComponentType<React.AnchorHTMLAttributes<HTMLAnchorElement> & {
13
22
  href: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakejp/design-system",
3
- "version": "0.19.0",
3
+ "version": "0.20.1",
4
4
  "type": "module",
5
5
  "description": "Cake.jp Design System — UI コンポーネント・カラートークン・タイポグラフィ",
6
6
  "license": "UNLICENSED",
@@ -111,6 +111,7 @@
111
111
  "react-hook-form": "^7.0.0",
112
112
  "sonner": "^2.0.0",
113
113
  "tailwind-merge": "^3.5.0",
114
+ "tw-animate-css": "^1.4.0",
114
115
  "vaul": "^1.0.0"
115
116
  },
116
117
  "peerDependencies": {
@@ -175,7 +176,6 @@
175
176
  "storybook": "^10.3.3",
176
177
  "tailwindcss": "^4.2.1",
177
178
  "tsc-alias": "^1.8.16",
178
- "tw-animate-css": "^1.4.0",
179
179
  "typescript": "~5.9.3",
180
180
  "typescript-eslint": "^8.48.0",
181
181
  "vaul": "^1.1.2",
@@ -27,7 +27,7 @@
27
27
  | Collapsible, CollapsibleTrigger, CollapsibleContent | `@/components/foundations/collapsible` | — | Default, CouponCodeInput, OrderOptions |
28
28
  | Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator | `@/components/foundations/command` | — | Default, ProductSearch, DeliveryOptions |
29
29
  | ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup | `@/components/foundations/context-menu` | — | Default, WithCheckboxItems |
30
- | DataTable, DataTableTable, DataTableHeader, DataTableBody, DataTableRow, DataTableHead, DataTableCell, DataTableAvatarCell, DataTableImageCell, DataTableLinkCell, DataTableCheckboxCell, DataTableActionCell, DataTableInputCell, DataTableSelectCell, DataTableNumberCell, DataTableDragHandleCell, DataTableBulkActions, DataTableSectionRow, DataTableAddRow, DataTableEmptyState | `@/components/foundations/data-table` | **state**: `default`, `selected`<br>**width**: `auto`, `max`, `hug`<br>**align**: `left`, `right`, `center` | Default, チェックボックス選択, タイトル固定, セクション, 空状態, 新規追加行, セル型バリエーション, 実用例(注文管理), 入力系セル一覧, ソートヘッダー, D&D並び替え |
30
+ | DataTable, DataTableTable, DataTableHeader, DataTableBody, DataTableRow, DataTableHead, DataTableCell, DataTableAvatarCell, DataTableImageCell, DataTableLinkCell, DataTableCheckboxCell, DataTableActionCell, DataTableInputCell, DataTableSelectCell, DataTableNumberCell, DataTableDragHandleCell, DataTableBulkActions, DataTableSectionRow, DataTableAddRow, DataTableEmptyState | `@/components/foundations/data-table` | **state**: `default`, `selected`<br>**width**: `auto`, `max`, `hug`<br>**align**: `left`, `right`, `center` | Default, チェックボックス選択, タイトル固定, セクション, 空状態, 新規追加行, セル型バリエーション, 実用例(注文管理), 入力系セル一覧, ソートヘッダー, D&D並び替え, interaction: チェック欄の操作と選択通知 |
31
31
  | Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger | `@/components/foundations/dialog` | — | Default, 確認ダイアログ, フォーム入力, interaction: 開閉とフォーカストラップ |
32
32
  | Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription | `@/components/foundations/drawer` | — | Default, カート追加クイックビュー |
33
33
  | DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent | `@/components/foundations/dropdown-menu` | — | Default, グループ付き, 注文アクション例 |
@@ -70,7 +70,7 @@
70
70
  | Component | Import | Variants | Stories |
71
71
  |-----------|--------|----------|---------|
72
72
  | AdminHeader | `@/components/primitives/admin-header` | — | — |
73
- | AdminSideNav | `@/components/primitives/admin-side-nav` | — | — |
73
+ | AdminSideNav | `@/components/primitives/admin-side-nav` | — | 下端寄り・多数項目・キーボード操作, interaction: flyout の開閉・フォーカス・viewport 境界 |
74
74
  | BannerCarousel | `@/components/primitives/banner-carousel` | — | Default, SmallBanners, LargeBanners |
75
75
  | BottomTabBar | `@/components/primitives/bottom-tab-bar` | — | Default(ホーム), アクティブ状態, バッジ付き, バッジオーバーフロー(99+), バナー付き, 記念日アクティブ |
76
76
  | BulkActionBar | `@/components/primitives/bulk-action-bar` | — | — |
@@ -191,6 +191,7 @@
191
191
  --Surface-Primary: #FFFFFF;
192
192
  --Surface-Secondary: #FBF9F8;
193
193
  --Surface-Tertiary: #F4F2F1;
194
+ --Surface-Elevated: #FFFFFF;
194
195
  --Surface-Caution: #EC0000;
195
196
  --Surface-Caution-Light: #FFE7E6;
196
197
  --Surface-Accent-Primary: #E04B00;
@@ -273,6 +274,7 @@
273
274
  --Surface-Primary: #000000E5;
274
275
  --Surface-Secondary: #FFFFFF1A;
275
276
  --Surface-Tertiary: #FFFFFF33;
277
+ --Surface-Elevated: #3A3736;
276
278
  --Surface-Caution: #EC0000;
277
279
  --Surface-Caution-Light: #FFE7E6;
278
280
  --Surface-Accent-Primary: #E04B00;
package/src/preset.css CHANGED
@@ -19,7 +19,7 @@
19
19
  * - シャドウ・角丸トークン
20
20
  * - モーショントークン(--Motion-Duration-* / --Motion-Easing-*)
21
21
  * - 重なり順トークン(--Z-*)
22
- * - アニメーションユーティリティ
22
+ * - アニメーションユーティリティ(tw-animate-css の animate-in 系 + 独自 keyframes)
23
23
  * - 見た目を変えず44pxの操作領域を確保する tap-target ユーティリティ
24
24
  * ============================================ */
25
25
 
@@ -35,6 +35,16 @@
35
35
  /* --- Layer 4: Motion Tokens (duration / easing) --- */
36
36
  @import "./styles/motion.css";
37
37
 
38
+ /* --- Layer 5: Animation Utilities (tw-animate-css) ---
39
+ foundations の 12 部品(Dialog / Sheet / Popover / DropdownMenu / Select /
40
+ Tooltip / Drawer / AlertDialog / HoverCard / ContextMenu / Menubar /
41
+ NavigationMenu)が使う animate-in / zoom-in-* / slide-in-from-* は
42
+ Tailwind 本体ではなく tw-animate-css のユーティリティ。preset が配らないと、
43
+ 自分で tw-animate-css を入れた consumer だけアニメーションが動く暗黙依存になる
44
+ (実例: cakejp-biz-mag のモバイルメニューが無言で無アニメーションだった)。
45
+ パッケージ解決で consumer の node_modules から読む(DS の dependency)。 */
46
+ @import "tw-animate-css";
47
+
38
48
  /* --- Dark mode variant --- */
39
49
  @custom-variant dark (&:is(.dark *));
40
50
 
@@ -234,7 +244,7 @@
234
244
  --foreground: var(--Text-High-Emphasis);
235
245
  --card: var(--Surface-Secondary);
236
246
  --card-foreground: var(--Text-High-Emphasis);
237
- --popover: var(--Surface-Primary);
247
+ --popover: var(--Surface-Elevated);
238
248
  --popover-foreground: var(--Text-High-Emphasis);
239
249
  --primary: var(--Brand-Cake-Orange);
240
250
  --primary-foreground: var(--Text-on-Inverse);
@@ -270,7 +280,7 @@
270
280
  --foreground: var(--Text-High-Emphasis);
271
281
  --card: var(--Surface-Secondary);
272
282
  --card-foreground: var(--Text-High-Emphasis);
273
- --popover: var(--Surface-Primary);
283
+ --popover: var(--Surface-Elevated);
274
284
  --popover-foreground: var(--Text-High-Emphasis);
275
285
  --primary: var(--Brand-Cake-Orange);
276
286
  --primary-foreground: var(--Text-on-Inverse);
@@ -16,6 +16,12 @@
16
16
  --Surface-Primary: var(--Primitive-White-alpha-1000);
17
17
  --Surface-Secondary: var(--Primitive-Gray-50);
18
18
  --Surface-Tertiary: var(--Primitive-Gray-100);
19
+ /* 浮遊レイヤー(メニュー・ポップオーバー・ダイアログ・シート)と、
20
+ スクロール内容の上に重なるエッジ固定バー(Header / StickyActionBar /
21
+ BottomTabBar / AdminHeader / AdminSideNav / OrderSummary fixed)の地。
22
+ 任意のコンテンツの上に重なるので必ず不透明にする(issue #262)。
23
+ light は Surface-Primary と同値(元から不透明)。 */
24
+ --Surface-Elevated: var(--Primitive-White-alpha-1000);
19
25
  --Surface-Caution: var(--Primitive-Sun-800);
20
26
  --Surface-Caution-Light: var(--Primitive-Sun-50);
21
27
  --Surface-Accent-Primary: var(--Primitive-Orange-700);
@@ -129,6 +135,10 @@
129
135
  --Surface-Primary: var(--Primitive-Gray-alpha-900);
130
136
  --Surface-Secondary: var(--Primitive-White-alpha-100);
131
137
  --Surface-Tertiary: var(--Primitive-White-alpha-200);
138
+ /* dark の Surface-Primary は #000000E5 でアルファ付き。ページ地としては
139
+ 下地に合成される前提なので妥当だが、浮遊レイヤーに使うと後ろが透ける。
140
+ 一段明るい不透明色を elevation として持つ(issue #262)。 */
141
+ --Surface-Elevated: var(--Primitive-Gray-800);
132
142
  --Surface-Caution: var(--Primitive-Sun-800);
133
143
  --Surface-Caution-Light: var(--Primitive-Sun-50);
134
144
  --Surface-Accent-Primary: var(--Primitive-Orange-700);
@@ -1,6 +1,8 @@
1
1
  <!--
2
- このファイルは @cakejp/design-system の postinstall で自動設置されました。
3
- 最新ルールを取り込むには: npx cakejp-ds init --force
2
+ DS 共通ルールの正本。npm package に同梱され、consumer からは
3
+ node_modules/@cakejp/design-system/templates/ 配下を参照して読む。
4
+ consumer のリポジトリへ本文をコピーしないこと(写しは必ず古くなる)。
5
+ consumer ルートに置かれるのは、この正本を指すポインタ(*.stub.md)だけ。
4
6
  -->
5
7
 
6
8
  # このプロジェクトは @cakejp/design-system に準拠する
@@ -0,0 +1,25 @@
1
+ <!--
2
+ このファイルは @cakejp/design-system の postinstall で自動設置されました。
3
+ DS 共通ルールは package 内の正本を参照します(このファイルへは複製しません)。
4
+ プロジェクト固有のルールは下の「プロジェクト固有ルール」以下へ自由に書けます。
5
+ DS 側の更新は npm install だけで反映されるため、書き写す必要はありません。
6
+ -->
7
+
8
+ # このプロジェクトは @cakejp/design-system に準拠する
9
+
10
+ Codex(および他の AI エージェント)は UI を作成・変更・レビューする前に、
11
+ **DS 共通ルールの正本を必ず読み込むこと**。
12
+
13
+ ## 📖 DS 共通ルール(正本・必読)
14
+
15
+ - `node_modules/@cakejp/design-system/templates/AGENTS.md`
16
+
17
+ このファイルへ内容を書き写さないこと。**手元の写しは必ず古くなる**(DS 側にルールが
18
+ 追加されても写しには反映されない)。正本は `npm install` のたびに最新へ更新される。
19
+
20
+ 正本から辿る必読ファイル(`CLAUDE.md` / `contracts/*.json` / `tokens.json` 等)も
21
+ すべて `node_modules/@cakejp/design-system/` 配下にある。
22
+
23
+ ## プロジェクト固有ルール
24
+
25
+ <!-- ここから下はプロジェクト固有。DS の更新で上書きされません。 -->
@@ -1,6 +1,8 @@
1
1
  <!--
2
- このファイルは @cakejp/design-system の postinstall で自動設置されました。
3
- 最新ルールを取り込むには: npx cakejp-ds init --force
2
+ DS 共通ルールの正本。npm package に同梱され、consumer からは
3
+ node_modules/@cakejp/design-system/templates/ 配下を参照して読む。
4
+ consumer のリポジトリへ本文をコピーしないこと(写しは必ず古くなる)。
5
+ consumer ルートに置かれるのは、この正本を指すポインタ(*.stub.md)だけ。
4
6
  -->
5
7
 
6
8
  # このプロジェクトは @cakejp/design-system に準拠する
@@ -0,0 +1,25 @@
1
+ <!--
2
+ このファイルは @cakejp/design-system の postinstall で自動設置されました。
3
+ DS 共通ルールは package 内の正本を参照します(このファイルへは複製しません)。
4
+ プロジェクト固有のルールは下の「プロジェクト固有ルール」以下へ自由に書けます。
5
+ DS 側の更新は npm install だけで反映されるため、書き写す必要はありません。
6
+ -->
7
+
8
+ # このプロジェクトは @cakejp/design-system に準拠する
9
+
10
+ Claude Code(および他の AI エージェント)は UI を作成・変更・レビューする前に、
11
+ **DS 共通ルールの正本を必ず読み込むこと**。
12
+
13
+ ## 📖 DS 共通ルール(正本・必読)
14
+
15
+ - `node_modules/@cakejp/design-system/templates/CLAUDE.md`
16
+
17
+ このファイルへ内容を書き写さないこと。**手元の写しは必ず古くなる**(DS 側にルールが
18
+ 追加されても写しには反映されない)。正本は `npm install` のたびに最新へ更新される。
19
+
20
+ 正本から辿る必読ファイル(`CLAUDE.md` / `contracts/*.json` / `tokens.json` 等)も
21
+ すべて `node_modules/@cakejp/design-system/` 配下にある。
22
+
23
+ ## プロジェクト固有ルール
24
+
25
+ <!-- ここから下はプロジェクト固有。DS の更新で上書きされません。 -->
package/tokens.json CHANGED
@@ -119,6 +119,11 @@
119
119
  "hex": "#F4F2F1",
120
120
  "usage": "ターシャリ背景"
121
121
  },
122
+ "elevated": {
123
+ "value": "Primitive-White-alpha-1000",
124
+ "hex": "#FFFFFF",
125
+ "usage": "浮遊レイヤー(メニュー・ポップオーバー・ダイアログ・シート)と、スクロール内容の上に重なるエッジ固定バー(Header / StickyActionBar / BottomTabBar 等)の地。必ず不透明にする"
126
+ },
122
127
  "caution": {
123
128
  "value": "Primitive-Sun-800",
124
129
  "hex": "#EC0000",
@@ -484,6 +489,10 @@
484
489
  "value": "var(--Primitive-White-alpha-200)",
485
490
  "usage": "Surface-Tertiary のCSS契約値"
486
491
  },
492
+ "elevated": {
493
+ "value": "var(--Primitive-Gray-800)",
494
+ "usage": "Surface-Elevated のCSS契約値"
495
+ },
487
496
  "caution": {
488
497
  "value": "var(--Primitive-Sun-800)",
489
498
  "usage": "Surface-Caution のCSS契約値"