Skip to content

feat(coachmark): S2 migration #3412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 1, 2025
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
11 changes: 11 additions & 0 deletions .changeset/lemon-weeks-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@spectrum-css/tokens": minor
---

#### Tokens

Adds custom vars for coachmark action menu vertical spacing. These help provide consistent spacing between states when the action menu is and is not visible.

In `tokens/custom/large-vars.css`: `--spectrum-coachmark-action-menu-vertical-offset`.

In `tokens/custom/medium-vars.css`: `--spectrum-coachmark-action-menu-vertical-offset`.
62 changes: 62 additions & 0 deletions .changeset/nice-cows-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
"@spectrum-css/coachmark": major
---

#### S2 coachmark migration

This migrates the `coachmark` component to S2. Custom properties have been remapped per the design spec.

| Before | After |
| ------------------------------------------ | ----------------------------------------------- |
| --spectrum-heading-sans-serif-font-weight | --spectrum-title-sans-serif-font-weight |
| --spectrum-coach-mark-title-size | --spectrum-coach-mark-title-font-size |
| --spectrum-heading-line-height | --spectrum-title-line-height |
| --spectrum-heading-serif-font-style | --spectrum-title-serif-font-style |
| --spectrum-coach-mark-body-size | --spectrum-coach-mark-body-font-size |
| --spectrum-body-sans-serif-font-style | --spectrum-body-serif-font-style |
| --spectrum-coach-mark-pagination-body-size | --spectrum-coach-mark-pagination-body-font-size |

### New properties

```css
--spectrum-coach-mark-edge-to-content
--spectrum-coach-mark-maximum-width
--spectrum-coach-mark-media-height
--spectrum-coach-mark-media-minimum-height
--spectrum-coach-mark-minimum-width
--spectrum-coach-mark-pagination-color
--spectrum-coach-mark-pagination-text-to-bottom-edge
--spectrum-coach-mark-width
--spectrum-coachmark-body-to-footer
--spectrum-coachmark-border-radius
--spectrum-coachmark-border-size
--spectrum-coachmark-buttongroup-display
--spectrum-coachmark-buttongroup-mobile-display
--spectrum-coachmark-content-font-size
--spectrum-coachmark-content-font-weight
--spectrum-coachmark-header-to-body
--spectrum-coachmark-heading-to-action-button
--spectrum-coachmark-max-width
--spectrum-coachmark-media-fixed-height
--spectrum-coachmark-media-min-height
--spectrum-coachmark-menu-display
--spectrum-coachmark-menu-mobile-display
--spectrum-coachmark-min-width
--spectrum-coachmark-padding
--spectrum-coachmark-step-color
--spectrum-coachmark-step-font-size
--spectrum-coachmark-step-font-style
--spectrum-coachmark-step-text-font-weight
--spectrum-coachmark-step-text-line-height
--spectrum-coachmark-step-to-bottom
--spectrum-coachmark-title-color
--spectrum-coachmark-title-font-family
--spectrum-coachmark-title-font-size
--spectrum-coachmark-title-font-style
--spectrum-coachmark-title-text-font-weight
--spectrum-coachmark-title-text-line-height
```

## Additions

