@reni-corp/reni-2c-ui 0.3.27 → 0.3.29

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 (101) hide show
  1. package/README.md +139 -16
  2. package/dist/components/elements/Alert.vue.d.ts +21 -3
  3. package/dist/components/elements/Alert.vue.d.ts.map +1 -1
  4. package/dist/components/elements/CheckBox.vue.d.ts +42 -2
  5. package/dist/components/elements/CheckBox.vue.d.ts.map +1 -1
  6. package/dist/components/elements/ComboBox.vue.d.ts +153 -0
  7. package/dist/components/elements/ComboBox.vue.d.ts.map +1 -0
  8. package/dist/components/elements/Icon.vue.d.ts.map +1 -1
  9. package/dist/components/elements/PasswordField.vue.d.ts +75 -25
  10. package/dist/components/elements/PasswordField.vue.d.ts.map +1 -1
  11. package/dist/components/elements/Progress.vue.d.ts +45 -0
  12. package/dist/components/elements/Progress.vue.d.ts.map +1 -0
  13. package/dist/components/elements/SelectBox.vue.d.ts +30 -10
  14. package/dist/components/elements/SelectBox.vue.d.ts.map +1 -1
  15. package/dist/components/elements/SkeletonLoader.vue.d.ts +30 -0
  16. package/dist/components/elements/SkeletonLoader.vue.d.ts.map +1 -0
  17. package/dist/components/elements/SpinButton.vue.d.ts +4 -2
  18. package/dist/components/elements/SpinButton.vue.d.ts.map +1 -1
  19. package/dist/components/elements/TextField.vue.d.ts +21 -6
  20. package/dist/components/elements/TextField.vue.d.ts.map +1 -1
  21. package/dist/components/features/ProductList.vue.d.ts +4 -0
  22. package/dist/components/features/ProductList.vue.d.ts.map +1 -1
  23. package/dist/components/features/ProductListItem.vue.d.ts +4 -0
  24. package/dist/components/features/ProductListItem.vue.d.ts.map +1 -1
  25. package/dist/components/features/ProductPurchase.vue.d.ts +102 -0
  26. package/dist/components/features/ProductPurchase.vue.d.ts.map +1 -0
  27. package/dist/components/foundation/AppBar.vue.d.ts +28 -3
  28. package/dist/components/foundation/AppBar.vue.d.ts.map +1 -1
  29. package/dist/components/foundation/AppFooter.vue.d.ts +51 -1
  30. package/dist/components/foundation/AppFooter.vue.d.ts.map +1 -1
  31. package/dist/components/interactive/Disclosure.vue.d.ts +54 -0
  32. package/dist/components/interactive/Disclosure.vue.d.ts.map +1 -0
  33. package/dist/components/layouts/Page.vue.d.ts +2 -0
  34. package/dist/components/layouts/Page.vue.d.ts.map +1 -1
  35. package/dist/components/renderless/Form.vue.d.ts +27 -1
  36. package/dist/components/renderless/Form.vue.d.ts.map +1 -1
  37. package/dist/index.d.ts +11 -3
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.es.js +7442 -6048
  40. package/dist/script.es.js +8881 -7489
  41. package/dist/script.umd.js +26 -26
  42. package/dist/style.css +1 -1
  43. package/dist/types.d.ts +7 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/dist/utils.d.ts.map +1 -1
  46. package/package.json +22 -13
  47. package/src/stories/Alert.stories.ts +260 -0
  48. package/src/stories/AnnounceBar.stories.ts +138 -0
  49. package/src/stories/AppBar.stories.ts +277 -0
  50. package/src/stories/AppFooter.stories.ts +274 -0
  51. package/src/stories/AppFrame.stories.ts +46 -0
  52. package/src/stories/AppLayout.stories.ts +870 -0
  53. package/src/stories/Button.stories.ts +101 -0
  54. package/src/stories/Card.stories.ts +152 -0
  55. package/src/stories/Carousel.stories.ts +62 -0
  56. package/src/stories/CarouselBanner.stories.ts +103 -0
  57. package/src/stories/CheckBox.stories.ts +76 -0
  58. package/src/stories/ComboBox.stories.ts +524 -0
  59. package/src/stories/Dialog.stories.ts +174 -0
  60. package/src/stories/Disclosure.stories.ts +217 -0
  61. package/src/stories/Divider.stories.ts +68 -0
  62. package/src/stories/Drawer.stories.ts +135 -0
  63. package/src/stories/DropDown.stories.ts +195 -0
  64. package/src/stories/FloatingBanner.stories.ts +79 -0
  65. package/src/stories/Form.stories.ts +704 -0
  66. package/src/stories/Gallery.stories.ts +78 -0
  67. package/src/stories/Grid.stories.ts +357 -0
  68. package/src/stories/Hero.stories.ts +52 -0
  69. package/src/stories/Html.stories.ts +178 -0
  70. package/src/stories/Icon.stories.ts +176 -0
  71. package/src/stories/Image.stories.ts +613 -0
  72. package/src/stories/Label.stories.ts +54 -0
  73. package/src/stories/List.stories.ts +112 -0
  74. package/src/stories/Modal.stories.ts +123 -0
  75. package/src/stories/Notification.stories.ts +82 -0
  76. package/src/stories/Page.stories.ts +414 -0
  77. package/src/stories/PasswordField.stories.ts +304 -0
  78. package/src/stories/ProductLabels.stories.ts +65 -0
  79. package/src/stories/ProductList.stories.ts +679 -0
  80. package/src/stories/ProductPurchase.stories.ts +807 -0
  81. package/src/stories/Progress.stories.ts +192 -0
  82. package/src/stories/Radio.stories.ts +81 -0
  83. package/src/stories/Section.stories.ts +244 -0
  84. package/src/stories/SelectBox.stories.ts +377 -0
  85. package/src/stories/SkeletonLoader.stories.ts +170 -0
  86. package/src/stories/Slider.stories.ts +79 -0
  87. package/src/stories/SnsLink.stories.ts +259 -0
  88. package/src/stories/SoldStacker.stories.ts +68 -0
  89. package/src/stories/SpinButton.stories.ts +134 -0
  90. package/src/stories/Spinner.stories.ts +58 -0
  91. package/src/stories/Stack.stories.ts +104 -0
  92. package/src/stories/Switch.stories.ts +68 -0
  93. package/src/stories/Tab.stories.ts +52 -0
  94. package/src/stories/TabPanels.stories.ts +67 -0
  95. package/src/stories/Tabs.stories.ts +68 -0
  96. package/src/stories/Text.stories.ts +69 -0
  97. package/src/stories/TextArea.stories.ts +78 -0
  98. package/src/stories/TextField.stories.ts +97 -0
  99. package/src/stories/ToolChip.stories.ts +125 -0
  100. package/dist/components/elements/SkeltonLoader.vue.d.ts +0 -7
  101. package/dist/components/elements/SkeltonLoader.vue.d.ts.map +0 -1
