@carbon/ibm-products-web-components 0.1.0 → 0.1.1-canary.3599
Sign up to get free protection for your applications and to get access to all the features.
- package/.storybook/main.ts +15 -1
- package/.storybook/preview-head.html +5 -1
- package/.storybook/{theme.ts → theme.js} +2 -2
- package/es/components/side-panel/side-panel.d.ts +61 -80
- package/es/components/side-panel/side-panel.scss.js +1 -1
- package/es/components/tearsheet/defs.d.ts +26 -0
- package/es/components/tearsheet/defs.js +39 -0
- package/es/components/tearsheet/defs.js.map +1 -0
- package/es/components/tearsheet/index.d.ts +9 -0
- package/es/components/tearsheet/index.js +9 -0
- package/es/components/tearsheet/index.js.map +1 -0
- package/es/components/tearsheet/tearsheet.d.ts +490 -0
- package/es/components/tearsheet/tearsheet.js +685 -0
- package/es/components/tearsheet/tearsheet.js.map +1 -0
- package/es/components/tearsheet/tearsheet.scss.js +13 -0
- package/es/components/tearsheet/tearsheet.scss.js.map +1 -0
- package/es/components/tearsheet/tearsheet.test.d.ts +7 -0
- package/es/components/tearsheet/tearsheet.test.js +122 -0
- package/es/components/tearsheet/tearsheet.test.js.map +1 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/lib/components/side-panel/side-panel.d.ts +61 -80
- package/lib/components/tearsheet/defs.d.ts +26 -0
- package/lib/components/tearsheet/defs.js +39 -0
- package/lib/components/tearsheet/defs.js.map +1 -0
- package/lib/components/tearsheet/index.d.ts +9 -0
- package/lib/components/tearsheet/tearsheet.d.ts +490 -0
- package/lib/components/tearsheet/tearsheet.test.d.ts +7 -0
- package/lib/index.d.ts +1 -0
- package/package.json +17 -17
- package/scss/components/tearsheet/story-styles.scss +23 -0
- package/scss/components/tearsheet/tearsheet.scss +318 -0
- package/src/components/tearsheet/defs.ts +30 -0
- package/src/components/tearsheet/index.ts +10 -0
- package/src/components/tearsheet/story-styles.scss +23 -0
- package/src/components/tearsheet/tearsheet.mdx +101 -0
- package/src/components/tearsheet/tearsheet.scss +318 -0
- package/src/components/tearsheet/tearsheet.stories.ts +703 -0
- package/src/components/tearsheet/tearsheet.test.ts +118 -0
- package/src/components/tearsheet/tearsheet.ts +792 -0
- package/src/index.ts +1 -0
- package/netlify.toml +0 -8
- /package/.storybook/{Preview.ts → preview.ts} +0 -0
@@ -0,0 +1,703 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
*
|
4
|
+
* Copyright IBM Corp. 2024, 2024
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
|
10
|
+
import { html } from 'lit';
|
11
|
+
import {
|
12
|
+
TEARSHEET_INFLUENCER_PLACEMENT,
|
13
|
+
TEARSHEET_INFLUENCER_WIDTH,
|
14
|
+
TEARSHEET_WIDTH,
|
15
|
+
} from './tearsheet';
|
16
|
+
import './index';
|
17
|
+
import '@carbon/web-components/es/components/tabs/index.js';
|
18
|
+
import '@carbon/web-components/es/components/slug/index.js';
|
19
|
+
import '@carbon/web-components/es/components/progress-indicator/index.js';
|
20
|
+
import '@carbon/web-components/es/components/progress-bar/index.js';
|
21
|
+
import '@carbon/web-components/es/components/button/index.js';
|
22
|
+
import '@carbon/web-components/es/components/text-input/index.js';
|
23
|
+
import '@carbon/web-components/es/components/textarea/index.js';
|
24
|
+
import { prefix } from '../../globals/settings';
|
25
|
+
|
26
|
+
import styles from './story-styles.scss?lit';
|
27
|
+
import { BUTTON_KIND } from '@carbon/web-components/es/components/button/defs.js';
|
28
|
+
const toggleButton = () => {
|
29
|
+
document.querySelector(`${prefix}-tearsheet`)?.toggleAttribute('open');
|
30
|
+
};
|
31
|
+
|
32
|
+
const widths = {
|
33
|
+
// 'default (narrow)': null,
|
34
|
+
[`Narrow (${TEARSHEET_WIDTH.NARROW})`]: TEARSHEET_WIDTH.NARROW,
|
35
|
+
[`Wide (${TEARSHEET_WIDTH.WIDE})`]: TEARSHEET_WIDTH.WIDE,
|
36
|
+
};
|
37
|
+
|
38
|
+
const influencerWidths = {
|
39
|
+
// 'default (narrow)': null,
|
40
|
+
[`Narrow (${TEARSHEET_INFLUENCER_WIDTH.NARROW})`]:
|
41
|
+
TEARSHEET_INFLUENCER_WIDTH.NARROW,
|
42
|
+
[`Wide (${TEARSHEET_INFLUENCER_WIDTH.WIDE})`]:
|
43
|
+
TEARSHEET_INFLUENCER_WIDTH.WIDE,
|
44
|
+
};
|
45
|
+
|
46
|
+
const influencerPlacements = {
|
47
|
+
// 'default (right)': null,
|
48
|
+
[`Left (${TEARSHEET_INFLUENCER_PLACEMENT.LEFT})`]:
|
49
|
+
TEARSHEET_INFLUENCER_PLACEMENT.LEFT,
|
50
|
+
[`right (${TEARSHEET_INFLUENCER_PLACEMENT.RIGHT})`]:
|
51
|
+
TEARSHEET_INFLUENCER_PLACEMENT.RIGHT,
|
52
|
+
};
|
53
|
+
|
54
|
+
const influencers = {
|
55
|
+
'No influencer': 0,
|
56
|
+
'Simple influencer': 1,
|
57
|
+
'Progress influencer': 2,
|
58
|
+
};
|
59
|
+
|
60
|
+
const getInfluencer = (index) => {
|
61
|
+
switch (index) {
|
62
|
+
case 1:
|
63
|
+
return html`<div
|
64
|
+
slot="influencer"
|
65
|
+
class=${`${storyPrefix}__dummy-content-block`}
|
66
|
+
>
|
67
|
+
Influencer
|
68
|
+
</div>`;
|
69
|
+
case 2:
|
70
|
+
return html` <cds-progress-indicator
|
71
|
+
vertical
|
72
|
+
slot="influencer"
|
73
|
+
class=${`${storyPrefix}__dummy-content-block`}
|
74
|
+
>
|
75
|
+
<cds-progress-step
|
76
|
+
state="complete"
|
77
|
+
label="First step"
|
78
|
+
secondary-label="Optional label"
|
79
|
+
description="Step 1: Getting started with Carbon Design System"
|
80
|
+
></cds-progress-step>
|
81
|
+
<cds-progress-step
|
82
|
+
label="Second step with tooltip"
|
83
|
+
state="current"
|
84
|
+
></cds-progress-step>
|
85
|
+
<cds-progress-step
|
86
|
+
label="Third step with tooltip"
|
87
|
+
state="incomplete"
|
88
|
+
></cds-progress-step>
|
89
|
+
<cds-progress-step
|
90
|
+
label="Fourth step"
|
91
|
+
secondary-label="Example invalid step"
|
92
|
+
state="invalid"
|
93
|
+
></cds-progress-step>
|
94
|
+
<cds-progress-step
|
95
|
+
disabled
|
96
|
+
label="Fifth step"
|
97
|
+
state="incomplete"
|
98
|
+
></cds-progress-step>
|
99
|
+
</cds-progress-indicator>`;
|
100
|
+
default:
|
101
|
+
return null;
|
102
|
+
}
|
103
|
+
};
|
104
|
+
|
105
|
+
const contents = {
|
106
|
+
Empty: 0,
|
107
|
+
'Brief content': 1,
|
108
|
+
'Longer content': 2,
|
109
|
+
};
|
110
|
+
|
111
|
+
const storyPrefix = 'tearsheet-stories';
|
112
|
+
|
113
|
+
const getContent = (index) => {
|
114
|
+
switch (index) {
|
115
|
+
case 1:
|
116
|
+
return html`
|
117
|
+
<style>
|
118
|
+
${styles}
|
119
|
+
</style>
|
120
|
+
<div class=${`${storyPrefix}__dummy-content-block`}>
|
121
|
+
<h5>Section</h5>
|
122
|
+
<cds-text-input
|
123
|
+
label="Input A"
|
124
|
+
id="tearsheet-story-text-input-a"
|
125
|
+
class="${storyPrefix}text-input"
|
126
|
+
></cds-text-input>
|
127
|
+
<cds-text-input
|
128
|
+
label="Input B"
|
129
|
+
id="tearsheet-story-text-input-b"
|
130
|
+
class="${storyPrefix}text-input"
|
131
|
+
></cds-text-input>
|
132
|
+
</div>
|
133
|
+
`;
|
134
|
+
case 2:
|
135
|
+
return html` <style>
|
136
|
+
${styles}
|
137
|
+
</style>
|
138
|
+
<div class=${`${storyPrefix}__dummy-content-block`}>
|
139
|
+
<h5>Section</h5>
|
140
|
+
<div class="${storyPrefix}text-inputs">
|
141
|
+
<cds-text-input
|
142
|
+
label="Input A"
|
143
|
+
id="tearsheet-story-text-input-a"
|
144
|
+
></cds-text-input>
|
145
|
+
<cds-text-input
|
146
|
+
label="Input B"
|
147
|
+
id="tearsheet-story-text-input-b"
|
148
|
+
></cds-text-input>
|
149
|
+
</div>
|
150
|
+
<div class="${storyPrefix}text-inputs">
|
151
|
+
<cds-text-input
|
152
|
+
label="Input C"
|
153
|
+
id="tearsheet-story-text-input-c"
|
154
|
+
></cds-text-input>
|
155
|
+
<cds-text-input
|
156
|
+
label="Input D"
|
157
|
+
id="tearsheet-story-text-input-d"
|
158
|
+
></cds-text-input>
|
159
|
+
</div>
|
160
|
+
<div class="${storyPrefix}textarea-container">
|
161
|
+
<cds-textarea
|
162
|
+
label="Notes"
|
163
|
+
value="This is a text area"
|
164
|
+
></cds-textarea>
|
165
|
+
<cds-textarea
|
166
|
+
label="Notes"
|
167
|
+
value="This is a text area"
|
168
|
+
></cds-textarea>
|
169
|
+
<cds-textarea
|
170
|
+
label="Notes"
|
171
|
+
value="This is a text area"
|
172
|
+
></cds-textarea>
|
173
|
+
</div>
|
174
|
+
</div>`;
|
175
|
+
default:
|
176
|
+
return null;
|
177
|
+
}
|
178
|
+
};
|
179
|
+
|
180
|
+
const labels = {
|
181
|
+
'No label': 0,
|
182
|
+
'Shorter label': 1,
|
183
|
+
'Longer label': 2,
|
184
|
+
};
|
185
|
+
|
186
|
+
const getLabel = (index) => {
|
187
|
+
switch (index) {
|
188
|
+
case 1:
|
189
|
+
return html`<span slot="label">Optional label for context</span>`;
|
190
|
+
case 2:
|
191
|
+
return html`<span slot="label"
|
192
|
+
>A longer label giving a bit more context
|
193
|
+
</span>`;
|
194
|
+
default:
|
195
|
+
return null;
|
196
|
+
}
|
197
|
+
};
|
198
|
+
|
199
|
+
const headerActions = {
|
200
|
+
'No header actions': 0,
|
201
|
+
'Drop down': 1,
|
202
|
+
Buttons: 2,
|
203
|
+
};
|
204
|
+
|
205
|
+
const getActionToolbarItems = (index) => {
|
206
|
+
switch (index) {
|
207
|
+
case 1:
|
208
|
+
return html`<cds-dropdown slot="header-actions">
|
209
|
+
${['option 1', 'option 2', 'option 3', 'option 4'].map(
|
210
|
+
(option) => html` <cds-dropdown-item value="${option}"
|
211
|
+
>${option}</cds-dropdown-item
|
212
|
+
>`
|
213
|
+
)}
|
214
|
+
</cds-dropdown>`;
|
215
|
+
case 2:
|
216
|
+
return html`
|
217
|
+
<cds-button
|
218
|
+
slot="header-actions"
|
219
|
+
kind=${BUTTON_KIND.SECONDARY}
|
220
|
+
size="sm"
|
221
|
+
style="width: initial"
|
222
|
+
>
|
223
|
+
Secondary
|
224
|
+
</cds-button>
|
225
|
+
<cds-button
|
226
|
+
slot="header-actions"
|
227
|
+
kind=${BUTTON_KIND.PRIMARY}
|
228
|
+
size="sm"
|
229
|
+
style="width: initial"
|
230
|
+
>
|
231
|
+
Primary
|
232
|
+
</cds-button>
|
233
|
+
`;
|
234
|
+
default:
|
235
|
+
return null;
|
236
|
+
}
|
237
|
+
};
|
238
|
+
|
239
|
+
const actionItems = {
|
240
|
+
'No actions': 0,
|
241
|
+
'One button': 1,
|
242
|
+
'Two buttons with ghost': 2,
|
243
|
+
'Two buttons with danger': 3,
|
244
|
+
'Three buttons with ghost': 4,
|
245
|
+
'Three buttons with danger': 5,
|
246
|
+
'Four buttons with ghost': 6,
|
247
|
+
'Four buttons with danger': 7,
|
248
|
+
'Too many buttons': 8,
|
249
|
+
};
|
250
|
+
|
251
|
+
const toActions = (kinds: BUTTON_KIND[]) => {
|
252
|
+
return kinds?.map((kind) => {
|
253
|
+
return html`<cds-button key=${kind} slot="actions" kind=${kind}>
|
254
|
+
${kind.charAt(0).toUpperCase() + kind.slice(1)}
|
255
|
+
</cds-button>`;
|
256
|
+
});
|
257
|
+
};
|
258
|
+
|
259
|
+
// TODO: There are problems switching this
|
260
|
+
const getActionItems = (index) => {
|
261
|
+
switch (index) {
|
262
|
+
case 1:
|
263
|
+
return toActions([BUTTON_KIND.PRIMARY]);
|
264
|
+
case 2:
|
265
|
+
return toActions([BUTTON_KIND.GHOST, BUTTON_KIND.PRIMARY]);
|
266
|
+
case 3:
|
267
|
+
return toActions([BUTTON_KIND.DANGER, BUTTON_KIND.PRIMARY]);
|
268
|
+
case 4:
|
269
|
+
return toActions([
|
270
|
+
BUTTON_KIND.GHOST,
|
271
|
+
BUTTON_KIND.SECONDARY,
|
272
|
+
BUTTON_KIND.PRIMARY,
|
273
|
+
]);
|
274
|
+
case 5:
|
275
|
+
return toActions([
|
276
|
+
BUTTON_KIND.DANGER,
|
277
|
+
BUTTON_KIND.SECONDARY,
|
278
|
+
BUTTON_KIND.PRIMARY,
|
279
|
+
]);
|
280
|
+
case 6:
|
281
|
+
return toActions([
|
282
|
+
BUTTON_KIND.GHOST,
|
283
|
+
BUTTON_KIND.TERTIARY,
|
284
|
+
BUTTON_KIND.SECONDARY,
|
285
|
+
BUTTON_KIND.PRIMARY,
|
286
|
+
]);
|
287
|
+
case 7:
|
288
|
+
return toActions([
|
289
|
+
BUTTON_KIND.DANGER,
|
290
|
+
BUTTON_KIND.TERTIARY,
|
291
|
+
BUTTON_KIND.SECONDARY,
|
292
|
+
BUTTON_KIND.PRIMARY,
|
293
|
+
]);
|
294
|
+
case 8:
|
295
|
+
return toActions([
|
296
|
+
BUTTON_KIND.GHOST,
|
297
|
+
BUTTON_KIND.DANGER,
|
298
|
+
BUTTON_KIND.TERTIARY,
|
299
|
+
BUTTON_KIND.SECONDARY,
|
300
|
+
BUTTON_KIND.PRIMARY,
|
301
|
+
]);
|
302
|
+
default:
|
303
|
+
return null;
|
304
|
+
}
|
305
|
+
};
|
306
|
+
|
307
|
+
const navigation = {
|
308
|
+
'No navigation': 0,
|
309
|
+
'With navigation': 1,
|
310
|
+
};
|
311
|
+
|
312
|
+
const getNavigation = (index) => {
|
313
|
+
switch (index) {
|
314
|
+
case 1:
|
315
|
+
return html` <div
|
316
|
+
className="tearsheet-stories__tabs"
|
317
|
+
slot="header-navigation"
|
318
|
+
>
|
319
|
+
<cds-tabs value="1">
|
320
|
+
<cds-tab value="1">Tab 1</cds-tab>
|
321
|
+
<cds-tab value="2">Tab 2</cds-tab>
|
322
|
+
<cds-tab value="3">Tab 3</cds-tab>
|
323
|
+
<cds-tab value="4">Tab 4</cds-tab>
|
324
|
+
</cds-tabs>
|
325
|
+
</div>`;
|
326
|
+
default:
|
327
|
+
return null;
|
328
|
+
}
|
329
|
+
};
|
330
|
+
|
331
|
+
const slugs = {
|
332
|
+
'No Slug': 0,
|
333
|
+
'With Slug': 1,
|
334
|
+
};
|
335
|
+
|
336
|
+
const getSlug = (index) => {
|
337
|
+
switch (index) {
|
338
|
+
case 1:
|
339
|
+
return html`<cds-slug size="xs" alignment="bottom-right">
|
340
|
+
<div slot="body-text">
|
341
|
+
<p class="secondary">AI Explained</p>
|
342
|
+
<h1>84%</h1>
|
343
|
+
<p class="secondary bold">Confidence score</p>
|
344
|
+
<!-- //cspell: disable -->
|
345
|
+
<p class="secondary">
|
346
|
+
Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed
|
347
|
+
do eiusmod tempor incididunt ut fsil labore et dolore magna aliqua.
|
348
|
+
</p>
|
349
|
+
<!-- //cspell: enable -->
|
350
|
+
<hr />
|
351
|
+
<p class="secondary">Model type</p>
|
352
|
+
<p class="bold">Foundation model</p>
|
353
|
+
</div>
|
354
|
+
</cds-slug>`;
|
355
|
+
default:
|
356
|
+
return null;
|
357
|
+
}
|
358
|
+
};
|
359
|
+
|
360
|
+
export const Default = {
|
361
|
+
args: {
|
362
|
+
actionItems: getActionItems(4),
|
363
|
+
headerActions: getActionToolbarItems(0),
|
364
|
+
content: getContent(2),
|
365
|
+
label: getLabel(1),
|
366
|
+
open: false,
|
367
|
+
influencerWidth: TEARSHEET_INFLUENCER_WIDTH.NARROW,
|
368
|
+
influencerPlacement: TEARSHEET_INFLUENCER_PLACEMENT.LEFT,
|
369
|
+
influencer: getInfluencer(0),
|
370
|
+
preventCloseOnClickOutside: false,
|
371
|
+
selectorInitialFocus: '',
|
372
|
+
width: TEARSHEET_WIDTH.WIDE,
|
373
|
+
slug: getSlug(0),
|
374
|
+
description: 'Description used to describe the flow if need be.',
|
375
|
+
title: 'Title used to designate the overarching flow of the tearsheet.',
|
376
|
+
headerNavigation: getNavigation(0),
|
377
|
+
},
|
378
|
+
argTypes: {
|
379
|
+
actionItems: {
|
380
|
+
control: 'select',
|
381
|
+
description: 'Slot (actions)',
|
382
|
+
options: actionItems,
|
383
|
+
},
|
384
|
+
headerActions: {
|
385
|
+
control: 'select',
|
386
|
+
description: 'Slot (header-toolbar)',
|
387
|
+
options: headerActions,
|
388
|
+
},
|
389
|
+
content: {
|
390
|
+
control: 'select',
|
391
|
+
description: 'Slot (default), panel contents',
|
392
|
+
options: contents,
|
393
|
+
},
|
394
|
+
label: {
|
395
|
+
control: 'select',
|
396
|
+
description: 'label',
|
397
|
+
options: labels,
|
398
|
+
},
|
399
|
+
open: {
|
400
|
+
control: 'boolean',
|
401
|
+
description: 'open',
|
402
|
+
},
|
403
|
+
influencerWidth: {
|
404
|
+
control: 'select',
|
405
|
+
description: 'influencer-width',
|
406
|
+
options: influencerWidths,
|
407
|
+
},
|
408
|
+
influencerPlacement: {
|
409
|
+
control: 'select',
|
410
|
+
description: 'influencer-placement',
|
411
|
+
options: influencerPlacements,
|
412
|
+
},
|
413
|
+
influencer: {
|
414
|
+
control: 'select',
|
415
|
+
description: 'influencer (slot)',
|
416
|
+
options: influencers,
|
417
|
+
},
|
418
|
+
preventCloseOnClickOutside: {
|
419
|
+
control: 'boolean',
|
420
|
+
description: 'prevent-close-on-click-outside',
|
421
|
+
},
|
422
|
+
selectorInitialFocus: {
|
423
|
+
control: 'text',
|
424
|
+
description: 'selector-initial-focus',
|
425
|
+
},
|
426
|
+
width: {
|
427
|
+
control: 'select',
|
428
|
+
description: 'width',
|
429
|
+
options: widths,
|
430
|
+
},
|
431
|
+
slug: {
|
432
|
+
control: 'select',
|
433
|
+
description: 'slug (AI slug)',
|
434
|
+
options: slugs,
|
435
|
+
},
|
436
|
+
description: {
|
437
|
+
control: 'text',
|
438
|
+
description: 'description',
|
439
|
+
},
|
440
|
+
title: {
|
441
|
+
control: 'text',
|
442
|
+
description: 'title',
|
443
|
+
},
|
444
|
+
headerNavigation: {
|
445
|
+
control: 'select',
|
446
|
+
description: 'header-navigation',
|
447
|
+
options: navigation,
|
448
|
+
},
|
449
|
+
},
|
450
|
+
render: (args) => {
|
451
|
+
return html`
|
452
|
+
<div class="${storyPrefix}story-container">
|
453
|
+
<div class="${storyPrefix}story-header"></div>
|
454
|
+
<div id="page-content-selector" class="${storyPrefix}story-content">
|
455
|
+
<cds-button @click="${toggleButton}">Toggle tearsheet</cds-button>
|
456
|
+
</div>
|
457
|
+
</div>
|
458
|
+
<c4p-tearsheet
|
459
|
+
class=${args.class}
|
460
|
+
selector-initial-focus=${args.selectorInitialFocus}
|
461
|
+
?open=${args.open}
|
462
|
+
influencer-placement=${args.influencerPlacement}
|
463
|
+
influencer-width=${args.influencerWidth}
|
464
|
+
?prevent-close-on-click-outside=${args.preventCloseOnClickOutside}
|
465
|
+
width=${args.width}
|
466
|
+
>
|
467
|
+
<!-- default slotted content -->
|
468
|
+
${args.content}
|
469
|
+
|
470
|
+
<!-- slotted header label -->
|
471
|
+
${args.label}
|
472
|
+
|
473
|
+
<!-- slotted header title -->
|
474
|
+
${args.title ? html`<span slot="title">${args.title}</span>` : ''}
|
475
|
+
|
476
|
+
<!-- slotted header description -->
|
477
|
+
${args.description
|
478
|
+
? html`<span slot="description">${args.description}</span>`
|
479
|
+
: ''}
|
480
|
+
|
481
|
+
<!-- slotted action in header cds-buttons -->
|
482
|
+
${args.headerActions}
|
483
|
+
|
484
|
+
<!-- slotted action items cds-buttons -->
|
485
|
+
${args.actionItems}
|
486
|
+
|
487
|
+
<!-- slotted slug -->
|
488
|
+
${args.slug}
|
489
|
+
|
490
|
+
<!-- slotted header-navigation -->
|
491
|
+
${args.headerNavigation}
|
492
|
+
|
493
|
+
<!-- slotted influencer -->
|
494
|
+
${args.influencer}
|
495
|
+
</c4p-tearsheet>
|
496
|
+
`;
|
497
|
+
},
|
498
|
+
};
|
499
|
+
|
500
|
+
export const WithNavigation = {
|
501
|
+
...Default,
|
502
|
+
args: {
|
503
|
+
...Default.args,
|
504
|
+
headerNavigation: getNavigation(1),
|
505
|
+
},
|
506
|
+
};
|
507
|
+
|
508
|
+
export const WithInfluencer = {
|
509
|
+
...Default,
|
510
|
+
args: {
|
511
|
+
...Default.args,
|
512
|
+
influencer: getInfluencer(2),
|
513
|
+
},
|
514
|
+
};
|
515
|
+
|
516
|
+
export const WithAllHeaderItemsAndInfluencer = {
|
517
|
+
...Default,
|
518
|
+
args: {
|
519
|
+
...Default.args,
|
520
|
+
headerActions: getActionToolbarItems(2),
|
521
|
+
influencer: getInfluencer(2),
|
522
|
+
},
|
523
|
+
};
|
524
|
+
|
525
|
+
export const Narrow = {
|
526
|
+
...Default,
|
527
|
+
args: {
|
528
|
+
...Default.args,
|
529
|
+
label: getLabel(0),
|
530
|
+
width: TEARSHEET_WIDTH.NARROW,
|
531
|
+
},
|
532
|
+
};
|
533
|
+
|
534
|
+
export const NarrowWithAllHeaderItems = {
|
535
|
+
...Default,
|
536
|
+
args: {
|
537
|
+
...Default.args,
|
538
|
+
width: TEARSHEET_WIDTH.NARROW,
|
539
|
+
},
|
540
|
+
};
|
541
|
+
|
542
|
+
export const StackingTemplate = {
|
543
|
+
...Default,
|
544
|
+
args: {
|
545
|
+
...Default.args,
|
546
|
+
},
|
547
|
+
render: (args) => {
|
548
|
+
const toggleButton = (index) => {
|
549
|
+
const tearsheet = document.querySelector(`[data-index="${index}"]`);
|
550
|
+
tearsheet?.toggleAttribute('open');
|
551
|
+
};
|
552
|
+
|
553
|
+
return html`
|
554
|
+
<div class="${storyPrefix}story-container">
|
555
|
+
<div class="${storyPrefix}story-header"></div>
|
556
|
+
<div id="page-content-selector" class="${storyPrefix}story-content">
|
557
|
+
<cds-button-set-base z-index="9999">
|
558
|
+
<cds-button @click="${() => toggleButton('one')}"
|
559
|
+
>Toggle tearsheet one</cds-button
|
560
|
+
>
|
561
|
+
<cds-button @click="${() => toggleButton('two')}"
|
562
|
+
>Toggle tearsheet two</cds-button
|
563
|
+
>
|
564
|
+
<cds-button @click="${() => toggleButton('three')}"
|
565
|
+
>Toggle tearsheet three</cds-button
|
566
|
+
>
|
567
|
+
</cds-button-set-base>
|
568
|
+
</div>
|
569
|
+
</div>
|
570
|
+
<c4p-tearsheet
|
571
|
+
data-index="one"
|
572
|
+
class=${args.class}
|
573
|
+
selector-initial-focus=${args.selectorInitialFocus}
|
574
|
+
?open=${args.open}
|
575
|
+
influencer-placement=${args.influencerPlacement}
|
576
|
+
influencer-width=${args.influencerWidth}
|
577
|
+
?prevent-close-on-click-outside=${args.preventCloseOnClickOutside}
|
578
|
+
width=${args.width}
|
579
|
+
>
|
580
|
+
<!-- default slotted content -->
|
581
|
+
<cds-button @click="${() => toggleButton('two')}"
|
582
|
+
>Toggle tearsheet two</cds-button
|
583
|
+
>
|
584
|
+
${args.content}
|
585
|
+
|
586
|
+
<!-- slotted header label -->
|
587
|
+
${args.label}
|
588
|
+
|
589
|
+
<!-- slotted header title -->
|
590
|
+
${args.title ? html`<span slot="title">One ${args.title}</span>` : ''}
|
591
|
+
|
592
|
+
<!-- slotted header description -->
|
593
|
+
${args.description
|
594
|
+
? html`<span slot="description">${args.description}</span>`
|
595
|
+
: ''}
|
596
|
+
|
597
|
+
<!-- slotted action in header cds-buttons -->
|
598
|
+
${args.headerActions}
|
599
|
+
|
600
|
+
<!-- slotted action items cds-buttons -->
|
601
|
+
${args.actionItems}
|
602
|
+
|
603
|
+
<!-- slotted slug -->
|
604
|
+
${args.slug}
|
605
|
+
|
606
|
+
<!-- slotted header-navigation -->
|
607
|
+
${args.headerNavigation}
|
608
|
+
|
609
|
+
<!-- slotted influencer -->
|
610
|
+
${args.influencer}
|
611
|
+
</c4p-tearsheet>
|
612
|
+
<c4p-tearsheet
|
613
|
+
data-index="two"
|
614
|
+
class=${args.class}
|
615
|
+
selector-initial-focus=${args.selectorInitialFocus}
|
616
|
+
has-close-icon
|
617
|
+
?open=${args.open}
|
618
|
+
influencer-placement=${args.influencerPlacement}
|
619
|
+
influencer-width=${args.influencerWidth}
|
620
|
+
?prevent-close-on-click-outside=${args.preventCloseOnClickOutside}
|
621
|
+
width=${args.width}
|
622
|
+
>
|
623
|
+
<!-- default slotted content -->
|
624
|
+
<cds-button @click="${() => toggleButton('three')}"
|
625
|
+
>Toggle tearsheet three</cds-button
|
626
|
+
>
|
627
|
+
${args.content}
|
628
|
+
|
629
|
+
<!-- slotted header label -->
|
630
|
+
${args.label}
|
631
|
+
|
632
|
+
<!-- slotted header title -->
|
633
|
+
${args.title ? html`<span slot="title">Two ${args.title}</span>` : ''}
|
634
|
+
|
635
|
+
<!-- slotted header description -->
|
636
|
+
${args.description
|
637
|
+
? html`<span slot="description">${args.description}</span>`
|
638
|
+
: ''}
|
639
|
+
|
640
|
+
<!-- slotted action in header cds-buttons -->
|
641
|
+
${args.headerActions}
|
642
|
+
|
643
|
+
<!-- slotted action items cds-buttons -->
|
644
|
+
${args.actionItems}
|
645
|
+
|
646
|
+
<!-- slotted slug -->
|
647
|
+
${args.slug}
|
648
|
+
|
649
|
+
<!-- slotted header-navigation -->
|
650
|
+
${args.headerNavigation}
|
651
|
+
|
652
|
+
<!-- slotted influencer -->
|
653
|
+
${args.influencer}
|
654
|
+
</c4p-tearsheet>
|
655
|
+
<c4p-tearsheet
|
656
|
+
data-index="three"
|
657
|
+
class=${args.class}
|
658
|
+
selector-initial-focus=${args.selectorInitialFocus}
|
659
|
+
has-close-icon
|
660
|
+
?open=${args.open}
|
661
|
+
influencer-placement=${args.influencerPlacement}
|
662
|
+
influencer-width=${args.influencerWidth}
|
663
|
+
?prevent-close-on-click-outside=${args.preventCloseOnClickOutside}
|
664
|
+
width=${args.width}
|
665
|
+
>
|
666
|
+
<!-- default slotted content -->
|
667
|
+
${args.content}
|
668
|
+
|
669
|
+
<!-- slotted header label -->
|
670
|
+
${args.label}
|
671
|
+
|
672
|
+
<!-- slotted header title -->
|
673
|
+
${args.title ? html`<span slot="title">Three ${args.title}</span>` : ''}
|
674
|
+
|
675
|
+
<!-- slotted header description -->
|
676
|
+
${args.description
|
677
|
+
? html`<span slot="description">${args.description}</span>`
|
678
|
+
: ''}
|
679
|
+
|
680
|
+
<!-- slotted action in header cds-buttons -->
|
681
|
+
${args.headerActions}
|
682
|
+
|
683
|
+
<!-- slotted action items cds-buttons -->
|
684
|
+
${args.actionItems}
|
685
|
+
|
686
|
+
<!-- slotted slug -->
|
687
|
+
${args.slug}
|
688
|
+
|
689
|
+
<!-- slotted header-navigation -->
|
690
|
+
${args.headerNavigation}
|
691
|
+
|
692
|
+
<!-- slotted influencer -->
|
693
|
+
${args.influencer}
|
694
|
+
</c4p-tearsheet>
|
695
|
+
`;
|
696
|
+
},
|
697
|
+
};
|
698
|
+
|
699
|
+
const meta = {
|
700
|
+
title: 'Experimental/Tearsheet',
|
701
|
+
};
|
702
|
+
|
703
|
+
export default meta;
|