@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
@@ -1,34 +1,101 @@
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 { DefaultRow as InputRadioCaptionGroupRow } from '../components/form/BmsInputRadioGroup.stories.js';
9
- import { DefaultColumn as InputRadioCaptionGroupColumn } from '../components/form/BmsInputRadioGroup.stories.js';
3
+ PlaygroundRadioGroup,
4
+ DoWithClearLabels,
5
+ DoWithCaption,
6
+ DoWithColumnLayout,
7
+ DontNoLabel,
8
+ DoWithLabel,
9
+ DontNoErrorFeedback,
10
+ DoWithErrorFeedback,
11
+ } from '../components/form/BmsInputRadioGroup.stories.js';
10
12
 
11
13
  <Meta title="Documentation/Fields/Radio Group" />
12
14
 
13
15
  # <img src="./BmsIcon.png" /> Radio Group
14
16
 
15
- A radio group consists of a set of interconnected radio buttons.
16
-
17
- ![](./fields/CoverRadioGroup.png)
17
+ A radio group consists of a set of interconnected radio buttons with a single caption that applies to all options. Radio 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.
18
18
 
19
19
  ## Anatomy
20
20
 
21
- ![InputFile representation](./fields/RadioGroupRepresentation.png)
21
+ Radio groups consist of a label that describes the overall choice, multiple radio button 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
+ ![Radio Group representation](./fields/RadioGroupRepresentation.png)
22
24
 
23
25
  ## Component
24
26
 
25
- ### Row representation
27
+ Use the controls below to interact with the component and see how it behaves with different configurations.
28
+
29
+ <Canvas of={PlaygroundRadioGroup} />
30
+
31
+ ### Props
32
+
33
+ <Controls of={PlaygroundRadioGroup} />
34
+
35
+ ## Usage Examples
36
+
37
+ ### ✅ Do: Radio group with clear labels
38
+
39
+ Always provide clear, descriptive labels for each option that explain what the choice represents.
40
+
41
+ <Canvas of={DoWithClearLabels} />
42
+
43
+ ### ✅ Do: Radio group with caption
44
+
45
+ Use a caption to provide general information that applies to all options, such as instructions, requirements, or context that helps users understand the choice.
46
+
47
+ <Canvas of={DoWithCaption} />
48
+
49
+ ### ✅ Do: Radio group in column layout
50
+
51
+ 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.
52
+
53
+ <Canvas of={DoWithColumnLayout} />
54
+
55
+ ### ✅ Do: Radio group with error feedback
56
+
57
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
58
+
59
+ <Canvas of={DoWithErrorFeedback} />
60
+
61
+ ## Rules
62
+
63
+ ### ⛔ Don't: Missing labels
64
+
65
+ Always provide a label for accessibility and clarity. Labels help screen readers and provide context about what choice is expected.
66
+
67
+ **❌ Don't:**
68
+
69
+ <Canvas of={DontNoLabel} />
70
+
71
+ **✅ Do:**
72
+
73
+ <Canvas of={DoWithLabel} />
74
+
75
+ ### ⛔ Don't: No error feedback
76
+
77
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
78
+
79
+ **❌ Don't:**
80
+
81
+ <Canvas of={DontNoErrorFeedback} />
82
+
83
+ **✅ Do:**
84
+
85
+ <Canvas of={DoWithErrorFeedback} />
86
+
87
+ ## When to use Radio Group vs Radio Caption Group
88
+
89
+ **Use Radio Group** when:
26
90
 
27
- <Canvas of={InputRadioCaptionGroupRow} args={{ label: 'toto' }} />
91
+ - All options share the same context or information
92
+ - You only need a single caption that applies to all options
93
+ - Options are simple and self-explanatory without individual descriptions
28
94
 
29
- ### Column representation
95
+ **Use Radio Caption Group** when:
30
96
 
31
- <Canvas of={InputRadioCaptionGroupColumn} args={{ label: 'toto' }} />
32
- ### Table of props
97
+ - Each option needs its own specific information or description
98
+ - You need to display different details for each choice (e.g., pricing, features, delivery times)
99
+ - Options have distinct characteristics that require individual explanation
33
100
 
