Skip to content

Commit 711d4cd

Browse files
marissahuysentruytcastastrophe
authored andcommitted
chore(contextualhelp,datepicker,fieldgroup): remove MDX files (#3422)
* docs(contextualhelp): remove MDX file - adds some additional documentation regarding stories/variants - migrates documentation in MDX to stories.js instead * docs(fieldgroup): remove MDX file - creates additional templates to showcase variants in a single story on the docs page - additional documentation to give context to stories - corrects sentence-casing in story names - removes duplicate control for label text - migrates documentation in MDX to stories.js instead * chore(fieldgroup,contextualhelp): cleans up test files - fieldgroup: we don't really need to change the label text or help text between test cases, so some of the test-specific changes were removed - contextualhelp: add help icon test case * docs(datepicker): remove MDX file - adds missing date picker docs - migrates documentation in MDX to stories.js instead - creates OpenClosedTemplate to display both states in a single story on the docs page - adds Range variant to the sidebar since that control isn't in the table
1 parent a61b73d commit 711d4cd

File tree

10 files changed

+165
-408
lines changed

10 files changed

+165
-408
lines changed

components/contextualhelp/stories/contextualhelp.mdx

-63
This file was deleted.

components/contextualhelp/stories/contextualhelp.stories.js

+19
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,18 @@ export default {
107107
},
108108
};
109109

110+
/**
111+
* The default contextual help component uses an info icon to signify that it represents in-line information, and does not incorporate a link in its content. Specific, brief, and contextual guidance is best for this component's supplemental or nice-to-know content. The default placement of the popover is `bottom-start`.
112+
*/
110113
export const Default = ContextualHelpGroup.bind({});
111114
Default.args = {};
112115

113116
// ********* DOCS ONLY ********* //
117+
/**
118+
* If using a standalone [link](/docs/components-link--docs), do not add punctuation to the end of the link text. Make sure that the landing experience is intuitive, helpful, and naturally builds upon the information being introduced in this component. For example, don’t link to an external sales website unless the information there is directly related to a user being able to do something within the product.
119+
*
120+
* A generic “Learn more” can be acceptable, but it’s more helpful, particularly for screen reader users, to include another word or two in the link text that gives more context about the link's destination.
121+
*/
114122
export const WithLink = Template.bind({});
115123
WithLink.tags = ["!dev"];
116124
WithLink.args = {
@@ -122,7 +130,11 @@ WithLink.args = {
122130
WithLink.parameters = {
123131
chromatic: { disableSnapshot: true },
124132
};
133+
WithLink.storyName = "Default - info icon with link";
125134

135+
/**
136+
* This is an example of the contextual help component within a popover with a placement of `top`. Read more about the 22 available placement positions in the [popover documentation](/docs/components-popover--docs).
137+
*/
126138
export const TopPopover = Template.bind({});
127139
TopPopover.tags = ["!dev"];
128140
TopPopover.args = {
@@ -142,7 +154,11 @@ TopPopover.parameters = {
142154
},
143155
},
144156
};
157+
TopPopover.storyName = "Default - top popover";
145158

159+
/**
160+
* When displaying help or resources to learn more, the contextual help should use the help icon. The content in this variant provides more detailed, in-depth guidance about a task, UI element, tool or keyboard shortcuts.
161+
*/
146162
export const HelpDefault = Template.bind({});
147163
HelpDefault.tags = ["!dev"];
148164
HelpDefault.args = {
@@ -151,6 +167,7 @@ HelpDefault.args = {
151167
HelpDefault.parameters = {
152168
chromatic: { disableSnapshot: true },
153169
};
170+
HelpDefault.storyName = "Help icon";
154171

155172
export const HelpWithLink = Template.bind({});
156173
HelpWithLink.tags = ["!dev"];
@@ -164,6 +181,7 @@ HelpWithLink.args = {
164181
HelpWithLink.parameters = {
165182
chromatic: { disableSnapshot: true },
166183
};
184+
HelpWithLink.storyName = "Help icon - with link";
167185

168186
export const HelpTopPopover = Template.bind({});
169187
HelpTopPopover.tags = ["!dev"];
@@ -185,6 +203,7 @@ HelpTopPopover.parameters = {
185203
},
186204
},
187205
};
206+
HelpTopPopover.storyName = "Help icon - top popover";
188207

189208
// ********* VRT ONLY ********* //
190209
export const WithForcedColors = ContextualHelpGroup.bind({});

components/contextualhelp/stories/contextualhelp.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ export const ContextualHelpGroup = Variants({
2222
url: "#",
2323
},
2424
},
25+
{
26+
testHeading: "Help",
27+
iconName: "Help",
28+
customStyles: {
29+
"inline-size": "275px",
30+
"margin-bottom": "170px",
31+
},
32+
},
2533
],
2634
});

components/datepicker/stories/datepicker.mdx

-86
This file was deleted.

components/datepicker/stories/datepicker.stories.js

+32-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isDisabled, isInvalid, isOpen, isQuiet, isReadOnly, isRequired, isValid
44
import metadata from "../metadata/metadata.json";
55
import packageJson from "../package.json";
66
import { DatePickerGroup } from "./datepicker.test.js";
7-
import { Template } from "./template.js";
7+
import { OpenClosedTemplate, Template } from "./template.js";
88

