@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.
Files changed (83) hide show
  1. package/dist/components/button/BmsButton.vue.d.ts +1 -1
  2. package/dist/components/button/BmsIconButton.vue.d.ts +1 -1
  3. package/dist/components/button/BmsToggleIcon.vue.d.ts +24 -0
  4. package/dist/components/button/UiButton.vue.d.ts +1 -1
  5. package/dist/components/form/BmsInputText.vue.d.ts +1 -1
  6. package/dist/components/form/BmsSearch.vue.d.ts +3 -3
  7. package/dist/components/form/BmsSelect.vue.d.ts +1 -1
  8. package/dist/components/form/RawSelect.vue.d.ts +1 -1
  9. package/dist/components/layout/BmsHeaderTitle.vue.d.ts +1 -1
  10. package/dist/components/navigation/BmsBreadcrumb.vue.d.ts +1 -1
  11. package/dist/components/navigation/BmsShortLinkMenu.vue.d.ts +2 -2
  12. package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +3 -3
  13. package/dist/components/table/BmsPagination.vue.d.ts +4 -2
  14. package/dist/components/table/BmsServerTable.vue.d.ts +3 -3
  15. package/dist/components/table/BmsTable.vue.d.ts +3 -3
  16. package/dist/components/table/BmsTableFilters.vue.d.ts +5 -3
  17. package/dist/components/table/UiBmsTable.vue.d.ts +3 -3
  18. package/dist/components/table/UiFilterButton.vue.d.ts +2 -0
  19. package/dist/index.d.ts +2 -1
  20. package/dist/models/table.model.d.ts +5 -0
  21. package/dist/plugins/field/FieldComponent.vue.d.ts +1 -1
  22. package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
  23. package/dist/showroom/pages/table.vue.d.ts +2 -0
  24. package/dist/sipa-bms-ui.css +167 -103
  25. package/dist/sipa-bms-ui.es.js +3838 -3301
  26. package/dist/sipa-bms-ui.es.js.map +1 -1
  27. package/dist/sipa-bms-ui.umd.js +3842 -3303
  28. package/dist/sipa-bms-ui.umd.js.map +1 -1
  29. package/package.json +19 -19
  30. package/src/components/button/BmsButton.stories.js +142 -3
  31. package/src/components/button/BmsToggleIcon.stories.js +145 -0
  32. package/src/components/button/BmsToggleIcon.vue +108 -0
  33. package/src/components/form/BmsChip.stories.js +104 -2
  34. package/src/components/form/BmsInputCheckboxCaptionGroup.stories.js +157 -2
  35. package/src/components/form/BmsInputCheckboxGroup.stories.js +119 -2
  36. package/src/components/form/BmsInputCode.stories.js +109 -2
  37. package/src/components/form/BmsInputFile.stories.js +110 -2
  38. package/src/components/form/BmsInputNumber.stories.js +12 -2
  39. package/src/components/form/BmsInputNumber.vue +2 -1
  40. package/src/components/form/BmsInputRadioCaptionGroup.stories.js +138 -2
  41. package/src/components/form/BmsInputRadioGroup.stories.js +120 -2
  42. package/src/components/form/BmsInputText.stories.js +278 -1
  43. package/src/components/form/BmsInputText.vue +2 -0
  44. package/src/components/form/BmsMultiSelect.vue +3 -1
  45. package/src/components/form/BmsSearch.stories.js +89 -2
  46. package/src/components/form/BmsSelect.stories.js +220 -2
  47. package/src/components/form/BmsSelect.vue +5 -3
  48. package/src/components/form/BmsTag.stories.js +119 -3
  49. package/src/components/form/BmsTextArea.stories.js +146 -2
  50. package/src/components/form/RawAutocomplete.vue +3 -1
  51. package/src/components/layout/BmsFloatingWindow.vue +12 -1
  52. package/src/components/layout/BmsForm.stories.js +216 -0
  53. package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
  54. package/src/components/layout/BmsSplitWindow.vue +1 -1
  55. package/src/components/table/BmsPagination.vue +3 -0
  56. package/src/components/table/BmsServerTable.stories.js +59 -3
  57. package/src/components/table/BmsServerTable.vue +9 -2
  58. package/src/components/table/BmsTable.stories.js +312 -2
  59. package/src/components/table/BmsTable.vue +14 -3
  60. package/src/components/table/BmsTableFilters.vue +15 -5
  61. package/src/components/table/UiBmsTable.stories.js +3 -0
  62. package/src/components/table/UiBmsTable.vue +14 -5
  63. package/src/components/table/UiFilterButton.vue +6 -1
  64. package/src/documentation/button/secondaryButton.mdx +114 -3
  65. package/src/documentation/checkboxCaptionGroup.mdx +99 -0
  66. package/src/documentation/checkboxGroup.mdx +99 -0
  67. package/src/documentation/chip.mdx +85 -11
  68. package/src/documentation/inputCode.mdx +97 -0
  69. package/src/documentation/inputFile.mdx +90 -13
  70. package/src/documentation/inputText.mdx +183 -0
  71. package/src/documentation/layout/form.mdx +74 -0
  72. package/src/documentation/layout/headerTitle.mdx +124 -0
  73. package/src/documentation/layout/table.mdx +111 -0
  74. package/src/documentation/radioCaptionGroup.mdx +86 -19
  75. package/src/documentation/radioGroup.mdx +85 -18
  76. package/src/documentation/search.mdx +85 -13
  77. package/src/documentation/select.mdx +137 -16
  78. package/src/documentation/tag.mdx +91 -11
  79. package/src/documentation/textArea.mdx +126 -13
  80. package/src/index.ts +3 -0
  81. package/src/models/table.model.ts +6 -0
  82. package/src/showroom/pages/floating-window.vue +36 -0
  83. package/src/documentation/fields_text.mdx +0 -31
