Skip to content

Commit ee48864

Browse files
marissahuysentruytrise-erpelding
authored andcommitted
docs(slider,meter,progressbar,dropzone,illustratedmessage): migration roadmap (#5775)
* docs: add component analysis docs adds migration roadmap and component analysis docs for meter, progress bar, slider, illustrated message and drop zone.
1 parent 6642d8c commit ee48864

File tree

5 files changed

+1418
-112
lines changed

5 files changed

+1418
-112
lines changed

migration-roadmap/dropzone.md

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# Dropzone migration roadmap
2+
3+
## Component specifications
4+
5+
### CSS
6+
7+
<details>
8+
<summary>CSS selectors</summary>
9+
10+
- `.spectrum-DropZone`
11+
- `.spectrum-DropZone .spectrum-IllustratedMessage`
12+
13+
**Subcomponents:**
14+
15+
- `.spectrum-DropZone-actions`
16+
- `.spectrum-DropZone.is-filled.is-dragged .spectrum-DropZone-actions`
17+
- `.spectrum-DropZone-button`
18+
- `.spectrum-DropZone-button .spectrum-Button-label`
19+
- `.spectrum-DropZone-content`
20+
- `.spectrum-DropZone.is-filled.is-dragged .spectrum-DropZone-content`
21+
- `.spectrum-DropZone-stroke`
22+
- `.spectrum-DropZone-strokePath`
23+
- `.spectrum-DropZone.is-dragged .spectrum-DropZone-strokePath`
24+
- `.spectrum-DropZone:has(.spectrum-DropZone-stroke)`
25+
26+
**Interactive states:**
27+
28+
- `.spectrum-DropZone-button:focus`
29+
- `.spectrum-DropZone-button:hover`
30+
- `.spectrum-DropZone:focus-visible`
31+
32+
**Variants:**
33+
34+
- `.spectrum-DropZone.is-dragged`
35+
- `.spectrum-DropZone.is-filled`
36+
- `.spectrum-DropZone.is-filled.is-dragged`
37+
38+
</details>
39+
40+
<details>
41+
<summary>Passthroughs</summary>
42+
43+
- `--mod-button-border-radius`
44+
- `--mod-illustrated-message-description-font-size`
45+
- `--mod-illustrated-message-description-position`
46+
- `--mod-illustrated-message-description-to-action`
47+
- `--mod-illustrated-message-description-z-index`
48+
- `--mod-illustrated-message-display`
49+
- `--mod-illustrated-message-illustration-color`
50+
- `--mod-illustrated-message-vertical-maximum-width`
51+
52+
</details>
53+
54+
<details>
55+
<summary>Modifiers</summary>
56+
57+
- `--mod-drop-zone-background-color`
58+
- `--mod-drop-zone-background-color-opacity`
59+
- `--mod-drop-zone-background-color-opacity-filled`
60+
- `--mod-drop-zone-body-font-size`
61+
- `--mod-drop-zone-body-to-action`
62+
- `--mod-drop-zone-border-color`
63+
- `--mod-drop-zone-border-color-hover`
64+
- `--mod-drop-zone-border-dash-gap`
65+
- `--mod-drop-zone-border-dash-length`
66+
- `--mod-drop-zone-border-style`
67+
- `--mod-drop-zone-border-style-dragged`
68+
- `--mod-drop-zone-border-width`
69+
- `--mod-drop-zone-content-background-color`
70+
- `--mod-drop-zone-content-bottom-to-text`
71+
- `--mod-drop-zone-content-font-family`
72+
- `--mod-drop-zone-content-font-size`
73+
- `--mod-drop-zone-content-font-weight`
74+
- `--mod-drop-zone-content-height`
75+
- `--mod-drop-zone-content-max-width`
76+
- `--mod-drop-zone-content-maximum-width`
77+
- `--mod-drop-zone-content-top-to-text`
78+
- `--mod-drop-zone-corner-radius`
79+
- `--mod-drop-zone-edge-to-text`
80+
- `--mod-drop-zone-illustration-color-hover`
81+
- `--mod-drop-zone-inline-size`
82+
- `--mod-drop-zone-padding`
83+
- `--mod-drop-zone-title-line-height`
84+
85+
</details>
86+
87+
### SWC
88+
89+
<details>
90+
<summary>Attributes</summary>
91+
92+
- `dropEffect` (String) - Controls the feedback during drag and drop: 'copy', 'move', 'link', or 'none'
93+
- `isDragged` (Boolean) - Indicates that files are currently being dragged over the dropzone
94+
- `isFilled` (Boolean) - Set to indicate that the component is in a filled state
95+
96+
</details>
97+
98+
<details>
99+
<summary>Slots</summary>
100+
101+
- Default slot - drop zone content (i.e. `<sp-illustrated-message>`, links, instructive copy)
102+
103+
</details>
104+
105+
## Comparison
106+
107+
### DOM Structure changes
108+
109+
<details>
110+
<summary>Spectrum Web Components:</summary>
111+
112+
```html
113+
<!-- The default slot is intended for `<sp-illustrated-message>`, links, instructive copy, etc. that make up the dropzone content. -->
114+
<slot></slot>
115+
```
116+
117+
</details>
118+
119+
<details>
120+
<summary>Legacy (CSS main branch):</summary>
121+
122+
```html
123+
<div class="spectrum-DropZone" role="region" tabindex="0">
124+
<div class="spectrum-IllustratedMessage">
125+
<svg class="spectrum-IllustratedMessage-illustration">
126+
<!-- Custom illustration SVG and illustrated message markup -->
127+
</svg>
128+
</div>
129+
130+
<!-- dropzone content is display: none by default -->
131+
<div class="spectrum-DropZone-content">
132+
<button class="spectrum-DropZone-button">Select files</button>
133+
<!-- .spectrum-ActionButton markup -->
134+
</div>
135+
</div>
136+
```
137+
138+
</details>
139+
140+
<details>
141+
<summary>Spectrum 2 (CSS spectrum-two branch):</summary>
142+
143+
```html
144+
<div class="spectrum-DropZone" role="region" tabindex="0">
145+
<svg
146+
class="spectrum-DropZone-stroke"
147+
xmlns="http://www.w3.org/2000/svg"
148+
preserveAspectRatio="none"
149+
>
150+
<rect
151+
x="1"
152+
y="1"
153+
rx="10px"
154+
ry="10px"
155+
fill="none"
156+
width="100%"
157+
height="100%"
158+
stroke-linecap="round"
159+
stroke-linejoin="round"
160+
vector-effect="non-scaling-stroke"
161+
class="spectrum-DropZone-strokePath"
162+
/>
163+
</svg>
164+
165+
<div class="spectrum-DropZone-content">
166+
<div class="spectrum-IllustratedMessage">
167+
<svg class="spectrum-IllustratedMessage-illustration">
168+
<!-- Custom illustration SVG -->
169+
</svg>
170+
</div>
171+
172+
<div class="spectrum-DropZone-actions">
173+
<button class="spectrum-Button">
174+
<!-- .spectrum-Button markup -->
175+
</button>
176+
</div>
177+
</div>
178+
</div>
179+
```
180+
181+
</details>
182+
183+
<details>
184+
<summary>Diff: Legacy (CSS main) → Spectrum 2 (CSS spectrum-two)</summary>
185+
186+
### HTML Output Diff
187+
188+
**Key Structural Changes:**
189+
190+
```diff
191+
<div class="spectrum-DropZone" role="region" tabindex="0">
192+
+ <svg class="spectrum-DropZone-stroke" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none">
193+
+ <rect x="1" y="1" rx="10px" ry="10px" fill="none" width="100%" height="100%" stroke-linecap="round" stroke-linejoin="round" vector-effect="non-scaling-stroke" class="spectrum-DropZone-strokePath" />
194+
+ </svg>
195+
196+
- <div class="spectrum-IllustratedMessage">
197+
- <svg class="spectrum-IllustratedMessage-illustration">
198+
- <!-- Custom illustration SVG and illustrated message markup -->
199+
- </svg>
200+
- </div>
201+
-
202+
<div class="spectrum-DropZone-content">
203+
- <button class="spectrum-DropZone-button">Select files</button>
204+
- <!-- .spectrum-ActionButton markup -->
205+
+ <div class="spectrum-IllustratedMessage">
206+
+ <svg class="spectrum-IllustratedMessage-illustration">
207+
+ <!-- Custom illustration SVG -->
208+
+ </svg>
209+
+ </div>
210+
+
211+
+ <div class="spectrum-DropZone-actions">
212+
+ <button class="spectrum-Button">
213+
+ <!-- .spectrum-Button markup -->
214+
+ </button>
215+
+ </div>
216+
</div>
217+
</div>
218+
```
219+
220+
### Key Changes in HTML Structure
221+
222+
1. **Enhanced visual border**: Added SVG stroke element (`.spectrum-DropZone-stroke`) with customizable dashed border styling that provides better visual feedback during drag operations.
223+
224+
2. **Restructured content organization**: Moved the illustrated message inside the `.spectrum-DropZone-content` container and separated actions into dedicated `.spectrum-DropZone-actions` container for better structural hierarchy.
225+
226+
3. **Button component upgrade**: Switched from `ActionButton` to `Button` component for improved consistency with other Spectrum components.
227+
228+
4. **Improved content flow**: The content container now properly wraps both the illustrated message and actions, creating a more logical content structure.
229+
230+
</details>
231+
232+
### CSS => SWC mapping
233+
234+
| CSS selector | Attribute or slot | Status |
235+
| ------------------------------- | ---------------------------------------- | ---------------------------- |
236+
| `.spectrum-DropZone` | `:host` | Implemented |
237+
| `.spectrum-DropZone.is-dragged` | `isDragged` attribute | Implemented |
238+
| `.spectrum-DropZone.is-filled` | `isFilled` attribute | Implemented |
239+
| `.spectrum-DropZone-content` | default slot; `<sp-illustrated-message>` | Implemented |
240+
| `.spectrum-DropZone-button` | default slot; `<sp-button>` | Implemented |
241+
| `.spectrum-DropZone-actions` | Actions container | Missing from WC (new for S2) |
242+
| `.spectrum-DropZone-stroke` | SVG stroke border | Missing from WC (new for S2) |
243+
| `.spectrum-DropZone-strokePath` | SVG path element | Missing from WC (new for S2) |
244+
245+
## Summary of changes
246+
247+
### CSS => SWC implementation gaps
248+
249+
- **Content structure**: The web component will require updating the internal structure including `.spectrum-DropZone-content`, `.spectrum-DropZone-actions`, and associated button elements. The `.spectrum-DropZone-content` and `.spectrum-DropZone-actions` classes are styled based on the Figma design specs. The SWC implementation provides only a simple slot-based container. We should consider if this approach is the approach we prefer moving into Spectrum 2 since the single-slot approach leaves the option open for lots of potentially unnecessary customization by the consumer (i.e. consumers could freely compose a drop zone with other components that does not follow the design expectations and standards).
250+
251+
- **Visual border system**: Missing the SVG-based stroke system (`.spectrum-DropZone-stroke` and `.spectrum-DropZone-strokePath`) provides enhanced visual feedback with customizable dashed borders. The svg borders were implemented in place of the CSS-only dashed border style to ensure the dashes have the corner rounding as laid out in the design spec.
252+
253+
- **Built-in UI elements**: The web component doesn't include built-in illustrated message and button components, requiring developers to manually compose these elements in the slot.
254+
255+
- **State-specific styling**: While drag and fill states are tracked separately, the web component currently doesn't handle the combination state of dragged and filled. Some missing features include include a button when the drop zone is filled, taking advantage of the custom SVG border options when dragged and filled, and `<sp-drop-zone>` needs to support the background illustration for the filled state.
256+
257+
Also worth consideration is the concept of "filled" vs. "replace." The design file refers to the "filled" state as the "replace" variant, so we should consider an API refactor if we want to align with design intentions more.
258+
259+
### CSS Spectrum 2 changes
260+
261+
- **Enhanced border system**: Introduced SVG-based stroke system replacing simple CSS borders, providing better visual feedback and customization options for drag states.
262+
263+
- **Improved content organization**: Repurposed `.spectrum-DropZone-content` wrapper and separated actions into `.spectrum-DropZone-actions` container for better organization.
264+
265+
- **Component upgrades**: Switched from an action button to a button for better visual hierarchy and consistency. Additionally, the `.spectrum-Dropzone-content` element was set by default to `display: none` in Spectrum 1, but didn't wrap the corresponding illustrated message content. For Spectrum 2, the purpose of `.spectrum-Dropzone-content` has been updated to more accurately wrap the component's visual content and be displayed by default.
266+
267+
- **Enhanced state styling**: Added more sophisticated styling for filled and dragged state combinations, including background image support for filled states.
268+
269+
## Resources
270+
271+
- [CSS migration](https://github.com/adobe/spectrum-css/pull/3429)
272+
- [Spectrum 2 preview](https://spectrumcss.z13.web.core.windows.net/pr-2352/index.html?path=/docs/components-drop-zone--docs)
273+
- [React](https://react-spectrum.adobe.com/s2/index.html?path=/docs/dropzone--docs)

0 commit comments

Comments
 (0)