@cakejp/design-system 0.4.1 → 0.6.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.
@@ -50,7 +50,7 @@ export interface ProductCarouselProps {
50
50
  * - `showCartButton` でカート追加ボタンを表示
51
51
  * - `sectionImage` でコラボ・ブランドロゴ等の画像をヘッダー左に表示
52
52
  * - `description` でセクション説明文を追加(コラボ紹介、特集説明等)
53
- * - 横パディングは SectionHeader(px-4)とスクロールコンテナ(px-4)が持つ
53
+ * - 横パディング(px-4)はヘッダー行(SectionHeader もしくは画像ラッパー)とスクロールコンテナが各自で持つ
54
54
  */
55
55
  declare function ProductCarousel({ title, subtitle, description, sectionImage, sectionImageAlt, sectionImageHref, moreHref, moreLabel, onMoreClick, headerSize, products, cardSize, showRanking, showCartButton, className, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;
56
56
  export { ProductCarousel };
@@ -16,6 +16,7 @@
16
16
  * | required | boolean | false | 必須バッジ表示 |
17
17
  * | optional | boolean | false | 任意バッジ表示 |
18
18
  * | description | string | — | 補足テキスト |
19
+ * | descriptionPosition | "above" \| "below" | "above" | description の表示位置 |
19
20
  * | error | string | — | エラーメッセージ |
20
21
  * | children | ReactNode | — | 入力要素 |
21
22
  *
@@ -34,6 +35,14 @@ export interface FormFieldProps {
34
35
  optional?: boolean;
35
36
  /** 補足テキスト */
36
37
  description?: string;
38
+ /**
39
+ * description の表示位置。
40
+ * - `"above"` (デフォルト): ラベル直下・入力要素の上
41
+ * - `"below"`: 入力要素の下
42
+ *
43
+ * グリッド配置で横並びフィールドの高さを揃えたい場合は `"below"` を使う。
44
+ */
45
+ descriptionPosition?: "above" | "below";
37
46
  /** エラーメッセージ */
38
47
  error?: string;
39
48
  /** htmlFor 属性 */
@@ -43,4 +52,4 @@ export interface FormFieldProps {
43
52
  /** 追加クラス */
44
53
  className?: string;
45
54
  }
46
- export declare function FormField({ label, required, optional, description, error, htmlFor, children, className, }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
55
+ export declare function FormField({ label, required, optional, description, descriptionPosition, error, htmlFor, children, className, }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- export interface ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ export interface ListItemProps extends React.HTMLAttributes<HTMLElement> {
3
3
  /** メインタイトル */
4
4
  title: string;
5
5
  /** キャプション(サブテキスト) */
@@ -55,6 +55,9 @@ export interface ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
55
55
  * - アイコン付き: `<ListItem title="注文履歴" leftIcon={<Icon />} size="lg" />`
56
56
  * - トグル行: `<ListItem title="通知設定" rightType="toggle" toggleChecked={true} />`
57
57
  * - テキスト値付き: `<ListItem title="言語" rightType="text" rightText="日本語" />`
58
+ *
59
+ * `href` か `onClick` を渡すとインタラクティブ行になり、hover 背景と focus リングが付く。
60
+ * 表示専用(href/onClick なし)の行は状態スタイルが付かない。
58
61
  */
59
62
  declare function ListItem({ title, caption, rightType, rightText, badgeCount, toggleChecked, onToggleChange, leftIcon, leftImageUrl, size, selected, showBorder, showBadgeDot, href, className, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
60
63
  export { ListItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakejp/design-system",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Cake.jp Design System — UI コンポーネント・カラートークン・タイポグラフィ",
6
6
  "license": "UNLICENSED",
@@ -31,7 +31,6 @@
31
31
  "cakejp-ds": "./bin/init.js"
32
32
  },
33
33
  "files": [
34
- "AGENTS.md",
35
34
  "CHANGELOG.md",
36
35
  "CLAUDE.md",
37
36
  "CLAUDE_PRODUCTION.md",
@@ -88,8 +87,9 @@
88
87
  "build-storybook": "storybook build",
89
88
  "lint:scratch": "bash scripts/lint-scratch.sh",
90
89
  "lint:reuse": "bash scripts/check-story-reuse.sh",
90
+ "lint:border": "node scripts/check-border-color.mjs",
91
91
  "generate:lint-rules": "node scripts/generate-lint-rules.mjs",
92
- "check": "tsc --noEmit && bash scripts/check-deps.sh && bash scripts/check-drift.sh && bash scripts/lint-scratch.sh && bash scripts/check-story-reuse.sh && bash scripts/check-responsive.sh",
92
+ "check": "tsc --noEmit && bash scripts/check-deps.sh && bash scripts/check-drift.sh && bash scripts/lint-scratch.sh && bash scripts/check-story-reuse.sh && bash scripts/check-responsive.sh && node scripts/check-border-color.mjs",
93
93
  "test": "vitest run --config vitest.config.ts"
94
94
  },
95
95
  "dependencies": {
@@ -11,7 +11,7 @@ Codex(および他の AI エージェント)は UI 作業を始める前に
11
11
 
12
12
  | ファイル | 内容 |
13
13
  |---------|------|
14
- | `node_modules/@cakejp/design-system/AGENTS.md` | DS 全体のルール・禁止パターン |
14
+ | `node_modules/@cakejp/design-system/CLAUDE.md` | DS 利用ガイド・禁止パターン |
15
15
  | `node_modules/@cakejp/design-system/contracts/components.json` | 全コンポーネントの定義・バリアント |
16
16
  | `node_modules/@cakejp/design-system/contracts/rules.json` | 禁止パターン・アクセシビリティ要件 |
17
17
  | `node_modules/@cakejp/design-system/tokens.json` | カラー・余白・角丸・影・タイポ |
@@ -11,7 +11,7 @@ Codex(および他の AI エージェント)は UI 作業を始める前に
11
11
 
12
12
  | ファイル | 内容 |
13
13
  |---------|------|
14
- | `node_modules/@cakejp/design-system/AGENTS.md` | DS 全体のルール・禁止パターン |
14
+ | `node_modules/@cakejp/design-system/CLAUDE.md` | DS 利用ガイド・禁止パターン |
15
15
  | `node_modules/@cakejp/design-system/contracts/components.json` | 全コンポーネントの定義・バリアント |
16
16
  | `node_modules/@cakejp/design-system/contracts/rules.json` | 禁止パターン・アクセシビリティ要件 |
17
17
  | `node_modules/@cakejp/design-system/tokens.json` | カラー・余白・角丸・影・タイポ |
package/AGENTS.md DELETED
@@ -1,144 +0,0 @@
1
- # Cake.jp Design System — AGENTS.md(Codex向け)
2
-
3
- ## このDSについて
4
-
5
- Cake.jp のフロントエンドとデザインシステムを正式に接続する統合デザインシステム。
6
- EC / BtoC / コマース向け。**3-tier 構造で 104 コンポーネント**:
7
- - foundations: 46個(shadcn ベース汎用 UI)
8
- - primitives: 35個(業界汎用パターン・jobboard 等他事業でも再利用可)
9
- - ec: 23個(Cake.jp / EC 事業特化)
10
-
11
- ---
12
-
13
- ## 必須: セッション開始時に読み込むファイル
14
-
15
- Codex はファイルを自動読み込みしないため、**タスク開始前に以下を明示的に読み込むこと**:
16
-
17
- ```
18
- 1. contracts/rules.json # 禁止パターン・アクセシビリティ要件
19
- 2. contracts/components.json # 全104コンポーネント定義(3-tier)
20
- 3. tokens.json # カラー・タイポグラフィ・スペーシングトークン
21
- ```
22
-
23
- 本番実装・新規コンポーネント作成の場合はさらに:
24
- ```
25
- 4. CLAUDE_PRODUCTION.md # 本番参照ルール・Figmaチェックリスト
26
- ```
27
-
28
- ---
29
-
30
- ## 技術スタック
31
-
32
- - React 19 + TypeScript
33
- - Vite(ビルド)
34
- - **Tailwind CSS v4**(`@import "tailwindcss"` 構文。`@tailwind base` / `@tailwind components` は v3 記法で**使用禁止**)
35
- - shadcn/ui(Radix UI ベース、Cake.jp テーマ適用済み)
36
- - Storybook(`@storybook/react-vite`)
37
- - CVA(class-variance-authority)でバリアント管理
38
- - **Lucide React + iconsax-react**(アイコン。`heroicons` `phosphor-icons` への置き換え禁止)
39
-
40
- ---
41
-
42
- ## ディレクトリ構成
43
-
44
- ```
45
- src/
46
- ├── components/
47
- │ ├── foundations/ # shadcn ベース汎用 UI(46個・全事業共通)
48
- │ ├── primitives/ # 業界汎用パターン(35個・jobboard等他事業でも再利用可)
49
- │ ├── ec/ # Cake.jp / EC 事業特化(23個・商品・配送・クーポン等)
50
- │ └── pages/ # ページ単位のストーリー
51
- ├── prototypes/ # /mock スキルで生成されたプロトタイプ
52
- ├── lib/
53
- │ └── utils.ts # cn() ユーティリティ
54
- └── index.css # カラートークン定義 + Tailwind 設定
55
- ```
56
-
57
- ### 3層構造の依存ルール
58
-
59
- ```
60
- ec/ ← Cake.jp 特化(最上位)
61
- ↓
62
- primitives/ ← 業界汎用パターン
63
- ↓
64
- foundations/ ← shadcn ベース(最下位)
65
- ```
66
-
67
- - `foundations/` は他層に依存しない
68
- - `primitives/` は `foundations/` のみ参照可
69
- - `ec/` は `foundations/` と `primitives/` を参照可
70
- - **逆方向の依存は禁止**(`bash scripts/check-deps.sh` で検証)
71
-
72
- ---
73
-
74
- ## ❌ スクラッチコード禁止ルール(強制)
75
-
76
- ### 書く前ゲート
77
-
78
- 以下のいずれかを書こうとしたら**手を止めて** `contracts/components.json` と Storybook で同等パターンを探すこと:
79
-
80
- | 書こうとしているもの | 確認先 |
81
- |-------------------|--------|
82
- | `::before` / `::after` 装飾(バー・ドット・矢印) | SectionHeader, Chip, Badge, ListItem の variants |
83
- | `rgba(...)` / `#xxxxxx` ハードコードカラー | `tokens.json` のトークン名を使う |
84
- | `box-shadow: ...` カスタム影 | `tokens.json` の `shadow.*` |
85
- | `border-radius: ...px` カスタム角丸 | `tokens.json` の `radius.*` |
86
- | カスタムフォントサイズ・ウェイト | `tokens.json` の `typography.*` |
87
-
88
- DSに存在しない場合のみカスタム実装を許可。その場合はコメントで理由を記載すること。
89
-
90
- ### 書いた後ゲート(強制)
91
-
92
- **.tsx / .css / .module.css を編集したら必ず実行**:
93
-
94
- ```bash
95
- bash scripts/lint-scratch.sh
96
- ```
97
-
98
- エラーが出たら修正してから次のタスクに進むこと。**エラーありのまま完了報告禁止。**
99
-
100
- **コンポーネントを追加・削除したら必ず実行**:
101
-
102
- ```bash
103
- bash scripts/check-drift.sh # contracts と実ファイルの一致を検証
104
- bash scripts/check-deps.sh # 3-tier 依存方向違反を検出
105
- ```
106
-
107
- `contracts/components.json` の `meta.counts` と実ファイル数が一致していること、
108
- foundations → primitives → ec の依存方向が正しいことを確認すること。
109
-
110
- ---
111
-
112
- ## コンポーネント追加時のチェックリスト
113
-
114
- - [ ] `src/index.tsx` にエクスポートを追加
115
- - [ ] `contracts/components.json` にコンポーネント定義を追加
116
- - [ ] `contracts/components.json` の `meta.counts` を更新
117
- - [ ] `bash scripts/check-drift.sh` を実行して乖離がないことを確認
118
- - [ ] Storybook のストーリーファイル(`.stories.tsx`)を作成
119
-
120
- ---
121
-
122
- ## ドキュメント構成
123
-
124
- | ファイル | 内容 |
125
- |---------|------|
126
- | **AGENTS.md**(本ファイル) | Codex向け。セッション開始時の読み込み指示・編集後コマンドを明記 |
127
- | **CLAUDE.md** | Claude Code向け概要(フック自動実行) |
128
- | **contracts/components.json** | 全104コンポーネントの構造化定義(3-tier・バリアント・アクセシビリティ要件) |
129
- | **contracts/rules.json** | 禁止パターン・アクセシビリティ要件・タイポグラフィ定義 |
130
- | **tokens.json** | カラー・スペーシング・シャドウトークンの機械可読定義 |
131
- | **CLAUDE_PRODUCTION.md** | 本番実装参照ルール・Figmaチェックリスト(Cake.jp固有) |
132
-
133
- ---
134
-
135
- ## 重要な制約(AI生成コードの典型的な誤り)
136
-
137
- `contracts/rules.json` の `aiPatterns` セクションで詳細を確認すること。主な注意点:
138
-
139
- - **価格表記**: `¥{数字,区切り}(税込)` — `円` `税込み` `(税込)` は禁止
140
- - **日付表記**: `M月D日(曜日)` — `YYYY/MM/DD` や英語表記禁止
141
- - **aria-label**: 日本語で記述 — 英語 aria-label 禁止
142
- - **input type="date"**: 使用禁止 — PopoverとCalendarを組み合わせる
143
- - **Tag に onClick**: 禁止 — 押せるものは Chip を使う
144
- - **SectionHeader 手書き**: 禁止 — `SectionHeader` コンポーネントを使う