ksk-design-system 1.41.0 → 1.43.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 (33) hide show
  1. package/AGENTS.md +23 -2
  2. package/CLAUDE.md +16 -0
  3. package/NATIVE_RECIPES.md +46 -0
  4. package/README.md +23 -3
  5. package/contracts/components.json +72 -6
  6. package/dist/index.js +2425 -2209
  7. package/dist/native/ui.js +434 -382
  8. package/dist/{native-D6LJPc6D.js → native-BelCzh9_.js} +10 -0
  9. package/dist/native.js +1 -1
  10. package/dist/types/components/patterns/celebration.d.ts +1 -1
  11. package/dist/types/components/patterns/countdown-hero.d.ts +12 -1
  12. package/dist/types/components/patterns/side-drawer-frame.d.ts +18 -0
  13. package/dist/types/components/ui/commit-auto-grow-textarea.d.ts +21 -0
  14. package/dist/types/components/ui/commit-input.d.ts +21 -0
  15. package/dist/types/components/ui/commit-textarea.d.ts +16 -0
  16. package/dist/types/components/ui/progress.d.ts +12 -1
  17. package/dist/types/components/ui/sheet.d.ts +61 -8
  18. package/dist/types/components/ui/use-commit-draft.d.ts +48 -0
  19. package/dist/types/index.d.ts +10 -0
  20. package/dist/types/native/components/DocumentScreen.d.ts +22 -0
  21. package/dist/types/native/components/Progress.d.ts +9 -9
  22. package/dist/types/native/components/Prose.d.ts +15 -0
  23. package/dist/types/native/components/Text.d.ts +6 -1
  24. package/dist/types/native/components/index.d.ts +2 -0
  25. package/dist/types/native/progress-logic.d.ts +23 -0
  26. package/dist/types/native/typography.d.ts +4 -2
  27. package/dist/types/tokens/native/scales.d.ts +10 -0
  28. package/package.json +8 -6
  29. package/src/components/COMPONENT_LOOKUP.md +7 -3
  30. package/src/native/COMPONENT_LOOKUP.md +3 -1
  31. package/src/preset.css +1 -0
  32. package/src/styles/sheet-keyboard.css +72 -0
  33. package/tokens.json +12 -0
package/AGENTS.md CHANGED
@@ -15,13 +15,18 @@
15
15
  コードを書く前に、以下を必ず読み込むこと:
16
16
 
17
17
  ```
18
- contracts/rules.json # 禁止パターン32件・AIアンチパターン10件・a11y要件
19
- contracts/components.json # 全112コンポーネントの定義・バリアント・ルール
18
+ .claude/skills/ksk-design-system/SKILL.md # 判断Skill: 実装・レビューの判断基準(正本への索引)
19
+ contracts/rules.json # 禁止パターン43件・AIアンチパターン10件・a11y要件
20
+ contracts/components.json # 全132コンポーネントの定義・バリアント・ルール
20
21
  contracts/design-context.json # DESIGN.md と正本ファイルの関係・AI向け検査方針
21
22
  tokens.json # カラー・スペーシング・シャドウトークン
22
23
  src/components/COMPONENT_LOOKUP.md # バリアント・インポートパス一覧(自動生成)
23
24
  ```
24
25
 
26
+ UI コンポーネント・画面の生成/修正・レビューの前には、必ず
27
+ `.claude/skills/ksk-design-system/SKILL.md` を読み、その判断基準に従うこと
28
+ (トークン選定・コンポーネント選択・レビュー優先順位・例外運用。迷ったら同ディレクトリの `references/` を参照)。
29
+
25
30
  **必ず `contracts/rules.json` の `prohibited` と `aiPatterns` を確認してから実装すること。**
26
31
  特に `aiPatterns` は AI が典型的に犯すパターン集 — 自分が生成しようとしているコードと照合すること。
27
32
 
@@ -86,6 +91,22 @@ Brand色を差し替え(10行)→ Primitive Layer → Semantic Layer → Bri
86
91
 
87
92
  ---
