chore(dropzone): full fidelity#6446
Conversation
|
1b2b242 to
607abae
Compare
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
94ac3a6 to
2aab51e
Compare
607abae to
26dc7e5
Compare
2aab51e to
42b0387
Compare
26dc7e5 to
87928fd
Compare
5t3ph
left a comment
There was a problem hiding this comment.
Blocking to assess a functional change of possibly adding a filled-content slot.
420a581 to
40b81e4
Compare
42b0387 to
fce646e
Compare
15ada21 to
972adaa
Compare
fce646e to
2acf4ea
Compare
…override directly
972adaa to
a32b450
Compare
5t3ph
left a comment
There was a problem hiding this comment.
Would you mind creating a ticket to investigate if we'd want to add something akin to React's FileTrigger (embedded in their DropZone demo, no separate docs) to help facilitate more of the upload operation? It's still feeling odd to me that we turn over so much to consumers to have to handle for the logic.
S1 showed a very rudimentary way to open a hidden file input, which we might want to demo at minimum. Could be done in the docs phase.
| } as const satisfies Record<DropzoneSize, string>; | ||
|
|
||
| const DROPZONE_SVG = ` | ||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 103" slot="" aria-hidden="true"> |
| <div class="swc-Dropzone"> | ||
| <div role="status" aria-live="polite" class="swc-Dropzone-status"></div> | ||
| <slot @slotchange=${this.handleDefaultSlotChange}></slot> | ||
| <slot name="filled-content"></slot> |
There was a problem hiding this comment.
Update to swap between the default slot and filled-content slot based on whether the element has the filled property, otherwise there's not value in having the filled-content slot.
Also please update stories that include the filled presentation to still include default slot content to prove/demo this swap.
| ${unsafeHTML(DROPZONE_SVG)} | ||
| <h2 slot="heading">${headingText}</h2> | ||
| </swc-illustrated-message> | ||
| <swc-button variant="accent" size=${size}>Browse files</swc-button> |
There was a problem hiding this comment.
Commenting as a reminder / for visibility of the need to update the buttons in these templates to move into the illustrated message new actions slot 🙌
| ───────────────────────────────────── */ | ||
|
|
||
| /* Mirror the dragged border when the browse control receives keyboard focus. */ | ||
| :host(:focus-within) .swc-Dropzone { |
There was a problem hiding this comment.
You could combine this selector with the dragged one, excluding the background, since border properties are the same.
| align-items: center; | ||
| justify-content: center; | ||
| padding: var(--swc-dropzone-padding, token("spacing-400")); | ||
| background: var(--swc-dropzone-background-color, transparent); |
There was a problem hiding this comment.
Still a bit of mixed use on the custom properties exposure and overrides - we can huddle after break if you need clarity on this beyond the docs examples!
There was a problem hiding this comment.
Gotcha! I ran through the docs and updated here 261364c. We can chat after the break too ✨
e8780f7 to
5096f04
Compare
5096f04 to
65c7ab4
Compare


Description
Phase 5 (CSS migration and stories) of the
swc-dropzoneSpectrum 2 migration. This PR is stacked on top of the file-structure PR and should be merged after that PR lands.Changes in this PR:
Dropzone.types.ts— AddedDropzoneSizetype andDROPZONE_VALID_SIZESconstant ('s' | 'm' | 'l'); addedDropzoneEventDetailtype alias for consumers who imported it from the 1st-gen packageDropzone.base.ts— AppliedSizedMixinwithvalidSizes: DROPZONE_VALID_SIZESto expose thesizeattribute on the base class;sizeis new in 2nd-gen (not in 1st-gen)Dropzone.ts— Updatedrender()to emit a.swc-Dropzonewrapper and aswc-Dropzone-statusvisually-hidden live region; added@csspropJSDoc for all five exposed custom properties; fixed@paramname mismatch in_onDragStateChangeJSDocdropzone.css— Full S2 token-based stylesheet: CSS-only dashed/solid border, size-variant padding overrides, dragged and filled state selectors,--swc-illustrated-message-illustration-colorcascade for accent-colored illustration in dragged state, and@media (forced-colors: active)blockdropzone.stories.ts— New stories file with Playground, Overview, Anatomy, Sizes (options), and States stories; Behaviors and Accessibility stubs deferred to Phase 7preview.ts— Added'Migration plan'to the Dropzone reference doc list in the Storybook sidebarMotivation and context
This is Phase 5 of the Dropzone Spectrum 2 migration. The CSS migration replaces the 1st-gen Spectrum CSS dependency with 2nd-gen S2 tokens (
token()calls), introduces size variants (new in 2nd-gen), and ensures the component renders correctly in both default and dragged/filled states.Key design decisions resolved during this phase:
border(dashed/solid toggling) rather than an SVG stroke, matching the currentspectrum-cssmain branch approach; SVG stroke can be revisited if the Figma or CSS spec diverges--swc-illustrated-message-illustration-coloris set on:host([dragged])and cascades through the DOM intoswc-illustrated-message's shadow via normal CSS custom property inheritance; no::slotted()selector needed for colorRelated issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Default state renders correctly
mDragged state applies correctly
draggedin the Playground controls; confirm the transition is immediateFilled state hides the illustrated message
Size variants change padding only
s,m, andlinstancesForced-colors / high-contrast mode
ButtonText; dragged: backgroundCanvas, borderHighlightDevice review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps.
Keyboard (required — document steps below)
role="group"is announced and the accessible name is readScreen reader (required — document steps below)
aria-live="polite") announces the state change whendraggedis toggled programmaticallydisplay: nonewhen[filled]) and only the uploaded-content region is announced