@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.
- package/dist/components/button/BmsButton.vue.d.ts +1 -1
- package/dist/components/button/BmsIconButton.vue.d.ts +1 -1
- package/dist/components/button/UiButton.vue.d.ts +1 -1
- package/dist/components/layout/BmsHeaderTitle.vue.d.ts +1 -1
- package/dist/components/navigation/BmsBreadcrumb.vue.d.ts +1 -1
- package/dist/components/navigation/BmsShortLinkMenu.vue.d.ts +2 -2
- package/dist/components/table/BmsPagination.vue.d.ts +2 -2
- package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
- package/dist/sipa-bms-ui.css +16 -16
- package/dist/sipa-bms-ui.es.js +3608 -3142
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +3608 -3142
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +18 -18
- package/src/components/button/BmsButton.stories.js +142 -3
- package/src/components/form/BmsChip.stories.js +104 -2
- package/src/components/form/BmsInputCheckboxCaptionGroup.stories.js +157 -2
- package/src/components/form/BmsInputCheckboxGroup.stories.js +119 -2
- package/src/components/form/BmsInputCode.stories.js +109 -2
- package/src/components/form/BmsInputFile.stories.js +110 -2
- package/src/components/form/BmsInputRadioCaptionGroup.stories.js +138 -2
- package/src/components/form/BmsInputRadioGroup.stories.js +120 -2
- package/src/components/form/BmsInputText.stories.js +269 -1
- package/src/components/form/BmsMultiSelect.vue +3 -1
- package/src/components/form/BmsSearch.stories.js +89 -2
- package/src/components/form/BmsSelect.stories.js +220 -2
- package/src/components/form/BmsSelect.vue +5 -3
- package/src/components/form/BmsTag.stories.js +119 -3
- package/src/components/form/BmsTextArea.stories.js +146 -2
- package/src/components/form/RawAutocomplete.vue +3 -1
- package/src/components/layout/BmsForm.stories.js +216 -0
- package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
- package/src/components/table/BmsTable.stories.js +247 -1
- package/src/documentation/button/secondaryButton.mdx +114 -3
- package/src/documentation/checkboxCaptionGroup.mdx +99 -0
- package/src/documentation/checkboxGroup.mdx +99 -0
- package/src/documentation/chip.mdx +85 -11
- package/src/documentation/inputCode.mdx +97 -0
- package/src/documentation/inputFile.mdx +90 -13
- package/src/documentation/inputText.mdx +183 -0
- package/src/documentation/layout/form.mdx +74 -0
- package/src/documentation/layout/headerTitle.mdx +124 -0
- package/src/documentation/layout/table.mdx +111 -0
- package/src/documentation/radioCaptionGroup.mdx +86 -19
- package/src/documentation/radioGroup.mdx +85 -18
- package/src/documentation/search.mdx +85 -13
- package/src/documentation/select.mdx +137 -16
- package/src/documentation/tag.mdx +91 -11
- package/src/documentation/textArea.mdx +126 -13
- package/src/documentation/fields_text.mdx +0 -31
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import {
|
|
3
|
+
PlaygroundTable,
|
|
4
|
+
DoWithSearch,
|
|
5
|
+
DoWithoutSearch,
|
|
6
|
+
DoWithFilters,
|
|
7
|
+
DoWithoutFilters,
|
|
8
|
+
DoWithCustomActions,
|
|
9
|
+
DoWithActionIcons,
|
|
10
|
+
DoWithSearchAndFilters,
|
|
11
|
+
DoWithSearchFiltersAndActions,
|
|
12
|
+
DoWithRowSelection,
|
|
13
|
+
} from '../../components/table/BmsTable.stories.js';
|
|
14
|
+
|
|
15
|
+
<Meta title="Documentation/Layout/Table" />
|
|
16
|
+
|
|
17
|
+
# <img src="../BmsIcon.png" /> Table
|
|
18
|
+
|
|
19
|
+
Table is a comprehensive component for displaying structured data in rows and columns. It provides powerful features including search, filtering, sorting, pagination, and row selection. Tables are essential for displaying large amounts of data in an organized and interactive way, allowing users to find, filter, and manipulate information efficiently.
|
|
20
|
+
|
|
21
|
+
## Anatomy
|
|
22
|
+
|
|
23
|
+
Table components consist of several key elements: column headers (with optional sorting), data rows, a search bar (optional), filter controls (optional), custom action buttons (optional), pagination controls, and selection checkboxes (when selectable). The table can display data in normal or dense mode, and supports various interaction patterns.
|
|
24
|
+
|
|
25
|
+
## Component
|
|
26
|
+
|
|
27
|
+
Use the controls below to interact with the component and see how it behaves with different configurations.
|
|
28
|
+
|
|
29
|
+
<Canvas of={PlaygroundTable} />
|
|
30
|
+
|
|
31
|
+
### Props
|
|
32
|
+
|
|
33
|
+
<Controls of={PlaygroundTable} />
|
|
34
|
+
|
|
35
|
+
## Usage Examples
|
|
36
|
+
|
|
37
|
+
### ✅ Do: Table with search
|
|
38
|
+
|
|
39
|
+
Enable search functionality when users need to quickly find specific data within the table. The search bar allows users to filter rows by any column value.
|
|
40
|
+
|
|
41
|
+
<Canvas of={DoWithSearch} />
|
|
42
|
+
|
|
43
|
+
### ✅ Do: Table without search
|
|
44
|
+
|
|
45
|
+
Disable search when the table contains a small amount of data or when search functionality is not needed. This simplifies the interface and reduces visual clutter.
|
|
46
|
+
|
|
47
|
+
<Canvas of={DoWithoutSearch} />
|
|
48
|
+
|
|
49
|
+
### ✅ Do: Table with filters
|
|
50
|
+
|
|
51
|
+
Use filters when users need to filter data by specific criteria (e.g., status, category, date range). Filters provide more precise control than search and are ideal for structured filtering.
|
|
52
|
+
|
|
53
|
+
<Canvas of={DoWithFilters} />
|
|
54
|
+
|
|
55
|
+
### ✅ Do: Table without filters
|
|
56
|
+
|
|
57
|
+
Omit filters when the data doesn't require structured filtering or when the table is simple enough that search alone is sufficient.
|
|
58
|
+
|
|
59
|
+
<Canvas of={DoWithoutFilters} />
|
|
60
|
+
|
|
61
|
+
### ✅ Do: Table with custom actions
|
|
62
|
+
|
|
63
|
+
Add custom action tags when users need quick filter options or preset filters. Tags provide a visual way to apply common filters automatically. Custom actions appear in the table header.
|
|
64
|
+
|
|
65
|
+
<Canvas of={DoWithCustomActions} />
|
|
66
|
+
|
|
67
|
+
### ✅ Do: Table with action icons
|
|
68
|
+
|
|
69
|
+
Add action icons (edit, delete, etc.) in a dedicated actions column when users need to perform actions on individual rows. Action icons provide quick access to row-level operations.
|
|
70
|
+
|
|
71
|
+
<Canvas of={DoWithActionIcons} />
|
|
72
|
+
|
|
73
|
+
### ✅ Do: Table with search and filters
|
|
74
|
+
|
|
75
|
+
Combine search and filters when users need both quick text search and structured filtering. This provides maximum flexibility for finding and organizing data.
|
|
76
|
+
|
|
77
|
+
<Canvas of={DoWithSearchAndFilters} />
|
|
78
|
+
|
|
79
|
+
### ✅ Do: Table with search, filters and actions
|
|
80
|
+
|
|
81
|
+
Use all three features (search, filters, and actions) when the table is complex and users need comprehensive data management capabilities.
|
|
82
|
+
|
|
83
|
+
<Canvas of={DoWithSearchFiltersAndActions} />
|
|
84
|
+
|
|
85
|
+
### ✅ Do: Table with row selection
|
|
86
|
+
|
|
87
|
+
Enable row selection when users need to select one or multiple rows to perform actions on them. Selection checkboxes appear in the first column, and selected rows are highlighted.
|
|
88
|
+
|
|
89
|
+
<Canvas of={DoWithRowSelection} />
|
|
90
|
+
|
|
91
|
+
## Rules
|
|
92
|
+
|
|
93
|
+
### When to use search
|
|
94
|
+
|
|
95
|
+
- **Use search** when users need to quickly find specific text across multiple columns
|
|
96
|
+
- **Don't use search** when the table is very small (fewer than 10 rows) or when filtering by specific criteria is more appropriate
|
|
97
|
+
|
|
98
|
+
### When to use filters
|
|
99
|
+
|
|
100
|
+
- **Use filters** when users need to filter by specific structured criteria (status, category, date ranges, etc.)
|
|
101
|
+
- **Don't use filters** when the data is simple and search alone is sufficient, or when filtering would add unnecessary complexity
|
|
102
|
+
|
|
103
|
+
### When to use custom actions
|
|
104
|
+
|
|
105
|
+
- **Use custom actions** when users need quick filter options or preset filters. Tags are ideal for common filter presets that users frequently apply
|
|
106
|
+
- **Don't use custom actions** when no quick filters are needed or when all filtering can be handled through the filter panel
|
|
107
|
+
|
|
108
|
+
### When to use row selection
|
|
109
|
+
|
|
110
|
+
- **Use row selection** when users need to select one or multiple rows to perform actions on them (delete, export, bulk edit, etc.)
|
|
111
|
+
- **Don't use row selection** when no bulk operations are needed or when actions should be performed individually on each row
|
|
@@ -1,34 +1,101 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
PlaygroundRadioCaptionGroup,
|
|
4
|
+
DoWithClearLabels,
|
|
5
|
+
DoWithHelpfulCaptions,
|
|
6
|
+
DoWithColumnLayout,
|
|
7
|
+
DontNoLabel,
|
|
8
|
+
DoWithLabel,
|
|
9
|
+
DontNoCaptions,
|
|
10
|
+
DoWithErrorFeedback,
|
|
11
|
+
} from '../components/form/BmsInputRadioCaptionGroup.stories.js';
|
|
10
12
|
|
|
11
13
|
<Meta title="Documentation/Fields/Radio Caption Group" />
|
|
12
14
|
|
|
13
|
-
# <img src="./BmsIcon.png" /> Radio Group
|
|
15
|
+
# <img src="./BmsIcon.png" /> Radio Caption Group
|
|
14
16
|
|
|
15
|
-
A radio caption group consists of a set of interconnected radio buttons.
|
|
16
|
-
|
|
17
|
-

