You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// import { DialogFullscreen, DialogFullscreenTakeover, DialogGroup } from "./dialog.test.js";
4
+
import{Template}from"./template.js";
4
5
5
6
/**
6
-
* A dialog displays important information that users need to acknowledge. They appear over the interface and block further interactions.
7
+
* A dialog displays important information that users need to acknowledge. They appear over the interface and block further interactions. Standard dialogs are the most frequent type of dialogs. They appear in the center of the screen over the interface and should be used for moderately complex tasks. Takeover dialogs are large types of dialogs. They use the totality of the screen and should be used for modal experiences with complex workflows.
7
8
*
8
-
* The alert variants that were previously a part of Dialog were moved to their own component, [Alert Dialog](/docs/components-alert-dialog--docs).
9
+
* The alert variants that were previously a part of Dialog were moved to their own component, [alert dialog](/docs/components-alert-dialog--docs).
9
10
*/
10
11
exportdefault{
11
12
title: "Components/Dialog",
12
13
component: "Dialog",
13
14
argTypes: {
14
15
heading: {
15
16
name: "Heading",
17
+
description: "Title for the dialog.",
16
18
type: {name: "string"},
17
19
table: {
18
20
type: {summary: "string"},
@@ -22,7 +24,7 @@ export default {
22
24
},
23
25
header: {
24
26
name: "Additional header content",
25
-
description: "Controls header content",
27
+
description: "Controls header content.",
26
28
type: {name: "string"},
27
29
table: {
28
30
type: {summary: "string"},
@@ -33,23 +35,13 @@ export default {
33
35
content: {table: {disable: true}},
34
36
hasFooter: {
35
37
name: "Has footer",
36
-
description: "Adds a footer to the dialog for additional context",
38
+
description: "Adds a footer to the dialog for additional context.",
37
39
type: {name: "boolean"},
38
40
table: {
39
41
type: {summary: "boolean"},
40
42
category: "Content",
41
43
},
42
44
control: "boolean",
43
-
},
44
-
hasCheckbox: {
45
-
name: "Has checkbox",
46
-
description: "Adds a checkbox to the footer content.",
47
-
type: {name: "boolean"},
48
-
table: {
49
-
type: {summary: "boolean"},
50
-
category: "Content",
51
-
},
52
-
control: {type: "boolean"},
53
45
if: {arg: "layout",eq: "default"},
54
46
},
55
47
footer: {
@@ -61,7 +53,18 @@ export default {
61
53
category: "Content",
62
54
},
63
55
control: {type: "text"},
64
-
if: {arg: "layout",eq: "default"},
56
+
if: {arg: "hasFooter",truthy: true},
57
+
},
58
+
hasCheckbox: {
59
+
name: "Has checkbox",
60
+
description: "Adds a checkbox to the footer content.",
61
+
type: {name: "boolean"},
62
+
table: {
63
+
type: {summary: "boolean"},
64
+
category: "Content",
65
+
},
66
+
control: {type: "boolean"},
67
+
if: {arg: "hasFooter",truthy: true},
65
68
},
66
69
size: {
67
70
name: "Size",
@@ -70,7 +73,7 @@ export default {
70
73
type: {summary: "string"},
71
74
category: "Component",
72
75
},
73
-
options: ["small","medium","large"],
76
+
options: ["s","m","l"],
74
77
control: "select",
75
78
},
76
79
layout: {
@@ -82,8 +85,7 @@ export default {
82
85
category: "Component",
83
86
defaultValue: {summary: "Default"},
84
87
},
85
-
// TODO: add the fullscreen and fullscreenTakeover layouts back to options[] once guidance on fullscreen dialogs is determined
constExampleContent="Standard dialog description. This should briefly communicate any additional information or context about the standard dialog title, to help users make one of the decisions offered by the buttons. Make it no more than a few short sentences.";
158
160
159
161
/**
160
-
* The default size for dialog is medium.
162
+
* The default size for dialog is medium. The default dialog also has a checkbox in the footer.
161
163
*/
162
164
exportconstDefault=Template.bind({});
163
165
Default.args={
164
166
heading: "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
165
-
header: "*Required",
167
+
header: "*Required",
166
168
showModal: true,
167
169
content: [
168
-
()=>Typography({
170
+
(passthroughs,context)=>Typography({
169
171
semantics: "body",
170
172
size: "m",
171
-
content: ExampleContent,
172
-
}),
173
+
content: [ExampleContent],
174
+
...passthroughs,
175
+
},context),
173
176
],
174
177
};
175
178
176
-
/* TODO: For all dialog stories: the "is-hidden-story" tags replicates "!dev" in older versions
177
-
of Storybook, to remove the stories from the side navigation, reflecting the intended behavior.
178
-
Remove "is-hidden-story" in favor of only "!dev" tags when possible.
179
+
/* TODO: For all dialog stories: the "is-hidden-story" tags in older versions of Storybook. In newer versions,
180
+
use "!dev" to remove the stories from the side navigation, reflecting the intended behavior.
181
+
Remove "is-hidden-story" in favor of "!dev" tags when possible.
/* TODO: once this gets rebased with `main`, make sure to use the fullscreen and fullscreenTakeover test templates
257
+
that are imported above, but commented out.
258
+
*/
251
259
/**
252
-
* A fullscreen dialog will automatically fill almost all of the available screen space. A margin is included around the outside of the dialog.
260
+
* The full screen variant shows a large dialog background, only revealing a small portion of the page around the outside of the dialog, behind an overlay. The size of the dialog varies with the size of the screen, in both width and height.
253
261
*/
254
262
exportconstFullscreen=Template.bind({});
263
+
Fullscreen.argTypes={
264
+
hasCheckbox: {table: {disable: true}},
265
+
footer: {table: {disable: true}},
266
+
};
255
267
Fullscreen.args={
256
268
...Default.args,
257
269
layout: "fullscreen",
258
270
};
259
271
Fullscreen.parameters={
260
272
chromatic: {disableSnapshot: true},
261
273
};
262
-
/* TODO: Remove "is-hidden-story" tag once guidance for S2 fullscreen dialogs has been determined. */
263
-
Fullscreen.tags=["is-hidden-story"];
264
274
265
275
/**
266
-
* A fullscreen takeover dialog will fill all of the available screen space.
276
+
* The full screen takeover variant is similar to the full screen variant except that the background covers the entire screen. The page behind the dialog is not visible. This variant should be reserved for workflows where displaying a second dialog on top of the first one is to be expected.
0 commit comments