@godxjp/ui 19.6.0 → 20.0.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 (137) hide show
  1. package/dist/components/data-display/card.d.ts +2 -2
  2. package/dist/components/data-display/collapsible.d.ts +23 -4
  3. package/dist/components/data-display/collapsible.js +119 -4
  4. package/dist/components/data-display/index.d.ts +3 -1
  5. package/dist/components/data-display/index.js +2 -0
  6. package/dist/components/data-display/legend.d.ts +15 -0
  7. package/dist/components/data-display/legend.js +11 -0
  8. package/dist/components/data-display/list-row.js +1 -1
  9. package/dist/components/data-display/popover.d.ts +58 -5
  10. package/dist/components/data-display/popover.js +206 -27
  11. package/dist/components/data-display/progress.d.ts +50 -2
  12. package/dist/components/data-display/progress.js +57 -9
  13. package/dist/components/data-entry/calendar.d.ts +1 -1
  14. package/dist/components/data-entry/calendar.js +67 -32
  15. package/dist/components/data-entry/checkbox.d.ts +19 -6
  16. package/dist/components/data-entry/checkbox.js +55 -16
  17. package/dist/components/data-entry/choice-option.d.ts +1 -1
  18. package/dist/components/data-entry/date-range-picker.d.ts +1 -1
  19. package/dist/components/data-entry/field.js +0 -1
  20. package/dist/components/data-entry/form.js +1 -1
  21. package/dist/components/data-entry/label.d.ts +3 -2
  22. package/dist/components/data-entry/label.js +23 -10
  23. package/dist/components/data-entry/month-picker.d.ts +1 -1
  24. package/dist/components/data-entry/month-range-picker.d.ts +1 -1
  25. package/dist/components/data-entry/transfer.js +16 -6
  26. package/dist/components/data-entry/tree-select-strategy.d.ts +1 -1
  27. package/dist/components/data-entry/tree-select.js +29 -12
  28. package/dist/components/data-entry/tree-utils.d.ts +1 -1
  29. package/dist/components/data-entry/upload.js +7 -2
  30. package/dist/components/feedback/dialog.d.ts +105 -38
  31. package/dist/components/feedback/dialog.js +272 -194
  32. package/dist/components/feedback/overlay-close-focus.d.ts +31 -0
  33. package/dist/components/feedback/overlay-close-focus.js +31 -0
  34. package/dist/components/feedback/overlay-header-tone.d.ts +1 -1
  35. package/dist/components/feedback/sheet.d.ts +53 -11
  36. package/dist/components/feedback/sheet.js +150 -81
  37. package/dist/components/feedback/tooltip.d.ts +51 -7
  38. package/dist/components/feedback/tooltip.js +107 -25
  39. package/dist/components/general/button.js +2 -2
  40. package/dist/components/general/logo.d.ts +17 -0
  41. package/dist/components/general/logo.js +22 -16
  42. package/dist/components/layout/app-shell.d.ts +1 -1
  43. package/dist/components/layout/app-shell.js +52 -8
  44. package/dist/components/layout/aspect-ratio.js +0 -1
  45. package/dist/components/layout/auth-divider.js +0 -1
  46. package/dist/components/layout/flex.d.ts +1 -1
  47. package/dist/components/layout/flex.js +19 -2
  48. package/dist/components/layout/nav-surface.d.ts +26 -0
  49. package/dist/components/layout/nav-surface.js +17 -0
  50. package/dist/components/layout/org-switcher.d.ts +5 -1
  51. package/dist/components/layout/org-switcher.js +5 -3
  52. package/dist/components/layout/separator.js +0 -1
  53. package/dist/components/layout/sidebar.js +4 -1
  54. package/dist/components/layout/split-pane.d.ts +14 -1
  55. package/dist/components/layout/split-pane.js +26 -13
  56. package/dist/components/layout/topbar-item.js +1 -2
  57. package/dist/components/navigation/app-setting-picker.js +21 -2
  58. package/dist/components/navigation/app-setting-toggle.d.ts +16 -0
  59. package/dist/components/navigation/app-setting-toggle.js +96 -0
  60. package/dist/components/navigation/dropdown-menu.d.ts +199 -18
  61. package/dist/components/navigation/dropdown-menu.js +344 -117
  62. package/dist/components/navigation/index.d.ts +2 -0
  63. package/dist/components/navigation/index.js +2 -0
  64. package/dist/components/navigation/pagination-utils.d.ts +2 -1
  65. package/dist/components/navigation/tabs.d.ts +47 -6
  66. package/dist/components/navigation/tabs.js +152 -90
  67. package/dist/components/ui/accordion.d.ts +50 -5
  68. package/dist/components/ui/accordion.js +239 -33
  69. package/dist/components/ui/aspect-ratio.d.ts +23 -2
  70. package/dist/components/ui/aspect-ratio.js +15 -13
  71. package/dist/components/ui/avatar.d.ts +29 -4
  72. package/dist/components/ui/avatar.js +111 -25
  73. package/dist/components/ui/hover-card.d.ts +42 -4
  74. package/dist/components/ui/hover-card.js +183 -27
  75. package/dist/components/ui/label.js +0 -1
  76. package/dist/components/ui/segmented.d.ts +3 -3
  77. package/dist/components/ui/separator.d.ts +8 -2
  78. package/dist/components/ui/separator.js +17 -9
  79. package/dist/components/ui/toggle-group.d.ts +50 -5
  80. package/dist/components/ui/toggle-group.js +79 -20
  81. package/dist/components/ui/toggle.d.ts +31 -5
  82. package/dist/components/ui/toggle.js +42 -3
  83. package/dist/i18n/messages/en.json +8 -0
  84. package/dist/i18n/messages/ja.json +8 -0
  85. package/dist/i18n/messages/vi.json +8 -0
  86. package/dist/lib/control-styles.d.ts +1 -1
  87. package/dist/lib/control-styles.js +1 -1
  88. package/dist/lib/slot.d.ts +32 -0
  89. package/dist/lib/slot.js +22 -0
  90. package/dist/lib/variants.d.ts +22 -3
  91. package/dist/lib/variants.js +56 -1
  92. package/dist/props/components/app.prop.d.ts +25 -1
  93. package/dist/props/components/data-display.prop.d.ts +17 -0
  94. package/dist/props/components/data-entry.prop.d.ts +32 -4
  95. package/dist/props/components/index.d.ts +1 -1
  96. package/dist/props/components/layout.prop.d.ts +118 -5
  97. package/dist/props/components/navigation.prop.d.ts +1 -1
  98. package/dist/props/registry.d.ts +22 -2
  99. package/dist/props/registry.js +33 -2
  100. package/dist/props/vocabulary/content.prop.d.ts +1 -1
  101. package/dist/props/vocabulary/index.d.ts +2 -2
  102. package/dist/props/vocabulary/interaction.prop.d.ts +17 -1
  103. package/dist/props/vocabulary/layout.prop.d.ts +57 -1
  104. package/dist/styles/control.css +142 -1
  105. package/dist/styles/core.css +5 -2
  106. package/dist/styles/data-display-layout.css +72 -0
  107. package/dist/styles/focus-ring.css +4 -0
  108. package/dist/styles/index.css +5 -2
  109. package/dist/styles/layout.css +106 -0
  110. package/dist/styles/shell-layout.css +140 -8
  111. package/dist/styles/text-layout.css +5 -4
  112. package/dist/tokens/base.css +1 -1
  113. package/dist/tokens/components/data-display.css +11 -0
  114. package/dist/tokens/components/shell.css +3 -1
  115. package/dist/tokens/foundation.css +2 -0
  116. package/docs/COMPONENTS.md +9 -3
  117. package/docs/DESIGN-AUTHORITY.md +96 -71
  118. package/docs/FRAME-COVERAGE-REPORT.md +5 -3
  119. package/docs/README.md +14 -14
  120. package/docs/WHAT-BELONGS-HERE.md +179 -0
  121. package/docs/data-display/legend.tsx +145 -0
  122. package/docs/data-display/progress.tsx +32 -0
  123. package/docs/data-entry/segmented.tsx +1 -1
  124. package/docs/data-entry/select.tsx +2 -2
  125. package/docs/feedback/sheet.tsx +1 -1
  126. package/docs/layout/app-shell-arrangements.tsx +225 -0
  127. package/docs/layout/aspect-ratio.tsx +1 -1
  128. package/docs/navigation/app-setting-picker.tsx +26 -1
  129. package/docs/navigation/app-setting-toggle.tsx +111 -0
  130. package/package.json +11 -8
  131. package/scripts/_agent-setup.mjs +165 -3
  132. package/scripts/consumer-rule.md +98 -0
  133. package/scripts/guinea-pig-skill.md +322 -0
  134. package/scripts/init-guinea-pig.mjs +62 -0
  135. package/scripts/postinstall.mjs +13 -2
  136. package/scripts/ui-audit.mjs +115 -14
  137. /package/dist/tokens/{antd.generated.css → derived.css} +0 -0
