@ouestfrance/sipa-bms-ui 8.22.1 → 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,97 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import {
|
|
3
|
+
PlaygroundInputCode,
|
|
4
|
+
DoWithClearLabel,
|
|
5
|
+
DoWithHtmlType,
|
|
6
|
+
DoWithJsonType,
|
|
7
|
+
DoWithCaption,
|
|
8
|
+
DoDisabled,
|
|
9
|
+
DontNoLabel,
|
|
10
|
+
DoWithLabel,
|
|
11
|
+
DontNoErrorFeedback,
|
|
12
|
+
DoWithErrorFeedback,
|
|
13
|
+
} from '../components/form/BmsInputCode.stories.js';
|
|
14
|
+
|
|
15
|
+
<Meta title="Documentation/Fields/Input Code" />
|
|
16
|
+
|
|
17
|
+
# <img src="./BmsIcon.png" /> Input Code
|
|
18
|
+
|
|
19
|
+
Input Code is a component for editing code with syntax highlighting and validation. It provides a code editor interface powered by CodeMirror, supporting HTML and JSON formats. The component includes automatic syntax validation for JSON and syntax highlighting for both HTML and JSON. It is ideal for configuration forms, template editing, or any scenario where users need to input and edit code.
|
|
20
|
+
|
|
21
|
+
## Anatomy
|
|
22
|
+
|
|
23
|
+
Input code components consist of several key elements: a label that describes what code is expected, a code editor with syntax highlighting, automatic validation for JSON (with error indicators), optional captions for additional information, and error messages for validation feedback.
|
|
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={PlaygroundInputCode} />
|
|
30
|
+
|
|
31
|
+
### Props
|
|
32
|
+
|
|
33
|
+
<Controls of={PlaygroundInputCode} />
|
|
34
|
+
|
|
35
|
+
## Usage Examples
|
|
36
|
+
|
|
37
|
+
### ✅ Do: Input code with clear label
|
|
38
|
+
|
|
39
|
+
Always provide a clear, descriptive label that explains what type of code is expected (HTML, JSON, etc.).
|
|
40
|
+
|
|
41
|
+
<Canvas of={DoWithClearLabel} />
|
|
42
|
+
|
|
43
|
+
### ✅ Do: Input code with HTML type
|
|
44
|
+
|
|
45
|
+
Use the HTML type when users need to edit HTML templates or markup. The editor provides HTML syntax highlighting.
|
|
46
|
+
|
|
47
|
+
<Canvas of={DoWithHtmlType} />
|
|
48
|
+
|
|
49
|
+
### ✅ Do: Input code with JSON type and validation
|
|
50
|
+
|
|
51
|
+
Use the JSON type when users need to edit JSON configuration. The editor provides JSON syntax highlighting and automatic validation with error indicators.
|
|
52
|
+
|
|
53
|
+
<Canvas of={DoWithJsonType} />
|
|
54
|
+
|
|
55
|
+
### ✅ Do: Input code with caption
|
|
56
|
+
|
|
57
|
+
Use captions to provide additional context, such as format requirements, examples, or validation rules.
|
|
58
|
+
|
|
59
|
+
<Canvas of={DoWithCaption} />
|
|
60
|
+
|
|
61
|
+
### ✅ Do: Disabled state
|
|
62
|
+
|
|
63
|
+
Use the disabled state when the code should not be editable, but the current code should still be visible.
|
|
64
|
+
|
|
65
|
+
<Canvas of={DoDisabled} />
|
|
66
|
+
|
|
67
|
+
### ✅ Do: Input code with error feedback
|
|
68
|
+
|
|
69
|
+
Always provide clear error messages when validation fails. For JSON, syntax errors are automatically detected and displayed.
|
|
70
|
+
|
|
71
|
+
<Canvas of={DoWithErrorFeedback} />
|
|
72
|
+
|
|
73
|
+
## Rules
|
|
74
|
+
|
|
75
|
+
### ⛔ Don't: Missing labels
|
|
76
|
+
|
|
77
|
+
Always provide a label for accessibility and clarity. Labels help screen readers and provide context about what code is expected.
|
|
78
|
+
|
|
79
|
+
**❌ Don't:**
|
|
80
|
+
|
|
81
|
+
<Canvas of={DontNoLabel} />
|
|
82
|
+
|
|
83
|
+
**✅ Do:**
|
|
84
|
+
|
|
85
|
+
<Canvas of={DoWithLabel} />
|
|
86
|
+
|
|
87
|
+
### ⛔ Don't: No error feedback
|
|
88
|
+
|
|
89
|
+
Always provide clear error messages when validation fails. For JSON, the editor automatically detects syntax errors, but you should also provide custom error messages when needed.
|
|
90
|
+
|
|
91
|
+
**❌ Don't:**
|
|
92
|
+
|
|
93
|
+
<Canvas of={DontNoErrorFeedback} />
|
|
94
|
+
|
|
95
|
+
**✅ Do:**
|
|
96
|
+
|
|
97
|
+
<Canvas of={DoWithErrorFeedback} />
|
|
@@ -1,28 +1,105 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
PlaygroundInputFile,
|
|
4
|
+
DoWithClearLabel,
|
|
5
|
+
DoWithCaption,
|
|
6
|
+
DoWithAcceptFilter,
|
|
7
|
+
DoDisabled,
|
|
8
|
+
DontNoLabel,
|
|
9
|
+
DoWithLabel,
|
|
10
|
+
DontNoErrorFeedback,
|
|
11
|
+
DoWithErrorFeedback,
|
|
12
|
+
DontNoCaption,
|
|
13
|
+
} from '../components/form/BmsInputFile.stories.js';
|
|
9
14
|
|
|
10
15
|
<Meta title="Documentation/Fields/Input File" />
|
|
11
16
|
|
|
12
17
|
# <img src="./BmsIcon.png" /> Input File
|
|
13
18
|
|
|
14
|
-
InputFile is a component for uploading one file. After upload
|
|
15
|
-
|
|
16
|
-

