Skip to content

Commit 7a52c29

Browse files
committed
chore(popover): adjust/enhance popover spacing by default
1 parent fd89332 commit 7a52c29

File tree

21 files changed

+272
-607
lines changed

21 files changed

+272
-607
lines changed

components/actionbar/stories/template.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ export const Template = ({
7474
],
7575
}, context),
7676
],
77-
popoverHeight: 42,
78-
popoverWidth: 500,
7977
}, context)}
8078
</div>
8179
`;

components/actionmenu/stories/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export const Template = ({
3333
iconName,
3434
iconSet,
3535
id: triggerId,
36-
customClasses,
3736
}, context),
3837
position: "bottom-start",
39-
customStyles,
38+
customWrapperClasses: customClasses,
39+
customWrapperStyles: customStyles,
4040
content: [
4141
(passthroughs) => Menu({
4242
...passthroughs,

components/alertdialog/stories/alertdialog.stories.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ export default {
6868
type: "figma",
6969
url: "https://www.figma.com/design/Mngz9H7WZLbrCvGQf3GnsY/S2---Desktop?node-id=21917-157",
7070
},
71-
docs: {
72-
story: {
73-
height: "300px",
74-
}
75-
},
7671
packageJson,
7772
metadata,
7873
status: {
@@ -119,11 +114,6 @@ Information.args = {
119114
content: "If you enjoy our app, would you mind taking a moment to rate it?",
120115
};
121116
Information.parameters = {
122-
docs: {
123-
story: {
124-
height: "400px",
125-
}
126-
},
127117
chromatic: { disableSnapshot: true },
128118
};
129119

@@ -187,11 +177,6 @@ Overflow.args = {
187177
};
188178
Overflow.parameters = {
189179
chromatic: { disableSnapshot: true },
190-
docs: {
191-
story: {
192-
height: "525px",
193-
},
194-
},
195180
};
196181

197182
/**

components/coachindicator/stories/template.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { getRandomId } from "@spectrum-css/preview/decorators";
12
import { html } from "lit-html";
23
import { classMap } from "lit-html/directives/class-map.js";
4+
import { ifDefined } from "lit-html/directives/if-defined.js";
35
import { styleMap } from "lit-html/directives/style-map.js";
46

57
import "../index.css";
@@ -10,6 +12,7 @@ export const Template = ({
1012
staticColor,
1113
customClasses = [],
1214
customStyles = {},
15+
id = getRandomId("coach-indicator"),
1316
} = {}) => {
1417
return html`
1518
<div
@@ -21,6 +24,7 @@ export const Template = ({
2124
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
2225
})}
2326
style=${styleMap(customStyles)}
27+
id=${ifDefined(id)}
2428
>
2529
${Array.from({ length: 3 }).map(() => html`
2630
<div class=${classMap({ [`${rootClass}-ring`]: true })}></div>

components/coachmark/stories/coachmark.stories.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ export default {
9494
},
9595
packageJson,
9696
metadata,
97-
docs: {
98-
story: {
99-
height: "525px",
100-
},
101-
},
10297
status: {
10398
type: "migrated",
10499
},
@@ -121,11 +116,6 @@ Standard.parameters = {
121116
chromatic: {
122117
disableSnapshot: true,
123118
},
124-
docs: {
125-
story: {
126-
height: "475px",
127-
},
128-
},
129119
};
130120
Standard.args = {
131121
imageSource: "example-card-landscape.png",
@@ -141,11 +131,6 @@ StandardNoMedia.parameters = {
141131
chromatic: {
142132
disableSnapshot: true,
143133
},
144-
docs: {
145-
story: {
146-
height: "250px",
147-
},
148-
},
149134
};
150135

151136
/** Images and media have a minimum height and can grow with the parent component. Fixed height media is constrained to a 4:3 aspect ratio by applying the `spectrum-CoachMark-image-wrapper--fixedHeight` class. When this fixed height class is used, the height can be customized using the modifiable custom property `--mod-coachmark-media-fixed-height`. */
@@ -155,11 +140,6 @@ MediaOptions.args = {
155140
imageSource: "example-card-portrait.png",
156141
};
157142
MediaOptions.parameters = {
158-
docs: {
159-
story: {
160-
height: "725px",
161-
},
162-
},
163143
chromatic: {
164144
disableSnapshot: true,
165145
},

components/coachmark/stories/template.js

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,34 @@ export const CoachContainer = (
4747
</div>
4848
`,
4949
)}
50-
<div class="spectrum-CoachMark-header">
50+
<div class="spectrum-CoachMark-header" style=${styleMap({
51+
"--mod-popover-width": "0px",
52+
"--mod-popover-height": "0px",
53+
"--mod-popover-wrapper-spacing": "0px",
54+
})}>
5155
<div class="spectrum-CoachMark-title">${title}</div>
5256
${when(
5357
hasActionMenu,
54-
() =>
55-
html` <div class="spectrum-CoachMark-action-menu">
56-
${ActionMenu(
58+
() => ActionMenu(
59+
{
60+
isOpen,
61+
position: "bottom-start",
62+
iconName: "More",
63+
size: scale === "large" ? "s" : "m",
64+
customClasses: [
65+
`${rootClass}-action-menu`
66+
],
67+
items: [
68+
{
69+
label: "Skip tour",
70+
},
5771
{
58-
isOpen,
59-
position: "bottom-start",
60-
iconName: "More",
61-
size: scale === "large" ? "s" : "m",
62-
items: [
63-
{
64-
label: "Skip tour",
65-
},
66-
{
67-
label: "Reset tour",
68-
},
69-
],
70-
popoverHeight: 68,
71-
popoverWidth: 84,
72+
label: "Reset tour",
7273
},
73-
context,
74-
)}
75-
</div>`,
74+
],
75+
},
76+
context,
77+
),
7678
)}
7779
</div>
7880
<div class="spectrum-CoachMark-content">
@@ -127,29 +129,24 @@ export const CoachContainer = (
127129
};
128130