34
- <Controls of={InputRadioCaptionGroupRow} />
101
+ The key difference is that Radio Group provides **one caption for the entire group**, while Radio Caption Group allows you to provide **individual captions for each option**.
@@ -1,28 +1,100 @@
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 SearchInputDefault } from '../components/form/BmsSearch.stories.js';
3
+ PlaygroundSearch,
4
+ DoWithClearPlaceholder,
5
+ DoWithValue,
6
+ DoDisabled,
7
+ DontGenericPlaceholder,
8
+ DoSpecificPlaceholder,
9
+ DontNoErrorFeedback,
10
+ DoWithErrorFeedback,
11
+ DontNoPlaceholder,
12
+ } from '../components/form/BmsSearch.stories.js';
9
13
 
10
14
  <Meta title="Documentation/Fields/Search" />
11
15
 
12
16
  # <img src="./BmsIcon.png" /> Search
13
17
 
14
- It allows users to enter text to perform a search among the data, content, or elements present in the interface they are viewing or the system.
18
+ Search components allow users to enter text to perform a search among the data, content, or elements present in the interface they are viewing or the system. They provide a dedicated input field with a search icon, making it easy for users to find and filter information. Search components are essential for interfaces with large amounts of data or content that needs to be discoverable.
15
19
 
16
- ![InputFile representation](./fields/CoverSearch.png)
20
+ ![Search representation](./fields/CoverSearch.png)
17
21
 
18
22
  ## Anatomy
19
23
 
20
- ![InputFile representation](./fields/InputSearchRepresentation.png)
24
+ Search components consist of several key elements: a search icon at the start to indicate the field's purpose, an input field where users type their search query, a clear button that appears when there is text to allow users to quickly reset the search, and placeholder text to guide users on what to search for.
25
+
26
+ ![Search representation](./fields/InputSearchRepresentation.png)
21
27
 
22
28
  ## Component
23
29
 
24
- <Canvas of={SearchInputDefault} args={{ label: 'toto' }} />
30
+ Use the controls below to interact with the component and see how it behaves with different configurations.
31
+
32
+ <Canvas of={PlaygroundSearch} />
33
+
34
+ ### Props
35
+
36
+ <Controls of={PlaygroundSearch} />
37
+
38
+ ## Usage Examples
39
+
40
+ ### ✅ Do: Search with clear placeholder
41
+
42
+ Always provide a clear, descriptive placeholder that explains what users can search for. This helps users understand the scope of the search.
43
+
44
+ <Canvas of={DoWithClearPlaceholder} />
45
+
46
+ ### ✅ Do: Search with value and clear button
47
+
48
+ When users type a search query, a clear button appears automatically, allowing them to quickly reset the search. This improves the user experience.
49
+
50
+ <Canvas of={DoWithValue} />
51
+
52
+ ### ✅ Do: Disabled state
53
+
54
+ Use the disabled state when the search should not be editable, but the current search value should still be visible.
55
+
56
+ <Canvas of={DoDisabled} />
57
+
58
+ ### ✅ Do: Search with error feedback
59
+
60
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix their search query.
61
+
62
+ <Canvas of={DoWithErrorFeedback} />
63
+
64
+ ## Rules
65
+
66
+ ### ⛔ Don't: Generic placeholder
67
+
68
+ Avoid generic placeholders like "Type here" or "Enter text". Use specific examples that guide users on what they can search for.
69
+
70
+ **❌ Don't:**
71
+
72
+ <Canvas of={DontGenericPlaceholder} />
73
+
74
+ **✅ Do:**
75
+
76
+ <Canvas of={DoSpecificPlaceholder} />
77
+
78
+ ### ⛔ Don't: No error feedback
79
+
80
+ Always provide clear error messages when search validation fails. Help users understand what went wrong and how to fix their search query.
81
+
82
+ **❌ Don't:**
83
+
84
+ <Canvas of={DontNoErrorFeedback} />
85
+
86
+ **✅ Do:**
87
+
88
+ <Canvas of={DoWithErrorFeedback} />
89
+
90
+ ### ⛔ Don't: Search without placeholder
91
+
92
+ Always provide a placeholder to guide users on what they can search for. By default we offer "Rechercher...".
93
+
94
+ **❌ Don't:**
95
+
96
+ <Canvas of={DontNoPlaceholder} />
25
97
 
