@ouestfrance/sipa-bms-ui 8.22.2 → 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.
Files changed (50) 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/UiButton.vue.d.ts +1 -1
  4. package/dist/components/layout/BmsHeaderTitle.vue.d.ts +1 -1
  5. package/dist/components/navigation/BmsBreadcrumb.vue.d.ts +1 -1
  6. package/dist/components/navigation/BmsShortLinkMenu.vue.d.ts +2 -2
  7. package/dist/components/table/BmsPagination.vue.d.ts +2 -2
  8. package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
  9. package/dist/sipa-bms-ui.css +16 -16
  10. package/dist/sipa-bms-ui.es.js +3608 -3142
  11. package/dist/sipa-bms-ui.es.js.map +1 -1
  12. package/dist/sipa-bms-ui.umd.js +3608 -3142
  13. package/dist/sipa-bms-ui.umd.js.map +1 -1
  14. package/package.json +18 -18
  15. package/src/components/button/BmsButton.stories.js +142 -3
  16. package/src/components/form/BmsChip.stories.js +104 -2
  17. package/src/components/form/BmsInputCheckboxCaptionGroup.stories.js +157 -2
  18. package/src/components/form/BmsInputCheckboxGroup.stories.js +119 -2
  19. package/src/components/form/BmsInputCode.stories.js +109 -2
  20. package/src/components/form/BmsInputFile.stories.js +110 -2
  21. package/src/components/form/BmsInputRadioCaptionGroup.stories.js +138 -2
  22. package/src/components/form/BmsInputRadioGroup.stories.js +120 -2
  23. package/src/components/form/BmsInputText.stories.js +269 -1
  24. package/src/components/form/BmsMultiSelect.vue +3 -1
  25. package/src/components/form/BmsSearch.stories.js +89 -2
  26. package/src/components/form/BmsSelect.stories.js +220 -2
  27. package/src/components/form/BmsSelect.vue +5 -3
  28. package/src/components/form/BmsTag.stories.js +119 -3
  29. package/src/components/form/BmsTextArea.stories.js +146 -2
  30. package/src/components/form/RawAutocomplete.vue +3 -1
  31. package/src/components/layout/BmsForm.stories.js +216 -0
  32. package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
  33. package/src/components/table/BmsTable.stories.js +247 -1
  34. package/src/documentation/button/secondaryButton.mdx +114 -3
  35. package/src/documentation/checkboxCaptionGroup.mdx +99 -0
  36. package/src/documentation/checkboxGroup.mdx +99 -0
  37. package/src/documentation/chip.mdx +85 -11
  38. package/src/documentation/inputCode.mdx +97 -0
  39. package/src/documentation/inputFile.mdx +90 -13
  40. package/src/documentation/inputText.mdx +183 -0
  41. package/src/documentation/layout/form.mdx +74 -0
  42. package/src/documentation/layout/headerTitle.mdx +124 -0
  43. package/src/documentation/layout/table.mdx +111 -0
  44. package/src/documentation/radioCaptionGroup.mdx +86 -19
  45. package/src/documentation/radioGroup.mdx +85 -18
  46. package/src/documentation/search.mdx +85 -13
  47. package/src/documentation/select.mdx +137 -16
  48. package/src/documentation/tag.mdx +91 -11
  49. package/src/documentation/textArea.mdx +126 -13
  50. package/src/documentation/fields_text.mdx +0 -31
@@ -1,11 +1,15 @@
1
1
  import BmsTable from '@/components/table/BmsTable.vue';
2
2
  import BmsButton from '@/components/button/BmsButton.vue';
3
3
  import BmsIconButton from '@/components/button/BmsIconButton.vue';
4
- import { Save, Trash } from 'lucide-vue-next';
4
+ import { BmsTag } from '@/index';
5
+ import { Save, Trash, Pencil } from 'lucide-vue-next';
5
6
 