129131
export const Template = (args, context) => {
130-
return html`
131-
<div
132-
class=${classMap({
133-
[args.rootClass]: true,
134-
...args.customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
135-
})}
136-
style=${styleMap(args.customStyles)}
137-
>
138-
${Popover(
139-
{
140-
customStyles: {
141-
"inline-size": "var(--spectrum-coach-mark-width)",
142-
},
143-
customClasses: [`${args.rootClass}-popover`],
144-
isOpen: true,
145-
position: "right-top",
146-
trigger: (passthrough) => CoachIndicator(passthrough, context),
147-
content: [CoachContainer(args, context)],
148-
},
149-
context,
150-
)}
151-
</div>
152-
`;
132+
return Popover(
133+
{
134+
customWrapperClasses: [
135+
args.rootClass,
136+
...args?.customClasses ?? []
137+
],
138+
customStyles: {
139+
...args?.customStyles ?? {},
140+
"inline-size": "var(--spectrum-coach-mark-width)",
141+
},
142+
customClasses: [`${args.rootClass}-popover`],
143+
isOpen: true,
144+
position: "right-top",
145+
trigger: (passthrough) => CoachIndicator(passthrough, context),
146+
content: [CoachContainer(args, context)],
147+
},
148+
context,
149+
);
153150
};
154151

155152
/* Displays open and closed action menus in a single story. */
@@ -165,15 +162,7 @@ export const CoachmarkMenuStatesTemplate = (args, context) =>
165162
Container({
166163
withBorder: false,
167164
heading: "With action menu (closed) and media",
168-
content: Template(
169-
{
170-
...args,
171-
customStyles: {
172-
"height": "265px"
173-
}
174-
},
175-
context,
176-
),
165+
content: Template(args, context),
177166
}),
178167
Container({
179168
withBorder: false,
@@ -183,10 +172,7 @@ export const CoachmarkMenuStatesTemplate = (args, context) =>
183172
...args,
184173
hasImage: false,
185174
hasActionMenu: true,
186-
isOpen: true,
187-
customStyles: {
188-
"height": "260px"
189-
}
175+
isOpen: true
190176
},
191177
context,
192178
),

components/combobox/stories/combobox.stories.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,6 @@ DefaultGroup.args = {
211211
DefaultGroup.tags = ["!dev"];
212212
DefaultGroup.parameters = {
213213
chromatic: { disableSnapshot: true },
214-
docs: {
215-
story: {
216-
height: "360px",
217-
},
218-
},
219214
};
220215

221216
/**

components/combobox/stories/combobox.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ export const ComboBoxGroup = Variants({
1616
{
1717
testHeading: "Open",
1818
isOpen: true,
19-
wrapperStyles: {
20-
"min-block-size": "250px",
21-
},
2219
},
2320
{
2421
testHeading: "Help text with label",

components/combobox/stories/template.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ export const Template = ({
5656
}, 0);
5757
}
5858

59-
const popoverHeight = size === "s" ? 106 : size === "l" ? 170 : size === "xl" ? 229 : 142; // default value is "m"
60-
const adjustedPopoverHeight = showFieldLabel ? popoverHeight : popoverHeight + 32; // Subtract label height when no label
61-
6259
return html`
6360
<div
6461
class=${classMap({
@@ -78,10 +75,7 @@ export const Template = ({
7875
})}
7976
id=${ifDefined(id)}
8077
data-testid=${ifDefined(testId ?? id)}
81-
style=${styleMap({
82-
...customStyles,
83-
["margin-block-end"]: !isReadOnly && isOpen && !isDisabled ? `${adjustedPopoverHeight}px` : undefined,
84-
})}
78+
style=${styleMap(customStyles)}
8579
role="combobox"
8680
aria-expanded=${isOpen}
8781
aria-haspopup="listbox"
@@ -150,7 +144,6 @@ export const Template = ({
150144
"inline-size": size === "s" ? "192px" : size === "l" ? "224px" : size === "xl" ? "240px" : "208px",
151145
},
152146
content,
153-
popoverHeight,
154147
}, context)}
155148
${when(helpText, () =>
156149
HelpText({

0 commit comments

Comments
 (0)