@ouestfrance/sipa-bms-ui 8.22.2 → 8.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/components/button/BmsButton.vue.d.ts +1 -1
  2. package/dist/components/button/BmsIconButton.vue.d.ts +1 -1
  3. package/dist/components/button/BmsToggleIcon.vue.d.ts +24 -0
  4. package/dist/components/button/UiButton.vue.d.ts +1 -1
  5. package/dist/components/form/BmsInputText.vue.d.ts +1 -1
  6. package/dist/components/form/BmsSearch.vue.d.ts +3 -3
  7. package/dist/components/form/BmsSelect.vue.d.ts +1 -1
  8. package/dist/components/form/RawSelect.vue.d.ts +1 -1
  9. package/dist/components/layout/BmsHeaderTitle.vue.d.ts +1 -1
  10. package/dist/components/navigation/BmsBreadcrumb.vue.d.ts +1 -1
  11. package/dist/components/navigation/BmsShortLinkMenu.vue.d.ts +2 -2
  12. package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +3 -3
  13. package/dist/components/table/BmsPagination.vue.d.ts +4 -2
  14. package/dist/components/table/BmsServerTable.vue.d.ts +3 -3
  15. package/dist/components/table/BmsTable.vue.d.ts +3 -3
  16. package/dist/components/table/BmsTableFilters.vue.d.ts +5 -3
  17. package/dist/components/table/UiBmsTable.vue.d.ts +3 -3
  18. package/dist/components/table/UiFilterButton.vue.d.ts +2 -0
  19. package/dist/index.d.ts +2 -1
  20. package/dist/models/table.model.d.ts +5 -0
  21. package/dist/plugins/field/FieldComponent.vue.d.ts +1 -1
  22. package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
  23. package/dist/showroom/pages/table.vue.d.ts +2 -0
  24. package/dist/sipa-bms-ui.css +167 -103
  25. package/dist/sipa-bms-ui.es.js +3838 -3301
  26. package/dist/sipa-bms-ui.es.js.map +1 -1
  27. package/dist/sipa-bms-ui.umd.js +3842 -3303
  28. package/dist/sipa-bms-ui.umd.js.map +1 -1
  29. package/package.json +19 -19
  30. package/src/components/button/BmsButton.stories.js +142 -3
  31. package/src/components/button/BmsToggleIcon.stories.js +145 -0
  32. package/src/components/button/BmsToggleIcon.vue +108 -0
  33. package/src/components/form/BmsChip.stories.js +104 -2
  34. package/src/components/form/BmsInputCheckboxCaptionGroup.stories.js +157 -2
  35. package/src/components/form/BmsInputCheckboxGroup.stories.js +119 -2
  36. package/src/components/form/BmsInputCode.stories.js +109 -2
  37. package/src/components/form/BmsInputFile.stories.js +110 -2
  38. package/src/components/form/BmsInputNumber.stories.js +12 -2
  39. package/src/components/form/BmsInputNumber.vue +2 -1
  40. package/src/components/form/BmsInputRadioCaptionGroup.stories.js +138 -2
  41. package/src/components/form/BmsInputRadioGroup.stories.js +120 -2
  42. package/src/components/form/BmsInputText.stories.js +278 -1
  43. package/src/components/form/BmsInputText.vue +2 -0
  44. package/src/components/form/BmsMultiSelect.vue +3 -1
  45. package/src/components/form/BmsSearch.stories.js +89 -2
  46. package/src/components/form/BmsSelect.stories.js +220 -2
  47. package/src/components/form/BmsSelect.vue +5 -3
  48. package/src/components/form/BmsTag.stories.js +119 -3
  49. package/src/components/form/BmsTextArea.stories.js +146 -2
  50. package/src/components/form/RawAutocomplete.vue +3 -1
  51. package/src/components/layout/BmsFloatingWindow.vue +12 -1
  52. package/src/components/layout/BmsForm.stories.js +216 -0
  53. package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
  54. package/src/components/layout/BmsSplitWindow.vue +1 -1
  55. package/src/components/table/BmsPagination.vue +3 -0
  56. package/src/components/table/BmsServerTable.stories.js +59 -3
  57. package/src/components/table/BmsServerTable.vue +9 -2
  58. package/src/components/table/BmsTable.stories.js +312 -2
  59. package/src/components/table/BmsTable.vue +14 -3
  60. package/src/components/table/BmsTableFilters.vue +15 -5
  61. package/src/components/table/UiBmsTable.stories.js +3 -0
  62. package/src/components/table/UiBmsTable.vue +14 -5
  63. package/src/components/table/UiFilterButton.vue +6 -1
  64. package/src/documentation/button/secondaryButton.mdx +114 -3
  65. package/src/documentation/checkboxCaptionGroup.mdx +99 -0
  66. package/src/documentation/checkboxGroup.mdx +99 -0
  67. package/src/documentation/chip.mdx +85 -11
  68. package/src/documentation/inputCode.mdx +97 -0
  69. package/src/documentation/inputFile.mdx +90 -13
  70. package/src/documentation/inputText.mdx +183 -0
  71. package/src/documentation/layout/form.mdx +74 -0
  72. package/src/documentation/layout/headerTitle.mdx +124 -0
  73. package/src/documentation/layout/table.mdx +111 -0
  74. package/src/documentation/radioCaptionGroup.mdx +86 -19
  75. package/src/documentation/radioGroup.mdx +85 -18
  76. package/src/documentation/search.mdx +85 -13
  77. package/src/documentation/select.mdx +137 -16
  78. package/src/documentation/tag.mdx +91 -11
  79. package/src/documentation/textArea.mdx +126 -13
  80. package/src/index.ts +3 -0
  81. package/src/models/table.model.ts +6 -0
  82. package/src/showroom/pages/floating-window.vue +36 -0
  83. package/src/documentation/fields_text.mdx +0 -31