Adds `--spectrum-coachmark-media-fixed-height` for fixed `4:3` image variant and an accompanying `--mod-coachmark-media-fixed-height` mod. This variation has been added to the `coachmark` component story as a boolean control labeled as `Fixed image height`. The class is conditionally added within the `hasImage` block and, as such, will only impact rendering when `hasImage` is also `true`.
49 changes: 40 additions & 9 deletions components/coachmark/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
".spectrum-CoachMark-header",
".spectrum-CoachMark-image",
".spectrum-CoachMark-image-wrapper",
".spectrum-CoachMark-image-wrapper--fixedHeight",
".spectrum-CoachMark-menu",
".spectrum-CoachMark-menu--mobile",
".spectrum-CoachMark-step",
".spectrum-CoachMark-title"
],
"modifiers": [
"--mod-coachmark-action-menu-vertical-offset",
"--mod-coachmark-body-to-footer",
"--mod-coachmark-border-radius",
"--mod-coachmark-border-size",
Expand All @@ -27,8 +29,9 @@
"--mod-coachmark-content-line-height",
"--mod-coachmark-header-to-body",
"--mod-coachmark-heading-to-action-button",
"--mod-coachmark-image-to-heading",
"--mod-coachmark-max-width",
"--mod-coachmark-media-height",
"--mod-coachmark-media-fixed-height",
"--mod-coachmark-media-min-height",
"--mod-coachmark-min-width",
"--mod-coachmark-padding",
Expand All @@ -47,39 +50,67 @@
"--mod-coachmark-width"
],
"component": [
"--spectrum-coach-mark-body-size",
"--spectrum-coach-mark-body-font-size",
"--spectrum-coach-mark-edge-to-content",
"--spectrum-coach-mark-maximum-width",
"--spectrum-coach-mark-media-height",
"--spectrum-coach-mark-media-minimum-height",
"--spectrum-coach-mark-minimum-width",
"--spectrum-coach-mark-pagination-body-size",
"--spectrum-coach-mark-pagination-body-font-size",
"--spectrum-coach-mark-pagination-color",
"--spectrum-coach-mark-pagination-text-to-bottom-edge",
"--spectrum-coach-mark-title-size",
"--spectrum-coach-mark-title-font-size",
"--spectrum-coach-mark-width",
"--spectrum-coachmark-action-menu-vertical-offset",
"--spectrum-coachmark-body-to-footer",
"--spectrum-coachmark-border-radius",
"--spectrum-coachmark-border-size",
"--spectrum-coachmark-buttongroup-display",
"--spectrum-coachmark-buttongroup-mobile-display",
"--spectrum-coachmark-content-font-size",
"--spectrum-coachmark-content-font-weight",
"--spectrum-coachmark-header-to-body",
"--spectrum-coachmark-image-to-heading",
"--spectrum-coachmark-max-width",
"--spectrum-coachmark-media-fixed-height",
"--spectrum-coachmark-media-min-height",
"--spectrum-coachmark-menu-display",
"--spectrum-coachmark-menu-mobile-display"
"--spectrum-coachmark-menu-mobile-display",
"--spectrum-coachmark-min-width",
"--spectrum-coachmark-padding",
"--spectrum-coachmark-step-color",
"--spectrum-coachmark-step-font-size",
"--spectrum-coachmark-step-font-style",
"--spectrum-coachmark-step-text-font-weight",
"--spectrum-coachmark-step-text-line-height",
"--spectrum-coachmark-step-to-bottom",
"--spectrum-coachmark-title-color",
"--spectrum-coachmark-title-font-family",
"--spectrum-coachmark-title-font-size",
"--spectrum-coachmark-title-font-style",
"--spectrum-coachmark-title-text-font-weight",
"--spectrum-coachmark-title-text-line-height",
"--spectrum-coachmark-width"
],
"global": [
"--spectrum-body-color",
"--spectrum-body-line-height",
"--spectrum-body-sans-serif-font-style",
"--spectrum-body-sans-serif-font-weight",
"--spectrum-body-serif-font-style",
"--spectrum-border-width-100",
"--spectrum-corner-radius-large-default",
"--spectrum-heading-color",
"--spectrum-heading-line-height",
"--spectrum-heading-sans-serif-font-weight",
"--spectrum-heading-serif-font-style",
"--spectrum-line-height-200",
"--spectrum-medium-font-weight",
"--spectrum-popover-content-area-spacing",
"--spectrum-sans-serif-font",
"--spectrum-spacing-100",
"--spectrum-spacing-200",
"--spectrum-spacing-300"
"--spectrum-spacing-300",
"--spectrum-title-line-height",
"--spectrum-title-sans-serif-font-weight",
"--spectrum-title-serif-font-style"
],
"passthroughs": [
"--mod-button-edge-to-visual-only",
Expand Down
92 changes: 66 additions & 26 deletions components/coachmark/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2024 Adobe. All rights reserved.
* Copyright 2025 Adobe. All rights reserved.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
Expand All @@ -12,27 +12,59 @@
*/

.spectrum-CoachMark {
--spectrum-coachmark-width: var(--spectrum-coach-mark-width);
--spectrum-coachmark-min-width: var(--spectrum-coach-mark-minimum-width);
--spectrum-coachmark-max-width: var(--spectrum-coach-mark-maximum-width);
--spectrum-coachmark-media-min-height: var(--spectrum-coach-mark-media-minimum-height);

--spectrum-coachmark-border-size: var(--mod-coachmark-border-size, var(--mod-popover-border-width));
--spectrum-coachmark-border-radius: var(--mod-coachmark-border-radius, var(--mod-popover-corner-radius));

--spectrum-coachmark-media-fixed-height: var(--spectrum-coach-mark-media-height);

/* layout */
--spectrum-coachmark-padding: var(--spectrum-coach-mark-edge-to-content);
--spectrum-coachmark-image-to-heading: var(--spectrum-coach-mark-edge-to-content);
--spectrum-coachmark-header-to-body: var(--spectrum-spacing-200);
--spectrum-coachmark-body-to-footer: var(--spectrum-spacing-300);

/* font */
--spectrum-coachmark-title-color: var(--spectrum-heading-color);
--spectrum-coachmark-title-font-family: var(--spectrum-sans-serif-font);
--spectrum-coachmark-title-font-size: var(--spectrum-coach-mark-title-font-size);
--spectrum-coachmark-title-font-style: var(--spectrum-title-serif-font-style);
--spectrum-coachmark-title-text-font-weight: var(--spectrum-title-sans-serif-font-weight);
--spectrum-coachmark-title-text-line-height: var(--spectrum-title-line-height);

--spectrum-coachmark-content-font-size: var(--spectrum-coach-mark-body-font-size);
--spectrum-coachmark-content-font-weight: var(--spectrum-body-sans-serif-font-weight);

--spectrum-coachmark-step-color: var(--spectrum-coach-mark-pagination-color);
--spectrum-coachmark-step-font-style: var(--spectrum-body-serif-font-style);
--spectrum-coachmark-step-font-size: var(--spectrum-coach-mark-pagination-body-font-size);
--spectrum-coachmark-step-text-font-weight: var(--spectrum-medium-font-weight);
--spectrum-coachmark-step-text-line-height: var(--spectrum-line-height-200);
--spectrum-coachmark-step-to-bottom: var(--spectrum-coach-mark-pagination-text-to-bottom-edge);

/* @passthrough start */
--mod-buttongroup-justify-content: flex-end;
--mod-popover-border-width: var(--spectrum-border-width-100);
--mod-popover-corner-radius: var(--spectrum-corner-radius-large-default);
--mod-popover-content-area-spacing: 0;
--mod-button-edge-to-visual-only: 9px;
/* @passthrough end */
}

.spectrum-CoachMark {
position: relative;
min-inline-size: var(--mod-coachmark-min-width, var(--spectrum-coach-mark-minimum-width));
max-inline-size: var(--mod-coachmark-max-width, var(--spectrum-coach-mark-maximum-width));
inline-size: var(--mod-coachmark-width, var(--spectrum-coach-mark-width));
min-inline-size: var(--mod-coachmark-min-width, var(--spectrum-coachmark-min-width));
max-inline-size: var(--mod-coachmark-max-width, var(--spectrum-coachmark-max-width));
inline-size: var(--mod-coachmark-width, var(--spectrum-coachmark-width));
}

/* Used when the coachmark has an image */
.spectrum-CoachMark-image-wrapper {
block-size: var(--mod-coachmark-media-height, var(--spectrum-coach-mark-media-height));
min-block-size: var(--mod-coachmark-media-min-height, var(--spectrum-coach-mark-media-minimum-height));
min-block-size: var(--mod-coachmark-media-min-height, var(--spectrum-coachmark-media-min-height));
inline-size: calc(var(--mod-coachmark-width, var(--spectrum-coach-mark-width)) - (var(--spectrum-coachmark-border-size) * 2));

object-fit: cover;
Expand All @@ -42,11 +74,16 @@
border-start-end-radius: inherit;
}

.spectrum-CoachMark-image-wrapper--fixedHeight {
block-size: var(--mod-coachmark-media-fixed-height, var(--spectrum-coachmark-media-fixed-height));
}

/* Class for the image; nested inside image-wrapper */
.spectrum-CoachMark-image {
display: block;
inline-size: 100%;
block-size: 100%;
min-block-size: var(--mod-coachmark-media-min-height, var(--spectrum-coachmark-media-min-height));
object-fit: cover;
border-start-start-radius: calc(var(--spectrum-coachmark-border-radius) - var(--spectrum-coachmark-border-size));
border-start-end-radius: calc(var(--spectrum-coachmark-border-radius) - var(--spectrum-coachmark-border-size));
Expand All @@ -57,34 +94,37 @@
.spectrum-CoachMark-content,
.spectrum-CoachMark-footer {
padding-block: 0;
padding-inline: var(--mod-coachmark-padding, var(--spectrum-coach-mark-edge-to-content));
padding-inline: var(--mod-coachmark-padding, var(--spectrum-coachmark-padding));
}

/* Wrapper contains title, action-menu */
.spectrum-CoachMark-header {
padding-block-start: var(--mod-coachmark-padding, var(--spectrum-coach-mark-edge-to-content));
padding-block-start: var(--mod-coachmark-image-to-heading, var(--spectrum-coachmark-image-to-heading));
display: flex;
justify-content: space-between;
align-items: center;
margin-block-end: var(--mod-coachmark-header-to-body, var(--spectrum-spacing-200));
align-items: flex-start;
margin-block-end: var(--mod-coachmark-header-to-body, var(--spectrum-coachmark-header-to-body));
}

/* Text wrapper for the title content; sides besdie action menu if present */
.spectrum-CoachMark-title {
color: var(--mod-coachmark-title-color, var(--spectrum-heading-color));
font-size: var(--mod-coachmark-title-font-size, var(--spectrum-coach-mark-title-size));
font-weight: var(--mod-coachmark-title-text-font-weight, var(--spectrum-heading-sans-serif-font-weight));
font-family: var(--mod-coachmark-title-font-family, var(--spectrum-sans-serif-font));
font-style: var(--mod-coachmark-title-font-style, var(--spectrum-heading-serif-font-style));
line-height: var(--mod-coachmark-title-text-line-height, var(--spectrum-heading-line-height));
color: var(--mod-coachmark-title-color, var(--spectrum-coachmark-title-color));
font-size: var(--mod-coachmark-title-font-size, var(--spectrum-coachmark-title-font-size));
font-weight: var(--mod-coachmark-title-text-font-weight, var(--spectrum-coachmark-title-text-font-weight));
font-family: var(--mod-coachmark-title-font-family, var(--spectrum-coachmark-title-font-family));
font-style: var(--mod-coachmark-title-font-style, var(--spectrum-coachmark-title-font-style));
line-height: var(--mod-coachmark-title-text-line-height, var(--spectrum-coachmark-title-text-line-height));
margin-block-end: 0;
}

/* Wrapper element around the nested action menu sub-component */
.spectrum-CoachMark-action-menu {
--mod-popover-content-area-spacing: var(--spectrum-popover-content-area-spacing);

white-space: nowrap;
z-index: 1;
margin-inline-start: var(--mod-coachmark-heading-to-action-button, var(--spectrum-spacing-300));
margin-block: var(--mod-coachmark-action-menu-vertical-offset, var(--spectrum-coachmark-action-menu-vertical-offset));
}

/* @deprecated not used currently in demos or by SWC */
Expand All @@ -99,10 +139,10 @@

/* Text wrapper for the content */
.spectrum-CoachMark-content {
margin-block-end: var(--mod-coachmark-body-to-footer, var(--spectrum-spacing-300));
margin-block-end: var(--mod-coachmark-body-to-footer, var(--spectrum-coachmark-body-to-footer));
color: var(--mod-coachmark-content-font-color, var(--spectrum-body-color));
font-size: var(--mod-coachmark-content-font-size, var(--spectrum-coach-mark-body-size));
font-weight: var(--mod-coachmark-content-font-weight, var(--spectrum-body-sans-serif-font-weight));
font-size: var(--mod-coachmark-content-font-size, var(--spectrum-coachmark-content-font-size));
font-weight: var(--mod-coachmark-content-font-weight, var(--spectrum-coachmark-content-font-weight));
font-family: var(--mod-coachmark-content-font-family, var(--spectrum-sans-serif-font));
font-style: var(--mod-coachmark-content-font-style, var(--spectrum-body-sans-serif-font-style));
line-height: var(--mod-coachmark-content-line-height, var(--spectrum-body-line-height));
Expand All @@ -113,20 +153,20 @@
display: grid;
align-items: end;
margin-block-start: 0;
padding-block-end: var(--mod-coachmark-padding, var(--spectrum-coach-mark-edge-to-content));
padding-block-end: var(--mod-coachmark-padding, var(--spectrum-coachmark-padding));
}

/* Text wrapper for the step count */
.spectrum-CoachMark-step {
justify-self: start;
margin-block-end: calc(var(--mod-coachmark-step-to-bottom, var(--spectrum-coach-mark-pagination-text-to-bottom-edge)) - var(--mod-coachmark-padding, var(--spectrum-coach-mark-edge-to-content)));
margin-block-end: calc(var(--mod-coachmark-step-to-bottom, var(--spectrum-coachmark-step-to-bottom)) - var(--mod-coachmark-padding, var(--spectrum-coachmark-padding)));

color: var(--mod-coachmark-step-color, var(--spectrum-coach-mark-pagination-color));
font-size: var(--mod-coachmark-step-font-size, var(--spectrum-coach-mark-pagination-body-size));
font-weight: var(--mod-coachmark-step-text-font-weight, var(--spectrum-body-sans-serif-font-weight));
color: var(--mod-coachmark-step-color, var(--spectrum-coachmark-step-color));
font-size: var(--mod-coachmark-step-font-size, var(--spectrum-coachmark-step-font-size));
font-weight: var(--mod-coachmark-step-text-font-weight, var(--spectrum-coachmark-step-text-font-weight));
font-family: var(--spectrum-sans-serif-font);
font-style: var(--mod-coachmark-step-font-style, var(--spectrum-body-sans-serif-font-style));
line-height: var(--mod-coachmark-step-text-line-height, var(--spectrum-body-line-height));
font-style: var(--mod-coachmark-step-font-style, var(--spectrum-coachmark-step-font-style));
line-height: var(--mod-coachmark-step-text-line-height, var(--spectrum-coachmark-step-text-line-height));
white-space: nowrap;
}

Expand Down
Loading
Loading