@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.
- package/dist/components/button/BmsButton.vue.d.ts +1 -1
- package/dist/components/button/BmsIconButton.vue.d.ts +1 -1
- package/dist/components/button/BmsToggleIcon.vue.d.ts +24 -0
- package/dist/components/button/UiButton.vue.d.ts +1 -1
- package/dist/components/form/BmsInputText.vue.d.ts +1 -1
- package/dist/components/form/BmsSearch.vue.d.ts +3 -3
- package/dist/components/form/BmsSelect.vue.d.ts +1 -1
- package/dist/components/form/RawSelect.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/navigation/UiTenantSwitcher.vue.d.ts +3 -3
- package/dist/components/table/BmsPagination.vue.d.ts +4 -2
- package/dist/components/table/BmsServerTable.vue.d.ts +3 -3
- package/dist/components/table/BmsTable.vue.d.ts +3 -3
- package/dist/components/table/BmsTableFilters.vue.d.ts +5 -3
- package/dist/components/table/UiBmsTable.vue.d.ts +3 -3
- package/dist/components/table/UiFilterButton.vue.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/models/table.model.d.ts +5 -0
- package/dist/plugins/field/FieldComponent.vue.d.ts +1 -1
- package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
- package/dist/showroom/pages/table.vue.d.ts +2 -0
- package/dist/sipa-bms-ui.css +167 -103
- package/dist/sipa-bms-ui.es.js +3838 -3301
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +3842 -3303
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +19 -19
- package/src/components/button/BmsButton.stories.js +142 -3
- package/src/components/button/BmsToggleIcon.stories.js +145 -0
- package/src/components/button/BmsToggleIcon.vue +108 -0
- 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/BmsInputNumber.stories.js +12 -2
- package/src/components/form/BmsInputNumber.vue +2 -1
- 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 +278 -1
- package/src/components/form/BmsInputText.vue +2 -0
- 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/BmsFloatingWindow.vue +12 -1
- package/src/components/layout/BmsForm.stories.js +216 -0
- package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
- package/src/components/layout/BmsSplitWindow.vue +1 -1
- package/src/components/table/BmsPagination.vue +3 -0
- package/src/components/table/BmsServerTable.stories.js +59 -3
- package/src/components/table/BmsServerTable.vue +9 -2
- package/src/components/table/BmsTable.stories.js +312 -2
- package/src/components/table/BmsTable.vue +14 -3
- package/src/components/table/BmsTableFilters.vue +15 -5
- package/src/components/table/UiBmsTable.stories.js +3 -0
- package/src/components/table/UiBmsTable.vue +14 -5
- package/src/components/table/UiFilterButton.vue +6 -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/index.ts +3 -0
- package/src/models/table.model.ts +6 -0
- package/src/showroom/pages/floating-window.vue +36 -0
- package/src/documentation/fields_text.mdx +0 -31
|
@@ -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} />
|
|
@@ -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**.
|