@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouestfrance/sipa-bms-ui",
3
- "version": "8.22.2",
3
+ "version": "8.23.0",
4
4
  "author": "Ouest-France BMS",
5
5
  "license": "ISC",
6
6
  "scripts": {
@@ -33,15 +33,15 @@
33
33
  "@chromatic-com/storybook": "^4.1.3",
34
34
  "@codemirror/lang-html": "6.4.11",
35
35
  "@codemirror/lang-json": "6.0.2",
36
- "@commitlint/cli": "20.1.0",
37
- "@commitlint/config-conventional": "20.0.0",
36
+ "@commitlint/cli": "20.2.0",
37
+ "@commitlint/config-conventional": "20.2.0",
38
38
  "@mdx-js/react": "3.1.1",
39
- "@storybook/addon-docs": "10.1.6",
40
- "@storybook/addon-links": "10.1.6",
41
- "@storybook/vue3-vite": "10.1.6",
39
+ "@storybook/addon-docs": "10.1.10",
40
+ "@storybook/addon-links": "10.1.10",
41
+ "@storybook/vue3-vite": "10.1.10",
42
42
  "@types/lodash": "4.17.21",
43
43
  "@types/uuid": "11.0.0",
44
- "@vitejs/plugin-vue": "6.0.2",
44
+ "@vitejs/plugin-vue": "6.0.3",
45
45
  "@vue/test-utils": "2.4.6",
46
46
  "@vueuse/core": "13.9.0",
47
47
  "@vueuse/motion": "^3.0.0",
@@ -52,25 +52,25 @@
52
52
  "cors": "^2.8.5",
53
53
  "cross-env": "^10.0.0",
54
54
  "cy2": "^4.0.0",
55
- "cypress": "15.7.0",
55
+ "cypress": "15.8.1",
56
56
  "express": "^5.0.0",
57
57
  "husky": "9.1.7",
58
- "jsdom": "27.2.0",
58
+ "jsdom": "27.3.0",
59
59
  "keycloak-js": "26.1.2",
60
60
  "lint-staged": "16.2.7",
61
61
  "lodash": "4.17.21",
62
- "lucide-vue-next": "0.554.0",
62
+ "lucide-vue-next": "0.562.0",
63
63
  "msw": "^2.12.4",
64
- "msw-storybook-addon": "^2.0.3",
64
+ "msw-storybook-addon": "^2.0.6",
65
65
  "normalize.css": "8.0.1",
66
66
  "path": "0.12.7",
67
- "prettier": "3.6.2",
67
+ "prettier": "3.7.4",
68
68
  "remark-gfm": "^4.0.1",
69
- "sass": "1.94.2",
69
+ "sass": "1.97.1",
70
70
  "semantic-release": "25.0.2",
71
71
  "start-server-and-test": "2.1.3",
72
- "storybook": "10.1.6",
73
- "storybook-addon-pseudo-states": "10.1.6",
72
+ "storybook": "10.1.10",
73
+ "storybook-addon-pseudo-states": "10.1.10",
74
74
  "storybook-addon-tag-badges": "^3.0.2",
75
75
  "storybook-vue3-router": "^7.0.0",
76
76
  "typescript": "5.2.2",
@@ -78,14 +78,14 @@
78
78
  "vite": "^7.1.12",
79
79
  "vite-plugin-dts": "^4.1.0",
80
80
  "vite-plugin-mkcert": "1.17.9",
81
- "vite-plugin-pages": "0.33.1",
81
+ "vite-plugin-pages": "0.33.2",
82
82
  "vite-svg-loader": "5.1.0",
83
83
  "vitest": "3.2.4",
84
- "vue": "3.5.24",
84
+ "vue": "3.5.26",
85
85
  "vue-codemirror": "6.1.1",
86
86
  "vue-loader": "17.4.2",
87
- "vue-router": "4.6.3",
88
- "vue-tsc": "3.1.5"
87
+ "vue-router": "4.6.4",
88
+ "vue-tsc": "3.2.0"
89
89
  },