@@ -1,17 +1,128 @@
1
- import { Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2
- import Button from '../../components/button/BmsButton.vue';
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
2
+ import {
3
+ PlaygroundSecondary,
4
+ DoSimpleSecondary,
5
+ DoDangerSecondary,
6
+ DoSmallSecondary,
7
+ DoIconStartSecondary,
8
+ DoIconEndSecondary,
9
+ DoSubmitSecondary,
10
+ DontLongLabelSecondary,
11
+ DoShortLabelSecondary,
12
+ DontSecondaryAsPrimary,
13
+ DoSecondaryForCancel,
14
+ DontTooManyIconsSecondary,
15
+ DoOneIconSecondary,
16
+ DontGenericLabelSecondary,
17
+ DoSpecificLabelSecondary,
18
+ } from '../../components/button/BmsButton.stories.js';
3
19
 
4
20
  <Meta title="Documentation/Buttons/Secondary" />
5
21
 
6
22
  # <img src="./BmsIcon.png" /> Secondary Button
7
23
 
24
+ The secondary button should represent secondary actions on a screen. They are used alongside primary buttons to create a clear hierarchy of actions. Secondary buttons are ideal for cancel actions, alternative options, or less important actions that don't require primary emphasis.
25
+
8
26
  ## Anatomy
9
27
 
10
28
  Buttons allow users to perform an action or to navigate to another page. They have multiple styles for various needs, and are ideal for calling attention to where a user needs to do something in order to move forward in a flow.
29
+
11
30
  ![](./button/CoverSecondaryButton.png)
12
31
 
13
32
  ## Component
14
33
 
15
- ## Usage
34
+ Use the controls below to interact with the component and see how it behaves with different configurations.
35
+
36
+ <Canvas of={PlaygroundSecondary} />
37
+
38
+ ### Props
39
+
40
+ <Controls of={PlaygroundSecondary} />
41
+
42
+ ## Usage Examples
43
+
44
+ ### ✅ Do: Simple secondary action button
45
+
46
+ Use a clear, concise label (maximum 3 words) for secondary actions like cancel, back, or alternative options.
47
+
48
+ <Canvas of={DoSimpleSecondary} />
49
+
50
+ ### ✅ Do: Button with icon at start
51
+
52
+ Icons can help clarify the action. Place them at the start of the button.
53
+
54
+ <Canvas of={DoIconStartSecondary} />
55
+
56
+ ### ✅ Do: Button with icon at end
57
+
58
+ Place icons at the end for navigation or backward actions.
59
+
60
+ <Canvas of={DoIconEndSecondary} />
61
+
62
+ ### ✅ Do: Submit button
63
+
64
+ Use `submit` prop for form submissions when the secondary action is to submit.
65
+
66
+ <Canvas of={DoSubmitSecondary} />
67
+
68
+ ### ✅ Do: Danger mode
69
+
70
+ Use danger mode for destructive secondary actions that require caution.
71
+
72
+ <Canvas of={DoDangerSecondary} />
73
+
74
+ ### ✅ Do: Small variant
75
+
76
+ Use the small variant when space is limited.
77
+
78
+ <Canvas of={DoSmallSecondary} />
16
79
 
17
80
  ## Rules
81
+
82
+ ### ⛔ Don't: Long labels
83
+
84
+ Avoid long labels that exceed 3 words. Keep button text concise and action-oriented.
85
+
86
+ **❌ Don't:**
87
+
88
+ <Canvas of={DontLongLabelSecondary} />
89
+
90
+ **✅ Do:**
91
+
92
+ <Canvas of={DoShortLabelSecondary} />
93
+
94
+ ### ⛔ Don't: Use secondary as primary action
95
+
96
+ Never use secondary buttons for the main action on a screen. Use primary buttons for the most important action.
97
+
98
+ **❌ Don't:**
99
+
100
+ <Canvas of={DontSecondaryAsPrimary} />
101
+
102
+ **✅ Do:**
103
+
104
+ <Canvas of={DoSecondaryForCancel} />
105
+
106
+ ### ⛔ Don't: Overuse of icons
107
+
108
+ Don't overload buttons with multiple icons or decorative elements that don't add value.
109
+
110
+ **❌ Don't:**
111
+
112
+ <Canvas of={DontTooManyIconsSecondary} />
113
+
114
+ **✅ Do:**
115
+
116
+ <Canvas of={DoOneIconSecondary} />
117
+
118
+ ### ⛔ Don't: Generic labels
119
+
120
+ Avoid generic labels like "Click here" or "Button". Use specific action verbs.
121
+
122
+ **❌ Don't:**
123
+
124
+ <Canvas of={DontGenericLabelSecondary} />
125
+
126
+ **✅ Do:**
127
+
128
+ <Canvas of={DoSpecificLabelSecondary} />
@@ -0,0 +1,99 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
2
+ import {
3
+ PlaygroundCheckboxCaptionGroup,
4
+ DoWithClearLabels,
5
+ DoWithHelpfulCaptions,
6
+ DoWithColumnLayout,
7
+ DontNoLabel,
8
+ DoWithLabel,
9
+ DontNoCaptions,
10
+ DoWithErrorFeedback,
11
+ } from '../components/form/BmsInputCheckboxCaptionGroup.stories.js';
12
+
13
+ <Meta title="Documentation/Fields/Checkbox Caption Group" />
14
+
15
+ # <img src="./BmsIcon.png" /> Checkbox Caption Group
16
+
17
+ A checkbox caption group consists of a set of interconnected checkboxes where each option can have its own caption. This allows you to provide specific information or descriptions for each individual choice. Checkbox caption groups are ideal when each option needs its own contextual information, such as pricing details, feature descriptions, or specific instructions for each choice. Unlike radio groups, checkboxes allow users to select multiple options.
18
+
19
+ ## Anatomy
20
+
21
+ Checkbox caption groups consist of a label that describes the overall choice, multiple checkbox 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
+ ## Component
24
+
25
+ Use the controls below to interact with the component and see how it behaves with different configurations.
26
+
27
+ <Canvas of={PlaygroundCheckboxCaptionGroup} />
28
+
29
+ ### Props
30
+
31
+ <Controls of={PlaygroundCheckboxCaptionGroup} />
32
+
33
+ ## Usage Examples
34
+
35
+ ### ✅ Do: Checkbox caption group with clear labels
36
+
37
+ Always provide clear, descriptive labels for each option that explain what the choice represents.
38
+
39
+ <Canvas of={DoWithClearLabels} />
40
+
41
+ ### ✅ Do: Checkbox caption group with helpful captions
42
+
43
+ Use captions to provide specific information for each option, such as pricing, features, or additional context that helps users make an informed decision.
44
+
45
+ <Canvas of={DoWithHelpfulCaptions} />
46
+
47
+ ### ✅ Do: Checkbox caption group in column layout
48
+
49
+ Use the column layout when you have longer option labels or captions, or when you want to display options vertically for better readability.
50
+
51
+ <Canvas of={DoWithColumnLayout} />
52
+
53
+ ### ✅ Do: Checkbox caption group with error feedback
54
+
55
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
56
+
57
+ <Canvas of={DoWithErrorFeedback} />
58
+
59
+ ## Rules
60
+
61
+ ### ⛔ Don't: Missing labels
62
+
63
+ Always provide a label for accessibility and clarity. Labels help screen readers and provide context about what choices are expected.
64
+
65
+ **❌ Don't:**
66
+
67
+ <Canvas of={DontNoLabel} />
68
+
69
+ **✅ Do:**
70
+
71
+ <Canvas of={DoWithLabel} />
72
+
73
+ ### ⛔ Don't: No captions when needed
74
+
75
+ 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.
76
+
77
+ **❌ Don't:**
78
+
79
+ <Canvas of={DontNoCaptions} />
80
+
81
+ **✅ Do:**
82
+
83
+ <Canvas of={DoWithHelpfulCaptions} />
84
+
85
+ ## When to use Checkbox Caption Group vs Checkbox Group
86
+
87
+ **Use Checkbox Caption Group** when:
88
+
89
+ - Each option needs its own specific information or description
90
+ - You need to display different details for each choice (e.g., pricing, features, delivery times)
91
+ - Options have distinct characteristics that require individual explanation
92
+
93
+ **Use Checkbox Group** when:
94
+
95
+ - All options share the same context or information
96
+ - You only need a single caption that applies to all options
97
+ - Options are simple and self-explanatory without individual descriptions
98
+
99
+ The key difference is that Checkbox Caption Group allows you to provide **individual captions for each option**, while Checkbox Group provides **one caption for the entire group**.
@@ -0,0 +1,99 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
2
+ import {
3
+ PlaygroundCheckboxGroup,
4
+ DoWithClearLabels,
5
+ DoWithCaption,
6
+ DoWithColumnLayout,
7
+ DontNoLabel,
8
+ DoWithLabel,
9
+ DontNoErrorFeedback,
10
+ DoWithErrorFeedback,
11
+ } from '../components/form/BmsInputCheckboxGroup.stories.js';
12
+
13
+ <Meta title="Documentation/Fields/Checkbox Group" />
14
+
15
+ # <img src="./BmsIcon.png" /> Checkbox Group
16
+
17
+ A checkbox group consists of a set of interconnected checkboxes with a single caption that applies to all options. Checkbox 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. Unlike radio groups, checkboxes allow users to select multiple options.
18
+
19
+ ## Anatomy
20
+
21
+ Checkbox groups consist of a label that describes the overall choice, multiple checkbox 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
+ ## Component
24
+
25
+ Use the controls below to interact with the component and see how it behaves with different configurations.
26
+
27
+ <Canvas of={PlaygroundCheckboxGroup} />
28
+
29
+ ### Props
30
+
31
+ <Controls of={PlaygroundCheckboxGroup} />
32
+
33
+ ## Usage Examples
34
+
35
+ ### ✅ Do: Checkbox group with clear labels
36
+
37
+ Always provide clear, descriptive labels for each option that explain what the choice represents.
38
+
39
+ <Canvas of={DoWithClearLabels} />
40
+
41
+ ### ✅ Do: Checkbox group with caption
42
+
43
+ Use a caption to provide general information that applies to all options, such as instructions, requirements, or context that helps users understand the choice.
44
+
45
+ <Canvas of={DoWithCaption} />
46
+
47
+ ### ✅ Do: Checkbox group in column layout
48
+
49
+ 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.
50
+
51
+ <Canvas of={DoWithColumnLayout} />
52
+
53
+ ### ✅ Do: Checkbox group with error feedback
54
+
55
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
56
+
57
+ <Canvas of={DoWithErrorFeedback} />
58
+
59
+ ## Rules
60
+
61
+ ### ⛔ Don't: Missing labels
62
+
63
+ Always provide a label for accessibility and clarity. Labels help screen readers and provide context about what choices are expected.
64
+
65
+ **❌ Don't:**
66
+
67
+ <Canvas of={DontNoLabel} />
68
+
69
+ **✅ Do:**
70
+
71
+ <Canvas of={DoWithLabel} />
72
+
73
+ ### ⛔ Don't: No error feedback
74
+
75
+ Always provide clear error messages when validation fails. Help users understand what went wrong and how to fix it.
76
+
77
+ **❌ Don't:**
78
+
79
+ <Canvas of={DontNoErrorFeedback} />
80
+
81
+ **✅ Do:**
82
+
83
+ <Canvas of={DoWithErrorFeedback} />
84
+
85
+ ## When to use Checkbox Group vs Checkbox Caption Group
86
+
87
+ **Use Checkbox Group** when:
88
+
89
+ - All options share the same context or information
90
+ - You only need a single caption that applies to all options
91
+ - Options are simple and self-explanatory without individual descriptions
92
+
93
+ **Use Checkbox Caption Group** when:
94
+
95
+ - Each option needs its own specific information or description
96
+ - You need to display different details for each choice (e.g., pricing, features, delivery times)
97
+ - Options have distinct characteristics that require individual explanation
98
+
99
+ The key difference is that Checkbox Group provides **one caption for the entire group**, while Checkbox Caption Group allows you to provide **individual captions for each option**.
@@ -1,28 +1,102 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
1
2
  import {
2
- Canvas,
3
- Meta,
4
- Story,
5
- Stories,
6
- Controls,
7
- } from '@storybook/addon-docs/blocks';
8
- import { Default as ChipDefault } from '../components/form/BmsChip.stories.js';
3
+ PlaygroundChip,
4
+ DoWithClearContent,
5
+ DoWithAppropriateColor,
6
+ DoWithShortContent,
7
+ DoWithStatusColor,
8
+ DontLongContent,
9
+ DoShortContent,
10
+ DontInappropriateColor,
11
+ DoAppropriateColor,
12
+ DontEmptyContent,
13
+ DoClearContent,
14
+ } from '../components/form/BmsChip.stories.js';
9
15
 
