@solid-design-system/mcp 6.29.1 → 6.30.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `sd-file-selector` component. _[`#3237`](https://github.com/solid-design-system/solid/pull/3237) [`cdab3e1`](https://github.com/solid-design-system/solid/commit/cdab3e1c704558ad4d437d9d19d5ad8db5062547) [@auroraVasconcelos](https://github.com/auroraVasconcelos)_
8
+
3
9
  ## 6.29.1
4
10
 
5
11
  ## 6.29.0
@@ -0,0 +1,139 @@
1
+ ## Overview
2
+
3
+ `<sd-file-selector>` — Used to select a file by clicking or dragging a file into a drop-area.
4
+
5
+ ## API
6
+
7
+ ### Examples
8
+
9
+ Use the components tool by passing the args `component` and `example` for any of these combinations:
10
+
11
+ - component: sd-file-selector, example: variant
12
+ - component: sd-file-selector, example: sizes
13
+ - component: sd-file-selector, example: label
14
+ - component: sd-file-selector, example: disabled
15
+ - component: sd-file-selector, example: visually-disabled
16
+ - component: sd-file-selector, example: help-text
17
+ - component: sd-file-selector, example: multiple-files
18
+ - component: sd-file-selector, example: hide-value
19
+ - component: sd-file-selector, example: required
20
+ - component: sd-file-selector, example: invalid
21
+ - component: sd-file-selector, example: directory
22
+
23
+ ### Key Properties
24
+
25
+ - prop.files: — The selected files as a `FileList` object. The `FileList` behaves like an array, so you can get the number of
26
+ selected files via its `length` property.
27
+ - prop.name: string, default='' — The name of the file selector, submitted as a name/value pair with form data.
28
+ - prop.title: string, default='' — The `title` attribute specifies extra information about an element most often as a default browser tooltip text when the mouse moves over the element.
29
+ - prop.value: — The value of the file selector contains a string that represents the path of the selected file. If multiple
30
+ files are selected, the value represents the first file in the list. The only valid value when setting a file
31
+ input is an empty string.
32
+ - prop.defaultValue: string, default='' — The default value of the form control. Primarily used for resetting the form control.
33
+ - prop.size: 'sm'|'md'|'lg', default='lg' — The file selector's size.
34
+ - prop.label: string, default='' — The file selector's label, this field is required to ensure accessibility. It is visually hidden by default, use the `showLabel` property to display it.
35
+ - prop.showLabel [attr: show-label]: boolean, default=false — Visually displays the file selector's label.
36
+ - prop.helpText [attr: help-text]: string, default='' — The file selector's help text. If you need to display HTML, use the `help-text` slot instead.
37
+ - prop.disabled: boolean, default=false — Disables the file selector.
38
+ - prop.visuallyDisabled [attr: visually-disabled]: boolean, default=false — Styles the input as if it was disabled and enables aria-disabled
39
+ - prop.droparea [attr: drop-area]: boolean, default=false — Draw the file selector as a drop area.
40
+ - prop.accept: string, default='' — Comma-separated list of supported file types (e.g. `.jpg,.png,image/*`).
41
+ - prop.styleOnValid [attr: style-on-valid]: boolean, default=false — Shows success styles if the validity of the input is valid.
42
+ - prop.capture: 'user'|'environment' — Specifies which camera to use for capture of image or video data. Works only when not using a droparea.
43
+ - prop.multiple: boolean, default=false — Indicates whether the user can select more than one file. Has no effect if `webkitdirectory` is set.
44
+ - prop.webkitdirectory: boolean, default=false — Indicates that the file selector should let the user select directories instead of files. Non-standard, but
45
+ supported by all major browsers.
46
+ - prop.form: string, default='' — By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you
47
+ to place the form control outside of a form and associate it with the form that has this `id`. The form must be in
48
+ the same document or shadow root for this to work.
49
+ - prop.required: boolean, default=false — Makes the input a required field.
50
+ - prop.hideValue [attr: hide-value]: boolean, default=false — Suppresses the value from being displayed in the file selector.
51
+ - prop.validity: — Gets the validity state object.
52
+ - prop.validationMessage: — Gets the validation message.
53
+ - prop.dir: 'ltr'|'rtl'|'auto' — The element's directionality.
54
+ - prop.lang: string — The element's language.
55
+
56
+ ### Events
57
+
58
+ - event.sd-blur: Emitted when the control loses focus.
59
+ - event.sd-change: Emitted when an alteration to the control's value is committed by the user.
60
+ - event.sd-error: Emitted when multiple files are selected via drag and drop, without the `multiple` property being set.
61
+ - event.sd-focus: Emitted when the control gains focus.
62
+ - event.sd-input: Emitted when the control receives input.
63
+
64
+ ### Slots
65
+
66
+ - slot.label: The file selector's label. Alternatively, you can use the `label` attribute.
67
+ - slot.help-text: Text that describes how to use the file selector. Alternatively, you can use the `help-text` attribute.
68
+
69
+ ### CSS Parts
70
+
71
+ - part.form-control: The form control that wraps the label, input, and help text.
72
+ - part.form-control-label: The label's wrapper.
73
+ - part.form-control-input: The input's wrapper.
74
+ - part.form-control-help-text: The help text's wrapper.
75
+ - part.button-wrapper: The wrapper around the button and text value.
76
+ - part.button: The sd-button acting as a file input trigger.
77
+ - part.value: The chosen files or placeholder text for the file input.
78
+ - part.droparea: The element wrapping the drop zone.
79
+ - part.droparea-background: The background of the drop zone.
80
+ - part.droparea-icon: The container that wraps the icon for the drop zone.
81
+ - part.droparea-value: The text for the drop zone.
82
+ - part.invalid-icon-message: The container that wraps the invalid icon and message.
83
+ - part.invalid-icon: The invalid icon.
84
+ - part.invalid-message: The invalid message.
85
+
86
+ ## Guidelines
87
+
88
+ ### Use Cases
89
+
90
+ - Select files or documents as part of a form submission.
91
+ - Attach supporting files in profile or account settings.
92
+ - Replace or update assets in content management workflows.
93
+ - Handle single or multiple file selections within any form or multi-step forms.
94
+
95
+ #### Default
96
+
97
+ Use the `default` variant when the select action is secondary to other form fields, or when space is limited.
98
+
99
+ - Inline file selector in dense or compact forms.
100
+ - Single-file selection where minimal visual weight is needed.
101
+ - Flows where the selection action sits alongside other inputs.
102
+
103
+ #### Drop Area
104
+
105
+ Use the `drop-area` variant when file selector is the primary action on the page or step.
106
+
107
+ - Dedicated selector steps in multi-step flows.
108
+ - Scenarios where drag-and-drop is a likely or preferred interaction.
109
+ - Select flows that support multiple files at once.
110
+
111
+ ### Rules
112
+
113
+ <b>Do not mix both variants within the same form or flow.</b>
114
+
115
+ ### Label and Help Text
116
+
117
+ - Always provide a descriptive label (e.g., "Select file", "Signed contract").
118
+ - Use help text to communicate accepted file types and size limits
119
+ - Do not rely on the drop-area copy alone to convey constraints.
120
+
121
+ ### Error Handling
122
+
123
+ - Use error-text to surface validation errors: below the component (default variant) or next to each individual file selector when the "show selected files" attribute is active (drop-area variant).
124
+ - Write error text in plain language with a clear solution (e.g., "The file is too large. Maximum allowed size is 5 MB.").
125
+
126
+ ### Per-error-type copy guidance
127
+
128
+ - Provide distinct error messages for each failure scenario rather than a generic fallback — for example: wrong file type, file too large, empty file, too many files, or selection failure.
129
+
130
+ ### Background
131
+
132
+ - Use light background options such as white, neutral-100, or primary-100.
133
+
134
+ ### Accessibility
135
+
136
+ - Use `visually-disabled` to keep disabled elements focusable and tooltip-accessible.
137
+ - Associate error text via `aria-describedby` so they are announced on focus.
138
+ - Use the `visually-disabled` attribute to keep disabled elements focusable, hoverable, and able to show tooltips, as they’re otherwise removed from the tab order and inaccessible to screen readers.
139
+ - A label must always be provided, even when it is visually hidden. The label is used to provide an accessible name for the file selector, ensuring that screen reader users can identify the purpose of the control.
@@ -0,0 +1,6 @@
1
+ Use the `webkitdirectory` attribute to allow directory selection.
2
+ **Note:** As it is a non-standard attribute, browser support may vary. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file#webkitdirectory) for more information.
3
+
4
+ ```html
5
+ <sd-file-selector label="Select a directory to upload" show-label webkitdirectory></sd-file-selector>
6
+ ```
@@ -0,0 +1,5 @@
1
+ Use the `disabled` attribute to disable the file selector.
2
+
3
+ ```html
4
+ <sd-file-selector label="Select a file to upload" disabled></sd-file-selector>
5
+ ```
@@ -0,0 +1,19 @@
1
+ Use the `help-text` attribute to provide additional context or instructions as:
2
+
3
+ - file size restrictions
4
+ - file format requirements
5
+ - file selection limit
6
+ For help-text that contain HTML, use the help-text slot instead.
7
+
8
+ ```html
9
+ <div class="flex flex-col gap-10">
10
+ <sd-file-selector
11
+ label="Select a file to upload"
12
+ help-text="Max file size is 3 MB. Only PDF, JPG and PNG files are supported."
13
+ >
14
+ </sd-file-selector>
15
+ <sd-file-selector label="Select a file to upload">
16
+ <div slot="help-text" class="text-lg">Max file size is 3 MB. Only PDF, JPG and PNG files are supported.</div>
17
+ </sd-file-selector>
18
+ </div>
19
+ ```
@@ -0,0 +1,5 @@
1
+ Use the `hide-value` attribute where you don’t want to show the selected value.
2
+
3
+ ```html
4
+ <sd-file-selector label="Select a file to upload" hide-value></sd-file-selector>
5
+ ```
@@ -0,0 +1,14 @@
1
+ The component gets `invalid` state when the form is not valid.
2
+
3
+ ```html
4
+ <form id="invalid-form">
5
+ <sd-file-selector id="invalid-file-selector" label="Select a file to upload" show-label> </sd-file-selector>
6
+ </form>
7
+ <script type="module">
8
+ await Promise.all([customElements.whenDefined('sd-file-selector')]).then(() => {
9
+ const fileSelector = document.getElementById('invalid-file-selector');
10
+ fileSelector.setCustomValidity('Please select a file.');
11
+ fileSelector.reportValidity();
12
+ });
13
+ </script>
14
+ ```
@@ -0,0 +1,13 @@
1
+ Use the `label` attribute to add an accessible label to the file selector.
2
+ For labels that contain HTML, use the label slot instead.
3
+ This label is visually hidden by default, to display it, use the `show-label` attribute.
4
+
5
+ ```html
6
+ <div class="flex flex-col gap-10">
7
+ <sd-file-selector label="Select a file to upload"></sd-file-selector>
8
+ <sd-file-selector label="Select a file to upload" show-label></sd-file-selector>
9
+ <sd-file-selector label="Select a file to upload" show-label>
10
+ <div slot="label" class="text-lg">Label slot</div>
11
+ </sd-file-selector>
12
+ </div>
13
+ ```
@@ -0,0 +1,5 @@
1
+ Use the `multiple` attribute to allow multiple files selection.
2
+
3
+ ```html
4
+ <sd-file-selector label="Select a file to upload" multiple></sd-file-selector>
5
+ ```
@@ -0,0 +1,6 @@
1
+ Use the `required` attribute to make the file selector a required field. This can be used for form validation purposes.
2
+ **Note:** For accessibility reasons, required fields must always display a visible label and value.
3
+
4
+ ```html
5
+ <sd-file-selector label="Required" show-label required></sd-file-selector>
6
+ ```
@@ -0,0 +1,14 @@
1
+ Use the `size` attribute to change the size:
2
+
3
+ - `lg` (default)
4
+ - `md`
5
+ - `sm`
6
+ On drop-area variant “md” and “sm” sizes are not available.
7
+
8
+ ```html
9
+ <div class="flex flex-col gap-10">
10
+ <sd-file-selector size="lg" label="sd-file-selector large size"></sd-file-selector>
11
+ <sd-file-selector size="md" label="sd-file-selector medium size"></sd-file-selector>
12
+ <sd-file-selector size="sm" label="sd-file-selector small size"></sd-file-selector>
13
+ </div>
14
+ ```
@@ -0,0 +1,8 @@
1
+ Use the `drop-area` attribute to switch to a drop area appearance.
2
+
3
+ ```html
4
+ <div class="flex flex-col gap-10">
5
+ <sd-file-selector label="sd-file-selector default variant"></sd-file-selector>
6
+ <sd-file-selector drop-area label="sd-file-selector drop area variant"></sd-file-selector>
7
+ </div>
8
+ ```
@@ -0,0 +1,9 @@
1
+ Use the `visually-disabled` attribute to style the component as if it was disabled and enable `aria-disabled` to allow it to be reachable by screen readers. When using this attribute, make sure to provide ways to inform the user why the element is disabled and how to enable it. This can be done by using the `help-text` attribute or wrapping the element in a sd-tooltip. Disabling elements is not recommended for accessibility reasons.
2
+
3
+ ```html
4
+ <div class="w-[250px] pt-12">
5
+ <sd-tooltip content="Visually disabled" trigger="hover focus" size="sm" placement="top">
6
+ <sd-file-selector value="Visually disabled" label="Select a file to upload" visually-disabled></sd-file-selector
7
+ ></sd-tooltip>
8
+ </div>
9
+ ```
@@ -614,16 +614,16 @@
614
614
  "displayNameDe": "Bildschirm Cursor",
615
615
  "tags": ["klicken", "auswählen"]
616
616
  },