@@ -0,0 +1,524 @@
1
+ import { ref } from 'vue'
2
+ import type { Meta, StoryObj } from '@storybook/vue3'
3
+ import ComboBox, {
4
+ type ComboBoxProps,
5
+ } from '@/components/elements/ComboBox.vue'
6
+ import Icon from '@/components/elements/Icon.vue'
7
+
8
+ /**
9
+ * ComboBox - 複数選択可能なコンボボックスコンポーネント
10
+ *
11
+ * ## 特徴
12
+ * - 複数選択対応(チップ表示)
13
+ * - オートコンプリート(検索)機能
14
+ * - キーボードナビゲーション対応
15
+ * - vee-validate連携
16
+ * - アクセシビリティ対応(ARIA属性)
17
+ *
18
+ * ## キーボード操作
19
+ * - `↑` / `↓`: リスト内を移動
20
+ * - `Enter` / `Space`: 選択/解除
21
+ * - `Escape`: ドロップダウンを閉じる
22
+ * - `Backspace`: 最後の選択を削除(入力が空の場合)
23
+ */
24
+ const meta: Meta<typeof ComboBox> = {
25
+ title: 'Elements/ComboBox',
26
+ component: ComboBox,
27
+ tags: ['autodocs'],
28
+ argTypes: {
29
+ modelValue: {
30
+ control: 'object',
31
+ description: '選択された値の配列',
32
+ },
33
+ label: {
34
+ control: 'text',
35
+ description: 'ラベルテキスト',
36
+ },
37
+ itemTitle: {
38
+ control: 'text',
39
+ description: 'アイテムの表示名として使用するキー',
40
+ },
41
+ itemValue: {
42
+ control: 'text',
43
+ description: 'アイテムの値として使用するキー',
44
+ },
45
+ returnObject: {
46
+ control: 'boolean',
47
+ description: 'trueの場合、値としてオブジェクト全体を返す',
48
+ },
49
+ items: {
50
+ control: 'object',
51
+ description: '選択肢のリスト',
52
+ },
53
+ disabled: {
54
+ control: 'boolean',
55
+ description: '無効状態',
56
+ },
57
+ autocomplete: {
58
+ control: 'boolean',
59
+ description: 'オートコンプリート(検索)機能の有効化',
60
+ },
61
+ clearable: {
62
+ control: 'boolean',
63
+ description: 'クリアボタンの表示',
64
+ },
65
+ name: {
66
+ control: 'text',
67
+ description: 'フォームフィールド名(vee-validate用)',
68
+ },
69
+ rules: {
70
+ control: 'text',
71
+ description: 'バリデーションルール',
72
+ },
73
+ placeholder: {
74
+ control: 'text',
75
+ description: 'プレースホルダーテキスト',
76
+ },
77
+ noResultsText: {
78
+ control: 'text',
79
+ description: '検索結果がない場合のメッセージ',
80
+ },
81
+ },
82
+ args: {
83
+ modelValue: [],
84
+ label: 'お気に入りの果物',
85
+ itemTitle: 'label',
86
+ itemValue: 'value',
87
+ returnObject: false,
88
+ items: [
89
+ { value: 'apple', label: 'りんご' },
90
+ { value: 'banana', label: 'バナナ' },
91
+ { value: 'orange', label: 'オレンジ' },
92
+ { value: 'grape', label: 'ぶどう' },
93
+ { value: 'strawberry', label: 'いちご' },
94
+ ],
95
+ disabled: false,
96
+ autocomplete: true,
97
+ clearable: false,
98
+ name: 'fruits',
99
+ rules: '',
100
+ placeholder: '検索または選択してください',
101
+ noResultsText: '該当する項目がありません',
102
+ },
103
+ }
104
+
105
+ export default meta
106
+ type StoryArgs = ComboBoxProps & { slotText: string }
107
+ type Story = StoryObj<StoryArgs>
108
+ type OverridesStory = Omit<Story, 'argTypes'> & {
109
+ argTypes?: Record<string, unknown>
110
+ }
111
+
112
+ /**
113
+ * 基本的な使用方法
114
+ */
115
+ export const 基本: OverridesStory = {
116
+ args: {},
117
+ argTypes: {},
118
+ render: (args: StoryArgs) => ({
119
+ components: { 'rn-comboBox': ComboBox, 'rn-icon': Icon },
120
+ setup() {
121
+ const selectedValues = ref<string[]>([])
122
+ return { args, selectedValues }
123
+ },
124
+ template: /* html */ `
125
+ <div class='sb-canvas' style="min-height: 320px;">
126
+ <rn-comboBox
127
+ v-model="selectedValues"
128
+ :label="args.label"
129
+ :itemTitle="args.itemTitle"
130
+ :itemValue="args.itemValue"
131
+ :returnObject="args.returnObject"
132
+ :items="args.items"
133
+ :disabled="args.disabled"
134
+ :autocomplete="args.autocomplete"
135
+ :clearable="args.clearable"
136
+ :name="args.name"
137
+ :rules="args.rules"
138
+ :placeholder="args.placeholder"
139
+ :noResultsText="args.noResultsText"
140
+ />
141
+ <div style="margin-top: 16px;">
142
+ <strong>選択中:</strong> {{ selectedValues }}
143
+ </div>
144
+ </div>
145
+ `,
146
+ }),
147
+ }
148
+
149
+ /**
150
+ * クリアボタン付き
151
+ * - `clearable: true` で全選択をクリアするボタンを表示
152
+ */
153
+ export const クリア可能: OverridesStory = {
154
+ args: {
155
+ clearable: true,
156
+ label: 'クリア可能なコンボボックス',
157
+ },
158
+ argTypes: {},
159
+ render: (args: StoryArgs) => ({
160
+ components: { 'rn-comboBox': ComboBox },
161
+ setup() {
162
+ const selectedValues = ref<string[]>(['apple', 'banana'])
163
+ return { args, selectedValues }
164
+ },
165
+ template: /* html */ `
166
+ <div class='sb-canvas' style="min-height: 320px;">
167
+ <rn-comboBox
168
+ v-model="selectedValues"
169
+ :label="args.label"
170
+ :itemTitle="args.itemTitle"
171
+ :itemValue="args.itemValue"
172
+ :returnObject="args.returnObject"
173
+ :items="args.items"
174
+ :disabled="args.disabled"
175
+ :autocomplete="args.autocomplete"
176
+ :clearable="args.clearable"
177
+ :name="args.name"
178
+ :rules="args.rules"
179
+ :placeholder="args.placeholder"
180
+ :noResultsText="args.noResultsText"
181
+ />
182
+ <div style="margin-top: 16px;">
183
+ <strong>選択中:</strong> {{ selectedValues }}
184
+ </div>
185
+ </div>
186
+ `,
187
+ }),
188
+ }
189
+
190
+ /**
191
+ * 必須入力バリデーション
192
+ * - `rules: 'required'` で必須チェックを有効化
193
+ * - 選択後にフォーカスを外すとバリデーションが実行される
194
+ */
195
+ export const 必須チェック: OverridesStory = {
196
+ args: {
197
+ rules: 'required',
198
+ label: '必須選択項目',
199
+ },
200
+ argTypes: {},
201
+ render: (args: StoryArgs) => ({
202
+ components: { 'rn-comboBox': ComboBox },
203
+ setup() {
204
+ const selectedValues = ref<string[]>([])
205
+ return { args, selectedValues }
206
+ },
207
+ template: /* html */ `
208
+ <div class='sb-canvas' style="min-height: 320px;">
209
+ <rn-comboBox
210
+ v-model="selectedValues"
211
+ :label="args.label"
212
+ :itemTitle="args.itemTitle"
213
+ :itemValue="args.itemValue"
214
+ :returnObject="args.returnObject"
215
+ :items="args.items"
216
+ :disabled="args.disabled"
217
+ :autocomplete="args.autocomplete"
218
+ :clearable="args.clearable"
219
+ :name="args.name"
220
+ :rules="args.rules"
221
+ :placeholder="args.placeholder"
222
+ :noResultsText="args.noResultsText"
223
+ />
224
+ <div style="margin-top: 16px;">
225
+ <strong>選択中:</strong> {{ selectedValues }}
226
+ </div>
227
+ </div>
228
+ `,
229
+ }),
230
+ }
231
+
232
+ /**
233
+ * オブジェクト返却モード
234
+ * - `returnObject: true` でアイテム全体をオブジェクトとして返す
235
+ */
236
+ export const returnObjectの場合: OverridesStory = {
237
+ args: {
238
+ returnObject: true,
239
+ label: 'オブジェクトを返す',
240
+ },
241
+ argTypes: {},
242
+ render: (args: StoryArgs) => ({
243
+ components: { 'rn-comboBox': ComboBox },
244
+ setup() {
245
+ const selectedValues = ref<unknown[]>([])
246
+ return { args, selectedValues }
247
+ },
248
+ template: /* html */ `
249
+ <div class='sb-canvas' style="min-height: 320px;">
250
+ <rn-comboBox
251
+ v-model="selectedValues"
252
+ :label="args.label"
253
+ :itemTitle="args.itemTitle"
254
+ :itemValue="args.itemValue"
255
+ :returnObject="args.returnObject"
256
+ :items="args.items"
257
+ :disabled="args.disabled"
258
+ :autocomplete="args.autocomplete"
259
+ :clearable="args.clearable"
260
+ :name="args.name"
261
+ :rules="args.rules"
262
+ :placeholder="args.placeholder"
263
+ :noResultsText="args.noResultsText"
264
+ />
265
+ <div style="margin-top: 16px;">
266
+ <strong>選択中:</strong> {{ JSON.stringify(selectedValues) }}
267
+ </div>
268
+ </div>
269
+ `,
270
+ }),
271
+ }
272
+
273
+ /**
274
+ * カスタムアイコン付き
275
+ * - `append-inner` スロットでカスタムアイコンを追加
276
+ */
277
+ export const アイコン付き: OverridesStory = {
278
+ args: {
279
+ label: 'アイコン付きコンボボックス',
280
+ },
281
+ argTypes: {},
282
+ render: (args: StoryArgs) => ({
283
+ components: { 'rn-comboBox': ComboBox, 'rn-icon': Icon },
284
+ setup() {
285
+ const selectedValues = ref<string[]>([])
286
+ return { args, selectedValues }
287
+ },
288
+ template: /* html */ `
289
+ <div class='sb-canvas' style="min-height: 320px;">
290
+ <rn-comboBox
291
+ v-model="selectedValues"
292
+ :label="args.label"
293
+ :itemTitle="args.itemTitle"
294
+ :itemValue="args.itemValue"
295
+ :returnObject="args.returnObject"
296
+ :items="args.items"
297
+ :disabled="args.disabled"
298
+ :autocomplete="args.autocomplete"
299
+ :clearable="args.clearable"
300
+ :name="args.name"
301
+ :rules="args.rules"
302
+ :placeholder="args.placeholder"
303
+ :noResultsText="args.noResultsText"
304
+ >
305
+ <template #append-inner>
306
+ <rn-icon icon="chevron-down" />
307
+ </template>
308
+ </rn-comboBox>
309
+ <div style="margin-top: 16px;">
310
+ <strong>選択中:</strong> {{ selectedValues }}
311
+ </div>
312
+ </div>
313
+ `,
314
+ }),
315
+ }
316
+
317
+ /**
318
+ * キーボード操作
319
+ *
320
+ * 以下のキーボード操作に対応しています:
321
+ * - `↑` / `↓`: リスト内のアイテムを移動
322
+ * - `Enter` / `Space`: フォーカス中のアイテムを選択/解除
323
+ * - `Escape`: ドロップダウンを閉じる
324
+ * - `Backspace`: 入力が空の場合、最後の選択を削除
325
+ */
326
+ export const キーボード操作: OverridesStory = {
327
+ args: {
328
+ label: 'キーボードで操作してください',
329
+ placeholder: 'Tab→↓↑で移動→Enterで選択',
330
+ },
331
+ argTypes: {},
332
+ render: (args: StoryArgs) => ({
333
+ components: { 'rn-comboBox': ComboBox },
334
+ setup() {
335
+ const selectedValues = ref<string[]>([])
336
+ return { args, selectedValues }
337
+ },
338
+ template: /* html */ `
339
+ <div class='sb-canvas' style="min-height: 320px;">
340
+ <p style="margin-bottom: 16px; color: #666; font-size: 14px;">
341
+ 💡 <strong>キーボード操作:</strong><br />
342
+ ・<kbd>↑</kbd> / <kbd>↓</kbd>: リスト内を移動<br />
343
+ ・<kbd>Enter</kbd> / <kbd>Space</kbd>: 選択/解除<br />
344
+ ・<kbd>Escape</kbd>: ドロップダウンを閉じる<br />
345
+ ・<kbd>Backspace</kbd>: 最後の選択を削除
346
+ </p>
347
+ <rn-comboBox
348
+ v-model="selectedValues"
349
+ :label="args.label"
350
+ :itemTitle="args.itemTitle"
351
+ :itemValue="args.itemValue"
352
+ :returnObject="args.returnObject"
353
+ :items="args.items"
354
+ :disabled="args.disabled"
355
+ :autocomplete="args.autocomplete"
356
+ :clearable="args.clearable"
357
+ :name="args.name"
358
+ :rules="args.rules"
359
+ :placeholder="args.placeholder"
360
+ :noResultsText="args.noResultsText"
361
+ />
362
+ <div style="margin-top: 16px;">
363
+ <strong>選択中:</strong> {{ selectedValues }}
364
+ </div>
365
+ </div>
366
+ `,
367
+ }),
368
+ }
369
+
370
+ /**
371
+ * 無効状態
372
+ * - `disabled: true` で操作を無効化
373
+ */
374
+ export const 無効状態: OverridesStory = {
375
+ args: {
376
+ disabled: true,
377
+ label: '無効なコンボボックス',
378
+ },
379
+ argTypes: {},
380
+ render: (args: StoryArgs) => ({
381
+ components: { 'rn-comboBox': ComboBox },
382
+ setup() {
383
+ const selectedValues = ref<string[]>(['apple', 'banana'])
384
+ return { args, selectedValues }
385
+ },
386
+ template: /* html */ `
387
+ <div class='sb-canvas' style="min-height: 320px;">
388
+ <rn-comboBox
389
+ v-model="selectedValues"
390
+ :label="args.label"
391
+ :itemTitle="args.itemTitle"
392
+ :itemValue="args.itemValue"
393
+ :returnObject="args.returnObject"
394
+ :items="args.items"
395
+ :disabled="args.disabled"
396
+ :autocomplete="args.autocomplete"
397
+ :clearable="args.clearable"
398
+ :name="args.name"
399
+ :rules="args.rules"
400
+ :placeholder="args.placeholder"
401
+ :noResultsText="args.noResultsText"
402
+ />
403
+ <div style="margin-top: 16px;">
404
+ <strong>選択中:</strong> {{ selectedValues }}
405
+ </div>
406
+ </div>
407
+ `,
408
+ }),
409
+ }
410
+
411
+ /**
412
+ * カスタム検索結果なしメッセージ
413
+ * - `noResultsText` propでメッセージをカスタマイズ
414
+ */
415
+ export const カスタム検索結果なし: OverridesStory = {
416
+ args: {
417
+ label: '検索してみてください',
418
+ noResultsText: '🔍 見つかりませんでした...',
419
+ placeholder: '存在しない文字を入力してみてください',
420
+ },
421
+ argTypes: {},
422
+ render: (args: StoryArgs) => ({
423
+ components: { 'rn-comboBox': ComboBox },
424
+ setup() {
425
+ const selectedValues = ref<string[]>([])
426
+ return { args, selectedValues }
427
+ },
428
+ template: /* html */ `
429
+ <div class='sb-canvas' style="min-height: 320px;">
430
+ <rn-comboBox
431
+ v-model="selectedValues"
432
+ :label="args.label"
433
+ :itemTitle="args.itemTitle"
434
+ :itemValue="args.itemValue"
435
+ :returnObject="args.returnObject"
436
+ :items="args.items"
437
+ :disabled="args.disabled"
438
+ :autocomplete="args.autocomplete"
439
+ :clearable="args.clearable"
440
+ :name="args.name"
441
+ :rules="args.rules"
442
+ :placeholder="args.placeholder"
443
+ :noResultsText="args.noResultsText"
444
+ />
445
+ <div style="margin-top: 16px;">
446
+ <strong>選択中:</strong> {{ selectedValues }}
447
+ </div>
448
+ </div>
449
+ `,
450
+ }),
451
+ }
452
+
453
+ /**
454
+ * イベントハンドリング
455
+ * - `@open`: ドロップダウンが開いた時
456
+ * - `@close`: ドロップダウンが閉じた時
457
+ * - `@select`: アイテムが選択された時
458
+ * - `@deselect`: アイテムの選択が解除された時
459
+ */
460
+ export const イベント: OverridesStory = {
461
+ args: {
462
+ label: 'イベントを確認',
463
+ clearable: true,
464
+ },
465
+ argTypes: {},
466
+ render: (args: StoryArgs) => ({
467
+ components: { 'rn-comboBox': ComboBox },
468
+ setup() {
469
+ const selectedValues = ref<string[]>([])
470
+ const eventLog = ref<string[]>([])
471
+
472
+ const onOpen = () => {
473
+ eventLog.value.push(`[${new Date().toLocaleTimeString()}] open`)
474
+ }
475
+ const onClose = () => {
476
+ eventLog.value.push(`[${new Date().toLocaleTimeString()}] close`)
477
+ }
478
+ const onSelect = (item: unknown) => {
479
+ eventLog.value.push(
480
+ `[${new Date().toLocaleTimeString()}] select: ${JSON.stringify(item)}`,
481
+ )
482
+ }
483
+ const onDeselect = (item: unknown) => {
484
+ eventLog.value.push(
485
+ `[${new Date().toLocaleTimeString()}] deselect: ${JSON.stringify(item)}`,
486
+ )
487
+ }
488
+
489
+ return { args, selectedValues, eventLog, onOpen, onClose, onSelect, onDeselect }
490
+ },
491
+ template: /* html */ `
492
+ <div class='sb-canvas' style="min-height: 400px;">
493
+ <rn-comboBox
494
+ v-model="selectedValues"
495
+ :label="args.label"
496
+ :itemTitle="args.itemTitle"
497
+ :itemValue="args.itemValue"
498
+ :returnObject="args.returnObject"
499
+ :items="args.items"
500
+ :disabled="args.disabled"
501
+ :autocomplete="args.autocomplete"
502
+ :clearable="args.clearable"
503
+ :name="args.name"
504
+ :rules="args.rules"
505
+ :placeholder="args.placeholder"
506
+ :noResultsText="args.noResultsText"
507
+ @open="onOpen"
508
+ @close="onClose"
509
+ @select="onSelect"
510
+ @deselect="onDeselect"
511
+ />
512
+ <div style="margin-top: 16px;">
513
+ <strong>選択中:</strong> {{ selectedValues }}
514
+ </div>
515
+ <div style="margin-top: 16px;">
516
+ <strong>イベントログ:</strong>
517
+ <ul style="font-size: 12px; font-family: monospace; max-height: 150px; overflow-y: auto; background: #f5f5f5; padding: 8px 8px 8px 24px; border-radius: 4px;">
518
+ <li v-for="(log, i) in eventLog" :key="i">{{ log }}</li>
519
+ </ul>
520
+ </div>
521
+ </div>
522
+ `,
523
+ }),
524
+ }
@@ -0,0 +1,174 @@
1
+ import { ref } from 'vue'
2
+ import type { Meta, StoryObj } from '@storybook/vue3'
3
+ import Dialog, { type DialogProps } from '@/components/interactive/Dialog.vue'
4
+ import Button from '@/components/elements/Button.vue'
5
+
6
+ const meta: Meta<typeof Dialog> = {
7
+ title: 'Interactive/Dialog',
8
+ component: Dialog,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: 'Dialogコンポーネント',
14
+ },
15
+ },
16
+ },
17
+ argTypes: {
18
+ title: {
19
+ control: 'text',
20
+ },
21
+ visible: {
22
+ control: 'boolean',
23
+ },
24
+ scrollable: {
25
+ control: 'boolean',
26
+ },
27
+ type: {
28
+ control: 'select',
29
+ options: ['default', 'alert', 'confirm'],
30
+ },
31
+ persistent: {
32
+ control: 'boolean',
33
+ },
34
+ },
35
+ args: {
36
+ title: 'Title',
37
+ visible: false,
38
+ scrollable: true,
39
+ type: 'default',
40
+ persistent: false,
41
+ },
42
+ }
43
+
44
+ export default meta
45
+ type StoryArgs = DialogProps
46
+ type Story = StoryObj<StoryArgs>
47
+ type OverridesStory = Omit<Story, 'argTypes'> & {
48
+ argTypes?: Record<string, DialogProps>
49
+ }
50
+
51
+ export const 基本: OverridesStory = {
52
+ args: {},
53
+ argTypes: {},
54
+ render: (args) => ({
55
+ components: { 'rn-dialog': Dialog, 'rn-button': Button },
56
+ setup() {
57
+ const visible = ref(false)
58
+ const handleVisible = () => {
59
+ visible.value = !visible.value
60
+ }
61
+ return { args, visible, handleVisible }
62
+ },
63
+ template: /* html */ `
64
+ <div class='sb-canvas'>
65
+ <div style='height: 300px;'>
66
+ <rn-button @click="handleVisible">ダイアログを開く</rn-button>
67
+ <rn-dialog
68
+ :title=args.title
69
+ :visible="visible"
70
+ :scrollable=args.scrollable
71
+ :type=args.type
72
+ :persistent=args.persistent
73
+ @onChangeVisible=handleVisible
74
+ >
75
+ </rn-dialog>
76
+ </div>
77
+ </div>
78
+ `,
79
+ }),
80
+ }
81
+
82
+ export const 応用1: OverridesStory = {
83
+ args: {},
84
+ argTypes: {},
85
+ parameters: {
86
+ docs: {
87
+ description: {
88
+ story: 'header,body,footerあり',
89
+ },
90
+ },
91
+ },
92
+ render: (args) => ({
93
+ components: { 'rn-dialog': Dialog, 'rn-button': Button },
94
+ setup() {
95
+ const visible = ref(false)
96
+ const handleVisible = () => {
97
+ visible.value = !visible.value
98
+ }
99
+ return { args, visible, handleVisible }
100
+ },
101
+ template: /* html */ `
102
+ <div class='sb-canvas'>
103
+ <div style='height: 300px;'>
104
+ <rn-button @click="handleVisible">ダイアログを開く</rn-button>
105
+ <rn-dialog
106
+ :title=args.title
107
+ :visible="visible"
108
+ :scrollable=args.scrollable
109
+ :type=args.type
110
+ :persistent=args.persistent
111
+ @onChangeVisible=handleVisible
112
+ >
113
+ <template #header>
114
+ header
115
+ </template>
116
+ <template #body>
117
+ <p>「ではみなさんは、そういうふうに川だと言われたり、乳の流れたあとだと言われたりしていた、このぼんやりと白いものがほんとうは何かご承知ですか」先生は、黒板につるした大きな黒い星座の図の、上から下へ白くけぶった銀河帯のようなところを指しながら、みんなに問いをかけました。</p>
118
+ <p>カムパネルラが手をあげました。</p>
119
+ <p>それから四、五人手をあげました。</p>
120
+ <p>ジョバンニも手をあげようとして、急いでそのままやめました。</p>
121
+ </template>
122
+ <template #footer>
123
+ footer
124
+ </template>
125
+ </rn-dialog>
126
+ </div>
127
+ </div>
128
+ `,
129
+ }),
130
+ }
131
+
132
+ export const 応用2: OverridesStory = {
133
+ args: {},
134
+ argTypes: {},
135
+ parameters: {
136
+ docs: {
137
+ description: {
138
+ story: 'header内のleftContent,rightContentあり',
139
+ },
140
+ },
141
+ },
142
+ render: (args) => ({
143
+ components: { 'rn-dialog': Dialog, 'rn-button': Button },
144
+ setup() {
145
+ const visible = ref(false)
146
+ const handleVisible = () => {
147
+ visible.value = !visible.value
148
+ }
149
+ return { args, visible, handleVisible }
150
+ },
151
+ template: /* html */ `
152
+ <div class='sb-canvas'>
153
+ <div style='height: 300px;'>
154
+ <rn-button @click="handleVisible">ダイアログを開く</rn-button>
155
+ <rn-dialog
156
+ :title=args.title
157
+ :visible="visible"
158
+ :scrollable=args.scrollable
159
+ :type=args.type
160
+ :persistent=args.persistent
161
+ @onChangeVisible=handleVisible
162
+ >
163
+ <template #headerLeftItem>
164
+ left
165
+ </template>
166
+ <template #headerRightItem>
167
+ right
168
+ </template>
169
+ </rn-dialog>
170
+ </div>
171
+ </div>
172
+ `,
173
+ }),
174
+ }