88
93
 
94
+ ## AIモデルの使い分け方針
95
+
96
+ | モデル | 用途 |
97
+ |--------|------|
98
+ | `claude-fable-5` | 最難関の設計・長時間エージェント作業のみ(高コストのため温存) |
99
+ | `claude-opus-4-8` | 通常のUI実装・レビュー・リファクタの既定 |
100
+
101
+ **検証ループを使う場合:** 実装 = Fable 5 / 検証 = Opus 4.8 のように実装者と検証者で別モデルを使う(同一モデルは同じバイアスを共有し独立検証にならない)。
102
+
103
+ **Fable 5 使用時の注意:**
104
+ - thinking は常時オン(パラメータ省略でデフォルトに任せる)
105
+ - refusal 時は `fallbacks` で Opus 4.8 に自動フォールバック
106
+ - 30日データ保持が必須
107
+
108
+ ---
109
+
89
110
  ## ドキュメント構成
90
111
 
91
112
  | ファイル | 内容 |
package/CLAUDE.md CHANGED
@@ -51,6 +51,22 @@ Brand色を差し替え(10行)→ Primitive Layer → Semantic Layer → Bri
51
51
 
52
52
  ---
53
53
 
54
+ ## AIモデルの使い分け方針
55
+
56
+ | モデル | 用途 |
57
+ |--------|------|
58
+ | `claude-fable-5` | 最難関の設計・長時間エージェント作業のみ(高コストのため温存) |
59
+ | `claude-opus-4-8` | 通常のUI実装・レビュー・リファクタの既定 |
60
+
61
+ **検証ループを使う場合:** 実装 = Fable 5 / 検証 = Opus 4.8 のように実装者と検証者で別モデルを使う(同一モデルは同じバイアスを共有し独立検証にならない)。
62
+
63
+ **Fable 5 使用時の注意:**
64
+ - thinking は常時オン(パラメータ省略でデフォルトに任せる)
65
+ - refusal 時は `fallbacks` で Opus 4.8 に自動フォールバック
66
+ - 30日データ保持が必須
67
+
68
+ ---
69
+
54
70
  ## ドキュメント構成
55
71
 
56
72
  | ファイル | 内容 |
package/NATIVE_RECIPES.md CHANGED
@@ -184,3 +184,49 @@ Web では `CompactFilePicker` / `ImageAttachmentPicker` が hidden file input
184
184
  </BottomSheetFrame>
185
185
  </Sheet>