@@ -0,0 +1,145 @@
1
+ import {
2
+ Card,
3
+ CardAction,
4
+ CardContent,
5
+ CardDescription,
6
+ CardHeader,
7
+ CardTitle,
8
+ Legend,
9
+ Progress,
10
+ } from "@godxjp/ui/data-display";
11
+ import { Text } from "@godxjp/ui/general";
12
+ import { Flex, PageContainer } from "@godxjp/ui/layout";
13
+
14
+ const COMPLIANCE = [
15
+ { name: "株式会社山田製作所", over: 2, near: 3, done: 12 },
16
+ { name: "佐藤食品株式会社", over: 1, near: 2, done: 9 },
17
+ { name: "東海精密工業株式会社", over: 0, near: 3, done: 21 },
18
+ ];
19
+
20
+ const STATUS_KEYS = [
21
+ { tone: "destructive", label: "期限超過" },
22
+ { tone: "warning", label: "期限間近" },
23
+ { tone: "success", label: "対応済" },
24
+ ] as const;
25
+
26
+ /**
27
+ * Legend — the KEY for a colour-coded surface: which tone means what, in words, once.
28
+ * Composed only from real @godxjp/ui components.
29
+ */
30
+ export default function Demo() {
31
+ return (
32
+ <PageContainer title="Legend" subtitle="tone → 意味 のキー · 凡例">
33
+ <Flex direction="col" gap="lg">
34
+ <Card>
35
+ <CardHeader>
36
+ <CardTitle level={2}>Progress の breakdown と組む</CardTitle>
37
+ <CardDescription>
38
+ CardAction に置くと、カード見出しと同じ行に凡例が並びます。色の意味をカードで
39
+ 一度だけ言い、各行では繰り返しません。
40
+ </CardDescription>
41
+ <CardAction>
42
+ <Legend items={[...STATUS_KEYS]} />
43
+ </CardAction>
44
+ </CardHeader>
45
+ <CardContent>
46
+ <Flex direction="col" gapRaw={11}>
47
+ {COMPLIANCE.map((row) => (
48
+ <Flex key={row.name} align="center" gapRaw={14}>
49
+ <Flex width={180}>
50
+ <Text weight="medium" truncate>
51
+ {row.name}
52
+ </Text>
53
+ </Flex>
54
+ <Flex fill direction="col">
55
+ <Progress
56
+ segments={[
57
+ { value: row.over, tone: "destructive", label: "期限超過" },
58
+ { value: row.near, tone: "warning", label: "期限間近" },
59
+ { value: row.done, tone: "success", label: "対応済" },
60
+ ]}
61
+ aria-label={row.name}
62
+ />
63
+ </Flex>
64
+ <Flex width={150} justify="end" align="center" gapRaw={12}>
65
+ <Text tone="destructive" weight="semibold" tabular>
66
+ {row.over}
67
+ </Text>
68
+ <Text tone="warning" weight="semibold" tabular>
69
+ {row.near}
70
+ </Text>
71
+ <Text tone="success" weight="semibold" tabular>
72
+ {row.done}
73
+ </Text>
74
+ <Text tone="muted" tabular>
75
+ 計 {row.over + row.near + row.done}
76
+ </Text>
77
+ </Flex>
78
+ </Flex>
79
+ ))}
80
+ </Flex>
81
+ </CardContent>
82
+ </Card>
83
+
84
+ <Card>
85
+ <CardHeader>
86
+ <CardTitle level={2}>Tones</CardTitle>
87
+ <CardDescription>
88
+ vocabulary の 7 tone すべてに塗りがあります。色だけで意味を運ばないため label
89
+ は必須です(WCAG 1.4.1)。
90
+ </CardDescription>
91
+ </CardHeader>
92
+ <CardContent>
93
+ <Legend
94
+ items={[
95
+ { tone: "default", label: "既定(primary)" },
96
+ { tone: "success", label: "成功" },
97
+ { tone: "warning", label: "注意" },
98
+ { tone: "destructive", label: "危険" },
99
+ { tone: "info", label: "情報" },
100
+ { tone: "muted", label: "控えめ" },
101
+ { tone: "neutral", label: "中立" },
102
+ ]}
103
+ />
104
+ </CardContent>
105
+ </Card>
106
+
107
+ <Card>
108
+ <CardHeader>
109
+ <CardTitle level={2}>Named legend</CardTitle>
110
+ <CardDescription>
111
+ aria-label を渡すと、その凡例が「何のキーか」を読み上げます。項目は list /
112
+ listitem として並びます。
113
+ </CardDescription>
114
+ </CardHeader>
115
+ <CardContent>
116
+ <Legend items={[...STATUS_KEYS]} aria-label="コンプライアンス状況の凡例" />
117
+ </CardContent>
118
+ </Card>
119
+
120
+ <Card>
121
+ <CardHeader>
122
+ <CardTitle level={2}>Wrapping</CardTitle>
123
+ <CardDescription>
124
+ 狭い幅では折り返します(横スクロールしません)。凡例が視界の外に出ると、色の意味
125
+ そのものが失われるためです。
126
+ </CardDescription>
127
+ </CardHeader>
128
+ <CardContent>
129
+ <Flex width={240}>
130
+ <Legend
131
+ items={[
132
+ { tone: "destructive", label: "期限超過" },
133
+ { tone: "warning", label: "期限間近" },
134
+ { tone: "success", label: "対応済" },
135
+ { tone: "info", label: "確認中" },
136
+ { tone: "muted", label: "対象外" },
137
+ ]}
138
+ />
139
+ </Flex>
140
+ </CardContent>
141
+ </Card>
142
+ </Flex>
143
+ </PageContainer>
144
+ );
145
+ }
@@ -33,6 +33,38 @@ export default function Demo() {
33
33
  </CardContent>
34
34
  </Card>
35
35
 
36
+ <Card>
37
+ <CardHeader>
38
+ <CardTitle level={2}>Breakdown(segments)</CardTitle>
39
+ <CardDescription>
40
+ 1 つの合計を状態ごとに分割します。割合ではなく実数を渡すと、各スライスの比率は
41
+ コンポーネントが計算します。メーターより背の高いトラックになるのは、0.5rem の pill
42
+ 上に 3 色を並べると比率が読めなくなるためです。role=&quot;img&quot;
43
+ として、全スライスを 1 つの名前で読み上げます。
44
+ </CardDescription>
45
+ </CardHeader>
46
+ <CardContent>
47
+ <Flex direction="col" gap="md">
48
+ <Progress
49
+ segments={[
50
+ { value: 2, tone: "destructive", label: "期限超過" },
51
+ { value: 3, tone: "warning", label: "期限間近" },
52
+ { value: 12, tone: "success", label: "対応済" },
53
+ ]}
54
+ label="株式会社山田製作所"
55
+ />
56
+ <Progress
57
+ segments={[
58
+ { value: 0, tone: "destructive", label: "期限超過" },
59
+ { value: 1, tone: "warning", label: "期限間近" },
60
+ { value: 6, tone: "success", label: "対応済" },
61
+ ]}
62
+ label="みどり農産株式会社(0 件のスライスは幅 0)"
63
+ />
64
+ </Flex>
65
+ </CardContent>
66
+ </Card>
67
+
36
68
  <Card>
37
69
  <CardHeader>
38
70
  <CardTitle level={2}>Over capacity</CardTitle>
@@ -7,7 +7,7 @@ import { Flex, PageContainer } from "@godxjp/ui/layout";
7
7
  import { CalendarDays, Columns3, LayoutList, Monitor, Moon, Sun } from "lucide-react";
8
8
 
9
9
  /**
10
- * Segmented — one-of-N from a small, closed, always-visible set. antd's Segmented drawn on Radix
10
+ * Segmented — one-of-N from a small, closed, always-visible set. The enterprise Segmented drawn on Radix
11
11
  * RadioGroup: a recessed track with the chosen item as a lifted slab, radiogroup semantics, arrow
12
12
  * keys between members. The track measures exactly --control-height, so it sits level with an
13
13
  * Input or a Button on the same row.
@@ -286,8 +286,8 @@ export default function Demo() {
286
286
  <CardHeader>
287
287
  <CardTitle level={2}>labelRender · custom selected display</CardTitle>
288
288
  <CardDescription>
289
- `labelRender` (Ant Design) customizes the SELECTED value shown on the trigger: here an
290
- avatar + name + a role badge. The placeholder still shows when nothing is selected.
289
+ `labelRender` customizes the SELECTED value shown on the trigger: here an avatar +
290
+ name + a role badge. The placeholder still shows when nothing is selected.
291
291
  </CardDescription>
292
292
  </CardHeader>
293
293
  <CardContent>
@@ -47,7 +47,7 @@ const headerTones = [
47
47
  * Sheet > SheetTrigger (asChild) > SheetContent(side) > SheetHeader >
48
48
  * SheetTitle (a11y required) > scrollable body > SheetFooter.
49
49
  *
50
- * SheetFooter is an Ant-Design-style PINNED action bar: it sticks to the bottom
50
+ * SheetFooter is a PINNED action bar: it sticks to the bottom
51
51
  * via mt-auto, draws a full-bleed top border, and right-aligns its actions with
52
52
  * the PRIMARY button rightmost. A destructive / clear / reset action goes
53
53
  * far-LEFT · give THAT button className="me-auto". Never stack footer buttons
@@ -0,0 +1,225 @@
1
+ import { useState } from "react";
2
+ import { AppShell, Flex, PageContainer, Sidebar, Topbar } from "@godxjp/ui/layout";
3
+ import type { SidebarSectionProp } from "@godxjp/ui/layout";
4
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display";
5
+ import { Button, Text } from "@godxjp/ui/general";
6
+ import {
7
+ Building2,
8
+ Hash,
9
+ LayoutDashboard,
10
+ MessagesSquare,
11
+ PanelLeftClose,
12
+ PanelLeftOpen,
13
+ Settings,
14
+ Users,
15
+ } from "lucide-react";
16
+
17
+ /**
18
+ * AppShell · column arrangements.
19
+ *
20
+ * THE SHELL HAS TWO INDEPENDENT GEOMETRY AXES, and this page exists so they can be seen next to
21
+ * each other rather than rediscovered:
22
+ *
23
+ * - `topbarSpan` — how far the BAR reaches. "content" starts it beside the sidebar (the rail
24
+ * runs the full window height); "full" runs it edge to edge with the navigation beneath it.
25
+ * - `navRail` — how many navigation COLUMNS there are. Passing the slot adds a second,
26
+ * narrower track before the sidebar: the workspace/organization switcher shape.
27
+ *
28
+ * They are axes, not a preset list. All four combinations are real product shapes, so there is no
29
+ * invalid pairing and nothing to reconcile — which is why the rail is a SLOT and not a fourth
30
+ * value bolted onto `topbarSpan`.
31
+ *
32
+ * Composed only from real @godxjp/ui components.
33
+ */
34
+
35
+ const WORKSPACE_RAIL: SidebarSectionProp[] = [
36
+ {
37
+ items: [
38
+ { id: "home", label: "ホーム", icon: LayoutDashboard },
39
+ { id: "chat", label: "チャット", icon: MessagesSquare },
40
+ { id: "people", label: "メンバー", icon: Users },
41
+ { id: "admin", label: "管理", icon: Settings },
42
+ ],
43
+ },
44
+ ];
45
+
46
+ const CHANNELS: SidebarSectionProp[] = [
47
+ {
48
+ label: "チャンネル",
49
+ items: [
50
+ { id: "general", label: "general", icon: Hash },
51
+ { id: "design", label: "design", icon: Hash },
52
+ { id: "incident", label: "incident-2026", icon: Hash },
53
+ ],
54
+ },
55
+ {
56
+ label: "ダイレクトメッセージ",
57
+ items: [
58
+ { id: "dm-sato", label: "佐藤 花子", icon: Users },
59
+ { id: "dm-tanaka", label: "田中 一郎", icon: Users },
60
+ ],
61
+ },
62
+ ];
63
+
64
+ export default function Demo() {
65
+ const [withRail, setWithRail] = useState(true);
66
+ const [fullSpan, setFullSpan] = useState(false);
67
+ const [collapsed, setCollapsed] = useState(false);
68
+
69
+ // The rail is ordinary navigation, so it is an ordinary <Sidebar> in icon-only mode — the shell
70
+ // owns the TRACK, never the content that goes in it.
71
+ const rail = (
72
+ <Sidebar aria-label="ワークスペース" activeId="chat" collapsed sections={WORKSPACE_RAIL} />
73
+ );
74
+
75
+ return (
76
+ <AppShell
77
+ topbarSpan={fullSpan ? "full" : "content"}
78
+ navRail={withRail ? rail : undefined}
79
+ navRailLabel="ワークスペース"
80
+ sidebarCollapsed={collapsed}
81
+ logo={
82
+ <Flex align="center" gap="sm">
83
+ <Building2 aria-hidden="true" />
84
+ <Text weight="medium">CoreChat</Text>
85
+ </Flex>
86
+ }
87
+ sidebar={
88
+ <Sidebar
89
+ aria-label="チャンネル"
90
+ activeId="general"
91
+ collapsed={collapsed}
92
+ sections={CHANNELS}
93
+ />
94
+ }
95
+ topbar={
96
+ <Topbar
97
+ start={
98
+ <Button
99
+ size="sm"
100
+ variant="ghost"
101
+ aria-label={collapsed ? "サイドバーを開く" : "サイドバーを閉じる"}
102
+ aria-expanded={!collapsed}
103
+ onClick={() => setCollapsed((c) => !c)}
104
+ >
105
+ {collapsed ? (
106
+ <PanelLeftOpen aria-hidden="true" />
107
+ ) : (
108
+ <PanelLeftClose aria-hidden="true" />
109
+ )}
110
+ </Button>
111
+ }
112
+ />
113
+ }
114
+ >
115
+ <PageContainer
116
+ title="列の構成"
117
+ subtitle={`${withRail ? "3 列" : "2 列"} · topbarSpan="${fullSpan ? "full" : "content"}"${
118
+ collapsed ? " · 折りたたみ" : ""
119
+ }`}
120
+ extra={
121
+ <Flex gap="sm">
122
+ <Button
123
+ size="sm"
124
+ variant={withRail ? "default" : "outline"}
125
+ aria-pressed={withRail}
126
+ onClick={() => setWithRail((v) => !v)}
127
+ >
128
+ navRail
129
+ </Button>
130
+ <Button
131
+ size="sm"
132
+ variant={fullSpan ? "default" : "outline"}
133
+ aria-pressed={fullSpan}
134
+ onClick={() => setFullSpan((v) => !v)}
135
+ >
136
+ topbarSpan=full
137
+ </Button>
138
+ <Button
139
+ size="sm"
140
+ variant={collapsed ? "default" : "outline"}
141
+ aria-pressed={collapsed}
142
+ onClick={() => setCollapsed((v) => !v)}
143
+ >
144
+ 折りたたみ
145
+ </Button>
146
+ </Flex>
147
+ }
148
+ >
149
+ <Flex direction="col" gap="lg">
150
+ <Card>
151
+ <CardHeader>
152
+ <CardTitle level={2}>2 本の軸は独立している</CardTitle>
153
+ <CardDescription>
154
+ 上の 3 つのボタンは互いに干渉しない。<code>navRail</code> は「ナビゲーションの列が
155
+ 何本か」を、<code>topbarSpan</code> は「バーがどこまで伸びるか」を答える別々の軸で、
156
+ 4 通りの組み合わせはすべて実在するプロダクトの形なので、禁止すべき組み合わせは
157
+ 存在しない。だから rail は <code>topbarSpan</code> に足した 4 つ目の値ではなく
158
+ スロットとして実装されている ― プリセット名を 4 つ覚える API にはしない。
159
+ </CardDescription>
160
+ <CardDescription>
161
+ 列幅はすべてトークン。<code>--app-shell-nav-rail-width</code>(4rem)が rail、
162
+ <code>--app-shell-sidebar-width</code>(16rem)がサイドバー、
163
+ <code>--app-shell-sidebar-collapsed-width</code>(4rem)が折りたたみ時の
164
+ サイドバー。3 つ目は 19.x では <code>--app-shell-rail-width</code> という名前で、
165
+ 20.0.0 で追加された本物の rail と正面衝突した ― 同じ 4rem、同じ「rail」の綴り、
166
+ 意味は別物。エイリアスを残さず改名したのは、どちらの読み方でも
167
+ もっともらしい幅に解決してしまい、静かに壊れるため。
168
+ </CardDescription>
169
+ </CardHeader>
170
+ </Card>
171
+
172
+ <Card>
173
+ <CardHeader>
174
+ <CardTitle level={2}>折りたたみは 1 本の列だけを畳む</CardTitle>
175
+ <CardDescription>
176
+ 「折りたたみ」を押すと、サイドバーの列だけが 16rem → 4rem になり、rail
177
+ は幅を保つ。Slack の挙動であり、折りたたみ中も rail
178
+ の行き先に手が届き続ける唯一の形。 rail まで一緒に畳むと、意味の分からない
179
+ アイコンの帯が 2 本並ぶだけになる。
180
+ </CardDescription>
181
+ </CardHeader>
182
+ <CardContent>
183
+ <Flex direction="col" gap="sm">
184
+ <Flex justify="between">
185
+ <Text tone="muted">rail</Text>
186
+ <Text mono>{withRail ? "4rem(固定)" : "—"}</Text>
187
+ </Flex>
188
+ <Flex justify="between">
189
+ <Text tone="muted">sidebar</Text>
190
+ <Text mono>{collapsed ? "4rem" : "16rem"}</Text>
191
+ </Flex>
192
+ <Flex justify="between">
193
+ <Text tone="muted">コンテンツ左端</Text>
194
+ <Text mono>
195
+ {withRail ? (collapsed ? "128px" : "320px") : collapsed ? "64px" : "256px"}
196
+ </Text>
197
+ </Flex>
198
+ </Flex>
199
+ </CardContent>
200
+ </Card>
201
+
202
+ <Card>
203
+ <CardHeader>
204
+ <CardTitle level={2}>900px 以下では両方の列が消える</CardTitle>
205
+ <CardDescription>
206
+ Frame の Dimensions を 900px 以下にすると、rail とサイドバーの両方が隠れ、
207
+ AppShell 所有のドロワーが navigation を引き受ける。 rail
208
+ を渡している場合、ドロワーの既定値は「rail のあとにサイドバー」になる ―
209
+ 両方の列が隠れる幅で <code>sidebar</code> だけを既定にすると、rail
210
+ が運んでいるアプリ階層の行き先が 端末によって存在したりしなかったりする。
211
+ いくつかの画面幅にしか無いコントロールは、コントロールではなく罠。
212
+ </CardDescription>
213
+ <CardDescription>
214
+ グリッドのテンプレートから領域名が消えるだけでは要素は消えない ―
215
+ 実測では、狭幅テンプレートを当てて <code>.app-sidebar</code> だけを隠した状態で
216
+ rail が暗黙の列に自動配置され、33×168px の断片としてページ本文の上に残った。
217
+ だから狭幅ブロックは rail を明示的に隠す。
218
+ </CardDescription>
219
+ </CardHeader>
220
+ </Card>
221
+ </Flex>
222
+ </PageContainer>
223
+ </AppShell>
224
+ );
225
+ }
@@ -4,7 +4,7 @@ import { Skeleton } from "@godxjp/ui/feedback";
4
4
  import { AspectRatio, Flex, PageContainer } from "@godxjp/ui/layout";
5
5
 
6
6
  /**
7
- * AspectRatio · Radix AspectRatio wrapper. Stabilises media/preview frames so
7
+ * AspectRatio · AspectRatio (thuộc tính CSS aspect-ratio, một node). Stabilises media/preview frames so
8
8
  * they do not reflow during load. ratio = width / height (number). Children fill
9
9
  * the constrained box · use object-fit: cover on images, width/height 100% on
10
10
  * iframes and SVG charts. Do not use for unconstrained text content. Composed
@@ -9,7 +9,7 @@ import {
9
9
  CardTitle,
10
10
  } from "@godxjp/ui/data-display";
11
11
  import { Text } from "@godxjp/ui/general";
12
- import { Flex, PageContainer, Topbar } from "@godxjp/ui/layout";
12
+ import { Flex, PageContainer, Topbar, TopbarItem } from "@godxjp/ui/layout";
13
13
  import { AppSettingPicker } from "@godxjp/ui/navigation";
14
14
 
15
15
  /**
@@ -123,6 +123,31 @@ export default function Demo() {
123
123
  </CardContent>
124
124
  </Card>
125
125
 
126
+ <Card>
127
+ <CardHeader>
128
+ <CardTitle level={2}>バーのセル(appearance=&quot;bar&quot;)</CardTitle>
129
+ <CardDescription>
130
+ <code>icon</code> と同じ構造上の省略を保ったまま、箱だけがバーの
131
+ <strong>セル</strong>になる。バーの高さいっぱいに伸び、角は
132
+ <code>--topbar-item-radius</code>(<code>TopbarItem</code> と同じつまみ)で四角い。
133
+ ホバーの面はバーそのものを塗る。
134
+ <code>icon</code> をバーに置くと <code>--control-height</code>
135
+ の丸い錠剤が背の高い帯の中に浮き、バー本来のクロームとは別系統に読める。
136
+ </CardDescription>
137
+ </CardHeader>
138
+ <CardContent>
139
+ <Topbar
140
+ start={<TopbarItem>プロジェクト</TopbarItem>}
141
+ end={
142
+ <>
143
+ <AppSettingPicker kind="locale" appearance="bar" id="topbar-locale-bar" />
144
+ <AppSettingPicker kind="theme" appearance="bar" id="topbar-theme-bar" />
145
+ </>
146
+ }
147
+ />
148
+ </CardContent>
149
+ </Card>
150
+
126
151
  <Card>
127
152
  <CardHeader>
128
153
  <CardTitle level={2}>無効化</CardTitle>
@@ -0,0 +1,111 @@
1
+ import { AppProvider } from "@godxjp/ui/app";
2
+ import {
3
+ Avatar,
4
+ AvatarFallback,
5
+ Card,
6
+ CardContent,
7
+ CardDescription,
8
+ CardHeader,
9
+ CardTitle,
10
+ } from "@godxjp/ui/data-display";
11
+ import { Text } from "@godxjp/ui/general";
12
+ import { Flex, PageContainer, Topbar } from "@godxjp/ui/layout";
13
+ import { AppSettingToggle } from "@godxjp/ui/navigation";
14
+
15
+ /**
16
+ * AppSettingToggle — ONE button that steps a single AppProvider setting to its next value and
17
+ * shows that value as its glyph. The no-menu counterpart to AppSettingPicker: same binding
18
+ * contract, same option order, one tap instead of open-then-choose. `appearance="bar"` (the
19
+ * default) is a CELL of the bar — full bar height, the bar's own hover surface, square corners.
20
+ */
21
+ export default function Demo() {
22
+ return (
23
+ <AppProvider defaultLocale="ja" defaultTimeFormat="24h" persist={false}>
24
+ <PageContainer
25
+ title="AppSettingToggle"
26
+ subtitle="押すたびに次の値へ送る 1 ボタン。ドロップダウンなし。"
27
+ >
28
+ <Flex direction="col" gap="lg">
29
+ <Card>
30
+ <CardHeader>
31
+ <CardTitle level={2}>トップバーのセル(既定)</CardTitle>
32
+ <CardDescription>
33
+ appearance=&quot;bar&quot; はバーの一部として全高で伸び、角は
34
+ --topbar-item-radius。--control-height の錠剤がバーの中に浮くことはない。
35
+ </CardDescription>
36
+ </CardHeader>
37
+ <CardContent>
38
+ <Topbar
39
+ start={
40
+ <Avatar className="rounded-md">
41
+ <AvatarFallback>G</AvatarFallback>
42
+ </Avatar>
43
+ }
44
+ end={
45
+ <>
46
+ <AppSettingToggle kind="theme" id="topbar-theme-toggle" />
47
+ <AppSettingToggle kind="density" id="topbar-density-toggle" />
48
+ <AppSettingToggle kind="fontSize" id="topbar-font-size-toggle" />
49
+ <AppSettingToggle kind="timeFormat" id="topbar-time-format-toggle" />
50
+ </>
51
+ }
52
+ />
53
+ </CardContent>
54
+ </Card>
55
+
56
+ <Card>
57
+ <CardHeader>
58
+ <CardTitle level={2}>バー以外(appearance=&quot;icon&quot;)</CardTitle>
59
+ <CardDescription>
60
+ 設定行やカードヘッダーなど、バーではない場所。--control-height
61
+ の正方形ゴーストボタン。
62
+ </CardDescription>
63
+ </CardHeader>
64
+ <CardContent>
65
+ <Flex direction="row" gap="md" align="center" wrap>
66
+ <Flex direction="row" gap="sm" align="center">
67
+ <Text weight="medium">テーマ</Text>
68
+ <AppSettingToggle kind="theme" appearance="icon" id="icon-theme-toggle" />
69
+ </Flex>
70
+ <Flex direction="row" gap="sm" align="center">
71
+ <Text weight="medium">時刻形式</Text>
72
+ <AppSettingToggle
73
+ kind="timeFormat"
74
+ appearance="icon"
75
+ id="icon-time-format-toggle"
76
+ />
77
+ </Flex>
78
+ </Flex>
79
+ </CardContent>
80
+ </Card>
81
+
82
+ <Card>
83
+ <CardHeader>
84
+ <CardTitle level={2}>制御モードと無効化</CardTitle>
85
+ <CardDescription>
86
+ value + onValueChange で外部状態に紐づけ、disabled で操作を止める。
87
+ </CardDescription>
88
+ </CardHeader>
89
+ <CardContent>
90
+ <Flex direction="row" gap="md" align="center">
91
+ <AppSettingToggle
92
+ kind="density"
93
+ appearance="icon"
94
+ value="comfortable"
95
+ onValueChange={() => {}}
96
+ id="controlled-density-toggle"
97
+ />
98
+ <AppSettingToggle
99
+ kind="theme"
100
+ appearance="icon"
101
+ disabled
102
+ id="disabled-theme-toggle"
103
+ />
104
+ </Flex>
105
+ </CardContent>
106
+ </Card>
107
+ </Flex>
108
+ </PageContainer>
109
+ </AppProvider>
110
+ );
111
+ }