@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
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import BmsTag from '@/components/form/BmsTag.vue';
|
|
2
|
-
import { Activity, Trash } from 'lucide-vue-next';
|
|
2
|
+
import { Activity, Trash, X } from 'lucide-vue-next';
|
|
3
3
|
|
|
4
4
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
+
title: 'Composants/form/Tag',
|
|
8
|
+
component: BmsTag,
|
|
7
9
|
parameters: {
|
|
8
10
|
docs: {
|
|
9
11
|
page: template,
|
|
10
12
|
},
|
|
11
13
|
},
|
|
12
|
-
title: 'Composants/form/Tag',
|
|
13
|
-
component: BmsTag,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const Template = (args) => ({
|
|
@@ -71,3 +71,119 @@ export const CantBeDismissed = Template.bind({});
|
|
|
71
71
|
CantBeDismissed.args = {
|
|
72
72
|
canBeDismissed: false,
|
|
73
73
|
};
|
|
74
|
+
|
|
75
|
+
// Simple template for documentation (without small variant)
|
|
76
|
+
const SimpleTemplate = (args) => ({
|
|
77
|
+
setup() {
|
|
78
|
+
return { args };
|
|
79
|
+
},
|
|
80
|
+
components: {
|
|
81
|
+
BmsTag,
|
|
82
|
+
Activity,
|
|
83
|
+
X,
|
|
84
|
+
},
|
|
85
|
+
template: `
|
|
86
|
+
<BmsTag v-bind="args">
|
|
87
|
+
{{ args.content || 'Tag' }}
|
|
88
|
+
</BmsTag>
|
|
89
|
+
`,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Playground with default values for documentation
|
|
93
|
+
export const PlaygroundTag = SimpleTemplate.bind({});
|
|
94
|
+
PlaygroundTag.parameters = { chromatic: { disable: true } };
|
|
95
|
+
PlaygroundTag.args = {
|
|
96
|
+
content: 'Filter',
|
|
97
|
+
active: false,
|
|
98
|
+
canBeDismissed: true,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Do: Tag with clear content
|
|
102
|
+
export const DoWithClearContent = SimpleTemplate.bind({});
|
|
103
|
+
DoWithClearContent.parameters = { chromatic: { disable: true } };
|
|
104
|
+
DoWithClearContent.args = {
|
|
105
|
+
content: 'Active',
|
|
106
|
+
active: true,
|
|
107
|
+
canBeDismissed: true,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Do: Tag with dismissible option
|
|
111
|
+
export const DoWithDismissible = SimpleTemplate.bind({});
|
|
112
|
+
DoWithDismissible.parameters = { chromatic: { disable: true } };
|
|
113
|
+
DoWithDismissible.args = {
|
|
114
|
+
content: 'Filter',
|
|
115
|
+
active: false,
|
|
116
|
+
canBeDismissed: true,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Do: Tag with active state
|
|
120
|
+
export const DoWithActiveState = SimpleTemplate.bind({});
|
|
121
|
+
DoWithActiveState.parameters = { chromatic: { disable: true } };
|
|
122
|
+
DoWithActiveState.args = {
|
|
123
|
+
content: 'Selected',
|
|
124
|
+
active: true,
|
|
125
|
+
canBeDismissed: true,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// Do: Tag with disabled state
|
|
129
|
+
export const DoWithDisabledState = SimpleTemplate.bind({});
|
|
130
|
+
DoWithDisabledState.parameters = { chromatic: { disable: true } };
|
|
131
|
+
DoWithDisabledState.args = {
|
|
132
|
+
content: 'Locked',
|
|
133
|
+
active: false,
|
|
134
|
+
disabled: true,
|
|
135
|
+
canBeDismissed: false,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// Do: Tag with short content
|
|
139
|
+
export const DoWithShortContent = SimpleTemplate.bind({});
|
|
140
|
+
DoWithShortContent.parameters = { chromatic: { disable: true } };
|
|
141
|
+
DoWithShortContent.args = {
|
|
142
|
+
content: 'New',
|
|
143
|
+
active: false,
|
|
144
|
+
canBeDismissed: true,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Don't: Tag with too long content
|
|
148
|
+
export const DontLongContent = SimpleTemplate.bind({});
|
|
149
|
+
DontLongContent.parameters = { chromatic: { disable: true } };
|
|
150
|
+
DontLongContent.args = {
|
|
151
|
+
content:
|
|
152
|
+
'This is a very long tag content that should not be used because it makes the tag difficult to read and breaks the layout',
|
|
153
|
+
active: false,
|
|
154
|
+
canBeDismissed: true,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Don't: Tag with empty or unclear content
|
|
158
|
+
export const DontEmptyContent = SimpleTemplate.bind({});
|
|
159
|
+
DontEmptyContent.parameters = { chromatic: { disable: true } };
|
|
160
|
+
DontEmptyContent.args = {
|
|
161
|
+
content: '',
|
|
162
|
+
active: false,
|
|
163
|
+
canBeDismissed: true,
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const DoClearContent = SimpleTemplate.bind({});
|
|
167
|
+
DoClearContent.parameters = { chromatic: { disable: true } };
|
|
168
|
+
DoClearContent.args = {
|
|
169
|
+
content: 'Filter',
|
|
170
|
+
active: false,
|
|
171
|
+
canBeDismissed: true,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Don't: Tag that cannot be dismissed when it should
|
|
175
|
+
export const DontCantDismissWhenNeeded = SimpleTemplate.bind({});
|
|
176
|
+
DontCantDismissWhenNeeded.parameters = { chromatic: { disable: true } };
|
|
177
|
+
DontCantDismissWhenNeeded.args = {
|
|
178
|
+
content: 'Temporary filter',
|
|
179
|
+
active: false,
|
|
180
|
+
canBeDismissed: false,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const DoCanDismiss = SimpleTemplate.bind({});
|
|
184
|
+
DoCanDismiss.parameters = { chromatic: { disable: true } };
|
|
185
|
+
DoCanDismiss.args = {
|
|
186
|
+
content: 'Temporary filter',
|
|
187
|
+
active: false,
|
|
188
|
+
canBeDismissed: true,
|
|
189
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import BmsTextArea from '@/components/form/BmsTextArea.vue';
|
|
2
2
|
import { within } from 'storybook/test';
|
|
3
|
+
import { ref } from 'vue';
|
|
3
4
|
|
|
4
5
|
import template from '@/documentation/template_field_dependency.mdx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
8
|
+
title: 'Composants/form/TextArea',
|
|
9
|
+
component: BmsTextArea,
|
|
7
10
|
parameters: {
|
|
8
11
|
docs: {
|
|
9
12
|
page: template,
|
|
10
13
|
},
|
|
11
14
|
},
|
|
12
|
-
title: 'Composants/form/TextArea',
|
|
13
|
-
component: BmsTextArea,
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const Template = (args) => ({
|
|
@@ -74,3 +75,146 @@ export const WithFocusState = {
|
|
|
74
75
|
await canvas.getByRole('input').focus();
|
|
75
76
|
},
|
|
76
77
|
};
|
|
78
|
+
|
|
79
|
+
// Simple template for documentation (without small variant)
|
|
80
|
+
const SimpleTemplate = (args) => ({
|
|
81
|
+
setup() {
|
|
82
|
+
const modelValue = ref(args.modelValue || '');
|
|
83
|
+
return { args, modelValue };
|
|
84
|
+
},
|
|
85
|
+
components: {
|
|
86
|
+
BmsTextArea,
|
|
87
|
+
},
|
|
88
|
+
template: `
|
|
89
|
+
<BmsTextArea v-bind="args" v-model="modelValue" />
|
|
90
|
+
`,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Playground with default values for documentation
|
|
94
|
+
export const PlaygroundTextArea = SimpleTemplate.bind({});
|
|
95
|
+
PlaygroundTextArea.parameters = { chromatic: { disable: true } };
|
|
96
|
+
PlaygroundTextArea.args = {
|
|
97
|
+
label: 'Description',
|
|
98
|
+
placeholder: 'Enter your description here...',
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Do: Simple textarea with label
|
|
102
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
103
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
104
|
+
DoWithLabel.args = {
|
|
105
|
+
label: 'Comments',
|
|
106
|
+
placeholder: 'Enter your comments',
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Do: Textarea with placeholder
|
|
110
|
+
export const DoWithPlaceholder = SimpleTemplate.bind({});
|
|
111
|
+
DoWithPlaceholder.parameters = { chromatic: { disable: true } };
|
|
112
|
+
DoWithPlaceholder.args = {
|
|
113
|
+
label: 'Description',
|
|
114
|
+
placeholder: 'Describe your project in detail...',
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Do: Textarea with caption
|
|
118
|
+
export const DoWithCaption = SimpleTemplate.bind({});
|
|
119
|
+
DoWithCaption.parameters = { chromatic: { disable: true } };
|
|
120
|
+
DoWithCaption.args = {
|
|
121
|
+
label: 'Message',
|
|
122
|
+
placeholder: 'Enter your message',
|
|
123
|
+
captions: ['Maximum 500 characters'],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Do: Disabled state
|
|
127
|
+
export const DoDisabled = SimpleTemplate.bind({});
|
|
128
|
+
DoDisabled.parameters = { chromatic: { disable: true } };
|
|
129
|
+
DoDisabled.args = {
|
|
130
|
+
label: 'Notes',
|
|
131
|
+
modelValue: 'This is a read-only note that cannot be edited.',
|
|
132
|
+
disabled: true,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Do: Loading state
|
|
136
|
+
export const DoLoading = SimpleTemplate.bind({});
|
|
137
|
+
DoLoading.parameters = { chromatic: { disable: true } };
|
|
138
|
+
DoLoading.args = {
|
|
139
|
+
label: 'Description',
|
|
140
|
+
placeholder: 'Loading...',
|
|
141
|
+
loading: true,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Do: Textarea with error feedback
|
|
145
|
+
export const DoWithErrorFeedback = SimpleTemplate.bind({});
|
|
146
|
+
DoWithErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
147
|
+
DoWithErrorFeedback.args = {
|
|
148
|
+
label: 'Description',
|
|
149
|
+
placeholder: 'Enter description',
|
|
150
|
+
modelValue: 'Too short',
|
|
151
|
+
errors: ['Description must be at least 20 characters'],
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Do: Textarea with helpful caption
|
|
155
|
+
export const DoWithHelpfulCaption = SimpleTemplate.bind({});
|
|
156
|
+
DoWithHelpfulCaption.parameters = { chromatic: { disable: true } };
|
|
157
|
+
DoWithHelpfulCaption.args = {
|
|
158
|
+
label: 'Project description',
|
|
159
|
+
placeholder: 'Describe your project',
|
|
160
|
+
modelValue: 'Short',
|
|
161
|
+
captions: ['Please provide a detailed description of at least 50 characters'],
|
|
162
|
+
errors: ['Description is too short'],
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Don't: Long labels
|
|
166
|
+
export const DontLongLabel = SimpleTemplate.bind({});
|
|
167
|
+
DontLongLabel.parameters = { chromatic: { disable: true } };
|
|
168
|
+
DontLongLabel.args = {
|
|
169
|
+
label:
|
|
170
|
+
'Please enter your complete and detailed project description including all relevant information about the project goals, timeline, and expected outcomes',
|
|
171
|
+
placeholder: 'Description',
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const DoShortLabel = SimpleTemplate.bind({});
|
|
175
|
+
DoShortLabel.parameters = { chromatic: { disable: true } };
|
|
176
|
+
DoShortLabel.args = {
|
|
177
|
+
label: 'Description',
|
|
178
|
+
placeholder: 'Enter description',
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Don't: No label
|
|
182
|
+
export const DontNoLabel = SimpleTemplate.bind({});
|
|
183
|
+
DontNoLabel.parameters = { chromatic: { disable: true } };
|
|
184
|
+
DontNoLabel.args = {
|
|
185
|
+
placeholder: 'Enter your message here',
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Don't: Generic placeholder
|
|
189
|
+
export const DontGenericPlaceholder = SimpleTemplate.bind({});
|
|
190
|
+
DontGenericPlaceholder.parameters = { chromatic: { disable: true } };
|
|
191
|
+
DontGenericPlaceholder.args = {
|
|
192
|
+
label: 'Message',
|
|
193
|
+
placeholder: 'Enter text here',
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const DoSpecificPlaceholder = SimpleTemplate.bind({});
|
|
197
|
+
DoSpecificPlaceholder.parameters = { chromatic: { disable: true } };
|
|
198
|
+
DoSpecificPlaceholder.args = {
|
|
199
|
+
label: 'Message',
|
|
200
|
+
placeholder: 'Describe the issue you encountered...',
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// Don't: No error feedback
|
|
204
|
+
export const DontNoErrorFeedback = SimpleTemplate.bind({});
|
|
205
|
+
DontNoErrorFeedback.parameters = { chromatic: { disable: true } };
|
|
206
|
+
DontNoErrorFeedback.args = {
|
|
207
|
+
label: 'Description',
|
|
208
|
+
placeholder: 'Enter description',
|
|
209
|
+
modelValue: 'Too short',
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// Don't: No caption for complex requirements
|
|
213
|
+
export const DontNoCaption = SimpleTemplate.bind({});
|
|
214
|
+
DontNoCaption.parameters = { chromatic: { disable: true } };
|
|
215
|
+
DontNoCaption.args = {
|
|
216
|
+
label: 'Project description',
|
|
217
|
+
placeholder: 'Enter description',
|
|
218
|
+
modelValue: 'Short',
|
|
219
|
+
errors: ['Error'],
|
|
220
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import BmsForm from '@/components/layout/BmsForm.vue';
|
|
2
|
+
import BmsInputText from '@/components/form/BmsInputText.vue';
|
|
3
|
+
import BmsSelect from '@/components/form/BmsSelect.vue';
|
|
4
|
+
import BmsTextArea from '@/components/form/BmsTextArea.vue';
|
|
5
|
+
import BmsInputNumber from '@/components/form/BmsInputNumber.vue';
|
|
6
|
+
import BmsButton from '@/components/button/BmsButton.vue';
|
|
7
|
+
import { ref } from 'vue';
|
|
2
8
|
|
|
3
9
|
export default {
|
|
4
10
|
title: 'Composants/layout/Form',
|
|
@@ -28,3 +34,213 @@ const Template = (args) => ({
|
|
|
28
34
|
});
|
|
29
35
|
|
|
30
36
|
export const Default = Template.bind({});
|
|
37
|
+
|
|
38
|
+
// Simple template for documentation
|
|
39
|
+
const SimpleTemplate = (args) => ({
|
|
40
|
+
components: {
|
|
41
|
+
BmsForm,
|
|
42
|
+
BmsInputText,
|
|
43
|
+
BmsSelect,
|
|
44
|
+
BmsTextArea,
|
|
45
|
+
BmsInputNumber,
|
|
46
|
+
BmsButton,
|
|
47
|
+
},
|
|
48
|
+
setup() {
|
|
49
|
+
const name = ref(args.name || '');
|
|
50
|
+
const email = ref(args.email || '');
|
|
51
|
+
const phone = ref(args.phone || '');
|
|
52
|
+
const country = ref(args.country || '');
|
|
53
|
+
const description = ref(args.description || '');
|
|
54
|
+
const age = ref(args.age || null);
|
|
55
|
+
return { args, name, email, phone, country, description, age };
|
|
56
|
+
},
|
|
57
|
+
template: `
|
|
58
|
+
<BmsForm>
|
|
59
|
+
<template #form_1>
|
|
60
|
+
<h2>Personal Information</h2>
|
|
61
|
+
<BmsInputText label="Name" v-model="name" placeholder="Enter your name" required />
|
|
62
|
+
<BmsInputText label="Email" v-model="email" placeholder="Enter your email" required />
|
|
63
|
+
<BmsInputText label="Phone" v-model="phone" placeholder="Enter your phone number" />
|
|
64
|
+
<BmsSelect
|
|
65
|
+
label="Country"
|
|
66
|
+
v-model="country"
|
|
67
|
+
placeholder="Select a country"
|
|
68
|
+
:options="[
|
|
69
|
+
{ label: 'France', value: 'fr' },
|
|
70
|
+
{ label: 'United States', value: 'us' },
|
|
71
|
+
{ label: 'United Kingdom', value: 'uk' },
|
|
72
|
+
{ label: 'Germany', value: 'de' }
|
|
73
|
+
]"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
<template #form_2>
|
|
77
|
+
<h2>Additional Details</h2>
|
|
78
|
+
<BmsTextArea label="Description" v-model="description" placeholder="Enter a description" />
|
|
79
|
+
<BmsInputNumber label="Age" v-model="age" :min="0" :max="120" />
|
|
80
|
+
</template>
|
|
81
|
+
<template #actions>
|
|
82
|
+
<BmsButton type="secondary">Cancel</BmsButton>
|
|
83
|
+
<BmsButton type="primary">Submit</BmsButton>
|
|
84
|
+
</template>
|
|
85
|
+
</BmsForm>
|
|
86
|
+
`,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Playground with default values for documentation
|
|
90
|
+
export const PlaygroundForm = SimpleTemplate.bind({});
|
|
91
|
+
PlaygroundForm.parameters = { chromatic: { disable: true } };
|
|
92
|
+
PlaygroundForm.args = {
|
|
93
|
+
name: '',
|
|
94
|
+
email: '',
|
|
95
|
+
phone: '',
|
|
96
|
+
country: '',
|
|
97
|
+
description: '',
|
|
98
|
+
age: null,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Do: Form with organized sections
|
|
102
|
+
export const DoWithOrganizedSections = SimpleTemplate.bind({});
|
|
103
|
+
DoWithOrganizedSections.parameters = { chromatic: { disable: true } };
|
|
104
|
+
DoWithOrganizedSections.args = {
|
|
105
|
+
name: '',
|
|
106
|
+
email: '',
|
|
107
|
+
phone: '',
|
|
108
|
+
country: '',
|
|
109
|
+
description: '',
|
|
110
|
+
age: null,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Do: Form with actions
|
|
114
|
+
export const DoWithActions = SimpleTemplate.bind({});
|
|
115
|
+
DoWithActions.parameters = { chromatic: { disable: true } };
|
|
116
|
+
DoWithActions.args = {
|
|
117
|
+
name: '',
|
|
118
|
+
email: '',
|
|
119
|
+
phone: '',
|
|
120
|
+
country: '',
|
|
121
|
+
description: '',
|
|
122
|
+
age: null,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Don't: Form without actions
|
|
126
|
+
export const DontNoActions = (args) => ({
|
|
127
|
+
components: {
|
|
128
|
+
BmsForm,
|
|
129
|
+
BmsInputText,
|
|
130
|
+
BmsSelect,
|
|
131
|
+
BmsTextArea,
|
|
132
|
+
},
|
|
133
|
+
setup() {
|
|
134
|
+
const name = ref(args.name || '');
|
|
135
|
+
const email = ref(args.email || '');
|
|
136
|
+
const country = ref(args.country || '');
|
|
137
|
+
const description = ref(args.description || '');
|
|
138
|
+
return { args, name, email, country, description };
|
|
139
|
+
},
|
|
140
|
+
template: `
|
|
141
|
+
<BmsForm>
|
|
142
|
+
<template #form_1>
|
|
143
|
+
<h2>Personal Information</h2>
|
|
144
|
+
<BmsInputText label="Name" v-model="name" required />
|
|
145
|
+
<BmsInputText label="Email" v-model="email" required />
|
|
146
|
+
<BmsSelect
|
|
147
|
+
label="Country"
|
|
148
|
+
v-model="country"
|
|
149
|
+
:options="[
|
|
150
|
+
{ label: 'France', value: 'fr' },
|
|
151
|
+
{ label: 'United States', value: 'us' }
|
|
152
|
+
]"
|
|
153
|
+
/>
|
|
154
|
+
</template>
|
|
155
|
+
<template #form_2>
|
|
156
|
+
<h2>Additional Details</h2>
|
|
157
|
+
<BmsTextArea label="Description" v-model="description" />
|
|
158
|
+
</template>
|
|
159
|
+
</BmsForm>
|
|
160
|
+
`,
|
|
161
|
+
});
|
|
162
|
+
DontNoActions.parameters = { chromatic: { disable: true } };
|
|
163
|
+
DontNoActions.args = {
|
|
164
|
+
name: '',
|
|
165
|
+
email: '',
|
|
166
|
+
country: '',
|
|
167
|
+
description: '',
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const DoWithActionsButton = SimpleTemplate.bind({});
|
|
171
|
+
DoWithActionsButton.parameters = { chromatic: { disable: true } };
|
|
172
|
+
DoWithActionsButton.args = {
|
|
173
|
+
name: '',
|
|
174
|
+
email: '',
|
|
175
|
+
phone: '',
|
|
176
|
+
country: '',
|
|
177
|
+
description: '',
|
|
178
|
+
age: null,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Don't: Form without section titles
|
|
182
|
+
export const DontNoSectionTitles = (args) => ({
|
|
183
|
+
components: {
|
|
184
|
+
BmsForm,
|
|
185
|
+
BmsInputText,
|
|
186
|
+
BmsSelect,
|
|
187
|
+
BmsTextArea,
|
|
188
|
+
BmsInputNumber,
|
|
189
|
+
BmsButton,
|
|
190
|
+
},
|
|
191
|
+
setup() {
|
|
192
|
+
const name = ref(args.name || '');
|
|
193
|
+
const email = ref(args.email || '');
|
|
194
|
+
const phone = ref(args.phone || '');
|
|
195
|
+
const country = ref(args.country || '');
|
|
196
|
+
const description = ref(args.description || '');
|
|
197
|
+
const age = ref(args.age || null);
|
|
198
|
+
return { args, name, email, phone, country, description, age };
|
|
199
|
+
},
|
|
200
|
+
template: `
|
|
201
|
+
<BmsForm>
|
|
202
|
+
<template #form_1>
|
|
203
|
+
<BmsInputText label="Name" v-model="name" placeholder="Enter your name" required />
|
|
204
|
+
<BmsInputText label="Email" v-model="email" placeholder="Enter your email" required />
|
|
205
|
+
<BmsInputText label="Phone" v-model="phone" placeholder="Enter your phone number" />
|
|
206
|
+
<BmsSelect
|
|
207
|
+
label="Country"
|
|
208
|
+
v-model="country"
|
|
209
|
+
placeholder="Select a country"
|
|
210
|
+
:options="[
|
|
211
|
+
{ label: 'France', value: 'fr' },
|
|
212
|
+
{ label: 'United States', value: 'us' }
|
|
213
|
+
]"
|
|
214
|
+
/>
|
|
215
|
+
</template>
|
|
216
|
+
<template #form_2>
|
|
217
|
+
<BmsTextArea label="Description" v-model="description" placeholder="Enter a description" />
|
|
218
|
+
<BmsInputNumber label="Age" v-model="age" :min="0" :max="120" />
|
|
219
|
+
</template>
|
|
220
|
+
<template #actions>
|
|
221
|
+
<BmsButton type="secondary">Cancel</BmsButton>
|
|
222
|
+
<BmsButton type="primary">Submit</BmsButton>
|
|
223
|
+
</template>
|
|
224
|
+
</BmsForm>
|
|
225
|
+
`,
|
|
226
|
+
});
|
|
227
|
+
DontNoSectionTitles.parameters = { chromatic: { disable: true } };
|
|
228
|
+
DontNoSectionTitles.args = {
|
|
229
|
+
name: '',
|
|
230
|
+
email: '',
|
|
231
|
+
phone: '',
|
|
232
|
+
country: '',
|
|
233
|
+
description: '',
|
|
234
|
+
age: null,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export const DoWithSectionTitles = SimpleTemplate.bind({});
|
|
238
|
+
DoWithSectionTitles.parameters = { chromatic: { disable: true } };
|
|
239
|
+
DoWithSectionTitles.args = {
|
|
240
|
+
name: '',
|
|
241
|
+
email: '',
|
|
242
|
+
phone: '',
|
|
243
|
+
country: '',
|
|
244
|
+
description: '',
|
|
245
|
+
age: null,
|
|
246
|
+
};
|
|
@@ -3,7 +3,6 @@ import BmsButton from '@/components/button/BmsButton.vue';
|
|
|
3
3
|
import { Flower } from 'lucide-vue-next';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
components: { BmsHeaderTitle },
|
|
7
6
|
title: 'Composants/layout/HeaderTitle',
|
|
8
7
|
component: BmsHeaderTitle,
|
|
9
8
|
};
|
|
@@ -66,3 +65,139 @@ WithAll.args = {
|
|
|
66
65
|
documentationUrl: '/docs',
|
|
67
66
|
activityUrl: '/docs',
|
|
68
67
|
};
|
|
68
|
+
|
|
69
|
+
// Simple template for documentation
|
|
70
|
+
const SimpleTemplate = (args) => ({
|
|
71
|
+
components: { BmsHeaderTitle, BmsButton, Flower },
|
|
72
|
+
setup() {
|
|
73
|
+
return { args };
|
|
74
|
+
},
|
|
75
|
+
template: `
|
|
76
|
+
<BmsHeaderTitle v-bind="args">
|
|
77
|
+
<template v-if="args.logo" #logo>
|
|
78
|
+
<Flower/>
|
|
79
|
+
</template>
|
|
80
|
+
<template v-if="args.afterTitle" #afterTitle>
|
|
81
|
+
<BmsButton type="tertiary">Secondary action</BmsButton>
|
|
82
|
+
</template>
|
|
83
|
+
<template v-if="args.actions" #actions>
|
|
84
|
+
<span style="display: flex; gap: 8px;">
|
|
85
|
+
<BmsButton v-if="args.secondaryAction && !args.twoPrimary" type="secondary">{{ args.secondaryLabel || 'Secondary' }}</BmsButton>
|
|
86
|
+
<BmsButton :type="args.primaryType || 'primary'">{{ args.primaryLabel || 'Primary action' }}</BmsButton>
|
|
87
|
+
<BmsButton v-if="args.secondaryActionRight" type="secondary">{{ args.secondaryLabel || 'Secondary' }}</BmsButton>
|
|
88
|
+
<BmsButton v-if="args.twoPrimary && args.secondaryAction" :type="args.primaryType || 'primary'">{{ args.secondaryLabel || 'Delete' }}</BmsButton>
|
|
89
|
+
</span>
|
|
90
|
+
</template>
|
|
91
|
+
<template v-if="args.subtitle" #subtitle>
|
|
92
|
+
{{ args.subtitle }}
|
|
93
|
+
</template>
|
|
94
|
+
</BmsHeaderTitle>
|
|
95
|
+
`,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Playground with default values for documentation
|
|
99
|
+
export const PlaygroundHeaderTitle = SimpleTemplate.bind({});
|
|
100
|
+
PlaygroundHeaderTitle.parameters = { chromatic: { disable: true } };
|
|
101
|
+
PlaygroundHeaderTitle.args = {
|
|
102
|
+
title: 'Page Title',
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Do: Header title with clear title
|
|
106
|
+
export const DoWithClearTitle = SimpleTemplate.bind({});
|
|
107
|
+
DoWithClearTitle.parameters = { chromatic: { disable: true } };
|
|
108
|
+
DoWithClearTitle.args = {
|
|
109
|
+
title: 'User Settings',
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Do: Header title with label
|
|
113
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
114
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
115
|
+
DoWithLabel.args = {
|
|
116
|
+
title: 'Edit Profile',
|
|
117
|
+
label: 'User Profile',
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Do: Header title with actions
|
|
121
|
+
export const DoWithActions = SimpleTemplate.bind({});
|
|
122
|
+
DoWithActions.parameters = { chromatic: { disable: true } };
|
|
123
|
+
DoWithActions.args = {
|
|
124
|
+
title: 'Dashboard',
|
|
125
|
+
actions: true,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// Do: Header title with secondary action
|
|
129
|
+
export const DoWithSecondaryAction = SimpleTemplate.bind({});
|
|
130
|
+
DoWithSecondaryAction.parameters = { chromatic: { disable: true } };
|
|
131
|
+
DoWithSecondaryAction.args = {
|
|
132
|
+
title: 'Edit Document',
|
|
133
|
+
actions: true,
|
|
134
|
+
secondaryAction: true,
|
|
135
|
+
secondaryLabel: 'Import',
|
|
136
|
+
primaryLabel: 'Add',
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Do: Header title with subtitle
|
|
140
|
+
export const DoWithSubtitle = SimpleTemplate.bind({});
|
|
141
|
+
DoWithSubtitle.parameters = { chromatic: { disable: true } };
|
|
142
|
+
DoWithSubtitle.args = {
|
|
143
|
+
title: 'Project Overview',
|
|
144
|
+
subtitle: 'Manage your project settings and team members',
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Do: Header title with helper links
|
|
148
|
+
export const DoWithHelperLinks = SimpleTemplate.bind({});
|
|
149
|
+
DoWithHelperLinks.parameters = { chromatic: { disable: true } };
|
|
150
|
+
DoWithHelperLinks.args = {
|
|
151
|
+
title: 'Configuration',
|
|
152
|
+
documentationUrl: '/docs/configuration',
|
|
153
|
+
activityUrl: '/activity',
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Don't: Missing title
|
|
157
|
+
export const DontNoTitle = SimpleTemplate.bind({});
|
|
158
|
+
DontNoTitle.parameters = { chromatic: { disable: true } };
|
|
159
|
+
DontNoTitle.args = {};
|
|
160
|
+
|
|
161
|
+
export const DoWithTitle = SimpleTemplate.bind({});
|
|
162
|
+
DoWithTitle.parameters = { chromatic: { disable: true } };
|
|
163
|
+
DoWithTitle.args = {
|
|
164
|
+
title: 'Page Title',
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Don't: Too long title
|
|
168
|
+
export const DontLongTitle = SimpleTemplate.bind({});
|
|
169
|
+
DontLongTitle.parameters = { chromatic: { disable: true } };
|
|
170
|
+
DontLongTitle.args = {
|
|
171
|
+
title:
|
|
172
|
+
'This is a very long page title that should not be used because it makes the header difficult to read and breaks the layout',
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const DoShortTitle = SimpleTemplate.bind({});
|
|
176
|
+
DoShortTitle.parameters = { chromatic: { disable: true } };
|
|
177
|
+
DoShortTitle.args = {
|
|
178
|
+
title: 'Settings',
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Don't: Two primary buttons
|
|
182
|
+
export const DontTwoPrimaryButtons = SimpleTemplate.bind({});
|
|
183
|
+
DontTwoPrimaryButtons.parameters = { chromatic: { disable: true } };
|
|
184
|
+
DontTwoPrimaryButtons.args = {
|
|
185
|
+
title: 'Edit Document',
|
|
186
|
+
actions: true,
|
|
187
|
+
twoPrimary: true,
|
|
188
|
+
primaryType: 'primary',
|
|
189
|
+
primaryLabel: 'Add',
|
|
190
|
+
secondaryAction: true,
|
|
191
|
+
secondaryLabel: 'Delete',
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Don't: Inverted button order
|
|
195
|
+
export const DontInvertedButtonOrder = SimpleTemplate.bind({});
|
|
196
|
+
DontInvertedButtonOrder.parameters = { chromatic: { disable: true } };
|
|
197
|
+
DontInvertedButtonOrder.args = {
|
|
198
|
+
title: 'Edit Document',
|
|
199
|
+
actions: true,
|
|
200
|
+
secondaryActionRight: true,
|
|
201
|
+
secondaryLabel: 'Import',
|
|
202
|
+
primaryLabel: 'Add',
|
|
203
|
+
};
|