@ouestfrance/sipa-bms-ui 8.22.1 → 8.22.3
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/dist/components/button/BmsButton.vue.d.ts +1 -1
- package/dist/components/button/BmsIconButton.vue.d.ts +1 -1
- package/dist/components/button/UiButton.vue.d.ts +1 -1
- package/dist/components/layout/BmsHeaderTitle.vue.d.ts +1 -1
- package/dist/components/navigation/BmsBreadcrumb.vue.d.ts +1 -1
- package/dist/components/navigation/BmsShortLinkMenu.vue.d.ts +2 -2
- package/dist/components/table/BmsPagination.vue.d.ts +2 -2
- package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
- package/dist/sipa-bms-ui.css +16 -16
- package/dist/sipa-bms-ui.es.js +3608 -3142
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +3608 -3142
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +18 -18
- package/src/components/button/BmsButton.stories.js +142 -3
- package/src/components/form/BmsChip.stories.js +104 -2
- package/src/components/form/BmsInputCheckboxCaptionGroup.stories.js +157 -2
- package/src/components/form/BmsInputCheckboxGroup.stories.js +119 -2
- package/src/components/form/BmsInputCode.stories.js +109 -2
- package/src/components/form/BmsInputFile.stories.js +110 -2
- package/src/components/form/BmsInputRadioCaptionGroup.stories.js +138 -2
- package/src/components/form/BmsInputRadioGroup.stories.js +120 -2
- package/src/components/form/BmsInputText.stories.js +269 -1
- package/src/components/form/BmsMultiSelect.vue +3 -1
- package/src/components/form/BmsSearch.stories.js +89 -2
- package/src/components/form/BmsSelect.stories.js +220 -2
- package/src/components/form/BmsSelect.vue +5 -3
- package/src/components/form/BmsTag.stories.js +119 -3
- package/src/components/form/BmsTextArea.stories.js +146 -2
- package/src/components/form/RawAutocomplete.vue +3 -1
- package/src/components/layout/BmsForm.stories.js +216 -0
- package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
- package/src/components/table/BmsTable.stories.js +247 -1
- package/src/documentation/button/secondaryButton.mdx +114 -3
- package/src/documentation/checkboxCaptionGroup.mdx +99 -0
- package/src/documentation/checkboxGroup.mdx +99 -0
- package/src/documentation/chip.mdx +85 -11
- package/src/documentation/inputCode.mdx +97 -0
- package/src/documentation/inputFile.mdx +90 -13
- package/src/documentation/inputText.mdx +183 -0
- package/src/documentation/layout/form.mdx +74 -0
- package/src/documentation/layout/headerTitle.mdx +124 -0
- package/src/documentation/layout/table.mdx +111 -0
- package/src/documentation/radioCaptionGroup.mdx +86 -19
- package/src/documentation/radioGroup.mdx +85 -18
- package/src/documentation/search.mdx +85 -13
- package/src/documentation/select.mdx +137 -16
- package/src/documentation/tag.mdx +91 -11
- package/src/documentation/textArea.mdx +126 -13
- package/src/documentation/fields_text.mdx +0 -31
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import BmsInputCode from '@/components/form/BmsInputCode.vue';
|
|
2
|
+
import { ref } from 'vue';
|
|
2
3
|
|
|
3
4
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
7
|
+
title: 'Composants/form/InputCode',
|
|
8
|
+
component: BmsInputCode,
|
|
6
9
|
parameters: {
|
|
7
10
|
docs: {
|
|
8
11
|
page: template,
|
|
9
12
|
},
|
|
10
13
|
},
|
|
11
|
-
title: 'Composants/form/InputCode',
|
|
12
|
-
component: BmsInputCode,
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const Template = (args) => ({
|
|
@@ -51,3 +52,109 @@ Disabled.args = {
|
|
|
51
52
|
<div></div>
|
|
52
53
|
<div></div>`,
|
|
53
54
|
};
|
|
55
|
+
|
|
56
|
+
// Simple template for documentation
|
|
57
|
+
const SimpleTemplate = (args) => ({
|
|
58
|
+
setup() {
|
|
59
|
+
const modelValue = ref(args.modelValue || '');
|
|
60
|
+
return { args, modelValue };
|
|
61
|
+
},
|
|
62
|
+
components: {
|
|
63
|
+
BmsInputCode,
|
|
64
|
+
},
|
|
65
|
+
template: `
|
|
66
|
+
<BmsInputCode v-bind="args" v-model="modelValue" />
|
|
67
|
+
`,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Playground with default values for documentation
|
|
71
|
+
export const PlaygroundInputCode = SimpleTemplate.bind({});
|
|
72
|
+
PlaygroundInputCode.parameters = { chromatic: { disable: true } };
|
|
73
|
+
PlaygroundInputCode.args = {
|
|
74
|
+
label: 'Code editor',
|
|
75
|
+
type: 'json',
|
|
76
|
+
modelValue: '{\n "key": "value"\n}',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Do: Input code with clear label
|
|
80
|
+
export const DoWithClearLabel = SimpleTemplate.bind({});
|
|
81
|
+
DoWithClearLabel.parameters = { chromatic: { disable: true } };
|
|
82
|
+
DoWithClearLabel.args = {
|
|
83
|
+
label: 'JSON Configuration',
|
|
84
|
+
type: 'json',
|
|
85
|
+
modelValue: '{\n "name": "example"\n}',
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// Do: Input code with HTML type
|
|
89
|
+
export const DoWithHtmlType = SimpleTemplate.bind({});
|
|
90
|
+
DoWithHtmlType.parameters = { chromatic: { disable: true } };
|
|
91
|
+
DoWithHtmlType.args = {
|
|
92
|
+
label: 'HTML Template',
|
|
93
|
+
type: 'html',
|
|
94
|
+
modelValue: '<div class="container">\n <p>Content</p>\n</div>',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Do: Input code with JSON type and validation
|
|
98
|
+
export const DoWithJsonType = SimpleTemplate.bind({});
|
|
99
|
+
DoWithJsonType.parameters = { chromatic: { disable: true } };
|
|
100
|
+
DoWithJsonType.args = {
|
|
101
|
+
label: 'Configuration JSON',
|
|
102
|
+
type: 'json',
|
|
103
|
+
modelValue: '{\n "setting": true,\n "value": 42\n}',
|
|
104
|
+
captions: ['JSON syntax is automatically validated'],
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Do: Input code with caption
|
|
108
|
+
export const DoWithCaption = SimpleTemplate.bind({});
|
|
109
|
+
DoWithCaption.parameters = { chromatic: { disable: true } };
|
|
110
|
+
DoWithCaption.args = {
|
|
111
|
+
label: 'Code snippet',
|
|
112
|
+
type: 'html',
|
|
113
|
+
modelValue: '<div>Example</div>',
|
|
114
|
+
captions: ['Enter valid HTML code'],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Do: Disabled state
|
|
118
|
+
export const DoDisabled = SimpleTemplate.bind({});
|
|
119
|
+
DoDisabled.parameters = { chromatic: { disable: true } };
|
|
120
|
+
DoDisabled.args = {
|
|
121
|
+
label: 'Read-only code',
|
|
122
|
+
type: 'json',
|
|
123
|
+
modelValue: '{\n "readonly": true\n}',
|
|
124
|
+
disabled: true,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Do: Input code with error feedback
|
|
128
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
129
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
130
|
+
DoWithErrorFeedback.args = {
|
|
131
|
+
label: 'JSON Configuration',
|
|
132
|
+
type: 'json',
|
|
133
|
+
modelValue: '{\n "invalid": json\n}',
|
|
134
|
+
errors: ['Invalid JSON syntax'],
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Don't: Missing labels
|
|
138
|
+
export const DontNoLabel = SimpleTemplate.bind({});
|
|
139
|
+
DontNoLabel.parameters = { chromatic: { disable: true } };
|
|
140
|
+
DontNoLabel.args = {
|
|
141
|
+
type: 'json',
|
|
142
|
+
modelValue: '{\n "key": "value"\n}',
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
146
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
147
|
+
DoWithLabel.args = {
|
|
148
|
+
label: 'Code editor',
|
|
149
|
+
type: 'json',
|
|
150
|
+
modelValue: '{\n "key": "value"\n}',
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// Don't: No error feedback
|
|
154
|
+
export const DontNoErrorFeedback = SimpleTemplate.bind({});
|
|
155
|
+
DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
156
|
+
DontNoErrorFeedback.args = {
|
|
157
|
+
label: 'JSON Configuration',
|
|
158
|
+
type: 'json',
|
|
159
|
+
modelValue: '{\n "invalid": syntax\n}',
|
|
160
|
+
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import BmsInputFile from './BmsInputFile.vue';
|
|
2
2
|
import { within } from 'storybook/test';
|
|
3
3
|
import { base64StringToBlob } from 'blob-util';
|
|
4
|
+
import { ref } from 'vue';
|
|
4
5
|
|
|
5
6
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
9
|
+
title: 'Composants/form/InputFile',
|
|
10
|
+
component: BmsInputFile,
|
|
8
11
|
parameters: {
|
|
9
12
|
docs: {
|
|
10
13
|
page: template,
|
|
11
14
|
},
|
|
12
15
|
},
|
|
13
|
-
title: 'Composants/form/InputFile',
|
|
14
|
-
component: BmsInputFile,
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
const Template = (args) => ({
|
|
@@ -157,3 +158,110 @@ WideWithImage.args = {
|
|
|
157
158
|
limit: 1,
|
|
158
159
|
wide: true,
|
|
159
160
|
};
|
|
161
|
+
|
|
162
|
+
// Simple template for documentation (without small variant)
|
|
163
|
+
const SimpleTemplate = (args) => ({
|
|
164
|
+
setup() {
|
|
165
|
+
const modelValue = ref(args.modelValue || []);
|
|
166
|
+
return { args, modelValue };
|
|
167
|
+
},
|
|
168
|
+
components: {
|
|
169
|
+
BmsInputFile,
|
|
170
|
+
},
|
|
171
|
+
template: `
|
|
172
|
+
<BmsInputFile v-bind="args" v-model="modelValue" />
|
|
173
|
+
`,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Playground with default values for documentation
|
|
177
|
+
export const PlaygroundInputFile = SimpleTemplate.bind({});
|
|
178
|
+
PlaygroundInputFile.parameters = { chromatic: { disable: true } };
|
|
179
|
+
PlaygroundInputFile.args = {
|
|
180
|
+
label: 'Upload file',
|
|
181
|
+
modelValue: [],
|
|
182
|
+
limit: 10,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Do: Input file with clear label
|
|
186
|
+
export const DoWithClearLabel = SimpleTemplate.bind({});
|
|
187
|
+
DoWithClearLabel.parameters = { chromatic: { disable: true } };
|
|
188
|
+
DoWithClearLabel.args = {
|
|
189
|
+
label: 'Upload document',
|
|
190
|
+
modelValue: [],
|
|
191
|
+
limit: 10,
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Do: Input file with caption
|
|
195
|
+
export const DoWithCaption = SimpleTemplate.bind({});
|
|
196
|
+
DoWithCaption.parameters = { chromatic: { disable: true } };
|
|
197
|
+
DoWithCaption.args = {
|
|
198
|
+
label: 'Upload image',
|
|
199
|
+
modelValue: [],
|
|
200
|
+
captions: ['Maximum file size: 10MB'],
|
|
201
|
+
limit: 10,
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// Do: Input file with accept filter
|
|
205
|
+
export const DoWithAcceptFilter = SimpleTemplate.bind({});
|
|
206
|
+
DoWithAcceptFilter.parameters = { chromatic: { disable: true } };
|
|
207
|
+
DoWithAcceptFilter.args = {
|
|
208
|
+
label: 'Upload image',
|
|
209
|
+
modelValue: [],
|
|
210
|
+
accept: 'image/*',
|
|
211
|
+
captions: ['Only image files are allowed'],
|
|
212
|
+
limit: 10,
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Do: Disabled state
|
|
216
|
+
export const DoDisabled = SimpleTemplate.bind({});
|
|
217
|
+
DoDisabled.parameters = { chromatic: { disable: true } };
|
|
218
|
+
DoDisabled.args = {
|
|
219
|
+
label: 'Upload file',
|
|
220
|
+
modelValue: [],
|
|
221
|
+
disabled: true,
|
|
222
|
+
limit: 10,
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// Do: Input file with error feedback
|
|
226
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
227
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
228
|
+
DoWithErrorFeedback.args = {
|
|
229
|
+
label: 'Upload file',
|
|
230
|
+
modelValue: [],
|
|
231
|
+
errors: ['Please upload a file'],
|
|
232
|
+
limit: 10,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// Don't: Missing label
|
|
236
|
+
export const DontNoLabel = SimpleTemplate.bind({});
|
|
237
|
+
DontNoLabel.parameters = { chromatic: { disable: true } };
|
|
238
|
+
DontNoLabel.args = {
|
|
239
|
+
modelValue: [],
|
|
240
|
+
limit: 10,
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
244
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
245
|
+
DoWithLabel.args = {
|
|
246
|
+
label: 'Upload file',
|
|
247
|
+
modelValue: [],
|
|
248
|
+
limit: 10,
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// Don't: No error feedback
|
|
252
|
+
export const DontNoErrorFeedback = SimpleTemplate.bind({});
|
|
253
|
+
DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
254
|
+
DontNoErrorFeedback.args = {
|
|
255
|
+
label: 'Upload file',
|
|
256
|
+
modelValue: [],
|
|
257
|
+
limit: 10,
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// Don't: No caption for file requirements
|
|
261
|
+
export const DontNoCaption = SimpleTemplate.bind({});
|
|
262
|
+
DontNoCaption.parameters = { chromatic: { disable: true } };
|
|
263
|
+
DontNoCaption.args = {
|
|
264
|
+
label: 'Upload file',
|
|
265
|
+
modelValue: [],
|
|
266
|
+
limit: 5,
|
|
267
|
+
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import BmsInputRadioCaptionGroup from '@/components/form/BmsInputRadioCaptionGroup.vue';
|
|
2
2
|
import BmsInputRadioCaption from '@/components/form/BmsInputRadioCaption.vue';
|
|
3
3
|
import { StatusType } from '@/models/status-type.model';
|
|
4
|
+
import { ref } from 'vue';
|
|
4
5
|
|
|
5
6
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
9
|
+
title: 'Composants/form/InputRadioCaptionGroup',
|
|
10
|
+
component: BmsInputRadioCaptionGroup,
|
|
8
11
|
parameters: {
|
|
9
12
|
docs: {
|
|
10
13
|
page: template,
|
|
11
14
|
},
|
|
12
15
|
},
|
|
13
|
-
title: 'Composants/form/InputRadioCaptionGroup',
|
|
14
|
-
component: BmsInputRadioCaptionGroup,
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
const Template = (args) => ({
|
|
@@ -164,3 +165,138 @@ Slot.args = {
|
|
|
164
165
|
label: 'This is a field label',
|
|
165
166
|
slot: true,
|
|
166
167
|
};
|
|
168
|
+
|
|
169
|
+
// Simple template for documentation
|
|
170
|
+
const SimpleTemplate = (args) => ({
|
|
171
|
+
setup() {
|
|
172
|
+
const modelValue = ref(args.modelValue || '');
|
|
173
|
+
return { args, modelValue };
|
|
174
|
+
},
|
|
175
|
+
components: {
|
|
176
|
+
BmsInputRadioCaptionGroup,
|
|
177
|
+
},
|
|
178
|
+
template: `
|
|
179
|
+
<BmsInputRadioCaptionGroup v-bind="args" v-model="modelValue" />
|
|
180
|
+
`,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Playground with default values for documentation
|
|
184
|
+
export const PlaygroundRadioCaptionGroup = SimpleTemplate.bind({});
|
|
185
|
+
PlaygroundRadioCaptionGroup.parameters = { chromatic: { disable: true } };
|
|
186
|
+
PlaygroundRadioCaptionGroup.args = {
|
|
187
|
+
label: 'Payment method',
|
|
188
|
+
modelValue: '',
|
|
189
|
+
options: [
|
|
190
|
+
{
|
|
191
|
+
value: 'credit',
|
|
192
|
+
label: 'Credit Card',
|
|
193
|
+
captions: ['Visa, Mastercard, Amex'],
|
|
194
|
+
},
|
|
195
|
+
{ value: 'paypal', label: 'PayPal', captions: ['Pay with PayPal account'] },
|
|
196
|
+
{
|
|
197
|
+
value: 'bank',
|
|
198
|
+
label: 'Bank Transfer',
|
|
199
|
+
captions: ['Direct bank transfer'],
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// Do: Radio caption group with clear labels
|
|
205
|
+
export const DoWithClearLabels = SimpleTemplate.bind({});
|
|
206
|
+
DoWithClearLabels.parameters = { chromatic: { disable: true } };
|
|
207
|
+
DoWithClearLabels.args = {
|
|
208
|
+
label: 'Subscription plan',
|
|
209
|
+
modelValue: '',
|
|
210
|
+
options: [
|
|
211
|
+
{ value: 'basic', label: 'Basic', captions: ['$9/month'] },
|
|
212
|
+
{ value: 'pro', label: 'Pro', captions: ['$29/month'] },
|
|
213
|
+
{ value: 'enterprise', label: 'Enterprise', captions: ['Custom pricing'] },
|
|
214
|
+
],
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// Do: Radio caption group with helpful captions
|
|
218
|
+
export const DoWithHelpfulCaptions = SimpleTemplate.bind({});
|
|
219
|
+
DoWithHelpfulCaptions.parameters = { chromatic: { disable: true } };
|
|
220
|
+
DoWithHelpfulCaptions.args = {
|
|
221
|
+
label: 'Delivery option',
|
|
222
|
+
modelValue: '',
|
|
223
|
+
options: [
|
|
224
|
+
{ value: 'standard', label: 'Standard', captions: ['5-7 business days'] },
|
|
225
|
+
{ value: 'express', label: 'Express', captions: ['2-3 business days'] },
|
|
226
|
+
{ value: 'overnight', label: 'Overnight', captions: ['Next business day'] },
|
|
227
|
+
],
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// Do: Radio caption group with error feedback
|
|
231
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
232
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
233
|
+
DoWithErrorFeedback.args = {
|
|
234
|
+
label: 'Payment method',
|
|
235
|
+
modelValue: '',
|
|
236
|
+
errors: ['Please select a payment method'],
|
|
237
|
+
options: [
|
|
238
|
+
{ value: 'credit', label: 'Credit Card', captions: ['Visa, Mastercard'] },
|
|
239
|
+
{ value: 'paypal', label: 'PayPal', captions: ['Pay with PayPal'] },
|
|
240
|
+
],
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
// Don't: Missing labels
|
|
244
|
+
export const DontNoLabel = SimpleTemplate.bind({});
|
|
245
|
+
DontNoLabel.parameters = { chromatic: { disable: true } };
|
|
246
|
+
DontNoLabel.args = {
|
|
247
|
+
modelValue: '',
|
|
248
|
+
options: [
|
|
249
|
+
{ value: 'option1', label: 'Option 1', captions: ['Description'] },
|
|
250
|
+
{ value: 'option2', label: 'Option 2', captions: ['Description'] },
|
|
251
|
+
],
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
255
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
256
|
+
DoWithLabel.args = {
|
|
257
|
+
label: 'Choose an option',
|
|
258
|
+
modelValue: '',
|
|
259
|
+
options: [
|
|
260
|
+
{ value: 'option1', label: 'Option 1', captions: ['Description'] },
|
|
261
|
+
{ value: 'option2', label: 'Option 2', captions: ['Description'] },
|
|
262
|
+
],
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// Don't: No captions when needed
|
|
266
|
+
export const DontNoCaptions = SimpleTemplate.bind({});
|
|
267
|
+
DontNoCaptions.parameters = { chromatic: { disable: true } };
|
|
268
|
+
DontNoCaptions.args = {
|
|
269
|
+
label: 'Subscription plan',
|
|
270
|
+
modelValue: '',
|
|
271
|
+
options: [
|
|
272
|
+
{ value: 'basic', label: 'Basic' },
|
|
273
|
+
{ value: 'pro', label: 'Pro' },
|
|
274
|
+
{ value: 'enterprise', label: 'Enterprise' },
|
|
275
|
+
],
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// Do: Radio caption group in column layout
|
|
279
|
+
export const DoWithColumnLayout = SimpleTemplate.bind({});
|
|
280
|
+
DoWithColumnLayout.parameters = { chromatic: { disable: true } };
|
|
281
|
+
DoWithColumnLayout.args = {
|
|
282
|
+
label: 'Delivery option',
|
|
283
|
+
modelValue: '',
|
|
284
|
+
align: 'column',
|
|
285
|
+
options: [
|
|
286
|
+
{
|
|
287
|
+
value: 'standard',
|
|
288
|
+
label: 'Standard Delivery',
|
|
289
|
+
captions: ['5-7 business days - Free'],
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
value: 'express',
|
|
293
|
+
label: 'Express Delivery',
|
|
294
|
+
captions: ['2-3 business days - $10'],
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
value: 'overnight',
|
|
298
|
+
label: 'Overnight Delivery',
|
|
299
|
+
captions: ['Next business day - $25'],
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import BmsInputRadioGroup from '@/components/form/BmsInputRadioGroup.vue';
|
|
2
2
|
import BmsInputRadio from '@/components/form/BmsInputRadio.vue';
|
|
3
3
|
import { StatusType } from '@/models/status-type.model';
|
|
4
|
+
import { ref } from 'vue';
|
|
4
5
|
|
|
5
6
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
9
|
+
title: 'Composants/form/InputRadioGroup',
|
|
10
|
+
component: BmsInputRadioGroup,
|
|
8
11
|
parameters: {
|
|
9
12
|
docs: {
|
|
10
13
|
page: template,
|
|
11
14
|
},
|
|
12
15
|
},
|
|
13
|
-
title: 'Composants/form/InputRadioGroup',
|
|
14
|
-
component: BmsInputRadioGroup,
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
const Template = (args) => ({
|
|
@@ -118,3 +119,120 @@ Slot.args = {
|
|
|
118
119
|
label: 'This is a field label',
|
|
119
120
|
slot: true,
|
|
120
121
|
};
|
|
122
|
+
|
|
123
|
+
// Simple template for documentation
|
|
124
|
+
const SimpleTemplate = (args) => ({
|
|
125
|
+
setup() {
|
|
126
|
+
const modelValue = ref(args.modelValue || '');
|
|
127
|
+
return { args, modelValue };
|
|
128
|
+
},
|
|
129
|
+
components: {
|
|
130
|
+
BmsInputRadioGroup,
|
|
131
|
+
},
|
|
132
|
+
template: `
|
|
133
|
+
<BmsInputRadioGroup v-bind="args" v-model="modelValue" />
|
|
134
|
+
`,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Playground with default values for documentation
|
|
138
|
+
export const PlaygroundRadioGroup = SimpleTemplate.bind({});
|
|
139
|
+
PlaygroundRadioGroup.parameters = { chromatic: { disable: true } };
|
|
140
|
+
PlaygroundRadioGroup.args = {
|
|
141
|
+
label: 'Gender',
|
|
142
|
+
modelValue: '',
|
|
143
|
+
values: [
|
|
144
|
+
{ value: 'male', label: 'Male' },
|
|
145
|
+
{ value: 'female', label: 'Female' },
|
|
146
|
+
{ value: 'other', label: 'Other' },
|
|
147
|
+
],
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// Do: Radio group with clear labels
|
|
151
|
+
export const DoWithClearLabels = SimpleTemplate.bind({});
|
|
152
|
+
DoWithClearLabels.parameters = { chromatic: { disable: true } };
|
|
153
|
+
DoWithClearLabels.args = {
|
|
154
|
+
label: 'Notification preference',
|
|
155
|
+
modelValue: '',
|
|
156
|
+
values: [
|
|
157
|
+
{ value: 'email', label: 'Email' },
|
|
158
|
+
{ value: 'sms', label: 'SMS' },
|
|
159
|
+
{ value: 'push', label: 'Push notifications' },
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Do: Radio group with caption
|
|
164
|
+
export const DoWithCaption = SimpleTemplate.bind({});
|
|
165
|
+
DoWithCaption.parameters = { chromatic: { disable: true } };
|
|
166
|
+
DoWithCaption.args = {
|
|
167
|
+
label: 'Account type',
|
|
168
|
+
modelValue: '',
|
|
169
|
+
captions: ['Select the type of account you want to create'],
|
|
170
|
+
values: [
|
|
171
|
+
{ value: 'personal', label: 'Personal' },
|
|
172
|
+
{ value: 'business', label: 'Business' },
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// Do: Radio group with error feedback
|
|
177
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
178
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
179
|
+
DoWithErrorFeedback.args = {
|
|
180
|
+
label: 'Gender',
|
|
181
|
+
modelValue: '',
|
|
182
|
+
errors: ['Please select a gender'],
|
|
183
|
+
values: [
|
|
184
|
+
{ value: 'male', label: 'Male' },
|
|
185
|
+
{ value: 'female', label: 'Female' },
|
|
186
|
+
{ value: 'other', label: 'Other' },
|
|
187
|
+
],
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// Don't: Missing labels
|
|
191
|
+
export const DontNoLabel = SimpleTemplate.bind({});
|
|
192
|
+
DontNoLabel.parameters = { chromatic: { disable: true } };
|
|
193
|
+
DontNoLabel.args = {
|
|
194
|
+
modelValue: '',
|
|
195
|
+
values: [
|
|
196
|
+
{ value: 'option1', label: 'Option 1' },
|
|
197
|
+
{ value: 'option2', label: 'Option 2' },
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
202
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
203
|
+
DoWithLabel.args = {
|
|
204
|
+
label: 'Choose an option',
|
|
205
|
+
modelValue: '',
|
|
206
|
+
values: [
|
|
207
|
+
{ value: 'option1', label: 'Option 1' },
|
|
208
|
+
{ value: 'option2', label: 'Option 2' },
|
|
209
|
+
],
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// Don't: No error feedback
|
|
213
|
+
export const DontNoErrorFeedback = SimpleTemplate.bind({});
|
|
214
|
+
DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
215
|
+
DontNoErrorFeedback.args = {
|
|
216
|
+
label: 'Gender',
|
|
217
|
+
modelValue: '',
|
|
218
|
+
values: [
|
|
219
|
+
{ value: 'male', label: 'Male' },
|
|
220
|
+
{ value: 'female', label: 'Female' },
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// Do: Radio group in column layout
|
|
225
|
+
export const DoWithColumnLayout = SimpleTemplate.bind({});
|
|
226
|
+
DoWithColumnLayout.parameters = { chromatic: { disable: true } };
|
|
227
|
+
DoWithColumnLayout.args = {
|
|
228
|
+
label: 'Notification preference',
|
|
229
|
+
modelValue: '',
|
|
230
|
+
align: 'column',
|
|
231
|
+
captions: ['Choose how you want to receive notifications'],
|
|
232
|
+
values: [
|
|
233
|
+
{ value: 'email', label: 'Email notifications' },
|
|
234
|
+
{ value: 'sms', label: 'SMS notifications' },
|
|
235
|
+
{ value: 'push', label: 'Push notifications' },
|
|
236
|
+
{ value: 'none', label: 'No notifications' },
|
|
237
|
+
],
|
|
238
|
+
};
|