26
- ### Table of props
98
+ **✅ Do:**
27
99
 
28
- <Controls of={SearchInputDefault} />
100
+ <Canvas of={DoWithClearPlaceholder} />
@@ -1,31 +1,152 @@
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 FieldDefault } from '../plugins/field/FieldComponent.stories.js';
9
- import { Default as TextDefault } from '../components/form/BmsInputText.stories.js';
10
- import BmsInput from '../components/form/BmsInputText.vue';
11
- import { Default as SelectDefault } from '../components/form/BmsSelect.stories.js';
3
+ PlaygroundSelect,
4
+ DoWithLabel,
5
+ DoWithPlaceholder,
6
+ DoWithCaption,
7
+ DoDisabled,
8
+ DoLoading,
9
+ DontLongLabel,
10
+ DoShortLabel,
11
+ DontNoLabel,
12
+ DontGenericPlaceholder,
13
+ DoSpecificPlaceholder,
14
+ DontNoErrorFeedback,
15
+ DoWithErrorFeedback,
16
+ DontNoCaption,
17
+ DoWithHelpfulCaption,
18
+ } from '../components/form/BmsSelect.stories.js';
12
19
 
13
20
  <Meta title="Documentation/Fields/Select" />
14
21
 
15
22
  # <img src="./BmsIcon.png" /> Select
16
23
 
17
- Selects (or "dropdowns")," enable users to select from a list of options within a confined area. The available options within the list may vary depending on the context.
18
-
19
- ![](./fields/CoverSelect.png)
24
+ Selects (or "dropdowns") enable users to select from a list of options within a confined area. They are essential components for forms that require users to choose from predefined options, providing a way to select single values from a list. The available options within the list may vary depending on the context. Various options can be shown with the field to communicate selection requirements and provide feedback.
20
25
 
21
26
  ## Anatomy
22
27
 
28
+ Select components consist of several key elements: a label that describes what information is needed, a select field that displays the selected value or placeholder, a dropdown icon to indicate it's a selectable field, placeholder text for guidance, captions for additional information, and error messages for validation feedback.
29
+
23
30
  ![](./fields/SelectRepresentation.png)
24
31
 
25
32
  ## Component
26
33
 