|
|
19
|
+
InputFile is a component for uploading one file. After upload, it shows the result. The component supports drag and drop functionality, file type filtering, size limits, and displays uploaded files with previews for images. It provides a user-friendly way to upload files in forms and interfaces.
|
|
17
20
|
|
|
18
21
|
## Anatomy
|
|
19
22
|
|
|
23
|
+
Input file components consist of several key elements: a label that describes what file is expected, a drop area where users can drag and drop files or click to browse, an optional caption for additional information like file size limits or accepted types, error messages for validation feedback, and a file preview area that shows uploaded files with the ability to remove them.
|
|
24
|
+
|
|
20
25
|

|
|
21
26
|
|
|
22
27
|
## Component
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
Use the controls below to interact with the component and see how it behaves with different configurations.
|
|
30
|
+
|
|
31
|
+
<Canvas of={PlaygroundInputFile} />
|
|
32
|
+
|
|
33
|
+
### Props
|
|
34
|
+
|
|
35
|
+
<Controls of={PlaygroundInputFile} />
|
|
36
|
+
|
|
37
|
+
## Usage Examples
|
|
38
|
+
|
|
39
|
+
### ✅ Do: Input file with clear label
|
|
40
|
+
|
|
41
|
+
Always provide a clear, descriptive label that explains what type of file is expected.
|
|
42
|
+
|
|
43
|
+
<Canvas of={DoWithClearLabel} />
|
|
44
|
+
|
|
45
|
+
### ✅ Do: Input file with caption
|
|
46
|
+
|
|
47
|
+
Use captions to provide additional context, such as file size limits, accepted file types, or format requirements.
|
|
48
|
+
|
|
49
|
+
<Canvas of={DoWithCaption} />
|
|
50
|
+
|
|
51
|
+
### ✅ Do: Input file with accept filter
|
|
52
|
+
|
|
53
|
+
Use the accept prop to restrict file types. This helps users understand what files they can upload and prevents invalid uploads.
|
|
54
|
+
|
|
55
|
+
<Canvas of={DoWithAcceptFilter} />
|
|
56
|
+
|
|
57
|
+
### ✅ Do: Disabled state
|
|
58
|
+
|
|
59
|
+
Use the disabled state when the file upload should not be available, but the current state should still be visible.
|
|
60
|
+
|
|
61
|
+
<Canvas of={DoDisabled} />
|
|
62
|
+
|
|
63
|
+
### ✅ Do: Input file with error feedback
|
|
64
|
+
|
|
65
|
+
Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
|
|
66
|
+
|
|
67
|
+
<Canvas of={DoWithErrorFeedback} />
|
|
68
|
+
|
|
69
|
+
## Rules
|
|
70
|
+
|
|
71
|
+
### ⛔ Don't: Missing labels
|
|
72
|
+
|
|
73
|
+
Always provide a label for accessibility and clarity. Labels help screen readers and provide context about what file is expected.
|
|
74
|
+
|
|
75
|
+
**❌ Don't:**
|
|
76
|
+
|
|
77
|
+
<Canvas of={DontNoLabel} />
|
|
78
|
+
|
|
79
|
+
**✅ Do:**
|
|
80
|
+
|
|
81
|
+
<Canvas of={DoWithLabel} />
|
|
82
|
+
|
|
83
|
+
### ⛔ Don't: No error feedback
|
|
84
|
+
|
|
85
|
+
Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
|
|
86
|
+
|
|
87
|
+
**❌ Don't:**
|
|
88
|
+
|
|
89
|
+
<Canvas of={DontNoErrorFeedback} />
|
|
90
|
+
|
|
91
|
+
**✅ Do:**
|
|
92
|
+
|
|
93
|
+
<Canvas of={DoWithErrorFeedback} />
|
|
94
|
+
|
|
95
|
+
### ⛔ Don't: No caption for file requirements
|
|
96
|
+
|
|
97
|
+
When file requirements are specific (size limits, file types, etc.), provide captions to help users understand what's expected.
|
|
98
|
+
|
|
99
|
+
**❌ Don't:**
|
|
100
|
+
|
|
101
|
+
<Canvas of={DontNoCaption} />
|
|
25
102
|
|
|
26
|
-
|
|
103
|
+
**✅ Do:**
|
|
27
104
|
|
|
28
|
-
<
|
|
105
|
+
<Canvas of={DoWithCaption} />
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import {
|
|
3
|
+
PlaygroundInputText,
|
|
4
|
+
DoWithLabel,
|
|
5
|
+
DoWithPlaceholder,
|
|
6
|
+
DoWithCaption,
|
|
7
|
+
DoWithIconStart,
|
|
8
|
+
DoWithIconEnd,
|
|
9
|
+
DoWithIcons,
|
|
10
|
+
DoDisabled,
|
|
11
|
+
DoLoading,
|
|
12
|
+
DoWithMaxLength,
|
|
13
|
+
DoWithMinMaxLength,
|
|
14
|
+
DontLongLabel,
|
|
15
|
+
DoShortLabel,
|
|
16
|
+
DontNoLabel,
|
|
17
|
+
DontGenericPlaceholder,
|
|
18
|
+
DoSpecificPlaceholder,
|
|
19
|
+
DontTooManyIcons,
|
|
20
|
+
DoOneIcon,
|
|
21
|
+
DontNoErrorFeedback,
|
|
22
|
+
DoWithErrorFeedback,
|
|
23
|
+
DontNoCaption,
|
|
24
|
+
DoWithHelpfulCaption,
|
|
25
|
+
} from '../components/form/BmsInputText.stories.js';
|
|
26
|
+
|
|
27
|
+
<Meta title="Documentation/Fields/Input Text" />
|
|
28
|
+
|
|
29
|
+
# <img src="./BmsIcon.png" /> Input Text
|
|
30
|
+
|
|
31
|
+
Text fields allow users to input custom text entries with a keyboard. They are essential components for forms and data collection, providing a way for users to enter text, numbers, dates, and other information. Various options can be shown with the field to communicate input requirements and provide feedback.
|
|
32
|
+
|
|
33
|
+
## Anatomy
|
|
34
|
+
|
|
35
|
+
Text inputs consist of several key elements: a label that describes what information is needed, an input field where users type, optional icons for visual cues, placeholder text for guidance, captions for additional information, and error messages for validation feedback.
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
## Component
|
|
40
|
+
|
|
41
|
+
Use the controls below to interact with the component and see how it behaves with different configurations.
|
|
42
|
+
|
|
43
|
+
<Canvas of={PlaygroundInputText} />
|
|
44
|
+
|
|
45
|
+
### Props
|
|
46
|
+
|
|
47
|
+
<Controls of={PlaygroundInputText} />
|
|
48
|
+
|
|
49
|
+
## Usage Examples
|
|
50
|
+
|
|
51
|
+
### ✅ Do: Simple input with label
|
|
52
|
+
|
|
53
|
+
Always provide a clear, descriptive label that explains what information is expected.
|
|
54
|
+
|
|
55
|
+
<Canvas of={DoWithLabel} />
|
|
56
|
+
|
|
57
|
+
### ✅ Do: Input with placeholder
|
|
58
|
+
|
|
59
|
+
Use placeholders to provide examples or format hints. Placeholders disappear when the user starts typing.
|
|
60
|
+
|
|
61
|
+
<Canvas of={DoWithPlaceholder} />
|
|
62
|
+
|
|
63
|
+
### ✅ Do: Input with caption
|
|
64
|
+
|
|
65
|
+
Use captions to provide additional context, help text, or format requirements.
|
|
66
|
+
|
|
67
|
+
<Canvas of={DoWithCaption} />
|
|
68
|
+
|
|
69
|
+
### ✅ Do: Input with icon at start
|
|
70
|
+
|
|
71
|
+
Icons at the start can help clarify the type of information expected or provide visual context.
|
|
72
|
+
|
|
73
|
+
<Canvas of={DoWithIconStart} />
|
|
74
|
+
|
|
75
|
+
### ✅ Do: Input with icon at end
|
|
76
|
+
|
|
77
|
+
Icons at the end are useful for actions like clearing the field, showing/hiding passwords, or indicating status.
|
|
78
|
+
|
|
79
|
+
<Canvas of={DoWithIconEnd} />
|
|
80
|
+
|
|
81
|
+
### ✅ Do: Input with both icons
|
|
82
|
+
|
|
83
|
+
Use both icons when you need to provide context at the start and an action at the end.
|
|
84
|
+
|
|
85
|
+
<Canvas of={DoWithIcons} />
|
|
86
|
+
|
|
87
|
+
### ✅ Do: Disabled state
|
|
88
|
+
|
|
89
|
+
Use the disabled state when the input should not be editable, but the value should still be visible.
|
|
90
|
+
|
|
91
|
+
<Canvas of={DoDisabled} />
|
|
92
|
+
|
|
93
|
+
### ✅ Do: Loading state
|
|
94
|
+
|
|
95
|
+
Use the loading state to indicate that the input is processing data or waiting for a response.
|
|
96
|
+
|
|
97
|
+
<Canvas of={DoLoading} />
|
|
98
|
+
|
|
99
|
+
### ✅ Do: Input with max length
|
|
100
|
+
|
|
101
|
+
Use maxlength to limit the number of characters. The component will show a warning when the limit is reached.
|
|
102
|
+
|
|
103
|
+
<Canvas of={DoWithMaxLength} />
|
|
104
|
+
|
|
105
|
+
### ✅ Do: Input with min and max length
|
|
106
|
+
|
|
107
|
+
Use both minlength and maxlength to enforce a specific range of characters.
|
|
108
|
+
|
|
109
|
+
<Canvas of={DoWithMinMaxLength} />
|
|
110
|
+
|
|
111
|
+
## Rules
|
|
112
|
+
|
|
113
|
+
### ⛔ Don't: Long labels
|
|
114
|
+
|
|
115
|
+
Avoid overly long labels that make the form difficult to scan. Keep labels concise and clear.
|
|
116
|
+
|
|
117
|
+
**❌ Don't:**
|
|
118
|
+
|
|
119
|
+
<Canvas of={DontLongLabel} />
|
|
120
|
+
|
|
121
|
+
**✅ Do:**
|
|
122
|
+
|
|
123
|
+
<Canvas of={DoShortLabel} />
|
|
124
|
+
|
|
125
|
+
### ⛔ Don't: Missing labels
|
|
126
|
+
|
|
127
|
+
Always provide a label for accessibility and clarity. Labels help screen readers and provide context.
|
|
128
|
+
|
|
129
|
+
**❌ Don't:**
|
|
130
|
+
|
|
131
|
+
<Canvas of={DontNoLabel} />
|
|
132
|
+
|
|
133
|
+
**✅ Do:**
|
|
134
|
+
|
|
135
|
+
<Canvas of={DoWithLabel} />
|
|
136
|
+
|
|
137
|
+
### ⛔ Don't: Generic placeholders
|
|
138
|
+
|
|
139
|
+
Avoid generic placeholders like "Enter text" or "Type here". Use specific examples that guide the user.
|
|
140
|
+
|
|
141
|
+
**❌ Don't:**
|
|
142
|
+
|
|
143
|
+
<Canvas of={DontGenericPlaceholder} />
|
|
144
|
+
|
|
145
|
+
**✅ Do:**
|
|
146
|
+
|
|
147
|
+
<Canvas of={DoSpecificPlaceholder} />
|
|
148
|
+
|
|
149
|
+
### ⛔ Don't: Overuse of icons
|
|
150
|
+
|
|
151
|
+
Don't overload inputs with multiple icons that don't add value. Use icons purposefully.
|
|
152
|
+
|
|
153
|
+
**❌ Don't:**
|
|
154
|
+
|
|
155
|
+
<Canvas of={DontTooManyIcons} />
|
|
156
|
+
|
|
157
|
+
**✅ Do:**
|
|
158
|
+
|
|
159
|
+
<Canvas of={DoOneIcon} />
|
|
160
|
+
|
|
161
|
+
### ⛔ Don't: No error feedback
|
|
162
|
+
|
|
163
|
+
Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
|
|
164
|
+
|
|
165
|
+
**❌ Don't:**
|
|
166
|
+
|
|
167
|
+
<Canvas of={DontNoErrorFeedback} />
|
|
168
|
+
|
|
169
|
+
**✅ Do:**
|
|
170
|
+
|
|
171
|
+
<Canvas of={DoWithErrorFeedback} />
|
|
172
|
+
|
|
173
|
+
### ⛔ Don't: Missing helpful captions
|
|
174
|
+
|
|
175
|
+
When input requirements are complex, provide captions to help users understand what's expected.
|
|
176
|
+
|
|
177
|
+
**❌ Don't:**
|
|
178
|
+
|
|
179
|
+
<Canvas of={DontNoCaption} />
|
|
180
|
+
|
|
181
|
+
**✅ Do:**
|
|
182
|
+
|
|
183
|
+
<Canvas of={DoWithHelpfulCaption} />
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import {
|
|
3
|
+
PlaygroundForm,
|
|
4
|
+
DoWithOrganizedSections,
|
|
5
|
+
DoWithActions,
|
|
6
|
+
DontNoActions,
|
|
7
|
+
DoWithActionsButton,
|
|
8
|
+
DontNoSectionTitles,
|
|
9
|
+
DoWithSectionTitles,
|
|
10
|
+
} from '../../components/layout/BmsForm.stories.js';
|
|
11
|
+
|
|
12
|
+
<Meta title="Documentation/Layout/Form" />
|
|
13
|
+
|
|
14
|
+
# <img src="../BmsIcon.png" /> Form
|
|
15
|
+
|
|
16
|
+
Form is a layout component that organizes form fields into sections and provides a consistent structure for form actions. It allows you to group related fields together using named slots and automatically positions action buttons at the bottom of the form. The component helps create well-organized, scannable forms with clear visual separation between sections.
|
|
17
|
+
|
|
18
|
+
## Anatomy
|
|
19
|
+
|
|
20
|
+
Form components consist of multiple named slots for organizing form fields into logical sections, and an actions slot for form submission buttons. Each section should have a clear title (typically an h2 heading) that describes the purpose of the fields within that section. Each section is visually separated, and the actions are consistently positioned at the bottom of the form.
|
|
21
|
+
|
|
22
|
+
## Component
|
|
23
|
+
|
|
24
|
+
Use the controls below to interact with the component and see how it behaves with different configurations.
|
|
25
|
+
|
|
26
|
+
<Canvas of={PlaygroundForm} />
|
|
27
|
+
|
|
28
|
+
### Props
|
|
29
|
+
|
|
30
|
+
<Controls of={PlaygroundForm} />
|
|
31
|
+
|
|
32
|
+
## Usage Examples
|
|
33
|
+
|
|
34
|
+
### ✅ Do: Form with organized sections
|
|
35
|
+
|
|
36
|
+
Organize form fields into logical sections using named slots. This makes the form easier to scan and understand.
|
|
37
|
+
|
|
38
|
+
<Canvas of={DoWithOrganizedSections} />
|
|
39
|
+
|
|
40
|
+
**Note on sections:** Using sections is not mandatory. They are particularly useful for improving readability when a form becomes too long. As a general guideline, consider using sections when you have more than 5 fields, as this helps users better understand and navigate the form structure.
|
|
41
|
+
|
|
42
|
+
### ✅ Do: Form with actions
|
|
43
|
+
|
|
44
|
+
Always provide action buttons (Submit, Cancel, etc.) in the actions slot. This gives users a clear way to submit or cancel the form.
|
|
45
|
+
|
|
46
|
+
<Canvas of={DoWithActions} />
|
|
47
|
+
|
|
48
|
+
## Rules
|
|
49
|
+
|
|
50
|
+
### ⛔ Don't: Form without section titles
|
|
51
|
+
|
|
52
|
+
Always provide a clear title for each section of the form. Section titles help users understand the purpose of each group of fields and make the form easier to scan and navigate.
|
|
53
|
+
|
|
54
|
+
**Note on section titles:** If your form has only one section, you don't need to add a title to that section. The page title should be sufficient in this case. Section titles are most useful when you have multiple sections to distinguish between different groups of fields.
|
|
55
|
+
|
|
56
|
+
**❌ Don't:**
|
|
57
|
+
|
|
58
|
+
<Canvas of={DontNoSectionTitles} />
|
|
59
|
+
|
|
60
|
+
**✅ Do:**
|
|
61
|
+
|
|
62
|
+
<Canvas of={DoWithSectionTitles} />
|
|
63
|
+
|
|
64
|
+
### ⛔ Don't: Form without actions
|
|
65
|
+
|
|
66
|
+
Always provide action buttons for forms. Without actions, users cannot submit or cancel the form, creating a poor user experience.
|
|
67
|
+
|
|
68
|
+
**❌ Don't:**
|
|
69
|
+
|
|
70
|
+
<Canvas of={DontNoActions} />
|
|
71
|
+
|
|
72
|
+
**✅ Do:**
|
|
73
|
+
|
|
74
|
+
<Canvas of={DoWithActionsButton} />
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import {
|
|
3
|
+
PlaygroundHeaderTitle,
|
|
4
|
+
DoWithClearTitle,
|
|
5
|
+
DoWithLabel,
|
|
6
|
+
DoWithActions,
|
|
7
|
+
DoWithSecondaryAction,
|
|
8
|
+
DoWithSubtitle,
|
|
9
|
+
DoWithHelperLinks,
|
|
10
|
+
DontNoTitle,
|
|
11
|
+
DoWithTitle,
|
|
12
|
+
DontLongTitle,
|
|
13
|
+
DoShortTitle,
|
|
14
|
+
DontTwoPrimaryButtons,
|
|
15
|
+
DontInvertedButtonOrder,
|
|
16
|
+
} from '../../components/layout/BmsHeaderTitle.stories.js';
|
|
17
|
+
|
|
18
|
+
<Meta title="Documentation/Layout/Header Title" />
|
|
19
|
+
|
|
20
|
+
# <img src="../BmsIcon.png" /> Header Title
|
|
21
|
+
|
|
22
|
+
Header Title is a component that provides a consistent structure for page headers. It displays a title, optional label, helper links, and action buttons. The component helps create a unified header experience across the application, providing space for logos, titles, subtitles, and action buttons in a well-organized layout.
|
|
23
|
+
|
|
24
|
+
## Anatomy
|
|
25
|
+
|
|
26
|
+
Header Title components consist of several key elements: an optional logo slot, a label (optional prefix text), the main title (h1), optional helper links (documentation and activity), an optional after-title slot for secondary actions, an actions slot for primary actions, and an optional subtitle slot for additional context.
|
|
27
|
+
|
|
28
|
+
## Component
|
|
29
|
+
|
|
30
|
+
Use the controls below to interact with the component and see how it behaves with different configurations.
|
|
31
|
+
|
|
32
|
+
<Canvas of={PlaygroundHeaderTitle} />
|
|
33
|
+
|
|
34
|
+
### Props
|
|
35
|
+
|
|
36
|
+
<Controls of={PlaygroundHeaderTitle} />
|
|
37
|
+
|
|
38
|
+
## Usage Examples
|
|
39
|
+
|
|
40
|
+
### ✅ Do: Header title with clear title
|
|
41
|
+
|
|
42
|
+
Always provide a clear, descriptive title that accurately represents the page content.
|
|
43
|
+
|
|
44
|
+
<Canvas of={DoWithClearTitle} />
|
|
45
|
+
|
|
46
|
+
### ✅ Do: Header title with label
|
|
47
|
+
|
|
48
|
+
Use a label to provide context or categorization for the title, such as the resource type or section name.
|
|
49
|
+
|
|
50
|
+
<Canvas of={DoWithLabel} />
|
|
51
|
+
|
|
52
|
+
### ✅ Do: Header title with actions
|
|
53
|
+
|
|
54
|
+
Use the actions slot to place primary action buttons in the header, aligned to the right.
|
|
55
|
+
|
|
56
|
+
<Canvas of={DoWithActions} />
|
|
57
|
+
|
|
58
|
+
### ✅ Do: Header title with secondary action
|
|
59
|
+
|
|
60
|
+
When you need multiple actions, place the secondary action button to the left of the primary action button. This follows the standard pattern where the primary action is on the right.
|
|
61
|
+
|
|
62
|
+
<Canvas of={DoWithSecondaryAction} />
|
|
63
|
+
|
|
64
|
+
### ✅ Do: Header title with subtitle
|
|
65
|
+
|
|
66
|
+
Use the subtitle slot to provide additional context or description about the page.
|
|
67
|
+
|
|
68
|
+
<Canvas of={DoWithSubtitle} />
|
|
69
|
+
|
|
70
|
+
### ✅ Do: Header title with helper links
|
|
71
|
+
|
|
72
|
+
Use helper links to provide quick access to documentation or activity logs related to the page.
|
|
73
|
+
|
|
74
|
+
<Canvas of={DoWithHelperLinks} />
|
|
75
|
+
|
|
76
|
+
## Rules
|
|
77
|
+
|
|
78
|
+
### ⛔ Don't: Missing title
|
|
79
|
+
|
|
80
|
+
Always provide a title for the header. The title is the primary identifier for the page and is essential for user orientation.
|
|
81
|
+
|
|
82
|
+
**❌ Don't:**
|
|
83
|
+
|
|
84
|
+
<Canvas of={DontNoTitle} />
|
|
85
|
+
|
|
86
|
+
**✅ Do:**
|
|
87
|
+
|
|
88
|
+
<Canvas of={DoWithTitle} />
|
|
89
|
+
|
|
90
|
+
### ⛔ Don't: Too long title
|
|
91
|
+
|
|
92
|
+
Avoid overly long titles that make the header difficult to read and break the layout. Keep titles concise and clear.
|
|
93
|
+
|
|
94
|
+
**❌ Don't:**
|
|
95
|
+
|
|
96
|
+
<Canvas of={DontLongTitle} />
|
|
97
|
+
|
|
98
|
+
**✅ Do:**
|
|
99
|
+
|
|
100
|
+
<Canvas of={DoShortTitle} />
|
|
101
|
+
|
|
102
|
+
### ⛔ Don't: Two primary buttons
|
|
103
|
+
|
|
104
|
+
Avoid using multiple primary buttons. Use a secondary button for the less important action to maintain visual hierarchy and clarity.
|
|
105
|
+
|
|
106
|
+
**❌ Don't:**
|
|
107
|
+
|
|
108
|
+
<Canvas of={DontTwoPrimaryButtons} />
|
|
109
|
+
|
|
110
|
+
**✅ Do:**
|
|
111
|
+
|
|
112
|
+
<Canvas of={DoWithSecondaryAction} />
|
|
113
|
+
|
|
114
|
+
### ⛔ Don't: Inverted button order
|
|
115
|
+
|
|
116
|
+
Always place the secondary action button to the left of the primary action button. The primary action should be on the right, following standard UI patterns.
|
|
117
|
+
|
|
118
|
+
**❌ Don't:**
|
|
119
|
+
|
|
120
|
+
<Canvas of={DontInvertedButtonOrder} />
|
|
121
|
+
|
|
122
|
+
**✅ Do:**
|
|
123
|
+
|
|
124
|
+
<Canvas of={DoWithSecondaryAction} />
|