@godxjp/ui 21.0.0 → 23.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.
- package/README.md +4 -4
- package/dist/app/app-provider.js +2 -1
- package/dist/components/data-display/badge.d.ts +28 -1
- package/dist/components/data-display/badge.js +2 -0
- package/dist/components/data-display/data-table.d.ts +18 -2
- package/dist/components/data-display/data-table.js +4 -0
- package/dist/components/data-display/index.d.ts +1 -1
- package/dist/components/data-display/popover.d.ts +19 -1
- package/dist/components/data-display/popover.js +9 -1
- package/dist/components/data-display/progress.d.ts +37 -0
- package/dist/components/data-display/progress.js +57 -5
- package/dist/components/data-display/scroll-area.d.ts +24 -4
- package/dist/components/data-display/scroll-area.js +34 -72
- package/dist/components/data-entry/cascader.js +8 -6
- package/dist/components/data-entry/checkbox.js +2 -0
- package/dist/components/data-entry/choice-hit-target.d.ts +24 -0
- package/dist/components/data-entry/choice-hit-target.js +12 -0
- package/dist/components/data-entry/control-surface.d.ts +8 -0
- package/dist/components/data-entry/control-surface.js +10 -1
- package/dist/components/data-entry/date-picker.d.ts +10 -3
- package/dist/components/data-entry/date-picker.js +503 -238
- package/dist/components/data-entry/form-field.d.ts +1 -1
- package/dist/components/data-entry/form-field.js +7 -3
- package/dist/components/data-entry/form.js +10 -1
- package/dist/components/data-entry/index.d.ts +0 -6
- package/dist/components/data-entry/index.js +0 -6
- package/dist/components/data-entry/label.d.ts +14 -1
- package/dist/components/data-entry/label.js +6 -1
- package/dist/components/data-entry/radio.d.ts +27 -6
- package/dist/components/data-entry/radio.js +89 -43
- package/dist/components/data-entry/search-select.js +226 -89
- package/dist/components/data-entry/select.d.ts +76 -14
- package/dist/components/data-entry/select.js +497 -163
- package/dist/components/data-entry/slider.d.ts +3 -11
- package/dist/components/data-entry/slider.js +582 -93
- package/dist/components/data-entry/switch.d.ts +6 -3
- package/dist/components/data-entry/switch.js +36 -11
- package/dist/components/layout/mobile-shell.d.ts +1 -1
- package/dist/components/layout/mobile-shell.js +2 -0
- package/dist/components/navigation/dropdown-menu.d.ts +11 -3
- package/dist/components/navigation/dropdown-menu.js +190 -15
- package/dist/components/navigation/index.d.ts +0 -3
- package/dist/components/navigation/index.js +0 -78
- package/dist/components/navigation/steps.d.ts +1 -1
- package/dist/components/navigation/steps.js +3 -1
- package/dist/components/navigation/tabs-scroll.d.ts +27 -0
- package/dist/components/navigation/tabs-scroll.js +52 -1
- package/dist/components/navigation/tabs.d.ts +2 -2
- package/dist/components/navigation/tabs.js +88 -23
- package/dist/components/ui/index.d.ts +0 -4
- package/dist/components/ui/index.js +0 -4
- package/dist/components/ui/input-otp.d.ts +1 -1
- package/dist/components/ui/segmented.d.ts +15 -1
- package/dist/components/ui/segmented.js +15 -6
- package/dist/components/ui/tag-input.js +3 -5
- package/dist/i18n/messages/en.json +3 -2
- package/dist/i18n/messages/ja.json +3 -2
- package/dist/i18n/messages/vi.json +3 -2
- package/dist/lib/datetime/picker-format.d.ts +18 -0
- package/dist/lib/datetime/picker-format.js +35 -1
- package/dist/lib/field-a11y.d.ts +12 -0
- package/dist/lib/field-a11y.js +14 -1
- package/dist/lib/select-options.d.ts +21 -0
- package/dist/lib/select-options.js +46 -0
- package/dist/props/components/data-display.prop.d.ts +16 -6
- package/dist/props/components/data-entry.prop.d.ts +503 -129
- package/dist/props/components/index.d.ts +2 -2
- package/dist/props/components/layout.prop.d.ts +12 -1
- package/dist/props/components/navigation.prop.d.ts +93 -1
- package/dist/props/registry.d.ts +79 -16
- package/dist/props/registry.js +85 -15
- package/dist/props/vocabulary/data.prop.d.ts +12 -0
- package/dist/props/vocabulary/index.d.ts +2 -2
- package/dist/props/vocabulary/layout.prop.d.ts +11 -0
- package/dist/styles/badge-layout.css +4 -0
- package/dist/styles/card-layout.css +6 -6
- package/dist/styles/control.css +220 -29
- package/dist/styles/data-display-layout.css +94 -23
- package/dist/styles/focus-ring.css +6 -4
- package/dist/styles/fonts.css +88 -4
- package/dist/styles/navigation-layout.css +36 -236
- package/dist/styles/shell-layout.css +149 -139
- package/dist/styles/table-layout.css +41 -3
- package/dist/tokens/components/control.css +4 -0
- package/dist/tokens/components/data-display.css +9 -5
- package/dist/tokens/components/navigation.css +9 -5
- package/dist/tokens/components/scroll-area.css +7 -0
- package/dist/tokens/components/segmented.css +0 -2
- package/dist/tokens/components/shell.css +2 -0
- package/dist/tokens/components/table.css +3 -0
- package/dist/tokens/foundation.css +7 -0
- package/docs/COMPONENTS.md +14 -14
- package/docs/CONSUMER-RULES.md +24 -1
- package/docs/CUSTOMER-THEMING.md +7 -1
- package/docs/FRAME-COVERAGE-REPORT.md +5 -11
- package/docs/TOKENS.md +65 -0
- package/docs/data-display/badge.tsx +37 -0
- package/docs/data-display/data-table/index.tsx +45 -1
- package/docs/data-display/popover.tsx +43 -5
- package/docs/data-display/progress.tsx +28 -0
- package/docs/data-display/scroll-area.tsx +51 -45
- package/docs/data-entry/calendar.tsx +2 -2
- package/docs/data-entry/date-picker.tsx +144 -5
- package/docs/data-entry/form/examples/invoice-form.tsx +2 -2
- package/docs/data-entry/form-field/examples/a11y-contract.tsx +3 -5
- package/docs/data-entry/form.tsx +4 -4
- package/docs/data-entry/input-otp.tsx +5 -2
- package/docs/data-entry/number-input.tsx +31 -0
- package/docs/data-entry/segmented.tsx +143 -2
- package/docs/data-entry/select-matrix.tsx +1 -2
- package/docs/data-entry/select.tsx +108 -3
- package/docs/data-entry/slider.tsx +125 -47
- package/docs/feedback/dialog.tsx +1 -2
- package/docs/feedback/sheet.tsx +1 -2
- package/docs/layout/app-shell-states.tsx +143 -0
- package/docs/layout/mobile-shell.tsx +5 -0
- package/docs/navigation/dropdown-menu.tsx +75 -4
- package/docs/navigation/tabs.tsx +149 -0
- package/docs/roadmap/antd-parity.md +35 -34
- package/docs/roadmap/parity-audit-data-entry.md +196 -172
- package/docs/roadmap/parity-audit-layout-navigation-general.md +304 -310
- package/docs/roadmap/parity-backlog.md +8 -10
- package/docs/showcase/acme-portal.tsx +7 -0
- package/package.json +28 -64
- package/scripts/ui-audit.mjs +18 -5
- package/scripts/visual-audit-rules.mjs +0 -7
- package/scripts/visual-audit.mjs +6 -27
- package/dist/components/data-entry/date-range-picker.d.ts +0 -11
- package/dist/components/data-entry/date-range-picker.js +0 -349
- package/dist/components/data-entry/month-picker.d.ts +0 -10
- package/dist/components/data-entry/month-picker.js +0 -241
- package/dist/components/data-entry/month-range-picker.d.ts +0 -10
- package/dist/components/data-entry/month-range-picker.js +0 -301
- package/dist/components/navigation/context-menu.d.ts +0 -21
- package/dist/components/navigation/context-menu.js +0 -149
- package/dist/components/navigation/menubar.d.ts +0 -21
- package/dist/components/navigation/menubar.js +0 -136
- package/dist/components/navigation/navigation-menu.d.ts +0 -10
- package/dist/components/navigation/navigation-menu.js +0 -91
- package/dist/components/ui/context-menu.d.ts +0 -1
- package/dist/components/ui/context-menu.js +0 -2
- package/dist/components/ui/date-range-picker.d.ts +0 -1
- package/dist/components/ui/date-range-picker.js +0 -2
- package/dist/components/ui/menubar.d.ts +0 -1
- package/dist/components/ui/menubar.js +0 -2
- package/dist/components/ui/navigation-menu.d.ts +0 -1
- package/dist/components/ui/navigation-menu.js +0 -2
- package/docs/FRAME-A11Y-CI.md +0 -349
- package/docs/data-entry/date-range-picker.tsx +0 -175
- package/docs/data-entry/month-picker.tsx +0 -101
- package/docs/data-entry/month-range-picker.tsx +0 -115
- package/docs/navigation/context-menu.tsx +0 -128
- package/docs/navigation/menubar.tsx +0 -141
- package/docs/navigation/navigation-menu.tsx +0 -158
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { ja } from "date-fns/locale";
|
|
3
|
-
|
|
4
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display";
|
|
5
|
-
import { DateRangePicker, FormField } from "@godxjp/ui/data-entry";
|
|
6
|
-
import { Flex, PageContainer } from "@godxjp/ui/layout";
|
|
7
|
-
import type { DateRange } from "react-day-picker";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* DateRangePicker — WAI-ARIA date-range control with two typeable ISO inputs
|
|
11
|
-
* + popover calendar. Submits as ${name}_from / ${name}_to. Never compose
|
|
12
|
-
* two DatePickers side-by-side to fake a range. Composed only from real
|
|
13
|
-
* @godxjp/ui components.
|
|
14
|
-
*/
|
|
15
|
-
export default function Demo() {
|
|
16
|
-
const [period, setPeriod] = useState<DateRange | undefined>({
|
|
17
|
-
from: new Date(2026, 3, 1),
|
|
18
|
-
to: new Date(2027, 2, 31),
|
|
19
|
-
});
|
|
20
|
-
const [reportRange, setReportRange] = useState<DateRange | undefined>(undefined);
|
|
21
|
-
const [campaign, setCampaign] = useState<DateRange | undefined>({
|
|
22
|
-
from: new Date(2026, 5, 1),
|
|
23
|
-
to: new Date(2026, 5, 30),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<PageContainer
|
|
28
|
-
title="DateRangePicker"
|
|
29
|
-
subtitle="期間入力 · 開始/終了 ISO 入力 + 範囲カレンダーポップオーバー"
|
|
30
|
-
>
|
|
31
|
-
<Flex direction="col" gap="lg">
|
|
32
|
-
<Card>
|
|
33
|
-
<CardHeader>
|
|
34
|
-
<CardTitle level={2}>基本 (controlled)</CardTitle>
|
|
35
|
-
<CardDescription>
|
|
36
|
-
value + onValueChange
|
|
37
|
-
で制御。開始/終了を直接タイプ入力するか、カレンダーアイコンを開いて
|
|
38
|
-
範囲を選択できる。name="period" を指定すると period_from / period_to として
|
|
39
|
-
ISO yyyy-MM-dd でフォーム送信される。
|
|
40
|
-
</CardDescription>
|
|
41
|
-
</CardHeader>
|
|
42
|
-
<CardContent>
|
|
43
|
-
<FormField id="period" label="会計期間" required>
|
|
44
|
-
<DateRangePicker
|
|
45
|
-
id="period"
|
|
46
|
-
name="period"
|
|
47
|
-
value={period}
|
|
48
|
-
onValueChange={setPeriod}
|
|
49
|
-
fromDate={new Date(2020, 0, 1)}
|
|
50
|
-
toDate={new Date(2030, 11, 31)}
|
|
51
|
-
/>
|
|
52
|
-
</FormField>
|
|
53
|
-
</CardContent>
|
|
54
|
-
</Card>
|
|
55
|
-
|
|
56
|
-
<Card>
|
|
57
|
-
<CardHeader>
|
|
58
|
-
<CardTitle level={2}>レポート期間フィルター (未選択)</CardTitle>
|
|
59
|
-
<CardDescription>
|
|
60
|
-
初期値なし。選択後は reportRange_from / reportRange_to
|
|
61
|
-
がクエリパラメータとして使われる。
|
|
62
|
-
</CardDescription>
|
|
63
|
-
</CardHeader>
|
|
64
|
-
<CardContent>
|
|
65
|
-
<FormField id="report-range" label="レポート期間">
|
|
66
|
-
<DateRangePicker
|
|
67
|
-
id="report-range"
|
|
68
|
-
name="reportRange"
|
|
69
|
-
value={reportRange}
|
|
70
|
-
onValueChange={setReportRange}
|
|
71
|
-
fromDate={new Date(2024, 0, 1)}
|
|
72
|
-
toDate={new Date(2026, 11, 31)}
|
|
73
|
-
placeholder="yyyy-mm-dd"
|
|
74
|
-
/>
|
|
75
|
-
</FormField>
|
|
76
|
-
</CardContent>
|
|
77
|
-
</Card>
|
|
78
|
-
|
|
79
|
-
<Card>
|
|
80
|
-
<CardHeader>
|
|
81
|
-
<CardTitle level={2}>非制御 (defaultValue)</CardTitle>
|
|
82
|
-
<CardDescription>
|
|
83
|
-
value / onValueChange を渡さず defaultValue
|
|
84
|
-
で初期範囲だけ与える。状態はコンポーネント内部で 保持され、name="fiscal_year"
|
|
85
|
-
のまま fiscal_year_from / fiscal_year_to として送信される。
|
|
86
|
-
</CardDescription>
|
|
87
|
-
</CardHeader>
|
|
88
|
-
<CardContent>
|
|
89
|
-
<FormField id="fiscal-year" label="会計年度 (初期値のみ)">
|
|
90
|
-
<DateRangePicker
|
|
91
|
-
id="fiscal-year"
|
|
92
|
-
name="fiscal_year"
|
|
93
|
-
defaultValue={{
|
|
94
|
-
from: new Date(2026, 3, 1),
|
|
95
|
-
to: new Date(2027, 2, 31),
|
|
96
|
-
}}
|
|
97
|
-
fromDate={new Date(2020, 0, 1)}
|
|
98
|
-
toDate={new Date(2030, 11, 31)}
|
|
99
|
-
/>
|
|
100
|
-
</FormField>
|
|
101
|
-
</CardContent>
|
|
102
|
-
</Card>
|
|
103
|
-
|
|
104
|
-
<Card>
|
|
105
|
-
<CardHeader>
|
|
106
|
-
<CardTitle level={2}>locale で日本語カレンダー</CardTitle>
|
|
107
|
-
<CardDescription>
|
|
108
|
-
locale={ja} を渡すとポップオーバーのカレンダーが日本語表記 (曜日・月名)
|
|
109
|
-
になる。 入力欄は常に ISO yyyy-MM-dd を保持する。
|
|
110
|
-
</CardDescription>
|
|
111
|
-
</CardHeader>
|
|
112
|
-
<CardContent>
|
|
113
|
-
<FormField id="campaign-period" label="キャンペーン期間">
|
|
114
|
-
<DateRangePicker
|
|
115
|
-
id="campaign-period"
|
|
116
|
-
name="campaign_period"
|
|
117
|
-
value={campaign}
|
|
118
|
-
onValueChange={setCampaign}
|
|
119
|
-
locale={ja}
|
|
120
|
-
fromDate={new Date(2024, 0, 1)}
|
|
121
|
-
toDate={new Date(2027, 11, 31)}
|
|
122
|
-
/>
|
|
123
|
-
</FormField>
|
|
124
|
-
</CardContent>
|
|
125
|
-
</Card>
|
|
126
|
-
|
|
127
|
-
<Card>
|
|
128
|
-
<CardHeader>
|
|
129
|
-
<CardTitle level={2}>disabled 状態</CardTitle>
|
|
130
|
-
<CardDescription>確定済み期間や読み取り専用フィールドに使用。</CardDescription>
|
|
131
|
-
</CardHeader>
|
|
132
|
-
<CardContent>
|
|
133
|
-
<FormField id="locked-period" label="確定期間">
|
|
134
|
-
<DateRangePicker
|
|
135
|
-
id="locked-period"
|
|
136
|
-
name="locked_period"
|
|
137
|
-
value={{
|
|
138
|
-
from: new Date(2025, 3, 1),
|
|
139
|
-
to: new Date(2026, 2, 31),
|
|
140
|
-
}}
|
|
141
|
-
disabled
|
|
142
|
-
/>
|
|
143
|
-
</FormField>
|
|
144
|
-
</CardContent>
|
|
145
|
-
</Card>
|
|
146
|
-
|
|
147
|
-
<Card>
|
|
148
|
-
<CardHeader>
|
|
149
|
-
<CardTitle level={2}>期間プリセットと確定</CardTitle>
|
|
150
|
-
</CardHeader>
|
|
151
|
-
<CardContent>
|
|
152
|
-
<FormField id="preset-range" label="集計期間">
|
|
153
|
-
<DateRangePicker
|
|
154
|
-
id="preset-range"
|
|
155
|
-
name="report"
|
|
156
|
-
format="yyyy/MM/dd"
|
|
157
|
-
needConfirm
|
|
158
|
-
allowEmpty={[false, true]}
|
|
159
|
-
showWeek
|
|
160
|
-
minDate={new Date(2026, 0, 1)}
|
|
161
|
-
maxDate={new Date(2026, 11, 31)}
|
|
162
|
-
presets={[
|
|
163
|
-
{
|
|
164
|
-
label: "9月",
|
|
165
|
-
value: () => ({ from: new Date(2026, 8, 1), to: new Date(2026, 8, 30) }),
|
|
166
|
-
},
|
|
167
|
-
]}
|
|
168
|
-
/>
|
|
169
|
-
</FormField>
|
|
170
|
-
</CardContent>
|
|
171
|
-
</Card>
|
|
172
|
-
</Flex>
|
|
173
|
-
</PageContainer>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display";
|
|
4
|
-
import { FormField, MonthPicker } from "@godxjp/ui/data-entry";
|
|
5
|
-
import { Flex, PageContainer } from "@godxjp/ui/layout";
|
|
6
|
-
|
|
7
|
-
/** MonthPicker — typeable yyyy/MM field with a localized month-grid affordance. */
|
|
8
|
-
export default function Demo() {
|
|
9
|
-
const [month, setMonth] = useState<Date | undefined>(new Date(2026, 6, 1));
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<PageContainer title="MonthPicker" subtitle="年月入力 · yyyy/MM + 月グリッド">
|
|
13
|
-
<Flex direction="col" gap="lg">
|
|
14
|
-
<Card>
|
|
15
|
-
<CardHeader>
|
|
16
|
-
<CardTitle level={2}>Controlled · form submission</CardTitle>
|
|
17
|
-
<CardDescription>
|
|
18
|
-
value + onValueChange で制御し、name は yyyy/MM の表示値を送信する。直接入力と
|
|
19
|
-
月グリッド選択のどちらも利用できる。
|
|
20
|
-
</CardDescription>
|
|
21
|
-
</CardHeader>
|
|
22
|
-
<CardContent>
|
|
23
|
-
<FormField id="billing-month" label="請求年月" required helper="yyyy/MM 形式">
|
|
24
|
-
<MonthPicker
|
|
25
|
-
id="billing-month"
|
|
26
|
-
name="billing_month"
|
|
27
|
-
value={month}
|
|
28
|
-
onValueChange={setMonth}
|
|
29
|
-
/>
|
|
30
|
-
</FormField>
|
|
31
|
-
</CardContent>
|
|
32
|
-
</Card>
|
|
33
|
-
|
|
34
|
-
<Card>
|
|
35
|
-
<CardHeader>
|
|
36
|
-
<CardTitle level={2}>Uncontrolled · bounded years</CardTitle>
|
|
37
|
-
<CardDescription>
|
|
38
|
-
defaultValue で内部状態を初期化し、fromYear / toYear で年移動を制限する。
|
|
39
|
-
</CardDescription>
|
|
40
|
-
</CardHeader>
|
|
41
|
-
<CardContent>
|
|
42
|
-
<FormField id="fiscal-month" label="会計年月">
|
|
43
|
-
<MonthPicker
|
|
44
|
-
id="fiscal-month"
|
|
45
|
-
name="fiscal_month"
|
|
46
|
-
defaultValue={new Date(2025, 3, 1)}
|
|
47
|
-
fromYear={2024}
|
|
48
|
-
toYear={2027}
|
|
49
|
-
/>
|
|
50
|
-
</FormField>
|
|
51
|
-
</CardContent>
|
|
52
|
-
</Card>
|
|
53
|
-
|
|
54
|
-
<Card>
|
|
55
|
-
<CardHeader>
|
|
56
|
-
<CardTitle level={2}>Clear affordance variants</CardTitle>
|
|
57
|
-
<CardDescription>
|
|
58
|
-
値がある既定状態ではクリア操作を表示する。必須フィールドでは allowClear=false
|
|
59
|
-
にして不用意な空値を防ぐ。
|
|
60
|
-
</CardDescription>
|
|
61
|
-
</CardHeader>
|
|
62
|
-
<CardContent>
|
|
63
|
-
<Flex direction="col" gap="md">
|
|
64
|
-
<FormField id="clearable-month" label="クリア可能">
|
|
65
|
-
<MonthPicker id="clearable-month" defaultValue={new Date(2026, 0, 1)} />
|
|
66
|
-
</FormField>
|
|
67
|
-
<FormField id="fixed-month" label="クリア不可" required>
|
|
68
|
-
<MonthPicker
|
|
69
|
-
id="fixed-month"
|
|
70
|
-
defaultValue={new Date(2026, 0, 1)}
|
|
71
|
-
allowClear={false}
|
|
72
|
-
/>
|
|
73
|
-
</FormField>
|
|
74
|
-
</Flex>
|
|
75
|
-
</CardContent>
|
|
76
|
-
</Card>
|
|
77
|
-
|
|
78
|
-
<Card>
|
|
79
|
-
<CardHeader>
|
|
80
|
-
<CardTitle level={2}>Disabled · empty and populated</CardTitle>
|
|
81
|
-
<CardDescription>権限不足または確定済みデータの操作不可状態。</CardDescription>
|
|
82
|
-
</CardHeader>
|
|
83
|
-
<CardContent>
|
|
84
|
-
<Flex direction="col" gap="md">
|
|
85
|
-
<FormField id="disabled-month-empty" label="無効(未選択)">
|
|
86
|
-
<MonthPicker id="disabled-month-empty" disabled />
|
|
87
|
-
</FormField>
|
|
88
|
-
<FormField id="disabled-month-value" label="無効(選択済み)">
|
|
89
|
-
<MonthPicker
|
|
90
|
-
id="disabled-month-value"
|
|
91
|
-
defaultValue={new Date(2026, 8, 1)}
|
|
92
|
-
disabled
|
|
93
|
-
/>
|
|
94
|
-
</FormField>
|
|
95
|
-
</Flex>
|
|
96
|
-
</CardContent>
|
|
97
|
-
</Card>
|
|
98
|
-
</Flex>
|
|
99
|
-
</PageContainer>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display";
|
|
4
|
-
import { FormField, MonthRangePicker } from "@godxjp/ui/data-entry";
|
|
5
|
-
import { Flex, PageContainer } from "@godxjp/ui/layout";
|
|
6
|
-
import type { DateRange } from "react-day-picker";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* MonthRangePicker — 年月 (yyyy/MM) 範囲入力。DateRangePicker と同じ
|
|
10
|
-
* 「ひとつのコントロール [開始 → 終了 ✕ 📅]」規約で、月グリッドポップオーバーを
|
|
11
|
-
* 視覚的アフォーダンスとして持つ。逆順 (from > to) は自動で入れ替え正規化される。
|
|
12
|
-
* MonthPicker を 2 つ並べて範囲を偽装しないこと。
|
|
13
|
-
*/
|
|
14
|
-
export default function Demo() {
|
|
15
|
-
const [closing, setClosing] = useState<DateRange | undefined>({
|
|
16
|
-
from: new Date(2026, 0, 1),
|
|
17
|
-
to: new Date(2026, 5, 1),
|
|
18
|
-
});
|
|
19
|
-
const [negotiation, setNegotiation] = useState<DateRange | undefined>(undefined);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<PageContainer
|
|
23
|
-
title="MonthRangePicker"
|
|
24
|
-
subtitle="年月範囲入力 · 開始/終了 yyyy/MM 入力 + 月グリッドポップオーバー"
|
|
25
|
-
>
|
|
26
|
-
<Flex direction="col" gap="lg">
|
|
27
|
-
<Card>
|
|
28
|
-
<CardHeader>
|
|
29
|
-
<CardTitle level={2}>基本 (controlled)</CardTitle>
|
|
30
|
-
<CardDescription>
|
|
31
|
-
value + onValueChange で制御。開始/終了を直接タイプ入力するか、カレンダーアイコンから
|
|
32
|
-
月グリッドで 2 ステップ選択 (開始 → 終了)。逆順に選んでも from ≤ to
|
|
33
|
-
に自動正規化される。name="closing_ym" を指定すると closing_ym_from /
|
|
34
|
-
closing_ym_to として yyyy/MM でフォーム送信される。
|
|
35
|
-
</CardDescription>
|
|
36
|
-
</CardHeader>
|
|
37
|
-
<CardContent>
|
|
38
|
-
<FormField id="closing-ym" label="締め年月" required>
|
|
39
|
-
<MonthRangePicker
|
|
40
|
-
id="closing-ym"
|
|
41
|
-
name="closing_ym"
|
|
42
|
-
value={closing}
|
|
43
|
-
onValueChange={setClosing}
|
|
44
|
-
/>
|
|
45
|
-
</FormField>
|
|
46
|
-
</CardContent>
|
|
47
|
-
</Card>
|
|
48
|
-
|
|
49
|
-
<Card>
|
|
50
|
-
<CardHeader>
|
|
51
|
-
<CardTitle level={2}>検索フィルター (未選択)</CardTitle>
|
|
52
|
-
<CardDescription>
|
|
53
|
-
初期値なし。確定済み範囲の上でもう一度選ぶと新しい範囲が開始される (reset-on-complete
|
|
54
|
-
· 開始月が固まって選び直せない、が起きない)。
|
|
55
|
-
</CardDescription>
|
|
56
|
-
</CardHeader>
|
|
57
|
-
<CardContent>
|
|
58
|
-
<FormField id="negotiation-ym" label="商談発生年月">
|
|
59
|
-
<MonthRangePicker
|
|
60
|
-
id="negotiation-ym"
|
|
61
|
-
name="search_negotiation_ym"
|
|
62
|
-
value={negotiation}
|
|
63
|
-
onValueChange={setNegotiation}
|
|
64
|
-
/>
|
|
65
|
-
</FormField>
|
|
66
|
-
</CardContent>
|
|
67
|
-
</Card>
|
|
68
|
-
|
|
69
|
-
<Card>
|
|
70
|
-
<CardHeader>
|
|
71
|
-
<CardTitle level={2}>非制御 (defaultValue) + 年クランプ</CardTitle>
|
|
72
|
-
<CardDescription>
|
|
73
|
-
defaultValue で初期範囲だけ与え、fromYear / toYear
|
|
74
|
-
でグリッドの年ナビゲーションを境界年で止める。
|
|
75
|
-
</CardDescription>
|
|
76
|
-
</CardHeader>
|
|
77
|
-
<CardContent>
|
|
78
|
-
<FormField id="fiscal-ym" label="会計年度範囲 (2024–2027)">
|
|
79
|
-
<MonthRangePicker
|
|
80
|
-
id="fiscal-ym"
|
|
81
|
-
name="fiscal_ym"
|
|
82
|
-
defaultValue={{
|
|
83
|
-
from: new Date(2026, 3, 1),
|
|
84
|
-
to: new Date(2027, 2, 1),
|
|
85
|
-
}}
|
|
86
|
-
fromYear={2024}
|
|
87
|
-
toYear={2027}
|
|
88
|
-
/>
|
|
89
|
-
</FormField>
|
|
90
|
-
</CardContent>
|
|
91
|
-
</Card>
|
|
92
|
-
|
|
93
|
-
<Card>
|
|
94
|
-
<CardHeader>
|
|
95
|
-
<CardTitle level={2}>disabled 状態</CardTitle>
|
|
96
|
-
<CardDescription>確定済み範囲や読み取り専用フィールドに使用。</CardDescription>
|
|
97
|
-
</CardHeader>
|
|
98
|
-
<CardContent>
|
|
99
|
-
<FormField id="locked-ym" label="確定範囲">
|
|
100
|
-
<MonthRangePicker
|
|
101
|
-
id="locked-ym"
|
|
102
|
-
name="locked_ym"
|
|
103
|
-
value={{
|
|
104
|
-
from: new Date(2025, 3, 1),
|
|
105
|
-
to: new Date(2026, 2, 1),
|
|
106
|
-
}}
|
|
107
|
-
disabled
|
|
108
|
-
/>
|
|
109
|
-
</FormField>
|
|
110
|
-
</CardContent>
|
|
111
|
-
</Card>
|
|
112
|
-
</Flex>
|
|
113
|
-
</PageContainer>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display";
|
|
4
|
-
import { Text } from "@godxjp/ui/general";
|
|
5
|
-
import {
|
|
6
|
-
ContextMenu,
|
|
7
|
-
ContextMenuCheckboxItem,
|
|
8
|
-
ContextMenuContent,
|
|
9
|
-
ContextMenuItem,
|
|
10
|
-
ContextMenuLabel,
|
|
11
|
-
ContextMenuRadioGroup,
|
|
12
|
-
ContextMenuRadioItem,
|
|
13
|
-
ContextMenuSeparator,
|
|
14
|
-
ContextMenuShortcut,
|
|
15
|
-
ContextMenuSub,
|
|
16
|
-
ContextMenuSubContent,
|
|
17
|
-
ContextMenuSubTrigger,
|
|
18
|
-
ContextMenuTrigger,
|
|
19
|
-
} from "@godxjp/ui/navigation";
|
|
20
|
-
import { Flex, PageContainer } from "@godxjp/ui/layout";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* ContextMenu — right-click action menu over a target area. Compose
|
|
24
|
-
* ContextMenu > ContextMenuTrigger + ContextMenuContent > items. Supports
|
|
25
|
-
* sub-menus, checkbox/radio items, separators, and keyboard shortcuts.
|
|
26
|
-
* Composed only from real @godxjp/ui components.
|
|
27
|
-
*/
|
|
28
|
-
export default function Demo() {
|
|
29
|
-
const [showRuby, setShowRuby] = useState(true);
|
|
30
|
-
const [showGrid, setShowGrid] = useState(false);
|
|
31
|
-
const [sort, setSort] = useState("date");
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<PageContainer
|
|
35
|
-
title="ContextMenu"
|
|
36
|
-
subtitle="右クリックで開くコンテキストメニュー · 行・カード・エリアへのアクション"
|
|
37
|
-
>
|
|
38
|
-
<Flex direction="col" gap="lg">
|
|
39
|
-
<Card>
|
|
40
|
-
<CardHeader>
|
|
41
|
-
<CardTitle level={2}>基本アクション</CardTitle>
|
|
42
|
-
<CardDescription>
|
|
43
|
-
領域を右クリックするとメニューが開きます。サブメニュー・区切り・ショートカットを含む。
|
|
44
|
-
ContextMenuItem の variant は default と destructive の 2 つ。破棄系のアクションだけを
|
|
45
|
-
destructive にする。
|
|
46
|
-
</CardDescription>
|
|
47
|
-
</CardHeader>
|
|
48
|
-
<CardContent>
|
|
49
|
-
<ContextMenu>
|
|
50
|
-
{/* ui-audit-disable-next-line no-hand-rolled-surface — the dashed area is the right-click target the demo asks you to use */}
|
|
51
|
-
{/* data-axe-open="contextmenu": check-frame-axe right-clicks here before its
|
|
52
|
-
overlay scan. */}
|
|
53
|
-
<ContextMenuTrigger
|
|
54
|
-
data-axe-open="contextmenu"
|
|
55
|
-
className="border-border h-36 w-full cursor-context-menu rounded-md border border-dashed"
|
|
56
|
-
>
|
|
57
|
-
<Flex align="center" justify="center" gap="xs">
|
|
58
|
-
<Text tone="muted">ここを右クリックしてください</Text>
|
|
59
|
-
</Flex>
|
|
60
|
-
</ContextMenuTrigger>
|
|
61
|
-
<ContextMenuContent>
|
|
62
|
-
<ContextMenuLabel>仕訳操作</ContextMenuLabel>
|
|
63
|
-
<ContextMenuItem>
|
|
64
|
-
編集
|
|
65
|
-
<ContextMenuShortcut>⌘E</ContextMenuShortcut>
|
|
66
|
-
</ContextMenuItem>
|
|
67
|
-
<ContextMenuItem>
|
|
68
|
-
複製
|
|
69
|
-
<ContextMenuShortcut>⌘D</ContextMenuShortcut>
|
|
70
|
-
</ContextMenuItem>
|
|
71
|
-
<ContextMenuSeparator />
|
|
72
|
-
<ContextMenuSub>
|
|
73
|
-
<ContextMenuSubTrigger>エクスポート</ContextMenuSubTrigger>
|
|
74
|
-
<ContextMenuSubContent>
|
|
75
|
-
<ContextMenuItem>CSV</ContextMenuItem>
|
|
76
|
-
<ContextMenuItem>PDF</ContextMenuItem>
|
|
77
|
-
<ContextMenuItem>Excel</ContextMenuItem>
|
|
78
|
-
</ContextMenuSubContent>
|
|
79
|
-
</ContextMenuSub>
|
|
80
|
-
<ContextMenuSeparator />
|
|
81
|
-
<ContextMenuItem variant="default">アーカイブに移動</ContextMenuItem>
|
|
82
|
-
<ContextMenuItem variant="destructive">
|
|
83
|
-
削除
|
|
84
|
-
<ContextMenuShortcut>⌫</ContextMenuShortcut>
|
|
85
|
-
</ContextMenuItem>
|
|
86
|
-
</ContextMenuContent>
|
|
87
|
-
</ContextMenu>
|
|
88
|
-
</CardContent>
|
|
89
|
-
</Card>
|
|
90
|
-
|
|
91
|
-
<Card>
|
|
92
|
-
<CardHeader>
|
|
93
|
-
<CardTitle level={2}>チェックボックス・ラジオアイテム</CardTitle>
|
|
94
|
-
<CardDescription>
|
|
95
|
-
表示設定の切り替えに使用。CheckboxItem は個別トグル、RadioGroup は排他選択。
|
|
96
|
-
</CardDescription>
|
|
97
|
-
</CardHeader>
|
|
98
|
-
<CardContent>
|
|
99
|
-
<ContextMenu>
|
|
100
|
-
{/* ui-audit-disable-next-line no-hand-rolled-surface — the dashed area is the right-click target the demo asks you to use */}
|
|
101
|
-
<ContextMenuTrigger className="border-border h-36 w-full cursor-context-menu rounded-md border border-dashed">
|
|
102
|
-
<Flex align="center" justify="center" gap="xs">
|
|
103
|
-
<Text tone="muted">右クリック · 表示設定</Text>
|
|
104
|
-
</Flex>
|
|
105
|
-
</ContextMenuTrigger>
|
|
106
|
-
<ContextMenuContent>
|
|
107
|
-
<ContextMenuLabel>表示オプション</ContextMenuLabel>
|
|
108
|
-
<ContextMenuCheckboxItem checked={showRuby} onCheckedChange={setShowRuby}>
|
|
109
|
-
ルビ表示
|
|
110
|
-
</ContextMenuCheckboxItem>
|
|
111
|
-
<ContextMenuCheckboxItem checked={showGrid} onCheckedChange={setShowGrid}>
|
|
112
|
-
グリッド線
|
|
113
|
-
</ContextMenuCheckboxItem>
|
|
114
|
-
<ContextMenuSeparator />
|
|
115
|
-
<ContextMenuLabel>並び順</ContextMenuLabel>
|
|
116
|
-
<ContextMenuRadioGroup value={sort} onValueChange={setSort}>
|
|
117
|
-
<ContextMenuRadioItem value="date">日付順</ContextMenuRadioItem>
|
|
118
|
-
<ContextMenuRadioItem value="amount">金額順</ContextMenuRadioItem>
|
|
119
|
-
<ContextMenuRadioItem value="account">科目順</ContextMenuRadioItem>
|
|
120
|
-
</ContextMenuRadioGroup>
|
|
121
|
-
</ContextMenuContent>
|
|
122
|
-
</ContextMenu>
|
|
123
|
-
</CardContent>
|
|
124
|
-
</Card>
|
|
125
|
-
</Flex>
|
|
126
|
-
</PageContainer>
|
|
127
|
-
);
|
|
128
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display";
|
|
4
|
-
import {
|
|
5
|
-
Menubar,
|
|
6
|
-
MenubarCheckboxItem,
|
|
7
|
-
MenubarContent,
|
|
8
|
-
MenubarItem,
|
|
9
|
-
MenubarLabel,
|
|
10
|
-
MenubarMenu,
|
|
11
|
-
MenubarRadioGroup,
|
|
12
|
-
MenubarRadioItem,
|
|
13
|
-
MenubarSeparator,
|
|
14
|
-
MenubarShortcut,
|
|
15
|
-
MenubarSub,
|
|
16
|
-
MenubarSubContent,
|
|
17
|
-
MenubarSubTrigger,
|
|
18
|
-
MenubarTrigger,
|
|
19
|
-
} from "@godxjp/ui/navigation";
|
|
20
|
-
import { Flex, PageContainer } from "@godxjp/ui/layout";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Menubar — アプリトップバー型メニュー。MenubarMenu > MenubarTrigger +
|
|
24
|
-
* MenubarContent > items で構成。チェック・ラジオ・サブメニュー・ショートカット対応。
|
|
25
|
-
* デスクトップ風のコマンドパレットや会計ソフトのツールバーに最適。
|
|
26
|
-
* Composed only from real @godxjp/ui components.
|
|
27
|
-
*/
|
|
28
|
-
export default function Demo() {
|
|
29
|
-
const [autoSave, setAutoSave] = useState(true);
|
|
30
|
-
const [showRuler, setShowRuler] = useState(false);
|
|
31
|
-
const [theme, setTheme] = useState("light");
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<PageContainer
|
|
35
|
-
title="Menubar"
|
|
36
|
-
subtitle="アプリケーションメニューバー · デスクトップ風のコマンドメニュー"
|
|
37
|
-
>
|
|
38
|
-
<Flex direction="col" gap="lg">
|
|
39
|
-
<Card>
|
|
40
|
-
<CardHeader>
|
|
41
|
-
<CardTitle level={2}>会計アプリメニュー</CardTitle>
|
|
42
|
-
<CardDescription>
|
|
43
|
-
ファイル・編集・表示・ヘルプメニューを含む標準的なアプリメニューバー。MenubarItem の
|
|
44
|
-
variant は default と destructive の 2 つ。編集メニューの末尾で両方を並べている。
|
|
45
|
-
</CardDescription>
|
|
46
|
-
</CardHeader>
|
|
47
|
-
<CardContent>
|
|
48
|
-
<Menubar>
|
|
49
|
-
<MenubarMenu>
|
|
50
|
-
<MenubarTrigger>ファイル</MenubarTrigger>
|
|
51
|
-
<MenubarContent>
|
|
52
|
-
<MenubarItem>
|
|
53
|
-
新規仕訳
|
|
54
|
-
<MenubarShortcut>⌘N</MenubarShortcut>
|
|
55
|
-
</MenubarItem>
|
|
56
|
-
<MenubarItem>
|
|
57
|
-
開く
|
|
58
|
-
<MenubarShortcut>⌘O</MenubarShortcut>
|
|
59
|
-
</MenubarItem>
|
|
60
|
-
<MenubarSeparator />
|
|
61
|
-
<MenubarSub>
|
|
62
|
-
<MenubarSubTrigger>エクスポート</MenubarSubTrigger>
|
|
63
|
-
<MenubarSubContent>
|
|
64
|
-
<MenubarItem>仕訳帳 CSV</MenubarItem>
|
|
65
|
-
<MenubarItem>試算表 PDF</MenubarItem>
|
|
66
|
-
<MenubarItem>貸借対照表 Excel</MenubarItem>
|
|
67
|
-
</MenubarSubContent>
|
|
68
|
-
</MenubarSub>
|
|
69
|
-
<MenubarSeparator />
|
|
70
|
-
<MenubarItem>
|
|
71
|
-
終了
|
|
72
|
-
<MenubarShortcut>⌘Q</MenubarShortcut>
|
|
73
|
-
</MenubarItem>
|
|
74
|
-
</MenubarContent>
|
|
75
|
-
</MenubarMenu>
|
|
76
|
-
|
|
77
|
-
<MenubarMenu>
|
|
78
|
-
<MenubarTrigger>編集</MenubarTrigger>
|
|
79
|
-
<MenubarContent>
|
|
80
|
-
<MenubarItem>
|
|
81
|
-
元に戻す
|
|
82
|
-
<MenubarShortcut>⌘Z</MenubarShortcut>
|
|
83
|
-
</MenubarItem>
|
|
84
|
-
<MenubarItem>
|
|
85
|
-
やり直す
|
|
86
|
-
<MenubarShortcut>⇧⌘Z</MenubarShortcut>
|
|
87
|
-
</MenubarItem>
|
|
88
|
-
<MenubarSeparator />
|
|
89
|
-
<MenubarItem>
|
|
90
|
-
コピー
|
|
91
|
-
<MenubarShortcut>⌘C</MenubarShortcut>
|
|
92
|
-
</MenubarItem>
|
|
93
|
-
<MenubarItem>
|
|
94
|
-
貼り付け
|
|
95
|
-
<MenubarShortcut>⌘V</MenubarShortcut>
|
|
96
|
-
</MenubarItem>
|
|
97
|
-
<MenubarSeparator />
|
|
98
|
-
<MenubarItem variant="default">選択行をアーカイブ</MenubarItem>
|
|
99
|
-
<MenubarItem variant="destructive">
|
|
100
|
-
選択行を削除
|
|
101
|
-
<MenubarShortcut>⌫</MenubarShortcut>
|
|
102
|
-
</MenubarItem>
|
|
103
|
-
</MenubarContent>
|
|
104
|
-
</MenubarMenu>
|
|
105
|
-
|
|
106
|
-
<MenubarMenu>
|
|
107
|
-
<MenubarTrigger>表示</MenubarTrigger>
|
|
108
|
-
<MenubarContent>
|
|
109
|
-
<MenubarLabel>オプション</MenubarLabel>
|
|
110
|
-
<MenubarCheckboxItem checked={autoSave} onCheckedChange={setAutoSave}>
|
|
111
|
-
自動保存
|
|
112
|
-
</MenubarCheckboxItem>
|
|
113
|
-
<MenubarCheckboxItem checked={showRuler} onCheckedChange={setShowRuler}>
|
|
114
|
-
ルーラーを表示
|
|
115
|
-
</MenubarCheckboxItem>
|
|
116
|
-
<MenubarSeparator />
|
|
117
|
-
<MenubarLabel>テーマ</MenubarLabel>
|
|
118
|
-
<MenubarRadioGroup value={theme} onValueChange={setTheme}>
|
|
119
|
-
<MenubarRadioItem value="light">ライト</MenubarRadioItem>
|
|
120
|
-
<MenubarRadioItem value="dark">ダーク</MenubarRadioItem>
|
|
121
|
-
<MenubarRadioItem value="system">システム</MenubarRadioItem>
|
|
122
|
-
</MenubarRadioGroup>
|
|
123
|
-
</MenubarContent>
|
|
124
|
-
</MenubarMenu>
|
|
125
|
-
|
|
126
|
-
<MenubarMenu>
|
|
127
|
-
<MenubarTrigger>ヘルプ</MenubarTrigger>
|
|
128
|
-
<MenubarContent>
|
|
129
|
-
<MenubarItem>ドキュメント</MenubarItem>
|
|
130
|
-
<MenubarItem>キーボードショートカット</MenubarItem>
|
|
131
|
-
<MenubarSeparator />
|
|
132
|
-
<MenubarItem>バージョン情報</MenubarItem>
|
|
133
|
-
</MenubarContent>
|
|
134
|
-
</MenubarMenu>
|
|
135
|
-
</Menubar>
|
|
136
|
-
</CardContent>
|
|
137
|
-
</Card>
|
|
138
|
-
</Flex>
|
|
139
|
-
</PageContainer>
|
|
140
|
-
);
|
|
141
|
-
}
|