mokkun 0.1.5 → 0.2.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/README.md +18 -6
  2. package/bin/cli.mjs +6 -6
  3. package/bin/viewer.html +78 -3
  4. package/dist/example.html +225 -0
  5. package/dist/mokkun.css +1 -1
  6. package/dist/mokkun.esm.js +14476 -9626
  7. package/dist/mokkun.esm.js.map +1 -1
  8. package/dist/mokkun.js +761 -363
  9. package/dist/mokkun.js.map +1 -1
  10. package/dist/types/lib.d.ts +109 -0
  11. package/dist/types/loader/file-loader.d.ts +118 -0
  12. package/dist/types/loader/index.d.ts +4 -0
  13. package/dist/types/parser/index.d.ts +5 -0
  14. package/dist/types/parser/key-normalizer.d.ts +24 -0
  15. package/dist/types/parser/v2/compile-expand.d.ts +23 -0
  16. package/dist/types/parser/v2/compile-field.d.ts +28 -0
  17. package/dist/types/parser/v2/compile-section.d.ts +6 -0
  18. package/dist/types/parser/v2/compile-v2.d.ts +14 -0
  19. package/dist/types/parser/v2/compile-warnings.d.ts +17 -0
  20. package/dist/types/parser/v2/file-spec.d.ts +24 -0
  21. package/dist/types/parser/v2/index.d.ts +5 -0
  22. package/dist/types/parser/v2/iso-date.d.ts +10 -0
  23. package/dist/types/parser/v2/parse-v2.d.ts +24 -0
  24. package/dist/types/parser/v2/validate-action.d.ts +11 -0
  25. package/dist/types/parser/v2/validate-app.d.ts +9 -0
  26. package/dist/types/parser/v2/validate-context.d.ts +41 -0
  27. package/dist/types/parser/v2/validate-field.d.ts +17 -0
  28. package/dist/types/parser/v2/validate-keys.d.ts +29 -0
  29. package/dist/types/parser/v2/validate-list.d.ts +5 -0
  30. package/dist/types/parser/v2/validate-v2.d.ts +6 -0
  31. package/dist/types/parser/v2/validate-view.d.ts +6 -0
  32. package/dist/types/parser/yaml-parser.d.ts +68 -0
  33. package/dist/types/renderer/action-handler.d.ts +76 -0
  34. package/dist/types/renderer/components/accordion-panel.d.ts +144 -0
  35. package/dist/types/renderer/components/action-buttons.d.ts +183 -0
  36. package/dist/types/renderer/components/alert-banner.d.ts +43 -0
  37. package/dist/types/renderer/components/app-header.d.ts +277 -0
  38. package/dist/types/renderer/components/app-navi.d.ts +167 -0
  39. package/dist/types/renderer/components/badge.d.ts +134 -0
  40. package/dist/types/renderer/components/browser.d.ts +134 -0
  41. package/dist/types/renderer/components/calendar.d.ts +198 -0
  42. package/dist/types/renderer/components/checkbox.d.ts +132 -0
  43. package/dist/types/renderer/components/chip.d.ts +120 -0
  44. package/dist/types/renderer/components/combobox.d.ts +217 -0
  45. package/dist/types/renderer/components/data-table.d.ts +186 -0
  46. package/dist/types/renderer/components/date-range-picker.d.ts +203 -0
  47. package/dist/types/renderer/components/definition-list.d.ts +165 -0
  48. package/dist/types/renderer/components/delete-confirm-dialog.d.ts +151 -0
  49. package/dist/types/renderer/components/dialog/action-dialog.d.ts +61 -0
  50. package/dist/types/renderer/components/dialog/base-dialog.d.ts +125 -0
  51. package/dist/types/renderer/components/dialog/dialog-types.d.ts +96 -0
  52. package/dist/types/renderer/components/disclosure.d.ts +118 -0
  53. package/dist/types/renderer/components/dropdown.d.ts +220 -0
  54. package/dist/types/renderer/components/duration-input.d.ts +154 -0
  55. package/dist/types/renderer/components/duration-picker.d.ts +108 -0
  56. package/dist/types/renderer/components/field-renderer.d.ts +22 -0
  57. package/dist/types/renderer/components/float-area.d.ts +196 -0
  58. package/dist/types/renderer/components/form-fields.d.ts +94 -0
  59. package/dist/types/renderer/components/form-section.d.ts +118 -0
  60. package/dist/types/renderer/components/google-map-embed.d.ts +88 -0
  61. package/dist/types/renderer/components/heading.d.ts +119 -0
  62. package/dist/types/renderer/components/image-uploader.d.ts +271 -0
  63. package/dist/types/renderer/components/index.d.ts +48 -0
  64. package/dist/types/renderer/components/information-panel.d.ts +139 -0
  65. package/dist/types/renderer/components/input.d.ts +222 -0
  66. package/dist/types/renderer/components/layout.d.ts +71 -0
  67. package/dist/types/renderer/components/line-clamp.d.ts +170 -0
  68. package/dist/types/renderer/components/loader.d.ts +104 -0
  69. package/dist/types/renderer/components/notification-bar.d.ts +251 -0
  70. package/dist/types/renderer/components/pagination.d.ts +167 -0
  71. package/dist/types/renderer/components/photo-manager-renderer.d.ts +9 -0
  72. package/dist/types/renderer/components/radio-button-panel.d.ts +152 -0
  73. package/dist/types/renderer/components/radio.d.ts +117 -0
  74. package/dist/types/renderer/components/repeater.d.ts +116 -0
  75. package/dist/types/renderer/components/response-message.d.ts +180 -0
  76. package/dist/types/renderer/components/search-input.d.ts +198 -0
  77. package/dist/types/renderer/components/section-nav.d.ts +151 -0
  78. package/dist/types/renderer/components/segmented-control.d.ts +143 -0
  79. package/dist/types/renderer/components/select.d.ts +98 -0
  80. package/dist/types/renderer/components/status-label.d.ts +146 -0
  81. package/dist/types/renderer/components/stepper.d.ts +123 -0
  82. package/dist/types/renderer/components/tabs.d.ts +185 -0
  83. package/dist/types/renderer/components/textarea.d.ts +173 -0
  84. package/dist/types/renderer/components/timeline.d.ts +146 -0
  85. package/dist/types/renderer/components/toggle.d.ts +109 -0
  86. package/dist/types/renderer/components/tooltip.d.ts +158 -0
  87. package/dist/types/renderer/components/wizard.d.ts +118 -0
  88. package/dist/types/renderer/layouts/index.d.ts +5 -0
  89. package/dist/types/renderer/layouts/shell.d.ts +7 -0
  90. package/dist/types/renderer/layouts/types.d.ts +34 -0
  91. package/dist/types/renderer/screen-renderer.d.ts +57 -0
  92. package/dist/types/renderer/utils/dom.d.ts +29 -0
  93. package/dist/types/renderer/utils/dummy-data.d.ts +13 -0
  94. package/dist/types/renderer/utils/field-helpers.d.ts +90 -0
  95. package/dist/types/renderer/utils/icons.d.ts +13 -0
  96. package/dist/types/renderer/utils/index.d.ts +6 -0
  97. package/dist/types/renderer-v2/actions.d.ts +30 -0
  98. package/dist/types/renderer-v2/app-shell.d.ts +15 -0
  99. package/dist/types/renderer-v2/condition.d.ts +19 -0
  100. package/dist/types/renderer-v2/context.d.ts +37 -0
  101. package/dist/types/renderer-v2/fields/choice.d.ts +12 -0
  102. package/dist/types/renderer-v2/fields/control-label.d.ts +57 -0
  103. package/dist/types/renderer-v2/fields/date.d.ts +6 -0
  104. package/dist/types/renderer-v2/fields/display.d.ts +22 -0
  105. package/dist/types/renderer-v2/fields/file-support.d.ts +15 -0
  106. package/dist/types/renderer-v2/fields/file.d.ts +9 -0
  107. package/dist/types/renderer-v2/fields/index.d.ts +20 -0
  108. package/dist/types/renderer-v2/fields/select.d.ts +17 -0
  109. package/dist/types/renderer-v2/fields/text.d.ts +26 -0
  110. package/dist/types/renderer-v2/fields/textarea.d.ts +5 -0
  111. package/dist/types/renderer-v2/fields/toggle.d.ts +6 -0
  112. package/dist/types/renderer-v2/icons.d.ts +35 -0
  113. package/dist/types/renderer-v2/index.d.ts +45 -0
  114. package/dist/types/renderer-v2/list-cells.d.ts +6 -0
  115. package/dist/types/renderer-v2/list-data.d.ts +53 -0
  116. package/dist/types/renderer-v2/mount-parts.d.ts +19 -0
  117. package/dist/types/renderer-v2/mount-repeat.d.ts +8 -0
  118. package/dist/types/renderer-v2/mount-section.d.ts +10 -0
  119. package/dist/types/renderer-v2/mount-visibility.d.ts +13 -0
  120. package/dist/types/renderer-v2/mount.d.ts +9 -0
  121. package/dist/types/renderer-v2/role.d.ts +15 -0
  122. package/dist/types/renderer-v2/section-fields.d.ts +11 -0
  123. package/dist/types/renderer-v2/section-list.d.ts +8 -0
  124. package/dist/types/renderer-v2/section-readonly.d.ts +8 -0
  125. package/dist/types/renderer-v2/section.d.ts +15 -0
  126. package/dist/types/renderer-v2/styles.d.ts +13 -0
  127. package/dist/types/renderer-v2/util.d.ts +28 -0
  128. package/dist/types/renderer-v2/view-state.d.ts +25 -0
  129. package/dist/types/renderer-v2/view.d.ts +8 -0
  130. package/dist/types/theme/index.d.ts +6 -0
  131. package/dist/types/theme/theme-manager.d.ts +102 -0
  132. package/dist/types/types/field-renderable.d.ts +40 -0
  133. package/dist/types/types/index.d.ts +7 -0
  134. package/dist/types/types/schema-v2.d.ts +270 -0
  135. package/dist/types/types/schema.d.ts +1712 -0
  136. package/dist/types/types/theme.d.ts +111 -0
  137. package/package.json +3 -1