617
- {
618
- "technicalId": "file-read-out",
619
- "displayNameDe": "Dokument vorlesen",
620
- "tags": ["vorlesen", "Audio", "Lautstärke"]
621
- },
622
617
  {
623
618
  "technicalId": "layers",
624
619
  "displayNameDe": "Ebenen",
625
620
  "tags": ["gruppieren", "Stapel", "mehrere Folien erzeugen"]
626
621
  },
622
+ {
623
+ "technicalId": "file-read-out",
624
+ "displayNameDe": "Dokument vorlesen",
625
+ "tags": ["vorlesen", "Audio", "Lautstärke"]
626
+ },
627
627
  {
628
628
  "technicalId": "collapse-left",
629
629
  "displayNameDe": "einklappen links",
@@ -844,16 +844,16 @@
844
844
  "displayNameDe": "Lesezeichen",
845
845
  "tags": ["merken", "Markierung", "markiert", "Favoriten"]
846
846
  },
847
- {
848
- "technicalId": "flash",
849
- "displayNameDe": "Blitz",
850
- "tags": ["Pfeil", "Fehler", "falsch"]
851
- },
852
847
  {
853
848
  "technicalId": "arrow-right",
854
849
  "displayNameDe": "Pfeil rechts",
855
850
  "tags": ["Pfeil", "vorwärts", "weiter"]
856
851
  },
