@fabrica_communications/design-system 0.1.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 (59) hide show
  1. package/README.md +54 -0
  2. package/package.json +91 -0
  3. package/src/app/components/page.tsx +19 -0
  4. package/src/app/favicon.ico +0 -0
  5. package/src/app/foundations/colors/page.tsx +11 -0
  6. package/src/app/foundations/page.tsx +11 -0
  7. package/src/app/foundations/typography/page.tsx +11 -0
  8. package/src/app/getting-started/page.tsx +11 -0
  9. package/src/app/globals.css +3 -0
  10. package/src/app/layout.tsx +61 -0
  11. package/src/app/page.tsx +994 -0
  12. package/src/components/shared/gap.tsx +103 -0
  13. package/src/components/shared/page-header.tsx +11 -0
  14. package/src/components/shared/page-top-button.tsx +27 -0
  15. package/src/components/ui/accordion.tsx +66 -0
  16. package/src/components/ui/alert-dialog.tsx +157 -0
  17. package/src/components/ui/aspect-ratio.tsx +11 -0
  18. package/src/components/ui/badge.tsx +46 -0
  19. package/src/components/ui/breadcrumb.tsx +109 -0
  20. package/src/components/ui/button.mdx +39 -0
  21. package/src/components/ui/button.stories.tsx +88 -0
  22. package/src/components/ui/button.tsx +53 -0
  23. package/src/components/ui/card.tsx +92 -0
  24. package/src/components/ui/carousel.tsx +241 -0
  25. package/src/components/ui/checkbox.tsx +32 -0
  26. package/src/components/ui/dialog.tsx +143 -0
  27. package/src/components/ui/field.tsx +248 -0
  28. package/src/components/ui/heading.tsx +51 -0
  29. package/src/components/ui/icon-definitions.ts +532 -0
  30. package/src/components/ui/icon.tsx +115 -0
  31. package/src/components/ui/input-group.tsx +170 -0
  32. package/src/components/ui/input.tsx +21 -0
  33. package/src/components/ui/label.tsx +24 -0
  34. package/src/components/ui/native-select.tsx +48 -0
  35. package/src/components/ui/pagination.tsx +127 -0
  36. package/src/components/ui/radio-group.tsx +45 -0
  37. package/src/components/ui/scroll-area.tsx +58 -0
  38. package/src/components/ui/section-container.tsx +24 -0
  39. package/src/components/ui/select.tsx +187 -0
  40. package/src/components/ui/separator.tsx +28 -0
  41. package/src/components/ui/skeleton.tsx +13 -0
  42. package/src/components/ui/sonner.tsx +40 -0
  43. package/src/components/ui/switch.mdx +20 -0
  44. package/src/components/ui/switch.stories.tsx +54 -0
  45. package/src/components/ui/switch.tsx +66 -0
  46. package/src/components/ui/table.tsx +119 -0
  47. package/src/components/ui/tabs.tsx +66 -0
  48. package/src/components/ui/text-link.tsx +72 -0
  49. package/src/components/ui/text.tsx +54 -0
  50. package/src/components/ui/textarea.tsx +18 -0
  51. package/src/components/ui/toggle.tsx +47 -0
  52. package/src/components/ui/tooltip.tsx +61 -0
  53. package/src/index.ts +37 -0
  54. package/src/lib/utils.ts +6 -0
  55. package/src/styles/globals.css +162 -0
  56. package/src/styles/variables.css +261 -0
  57. package/tokens/design-tokens.tokens.json +1652 -0
  58. package/tokens/design-tokens.tokens/344/270/213/345/261/244.json +1659 -0
  59. package/tokens//345/205/250/343/203/227/343/203/255/343/202/270/343/202/247/343/202/257/343/203/210/345/205/261/351/200/232_design-tokens.tokens.json +572 -0
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Fabrica Design System
2
+
3
+ Fabricaの共通UIコンポーネントとデザイントークンを提供するリポジトリです。
4
+
5
+ ## 利用対象
6
+ - **デザインシステム担当**: 本リポジトリを更新・配布します。
7
+ - **通常の開発者**: `fabrica-product-starter` を利用し、基本的に本リポジトリは触りません。
8
+
9
+ ## 必要バージョン
10
+ - Node.js v22 以上
11
+ - npm(pnpm / Yarn は使用しません)
12
+
13
+ ## 初期セットアップ
14
+ ```bash
15
+ npm install
16
+ npm run dev
17
+ ```
18
+
19
+ ## よく使うスクリプト
20
+ - `npm run dev`: Next.js 開発サーバーを起動
21
+ - `npm run build`: 本番ビルドを作成
22
+ - `npm run lint`: Lint チェック
23
+ - `npm run storybook`: Storybook を起動(ポート 6006)
24
+ - `npm run watch:icons`: `public/icons/*.svg` の変更を監視して `icon-definitions.ts` を再生成
25
+ - `npm run generate:icons`: アイコン定義の手動再生成
26
+
27
+ ## 公開と利用(npmjs)
28
+ 本体は `npm publish` で公開し、スターター側は `@fabrica_communications/design-system` をインストールします。
29
+
30
+ ## MCPサーバー(ローカル)
31
+ MCPサーバーは `mcp-server/` にあります。ローカルでの起動は以下の通りです。
32
+
33
+ ```bash
34
+ cd mcp-server
35
+ npm install
36
+ npm run build
37
+ npm run mcp
38
+ ```
39
+
40
+ ## アイコン運用
41
+ - 新しいSVGアイコンは `public/icons/` に配置してください。
42
+ - 開発中は `npm run watch:icons` を常駐させることで、SVG追加・更新時に `src/components/ui/icon-definitions.ts` が自動更新されます。
43
+ - 自動生成を忘れてコミットしないよう、PR作成前に差分がないか確認してください。
44
+
45
+ ## CSS / デザイントークン運用
46
+
47
+ ### フォント設定
48
+ デフォルトフォントとして **Noto Sans JP** を使用しています。`next/font/google` を使用して最適化されており、`src/styles/globals.css` でフォールバックフォントとして「Hiragino Sans」「Hiragino Kaku Gothic ProN」「Helvetica Neue」を設定しています。
49
+
50
+ ### デザイントークン運用
51
+ - Figmaからエクスポートしたデザイントークンを `tokens/` ディレクトリに配置します。
52
+ - トークン配置後は `node scripts/remove-japanese-tokens.mjs` を実行して余分な日本語ラベルを削除します。
53
+ - CSSビルドのため `npx style-dictionary build` を実行します(出力先: `src/styles/variables.css`)。
54
+ - 最後に `node scripts/postprocess-design-tokens.mjs` を実行し、`variables.css` のrem値を1/10に調整しつつ、`--master-` などのカスタムプレフィックスを通常の `--` に統一します。
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@fabrica_communications/design-system",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "scripts": {
10
+ "dev": "next dev",
11
+ "build": "next build",
12
+ "start": "next start",
13
+ "lint": "eslint",
14
+ "generate:icons": "node scripts/generate-icons.mjs",
15
+ "watch:icons": "node --watch --watch-path=public/icons scripts/generate-icons.mjs",
16
+ "storybook": "storybook dev -p 6006",
17
+ "build-storybook": "storybook build"
18
+ },
19
+ "main": "./src/index.ts",
20
+ "types": "./src/index.ts",
21
+ "imports": {
22
+ "@/lib/*": "./src/lib/*.ts",
23
+ "@/components/*": "./src/components/*"
24
+ },
25
+ "exports": {
26
+ ".": "./src/index.ts",
27
+ "./styles.css": "./src/styles/globals.css"
28
+ },
29
+ "files": [
30
+ "src",
31
+ "tokens",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "dependencies": {
36
+ "@radix-ui/react-accordion": "^1.2.12",
37
+ "@radix-ui/react-alert-dialog": "^1.1.15",
38
+ "@radix-ui/react-aspect-ratio": "^1.1.7",
39
+ "@radix-ui/react-checkbox": "^1.3.3",
40
+ "@radix-ui/react-dialog": "^1.1.15",
41
+ "@radix-ui/react-label": "^2.1.7",
42
+ "@radix-ui/react-radio-group": "^1.3.8",
43
+ "@radix-ui/react-scroll-area": "^1.2.10",
44
+ "@radix-ui/react-select": "^2.2.6",
45
+ "@radix-ui/react-separator": "^1.1.7",
46
+ "@radix-ui/react-slot": "^1.2.3",
47
+ "@radix-ui/react-switch": "^1.2.6",
48
+ "@radix-ui/react-tabs": "^1.1.13",
49
+ "@radix-ui/react-toggle": "^1.1.10",
50
+ "@radix-ui/react-tooltip": "^1.2.8",
51
+ "class-variance-authority": "^0.7.1",
52
+ "clsx": "^2.1.1",
53
+ "embla-carousel-react": "^8.6.0",
54
+ "lucide-react": "^0.546.0",
55
+ "next-themes": "^0.4.6",
56
+ "sonner": "^2.0.7",
57
+ "tailwind-merge": "^3.3.1",
58
+ "tw-animate-css": "^1.4.0"
59
+ },
60
+ "peerDependencies": {
61
+ "next": "^16.1.1",
62
+ "react": "19.2.0",
63
+ "react-dom": "19.2.0"
64
+ },
65
+ "devDependencies": {
66
+ "@mdx-js/loader": "^3.1.1",
67
+ "@next/mdx": "^16.1.1",
68
+ "@storybook/addon-a11y": "^10.1.11",
69
+ "@storybook/addon-docs": "^10.1.11",
70
+ "@storybook/addon-onboarding": "^10.1.11",
71
+ "@storybook/nextjs-vite": "^10.1.11",
72
+ "@tailwindcss/postcss": "^4",
73
+ "@types/node": "^20",
74
+ "@types/react": "^19",
75
+ "@types/react-dom": "^19",
76
+ "baseline-browser-mapping": "^2.9.11",
77
+ "eslint": "^9",
78
+ "eslint-config-next": "16.0.1",
79
+ "eslint-plugin-storybook": "^0.12.0",
80
+ "next": "^16.1.1",
81
+ "prettier": "^3.8.1",
82
+ "react": "19.2.0",
83
+ "react-dom": "19.2.0",
84
+ "shadcn": "^3.5.0",
85
+ "storybook": "^10.1.11",
86
+ "style-dictionary": "^5.1.1",
87
+ "tailwindcss": "^4",
88
+ "typescript": "^5",
89
+ "vite": "^7.3.0"
90
+ }
91
+ }
@@ -0,0 +1,19 @@
1
+ "use client";
2
+
3
+ import ComponentsIntro from "../../../content/components/index.mdx";
4
+ import ButtonDoc from "../../../content/components/button.mdx";
5
+ import SwitchDoc from "../../../content/components/switch.mdx";
6
+
7
+ export default function ComponentsPage() {
8
+ return (
9
+ <article className="space-y-10 p-6">
10
+ <ComponentsIntro />
11
+ <section>
12
+ <ButtonDoc />
13
+ </section>
14
+ <section>
15
+ <SwitchDoc />
16
+ </section>
17
+ </article>
18
+ );
19
+ }
Binary file
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import Colors from "../../../../content/foundations/colors.mdx";
4
+
5
+ export default function ColorsPage() {
6
+ return (
7
+ <article className="space-y-8 p-6">
8
+ <Colors />
9
+ </article>
10
+ );
11
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import Foundations from "../../../content/foundations/index.mdx";
4
+
5
+ export default function FoundationsPage() {
6
+ return (
7
+ <article className="space-y-8 p-6">
8
+ <Foundations />
9
+ </article>
10
+ );
11
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import Typography from "../../../../content/foundations/typography.mdx";
4
+
5
+ export default function TypographyPage() {
6
+ return (
7
+ <article className="space-y-8 p-6">
8
+ <Typography />
9
+ </article>
10
+ );
11
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import GettingStarted from "../../../content/getting-started/index.mdx";
4
+
5
+ export default function GettingStartedPage() {
6
+ return (
7
+ <article className="space-y-8 p-6">
8
+ <GettingStarted />
9
+ </article>
10
+ );
11
+ }
@@ -0,0 +1,3 @@
1
+ /* Next appルートから読み込む入口。正本は src/styles に集約。 */
2
+ @import "../styles/globals.css";
3
+
@@ -0,0 +1,61 @@
1
+ import type { Metadata } from 'next'
2
+ import Link from 'next/link'
3
+ import { Noto_Sans_JP } from 'next/font/google'
4
+ import './globals.css'
5
+
6
+ import { PageHeader } from '@/components/shared/page-header'
7
+ import { PageTopButton } from '@/components/shared/page-top-button'
8
+ import { Toaster } from '../components/ui/sonner'
9
+
10
+ export const metadata: Metadata = {
11
+ title: 'サイトタイトル',
12
+ description: '説明文です。',
13
+ }
14
+
15
+ const notoSansJP = Noto_Sans_JP({
16
+ subsets: ['latin'],
17
+ weight: ['400', '700'],
18
+ display: 'swap',
19
+ variable: '--font-sans',
20
+ })
21
+
22
+ export default function RootLayout({
23
+ children,
24
+ }: Readonly<{
25
+ children: React.ReactNode
26
+ }>) {
27
+ const navItems = [
28
+ { href: '/getting-started', label: 'Getting Started' },
29
+ { href: '/foundations', label: 'Foundations' },
30
+ { href: '/components', label: 'Components' },
31
+ ]
32
+
33
+ return (
34
+ <html lang="ja">
35
+ <body className={`font-sans ${notoSansJP.variable}`}>
36
+ <PageHeader />
37
+ <div className="flex min-h-screen bg-(--usage-background)">
38
+ <aside className="w-64 shrink-0 border-r border-(--usage-border) bg-white px-4 py-6">
39
+ <div className="mb-4 text-xs font-semibold uppercase tracking-wide text-(--primitive-neutral-600)">
40
+ Docs
41
+ </div>
42
+ <nav className="space-y-2">
43
+ {navItems.map((item) => (
44
+ <Link
45
+ key={item.href}
46
+ href={item.href}
47
+ className="block rounded-md px-2 py-1 text-sm font-medium text-(--body-text) hover:bg-(--usage-background)"
48
+ >
49
+ {item.label}
50
+ </Link>
51
+ ))}
52
+ </nav>
53
+ </aside>
54
+ <div className="flex-1">{children}</div>
55
+ </div>
56
+ <PageTopButton />
57
+ <Toaster />
58
+ </body>
59
+ </html>
60
+ )
61
+ }