@@ -0,0 +1,251 @@
1
+ /**
2
+ * NotificationBar Component
3
+ * 通知バーコンポーネント
4
+ *
5
+ *
6
+ * - タイプ(info/success/warning/error/sync)
7
+ * - アクションボタン対応
8
+ * - 閉じるボタン
9
+ * - アニメーション(スライドイン)
10
+ * - 複数通知のスタック表示対応
11
+ * - `data-type` for styling
12
+ * - `role="alert"` or `role="status"` for accessibility
13
+ *
14
+ * @see https://smarthr.design/products/components/notification-bar/
15
+ */
16
+ import type { InputField } from '../../types/schema';
17
+ /**
18
+ * 通知バーのタイプ
19
+ * - info: 情報通知
20
+ * - success: 成功通知
21
+ * - warning: 警告通知
22
+ * - error: エラー通知
23
+ * - sync: 同期中通知
24
+ */
25
+ export type NotificationBarType = 'info' | 'success' | 'warning' | 'error' | 'sync';
26
+ /**
27
+ * 通知バーの状態
28
+ */
29
+ export interface NotificationBarState {
30
+ /** メッセージ */
31
+ message: string;
32
+ /** 表示状態 */
33
+ visible: boolean;
34
+ /** 強調表示 */
35
+ bold: boolean;
36
+ }
37
+ /**
38
+ * 通知バーのコールバック
39
+ */
40
+ export interface NotificationBarCallbacks {
41
+ /** 閉じるボタンクリック時 */
42
+ onClose?: () => void;
43
+ /** アクションボタンクリック時 */
44
+ onAction?: () => void;
45
+ }
46
+ /**
47
+ * 通知バーの設定
48
+ */
49
+ export interface NotificationBarConfig {
50
+ /** メッセージ */
51
+ message: string;
52
+ /** タイプ(カラー) */
53
+ type?: NotificationBarType;
54
+ /** アクションボタンのラベル */
55
+ actionLabel?: string;
56
+ /** 閉じるボタンを表示するか */
57
+ closable?: boolean;
58
+ /** 強調表示(背景色を濃くする) */
59
+ bold?: boolean;
60
+ /** アクセシビリティ用のロール */
61
+ role?: 'alert' | 'status';
62
+ /** アクセシビリティ用のラベル */
63
+ ariaLabel?: string;
64
+ }
65
+ /**
66
+ * 通知バーコンポーネント
67
+ */
68
+ export declare class NotificationBar {
69
+ private config;
70
+ private state;
71
+ private callbacks;
72
+ private container;
73
+ private closeHandler;
74
+ private actionHandler;
75
+ constructor(container: HTMLElement, config: NotificationBarConfig, callbacks?: NotificationBarCallbacks);
76
+ /**
77
+ * 通知バーをレンダリング
78
+ */
79
+ render(): void;
80
+ /**
81
+ * メッセージを設定
82
+ */
83
+ setMessage(message: string): void;
84
+ /**
85
+ * 表示状態を設定
86
+ */
87
+ setVisible(visible: boolean): void;
88
+ /**
89
+ * 強調表示を設定
90
+ */
91
+ setBold(bold: boolean): void;
92
+ /**
93
+ * 通知を表示
94
+ */
95
+ show(): void;
96
+ /**
97
+ * 通知を非表示
98
+ */
99
+ hide(): void;
100
+ /**
101
+ * 現在のメッセージを取得
102
+ */
103
+ getMessage(): string;
104
+ /**
105
+ * 表示状態を取得
106
+ */
107
+ isVisible(): boolean;
108
+ /**
109
+ * 強調表示状態を取得
110
+ */
111
+ isBold(): boolean;
112
+ /**
113
+ * 現在の状態を取得
114
+ */
115
+ getState(): Readonly<NotificationBarState>;
116
+ /**
117
+ * コンポーネントを破棄
118
+ */
119
+ destroy(): void;
120
+ /**
121
+ * 初期状態を作成
122
+ */
123
+ private createInitialState;
124
+ /**
125
+ * 通知バーの内容をレンダリング
126
+ */
127
+ private renderContent;
128
+ /**
129
+ * アクションボタンをレンダリング
130
+ */
131
+ private renderActionButton;
132
+ /**
133
+ * 閉じるボタンをレンダリング
134
+ */
135
+ private renderCloseButton;
136
+ /**
137
+ * アクションボタンクリックハンドラー
138
+ */
139
+ private handleAction;
140
+ /**
141
+ * 閉じるボタンクリックハンドラー
142
+ */
143
+ private handleClose;
144
+ /**
145
+ * イベントリスナーをクリーンアップ
146
+ */
147
+ private cleanup;
148
+ static renderField(field: InputField): string;
149
+ }
150
+ /**
151
+ * 通知アイテム
152
+ */
153
+ export interface NotificationItem {
154
+ /** 通知ID */
155
+ id: string;
156
+ /** メッセージ */
157
+ message: string;
158
+ /** タイプ */
159
+ type?: NotificationBarType;
160
+ /** アクションラベル */
161
+ actionLabel?: string;
162
+ /** 強調表示 */
163
+ bold?: boolean;
164
+ /** アクセシビリティ用のロール */
165
+ role?: 'alert' | 'status';
166
+ /** アクションコールバック */
167
+ onAction?: () => void;
168
+ }
169
+ /**
170
+ * 通知スタックの状態
171
+ */
172
+ export interface NotificationBarStackState {
173
+ /** 通知一覧 */
174
+ notifications: NotificationItem[];
175
+ }
176
+ /**
177
+ * 通知スタックのコールバック
178
+ */
179
+ export interface NotificationBarStackCallbacks {
180
+ /** 通知が閉じられた時 */
181
+ onNotificationClose?: (id: string) => void;
182
+ /** 全通知が閉じられた時 */
183
+ onAllClosed?: () => void;
184
+ }
185
+ /**
186
+ * 通知スタックの設定
187
+ */
188
+ export interface NotificationBarStackConfig {
189
+ /** 初期通知リスト */
190
+ notifications?: NotificationItem[];
191
+ /** 最大表示数 */
192
+ maxVisible?: number;
193
+ }
194
+ /**
195
+ * 通知スタックコンポーネント
196
+ * 複数の通知をスタック表示する
197
+ */
198
+ export declare class NotificationBarStack {
199
+ private config;
200
+ private state;
201
+ private callbacks;
202
+ private container;
203
+ private notificationBars;
204
+ constructor(container: HTMLElement, config?: NotificationBarStackConfig, callbacks?: NotificationBarStackCallbacks);
205
+ /**
206
+ * スタックをレンダリング
207
+ */
208
+ render(): void;
209
+ /**
210
+ * 通知を追加
211
+ */
212
+ addNotification(notification: Omit<NotificationItem, 'id'> & {
213
+ id?: string;
214
+ }): string;
215
+ /**
216
+ * 通知を削除
217
+ */
218
+ removeNotification(id: string): void;
219
+ /**
220
+ * 全通知をクリア
221
+ */
222
+ clearAll(): void;
223
+ /**
224
+ * 通知数を取得
225
+ */
226
+ getCount(): number;
227
+ /**
228
+ * 通知一覧を取得
229
+ */
230
+ getNotifications(): Readonly<NotificationItem[]>;
231
+ /**
232
+ * 現在の状態を取得
233
+ */
234
+ getState(): Readonly<NotificationBarStackState>;
235
+ /**
236
+ * コンポーネントを破棄
237
+ */
238
+ destroy(): void;
239
+ /**
240
+ * 初期状態を作成
241
+ */
242
+ private createInitialState;
243
+ }
244
+ /**
245
+ * 通知バーを作成
246
+ */
247
+ export declare function createNotificationBar(container: HTMLElement, config: NotificationBarConfig, callbacks?: NotificationBarCallbacks): NotificationBar;
248
+ /**
249
+ * 通知スタックを作成
250
+ */
251
+ export declare function createNotificationBarStack(container: HTMLElement, config?: NotificationBarStackConfig, callbacks?: NotificationBarStackCallbacks): NotificationBarStack;
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Pagination Component
3
+ * ページネーションコンポーネント
4
+ *
5
+ * 機能:
6
+ * - ページ番号表示
7
+ * - 前後ボタン
8
+ * - 最初/最後へのジャンプ
9
+ * - ページサイズ選択
10
+ * - 表示件数表示
11
+ * - コンパクト表示モード
12
+ */
13
+ import type { InputField } from '../../types/schema';
14
+ /**
15
+ * ページネーションの状態
16
+ */
17
+ export interface PaginationState {
18
+ /** 現在のページ(1始まり) */
19
+ currentPage: number;
20
+ /** 1ページあたりのアイテム数 */
21
+ pageSize: number;
22
+ /** 総アイテム数 */
23
+ totalItems: number;
24
+ /** 総ページ数 */
25
+ totalPages: number;
26
+ }
27
+ /**
28
+ * ページネーションのコールバック
29
+ */
30
+ export interface PaginationCallbacks {
31
+ /** ページ変更時 */
32
+ onPageChange?: (page: number, state: PaginationState) => void;
33
+ /** ページサイズ変更時 */
34
+ onPageSizeChange?: (pageSize: number, state: PaginationState) => void;
35
+ }
36
+ /**
37
+ * ページネーションの設定
38
+ */
39
+ export interface PaginationConfig {
40
+ /** 総アイテム数 */
41
+ totalItems: number;
42
+ /** 初期ページ(1始まり、デフォルト: 1) */
43
+ initialPage?: number;
44
+ /** 初期ページサイズ(デフォルト: 10) */
45
+ initialPageSize?: number;
46
+ /** ページサイズの選択肢(デフォルト: [10, 25, 50, 100]) */
47
+ pageSizeOptions?: number[];
48
+ /** ページサイズ選択を表示するか(デフォルト: true) */
49
+ showPageSizeSelector?: boolean;
50
+ /** 表示件数を表示するか(デフォルト: true) */
51
+ showItemCount?: boolean;
52
+ /** 最初/最後へのジャンプボタンを表示するか(デフォルト: true) */
53
+ showJumpButtons?: boolean;
54
+ /** ページ番号ボタンの最大表示数(デフォルト: 7) */
55
+ maxPageButtons?: number;
56
+ /** コンパクトモード(デフォルト: false) */
57
+ compact?: boolean;
58
+ /** 位置(デフォルト: 'center') */
59
+ align?: 'left' | 'center' | 'right';
60
+ }
61
+ /**
62
+ * ページネーションコンポーネント
63
+ */
64
+ export declare class Pagination {
65
+ private config;
66
+ private state;
67
+ private callbacks;
68
+ private container;
69
+ private instanceId;
70
+ constructor(container: HTMLElement, config: PaginationConfig, callbacks?: PaginationCallbacks);
71
+ /**
72
+ * ページネーションをレンダリング
73
+ */
74
+ render(): void;
75
+ /**
76
+ * 指定したページへ移動
77
+ */
78
+ goToPage(page: number): void;
79
+ /**
80
+ * 次のページへ移動
81
+ */
82
+ nextPage(): void;
83
+ /**
84
+ * 前のページへ移動
85
+ */
86
+ previousPage(): void;
87
+ /**
88
+ * 最初のページへ移動
89
+ */
90
+ firstPage(): void;
91
+ /**
92
+ * 最後のページへ移動
93
+ */
94
+ lastPage(): void;
95
+ /**
96
+ * ページサイズを設定
97
+ */
98
+ setPageSize(pageSize: number): void;
99
+ /**
100
+ * 総アイテム数を更新
101
+ */
102
+ setTotalItems(totalItems: number): void;
103
+ /**
104
+ * 現在の状態を取得
105
+ */
106
+ getState(): PaginationState;
107
+ /**
108
+ * 現在のページを取得
109
+ */
110
+ getCurrentPage(): number;
111
+ /**
112
+ * ページサイズを取得
113
+ */
114
+ getPageSize(): number;
115
+ /**
116
+ * 表示中のアイテム範囲を取得
117
+ */
118
+ getItemRange(): {
119
+ start: number;
120
+ end: number;
121
+ };
122
+ /**
123
+ * 初期状態を作成
124
+ */
125
+ private createInitialState;
126
+ /**
127
+ * ページ番号を有効範囲内にクランプ
128
+ */
129
+ private clampPage;
130
+ /**
131
+ * ページサイズセレクターをレンダリング
132
+ */
133
+ private renderPageSizeSelector;
134
+ /**
135
+ * ナビゲーションをレンダリング
136
+ */
137
+ private renderNavigation;
138
+ /**
139
+ * ページ番号ボタンをレンダリング
140
+ */
141
+ private renderPageButtons;
142
+ /**
143
+ * 表示するページ番号を計算
144
+ */
145
+ private calculateVisiblePages;
146
+ /**
147
+ * ボタンを作成
148
+ */
149
+ private createButton;
150
+ /**
151
+ * ページ番号ボタンを作成
152
+ */
153
+ private createPageButton;
154
+ /**
155
+ * 表示件数をレンダリング
156
+ */
157
+ private renderItemCount;
158
+ /**
159
+ * PaginationフィールドをHTMLとしてレンダリング(静的メソッド)
160
+ * SSR/初期レンダリング用
161
+ */
162
+ static renderField(field: InputField): string;
163
+ }
164
+ /**
165
+ * Paginationを作成するファクトリ関数
166
+ */
167
+ export declare function createPagination(container: HTMLElement, config: PaginationConfig, callbacks?: PaginationCallbacks): Pagination;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Photo Manager Renderer
3
+ * 写真管理画面のHTML生成(静的レンダリング用)
4
+ */
5
+ import type { PhotoManagerField } from '../../types/schema';
6
+ /**
7
+ * 写真管理フィールドをHTML文字列としてレンダリング
8
+ */
9
+ export declare function renderPhotoManagerField(field: PhotoManagerField): string;
@@ -0,0 +1,152 @@
1
+ /**
2
+ * RadioButtonPanel Component
3
+ * ラジオボタンパネルコンポーネント
4
+ *
5
+ * Card-style radio button group component:
6
+ * - Visual panel/card appearance for each option
7
+ * - Icon and image support
8
+ * - Description text
9
+ * - Disabled state (group and per-option)
10
+ * - Selected state highlighting
11
+ * - Vertical/horizontal/grid layouts
12
+ * - Full ARIA 1.2 compliance with keyboard navigation
13
+ */
14
+ /**
15
+ * ラジオボタンパネルのオプション
16
+ */
17
+ export interface RadioButtonPanelOption {
18
+ /** 値 */
19
+ value: string;
20
+ /** ラベル */
21
+ label: string;
22
+ /** 説明テキスト */
23
+ description?: string;
24
+ /** アイコン(SVG文字列) */
25
+ icon?: string;
26
+ /** 画像URL */
27
+ image?: string;
28
+ /** 無効化 */
29
+ disabled?: boolean;
30
+ }
31
+ /**
32
+ * ラジオボタンパネルの状態
33
+ */
34
+ export interface RadioButtonPanelState {
35
+ /** 選択された値 */
36
+ selectedValue: string | null;
37
+ /** 無効化状態 */
38
+ disabled: boolean;
39
+ /** フォーカスされているオプションのインデックス */
40
+ focusedIndex: number;
41
+ }
42
+ /**
43
+ * ラジオボタンパネルのコールバック
44
+ */
45
+ export interface RadioButtonPanelCallbacks {
46
+ /** 値変更時(値と状態を受け取る) */
47
+ onChange?: (value: string, state: RadioButtonPanelState) => void;
48
+ /** 値変更時(値のみを受け取る) */
49
+ onValueChange?: (value: string) => void;
50
+ }
51
+ /**
52
+ * ラジオボタンパネルの設定
53
+ */
54
+ export interface RadioButtonPanelConfig {
55
+ /** name属性(フォーム用、必須) */
56
+ name: string;
57
+ /** オプション配列 */
58
+ options: RadioButtonPanelOption[];
59
+ /** 初期選択値 */
60
+ defaultValue?: string;
61
+ /** レイアウト方向 */
62
+ direction?: 'horizontal' | 'vertical';
63
+ /** グリッドカラム数(horizontal時のみ) */
64
+ columns?: 1 | 2 | 3 | 4;
65
+ /** サイズ */
66
+ size?: 'small' | 'medium' | 'large';
67
+ /** 無効化(グループ全体) */
68
+ disabled?: boolean;
69
+ /** 必須 */
70
+ required?: boolean;
71
+ /** 幅 */
72
+ width?: string | number;
73
+ }
74
+ /**
75
+ * ラジオボタンパネルコンポーネント
76
+ */
77
+ export declare class RadioButtonPanel {
78
+ private config;
79
+ private state;
80
+ private callbacks;
81
+ private container;
82
+ private optionElements;
83
+ constructor(container: HTMLElement, config: RadioButtonPanelConfig, callbacks?: RadioButtonPanelCallbacks);
84
+ /**
85
+ * ラジオボタンパネルをレンダリング
86
+ */
87
+ render(): void;
88
+ /**
89
+ * 値を設定
90
+ */
91
+ setValue(value: string | null): void;
92
+ /**
93
+ * 無効化状態を設定
94
+ */
95
+ setDisabled(disabled: boolean): void;
96
+ /**
97
+ * 現在の状態を取得
98
+ */
99
+ getState(): RadioButtonPanelState;
100
+ /**
101
+ * 現在の値を取得
102
+ */
103
+ getValue(): string | null;
104
+ /**
105
+ * 無効化されているかどうかを取得
106
+ */
107
+ isDisabled(): boolean;
108
+ /**
109
+ * 初期状態を作成
110
+ */
111
+ private createInitialState;
112
+ /**
113
+ * オプションをレンダリング
114
+ */
115
+ private renderOption;
116
+ /**
117
+ * メディア(アイコン/画像)をレンダリング
118
+ */
119
+ private renderMedia;
120
+ /**
121
+ * コンテンツ(ラベル + 説明)をレンダリング
122
+ */
123
+ private renderContent;
124
+ /**
125
+ * インジケーター(ラジオ円)をレンダリング
126
+ */
127
+ private renderIndicator;
128
+ /**
129
+ * オプションクリックを処理
130
+ */
131
+ private handleOptionClick;
132
+ /**
133
+ * キーボードナビゲーションを処理
134
+ */
135
+ private handleKeyboardNavigation;
136
+ /**
137
+ * 次のオプションにフォーカス
138
+ */
139
+ private focusNextOption;
140
+ /**
141
+ * 前のオプションにフォーカス
142
+ */
143
+ private focusPreviousOption;
144
+ /**
145
+ * 指定されたインデックスのオプションにフォーカス
146
+ */
147
+ private focusOption;
148
+ }
149
+ /**
150
+ * RadioButtonPanelを作成するファクトリ関数
151
+ */
152
+ export declare function createRadioButtonPanel(container: HTMLElement, config: RadioButtonPanelConfig, callbacks?: RadioButtonPanelCallbacks): RadioButtonPanel;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * RadioButton Component
3
+ * ラジオボタンコンポーネント
4
+ *
5
+ *
6
+ * - `checked` / `defaultChecked` for state
7
+ * - `data-state="checked|unchecked"` for styling
8
+ * - `error` state with error messages
9
+ * - `role="radio"` with `aria-checked` for accessibility
10
+ */
11
+ import type { RadioGroupField } from '../../types/schema';
12
+ /**
13
+ * ラジオボタンの状態
14
+ */
15
+ export interface RadioButtonState {
16
+ /** 選択状態 */
17
+ checked: boolean;
18
+ /** 無効化状態 */
19
+ disabled: boolean;
20
+ }
21
+ /**
22
+ * ラジオボタンのコールバック
23
+ */
24
+ export interface RadioButtonCallbacks {
25
+ /** 状態変更時 */
26
+ onChange?: (checked: boolean, state: RadioButtonState) => void;
27
+ /** 選択状態変更時 */
28
+ onCheckedChange?: (checked: boolean) => void;
29
+ }
30
+ /**
31
+ * ラジオボタンの設定
32
+ */
33
+ export interface RadioButtonConfig {
34
+ /** 初期選択状態 */
35
+ defaultChecked?: boolean;
36
+ /** 無効化 */
37
+ disabled?: boolean;
38
+ /** 選択時ラベル */
39
+ checkedLabel?: string;
40
+ /** 非選択時ラベル */
41
+ uncheckedLabel?: string;
42
+ /** サイズ */
43
+ size?: 'small' | 'medium' | 'large';
44
+ /** name属性(グループ化用) */
45
+ name?: string;
46
+ /** value属性 */
47
+ value?: string;
48
+ /** ラベル位置 */
49
+ labelPosition?: 'left' | 'right';
50
+ }
51
+ /**
52
+ * ラジオボタンコンポーネント
53
+ */
54
+ export declare class RadioButton {
55
+ private config;
56
+ private state;
57
+ private callbacks;
58
+ private container;
59
+ private instanceId;
60
+ constructor(container: HTMLElement, config?: RadioButtonConfig, callbacks?: RadioButtonCallbacks);
61
+ /**
62
+ * ラジオボタンをレンダリング
63
+ */
64
+ render(): void;
65
+ /**
66
+ * 選択状態を設定
67
+ */
68
+ setChecked(checked: boolean): void;
69
+ /**
70
+ * 無効化状態を設定
71
+ */
72
+ setDisabled(disabled: boolean): void;
73
+ /**
74
+ * 現在の状態を取得
75
+ */
76
+ getState(): RadioButtonState;
77
+ /**
78
+ * 選択状態を取得
79
+ */
80
+ isChecked(): boolean;
81
+ /**
82
+ * 無効化されているかどうかを取得
83
+ */
84
+ isDisabled(): boolean;
85
+ /**
86
+ * value属性を取得
87
+ */
88
+ getValue(): string | undefined;
89
+ /**
90
+ * name属性を取得
91
+ */
92
+ getName(): string | undefined;
93
+ /**
94
+ * 初期状態を作成
95
+ */
96
+ private createInitialState;
97
+ /**
98
+ * ラジオボタンをレンダリング
99
+ */
100
+ private renderRadio;
101
+ /**
102
+ * ラベルをレンダリング
103
+ */
104
+ private renderLabel;
105
+ /**
106
+ * ラジオグループフィールドをHTMLとしてレンダリング(静的メソッド)
107
+ * SSR/初期レンダリング用
108
+ *
109
+ * @param field - ラジオグループフィールド定義
110
+ * @returns 生成されたHTML文字列
111
+ */
112
+ static renderField(field: RadioGroupField): string;
113
+ }
114
+ /**
115
+ * RadioButtonを作成するファクトリ関数
116
+ */
117
+ export declare function createRadioButton(container: HTMLElement, config?: RadioButtonConfig, callbacks?: RadioButtonCallbacks): RadioButton;