10
16
  <Meta title="Documentation/Chip" />
11
17
 
12
18
  # <img src="./BmsIcon.png" /> Chip
13
19
 
14
- A Chip is a component to make data representation, there is no actions attached to him.
20
+ A Chip is a component to make data representation, there is no actions attached to him. Chips are compact elements that represent an input, attribute, or action. They are commonly used to display status, categories, tags, or other metadata. Chips help users quickly scan and understand information at a glance.
15
21
 
16
22
  ![Chip representation](./chip/CoverChips.png)
17
23
 
18
24
  ## Anatomy
19
25
 
26
+ Chips consist of a container with background color, text content, and optional color coding to convey meaning. They are designed to be compact and visually distinct while maintaining readability.
27
+
20
28
  ![Chip representation](./chip/ChipRepresentation.png)
21
29
 
22
30
  ## Component
23
31
 
24
- <Canvas of={ChipDefault} args={{ label: 'toto' }} />
32
+ Use the controls below to interact with the component and see how it behaves with different configurations.
33
+
34
+ <Canvas of={PlaygroundChip} />
35
+
36
+ ### Props
37
+
38
+ <Controls of={PlaygroundChip} />
39
+
40
+ ## Usage Examples
41
+
42
+ ### ✅ Do: Chip with clear content
43
+
44
+ Always provide clear, concise content that is easy to understand at a glance.
45
+
46
+ <Canvas of={DoWithClearContent} />
47
+
48
+ ### ✅ Do: Chip with appropriate color
49
+
50
+ Use colors that match the semantic meaning of the content. Green for success/active, red for errors/danger, orange for warnings, etc.
51
+
52
+ <Canvas of={DoWithAppropriateColor} />
53
+
54
+ ### ✅ Do: Chip with short content
55
+
56
+ Keep chip content short and concise. Chips are meant to display brief information, not long descriptions.
57
+
58
+ <Canvas of={DoWithShortContent} />
59
+
60
+ ### ✅ Do: Chip with status color
61
+
62
+ Use color coding to quickly convey status information. This helps users understand the state without reading the text.
63
+
64
+ <Canvas of={DoWithStatusColor} />
65
+
66
+ ## Rules
67
+
68
+ ### ⛔ Don't: Long content
69
+
70
+ Avoid overly long content in chips. Long text makes chips difficult to read, breaks the layout, and defeats the purpose of compact data representation.
71
+
72
+ **❌ Don't:**
73
+
74
+ <Canvas of={DontLongContent} />
75
+
76
+ **✅ Do:**
77
+
78
+ <Canvas of={DoShortContent} />
79
+
80
+ ### ⛔ Don't: Inappropriate color usage
81
+
82
+ Don't use colors that contradict the semantic meaning of the content. This can confuse users and lead to misunderstandings.
83
+
84
+ **❌ Don't:**
85
+
86
+ <Canvas of={DontInappropriateColor} />
87
+
88
+ **✅ Do:**
89
+
90
+ <Canvas of={DoAppropriateColor} />
91
+
92
+ ### ⛔ Don't: Empty or unclear content
93
+
94
+ Always provide meaningful content in chips. Empty chips or unclear labels don't provide value to users.
95
+
96
+ **❌ Don't:**
97
+
98
+ <Canvas of={DontEmptyContent} />
25
99
 
26
- ### Table of props
100
+ **✅ Do:**
27
101
 
28
- <Controls of={ChipDefault} />
102
+ <Canvas of={DoClearContent} />
@@ -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
- Canvas,
3
- Meta,
4
- Story,
5
- Stories,
6
- Controls,
7
- } from '@storybook/addon-docs/blocks';
8
- import { Empty as InputFileDefault } from '../components/form/BmsInputFile.stories.js';
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 its show the result.
15
-
16
- ![InputFile representation](./fields/CoverInputFile.png)
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
  ![InputFile representation](./fields/InputMediaRepresentation.png)
21
26
 
22
27
  ## Component
23
28
 
24
- <Canvas of={InputFileDefault} args={{ label: 'toto' }} />
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
- ### Table of props
103
+ **✅ Do:**
27
104
 
28
- <Controls of={InputFileDefault} />
105
+ <Canvas of={DoWithCaption} />