@@ -6,14 +6,14 @@ import { ref } from 'vue';
6
6
  import template from '@/documentation/template_field_dependency.mdx';
7
7
 
8
8
  export default {
9
+ title: 'Composants/form/InputCheckboxCaptionGroup',
10
+ component: BmsInputCheckboxCaptionGroup,
9
11
  parameters: {
10
12
  docs: {
11
13
  page: template,
12
14
  },
13
15
  },
14
16
  tags: ['with_useable_code'],
15
- title: 'Composants/form/InputCheckboxCaptionGroup',
16
- component: BmsInputCheckboxCaptionGroup,
17
17
  };
18
18
 
19
19
  const Template = (args) => ({
@@ -171,3 +171,158 @@ Errors.args = {
171
171
  label: 'This is a field label',
172
172
  errors: ['Error 1', 'Error 2'],
173
173
  };
174
+
175
+ // Simple template for documentation
176
+ const SimpleTemplate = (args) => ({
177
+ setup() {
178
+ const modelValue = ref(args.modelValue || []);
179
+ return { args, modelValue };
180
+ },
181
+ components: {
182
+ BmsInputCheckboxCaptionGroup,
183
+ },
184
+ template: `
185
+ <BmsInputCheckboxCaptionGroup v-bind="args" v-model="modelValue" />
186
+ `,
187
+ });
188
+
189
+ // Playground with default values for documentation
190
+ export const PlaygroundCheckboxCaptionGroup = SimpleTemplate.bind({});
191
+ PlaygroundCheckboxCaptionGroup.parameters = { chromatic: { disable: true } };
192
+ PlaygroundCheckboxCaptionGroup.args = {
193
+ label: 'Select features',
194
+ modelValue: [],
195
+ options: [
196
+ {
197
+ value: 'feature1',
198
+ label: 'Feature 1',
199
+ captions: ['Basic feature included'],
200
+ },
201
+ { value: 'feature2', label: 'Feature 2', captions: ['Advanced feature'] },
202
+ { value: 'feature3', label: 'Feature 3', captions: ['Premium feature'] },
203
+ ],
204
+ };
205
+
206
+ // Do: Checkbox caption group with clear labels
207
+ export const DoWithClearLabels = SimpleTemplate.bind({});
208
+ DoWithClearLabels.parameters = { chromatic: { disable: true } };
209
+ DoWithClearLabels.args = {
210
+ label: 'Notification preferences',
211
+ modelValue: [],
212
+ options: [
213
+ {
214
+ value: 'email',
215
+ label: 'Email notifications',
216
+ captions: ['Receive updates via email'],
217
+ },
218
+ {
219
+ value: 'sms',
220
+ label: 'SMS notifications',
221
+ captions: ['Receive updates via SMS'],
222
+ },
223
+ {
224
+ value: 'push',
225
+ label: 'Push notifications',
226
+ captions: ['Receive browser notifications'],
227
+ },
228
+ ],
229
+ };
230
+
231
+ // Do: Checkbox caption group with helpful captions
232
+ export const DoWithHelpfulCaptions = SimpleTemplate.bind({});
233
+ DoWithHelpfulCaptions.parameters = { chromatic: { disable: true } };
234
+ DoWithHelpfulCaptions.args = {
235
+ label: 'Subscription add-ons',
236
+ modelValue: [],
237
+ options: [
238
+ {
239
+ value: 'storage',
240
+ label: 'Extra Storage',
241
+ captions: ['+100GB storage space'],
242
+ },
243
+ {
244
+ value: 'support',
245
+ label: 'Priority Support',
246
+ captions: ['24/7 priority support'],
247
+ },
248
+ {
249
+ value: 'analytics',
250
+ label: 'Advanced Analytics',
251
+ captions: ['Detailed usage analytics'],
252
+ },
253
+ ],
254
+ };
255
+
256
+ // Do: Checkbox caption group in column layout
257
+ export const DoWithColumnLayout = SimpleTemplate.bind({});
258
+ DoWithColumnLayout.parameters = { chromatic: { disable: true } };
259
+ DoWithColumnLayout.args = {
260
+ label: 'Select services',
261
+ modelValue: [],
262
+ align: 'column',
263
+ options: [
264
+ {
265
+ value: 'service1',
266
+ label: 'Service 1',
267
+ captions: ['Description of service 1 with more details'],
268
+ },
269
+ {
270
+ value: 'service2',
271
+ label: 'Service 2',
272
+ captions: ['Description of service 2 with more details'],
273
+ },
274
+ {
275
+ value: 'service3',
276
+ label: 'Service 3',
277
+ captions: ['Description of service 3 with more details'],
278
+ },
279
+ ],
280
+ };
281
+
282
+ // Do: Checkbox caption group with error feedback
283
+ export const DoWithErrorFeedback = SimpleTemplate.bind({});
284
+ DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
285
+ DoWithErrorFeedback.args = {
286
+ label: 'Select features',
287
+ modelValue: [],
288
+ errors: ['Please select at least one feature'],
289
+ options: [
290
+ { value: 'feature1', label: 'Feature 1', captions: ['Basic feature'] },
291
+ { value: 'feature2', label: 'Feature 2', captions: ['Advanced feature'] },
292
+ ],
293
+ };
294
+
295
+ // Don't: Missing labels
296
+ export const DontNoLabel = SimpleTemplate.bind({});
297
+ DontNoLabel.parameters = { chromatic: { disable: true } };
298
+ DontNoLabel.args = {
299
+ modelValue: [],
300
+ options: [
301
+ { value: 'option1', label: 'Option 1', captions: ['Description'] },
302
+ { value: 'option2', label: 'Option 2', captions: ['Description'] },
303
+ ],
304
+ };
305
+
306
+ export const DoWithLabel = SimpleTemplate.bind({});
307
+ DoWithLabel.parameters = { chromatic: { disable: true } };
308
+ DoWithLabel.args = {
309
+ label: 'Choose options',
310
+ modelValue: [],
311
+ options: [
312
+ { value: 'option1', label: 'Option 1', captions: ['Description'] },
313
+ { value: 'option2', label: 'Option 2', captions: ['Description'] },
314
+ ],
315
+ };
316
+
317
+ // Don't: No captions when needed
318
+ export const DontNoCaptions = SimpleTemplate.bind({});
319
+ DontNoCaptions.parameters = { chromatic: { disable: true } };
320
+ DontNoCaptions.args = {
321
+ label: 'Subscription add-ons',
322
+ modelValue: [],
323
+ options: [
324
+ { value: 'storage', label: 'Extra Storage' },
325
+ { value: 'support', label: 'Priority Support' },
326
+ { value: 'analytics', label: 'Advanced Analytics' },
327
+ ],
328
+ };
@@ -6,13 +6,13 @@ import { ref } from 'vue';
6
6
  import template from '@/documentation/template_field_dependency.mdx';
7
7
 
8
8
  export default {
9
+ title: 'Composants/form/InputCheckboxGroup',
10
+ component: BmsInputCheckboxGroup,
9
11
  parameters: {
10
12
  docs: {
11
13
  page: template,
12
14
  },
13
15
  },
14
- title: 'Composants/form/InputCheckboxGroup',
15
- component: BmsInputCheckboxGroup,
16
16
  };
17
17
 
18
18
  const Template = (args) => ({
@@ -92,3 +92,120 @@ Errors.args = {
92
92
  label: 'This is a field label',
93
93
  errors: ['Error 1', 'Error 2'],
94
94
  };
95
+
96
+ // Simple template for documentation
97
+ const SimpleTemplate = (args) => ({
98
+ setup() {
99
+ const modelValue = ref(args.modelValue || []);
100
+ return { args, modelValue };
101
+ },
102
+ components: {
103
+ BmsInputCheckboxGroup,
104
+ },
105
+ template: `
106
+ <BmsInputCheckboxGroup v-bind="args" v-model="modelValue" />
107
+ `,
108
+ });
109
+
110
+ // Playground with default values for documentation
111
+ export const PlaygroundCheckboxGroup = SimpleTemplate.bind({});
112
+ PlaygroundCheckboxGroup.parameters = { chromatic: { disable: true } };
113
+ PlaygroundCheckboxGroup.args = {
114
+ label: 'Select interests',
115
+ modelValue: [],
116
+ values: [
117
+ { value: 'sports', label: 'Sports' },
118
+ { value: 'music', label: 'Music' },
119
+ { value: 'travel', label: 'Travel' },
120
+ ],
121
+ };
122
+
123
+ // Do: Checkbox group with clear labels
124
+ export const DoWithClearLabels = SimpleTemplate.bind({});
125
+ DoWithClearLabels.parameters = { chromatic: { disable: true } };
126
+ DoWithClearLabels.args = {
127
+ label: 'Communication preferences',
128
+ modelValue: [],
129
+ values: [
130
+ { value: 'email', label: 'Email' },
131
+ { value: 'sms', label: 'SMS' },
132
+ { value: 'phone', label: 'Phone' },
133
+ ],
134
+ };
135
+
136
+ // Do: Checkbox group with caption
137
+ export const DoWithCaption = SimpleTemplate.bind({});
138
+ DoWithCaption.parameters = { chromatic: { disable: true } };
139
+ DoWithCaption.args = {
140
+ label: 'Select categories',
141
+ modelValue: [],
142
+ captions: ['You can select multiple categories'],
143
+ values: [
144
+ { value: 'tech', label: 'Technology' },
145
+ { value: 'design', label: 'Design' },
146
+ { value: 'business', label: 'Business' },
147
+ ],
148
+ };
149
+
150
+ // Do: Checkbox group in column layout
151
+ export const DoWithColumnLayout = SimpleTemplate.bind({});
152
+ DoWithColumnLayout.parameters = { chromatic: { disable: true } };
153
+ DoWithColumnLayout.args = {
154
+ label: 'Select permissions',
155
+ modelValue: [],
156
+ align: 'column',
157
+ captions: ['Select all permissions you want to grant'],
158
+ values: [
159
+ { value: 'read', label: 'Read access' },
160
+ { value: 'write', label: 'Write access' },
161
+ { value: 'delete', label: 'Delete access' },
162
+ { value: 'admin', label: 'Admin access' },
163
+ ],
164
+ };
165
+
166
+ // Do: Checkbox group with error feedback
167
+ export const DoWithErrorFeedback = SimpleTemplate.bind({});
168
+ DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
169
+ DoWithErrorFeedback.args = {
170
+ label: 'Select interests',
171
+ modelValue: [],
172
+ errors: ['Please select at least one interest'],
173
+ values: [
174
+ { value: 'sports', label: 'Sports' },
175
+ { value: 'music', label: 'Music' },
176
+ ],
177
+ };
178
+
179
+ // Don't: Missing labels
180
+ export const DontNoLabel = SimpleTemplate.bind({});
181
+ DontNoLabel.parameters = { chromatic: { disable: true } };
182
+ DontNoLabel.args = {
183
+ modelValue: [],
184
+ values: [
185
+ { value: 'option1', label: 'Option 1' },
186
+ { value: 'option2', label: 'Option 2' },
187
+ ],
188
+ };
189
+
190
+ export const DoWithLabel = SimpleTemplate.bind({});
191
+ DoWithLabel.parameters = { chromatic: { disable: true } };
192
+ DoWithLabel.args = {
193
+ label: 'Choose options',
194
+ modelValue: [],
195
+ values: [
196
+ { value: 'option1', label: 'Option 1' },
197
+ { value: 'option2', label: 'Option 2' },
198
+ ],
199
+ };
200
+
201
+ // Don't: No error feedback
202
+ export const DontNoErrorFeedback = SimpleTemplate.bind({});
203
+ DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
204
+ DontNoErrorFeedback.args = {
205
+ label: 'Select interests',
206
+ modelValue: [],
207
+ values: [
208
+ { value: 'sports', label: 'Sports' },
209
+ { value: 'music', label: 'Music' },
210
+ ],
211
+ };
@@ -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
+ };
@@ -70,12 +70,22 @@ WithIcons.args = {
70
70
  iconEnd: true,
71
71
  };
72
72
 
73
+ export const WithLimitAndEmptyValue = Template.bind({});
74
+ WithLimitAndEmptyValue.args = {
75
+ label: 'My label',
76
+ modelValue: null,
77
+ modelValueSmall: undefined,
78
+ min: 5,
79
+ max: 8,
80
+ errors: [],
81
+ };
82
+
73
83
  export const WithLimitExceeded = Template.bind({});
74
84
  WithLimitExceeded.args = {
75
85
  label: 'My label',
76
- modelValue: 10,
86
+ modelValue: 0,
77
87
  modelValueSmall: 2,
78
- min: 5,
88
+ min: 1,
79
89
  max: 8,
80
90
  errors: [{ label: 'Error 1' }],
81
91
  };
@@ -70,7 +70,8 @@ const classes = computed(() => {
70
70
 
71
71
  const checkLimit = () => {
72
72
  internalErrors.value = [];
73
- if (props.min !== undefined && props.modelValue < props.min) {
73
+ const hasValue = props.modelValue !== null && props.modelValue !== undefined;
74
+ if (hasValue && props.min !== undefined && props.modelValue < props.min) {
74
75
  internalErrors.value = [
75
76
  'Valeur inférieure au minimum autorisé (min : ' + props.min + ')',
76
77
  ];