852
+ {
853
+ "technicalId": "flash",
854
+ "displayNameDe": "Blitz",
855
+ "tags": ["Pfeil", "Fehler", "falsch"]
856
+ },
857
857
  {
858
858
  "technicalId": "arrow-top",
859
859
  "displayNameDe": "Pfeil oben",
package/package.json CHANGED
@@ -20,9 +20,9 @@
20
20
  "prettier": "^3.9.5",
21
21
  "tsx": "^4.23.1",
22
22
  "typescript": "^5.9.3",
23
- "@solid-design-system/components": "6.29.1",
24
- "@solid-design-system/styles": "6.29.1",
25
- "@solid-design-system/tokens": "6.29.1"
23
+ "@solid-design-system/tokens": "6.30.0",
24
+ "@solid-design-system/components": "6.30.0",
25
+ "@solid-design-system/styles": "6.30.0"
26
26
  },
27
27
  "exports": {
28
28
  ".": {
@@ -59,7 +59,7 @@
59
59
  "directory": "packages/mcp"
60
60
  },
61
61
  "type": "module",
62
- "version": "6.29.1",
62
+ "version": "6.30.0",
63
63
  "scripts": {
64
64
  "build": "pnpm run build:components && pnpm run build:tokens && pnpm run build:ts && pnpm run build:metadata && cd ../.. && pnpm exec prettier --write --log-level warn packages/mcp/metadata",
65
65
  "build:components": "cd ../components && pnpm exec node scripts/make-metadata.js --outdir dist",