27
- <Canvas of={SelectDefault} args={{ label: 'toto' }} />
34
+ Use the controls below to interact with the component and see how it behaves with different configurations.
35
+
36
+ <Canvas of={PlaygroundSelect} />
37
+
38
+ ### Props
39
+
40
+ <Controls of={PlaygroundSelect} />
41
+
42
+ ## Usage Examples
43
+
44
+ ### ✅ Do: Simple select with label
45
+
46
+ Always provide a clear, descriptive label that explains what information is expected.
47
+
48
+ <Canvas of={DoWithLabel} />
49
+
50
+ ### ✅ Do: Select with placeholder
51
+
52
+ Use placeholders to provide examples or guidance on what to select. Placeholders help users understand what action is expected.
53
+
54
+ <Canvas of={DoWithPlaceholder} />
55
+
56
+ ### ✅ Do: Select with caption
57
+
58
+ Use captions to provide additional context, help text, or important information about the selection.
59
+
60
+ <Canvas of={DoWithCaption} />
61
+
62
+ ### ✅ Do: Disabled state
63
+
64
+ Use the disabled state when the select should not be editable, but the value should still be visible.
65
+
66
+ <Canvas of={DoDisabled} />
67
+
68
+ ### ✅ Do: Loading state
69
+
70
+ Use the loading state to indicate that the select is processing data or waiting for options to load.
71
+
72
+ <Canvas of={DoLoading} />
73
+
74
+ ### ✅ Do: Select with error feedback
75
+
76
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
77
+
78
+ <Canvas of={DoWithErrorFeedback} />
79
+
80
+ ## Rules
81
+
82
+ ### ⛔ Don't: Long labels
83
+
84
+ Avoid overly long labels that make the form difficult to scan. Keep labels concise and clear.
85
+
86
+ **❌ Don't:**
87
+
88
+ <Canvas of={DontLongLabel} />
89
+
90
+ **✅ Do:**
91
+
92
+ <Canvas of={DoShortLabel} />
93
+
94
+ ### ⛔ Don't: Missing labels
95
+
96
+ Always provide a label for accessibility and clarity. Labels help screen readers and provide context.
97
+
98
+ **❌ Don't:**
99
+
100
+ <Canvas of={DontNoLabel} />
101
+
102
+ **✅ Do:**
103
+
104
+ <Canvas of={DoWithLabel} />
105
+
106
+ ### ⛔ Don't: Generic placeholders
107
+
108
+ Avoid generic placeholders like "Select" or "Choose". Use specific examples that guide the user.
109
+
110
+ **❌ Don't:**
111
+
112
+ <Canvas of={DontGenericPlaceholder} />
113
+
114
+ **✅ Do:**
115
+
116
+ <Canvas of={DoSpecificPlaceholder} />
117
+
118
+ ### ⛔ Don't: No error feedback
119
+
120
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
121
+
122
+ **❌ Don't:**
123
+
124
+ <Canvas of={DontNoErrorFeedback} />
125
+
126
+ **✅ Do:**
127
+
128
+ <Canvas of={DoWithErrorFeedback} />
129
+
130
+ ### ⛔ Don't: Missing helpful captions
131
+
132
+ When selection requirements are complex, provide captions to help users understand what's expected.
133
+
134
+ **❌ Don't:**
135
+
136
+ <Canvas of={DontNoCaption} />
137
+
138
+ **✅ Do:**
139
+
140
+ <Canvas of={DoWithHelpfulCaption} />
141
+
142
+ ### ⚠️ Note: When to use Radio instead of Select
143
+
144
+ For a small number of options (especially 2 options), consider using the Radio component instead of Select. Radio buttons provide better visibility of all available options and require fewer interactions from users. Selects are better suited for longer lists of options (typically 5 or more) or when space is limited.
145
+
146
+ **❌ Don't: Use Select with only 2 options**
147
+
148
+ When you have only 2 options, a Select dropdown adds unnecessary complexity. Users have to click to see options that could be immediately visible.
28
149
 
29
- ### Table of props
150
+ **✅ Do: Use Radio for 2-3 options**
30
151
 
31
- <Controls of={SelectDefault} />
152
+ For binary choices or a small number of options, Radio buttons allow users to see all options at once and make a selection with a single click.
@@ -1,28 +1,108 @@
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 TagDefault } from '../components/form/BmsTag.stories.js';
3
+ PlaygroundTag,
4
+ DoWithClearContent,
5
+ DoWithDismissible,
6
+ DoWithActiveState,
7
+ DoWithDisabledState,
8
+ DoWithShortContent,
9
+ DontLongContent,
10
+ DontEmptyContent,
11
+ DoClearContent,
12
+ DontCantDismissWhenNeeded,
13
+ DoCanDismiss,
14
+ } from '../components/form/BmsTag.stories.js';
9
15
 
10
16
  <Meta title="Documentation/Tag" />
11
17
 
12
18
  # <img src="./BmsIcon.png" /> Tag
13
19
 
14
- Tags are components that allow users to add differents options to forms or interfaces. A tag can be active or desactive by the user and closable (its the principal difference with Chips).
20
+ Tags are interactive components that allow users to add, select, and remove options in forms or interfaces. Tags can be clicked to toggle their active state and can be dismissed (closed) by users. They are commonly used for filters, selections, categories, and removable items. Tags provide a way for users to interact with and manage multiple options in a compact, visual format.
15
21
 
16
22
  ![Tag representation](./tag/CoverTag.png)
17
23
 
18
24
  ## Anatomy
19
25
 
26
+ Tags consist of a container with a border, text content, and an optional dismiss button. They can be in an active or inactive state, and can be disabled. Tags are designed to be interactive elements that users can click to toggle or dismiss.
27
+
20
28
  ![Tag representation](./tag/TagRepresentation.png)