186
186
  ```
187
+
188
+ ## Caption / attribution text
189
+
190
+ 出典・著作権表示など、控えめな注釈は `Text` の `variant="caption-strong"` を使います(11px・font-semibold 相当)。`text-[11px] font-semibold leading-4 text-hint` のようなマジックナンバーをローカルに書きません。色は未指定なら自動で hint 相当(`text.low-emphasis`)になります。
191
+
192
+ ```tsx
193
+ import { Text } from "ksk-design-system/native/ui"
194
+
195
+ {citationOf(question) && (
196
+ <Text variant="caption-strong" style={{ marginTop: 12 }}>
197
+ {citationOf(question)}
198
+ </Text>
199
+ )}
200
+ ```
201
+
202
+ 通常の注釈(強調不要)には既存の `variant="caption"`(11px・通常ウェイト)を使います。
203
+
204
+ ## Masked / teaser progress bars
205
+
206
+ 未課金ユーザー向けのティザー表示など、実データを見せたくない進捗バーは `Progress` の `masked` を使います。`masked=true` の間はバー幅・色ともに `value`/`autoColor` を無視し固定表示になるため、幅から実データを逆算されません。
207
+
208
+ ```tsx
209
+ import { Progress, Text } from "ksk-design-system/native/ui"
210
+
211
+ <Text variant="body.sm">{masked ? "🔒 ??%" : `${accuracy}%(${correct}/${answered})`}</Text>
212
+ <Progress value={accuracy} masked={masked} />
213
+ ```
214
+
215
+ Web 版 `Progress`(`ksk-design-system` の `Progress`)にも同じ `masked` prop があります。
216
+
217
+ ## Static document viewer (privacy policy / terms)
218
+
219
+ プライバシーポリシー・利用規約などの静的文書画面は `DocumentScreen` + `Prose` を使います。見出し・本文・最終更新日・戻るヘッダのタイポとスペーシングは DS 側で一元管理されるため、consumer は `sections` の原稿データだけ持てば済みます。
220
+
221
+ ```tsx
222
+ import { DocumentScreen, Prose } from "ksk-design-system/native/ui"
223
+
224
+ const POLICY_SECTIONS = [
225
+ { title: "個人情報の取得", body: ["本アプリは以下の情報を取得します。", "…"] },
226
+ { title: "個人情報の利用目的", body: ["取得した情報は次の目的で利用します。"] },
227
+ ]
228
+
229
+ <DocumentScreen title="プライバシーポリシー" lastUpdated="2026年7月7日" onBack={() => navigation.goBack()}>
230
+ <Prose sections={POLICY_SECTIONS} />
231
+ </DocumentScreen>
232
+ ```
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # KSK Design System
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/ksk-design-system.svg)](https://www.npmjs.com/package/ksk-design-system)
4
+ [![npm downloads/month](https://img.shields.io/npm/dm/ksk-design-system.svg)](https://npm-stat.com/charts.html?package=ksk-design-system)
5
+ [![npm downloads total](https://img.shields.io/npm/dt/ksk-design-system.svg)](https://npm-stat.com/charts.html?package=ksk-design-system)
6
+ [![license](https://img.shields.io/npm/l/ksk-design-system.svg)](./LICENSE)
7
+
3
8
  複数クライアント案件を **1つのデザインシステム** で高速に回すために設計された、React 製のマルチテーマ対応 UI ライブラリ。BtoB / SaaS の信頼感と EC / BtoC の購買体験、2つのドメインの設計思想を統合しています。
4
9
 
5
10
  **🔗 ライブ Storybook → https://ksk-design-system.vercel.app**
6
11
 
7
- 125 コンポーネントを実際に操作・確認できます。
12
+ 133 コンポーネントを実際に操作・確認できます。
8
13
 
9
14
  ---
10
15
 
@@ -14,7 +19,7 @@
14
19
  - **アクセシブル** — shadcn/ui(Radix UI ベース)+ `@storybook/addon-a11y` で a11y を担保
15
20
  - **Tailwind CSS v4 ネイティブ** — `@theme` ベースのトークン設計
16
21
  - **型安全** — React 19 + TypeScript、CVA によるバリアント管理
17
- - **125 Web コンポーネント + 126 React Native exports** — Web 125(UI 57 / EC 11 / 管理 8 / シェル 3 / パターン 46)+ RN `native/ui` 公開 export 126
22
+ - **133 Web コンポーネント + 134 React Native exports** — Web 133(UI 58 / パターン 52 / EC 12 / 管理 8 / シェル 3)+ RN `native/ui` 公開 export 134
18
23
  - **iOS 26 Liquid Glass 対応** — RN 側 `GlassView` + `Button variant="glass"`、Web 側 `.glass` CSS マテリアル
19
24
 
20
25
  ## 🎨 テーマ
@@ -131,7 +136,7 @@ import { BottomTabBar } from "ksk-design-system"
131
136
 
132
137
  ### React Native / Expo
133
138
 
134
- `ksk-design-system/native/ui` から直接 RN 用コンポーネント export(126 個)を import できます。iOS 26 の **Liquid Glass** にも対応:
139
+ `ksk-design-system/native/ui` から直接 RN 用コンポーネント export(134 個)を import できます。iOS 26 の **Liquid Glass** にも対応:
135
140
 
136
141
  ```tsx
137
142
  import { ThemeProvider, Button, Card, GlassView } from "ksk-design-system/native/ui"
@@ -182,6 +187,21 @@ DS コンポーネントを最大限活用したモックが `src/prototypes/`
182
187
  - **npm**: https://www.npmjs.com/package/ksk-design-system
