@ouestfrance/sipa-bms-ui 8.22.2 → 8.23.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/dist/components/button/BmsButton.vue.d.ts +1 -1
- package/dist/components/button/BmsIconButton.vue.d.ts +1 -1
- package/dist/components/button/BmsToggleIcon.vue.d.ts +24 -0
- package/dist/components/button/UiButton.vue.d.ts +1 -1
- package/dist/components/form/BmsInputText.vue.d.ts +1 -1
- package/dist/components/form/BmsSearch.vue.d.ts +3 -3
- package/dist/components/form/BmsSelect.vue.d.ts +1 -1
- package/dist/components/form/RawSelect.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/navigation/UiTenantSwitcher.vue.d.ts +3 -3
- package/dist/components/table/BmsPagination.vue.d.ts +4 -2
- package/dist/components/table/BmsServerTable.vue.d.ts +3 -3
- package/dist/components/table/BmsTable.vue.d.ts +3 -3
- package/dist/components/table/BmsTableFilters.vue.d.ts +5 -3
- package/dist/components/table/UiBmsTable.vue.d.ts +3 -3
- package/dist/components/table/UiFilterButton.vue.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/models/table.model.d.ts +5 -0
- package/dist/plugins/field/FieldComponent.vue.d.ts +1 -1
- package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
- package/dist/showroom/pages/table.vue.d.ts +2 -0
- package/dist/sipa-bms-ui.css +167 -103
- package/dist/sipa-bms-ui.es.js +3838 -3301
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +3842 -3303
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +19 -19
- package/src/components/button/BmsButton.stories.js +142 -3
- package/src/components/button/BmsToggleIcon.stories.js +145 -0
- package/src/components/button/BmsToggleIcon.vue +108 -0
- 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/BmsInputNumber.stories.js +12 -2
- package/src/components/form/BmsInputNumber.vue +2 -1
- 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 +278 -1
- package/src/components/form/BmsInputText.vue +2 -0
- 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/BmsFloatingWindow.vue +12 -1
- package/src/components/layout/BmsForm.stories.js +216 -0
- package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
- package/src/components/layout/BmsSplitWindow.vue +1 -1
- package/src/components/table/BmsPagination.vue +3 -0
- package/src/components/table/BmsServerTable.stories.js +59 -3
- package/src/components/table/BmsServerTable.vue +9 -2
- package/src/components/table/BmsTable.stories.js +312 -2
- package/src/components/table/BmsTable.vue +14 -3
- package/src/components/table/BmsTableFilters.vue +15 -5
- package/src/components/table/UiBmsTable.stories.js +3 -0
- package/src/components/table/UiBmsTable.vue +14 -5
- package/src/components/table/UiFilterButton.vue +6 -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/index.ts +3 -0
- package/src/models/table.model.ts +6 -0
- package/src/showroom/pages/floating-window.vue +36 -0
- package/src/documentation/fields_text.mdx +0 -31
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import BmsSearch from '@/components/form/BmsSearch.vue';
|
|
2
2
|
import { within } from 'storybook/test';
|
|
3
|
+
import { ref } from 'vue';
|
|
3
4
|
|
|
4
5
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
8
|
+
title: 'Composants/form/Search',
|
|
9
|
+
component: BmsSearch,
|
|
7
10
|
parameters: {
|
|
8
11
|
docs: {
|
|
9
12
|
page: template,
|
|
10
13
|
},
|
|
11
14
|
},
|
|
12
|
-
title: 'Composants/form/Search',
|
|
13
|
-
component: BmsSearch,
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const Template = (args) => ({
|
|
@@ -70,3 +71,89 @@ export const WithFocusState = {
|
|
|
70
71
|
await canvas.getByRole('input').focus();
|
|
71
72
|
},
|
|
72
73
|
};
|
|
74
|
+
|
|
75
|
+
// Simple template for documentation (without small variant)
|
|
76
|
+
const SimpleTemplate = (args) => ({
|
|
77
|
+
setup() {
|
|
78
|
+
const modelValue = ref(args.modelValue || '');
|
|
79
|
+
return { args, modelValue };
|
|
80
|
+
},
|
|
81
|
+
components: {
|
|
82
|
+
BmsSearch,
|
|
83
|
+
},
|
|
84
|
+
template: `
|
|
85
|
+
<BmsSearch v-bind="args" v-model="modelValue" />
|
|
86
|
+
`,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Playground with default values for documentation
|
|
90
|
+
export const PlaygroundSearch = SimpleTemplate.bind({});
|
|
91
|
+
PlaygroundSearch.parameters = { chromatic: { disable: true } };
|
|
92
|
+
PlaygroundSearch.args = {
|
|
93
|
+
placeholder: 'Search...',
|
|
94
|
+
modelValue: '',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Do: Search with clear placeholder
|
|
98
|
+
export const DoWithClearPlaceholder = SimpleTemplate.bind({});
|
|
99
|
+
DoWithClearPlaceholder.parameters = { chromatic: { disable: true } };
|
|
100
|
+
DoWithClearPlaceholder.args = {
|
|
101
|
+
placeholder: 'Search products...',
|
|
102
|
+
modelValue: '',
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Do: Search with value and clear button
|
|
106
|
+
export const DoWithValue = SimpleTemplate.bind({});
|
|
107
|
+
DoWithValue.parameters = { chromatic: { disable: true } };
|
|
108
|
+
DoWithValue.args = {
|
|
109
|
+
placeholder: 'Search...',
|
|
110
|
+
modelValue: 'search term',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Do: Disabled state
|
|
114
|
+
export const DoDisabled = SimpleTemplate.bind({});
|
|
115
|
+
DoDisabled.parameters = { chromatic: { disable: true } };
|
|
116
|
+
DoDisabled.args = {
|
|
117
|
+
placeholder: 'Search...',
|
|
118
|
+
modelValue: 'search term',
|
|
119
|
+
disabled: true,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Do: Search with error feedback
|
|
123
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
124
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
125
|
+
DoWithErrorFeedback.args = {
|
|
126
|
+
placeholder: 'Search...',
|
|
127
|
+
modelValue: 'invalid search',
|
|
128
|
+
errors: ['Search query is too short'],
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// Don't: Generic placeholder
|
|
132
|
+
export const DontGenericPlaceholder = SimpleTemplate.bind({});
|
|
133
|
+
DontGenericPlaceholder.parameters = { chromatic: { disable: true } };
|
|
134
|
+
DontGenericPlaceholder.args = {
|
|
135
|
+
placeholder: 'Type here',
|
|
136
|
+
modelValue: '',
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const DoSpecificPlaceholder = SimpleTemplate.bind({});
|
|
140
|
+
DoSpecificPlaceholder.parameters = { chromatic: { disable: true } };
|
|
141
|
+
DoSpecificPlaceholder.args = {
|
|
142
|
+
placeholder: 'Search by name, email, or ID...',
|
|
143
|
+
modelValue: '',
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Don't: No error feedback
|
|
147
|
+
export const DontNoErrorFeedback = SimpleTemplate.bind({});
|
|
148
|
+
DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
149
|
+
DontNoErrorFeedback.args = {
|
|
150
|
+
placeholder: 'Search...',
|
|
151
|
+
modelValue: 'invalid',
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Don't: Search without placeholder
|
|
155
|
+
export const DontNoPlaceholder = SimpleTemplate.bind({});
|
|
156
|
+
DontNoPlaceholder.parameters = { chromatic: { disable: true } };
|
|
157
|
+
DontNoPlaceholder.args = {
|
|
158
|
+
modelValue: '',
|
|
159
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import BmsSelect from '@/components/form/BmsSelect.vue';
|
|
2
2
|
import { within } from 'storybook/test';
|
|
3
|
+
import { ref } from 'vue';
|
|
3
4
|
|
|
4
5
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
8
|
+
title: 'Composants/form/Select',
|
|
9
|
+
component: BmsSelect,
|
|
7
10
|
parameters: {
|
|
8
11
|
docs: {
|
|
9
12
|
page: template,
|
|
10
13
|
},
|
|
11
14
|
},
|
|
12
|
-
title: 'Composants/form/Select',
|
|
13
|
-
component: BmsSelect,
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const Template = (args) => ({
|
|
@@ -141,3 +142,220 @@ WithIncorrectValue.args = {
|
|
|
141
142
|
{ label: 'c', value: 'c' },
|
|
142
143
|
],
|
|
143
144
|
};
|
|
145
|
+
|
|
146
|
+
// Simple template for documentation (without small variant)
|
|
147
|
+
const SimpleTemplate = (args) => ({
|
|
148
|
+
setup() {
|
|
149
|
+
const modelValue = ref(args.modelValue || '');
|
|
150
|
+
return { args, modelValue };
|
|
151
|
+
},
|
|
152
|
+
components: {
|
|
153
|
+
BmsSelect,
|
|
154
|
+
},
|
|
155
|
+
template: `
|
|
156
|
+
<BmsSelect v-bind="args" v-model="modelValue" />
|
|
157
|
+
`,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Playground with default values for documentation
|
|
161
|
+
export const PlaygroundSelect = SimpleTemplate.bind({});
|
|
162
|
+
PlaygroundSelect.parameters = { chromatic: { disable: true } };
|
|
163
|
+
PlaygroundSelect.args = {
|
|
164
|
+
label: 'Country',
|
|
165
|
+
placeholder: 'Select a country',
|
|
166
|
+
modelValue: '',
|
|
167
|
+
options: [
|
|
168
|
+
{ label: 'France', value: 'fr' },
|
|
169
|
+
{ label: 'Germany', value: 'de' },
|
|
170
|
+
{ label: 'Spain', value: 'es' },
|
|
171
|
+
{ label: 'Italy', value: 'it' },
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// Do: Simple select with label
|
|
176
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
177
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
178
|
+
DoWithLabel.args = {
|
|
179
|
+
label: 'Country',
|
|
180
|
+
modelValue: '',
|
|
181
|
+
options: [
|
|
182
|
+
{ label: 'France', value: 'fr' },
|
|
183
|
+
{ label: 'Germany', value: 'de' },
|
|
184
|
+
{ label: 'Spain', value: 'es' },
|
|
185
|
+
],
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Do: Select with placeholder
|
|
189
|
+
export const DoWithPlaceholder = SimpleTemplate.bind({});
|
|
190
|
+
DoWithPlaceholder.parameters = { chromatic: { disable: true } };
|
|
191
|
+
DoWithPlaceholder.args = {
|
|
192
|
+
label: 'Country',
|
|
193
|
+
placeholder: 'Choose your country',
|
|
194
|
+
modelValue: '',
|
|
195
|
+
options: [
|
|
196
|
+
{ label: 'France', value: 'fr' },
|
|
197
|
+
{ label: 'Germany', value: 'de' },
|
|
198
|
+
{ label: 'Spain', value: 'es' },
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// Do: Select with caption
|
|
203
|
+
export const DoWithCaption = SimpleTemplate.bind({});
|
|
204
|
+
DoWithCaption.parameters = { chromatic: { disable: true } };
|
|
205
|
+
DoWithCaption.args = {
|
|
206
|
+
label: 'Payment method',
|
|
207
|
+
placeholder: 'Select payment method',
|
|
208
|
+
modelValue: '',
|
|
209
|
+
captions: ['We accept all major credit cards'],
|
|
210
|
+
options: [
|
|
211
|
+
{ label: 'Credit Card', value: 'cc' },
|
|
212
|
+
{ label: 'PayPal', value: 'pp' },
|
|
213
|
+
{ label: 'Bank Transfer', value: 'bt' },
|
|
214
|
+
],
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// Do: Disabled state
|
|
218
|
+
export const DoDisabled = SimpleTemplate.bind({});
|
|
219
|
+
DoDisabled.parameters = { chromatic: { disable: true } };
|
|
220
|
+
DoDisabled.args = {
|
|
221
|
+
label: 'Country',
|
|
222
|
+
modelValue: 'fr',
|
|
223
|
+
disabled: true,
|
|
224
|
+
options: [
|
|
225
|
+
{ label: 'France', value: 'fr' },
|
|
226
|
+
{ label: 'Germany', value: 'de' },
|
|
227
|
+
{ label: 'Spain', value: 'es' },
|
|
228
|
+
],
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// Do: Loading state
|
|
232
|
+
export const DoLoading = SimpleTemplate.bind({});
|
|
233
|
+
DoLoading.parameters = { chromatic: { disable: true } };
|
|
234
|
+
DoLoading.args = {
|
|
235
|
+
label: 'Country',
|
|
236
|
+
placeholder: 'Loading...',
|
|
237
|
+
loading: true,
|
|
238
|
+
modelValue: '',
|
|
239
|
+
options: [],
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// Do: Select with error feedback
|
|
243
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
244
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
245
|
+
DoWithErrorFeedback.args = {
|
|
246
|
+
label: 'Country',
|
|
247
|
+
placeholder: 'Select a country',
|
|
248
|
+
modelValue: '',
|
|
249
|
+
errors: ['Please select a country'],
|
|
250
|
+
options: [
|
|
251
|
+
{ label: 'France', value: 'fr' },
|
|
252
|
+
{ label: 'Germany', value: 'de' },
|
|
253
|
+
{ label: 'Spain', value: 'es' },
|
|
254
|
+
],
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// Do: Select with helpful caption
|
|
258
|
+
export const DoWithHelpfulCaption = SimpleTemplate.bind({});
|
|
259
|
+
DoWithHelpfulCaption.parameters = { chromatic: { disable: true } };
|
|
260
|
+
DoWithHelpfulCaption.args = {
|
|
261
|
+
label: 'Payment method',
|
|
262
|
+
placeholder: 'Select payment method',
|
|
263
|
+
modelValue: '',
|
|
264
|
+
captions: ['Select your preferred payment method to proceed'],
|
|
265
|
+
errors: ['Payment method is required'],
|
|
266
|
+
options: [
|
|
267
|
+
{ label: 'Credit Card', value: 'cc' },
|
|
268
|
+
{ label: 'PayPal', value: 'pp' },
|
|
269
|
+
{ label: 'Bank Transfer', value: 'bt' },
|
|
270
|
+
],
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
// Don't: Long labels
|
|
274
|
+
export const DontLongLabel = SimpleTemplate.bind({});
|
|
275
|
+
DontLongLabel.parameters = { chromatic: { disable: true } };
|
|
276
|
+
DontLongLabel.args = {
|
|
277
|
+
label:
|
|
278
|
+
'Please select the country where you currently reside and where you would like to receive your shipment',
|
|
279
|
+
placeholder: 'Country',
|
|
280
|
+
modelValue: '',
|
|
281
|
+
options: [
|
|
282
|
+
{ label: 'France', value: 'fr' },
|
|
283
|
+
{ label: 'Germany', value: 'de' },
|
|
284
|
+
],
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export const DoShortLabel = SimpleTemplate.bind({});
|
|
288
|
+
DoShortLabel.parameters = { chromatic: { disable: true } };
|
|
289
|
+
DoShortLabel.args = {
|
|
290
|
+
label: 'Country',
|
|
291
|
+
placeholder: 'Select country',
|
|
292
|
+
modelValue: '',
|
|
293
|
+
options: [
|
|
294
|
+
{ label: 'France', value: 'fr' },
|
|
295
|
+
{ label: 'Germany', value: 'de' },
|
|
296
|
+
],
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// Don't: No label
|
|
300
|
+
export const DontNoLabel = SimpleTemplate.bind({});
|
|
301
|
+
DontNoLabel.parameters = { chromatic: { disable: true } };
|
|
302
|
+
DontNoLabel.args = {
|
|
303
|
+
placeholder: 'Select an option',
|
|
304
|
+
modelValue: '',
|
|
305
|
+
options: [
|
|
306
|
+
{ label: 'Option 1', value: '1' },
|
|
307
|
+
{ label: 'Option 2', value: '2' },
|
|
308
|
+
],
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// Don't: Generic placeholder
|
|
312
|
+
export const DontGenericPlaceholder = SimpleTemplate.bind({});
|
|
313
|
+
DontGenericPlaceholder.parameters = { chromatic: { disable: true } };
|
|
314
|
+
DontGenericPlaceholder.args = {
|
|
315
|
+
label: 'Country',
|
|
316
|
+
placeholder: 'Select',
|
|
317
|
+
modelValue: '',
|
|
318
|
+
options: [
|
|
319
|
+
{ label: 'France', value: 'fr' },
|
|
320
|
+
{ label: 'Germany', value: 'de' },
|
|
321
|
+
],
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export const DoSpecificPlaceholder = SimpleTemplate.bind({});
|
|
325
|
+
DoSpecificPlaceholder.parameters = { chromatic: { disable: true } };
|
|
326
|
+
DoSpecificPlaceholder.args = {
|
|
327
|
+
label: 'Country',
|
|
328
|
+
placeholder: 'Choose your country',
|
|
329
|
+
modelValue: '',
|
|
330
|
+
options: [
|
|
331
|
+
{ label: 'France', value: 'fr' },
|
|
332
|
+
{ label: 'Germany', value: 'de' },
|
|
333
|
+
],
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// Don't: No error feedback
|
|
337
|
+
export const DontNoErrorFeedback = SimpleTemplate.bind({});
|
|
338
|
+
DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
339
|
+
DontNoErrorFeedback.args = {
|
|
340
|
+
label: 'Country',
|
|
341
|
+
placeholder: 'Select a country',
|
|
342
|
+
modelValue: '',
|
|
343
|
+
options: [
|
|
344
|
+
{ label: 'France', value: 'fr' },
|
|
345
|
+
{ label: 'Germany', value: 'de' },
|
|
346
|
+
],
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
// Don't: No caption for complex requirements
|
|
350
|
+
export const DontNoCaption = SimpleTemplate.bind({});
|
|
351
|
+
DontNoCaption.parameters = { chromatic: { disable: true } };
|
|
352
|
+
DontNoCaption.args = {
|
|
353
|
+
label: 'Payment method',
|
|
354
|
+
placeholder: 'Select payment method',
|
|
355
|
+
modelValue: '',
|
|
356
|
+
errors: ['Error'],
|
|
357
|
+
options: [
|
|
358
|
+
{ label: 'Credit Card', value: 'cc' },
|
|
359
|
+
{ label: 'PayPal', value: 'pp' },
|
|
360
|
+
],
|
|
361
|
+
};
|
|
@@ -96,9 +96,11 @@ const onSelect = (option: any) => {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
const onSelectClick = () => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
if (!props.disabled) {
|
|
100
|
+
isDatalistOpen.value = !isDatalistOpen.value;
|
|
101
|
+
if (isDatalistOpen) {
|
|
102
|
+
setFocus();
|
|
103
|
+
}
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import BmsTag from '@/components/form/BmsTag.vue';
|
|
2
|
-
import { Activity, Trash } from 'lucide-vue-next';
|
|
2
|
+
import { Activity, Trash, X } from 'lucide-vue-next';
|
|
3
3
|
|
|
4
4
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
+
title: 'Composants/form/Tag',
|
|
8
|
+
component: BmsTag,
|
|
7
9
|
parameters: {
|
|
8
10
|
docs: {
|
|
9
11
|
page: template,
|
|
10
12
|
},
|
|
11
13
|
},
|
|
12
|
-
title: 'Composants/form/Tag',
|
|
13
|
-
component: BmsTag,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const Template = (args) => ({
|
|
@@ -71,3 +71,119 @@ export const CantBeDismissed = Template.bind({});
|
|
|
71
71
|
CantBeDismissed.args = {
|
|
72
72
|
canBeDismissed: false,
|
|
73
73
|
};
|
|
74
|
+
|
|
75
|
+
// Simple template for documentation (without small variant)
|
|
76
|
+
const SimpleTemplate = (args) => ({
|
|
77
|
+
setup() {
|
|
78
|
+
return { args };
|
|
79
|
+
},
|
|
80
|
+
components: {
|
|
81
|
+
BmsTag,
|
|
82
|
+
Activity,
|
|
83
|
+
X,
|
|
84
|
+
},
|
|
85
|
+
template: `
|
|
86
|
+
<BmsTag v-bind="args">
|
|
87
|
+
{{ args.content || 'Tag' }}
|
|
88
|
+
</BmsTag>
|
|
89
|
+
`,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Playground with default values for documentation
|
|
93
|
+
export const PlaygroundTag = SimpleTemplate.bind({});
|
|
94
|
+
PlaygroundTag.parameters = { chromatic: { disable: true } };
|
|
95
|
+
PlaygroundTag.args = {
|
|
96
|
+
content: 'Filter',
|
|
97
|
+
active: false,
|
|
98
|
+
canBeDismissed: true,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Do: Tag with clear content
|
|
102
|
+
export const DoWithClearContent = SimpleTemplate.bind({});
|
|
103
|
+
DoWithClearContent.parameters = { chromatic: { disable: true } };
|
|
104
|
+
DoWithClearContent.args = {
|
|
105
|
+
content: 'Active',
|
|
106
|
+
active: true,
|
|
107
|
+
canBeDismissed: true,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Do: Tag with dismissible option
|
|
111
|
+
export const DoWithDismissible = SimpleTemplate.bind({});
|
|
112
|
+
DoWithDismissible.parameters = { chromatic: { disable: true } };
|
|
113
|
+
DoWithDismissible.args = {
|
|
114
|
+
content: 'Filter',
|
|
115
|
+
active: false,
|
|
116
|
+
canBeDismissed: true,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Do: Tag with active state
|
|
120
|
+
export const DoWithActiveState = SimpleTemplate.bind({});
|
|
121
|
+
DoWithActiveState.parameters = { chromatic: { disable: true } };
|
|
122
|
+
DoWithActiveState.args = {
|
|
123
|
+
content: 'Selected',
|
|
124
|
+
active: true,
|
|
125
|
+
canBeDismissed: true,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// Do: Tag with disabled state
|
|
129
|
+
export const DoWithDisabledState = SimpleTemplate.bind({});
|
|
130
|
+
DoWithDisabledState.parameters = { chromatic: { disable: true } };
|
|
131
|
+
DoWithDisabledState.args = {
|
|
132
|
+
content: 'Locked',
|
|
133
|
+
active: false,
|
|
134
|
+
disabled: true,
|
|
135
|
+
canBeDismissed: false,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// Do: Tag with short content
|
|
139
|
+
export const DoWithShortContent = SimpleTemplate.bind({});
|
|
140
|
+
DoWithShortContent.parameters = { chromatic: { disable: true } };
|
|
141
|
+
DoWithShortContent.args = {
|
|
142
|
+
content: 'New',
|
|
143
|
+
active: false,
|
|
144
|
+
canBeDismissed: true,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Don't: Tag with too long content
|
|
148
|
+
export const DontLongContent = SimpleTemplate.bind({});
|
|
149
|
+
DontLongContent.parameters = { chromatic: { disable: true } };
|
|
150
|
+
DontLongContent.args = {
|
|
151
|
+
content:
|
|
152
|
+
'This is a very long tag content that should not be used because it makes the tag difficult to read and breaks the layout',
|
|
153
|
+
active: false,
|
|
154
|
+
canBeDismissed: true,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Don't: Tag with empty or unclear content
|
|
158
|
+
export const DontEmptyContent = SimpleTemplate.bind({});
|
|
159
|
+
DontEmptyContent.parameters = { chromatic: { disable: true } };
|
|
160
|
+
DontEmptyContent.args = {
|
|
161
|
+
content: '',
|
|
162
|
+
active: false,
|
|
163
|
+
canBeDismissed: true,
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const DoClearContent = SimpleTemplate.bind({});
|
|
167
|
+
DoClearContent.parameters = { chromatic: { disable: true } };
|
|
168
|
+
DoClearContent.args = {
|
|
169
|
+
content: 'Filter',
|
|
170
|
+
active: false,
|
|
171
|
+
canBeDismissed: true,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Don't: Tag that cannot be dismissed when it should
|
|
175
|
+
export const DontCantDismissWhenNeeded = SimpleTemplate.bind({});
|
|
176
|
+
DontCantDismissWhenNeeded.parameters = { chromatic: { disable: true } };
|
|
177
|
+
DontCantDismissWhenNeeded.args = {
|
|
178
|
+
content: 'Temporary filter',
|
|
179
|
+
active: false,
|
|
180
|
+
canBeDismissed: false,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const DoCanDismiss = SimpleTemplate.bind({});
|
|
184
|
+
DoCanDismiss.parameters = { chromatic: { disable: true } };
|
|
185
|
+
DoCanDismiss.args = {
|
|
186
|
+
content: 'Temporary filter',
|
|
187
|
+
active: false,
|
|
188
|
+
canBeDismissed: true,
|
|
189
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import BmsTextArea from '@/components/form/BmsTextArea.vue';
|
|
2
2
|
import { within } from 'storybook/test';
|
|
3
|
+
import { ref } from 'vue';
|
|
3
4
|
|
|
4
5
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
8
|
+
title: 'Composants/form/TextArea',
|
|
9
|
+
component: BmsTextArea,
|
|
7
10
|
parameters: {
|
|
8
11
|
docs: {
|
|
9
12
|
page: template,
|
|
10
13
|
},
|
|
11
14
|
},
|
|
12
|
-
title: 'Composants/form/TextArea',
|
|
13
|
-
component: BmsTextArea,
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const Template = (args) => ({
|
|
@@ -74,3 +75,146 @@ export const WithFocusState = {
|
|
|
74
75
|
await canvas.getByRole('input').focus();
|
|
75
76
|
},
|
|
76
77
|
};
|
|
78
|
+
|
|
79
|
+
// Simple template for documentation (without small variant)
|
|
80
|
+
const SimpleTemplate = (args) => ({
|
|
81
|
+
setup() {
|
|
82
|
+
const modelValue = ref(args.modelValue || '');
|
|
83
|
+
return { args, modelValue };
|
|
84
|
+
},
|
|
85
|
+
components: {
|
|
86
|
+
BmsTextArea,
|
|
87
|
+
},
|
|
88
|
+
template: `
|
|
89
|
+
<BmsTextArea v-bind="args" v-model="modelValue" />
|
|
90
|
+
`,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Playground with default values for documentation
|
|
94
|
+
export const PlaygroundTextArea = SimpleTemplate.bind({});
|
|
95
|
+
PlaygroundTextArea.parameters = { chromatic: { disable: true } };
|
|
96
|
+
PlaygroundTextArea.args = {
|
|
97
|
+
label: 'Description',
|
|
98
|
+
placeholder: 'Enter your description here...',
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Do: Simple textarea with label
|
|
102
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
103
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
104
|
+
DoWithLabel.args = {
|
|
105
|
+
label: 'Comments',
|
|
106
|
+
placeholder: 'Enter your comments',
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Do: Textarea with placeholder
|
|
110
|
+
export const DoWithPlaceholder = SimpleTemplate.bind({});
|
|
111
|
+
DoWithPlaceholder.parameters = { chromatic: { disable: true } };
|
|
112
|
+
DoWithPlaceholder.args = {
|
|
113
|
+
label: 'Description',
|
|
114
|
+
placeholder: 'Describe your project in detail...',
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Do: Textarea with caption
|
|
118
|
+
export const DoWithCaption = SimpleTemplate.bind({});
|
|
119
|
+
DoWithCaption.parameters = { chromatic: { disable: true } };
|
|
120
|
+
DoWithCaption.args = {
|
|
121
|
+
label: 'Message',
|
|
122
|
+
placeholder: 'Enter your message',
|
|
123
|
+
captions: ['Maximum 500 characters'],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Do: Disabled state
|
|
127
|
+
export const DoDisabled = SimpleTemplate.bind({});
|
|
128
|
+
DoDisabled.parameters = { chromatic: { disable: true } };
|
|
129
|
+
DoDisabled.args = {
|
|
130
|
+
label: 'Notes',
|
|
131
|
+
modelValue: 'This is a read-only note that cannot be edited.',
|
|
132
|
+
disabled: true,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Do: Loading state
|
|
136
|
+
export const DoLoading = SimpleTemplate.bind({});
|
|
137
|
+
DoLoading.parameters = { chromatic: { disable: true } };
|
|
138
|
+
DoLoading.args = {
|
|
139
|
+
label: 'Description',
|
|
140
|
+
placeholder: 'Loading...',
|
|
141
|
+
loading: true,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Do: Textarea with error feedback
|
|
145
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
146
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
147
|
+
DoWithErrorFeedback.args = {
|
|
148
|
+
label: 'Description',
|
|
149
|
+
placeholder: 'Enter description',
|
|
150
|
+
modelValue: 'Too short',
|
|
151
|
+
errors: ['Description must be at least 20 characters'],
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Do: Textarea with helpful caption
|
|
155
|
+
export const DoWithHelpfulCaption = SimpleTemplate.bind({});
|
|
156
|
+
DoWithHelpfulCaption.parameters = { chromatic: { disable: true } };
|
|
157
|
+
DoWithHelpfulCaption.args = {
|
|
158
|
+
label: 'Project description',
|
|
159
|
+
placeholder: 'Describe your project',
|
|
160
|
+
modelValue: 'Short',
|
|
161
|
+
captions: ['Please provide a detailed description of at least 50 characters'],
|
|
162
|
+
errors: ['Description is too short'],
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Don't: Long labels
|
|
166
|
+
export const DontLongLabel = SimpleTemplate.bind({});
|
|
167
|
+
DontLongLabel.parameters = { chromatic: { disable: true } };
|
|
168
|
+
DontLongLabel.args = {
|
|
169
|
+
label:
|
|
170
|
+
'Please enter your complete and detailed project description including all relevant information about the project goals, timeline, and expected outcomes',
|
|
171
|
+
placeholder: 'Description',
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const DoShortLabel = SimpleTemplate.bind({});
|
|
175
|
+
DoShortLabel.parameters = { chromatic: { disable: true } };
|
|
176
|
+
DoShortLabel.args = {
|
|
177
|
+
label: 'Description',
|
|
178
|
+
placeholder: 'Enter description',
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Don't: No label
|
|
182
|
+
export const DontNoLabel = SimpleTemplate.bind({});
|
|
183
|
+
DontNoLabel.parameters = { chromatic: { disable: true } };
|
|
184
|
+
DontNoLabel.args = {
|
|
185
|
+
placeholder: 'Enter your message here',
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Don't: Generic placeholder
|
|
189
|
+
export const DontGenericPlaceholder = SimpleTemplate.bind({});
|
|
190
|
+
DontGenericPlaceholder.parameters = { chromatic: { disable: true } };
|
|
191
|
+
DontGenericPlaceholder.args = {
|
|
192
|
+
label: 'Message',
|
|
193
|
+
placeholder: 'Enter text here',
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const DoSpecificPlaceholder = SimpleTemplate.bind({});
|
|
197
|
+
DoSpecificPlaceholder.parameters = { chromatic: { disable: true } };
|
|
198
|
+
DoSpecificPlaceholder.args = {
|
|
199
|
+
label: 'Message',
|
|
200
|
+
placeholder: 'Describe the issue you encountered...',
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// Don't: No error feedback
|
|
204
|
+
export const DontNoErrorFeedback = SimpleTemplate.bind({});
|
|
205
|
+
DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
206
|
+
DontNoErrorFeedback.args = {
|
|
207
|
+
label: 'Description',
|
|
208
|
+
placeholder: 'Enter description',
|
|
209
|
+
modelValue: 'Too short',
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// Don't: No caption for complex requirements
|
|
213
|
+
export const DontNoCaption = SimpleTemplate.bind({});
|
|
214
|
+
DontNoCaption.parameters = { chromatic: { disable: true } };
|
|
215
|
+
DontNoCaption.args = {
|
|
216
|
+
label: 'Project description',
|
|
217
|
+
placeholder: 'Enter description',
|
|
218
|
+
modelValue: 'Short',
|
|
219
|
+
errors: ['Error'],
|
|
220
|
+
};
|