6
7
  export default {
7
8
  title: 'Composants/table/Table',
8
9
  component: BmsTable,
10
+ parameters: {
11
+ chromatic: { disable: true },
12
+ },
9
13
  argTypes: {
10
14
  disableSearch: {
11
15
  control: { type: 'boolean' },
@@ -1088,3 +1092,245 @@ WithActionColumnAndChildElement.args = {
1088
1092
  selectedItems: [],
1089
1093
  selectable: true,
1090
1094
  };
1095
+
1096
+ // Simple template for documentation
1097
+ const SimpleTemplate = (args) => ({
1098
+ components: {
1099
+ BmsTable,
1100
+ BmsButton,
1101
+ BmsTag,
1102
+ },
1103
+ setup() {
1104
+ return { args };
1105
+ },
1106
+ template: `
1107
+ <BmsTable v-bind="args">
1108
+ <template v-if="args.hasCustomAction" #custom-action>
1109
+ <div style="display: flex; gap: 8px;">
1110
+ <BmsTag
1111
+ v-for="tag in args.filterTags"
1112
+ :key="tag.id"
1113
+ :active="tag.active"
1114
+ @click="tag.onClick"
1115
+ >
1116
+ {{ tag.label }}
1117
+ </BmsTag>
1118
+ </div>
1119
+ </template>
1120
+ </BmsTable>
1121
+ `,
1122
+ });
1123
+
1124
+ // Common headers and items for documentation examples
1125
+ const commonHeaders = [
1126
+ {
1127
+ label: 'Name',
1128
+ key: 'name',
1129
+ align: 'start',
1130
+ sortable: true,
1131
+ },
1132
+ {
1133
+ label: 'Email',
1134
+ key: 'email',
1135
+ align: 'start',
1136
+ },
1137
+ {
1138
+ label: 'Status',
1139
+ key: 'status',
1140
+ align: 'center',
1141
+ },
1142
+ ];
1143
+
1144
+ const commonItems = [
1145
+ { name: 'John Doe', email: 'john@example.com', status: 'Active' },
1146
+ { name: 'Jane Smith', email: 'jane@example.com', status: 'Active' },
1147
+ { name: 'Bob Johnson', email: 'bob@example.com', status: 'Inactive' },
1148
+ { name: 'Alice Williams', email: 'alice@example.com', status: 'Active' },
1149
+ { name: 'Charlie Brown', email: 'charlie@example.com', status: 'Pending' },
1150
+ ];
1151
+
1152
+ // Playground with default values for documentation
1153
+ export const PlaygroundTable = SimpleTemplate.bind({});
1154
+ PlaygroundTable.parameters = { chromatic: { disable: true } };
1155
+ PlaygroundTable.args = {
1156
+ headers: commonHeaders,
1157
+ items: commonItems,
1158
+ disableSearch: false,
1159
+ filters: [],
1160
+ hasCustomAction: false,
1161
+ };
1162
+
1163
+ // Do: Table with search
1164
+ export const DoWithSearch = SimpleTemplate.bind({});
1165
+ DoWithSearch.parameters = { chromatic: { disable: true } };
1166
+ DoWithSearch.args = {
1167
+ headers: commonHeaders,
1168
+ items: commonItems,
1169
+ disableSearch: false,
1170
+ filters: [],
1171
+ hasCustomAction: false,
1172
+ };
1173
+
1174
+ // Do: Table without search
1175
+ export const DoWithoutSearch = SimpleTemplate.bind({});
1176
+ DoWithoutSearch.parameters = { chromatic: { disable: true } };
1177
+ DoWithoutSearch.args = {
1178
+ headers: commonHeaders,
1179
+ items: commonItems,
1180
+ disableSearch: true,
1181
+ filters: [],
1182
+ hasCustomAction: false,
1183
+ };
1184
+
1185
+ // Do: Table with filters
1186
+ export const DoWithFilters = SimpleTemplate.bind({});
1187
+ DoWithFilters.parameters = { chromatic: { disable: true } };
1188
+ DoWithFilters.args = {
1189
+ headers: commonHeaders,
1190
+ items: commonItems,
1191
+ disableSearch: false,
1192
+ filters: [
1193
+ {
1194
+ label: 'Status',
1195
+ key: 'status',
1196
+ type: 'select',
1197
+ selectOptions: [
1198
+ { label: 'Active', value: 'Active' },
1199
+ { label: 'Inactive', value: 'Inactive' },
1200
+ { label: 'Pending', value: 'Pending' },
1201
+ ],
1202
+ },
1203
+ ],
1204
+ hasCustomAction: false,
1205
+ };
1206
+
1207
+ // Do: Table without filters
1208
+ export const DoWithoutFilters = SimpleTemplate.bind({});
1209
+ DoWithoutFilters.parameters = { chromatic: { disable: true } };
1210
+ DoWithoutFilters.args = {
1211
+ headers: commonHeaders,
1212
+ items: commonItems,
1213
+ disableSearch: false,
1214
+ filters: [],
1215
+ hasCustomAction: false,
1216
+ };
1217
+
1218
+ // Do: Table with custom actions (filter tags)
1219
+ export const DoWithCustomActions = SimpleTemplate.bind({});
1220
+ DoWithCustomActions.parameters = { chromatic: { disable: true } };
1221
+ DoWithCustomActions.args = {
1222
+ headers: commonHeaders,
1223
+ items: commonItems,
1224
+ disableSearch: false,
1225
+ filters: [],
1226
+ hasCustomAction: true,
1227
+ filterTags: [
1228
+ { id: '1', label: 'Active', active: true, onClick: () => {} },
1229
+ { id: '2', label: 'Inactive', active: false, onClick: () => {} },
1230
+ { id: '3', label: 'Pending', active: false, onClick: () => {} },
1231
+ ],
1232
+ };
1233
+
1234
+ // Do: Table with action icons
1235
+ const TemplateWithActionIcons = (args) => ({
1236
+ components: {
1237
+ BmsTable,
1238
+ BmsIconButton,
1239
+ Pencil,
1240
+ Trash,
1241
+ },
1242
+ setup() {
1243
+ return { args };
1244
+ },
1245
+ template: `
1246
+ <BmsTable v-bind="args">
1247
+ <template #actions="{ row, isChildElement }">
1248
+ <template v-if="isChildElement">
1249
+ <span style="color: var(--bms-grey-50);">No actions</span>
1250
+ </template>
1251
+ <template v-else>
1252
+ <div style="display: flex; gap: 8px;">
1253
+ <BmsIconButton><Pencil/></BmsIconButton>
1254
+ <BmsIconButton mode="danger"><Trash/></BmsIconButton>
1255
+ </div>
1256
+ </template>
1257
+ </template>
1258
+ </BmsTable>
1259
+ `,
1260
+ });
1261
+
1262
+ export const DoWithActionIcons = TemplateWithActionIcons.bind({});
1263
+ DoWithActionIcons.args = {
1264
+ headers: [
1265
+ ...commonHeaders,
1266
+ {
1267
+ label: 'Actions',
1268
+ key: 'actions',
1269
+ action: true,
1270
+ },
1271
+ ],
1272
+ items: commonItems,
1273
+ disableSearch: false,
1274
+ filters: [],
1275
+ };
1276
+
1277
+ // Do: Table with search and filters
1278
+ export const DoWithSearchAndFilters = SimpleTemplate.bind({});
1279
+ DoWithSearchAndFilters.parameters = { chromatic: { disable: true } };
1280
+ DoWithSearchAndFilters.args = {
1281
+ headers: commonHeaders,
1282
+ items: commonItems,
1283
+ disableSearch: false,
1284
+ filters: [
1285
+ {
1286
+ label: 'Status',
1287
+ key: 'status',
1288
+ type: 'select',
1289
+ selectOptions: [
1290
+ { label: 'Active', value: 'Active' },
1291
+ { label: 'Inactive', value: 'Inactive' },
1292
+ { label: 'Pending', value: 'Pending' },
1293
+ ],
1294
+ },
1295
+ ],
1296
+ hasCustomAction: false,
1297
+ };
1298
+
1299
+ // Do: Table with search, filters and actions
1300
+ export const DoWithSearchFiltersAndActions = SimpleTemplate.bind({});
1301
+ DoWithSearchFiltersAndActions.parameters = { chromatic: { disable: true } };
1302
+ DoWithSearchFiltersAndActions.args = {
1303
+ headers: commonHeaders,
1304
+ items: commonItems,
1305
+ disableSearch: false,
1306
+ filters: [
1307
+ {
1308
+ label: 'Status',
1309
+ key: 'status',
1310
+ type: 'select',
1311
+ selectOptions: [
1312
+ { label: 'Active', value: 'Active' },
1313
+ { label: 'Inactive', value: 'Inactive' },
1314
+ { label: 'Pending', value: 'Pending' },
1315
+ ],
1316
+ },
1317
+ ],
1318
+ hasCustomAction: true,
1319
+ filterTags: [
1320
+ { id: '1', label: 'Active', active: true, onClick: () => {} },
1321
+ { id: '2', label: 'Inactive', active: false, onClick: () => {} },
1322
+ ],
1323
+ };
1324
+
1325
+ // Do: Table with row selection
1326
+ export const DoWithRowSelection = SimpleTemplate.bind({});
1327
+ DoWithRowSelection.parameters = { chromatic: { disable: true } };
1328
+ DoWithRowSelection.args = {
1329
+ headers: commonHeaders,
1330
+ items: commonItems,
1331
+ disableSearch: false,
1332
+ filters: [],
1333
+ hasCustomAction: false,
1334
+ selectable: true,
1335
+ selectedItems: [],
1336
+ };
@@ -1,17 +1,128 @@
1
- import { Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2
- import Button from '../../components/button/BmsButton.vue';
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
2
+ import {
3
+ PlaygroundSecondary,
4
+ DoSimpleSecondary,
5
+ DoDangerSecondary,
6
+ DoSmallSecondary,
7
+ DoIconStartSecondary,
8
+ DoIconEndSecondary,
9
+ DoSubmitSecondary,
10
+ DontLongLabelSecondary,
11
+ DoShortLabelSecondary,
12
+ DontSecondaryAsPrimary,
13
+ DoSecondaryForCancel,
14
+ DontTooManyIconsSecondary,
15
+ DoOneIconSecondary,
16
+ DontGenericLabelSecondary,
17
+ DoSpecificLabelSecondary,
18
+ } from '../../components/button/BmsButton.stories.js';
3
19
 
4
20
  <Meta title="Documentation/Buttons/Secondary" />
5
21
 
6
22
  # <img src="./BmsIcon.png" /> Secondary Button
7
23
 
24
+ The secondary button should represent secondary actions on a screen. They are used alongside primary buttons to create a clear hierarchy of actions. Secondary buttons are ideal for cancel actions, alternative options, or less important actions that don't require primary emphasis.
25
+
8
26
  ## Anatomy
9
27
 
10
28
  Buttons allow users to perform an action or to navigate to another page. They have multiple styles for various needs, and are ideal for calling attention to where a user needs to do something in order to move forward in a flow.
29
+
11
30
  ![](./button/CoverSecondaryButton.png)
12
31
 
13
32
  ## Component
14
33
 
15
- ## Usage
34
+ Use the controls below to interact with the component and see how it behaves with different configurations.
35
+
36
+ <Canvas of={PlaygroundSecondary} />
37
+
38
+ ### Props
39
+
40
+ <Controls of={PlaygroundSecondary} />
41
+
42
+ ## Usage Examples
43
+
44
+ ### ✅ Do: Simple secondary action button
45
+
46
+ Use a clear, concise label (maximum 3 words) for secondary actions like cancel, back, or alternative options.
47
+
48
+ <Canvas of={DoSimpleSecondary} />
49
+
50
+ ### ✅ Do: Button with icon at start
51
+
52
+ Icons can help clarify the action. Place them at the start of the button.
53
+
54
+ <Canvas of={DoIconStartSecondary} />
55
+
56
+ ### ✅ Do: Button with icon at end
57
+
58
+ Place icons at the end for navigation or backward actions.
59
+
60
+ <Canvas of={DoIconEndSecondary} />
61
+
62
+ ### ✅ Do: Submit button
63
+
64
+ Use `submit` prop for form submissions when the secondary action is to submit.
65
+
66
+ <Canvas of={DoSubmitSecondary} />
67
+
68
+ ### ✅ Do: Danger mode
69
+
70
+ Use danger mode for destructive secondary actions that require caution.
71
+
72
+ <Canvas of={DoDangerSecondary} />
73
+
74
+ ### ✅ Do: Small variant
75
+
76
+ Use the small variant when space is limited.
77
+
78
+ <Canvas of={DoSmallSecondary} />
16
79
 
17
80
  ## Rules
81
+
82
+ ### ⛔ Don't: Long labels
83
+
84
+ Avoid long labels that exceed 3 words. Keep button text concise and action-oriented.
85
+
86
+ **❌ Don't:**
87
+
88
+ <Canvas of={DontLongLabelSecondary} />
89
+
90
+ **✅ Do:**
91
+
92
+ <Canvas of={DoShortLabelSecondary} />
93
+
94
+ ### ⛔ Don't: Use secondary as primary action
95
+
96
+ Never use secondary buttons for the main action on a screen. Use primary buttons for the most important action.
97
+
98
+ **❌ Don't:**
99
+
100
+ <Canvas of={DontSecondaryAsPrimary} />
101
+
102
+ **✅ Do:**
103
+
104
+ <Canvas of={DoSecondaryForCancel} />
105
+
106
+ ### ⛔ Don't: Overuse of icons
107
+
108
+ Don't overload buttons with multiple icons or decorative elements that don't add value.
109
+
110
+ **❌ Don't:**
111
+
112
+ <Canvas of={DontTooManyIconsSecondary} />
113
+
114
+ **✅ Do:**
115
+
116
+ <Canvas of={DoOneIconSecondary} />
117
+
118
+ ### ⛔ Don't: Generic labels
119
+
120
+ Avoid generic labels like "Click here" or "Button". Use specific action verbs.
121
+
122
+ **❌ Don't:**
123
+
124
+ <Canvas of={DontGenericLabelSecondary} />
125
+
126
+ **✅ Do:**
127
+
128
+ <Canvas of={DoSpecificLabelSecondary} />
@@ -0,0 +1,99 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
2
+ import {
3
+ PlaygroundCheckboxCaptionGroup,
4
+ DoWithClearLabels,
5
+ DoWithHelpfulCaptions,
6
+ DoWithColumnLayout,
7
+ DontNoLabel,
8
+ DoWithLabel,
9
+ DontNoCaptions,
10
+ DoWithErrorFeedback,
11
+ } from '../components/form/BmsInputCheckboxCaptionGroup.stories.js';
12
+
13
+ <Meta title="Documentation/Fields/Checkbox Caption Group" />
14
+
15
+ # <img src="./BmsIcon.png" /> Checkbox Caption Group
16
+
17
+ A checkbox caption group consists of a set of interconnected checkboxes where each option can have its own caption. This allows you to provide specific information or descriptions for each individual choice. Checkbox caption groups are ideal when each option needs its own contextual information, such as pricing details, feature descriptions, or specific instructions for each choice. Unlike radio groups, checkboxes allow users to select multiple options.
18
+
19
+ ## Anatomy
20
+
21
+ Checkbox caption groups consist of a label that describes the overall choice, multiple checkbox options, and individual captions under each option that provide specific information about that choice. The group can be displayed in a row or column layout.
22
+
23
+ ## Component
24
+
25
+ Use the controls below to interact with the component and see how it behaves with different configurations.
26
+
27
+ <Canvas of={PlaygroundCheckboxCaptionGroup} />
28
+
29
+ ### Props
30
+
31
+ <Controls of={PlaygroundCheckboxCaptionGroup} />
32
+
33
+ ## Usage Examples
34
+
35
+ ### ✅ Do: Checkbox caption group with clear labels
36
+
37
+ Always provide clear, descriptive labels for each option that explain what the choice represents.
38
+
39
+ <Canvas of={DoWithClearLabels} />
40
+
41
+ ### ✅ Do: Checkbox caption group with helpful captions
42
+
43
+ Use captions to provide specific information for each option, such as pricing, features, or additional context that helps users make an informed decision.
44
+
45
+ <Canvas of={DoWithHelpfulCaptions} />
46
+
47
+ ### ✅ Do: Checkbox caption group in column layout
48
+
49
+ Use the column layout when you have longer option labels or captions, or when you want to display options vertically for better readability.
50
+
51
+ <Canvas of={DoWithColumnLayout} />
52
+
53
+ ### ✅ Do: Checkbox caption group with error feedback
54
+
55
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
56
+
57
+ <Canvas of={DoWithErrorFeedback} />
58
+
59
+ ## Rules
60
+
61
+ ### ⛔ Don't: Missing labels
62
+
63
+ Always provide a label for accessibility and clarity. Labels help screen readers and provide context about what choices are expected.
64
+
65
+ **❌ Don't:**
66
+
67
+ <Canvas of={DontNoLabel} />
68
+
69
+ **✅ Do:**
70
+
71
+ <Canvas of={DoWithLabel} />
72
+
73
+ ### ⛔ Don't: No captions when needed
74
+
75
+ When each option has specific information that users need to know (pricing, features, descriptions), provide captions for each option. Without captions, users may not have enough information to make an informed choice.
76
+
77
+ **❌ Don't:**
78
+
79
+ <Canvas of={DontNoCaptions} />
80
+
81
+ **✅ Do:**
82
+
83
+ <Canvas of={DoWithHelpfulCaptions} />
84
+
85
+ ## When to use Checkbox Caption Group vs Checkbox Group
86
+
87
+ **Use Checkbox Caption Group** when:
88
+
89
+ - Each option needs its own specific information or description
90
+ - You need to display different details for each choice (e.g., pricing, features, delivery times)
91
+ - Options have distinct characteristics that require individual explanation
92
+
93
+ **Use Checkbox Group** when:
94
+
95
+ - All options share the same context or information
96
+ - You only need a single caption that applies to all options
97
+ - Options are simple and self-explanatory without individual descriptions
98
+
99
+ The key difference is that Checkbox Caption Group allows you to provide **individual captions for each option**, while Checkbox Group provides **one caption for the entire group**.
@@ -0,0 +1,99 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
2
+ import {
3
+ PlaygroundCheckboxGroup,
4
+ DoWithClearLabels,
5
+ DoWithCaption,
6
+ DoWithColumnLayout,
7
+ DontNoLabel,
8
+ DoWithLabel,
9
+ DontNoErrorFeedback,
10
+ DoWithErrorFeedback,
11
+ } from '../components/form/BmsInputCheckboxGroup.stories.js';
12
+
13
+ <Meta title="Documentation/Fields/Checkbox Group" />
14
+
15
+ # <img src="./BmsIcon.png" /> Checkbox Group
16
+
17
+ A checkbox group consists of a set of interconnected checkboxes with a single caption that applies to all options. Checkbox groups are ideal when all options share the same context or when you need to provide general information that applies to the entire group rather than individual options. Unlike radio groups, checkboxes allow users to select multiple options.
18
+
19
+ ## Anatomy
20
+
21
+ Checkbox groups consist of a label that describes the overall choice, multiple checkbox options, and a single caption that provides information applicable to all options. The group can be displayed in a row or column layout.
22
+
23
+ ## Component
24
+
25
+ Use the controls below to interact with the component and see how it behaves with different configurations.
26
+
27
+ <Canvas of={PlaygroundCheckboxGroup} />
28
+
29
+ ### Props
30
+
31
+ <Controls of={PlaygroundCheckboxGroup} />
32
+
33
+ ## Usage Examples
34
+
35
+ ### ✅ Do: Checkbox group with clear labels
36
+
37
+ Always provide clear, descriptive labels for each option that explain what the choice represents.
38
+
39
+ <Canvas of={DoWithClearLabels} />
40
+
41
+ ### ✅ Do: Checkbox group with caption
42
+
43
+ Use a caption to provide general information that applies to all options, such as instructions, requirements, or context that helps users understand the choice.
44
+
45
+ <Canvas of={DoWithCaption} />
46
+
47
+ ### ✅ Do: Checkbox group in column layout
48
+
49
+ Use the column layout when you have longer option labels, or when you want to display options vertically for better readability or when space is limited horizontally.
50
+
51
+ <Canvas of={DoWithColumnLayout} />
52
+
53
+ ### ✅ Do: Checkbox group with error feedback
54
+
55
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
56
+
57
+ <Canvas of={DoWithErrorFeedback} />
58
+
59
+ ## Rules
60
+
61
+ ### ⛔ Don't: Missing labels
62
+
63
+ Always provide a label for accessibility and clarity. Labels help screen readers and provide context about what choices are expected.
64
+
65
+ **❌ Don't:**
66
+
67
+ <Canvas of={DontNoLabel} />
68
+
69
+ **✅ Do:**
70
+
71
+ <Canvas of={DoWithLabel} />
72
+
73
+ ### ⛔ Don't: No error feedback
74
+
75
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
76
+
77
+ **❌ Don't:**
78
+
79
+ <Canvas of={DontNoErrorFeedback} />
80
+
81
+ **✅ Do:**
82
+
83
+ <Canvas of={DoWithErrorFeedback} />
84
+
85
+ ## When to use Checkbox Group vs Checkbox Caption Group
86
+
87
+ **Use Checkbox Group** when:
88
+
89
+ - All options share the same context or information
90
+ - You only need a single caption that applies to all options
91
+ - Options are simple and self-explanatory without individual descriptions
92
+
93
+ **Use Checkbox Caption Group** when:
94
+
95
+ - Each option needs its own specific information or description
96
+ - You need to display different details for each choice (e.g., pricing, features, delivery times)
97
+ - Options have distinct characteristics that require individual explanation
98
+
99
+ The key difference is that Checkbox Group provides **one caption for the entire group**, while Checkbox Caption Group allows you to provide **individual captions for each option**.
@@ -1,28 +1,102 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
1
2
  import {
2
- Canvas,
3
- Meta,
4
- Story,
5
- Stories,
6
- Controls,
7
- } from '@storybook/addon-docs/blocks';
8
- import { Default as ChipDefault } from '../components/form/BmsChip.stories.js';
3
+ PlaygroundChip,
4
+ DoWithClearContent,
5
+ DoWithAppropriateColor,
6
+ DoWithShortContent,
7
+ DoWithStatusColor,
8
+ DontLongContent,
9
+ DoShortContent,
10
+ DontInappropriateColor,
11
+ DoAppropriateColor,
12
+ DontEmptyContent,
13
+ DoClearContent,
14
+ } from '../components/form/BmsChip.stories.js';
9
15
 
10
16
  <Meta title="Documentation/Chip" />
11
17
 
12
18
  # <img src="./BmsIcon.png" /> Chip
13
19
 
14
- A Chip is a component to make data representation, there is no actions attached to him.
20
+ A Chip is a component to make data representation, there is no actions attached to him. Chips are compact elements that represent an input, attribute, or action. They are commonly used to display status, categories, tags, or other metadata. Chips help users quickly scan and understand information at a glance.
15
21
 
16
22
  ![Chip representation](./chip/CoverChips.png)
17
23
 
18
24
  ## Anatomy
19
25
 
26
+ Chips consist of a container with background color, text content, and optional color coding to convey meaning. They are designed to be compact and visually distinct while maintaining readability.
27
+
20
28
  ![Chip representation](./chip/ChipRepresentation.png)
21
29
 
22
30
  ## Component
23
31
 
24
- <Canvas of={ChipDefault} args={{ label: 'toto' }} />
32
+ Use the controls below to interact with the component and see how it behaves with different configurations.
33
+
34
+ <Canvas of={PlaygroundChip} />
35
+
36
+ ### Props
37
+
38
+ <Controls of={PlaygroundChip} />
39
+
40
+ ## Usage Examples
41
+
42
+ ### ✅ Do: Chip with clear content
43
+
44
+ Always provide clear, concise content that is easy to understand at a glance.
45
+
46
+ <Canvas of={DoWithClearContent} />
47
+
48
+ ### ✅ Do: Chip with appropriate color
49
+
50
+ Use colors that match the semantic meaning of the content. Green for success/active, red for errors/danger, orange for warnings, etc.
51
+
52
+ <Canvas of={DoWithAppropriateColor} />
53
+
54
+ ### ✅ Do: Chip with short content
55
+
56
+ Keep chip content short and concise. Chips are meant to display brief information, not long descriptions.
57
+
58
+ <Canvas of={DoWithShortContent} />
59
+
60
+ ### ✅ Do: Chip with status color
61
+
62
+ Use color coding to quickly convey status information. This helps users understand the state without reading the text.
63
+
64
+ <Canvas of={DoWithStatusColor} />
65
+
66
+ ## Rules
67
+
68
+ ### ⛔ Don't: Long content
69
+
70
+ Avoid overly long content in chips. Long text makes chips difficult to read, breaks the layout, and defeats the purpose of compact data representation.
71
+
72
+ **❌ Don't:**
73
+
74
+ <Canvas of={DontLongContent} />
75
+
76
+ **✅ Do:**
77
+
78
+ <Canvas of={DoShortContent} />
79
+
80
+ ### ⛔ Don't: Inappropriate color usage
81
+
82
+ Don't use colors that contradict the semantic meaning of the content. This can confuse users and lead to misunderstandings.
83
+
84
+ **❌ Don't:**
85
+
86
+ <Canvas of={DontInappropriateColor} />
87
+
88
+ **✅ Do:**
89
+
90
+ <Canvas of={DoAppropriateColor} />
91
+
92
+ ### ⛔ Don't: Empty or unclear content
93
+
94
+ Always provide meaningful content in chips. Empty chips or unclear labels don't provide value to users.
95
+
96
+ **❌ Don't:**
97
+
98
+ <Canvas of={DontEmptyContent} />
25
99
 
26
- ### Table of props
100
+ **✅ Do:**
27
101
 
28
- <Controls of={ChipDefault} />
102
+ <Canvas of={DoClearContent} />