183
188
  - 設計思想・トークン体系の詳細は `CLAUDE.md` / `DESIGN.md` を参照
184
189
 
190
+ ## 📈 ダウンロード数
191
+
192
+ npm の公開統計から、インストール数を確認できます。
193
+
194
+ ```bash
195
+ npm run metrics # 直近の DL 数・推移・バージョン別内訳を表示
196
+ npm run metrics -- --json # 生データを JSON で出力
197
+ npm run metrics -- --range last-year
198
+ ```
199
+
200
+ - リアルタイムのグラフ: https://npm-stat.com/charts.html?package=ksk-design-system
201
+ - README 冒頭のバッジは shields.io 経由で常時最新の月間 DL 数を表示
202
+
203
+ > npm は匿名集計のため、CI やミラーの重複を含む **install 回数の目安** です(ユニークユーザー数ではありません)。
204
+
185
205
  ## 📄 ライセンス
186
206
 
187
207
  [MIT](./LICENSE) © 奥野圭祐 (Keisuke Okuno)
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "meta": {
3
3
  "name": "KSK Design System — Component Contracts",
4
- "version": "1.34.0",
4
+ "version": "1.43.0",
5
5
  "description": "全コンポーネントの構造化定義。バリアント・アクセシビリティ要件・使用ルールを機械可読形式で管理。",
6
6
  "counts": {
7
- "ui": 58,
8
- "patterns": 51,
7
+ "ui": 61,
8
+ "patterns": 52,
9
9
  "commerce": 12,
10
10
  "admin": 8,
11
11
  "shells": 3,
12
- "total": 132
12
+ "total": 136
13
13
  }
14
14
  },
15
15
  "ui": [
@@ -72,6 +72,51 @@
72
72
  "Must use <Input> not <input>"
73
73
  ]
74
74
  },