|
|
17
|
+
A radio caption group consists of a set of interconnected radio buttons where each option can have its own caption. This allows you to provide specific information or descriptions for each individual choice. Radio caption groups are ideal when each option needs its own contextual information, such as pricing details, feature descriptions, or specific instructions for each choice.
|
|
18
18
|
|
|
19
19
|
## Anatomy
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Radio caption groups consist of a label that describes the overall choice, multiple radio button 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
|
+

|
|
22
24
|
|
|
23
25
|
## Component
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
Use the controls below to interact with the component and see how it behaves with different configurations.
|
|
28
|
+
|
|
29
|
+
<Canvas of={PlaygroundRadioCaptionGroup} />
|
|
30
|
+
|
|
31
|
+
### Props
|
|
32
|
+
|
|
33
|
+
<Controls of={PlaygroundRadioCaptionGroup} />
|
|
34
|
+
|
|
35
|
+
## Usage Examples
|
|
36
|
+
|
|
37
|
+
### ✅ Do: Radio caption 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 caption group with helpful captions
|
|
44
|
+
|
|
45
|
+
Use captions to provide specific information for each option, such as pricing, features, or additional context that helps users make an informed decision.
|
|
46
|
+
|
|
47
|
+
<Canvas of={DoWithHelpfulCaptions} />
|
|
48
|
+
|
|
49
|
+
### ✅ Do: Radio caption group in column layout
|
|
50
|
+
|
|
51
|
+
Use the column layout when you have longer option labels or captions, or when you want to display options vertically for better readability.
|
|
52
|
+
|
|
53
|
+
<Canvas of={DoWithColumnLayout} />
|
|
54
|
+
|
|
55
|
+
### ✅ Do: Radio caption 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 captions when needed
|
|
76
|
+
|
|
77
|
+
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.
|
|
78
|
+
|
|
79
|
+
**❌ Don't:**
|
|
80
|
+
|
|
81
|
+
<Canvas of={DontNoCaptions} />
|
|
82
|
+
|
|
83
|
+
**✅ Do:**
|
|
84
|
+
|
|
85
|
+
<Canvas of={DoWithHelpfulCaptions} />
|
|
86
|
+
|
|
87
|
+
## When to use Radio Caption Group vs Radio Group
|
|
88
|
+
|
|
89
|
+
**Use Radio Caption Group** when:
|
|
26
90
|
|
|
27
|
-
|
|
91
|
+
- Each option needs its own specific information or description
|
|
92
|
+
- You need to display different details for each choice (e.g., pricing, features, delivery times)
|
|
93
|
+
- Options have distinct characteristics that require individual explanation
|
|
28
94
|
|
|
29
|
-
|
|
95
|
+
**Use Radio Group** when:
|
|
30
96
|
|
|
31
|
-
|
|
32
|
-
|
|
97
|
+
- All options share the same context or information
|
|
98
|
+
- You only need a single caption that applies to all options
|
|
99
|
+
- Options are simple and self-explanatory without individual descriptions
|
|
33
100
|
|
|
34
|
-
|
|
101
|
+
The key difference is that Radio Caption Group allows you to provide **individual captions for each option**, while Radio Group provides **one caption for the entire group**.
|
|
@@ -1,34 +1,101 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-

|
|
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
|
-
|
|
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
|
+

|
|
22
24
|
|
|
23
25
|
## Component
|
|
24
26
|
|
|
25
|
-
|
|
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
|
-
|
|
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
|
-
|
|
95
|
+
**Use Radio Caption Group** when:
|
|
30
96
|
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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
|
-

|
|
17
21
|
|
|
18
22
|
## Anatomy
|
|
19
23
|
|
|
20
|
-
|
|
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
|
+

|
|
21
27
|
|
|
22
28
|
## Component
|
|
23
29
|
|
|
24
|
-
|
|
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
|
-
|
|
98
|
+
**✅ Do:**
|
|
27
99
|
|
|
28
|
-
<
|
|
100
|
+
<Canvas of={DoWithClearPlaceholder} />
|
|
@@ -1,31 +1,152 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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")
|
|
18
|
-
|
|
19
|
-

|
|
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
|

|
|
24
31
|
|
|
25
32
|
## Component
|
|
26
33
|
|
|
27
|
-
|
|
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
|
-
|
|
150
|
+
**✅ Do: Use Radio for 2-3 options**
|
|
30
151
|
|
|
31
|
-
|
|
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.
|