21
29
 
22
30
  ## Component
23
31
 
24
- <Canvas of={TagDefault} 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={PlaygroundTag} />
35
+
36
+ ### Props
37
+
38
+ <Controls of={PlaygroundTag} />
39
+
40
+ ## Usage Examples
41
+
42
+ ### ✅ Do: Tag 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: Tag with dismissible option
49
+
50
+ Use dismissible tags when users need to remove items, such as filters or selected options.
51
+
52
+ <Canvas of={DoWithDismissible} />
53
+
54
+ ### ✅ Do: Tag with active state
55
+
56
+ Use the active state to indicate that a tag is currently selected or applied. Active tags have a filled background.
57
+
58
+ <Canvas of={DoWithActiveState} />
59
+
60
+ ### ✅ Do: Tag with disabled state
61
+
62
+ Use the disabled state when a tag should be visible but not interactive. This is useful for showing locked or unavailable options.
63
+
64
+ <Canvas of={DoWithDisabledState} />
65
+
66
+ ### ✅ Do: Tag with short content
67
+
68
+ Keep tag content short and concise. Tags are meant to display brief information that users can quickly scan and interact with.
69
+
70
+ <Canvas of={DoWithShortContent} />
71
+
72
+ ## Rules
73
+
74
+ ### ⛔ Don't: Long content
75
+
76
+ Avoid overly long content in tags. Long text makes tags difficult to read, breaks the layout, and defeats the purpose of compact, scannable elements.
77
+
78
+ **❌ Don't:**
79
+
80
+ <Canvas of={DontLongContent} />
81
+
82
+ **✅ Do:**
83
+
84
+ <Canvas of={DoWithShortContent} />
85
+
86
+ ### ⛔ Don't: Empty or unclear content
87
+
88
+ Always provide meaningful content in tags. Empty tags or unclear labels don't provide value to users and make the interface confusing.
89
+
90
+ **❌ Don't:**
91
+
92
+ <Canvas of={DontEmptyContent} />
93
+
94
+ **✅ Do:**
95
+
96
+ <Canvas of={DoClearContent} />
97
+
98
+ ### ⛔ Don't: Tag that cannot be dismissed when it should
99
+
100
+ If a tag represents something that users should be able to remove (like a filter or a selected option), make sure it can be dismissed. Non-dismissible tags should only be used for permanent or required items.
101
+
102
+ **❌ Don't:**
103
+
104
+ <Canvas of={DontCantDismissWhenNeeded} />
25
105
 
26
- ### Table of props
106
+ **✅ Do:**
27
107
 
28
- <Controls of={TagDefault} />
108
+ <Canvas of={DoCanDismiss} />
@@ -1,27 +1,140 @@
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 TextAreaDefault } from '../components/form/BmsTextArea.stories.js';
3
+ PlaygroundTextArea,
4
+ DoWithLabel,
5
+ DoWithPlaceholder,
6
+ DoWithCaption,
7
+ DoDisabled,
8
+ DoLoading,
9
+ DontLongLabel,
10
+ DoShortLabel,
11
+ DontNoLabel,
12
+ DontGenericPlaceholder,
13
+ DoSpecificPlaceholder,
14
+ DontNoErrorFeedback,
15
+ DoWithErrorFeedback,
16
+ DontNoCaption,
17
+ DoWithHelpfulCaption,
18
+ } from '../components/form/BmsTextArea.stories.js';
9
19
 
10
20
  <Meta title="Documentation/Fields/Text Area" />
11
21
 
12
22
  # <img src="./BmsIcon.png" /> Text Area
13
23
 
14
- Text area allows users to input and edit multiple lines of text such as paragraphs, comments, or descriptions.
15
- ![InputFile representation](./fields/CoverTextArea.png)
24
+ Text area allows users to input and edit multiple lines of text such as paragraphs, comments, or descriptions. They are essential components for forms that require longer text entries, providing a way for users to enter detailed information, feedback, or multi-line content. Various options can be shown with the field to communicate input requirements and provide feedback.
16
25
 