75
+ {
76
+ "name": "CommitInput",
77
+ "path": "src/components/ui/commit-input.tsx",
78
+ "description": "IME(日本語変換)を壊さない Input の確定時コミット版。value + onCommit contract。store 直結の inline 編集で、変換中に onChange が store へ書き込んで変換が中断される問題を防ぐ。視覚は Input に完全委譲。共通ロジックは useCommitDraft フック。",
79
+ "variants": [],
80
+ "accessibility": [
81
+ "Must pair with <Label>"
82
+ ],
83
+ "rules": [
84
+ "value/onCommit contract。value は controlled、確定タイミングでのみ onCommit が呼ばれる",
85
+ "変換(composition)中は commit せず draft のみ更新。compositionEnd / 非変換入力時に commit",
86
+ "外部 value 変更は非変換中のみ draft へ反映(realtime 同期対応)",
87
+ "store 直結 controlled input で IME が壊れる場合に Input の代わりに使う"
88
+ ]
89
+ },
90
+ {
91
+ "name": "CommitTextarea",
92
+ "path": "src/components/ui/commit-textarea.tsx",
93
+ "description": "IME(日本語変換)を壊さない Textarea の確定時コミット版。value + onCommit contract。CommitInput と同じ流儀で compositionEnd / 非変換入力時のみ commit。視覚は Textarea に完全委譲。共通ロジックは useCommitDraft フック。",
94
+ "variants": [],
95
+ "accessibility": [
96
+ "Must pair with <Label>"
97
+ ],
98
+ "rules": [
99
+ "value/onCommit contract。value は controlled、確定タイミングでのみ onCommit が呼ばれる",
100
+ "変換(composition)中は commit せず draft のみ更新。compositionEnd / 非変換入力時に commit",
101
+ "外部 value 変更は非変換中のみ draft へ反映(realtime 同期対応)",
102
+ "store 直結 controlled textarea で IME が壊れる場合に Textarea の代わりに使う"
103
+ ]
104
+ },
105
+ {
106
+ "name": "CommitAutoGrowTextarea",
107
+ "path": "src/components/ui/commit-auto-grow-textarea.tsx",
108
+ "description": "IME(日本語変換)を壊さない AutoGrowTextarea の確定時コミット版。value + onCommit contract。AutoGrowTextarea の onChange は (value:string) を渡すため変換中判定は内部 composingRef のみで行う。視覚・auto-grow は AutoGrowTextarea に完全委譲。共通ロジックは useCommitDraft フック。",
109
+ "variants": [],
110
+ "accessibility": [
111
+ "Must pair with <Label>"
112
+ ],
113
+ "rules": [
114
+ "value/onCommit contract。value は controlled、確定タイミングでのみ onCommit が呼ばれる",
115
+ "変換(composition)中は commit せず draft のみ更新。compositionEnd / 非変換入力時に commit",
116
+ "外部 value 変更は非変換中のみ draft へ反映(realtime 同期対応)",
117
+ "store 直結 controlled AutoGrowTextarea で IME が壊れる場合に代わりに使う"
118
+ ]
119
+ },
75
120
  {
76
121
  "name": "Calendar",
77
122
  "path": "src/components/ui/calendar.tsx",
@@ -1275,12 +1320,14 @@
1275
1320
  {
1276
1321
  "name": "CountdownHero",
1277
1322
  "path": "src/components/patterns/countdown-hero.tsx",
1278
- "description": "装飾的な serif 数字で目標日までの残日数を表示するヒーロー表示。belle-todo の CountdownSection を参考に、日付編集フォーム・wedding イラスト・i18n・store は持ち込まず表示専用に再設計(Issue #110)。",
1323
+ "description": "装飾的な serif 数字で目標日までの残日数を表示するヒーロー表示。belle-todo の CountdownSection を参考に、日付編集フォーム・wedding イラスト・i18n・store は持ち込まず表示専用に再設計(Issue #110)。dateLabel prop で数字の下に目標日そのもの(消費側でフォーマット)を、todayValue prop で当日に数字 0 の代わりの文言を表示できる(Issue #118)。",
1279
1324
  "features": [
1280
1325
  "large-serif-number",
1281
1326
  "today-past-active-states",
1282
1327
  "illustration-slot",
1283
- "iso-string-or-date-target"
1328
+ "iso-string-or-date-target",
1329
+ "date-label-slot",
1330
+ "today-value-override"
1284
1331
  ],
1285
1332
  "rules": [
1286
1333
  "既存の CountdownTimer(残日数ピル表示)とは別コンポーネント。装飾ヒーロー表示専用で置き換えない。",
@@ -1589,6 +1636,25 @@
1589
1636
  "フォーム/詳細の中身は DetailSheetScaffold と KeyboardAwareSheetFooter を使う"
1590
1637
  ]
1591
1638
  },
1639
+ {
1640
+ "name": "SideDrawerFrame",
1641
+ "path": "src/components/patterns/side-drawer-frame.tsx",
1642
+ "description": "SheetContent(side=right/left) の詳細ドロワー outer frame preset。全高・padding無し・flex縦・幅md を1つの口でまとめる。PC の右詳細ドロワー用(モバイルの下部シートは BottomSheetFrame)。swipeToClose は side に追従した方向で閉じる。",
1643
+ "variants": [
1644
+ "left",
1645
+ "right"
1646
+ ],
1647
+ "features": [
1648
+ "full-height side drawer",
1649
+ "flex column scroll composition",
1650
+ "side-following swipe-to-close"
1651
+ ],
1652
+ "rules": [
1653
+ "詳細ドロワーの className 上書き(p-0 w-full max-w-md flex flex-col overflow-hidden)を consumer 側に重複させず SideDrawerFrame を使う",
1654
+ "中身は DetailSheetScaffold + 固定フッタで組む(本文 flex-1 overflow-y-auto)",
1655
+ "モバイルの下から出る詳細/フォームは BottomSheetFrame を使う"
1656
+ ]
1657
+ },
1592
1658
  {
1593
1659
  "name": "SettingsSection / SettingsListRow",
1594
1660
  "path": "src/components/patterns/settings-section.tsx",