Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/grid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### Enhancements

- Add `--wp-grid-placeholder-outline-style` and
`--wp-grid-resize-preview-outline-style` CSS custom properties for
the drag-placeholder outline (default `dashed`) and resize-preview
border (default `solid`).
- Set `data-wp-dashboard-grid-resizing` on the `DashboardGrid` root
element while any tile resize gesture is active, so consumers can
adjust styles when the pointer may still hover tiles ([#78234](https://github.com/WordPress/gutenberg/pull/78234)).
Expand Down
8 changes: 5 additions & 3 deletions packages/grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ When `editMode` is true:
stays in place as a dashed placeholder while a clone follows the
cursor through `<DragOverlay>`.
- A resize handle appears on the bottom-right of each item. A
dashed outline previews the target size as the cursor moves.
solid outline previews the target size as the cursor moves.
- While any tile is dragging or resizing, `actionableArea` content
on every tile is set `inert` so hovers on other tiles can't steal
the gesture.
Expand Down Expand Up @@ -474,8 +474,10 @@ root itself via `style`). All values fall back to sensible defaults.
|----------|---------|------------|
| `--wp-grid-drag-preview-scale` | `1.05` | Lift scale of the drag-preview functional frame. Set to `1` to disable the lift. |
| `--wp-grid-placeholder-opacity` | `0.4` | Opacity of the placeholder tile (the original item while a drag is in flight). |
| `--wp-grid-placeholder-outline-color` | `var(--wpds-color-stroke-interactive-brand)` | Dashed outline color of the placeholder and of the resize-preview overlay. |
| `--wp-grid-placeholder-radius` | `0` | Border radius of the placeholder, used to match the consumer's tile shape so the dashed outline traces the right silhouette. |
| `--wp-grid-placeholder-outline-style` | `dashed` | Outline style of the drag placeholder (for example `solid` or `dotted`). |
| `--wp-grid-resize-preview-outline-style` | `solid` | Border style of the resize-preview overlay (for example `dashed` or `dotted`). |
| `--wp-grid-placeholder-outline-color` | `var(--wpds-color-stroke-interactive-brand)` | Outline color of the placeholder and of the resize-preview overlay. |
| `--wp-grid-placeholder-radius` | `0` | Border radius of the placeholder, used to match the consumer's tile shape so the outline traces the right silhouette. |

---

Expand Down
8 changes: 5 additions & 3 deletions packages/grid/src/dashboard-grid/grid-item.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
/*
* During drag, the original item acts as a placeholder in its grid
* cell while `<DragOverlay>` renders a clone that follows the cursor.
* Fading the placeholder and outlining it with a dashed border makes
* Fading the placeholder and outlining it makes
* the destination visible without any scaling or translation on the
* original element.
*/
.is-dragging {
opacity: var(--wp-grid-placeholder-opacity, 0.4);
pointer-events: none;
outline:
var(--wpds-border-width-sm) dashed
var(--wpds-border-width-sm)
var(--wp-grid-placeholder-outline-style, dashed)
Comment on lines +21 to +22

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can follow-up adding dedicated CSS tokens for the rest of the styles to keep Grid easily themeable by consumers.

var(--wp-grid-placeholder-outline-color, var(--wpds-color-stroke-interactive-brand));
border-radius: var(--wp-grid-placeholder-radius, 0);
}
Expand All @@ -36,7 +37,8 @@
pointer-events: none;
z-index: 1;
border:
var(--wpds-border-width-sm) dashed
var(--wpds-border-width-sm)
var(--wp-grid-resize-preview-outline-style, solid)
var(--wp-grid-placeholder-outline-color, var(--wpds-color-stroke-interactive-brand));
background: transparent;
border-radius: var(--wp-grid-placeholder-radius, 0);
Expand Down
8 changes: 5 additions & 3 deletions packages/grid/src/dashboard-lanes/lanes-item.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
/*
* During drag, the original item acts as a placeholder in its lane
* while `<DragOverlay>` renders a clone that follows the cursor.
* Fading the placeholder and outlining it with a dashed border makes
* Fading the placeholder and outlining it makes
* the destination visible without any scaling or translation on the
* original element.
*/
.is-dragging {
opacity: var(--wp-grid-placeholder-opacity, 0.4);
pointer-events: none;
outline:
var(--wpds-border-width-sm) dashed
var(--wpds-border-width-sm)
var(--wp-grid-placeholder-outline-style, dashed)
var(--wp-grid-placeholder-outline-color, var(--wpds-color-stroke-interactive-brand));
border-radius: var(--wp-grid-placeholder-radius, 0);
}
Expand All @@ -36,7 +37,8 @@
pointer-events: none;
z-index: 1;
border:
var(--wpds-border-width-sm) dashed
var(--wpds-border-width-sm)
var(--wp-grid-resize-preview-outline-style, solid)
var(--wp-grid-placeholder-outline-color, var(--wpds-color-stroke-interactive-brand));
background: transparent;
}
Expand Down
Loading