17
26
  ## Anatomy
18
27
 
19
- ![InputFile representation](./fields/InputTextAreaRepresentation.png)
28
+ Text areas consist of several key elements: a label that describes what information is needed, a textarea field where users type multiple lines of text, placeholder text for guidance, captions for additional information, and error messages for validation feedback.
29
+
30
+ ![](./fields/InputTextAreaRepresentation.png)
20
31
 
21
32
  ## Component
22
33
 
23
- <Canvas of={TextAreaDefault} args={{ label: 'toto' }} />
34
+ Use the controls below to interact with the component and see how it behaves with different configurations.
35
+
36
+ <Canvas of={PlaygroundTextArea} />
37
+
38
+ ### Props
39
+
40
+ <Controls of={PlaygroundTextArea} />
41
+
42
+ ## Usage Examples
43
+
44
+ ### ✅ Do: Simple textarea with label
45
+
46
+ Always provide a clear, descriptive label that explains what information is expected.
47
+
48
+ <Canvas of={DoWithLabel} />
49
+
50
+ ### ✅ Do: Textarea with placeholder
51
+
52
+ Use placeholders to provide examples or format hints. Placeholders disappear when the user starts typing.
53
+
54
+ <Canvas of={DoWithPlaceholder} />
55
+
56
+ ### ✅ Do: Textarea with caption
57
+
58
+ Use captions to provide additional context, help text, or format requirements such as character limits.
59
+
60
+ <Canvas of={DoWithCaption} />
61
+
62
+ ### ✅ Do: Disabled state
63
+
64
+ Use the disabled state when the textarea should not be editable, but the value should still be visible.
65
+
66
+ <Canvas of={DoDisabled} />
67
+
68
+ ### ✅ Do: Loading state
69
+
70
+ Use the loading state to indicate that the textarea is processing data or waiting for a response.
71
+
72
+ <Canvas of={DoLoading} />
73
+
74
+ ### ✅ Do: Textarea with error feedback
75
+
76
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
77
+
78
+ <Canvas of={DoWithErrorFeedback} />
79
+
80
+ ## Rules
81
+
82
+ ### ⛔ Don't: Long labels
83
+
84
+ Avoid overly long labels that make the form difficult to scan. Keep labels concise and clear.
85
+
86
+ **❌ Don't:**
87
+
88
+ <Canvas of={DontLongLabel} />
89
+
90
+ **✅ Do:**
91
+
92
+ <Canvas of={DoShortLabel} />
93
+
94
+ ### ⛔ Don't: Missing labels
95
+
96
+ Always provide a label for accessibility and clarity. Labels help screen readers and provide context.
97
+
98
+ **❌ Don't:**
99
+
100
+ <Canvas of={DontNoLabel} />
101
+
102
+ **✅ Do:**
103
+
104
+ <Canvas of={DoWithLabel} />
105
+
106
+ ### ⛔ Don't: Generic placeholders
107
+
108
+ Avoid generic placeholders like "Enter text" or "Type here". Use specific examples that guide the user.
109
+
110
+ **❌ Don't:**
111
+
112
+ <Canvas of={DontGenericPlaceholder} />
113
+
114
+ **✅ Do:**
115
+
116
+ <Canvas of={DoSpecificPlaceholder} />
117
+
118
+ ### ⛔ Don't: No error feedback
119
+
120
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
121
+
122
+ **❌ Don't:**
123
+
124
+ <Canvas of={DontNoErrorFeedback} />
125
+
126
+ **✅ Do:**
127
+
128
+ <Canvas of={DoWithErrorFeedback} />
129
+
130
+ ### ⛔ Don't: Missing helpful captions
131
+
132
+ When textarea requirements are complex, provide captions to help users understand what's expected.
133
+
134
+ **❌ Don't:**
135
+
136
+ <Canvas of={DontNoCaption} />
24
137
 
25
- ### Table of props
138
+ **✅ Do:**
26
139
 
27
- <Controls of={TextAreaDefault} />
140
+ <Canvas of={DoWithHelpfulCaption} />