90
90
  "files": [
91
91
  "dist",
@@ -17,6 +17,9 @@ export default {
17
17
  chromatic: { disable: true },
18
18
  },
19
19
  argTypes: {
20
+ defaultSlot: {
21
+ description: 'Slot VueJS',
22
+ },
20
23
  type: {
21
24
  control: { type: 'select' },
22
25
  options: ['primary', 'secondary', 'tertiary'],
@@ -41,13 +44,22 @@ const Template = (args) => ({
41
44
  },
42
45
  template: `
43
46
  <BmsButton v-bind="args">
44
- Save
47
+ {{args.defaultSlot ?? 'Save'}}
45
48
  </BmsButton>
46
49
  `,
47
50
  });
48
51
 
49
52
  export const Playground = Template.bind({});
50
- Playground.args = {};
53
+ Playground.parameters = { chromatic: { disable: false } };
54
+ Playground.args = {
55
+ type: 'primary',
56
+ };
57
+
58
+ export const PlaygroundSecondary = Template.bind({});
59
+ PlaygroundSecondary.args = {
60
+ type: 'secondary',
61
+ defaultSlot: 'Cancel',
62
+ };
51
63
 
52
64
  // Stories for documentation examples (Do/Don't)
53
65
  export const DoSimple = Template.bind({});
@@ -124,9 +136,9 @@ export const DoOnePrimary = () => ({
124
136
  components: { BmsButton },
125
137
  template: `
126
138
  <div style="display: flex; gap: 8px;">
127
- <BmsButton type="primary">Save</BmsButton>
128
139
  <BmsButton type="secondary">Cancel</BmsButton>
129
140
  <BmsButton type="secondary">Delete</BmsButton>
141
+ <BmsButton type="primary">Save</BmsButton>
130
142
  </div>
131
143
  `,
132
144
  });
@@ -194,3 +206,130 @@ export const DoPrimaryForSave = () => ({
194
206
  </div>
195
207
  `,
196
208
  });
209
+
210
+ // Secondary button stories for documentation
211
+ export const DoSimpleSecondary = Template.bind({});
212
+ DoSimpleSecondary.args = {
213
+ type: 'secondary',
214
+ defaultSlot: 'Cancel',
215
+ };
216
+
217
+ export const DoDangerSecondary = Template.bind({});
218
+ DoDangerSecondary.args = {
219
+ type: 'secondary',
220
+ mode: 'danger',
221
+ };
222
+
223
+ export const DoSmallSecondary = Template.bind({});
224
+ DoSmallSecondary.args = {
225
+ type: 'secondary',
226
+ small: true,
227
+ };
228
+
229
+ // Do: Secondary button with icon at start
230
+ export const DoIconStartSecondary = () => ({
231
+ components: { BmsButton, ArrowLeft },
232
+ template: `
233
+ <BmsButton type="secondary">
234
+ <template #start><ArrowLeft /></template>
235
+ Back
236
+ </BmsButton>
237
+ `,
238
+ });
239
+
240
+ // Do: Secondary button with icon at end
241
+ export const DoIconEndSecondary = () => ({
242
+ components: { BmsButton, ArrowRight },
243
+ template: `
244
+ <BmsButton type="secondary">
245
+ Next
246
+ <template #end><ArrowRight /></template>
247
+ </BmsButton>
248
+ `,
249
+ });
250
+
251
+ // Do: Secondary submit button
252
+ export const DoSubmitSecondary = () => ({
253
+ components: { BmsButton },
254
+ template: `
255
+ <form>
256
+ <BmsButton type="secondary" :submit="true">Cancel form</BmsButton>
257
+ </form>
258
+ `,
259
+ });
260
+
261
+ // Don't: Long labels for secondary
262
+ export const DontLongLabelSecondary = () => ({
263
+ components: { BmsButton },
264
+ template:
265
+ '<BmsButton type="secondary">Click here to cancel your changes to the document</BmsButton>',
266
+ });
267
+
268
+ export const DoShortLabelSecondary = () => ({
269
+ components: { BmsButton },
270
+ template: '<BmsButton type="secondary">Cancel changes</BmsButton>',
271
+ });
272
+
273
+ // Don't: Secondary as primary action
274
+ export const DontSecondaryAsPrimary = () => ({
275
+ components: { BmsButton },
276
+ template: `
277
+ <div style="display: flex; gap: 8px;">
278
+ <BmsButton type="secondary">Save</BmsButton>
279
+ <BmsButton type="secondary">Confirm</BmsButton>
280
+ </div>
281
+ `,
282
+ });
283
+
284
+ export const DoSecondaryForCancel = () => ({
285
+ components: { BmsButton },
286
+ template: `
287
+ <div style="display: flex; gap: 8px;">
288
+ <BmsButton type="secondary">Cancel</BmsButton>
289
+ <BmsButton type="primary">Save</BmsButton>
290
+ </div>
291
+ `,
292
+ });
293
+
294
+ // Don't: Too many icons on secondary
295
+ export const DontTooManyIconsSecondary = () => ({
296
+ components: { BmsButton, Heart, Wand, Check, ArrowLeft },
297
+ template: `
298
+ <BmsButton type="secondary">
299
+ <template #start><Heart /><Wand /></template>
300
+ Cancel changes
301
+ <template #end><Check /><ArrowLeft /></template>
302
+ </BmsButton>
303
+ `,
304
+ });
305
+
306
+ export const DoOneIconSecondary = () => ({
307
+ components: { BmsButton, ArrowLeft },
308
+ template: `
309
+ <BmsButton type="secondary">
310
+ <template #start><ArrowLeft /></template>
311
+ Back
312
+ </BmsButton>
313
+ `,
314
+ });
315
+
316
+ // Don't: Generic labels for secondary
317
+ export const DontGenericLabelSecondary = () => ({
318
+ components: { BmsButton },
319
+ template: `
320
+ <div style="display: flex; gap: 8px;">
321
+ <BmsButton type="secondary">Click here</BmsButton>
322
+ <BmsButton type="secondary">Button</BmsButton>
323
+ </div>
324
+ `,
325
+ });
326
+
327
+ export const DoSpecificLabelSecondary = () => ({
328
+ components: { BmsButton },
329
+ template: `
330
+ <div style="display: flex; gap: 8px;">
331
+ <BmsButton type="secondary">Cancel order</BmsButton>
332
+ <BmsButton type="secondary">Go back</BmsButton>
333
+ </div>
334
+ `,
335
+ });
@@ -0,0 +1,145 @@
1
+ import { Activity } from 'lucide-vue-next';
2
+ import { ref } from 'vue';
3
+ import BmsToggleIcon from './BmsToggleIcon.vue';
4
+
5
+ const WITH_DEFAULT_SLOT = {
6
+ default: '<Activity/>',
7
+ };
8
+
9
+ export default {
10
+ title: 'Composants/button/ToggleIcon',
11
+ component: BmsToggleIcon,
12
+ tags: ['with_useable_code'],
13
+ argTypes: {
14
+ modelValue: {
15
+ control: { type: 'boolean' },
16
+ },
17
+ disabled: {
18
+ control: { type: 'boolean' },
19
+ },
20
+ small: {
21
+ control: { type: 'boolean' },
22
+ },
23
+ },
24
+ };
25
+
26
+ const Template = (args) => ({
27
+ components: {
28
+ BmsToggleIcon,
29
+ Activity,
30
+ },
31
+ setup() {
32
+ const modelValue = ref(args.modelValue ?? false);
33
+ const modelValueSmall = ref(args.modelValue ?? false);
34
+ return { args, modelValue, modelValueSmall };
35
+ },
36
+ template: `
37
+ <div style="display: flex; flex-direction: column; gap: 24px; padding: 16px;">
38
+ <div style="display: flex; flex-direction: column; gap: 8px;">
39
+ <b>Normal</b>
40
+ <div style="display: flex; gap: 16px; align-items: center;">
41
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
42
+ <b style="font-size: 12px;">Default (cliquable)</b>
43
+ <BmsToggleIcon v-model="modelValue"><Activity/></BmsToggleIcon>
44
+ </div>
45
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
46
+ <b style="font-size: 12px;">Disable Default</b>
47
+ <BmsToggleIcon :model-value="false" :disabled="true"><Activity/></BmsToggleIcon>
48
+ </div>
49
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
50
+ <b style="font-size: 12px;">Hover</b>
51
+ <BmsToggleIcon :model-value="false" class="_hover"><Activity/></BmsToggleIcon>
52
+ </div>
53
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
54
+ <b style="font-size: 12px;">Actif</b>
55
+ <BmsToggleIcon :model-value="true"><Activity/></BmsToggleIcon>
56
+ </div>
57
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
58
+ <b style="font-size: 12px;">Disable Actif</b>
59
+ <BmsToggleIcon :model-value="true" :disabled="true"><Activity/></BmsToggleIcon>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <div style="display: flex; flex-direction: column; gap: 8px;">
64
+ <b>Small</b>
65
+ <div style="display: flex; gap: 16px; align-items: center;">
66
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
67
+ <b style="font-size: 12px;">Default (cliquable)</b>
68
+ <BmsToggleIcon v-model="modelValueSmall" small><Activity/></BmsToggleIcon>
69
+ </div>
70
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
71
+ <b style="font-size: 12px;">Disable Default</b>
72
+ <BmsToggleIcon :model-value="false" small :disabled="true"><Activity/></BmsToggleIcon>
73
+ </div>
74
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
75
+ <b style="font-size: 12px;">Hover</b>
76
+ <BmsToggleIcon :model-value="false" small class="_hover"><Activity/></BmsToggleIcon>
77
+ </div>
78
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
79
+ <b style="font-size: 12px;">Actif</b>
80
+ <BmsToggleIcon :model-value="true" small><Activity/></BmsToggleIcon>
81
+ </div>
82
+ <div style="display: flex; flex-direction: column; gap: 4px; align-items: center;">
83
+ <b style="font-size: 12px;">Disable Actif</b>
84
+ <BmsToggleIcon :model-value="true" small :disabled="true"><Activity/></BmsToggleIcon>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ `,
90
+ });
91
+
92
+ export const ToggleIcon = Template.bind({});
93
+ ToggleIcon.args = { ...WITH_DEFAULT_SLOT };
94
+
95
+ export const Default = () => ({
96
+ components: { BmsToggleIcon, Activity },
97
+ template: '<BmsToggleIcon><Activity/></BmsToggleIcon>',
98
+ });
99
+
100
+ export const DisableDefault = () => ({
101
+ components: { BmsToggleIcon, Activity },
102
+ template: '<BmsToggleIcon :disabled="true"><Activity/></BmsToggleIcon>',
103
+ });
104
+
105
+ export const Hover = () => ({
106
+ components: { BmsToggleIcon, Activity },
107
+ template: '<BmsToggleIcon class="_hover"><Activity/></BmsToggleIcon>',
108
+ });
109
+
110
+ export const Actif = () => ({
111
+ components: { BmsToggleIcon, Activity },
112
+ template: '<BmsToggleIcon :model-value="true"><Activity/></BmsToggleIcon>',
113
+ });
114
+
115
+ export const DisableActif = () => ({
116
+ components: { BmsToggleIcon, Activity },
117
+ template:
118
+ '<BmsToggleIcon :model-value="true" :disabled="true"><Activity/></BmsToggleIcon>',
119
+ });
120
+
121
+ export const Small = () => ({
122
+ components: { BmsToggleIcon, Activity },
123
+ template: '<BmsToggleIcon small><Activity/></BmsToggleIcon>',
124
+ });
125
+
126
+ export const SmallActive = () => ({
127
+ components: { BmsToggleIcon, Activity },
128
+ template:
129
+ '<BmsToggleIcon small :model-value="true"><Activity/></BmsToggleIcon>',
130
+ });
131
+
132
+ export const WithVModel = () => ({
133
+ components: { BmsToggleIcon, Activity },
134
+ setup() {
135
+ const isActive = ref(false);
136
+ return { isActive };
137
+ },
138
+ template: `
139
+ <div style="display: flex; flex-direction: column; gap: 16px; padding: 16px;">
140
+ <BmsToggleIcon v-model="isActive"><Activity/></BmsToggleIcon>
141
+ <p>État actif : {{ isActive }}</p>
142
+ <button @click="isActive = !isActive" style="padding: 8px;">Toggle depuis l'extérieur</button>
143
+ </div>
144
+ `,
145
+ });
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <button
3
+ class="toggle-icon"
4
+ :class="{ active: modelValue, disabled, small }"
5
+ :disabled="disabled"
6
+ @click="handleClick"
7
+ >
8
+ <slot></slot>
9
+ </button>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ interface Props {
14
+ modelValue?: boolean;
15
+ disabled?: boolean;
16
+ small?: boolean;
17
+ }
18
+
19
+ const props = withDefaults(defineProps<Props>(), {
20
+ modelValue: false,
21
+ disabled: false,
22
+ small: false,
23
+ });
24
+
25
+ const emit = defineEmits<{
26
+ (e: 'update:modelValue', value: boolean): void;
27
+ (e: 'click', event: MouseEvent): void;
28
+ }>();
29
+
30
+ const handleClick = (event: MouseEvent) => {
31
+ if (!props.disabled) {
32
+ const newValue = !props.modelValue;
33
+ emit('update:modelValue', newValue);
34
+ emit('click', event);
35
+ }
36
+ };
37
+ </script>
38
+
39
+ <style lang="scss" scoped>
40
+ .toggle-icon {
41
+ --icon-color: var(--bms-grey-100);
42
+ --underline-color: transparent;
43
+
44
+ background: none;
45
+ border: none;
46
+ padding: 0;
47
+ padding-bottom: 0.25em;
48
+ cursor: pointer;
49
+ display: inline-flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ position: relative;
53
+
54
+ :deep(svg) {
55
+ color: var(--icon-color);
56
+ transition: color 0.2s;
57
+ }
58
+
59
+ &::after {
60
+ content: '';
61
+ position: absolute;
62
+ bottom: 0;
63
+ left: 0;
64
+ right: 0;
65
+ height: 0.125em;
66
+ background-color: var(--underline-color);
67
+ transition: background-color 0.2s;
68
+ }
69
+
70
+ &:hover:not(.disabled),
71
+ &._hover:not(.disabled) {
72
+ --icon-color: var(--bms-grey-140);
73
+ --underline-color: var(--bms-grey-140);
74
+ }
75
+
76
+ &.active {
77
+ --icon-color: var(--bms-main-100);
78
+ --underline-color: var(--bms-main-100);
79
+ }
80
+
81
+ &.active:hover:not(.disabled),
82
+ &.active._hover:not(.disabled) {
83
+ --icon-color: var(--bms-main-140);
84
+ --underline-color: var(--bms-main-140);
85
+ }
86
+
87
+ &.disabled {
88
+ --icon-color: var(--bms-grey-50);
89
+ cursor: default;
90
+ pointer-events: none;
91
+ }
92
+
93
+ &.disabled.active {
94
+ --underline-color: var(--bms-grey-50);
95
+ }
96
+
97
+ &.small {
98
+ :deep(svg) {
99
+ width: 1em;
100
+ height: 1em;
101
+ }
102
+
103
+ &::after {
104
+ height: 1.5px;
105
+ }
106
+ }
107
+ }
108
+ </style>
@@ -3,13 +3,16 @@ import BmsChip from '@/components/form/BmsChip.vue';
3
3
  import template from '@/documentation/template_field_dependency.mdx';
4
4
 
5
5
  export default {
6
+ title: 'Composants/form/Chip',
7
+ component: BmsChip,
8
+ argTypes: {
9
+ color: { options: ['grey', 'blue', 'red', 'green', 'orange'] },
10
+ },
6
11
  parameters: {
7
12
  docs: {
8
13
  page: template,
9
14
  },
10
15
  },
11
- title: 'Composants/form/Chip',
12
- component: BmsChip,
13
16
  };
14
17
 
15
18
  const Template = (args) => ({
@@ -63,3 +66,102 @@ export const Unknown = Template.bind({});
63
66
  Unknown.args = {
64
67
  color: 'Unknown',
65
68
  };
69
+
70
+ // Simple template for documentation
71
+ const SimpleTemplate = (args) => ({
72
+ setup() {
73
+ return { args };
74
+ },
75
+ components: {
76
+ BmsChip,
77
+ },
78
+ template: `
79
+ <BmsChip v-bind="args">{{ args.content || 'Content' }}</BmsChip>
80
+ `,
81
+ });
82
+
83
+ // Playground with default values for documentation
84
+ export const PlaygroundChip = SimpleTemplate.bind({});
85
+ PlaygroundChip.parameters = { chromatic: { disable: true } };
86
+ PlaygroundChip.args = {
87
+ content: 'Status',
88
+ color: 'grey',
89
+ };
90
+
91
+ // Do: Chip with clear content
92
+ export const DoWithClearContent = SimpleTemplate.bind({});
93
+ DoWithClearContent.parameters = { chromatic: { disable: true } };
94
+ DoWithClearContent.args = {
95
+ content: 'Active',
96
+ color: 'green',
97
+ };
98
+
99
+ // Do: Chip with appropriate color
100
+ export const DoWithAppropriateColor = SimpleTemplate.bind({});
101
+ DoWithAppropriateColor.parameters = { chromatic: { disable: true } };
102
+ DoWithAppropriateColor.args = {
103
+ content: 'Error',
104
+ color: 'red',
105
+ };
106
+
107
+ // Do: Chip with short content
108
+ export const DoWithShortContent = SimpleTemplate.bind({});
109
+ DoWithShortContent.parameters = { chromatic: { disable: true } };
110
+ DoWithShortContent.args = {
111
+ content: 'New',
112
+ color: 'blue',
113
+ };
114
+
115
+ // Do: Chip with status color
116
+ export const DoWithStatusColor = SimpleTemplate.bind({});
117
+ DoWithStatusColor.parameters = { chromatic: { disable: true } };
118
+ DoWithStatusColor.args = {
119
+ content: 'Pending',
120
+ color: 'orange',
121
+ };
122
+
123
+ // Don't: Chip with too long content
124
+ export const DontLongContent = SimpleTemplate.bind({});
125
+ DontLongContent.parameters = { chromatic: { disable: true } };
126
+ DontLongContent.args = {
127
+ content:
128
+ 'This is a very long chip content that should not be used because it makes the chip difficult to read and breaks the layout',
129
+ color: 'grey',
130
+ };
131
+
132
+ export const DoShortContent = SimpleTemplate.bind({});
133
+ DoShortContent.parameters = { chromatic: { disable: true } };
134
+ DoShortContent.args = {
135
+ content: 'Status',
136
+ color: 'grey',
137
+ };
138
+
139
+ // Don't: Chip with inappropriate color
140
+ export const DontInappropriateColor = SimpleTemplate.bind({});
141
+ DontInappropriateColor.parameters = { chromatic: { disable: true } };
142
+ DontInappropriateColor.args = {
143
+ content: 'Success',
144
+ color: 'red',
145
+ };
146
+
147
+ export const DoAppropriateColor = SimpleTemplate.bind({});
148
+ DoAppropriateColor.parameters = { chromatic: { disable: true } };
149
+ DoAppropriateColor.args = {
150
+ content: 'Success',
151
+ color: 'green',
152
+ };
153
+
154
+ // Don't: Chip with empty or unclear content
155
+ export const DontEmptyContent = SimpleTemplate.bind({});
156
+ DontEmptyContent.parameters = { chromatic: { disable: true } };
157
+ DontEmptyContent.args = {
158
+ content: '',
159
+ color: 'grey',
160
+ };
161
+
162
+ export const DoClearContent = SimpleTemplate.bind({});
163
+ DoClearContent.parameters = { chromatic: { disable: true } };
164
+ DoClearContent.args = {
165
+ content: 'Active',
166
+ color: 'green',
167
+ };