99
/**
1010
* A date picker displays a text field input with a button next to it, and can display two text fields next to each other for choosing a date range.
@@ -28,7 +28,7 @@ export default {
2828
if: { arg: "isInvalid", truthy: false },
2929
},
3030
isDateTimeRange: {
31-
name: "Date and Time styling",
31+
name: "Date and time styling",
3232
type: { name: "boolean" },
3333
table: {
3434
type: { summary: "boolean" },
@@ -81,16 +81,31 @@ export default {
8181

8282
export const Default = DatePickerGroup.bind({});
8383
Default.args = {};
84-
Default.parameters = {
84+
Default.tags = ["!autodocs"];
85+
86+
// ********* DOCS ONLY ********* //
87+
/**
88+
* Default styling for date pickers display a visible field button. This style works best in a dense array of controls where the field button helps separate the dropdown from its surroundings.
89+
*
90+
* The standard implementation for a date picker incorporates the display of a [calendar](/docs/components-calendar--docs) within a [popover component](/docs/components-popover--docs).
91+
*/
92+
export const DefaultGroup = OpenClosedTemplate.bind({});
93+
DefaultGroup.args = {};
94+
DefaultGroup.tags = [ "!dev"];
95+
DefaultGroup.storyName = "Default";
96+
DefaultGroup.parameters = {
8597
docs: {
8698
story: {
87-
height: "300px"
99+
height: "350px",
88100
}
89101
},
102+
chromatic: { disableSnapshot: true },
90103
};
91104

92-
// ********* DOCS ONLY ********* //
93-
export const Quiet = Template.bind({});
105+
/**
106+
* The quiet style works best when a clear layout (vertical stack, table, grid) makes it easy to parse.
107+
*/
108+
export const Quiet = OpenClosedTemplate.bind({});
94109
Quiet.tags = ["!dev"];
95110
Quiet.args = {
96111
isQuiet: true,
@@ -99,11 +114,14 @@ Quiet.parameters = {
99114
chromatic: { disableSnapshot: true },
100115
docs: {
101116
story: {
102-
height: "300px"
117+
height: "350px",
103118
}
104119
},
105120
};
106121

122+
/**
123+
* Date pickers can be used to select a date range (a start date and an end date).
124+
*/
107125
export const Range = Template.bind({});
108126
Range.args = {
109127
lastDay: 3,
@@ -125,7 +143,11 @@ QuietRange.args = {
125143
QuietRange.parameters = {
126144
chromatic: { disableSnapshot: true },
127145
};
146+
QuietRange.storyName = "Range, quiet";
128147

148+
/**
149+
* A date picker can be marked as having an error to show that a value needs to be entered in order to move forward, or that an entered value is invalid.
150+
*/
129151
export const Invalid = Template.bind({});
130152
Invalid.tags = ["!dev"];
131153
Invalid.args = {
@@ -146,6 +168,7 @@ QuietInvalid.args = {
146168
QuietInvalid.parameters = {
147169
chromatic: { disableSnapshot: true },
148170
};
171+
QuietInvalid.storyName = "Invalid, quiet";
149172

150173
export const ReadOnly = Template.bind({});
151174
ReadOnly.tags = ["!dev"];
@@ -155,6 +178,7 @@ ReadOnly.args = {
155178
ReadOnly.parameters = {
156179
chromatic: { disableSnapshot: true },
157180
};
181+
ReadOnly.storyName = "Read-only";
158182

159183
export const Disabled = Template.bind({});
160184
Disabled.tags = ["!dev"];
@@ -174,6 +198,7 @@ QuietDisabled.args = {
174198
QuietDisabled.parameters = {
175199
chromatic: { disableSnapshot: true },
176200
};
201+
QuietDisabled.storyName = "Disabled, quiet";
177202

178203
// ********* VRT ONLY ********* //
179204
export const WithForcedColors = DatePickerGroup.bind({});

components/datepicker/stories/template.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Template as Calendar } from "@spectrum-css/calendar/stories/template.js";
22
import { Template as PickerButton } from "@spectrum-css/pickerbutton/stories/template.js";
33
import { Template as Popover } from "@spectrum-css/popover/stories/template.js";
4-
import { getRandomId } from "@spectrum-css/preview/decorators";
4+
import { Container, getRandomId } from "@spectrum-css/preview/decorators";
55
import { Template as TextField } from "@spectrum-css/textfield/stories/template.js";
66
import { html } from "lit";
77
import { when } from "lit-html/directives/when.js";
@@ -135,3 +135,22 @@ export const Template = ({
135135
}, context)}
136136
`;
137137
};
138+
139+
140+
/* Displays open and closed date pickers. */
141+
export const OpenClosedTemplate = (args, context) => Container({
142+
withBorder: false,
143+
wrapperStyles: { "column-gap": "56px", },
144+
content: html`
145+
${Container({
146+
withBorder: false,
147+
heading: "Open",
148+
content: Template(args, context),
149+
})}
150+
${Container({
151+
withBorder: false,
152+
heading: "Closed",
153+
content: Template({...args, isOpen: false}, context),
154+
})}
155+
`
156+
});

0 commit comments

Comments
 (0)