@ukic/web-components 2.35.0 → 2.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
  3. package/dist/cjs/ic-navigation-item.cjs.entry.js.map +1 -1
  4. package/dist/cjs/ic-toast.cjs.entry.js +2 -2
  5. package/dist/cjs/ic-toast.cjs.entry.js.map +1 -1
  6. package/dist/collection/components/ic-accordion/ic-accordion.stories.js +635 -0
  7. package/dist/collection/components/ic-alert/ic-alert.stories.js +257 -0
  8. package/dist/collection/components/ic-back-to-top/ic-back-to-top.stories.js +162 -0
  9. package/dist/collection/components/ic-badge/ic-badge.stories.js +1082 -0
  10. package/dist/collection/components/ic-breadcrumb-group/ic-breadcrumb-group.stories.js +502 -0
  11. package/dist/collection/components/ic-button/ic-button.stories.js +2218 -0
  12. package/dist/collection/components/ic-card/ic-card.stories.js +1034 -0
  13. package/dist/collection/components/ic-checkbox-group/ic-checkbox-group.stories.js +687 -0
  14. package/dist/collection/components/ic-chip/ic-chip.stories.js +670 -0
  15. package/dist/collection/components/ic-classification-banner/ic-classification-banner.stories.js +131 -0
  16. package/dist/collection/components/ic-data-entity/ic-data-entity.stories.js +487 -0
  17. package/dist/collection/components/ic-dialog/ic-dialog.stories.js +1256 -0
  18. package/dist/collection/components/ic-empty-state/ic-empty-state.stories.js +397 -0
  19. package/dist/collection/components/ic-footer/ic-footer.stories.js +383 -0
  20. package/dist/collection/components/ic-hero/ic-hero.stories.js +489 -0
  21. package/dist/collection/components/ic-link/ic-link.stories.js +114 -0
  22. package/dist/collection/components/ic-loading-indicator/ic-loading-indicator.stories.js +416 -0
  23. package/dist/collection/components/ic-navigation-item/ic-navigation-item.css +7 -35
  24. package/dist/collection/components/ic-page-header/ic-page-header.stories.js +557 -0
  25. package/dist/collection/components/ic-pagination/ic-pagination.stories.js +125 -0
  26. package/dist/collection/components/ic-popover-menu/ic-popover-menu.stories.js +486 -0
  27. package/dist/collection/components/ic-radio-group/ic-radio-group.stories.js +450 -0
  28. package/dist/collection/components/ic-search-bar/ic-search-bar.stories.js +591 -0
  29. package/dist/collection/components/ic-section-container/ic-section-container.stories.js +62 -0
  30. package/dist/collection/components/ic-select/ic-select-searchable.stories.js +953 -0
  31. package/dist/collection/components/ic-select/ic-select-single.stories.js +780 -0
  32. package/dist/collection/components/ic-side-navigation/ic-side-navigation.stories.js +2526 -0
  33. package/dist/collection/components/ic-skeleton/ic-skeleton.stories.js +141 -0
  34. package/dist/collection/components/ic-status-tag/ic-status-tag.stories.js +161 -0
  35. package/dist/collection/components/ic-stepper/ic-stepper.stories.js +327 -0
  36. package/dist/collection/components/ic-switch/ic-switch.stories.js +171 -0
  37. package/dist/collection/components/ic-tab-context/ic-tabs.stories.js +388 -0
  38. package/dist/collection/components/ic-text-field/ic-text-field.stories.js +1083 -0
  39. package/dist/collection/components/ic-theme/ic-theme.stories.js +171 -0
  40. package/dist/collection/components/ic-toast/ic-toast.js +2 -2
  41. package/dist/collection/components/ic-toast/ic-toast.js.map +1 -1
  42. package/dist/collection/components/ic-toast/ic-toast.stories.js +413 -0
  43. package/dist/collection/components/ic-toast/test/basic/ic-toast.spec.js +3 -3
  44. package/dist/collection/components/ic-toast/test/basic/ic-toast.spec.js.map +1 -1
  45. package/dist/collection/components/ic-toggle-button/ic-toggle-button.stories.js +537 -0
  46. package/dist/collection/components/ic-toggle-button-group/ic-toggle-button-group.stories.js +610 -0
  47. package/dist/collection/components/ic-tooltip/ic-tooltip.stories.js +356 -0
  48. package/dist/collection/components/ic-top-navigation/ic-top-navigation.stories.js +1083 -0
  49. package/dist/collection/components/ic-typography/ic-typography.stories.js +437 -0
  50. package/dist/collection/patterns/top-nav-content-footer.stories.js +109 -0
  51. package/dist/collection/patterns/z-index.stories.js +474 -0
  52. package/dist/components/ic-navigation-item.js +1 -1
  53. package/dist/components/ic-navigation-item.js.map +1 -1
  54. package/dist/components/ic-toast.js +2 -2
  55. package/dist/components/ic-toast.js.map +1 -1
  56. package/dist/core/core.esm.js +1 -1
  57. package/dist/core/p-3e8023ff.entry.js +2 -0
  58. package/dist/core/p-3e8023ff.entry.js.map +1 -0
  59. package/dist/core/{p-7e8a4abd.entry.js → p-bfaa257c.entry.js} +2 -2
  60. package/dist/core/{p-7e8a4abd.entry.js.map → p-bfaa257c.entry.js.map} +1 -1
  61. package/dist/esm/ic-navigation-item.entry.js +1 -1
  62. package/dist/esm/ic-navigation-item.entry.js.map +1 -1
  63. package/dist/esm/ic-toast.entry.js +2 -2
  64. package/dist/esm/ic-toast.entry.js.map +1 -1
  65. package/hydrate/index.js +3 -3
  66. package/package.json +15 -11
  67. package/dist/core/p-dfb3e76e.entry.js +0 -2
  68. package/dist/core/p-dfb3e76e.entry.js.map +0 -1
@@ -0,0 +1,1256 @@
1
+ import { html } from "lit-html";
2
+
3
+ const defaultArgs = {
4
+ buttons: true,
5
+ closeOnBackdropClick: true,
6
+ destructive: false,
7
+ dismissLabel: "Dismiss",
8
+ disableHeightConstraint: false,
9
+ disableWidthConstraint: false,
10
+ hideCloseButton: false,
11
+ heading: "This is a dialog",
12
+ label: "Dialog",
13
+ open: true,
14
+ size: "medium",
15
+ };
16
+
17
+ export default {
18
+ title: "Web Components/Dialog",
19
+ component: "ic-dialog",
20
+ };
21
+
22
+ export const Sizes = {
23
+ render: () => html`
24
+ <script>
25
+ function showSmallDialog() {
26
+ dialog = document.querySelector("#small-dialog");
27
+ dialog.open = true;
28
+ }
29
+ function showMediumDialog() {
30
+ dialog = document.querySelector("#medium-dialog");
31
+ dialog.open = true;
32
+ }
33
+ function showLargeDialog() {
34
+ dialog = document.querySelector("#large-dialog");
35
+ dialog.open = true;
36
+ }
37
+ </script>
38
+ <ic-button variant="primary" onclick="showSmallDialog()"
39
+ >Launch small dialog</ic-button
40
+ >
41
+ <ic-button variant="primary" onclick="showMediumDialog()"
42
+ >Launch medium dialog</ic-button
43
+ >
44
+ <ic-button variant="primary" onclick="showLargeDialog()"
45
+ >Launch large dialog</ic-button
46
+ >
47
+ <ic-dialog heading="This is a small dialog" label="Small" id="small-dialog">
48
+ <ic-typography>
49
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
50
+ tempor incididunt ut labore et dolore magna aliqua.
51
+ </ic-typography>
52
+ </ic-dialog>
53
+ <ic-dialog
54
+ heading="This is a medium dialog"
55
+ label="Medium"
56
+ size="medium"
57
+ id="medium-dialog"
58
+ >
59
+ <ic-typography>
60
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
61
+ tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor
62
+ sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
63
+ ut labore et dolore magna aliqua.
64
+ </ic-typography>
65
+ </ic-dialog>
66
+ <ic-dialog
67
+ heading="This is a large dialog"
68
+ label="Large"
69
+ size="large"
70
+ id="large-dialog"
71
+ >
72
+ <ic-typography>
73
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
74
+ tempor incididunt ut labore et dolore magna aliqua.
75
+ </ic-typography>
76
+ </ic-dialog>
77
+ `,
78
+
79
+ name: "Sizes",
80
+ };
81
+
82
+ export const Status = {
83
+ render: () => html`
84
+ <script>
85
+ function showNeutralDialog() {
86
+ dialog = document.querySelector("#neutral-dialog");
87
+ dialog.open = true;
88
+ }
89
+ function showInfoDialog() {
90
+ dialog = document.querySelector("#info-dialog");
91
+ dialog.open = true;
92
+ }
93
+ function showWarningDialog() {
94
+ dialog = document.querySelector("#warning-dialog");
95
+ dialog.open = true;
96
+ }
97
+ function showErrorDialog() {
98
+ dialog = document.querySelector("#error-dialog");
99
+ dialog.open = true;
100
+ }
101
+ function showSuccessDialog() {
102
+ dialog = document.querySelector("#success-dialog");
103
+ dialog.open = true;
104
+ }
105
+ </script>
106
+ <ic-button variant="primary" onclick="showNeutralDialog()"
107
+ >Launch neutral dialog</ic-button
108
+ >
109
+ <ic-button variant="primary" onclick="showInfoDialog()"
110
+ >Launch info dialog</ic-button
111
+ >
112
+ <ic-button variant="primary" onclick="showWarningDialog()"
113
+ >Launch warning dialog</ic-button
114
+ >
115
+ <ic-button variant="primary" onclick="showErrorDialog()"
116
+ >Launch error dialog</ic-button
117
+ >
118
+ <ic-button variant="primary" onclick="showSuccessDialog()"
119
+ >Launch success dialog</ic-button
120
+ >
121
+ <ic-dialog
122
+ heading="This dialog has a neutral alert"
123
+ label="Neutral"
124
+ status="neutral"
125
+ alert-heading="Neutral alert"
126
+ alert-message="This alert is for generic/miscellaneous messages"
127
+ id="neutral-dialog"
128
+ >
129
+ <ic-typography>
130
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
131
+ tempor incididunt ut labore et dolore magna aliqua.
132
+ </ic-typography>
133
+ </ic-dialog>
134
+ <ic-dialog
135
+ heading="This dialog has an info alert"
136
+ label="Info"
137
+ status="info"
138
+ alert-heading="Info alert"
139
+ alert-message="This alert is for information"
140
+ id="info-dialog"
141
+ >
142
+ <ic-typography>
143
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
144
+ tempor incididunt ut labore et dolore magna aliqua.
145
+ </ic-typography>
146
+ </ic-dialog>
147
+ <ic-dialog
148
+ heading="This dialog has a warning alert"
149
+ label="Warning"
150
+ status="warning"
151
+ alert-heading="Warning alert"
152
+ alert-message="This alert is for warnings"
153
+ id="warning-dialog"
154
+ >
155
+ <ic-typography>
156
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
157
+ tempor incididunt ut labore et dolore magna aliqua.
158
+ </ic-typography>
159
+ </ic-dialog>
160
+ <ic-dialog
161
+ heading="This dialog has an error alert"
162
+ label="Error"
163
+ status="error"
164
+ alert-heading="Error alert"
165
+ alert-message="This alert is for errors"
166
+ id="error-dialog"
167
+ >
168
+ <ic-typography>
169
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
170
+ tempor incididunt ut labore et dolore magna aliqua.
171
+ </ic-typography>
172
+ </ic-dialog>
173
+ <ic-dialog
174
+ heading="This dialog has a success alert"
175
+ label="Success"
176
+ status="success"
177
+ alert-heading="Success alert"
178
+ alert-message="This alert is for success messages"
179
+ id="success-dialog"
180
+ >
181
+ <ic-typography>
182
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
183
+ tempor incididunt ut labore et dolore magna aliqua.
184
+ </ic-typography>
185
+ </ic-dialog>
186
+ `,
187
+
188
+ name: "Status",
189
+ };
190
+
191
+ export const Buttons = {
192
+ render: () => html`
193
+ <script>
194
+ function showPlainDialog() {
195
+ dialog = document.querySelector("#plain-dialog");
196
+ dialog.open = true;
197
+ }
198
+ function showSingleDialog() {
199
+ dialog = document.querySelector("#single-dialog");
200
+ dialog.open = true;
201
+ }
202
+ function showDoubleDialog() {
203
+ dialog = document.querySelector("#double-dialog");
204
+ dialog.open = true;
205
+ }
206
+ function showTripleDialog() {
207
+ dialog = document.querySelector("#triple-dialog");
208
+ dialog.open = true;
209
+ }
210
+ function showDestructiveDialog() {
211
+ dialog = document.querySelector("#destructive-dialog");
212
+ dialog.open = true;
213
+ }
214
+ tripleDialog = document.querySelector("#triple-dialog");
215
+ tripleDialog.buttonProps = [
216
+ { label: "Cancel", onclick: "this.hideDialog()" },
217
+ { label: "Options", onclick: "alert('Options...')" },
218
+ { label: "Confirm", onclick: "alert('Confirmed')" },
219
+ ];
220
+ singleDialog = document.querySelector("#single-dialog");
221
+ singleDialog.buttonProps = [
222
+ { label: "Confirm", onclick: "alert('Confirmed')" },
223
+ ];
224
+ destructiveDialog = document.querySelector("#destructive-dialog");
225
+ destructiveDialog.buttonProps = [
226
+ { label: "Confirm", onclick: "alert('Confirmed')" },
227
+ ];
228
+ </script>
229
+ <ic-button variant="primary" onclick="showPlainDialog()"
230
+ >Launch no button dialog</ic-button
231
+ >
232
+ <ic-button variant="primary" onclick="showSingleDialog()"
233
+ >Launch single button dialog</ic-button
234
+ >
235
+ <ic-button variant="primary" onclick="showDoubleDialog()"
236
+ >Launch two button dialog</ic-button
237
+ >
238
+ <ic-button variant="primary" onclick="showTripleDialog()"
239
+ >Launch three button dialog</ic-button
240
+ >
241
+ <ic-button variant="primary" onclick="showDestructiveDialog()"
242
+ >Launch destructive button dialog</ic-button
243
+ >
244
+ <ic-dialog
245
+ heading="This dialog has no default buttons"
246
+ label="None"
247
+ id="plain-dialog"
248
+ buttons="false"
249
+ >
250
+ <ic-typography
251
+ >Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
252
+ tempor incididunt ut labore et dolore magna aliqua.</ic-typography
253
+ >
254
+ </ic-dialog>
255
+ <ic-dialog
256
+ heading="This dialog has a single button"
257
+ label="Single"
258
+ id="single-dialog"
259
+ >
260
+ <ic-typography>
261
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
262
+ tempor incididunt ut labore et dolore magna aliqua.
263
+ </ic-typography>
264
+ </ic-dialog>
265
+ <ic-dialog
266
+ heading="This dialog has two default buttons"
267
+ label="Double"
268
+ id="double-dialog"
269
+ >
270
+ <ic-typography>
271
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
272
+ tempor incididunt ut labore et dolore magna aliqua.
273
+ </ic-typography>
274
+ </ic-dialog>
275
+ <ic-dialog
276
+ heading="This dialog has three default buttons"
277
+ label="Triple"
278
+ id="triple-dialog"
279
+ >
280
+ <ic-typography
281
+ >Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
282
+ tempor incididunt ut labore et dolore magna aliqua.</ic-typography
283
+ >
284
+ </ic-dialog>
285
+ <ic-dialog
286
+ heading="This dialog has a default destructive button"
287
+ label="Destructive"
288
+ id="destructive-dialog"
289
+ destructive="true"
290
+ >
291
+ <ic-typography>
292
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
293
+ tempor incididunt ut labore et dolore magna aliqua.
294
+ </ic-typography>
295
+ </ic-dialog>
296
+ `,
297
+
298
+ name: "Buttons",
299
+ };
300
+
301
+ export const SlottedContent = {
302
+ render: () => html`
303
+ <script>
304
+ function showDialog() {
305
+ dialog = document.querySelector("ic-dialog");
306
+ dialog.open = true;
307
+ }
308
+ function hideDialog() {
309
+ dialog.open = false;
310
+ }
311
+ function confirm() {
312
+ checkbox = document.querySelector("ic-checkbox");
313
+ if (checkbox.checked) {
314
+ alert("Confirmed with option");
315
+ } else {
316
+ alert("Confirmed!");
317
+ }
318
+ hideDialog();
319
+ }
320
+ var select1 = document.querySelector("#sel1");
321
+ select1.options = [
322
+ { label: "Cappuccino", value: "Cap" },
323
+ { label: "Latte", value: "Lat" },
324
+ { label: "Americano", value: "Ame" },
325
+ ];
326
+ select1.addEventListener("icChange", function (event) {
327
+ console.log(event.detail.value);
328
+ });
329
+ var icPopover = document.querySelector("ic-popover-menu");
330
+ function buttonClick() {
331
+ icPopover.open = true;
332
+ }
333
+ </script>
334
+ <ic-button variant="primary" onclick="showDialog()"
335
+ >Launch dialog</ic-button
336
+ >
337
+ <ic-dialog dismiss-label="Close" size="medium">
338
+ <ic-typography slot="heading" variant="h4"
339
+ >This dialog has slotted interactive content</ic-typography
340
+ >
341
+ <ic-typography slot="label" variant="label">Slotted label</ic-typography>
342
+ <ic-alert
343
+ variant="info"
344
+ heading="Info"
345
+ message="This alert is for displaying information"
346
+ slot="alert"
347
+ ></ic-alert>
348
+ <ic-typography>
349
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
350
+ tempor incididunt ut labore et dolore magna aliqua.
351
+ </ic-typography>
352
+ <ic-search-bar label="What is your favourite coffee?"></ic-search-bar>
353
+ <ic-text-field label="What is your favourite coffee?"> </ic-text-field>
354
+ <ic-select
355
+ id="sel1"
356
+ label="What is your favourite coffee?"
357
+ placeholder="Placeholder goes here"
358
+ ></ic-select>
359
+ <ic-checkbox-group
360
+ style="margin: 8px 0"
361
+ hide-label
362
+ label="confirm"
363
+ name="confirm-checkbox"
364
+ >
365
+ <ic-checkbox label="Option" value="confirm" id="focus"></ic-checkbox>
366
+ </ic-checkbox-group>
367
+ <ic-button id="button-1" onclick="buttonClick()">Show popover</ic-button>
368
+ <ic-tooltip label="This is a description of the button">
369
+ <ic-chip label="Default">
370
+ <svg
371
+ slot="icon"
372
+ width="20"
373
+ height="20"
374
+ viewBox="0 0 20 20"
375
+ fill="currentColor"
376
+ xmlns="http://www.w3.org/2000/svg"
377
+ >
378
+ <path
379
+ d="M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM10 3C11.66 3 13 4.34 13 6C13 7.66 11.66 9 10 9C8.34 9 7 7.66 7 6C7 4.34 8.34 3 10 3ZM10 17.2C7.5 17.2 5.29 15.92 4 13.98C4.03 11.99 8 10.9 10 10.9C11.99 10.9 15.97 11.99 16 13.98C14.71 15.92 12.5 17.2 10 17.2Z"
380
+ />
381
+ </svg> </ic-chip
382
+ ></ic-tooltip>
383
+ <div>
384
+ <ic-popover-menu anchor="button-1" aria-label="popover">
385
+ <ic-menu-item label="Copy code" disabled="true"></ic-menu-item>
386
+ <ic-menu-group label="View">
387
+ <ic-menu-item
388
+ label="Zoom in"
389
+ keyboard-shortcut="Cmd+"
390
+ ></ic-menu-item>
391
+ </ic-menu-group>
392
+ <ic-menu-item
393
+ label="Actions"
394
+ submenu-trigger-for="abc"
395
+ ></ic-menu-item>
396
+ </ic-popover-menu>
397
+ <ic-popover-menu submenu-id="abc">
398
+ <ic-menu-item
399
+ label="Find"
400
+ submenu-trigger-for="abc123"
401
+ ></ic-menu-item>
402
+ </ic-popover-menu>
403
+ <ic-popover-menu submenu-id="abc123">
404
+ <ic-menu-item
405
+ disabled="true"
406
+ label="Search the web"
407
+ description="This will search the web to find the thing you are looking for."
408
+ ></ic-menu-item>
409
+ <ic-menu-item label="Find icons">
410
+ <svg
411
+ slot="icon"
412
+ xmlns="http://www.w3.org/2000/svg"
413
+ height="24px"
414
+ viewBox="0 0 24 24"
415
+ width="24px"
416
+ >
417
+ <path d="M0 0h24v24H0V0z" fill="none" />
418
+ <path
419
+ d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
420
+ />
421
+ </svg>
422
+ </ic-menu-item>
423
+ </ic-popover-menu>
424
+ </div>
425
+ <ic-button
426
+ variant="tertiary"
427
+ onclick="hideDialog()"
428
+ slot="dialog-controls"
429
+ >Cancel</ic-button
430
+ >
431
+ <ic-button variant="primary" onclick="confirm()" slot="dialog-controls"
432
+ >Confirm</ic-button
433
+ >
434
+ </ic-dialog>
435
+ `,
436
+
437
+ name: "Slotted content",
438
+ };
439
+
440
+ export const BackgroundClosePrevented = {
441
+ render: () => html`
442
+ <script>
443
+ function showClosePreventedDialog() {
444
+ dialog = document.querySelector("ic-dialog");
445
+ dialog.open = true;
446
+ }
447
+ </script>
448
+ <ic-button variant="primary" onclick="showClosePreventedDialog()"
449
+ >Launch close prevented dialog</ic-button
450
+ >
451
+ <ic-dialog
452
+ heading="This dialog can't be closed by clicking the background"
453
+ label="Background close prevented"
454
+ close-on-backdrop-click="false"
455
+ >
456
+ <ic-typography>
457
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
458
+ tempor incididunt ut labore et dolore magna aliqua.
459
+ </ic-typography>
460
+ </ic-dialog>
461
+ `,
462
+
463
+ name: "Background close prevented",
464
+ };
465
+
466
+ export const Scrollable = {
467
+ render: () => html`
468
+ <script>
469
+ function showScrollableDialog() {
470
+ dialog = document.querySelector("ic-dialog");
471
+ dialog.open = true;
472
+ }
473
+ var select = document.querySelector("#scroll-sel");
474
+ select.options = [
475
+ { label: "Cappuccino", value: "Cap" },
476
+ { label: "Latte", value: "Lat" },
477
+ { label: "Americano", value: "Ame" },
478
+ ];
479
+ select.addEventListener("icChange", function (event) {
480
+ console.log(event.detail.value);
481
+ });
482
+ </script>
483
+ <ic-button variant="primary" onclick="showScrollableDialog()"
484
+ >Launch scrollable dialog</ic-button
485
+ >
486
+ <ic-dialog heading="This dialog has overflowing content" label="Scrollable">
487
+ <ic-typography>
488
+ Lorem Ipsum is simply dummy text of the printing and typesetting
489
+ industry. Lorem Ipsum has been the industry's standard dummy text ever
490
+ since the 1500s, when an unknown printer took a galley of type and
491
+ scrambled it to make a type specimen book.
492
+ </ic-typography>
493
+ <br />
494
+ <ic-select
495
+ id="scroll-sel"
496
+ label="What is your favourite coffee?"
497
+ placeholder="Placeholder goes here"
498
+ ></ic-select>
499
+ <br />
500
+ <ic-typography>
501
+ It has survived not only five centuries, but also the leap into
502
+ electronic typesetting, remaining essentially unchanged. It was
503
+ popularised in the 1960s with the release of Letraset sheets containing
504
+ Lorem Ipsum passages, and more recently with desktop publishing software
505
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
506
+ Why do we use it?<br /><br />
507
+ It is a long established fact that a reader will be distracted by the
508
+ readable content of a page when looking at its layout. The point of
509
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
510
+ letters, as opposed to using 'Content here, content here', making it
511
+ look like readable English. Many desktop publishing packages and web
512
+ page editors now use Lorem Ipsum as their default model text, and a
513
+ search for 'lorem ipsum' will uncover many web sites still in their
514
+ infancy. Various versions have evolved over the years, sometimes by
515
+ accident, sometimes on purpose (injected humour and the like).
516
+ </ic-typography>
517
+ </ic-dialog>
518
+ `,
519
+
520
+ name: "Scrollable",
521
+ };
522
+
523
+ export const EventsExample = {
524
+ render: () => html`
525
+ <script>
526
+ function showDialog() {
527
+ dialog = document.querySelector("ic-dialog");
528
+ dialog.open = true;
529
+ document.addEventListener("icDialogConfirmed", dialogConfirmed);
530
+ document.addEventListener("icDialogCancelled", dialogCancelled);
531
+ }
532
+ function dialogConfirmed() {
533
+ dialog = document.querySelector("ic-dialog");
534
+ alert("Dialog confirmed");
535
+ dialog.open = false;
536
+ document.removeEventListener("icDialogConfirmed", dialogConfirmed);
537
+ document.removeEventListener("icDialogCancelled", dialogCancelled);
538
+ }
539
+ function dialogCancelled() {
540
+ alert("Dialog cancelled");
541
+ document.removeEventListener("icDialogConfirmed", dialogConfirmed);
542
+ document.removeEventListener("icDialogCancelled", dialogCancelled);
543
+ }
544
+ </script>
545
+ <ic-button variant="primary" onclick="showDialog()"
546
+ >Launch dialog</ic-button
547
+ >
548
+ <ic-dialog heading="This dialog utilises events" label="Events">
549
+ <ic-typography>
550
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
551
+ tempor incididunt ut labore et dolore magna aliqua.
552
+ </ic-typography>
553
+ </ic-dialog>
554
+ `,
555
+
556
+ name: "Events example",
557
+ };
558
+
559
+ export const Popover = {
560
+ render: () => html`
561
+ <script>
562
+ function dropdownItems() {
563
+ return Array.from(Array(10).keys()).map((i) => {
564
+ return {
565
+ label: "Item " + i,
566
+ value: "item-" + i,
567
+ };
568
+ });
569
+ }
570
+ document
571
+ .querySelector("#select-dialog-btn")
572
+ .addEventListener("click", () => {
573
+ document.querySelector("#select-dialog").open = true;
574
+ });
575
+ document
576
+ .querySelector("#search-dialog-btn")
577
+ .addEventListener("click", () => {
578
+ document.querySelector("#search-dialog").open = true;
579
+ });
580
+ document
581
+ .querySelector("#tooltip-dialog-btn")
582
+ .addEventListener("click", () => {
583
+ document.querySelector("#tooltip-dialog").open = true;
584
+ });
585
+ document.querySelector("#select-dropdown").options = dropdownItems();
586
+ document.querySelector("#search-dropdown").options = dropdownItems();
587
+ document.querySelector("#select-dropdown-2").options = dropdownItems();
588
+ document
589
+ .querySelector("#long-text-select-dialog-btn")
590
+ .addEventListener("click", () => {
591
+ document.querySelector("#long-text-select-dialog").open = true;
592
+ });
593
+ document
594
+ .querySelector("#popover-menu-dialog-btn")
595
+ .addEventListener("click", () => {
596
+ document.querySelector("#popover-menu-dialog").open = true;
597
+ });
598
+ document
599
+ .querySelector("#popover-menu-show-btn")
600
+ .addEventListener("click", () => {
601
+ document.querySelector("#popover-menu").open = true;
602
+ });
603
+ </script>
604
+ <div>
605
+ <ic-button id="select-dialog-btn">Select Dialog</ic-button>
606
+ <ic-button id="search-dialog-btn">Search Dialog</ic-button>
607
+ <ic-button id="tooltip-dialog-btn">Tooltip Dialog</ic-button>
608
+ <ic-button id="popover-menu-dialog-btn">Popover Menu Dialog</ic-button>
609
+ <ic-button id="long-text-select-dialog-btn"
610
+ >Long Text with Select Dialog</ic-button
611
+ >
612
+ </div>
613
+ <ic-dialog heading="Select" id="select-dialog">
614
+ <ic-typography>
615
+ It has survived not only five centuries, but also the leap into
616
+ electronic typesetting, remaining essentially unchanged. It was
617
+ popularised in the 1960s with the release of Letraset sheets containing
618
+ Lorem Ipsum passages, and more recently with desktop publishing software
619
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
620
+ Why do we use it?<br /><br />
621
+ It is a long established fact that a reader will be distracted by the
622
+ readable content of a page when looking at its layout. The point of
623
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
624
+ letters, as opposed to using 'Content here, content here', making it
625
+ look like readable English. Many desktop publishing packages and web
626
+ page editors now use Lorem Ipsum as their default model text, and a
627
+ search for 'lorem ipsum' will uncover many web sites still in their
628
+ infancy. Various versions have evolved over the years, sometimes by
629
+ accident, sometimes on purpose (injected humour and the like).
630
+ </ic-typography>
631
+ <ic-select
632
+ id="select-dropdown"
633
+ label="What is your favourite coffee?"
634
+ ></ic-select>
635
+ </ic-dialog>
636
+ <ic-dialog heading="Search" id="search-dialog">
637
+ <ic-typography>
638
+ It has survived not only five centuries, but also the leap into
639
+ electronic typesetting, remaining essentially unchanged. It was
640
+ popularised in the 1960s with the release of Letraset sheets containing
641
+ Lorem Ipsum passages, and more recently with desktop publishing software
642
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
643
+ Why do we use it?<br /><br />
644
+ It is a long established fact that a reader will be distracted by the
645
+ readable content of a page when looking at its layout. The point of
646
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
647
+ letters, as opposed to using 'Content here, content here', making it
648
+ look like readable English. Many desktop publishing packages and web
649
+ page editors now use Lorem Ipsum as their default model text, and a
650
+ search for 'lorem ipsum' will uncover many web sites still in their
651
+ infancy. Various versions have evolved over the years, sometimes by
652
+ accident, sometimes on purpose (injected humour and the like).
653
+ </ic-typography>
654
+ <ic-search-bar
655
+ id="search-dropdown"
656
+ label="What is your favourite coffee?"
657
+ ></ic-search-bar>
658
+ </ic-dialog>
659
+ <ic-dialog heading="Tooltip" id="tooltip-dialog">
660
+ <ic-typography>
661
+ It has survived not only five centuries, but also the leap into
662
+ electronic typesetting, remaining essentially unchanged. It was
663
+ popularised in the 1960s with the release of Letraset sheets containing
664
+ Lorem Ipsum passages, and more recently with desktop publishing software
665
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
666
+ Why do we use it?<br /><br />
667
+ It is a long established fact that a reader will be distracted by the
668
+ readable content of a page when looking at its layout. The point of
669
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
670
+ letters, as opposed to using 'Content here, content here', making it
671
+ look like readable English. Many desktop publishing packages and web
672
+ page editors now use Lorem Ipsum as their default model text, and a
673
+ search for 'lorem ipsum' will uncover many web sites still in their
674
+ infancy. Various versions have evolved over the years, sometimes by
675
+ accident, sometimes on purpose (injected humour and the like).
676
+ </ic-typography>
677
+ <ic-tooltip
678
+ label="This is a description of the button"
679
+ target="test-button-default"
680
+ ><button
681
+ id="test-button-default"
682
+ aria-describedby="ic-tooltip-test-button-default"
683
+ >
684
+ Default
685
+ </button></ic-tooltip
686
+ >
687
+ <ic-button
688
+ variant="icon"
689
+ size="small"
690
+ aria-label="refresh"
691
+ id="testbutton"
692
+ ><svg
693
+ xmlns="http://www.w3.org/2000/svg"
694
+ height="24px"
695
+ viewBox="0 0 24 24"
696
+ width="24px"
697
+ fill="#000000"
698
+ >
699
+ <path d="M0 0h24v24H0V0z" fill="none" />
700
+ <path
701
+ d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
702
+ /></svg
703
+ ></ic-button>
704
+ <ic-chip label="Small" dismissible="true" size="small">
705
+ <svg
706
+ slot="icon"
707
+ width="20"
708
+ height="20"
709
+ viewBox="0 0 20 20"
710
+ fill="currentColor"
711
+ xmlns="http://www.w3.org/2000/svg"
712
+ >
713
+ <path
714
+ d="M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM10 3C11.66 3 13 4.34 13 6C13 7.66 11.66 9 10 9C8.34 9 7 7.66 7 6C7 4.34 8.34 3 10 3ZM10 17.2C7.5 17.2 5.29 15.92 4 13.98C4.03 11.99 8 10.9 10 10.9C11.99 10.9 15.97 11.99 16 13.98C14.71 15.92 12.5 17.2 10 17.2Z"
715
+ />
716
+ </svg>
717
+ </ic-chip>
718
+ </ic-dialog>
719
+ <ic-dialog heading="Popover Menu" id="popover-menu-dialog">
720
+ <ic-typography>
721
+ It has survived not only five centuries, but also the leap into
722
+ electronic typesetting, remaining essentially unchanged. It was
723
+ popularised in the 1960s with the release of Letraset sheets containing
724
+ Lorem Ipsum passages, and more recently with desktop publishing software
725
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
726
+ Why do we use it?<br /><br />
727
+ It is a long established fact that a reader will be distracted by the
728
+ readable content of a page when looking at its layout. The point of
729
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
730
+ letters, as opposed to using 'Content here, content here', making it
731
+ look like readable English. Many desktop publishing packages and web
732
+ page editors now use Lorem Ipsum as their default model text, and a
733
+ search for 'lorem ipsum' will uncover many web sites still in their
734
+ infancy. Various versions have evolved over the years, sometimes by
735
+ accident, sometimes on purpose (injected humour and the like).
736
+ </ic-typography>
737
+ <ic-button id="popover-menu-show-btn">Show popover</ic-button>
738
+ <ic-popover-menu
739
+ id="popover-menu"
740
+ anchor="popover-menu-show-btn"
741
+ aria-label="popover"
742
+ >
743
+ <ic-menu-item label="Copy code" disabled="true"></ic-menu-item>
744
+ <ic-menu-group label="View">
745
+ <ic-menu-item label="Zoom in" keyboard-shortcut="Cmd+"></ic-menu-item>
746
+ <ic-menu-item
747
+ label="Zoom out"
748
+ keyboard-shortcut="Cmd-"
749
+ ></ic-menu-item>
750
+ </ic-menu-group>
751
+ <ic-menu-item label="Actions" submenu-trigger-for="abc"></ic-menu-item>
752
+ <ic-menu-item
753
+ label="Logout"
754
+ variant="destructive"
755
+ disabled="true"
756
+ ></ic-menu-item>
757
+ </ic-popover-menu>
758
+ <ic-popover-menu submenu-id="abc">
759
+ <ic-menu-item label="Edit"></ic-menu-item>
760
+ <ic-menu-item label="Find" submenu-trigger-for="abc123"></ic-menu-item>
761
+ <ic-menu-item label="Delete" variant="destructive"></ic-menu-item>
762
+ </ic-popover-menu>
763
+ <ic-popover-menu submenu-id="abc123">
764
+ <ic-menu-item
765
+ disabled="true"
766
+ label="Search the web"
767
+ description="This will search the web to find the thing you are looking for."
768
+ ></ic-menu-item>
769
+ <ic-menu-item label="Find..."></ic-menu-item>
770
+ <ic-menu-item label="Find icons">
771
+ <svg
772
+ slot="icon"
773
+ xmlns="http://www.w3.org/2000/svg"
774
+ height="24px"
775
+ viewBox="0 0 24 24"
776
+ width="24px"
777
+ >
778
+ <path d="M0 0h24v24H0V0z" fill="none" />
779
+ <path
780
+ d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
781
+ />
782
+ </svg>
783
+ </ic-menu-item>
784
+ <ic-menu-item
785
+ label="Show found results"
786
+ variant="toggle"
787
+ ></ic-menu-item>
788
+ </ic-popover-menu>
789
+ </ic-dialog>
790
+ <ic-dialog
791
+ heading="Long Text Select"
792
+ id="long-text-select-dialog"
793
+ disable-height-constraint="true"
794
+ >
795
+ <ic-typography>
796
+ It has survived not only five centuries, but also the leap into
797
+ electronic typesetting, remaining essentially unchanged. It was
798
+ popularised in the 1960s with the release of Letraset sheets containing
799
+ Lorem Ipsum passages, and more recently with desktop publishing software
800
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
801
+ Why do we use it?<br /><br />
802
+ It is a long established fact that a reader will be distracted by the
803
+ readable content of a page when looking at its layout. The point of
804
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
805
+ letters, as opposed to using 'Content here, content here', making it
806
+ look like readable English. Many desktop publishing packages and web
807
+ page editors now use Lorem Ipsum as their default model text, and a
808
+ search for 'lorem ipsum' will uncover many web sites still in their
809
+ infancy. Various versions have evolved over the years, sometimes by
810
+ accident, sometimes on purpose (injected humour and the like).
811
+ </ic-typography>
812
+ <ic-typography>
813
+ It has survived not only five centuries, but also the leap into
814
+ electronic typesetting, remaining essentially unchanged. It was
815
+ popularised in the 1960s with the release of Letraset sheets containing
816
+ Lorem Ipsum passages, and more recently with desktop publishing software
817
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
818
+ Why do we use it?<br /><br />
819
+ It is a long established fact that a reader will be distracted by the
820
+ readable content of a page when looking at its layout. The point of
821
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
822
+ letters, as opposed to using 'Content here, content here', making it
823
+ look like readable English. Many desktop publishing packages and web
824
+ page editors now use Lorem Ipsum as their default model text, and a
825
+ search for 'lorem ipsum' will uncover many web sites still in their
826
+ infancy. Various versions have evolved over the years, sometimes by
827
+ accident, sometimes on purpose (injected humour and the like).
828
+ </ic-typography>
829
+ <ic-typography>
830
+ It has survived not only five centuries, but also the leap into
831
+ electronic typesetting, remaining essentially unchanged. It was
832
+ popularised in the 1960s with the release of Letraset sheets containing
833
+ Lorem Ipsum passages, and more recently with desktop publishing software
834
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
835
+ Why do we use it?<br /><br />
836
+ It is a long established fact that a reader will be distracted by the
837
+ readable content of a page when looking at its layout. The point of
838
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
839
+ letters, as opposed to using 'Content here, content here', making it
840
+ look like readable English. Many desktop publishing packages and web
841
+ page editors now use Lorem Ipsum as their default model text, and a
842
+ search for 'lorem ipsum' will uncover many web sites still in their
843
+ infancy. Various versions have evolved over the years, sometimes by
844
+ accident, sometimes on purpose (injected humour and the like).
845
+ </ic-typography>
846
+ <ic-select
847
+ id="select-dropdown-2"
848
+ label="What is your favourite coffee?"
849
+ ></ic-select>
850
+ </ic-dialog>
851
+ `,
852
+
853
+ name: "Popover",
854
+ };
855
+
856
+ export const DisableHeightConstraint = {
857
+ render: () => html`
858
+ <script>
859
+ function dropdownItems() {
860
+ return Array.from(Array(10).keys()).map((i) => {
861
+ return {
862
+ label: "Item " + i,
863
+ value: "item-" + i,
864
+ };
865
+ });
866
+ }
867
+ document
868
+ .querySelector("#long-text-select-dialog-btn")
869
+ .addEventListener("click", () => {
870
+ document.querySelector("#long-text-select-dialog").showDialog();
871
+ });
872
+ document
873
+ .querySelector("#short-text-select-dialog-btn")
874
+ .addEventListener("click", () => {
875
+ document.querySelector("#short-text-select-dialog").open = true;
876
+ });
877
+ document.querySelector("#select-dropdown-2").options = dropdownItems();
878
+ document.querySelector("#select-dropdown-3").options = dropdownItems();
879
+ </script>
880
+ <div>
881
+ <ic-button id="long-text-select-dialog-btn"
882
+ >Long Text with Select Dialog</ic-button
883
+ >
884
+ <ic-button id="short-text-select-dialog-btn"
885
+ >Short Text with Select Dialog</ic-button
886
+ >
887
+ <ic-typography>
888
+ It has survived not only five centuries, but also the leap into
889
+ electronic typesetting, remaining essentially unchanged. It was
890
+ popularised in the 1960s with the release of Letraset sheets containing
891
+ Lorem Ipsum passages, and more recently with desktop publishing software
892
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
893
+ Why do we use it?<br /><br />
894
+ It is a long established fact that a reader will be distracted by the
895
+ readable content of a page when looking at its layout. The point of
896
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
897
+ letters, as opposed to using 'Content here, content here', making it
898
+ look like readable English. Many desktop publishing packages and web
899
+ page editors now use Lorem Ipsum as their default model text, and a
900
+ search for 'lorem ipsum' will uncover many web sites still in their
901
+ infancy. Various versions have evolved over the years, sometimes by
902
+ accident, sometimes on purpose (injected humour and the like).
903
+ </ic-typography>
904
+ <ic-typography>
905
+ It has survived not only five centuries, but also the leap into
906
+ electronic typesetting, remaining essentially unchanged. It was
907
+ popularised in the 1960s with the release of Letraset sheets containing
908
+ Lorem Ipsum passages, and more recently with desktop publishing software
909
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
910
+ Why do we use it?<br /><br />
911
+ It is a long established fact that a reader will be distracted by the
912
+ readable content of a page when looking at its layout. The point of
913
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
914
+ letters, as opposed to using 'Content here, content here', making it
915
+ look like readable English. Many desktop publishing packages and web
916
+ page editors now use Lorem Ipsum as their default model text, and a
917
+ search for 'lorem ipsum' will uncover many web sites still in their
918
+ infancy. Various versions have evolved over the years, sometimes by
919
+ accident, sometimes on purpose (injected humour and the like).
920
+ </ic-typography>
921
+ <ic-typography>
922
+ It has survived not only five centuries, but also the leap into
923
+ electronic typesetting, remaining essentially unchanged. It was
924
+ popularised in the 1960s with the release of Letraset sheets containing
925
+ Lorem Ipsum passages, and more recently with desktop publishing software
926
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
927
+ Why do we use it?<br /><br />
928
+ It is a long established fact that a reader will be distracted by the
929
+ readable content of a page when looking at its layout. The point of
930
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
931
+ letters, as opposed to using 'Content here, content here', making it
932
+ look like readable English. Many desktop publishing packages and web
933
+ page editors now use Lorem Ipsum as their default model text, and a
934
+ search for 'lorem ipsum' will uncover many web sites still in their
935
+ infancy. Various versions have evolved over the years, sometimes by
936
+ accident, sometimes on purpose (injected humour and the like).
937
+ </ic-typography>
938
+ <ic-typography>
939
+ It has survived not only five centuries, but also the leap into
940
+ electronic typesetting, remaining essentially unchanged. It was
941
+ popularised in the 1960s with the release of Letraset sheets containing
942
+ Lorem Ipsum passages, and more recently with desktop publishing software
943
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
944
+ Why do we use it?<br /><br />
945
+ It is a long established fact that a reader will be distracted by the
946
+ readable content of a page when looking at its layout. The point of
947
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
948
+ letters, as opposed to using 'Content here, content here', making it
949
+ look like readable English. Many desktop publishing packages and web
950
+ page editors now use Lorem Ipsum as their default model text, and a
951
+ search for 'lorem ipsum' will uncover many web sites still in their
952
+ infancy. Various versions have evolved over the years, sometimes by
953
+ accident, sometimes on purpose (injected humour and the like).
954
+ </ic-typography>
955
+ <ic-typography>
956
+ It has survived not only five centuries, but also the leap into
957
+ electronic typesetting, remaining essentially unchanged. It was
958
+ popularised in the 1960s with the release of Letraset sheets containing
959
+ Lorem Ipsum passages, and more recently with desktop publishing software
960
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
961
+ Why do we use it?<br /><br />
962
+ It is a long established fact that a reader will be distracted by the
963
+ readable content of a page when looking at its layout. The point of
964
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
965
+ letters, as opposed to using 'Content here, content here', making it
966
+ look like readable English. Many desktop publishing packages and web
967
+ page editors now use Lorem Ipsum as their default model text, and a
968
+ search for 'lorem ipsum' will uncover many web sites still in their
969
+ infancy. Various versions have evolved over the years, sometimes by
970
+ accident, sometimes on purpose (injected humour and the like).
971
+ </ic-typography>
972
+ <ic-typography>
973
+ It has survived not only five centuries, but also the leap into
974
+ electronic typesetting, remaining essentially unchanged. It was
975
+ popularised in the 1960s with the release of Letraset sheets containing
976
+ Lorem Ipsum passages, and more recently with desktop publishing software
977
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
978
+ Why do we use it?<br /><br />
979
+ It is a long established fact that a reader will be distracted by the
980
+ readable content of a page when looking at its layout. The point of
981
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
982
+ letters, as opposed to using 'Content here, content here', making it
983
+ look like readable English. Many desktop publishing packages and web
984
+ page editors now use Lorem Ipsum as their default model text, and a
985
+ search for 'lorem ipsum' will uncover many web sites still in their
986
+ infancy. Various versions have evolved over the years, sometimes by
987
+ accident, sometimes on purpose (injected humour and the like).
988
+ </ic-typography>
989
+ <ic-typography>
990
+ It has survived not only five centuries, but also the leap into
991
+ electronic typesetting, remaining essentially unchanged. It was
992
+ popularised in the 1960s with the release of Letraset sheets containing
993
+ Lorem Ipsum passages, and more recently with desktop publishing software
994
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
995
+ Why do we use it?<br /><br />
996
+ It is a long established fact that a reader will be distracted by the
997
+ readable content of a page when looking at its layout. The point of
998
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
999
+ letters, as opposed to using 'Content here, content here', making it
1000
+ look like readable English. Many desktop publishing packages and web
1001
+ page editors now use Lorem Ipsum as their default model text, and a
1002
+ search for 'lorem ipsum' will uncover many web sites still in their
1003
+ infancy. Various versions have evolved over the years, sometimes by
1004
+ accident, sometimes on purpose (injected humour and the like).
1005
+ </ic-typography>
1006
+ <ic-button id="long-text-select-dialog-btn"
1007
+ >Long Text with Select Dialog</ic-button
1008
+ >
1009
+ <ic-button id="short-text-select-dialog-btn"
1010
+ >Short Text with Select Dialog</ic-button
1011
+ >
1012
+ </div>
1013
+ <ic-dialog
1014
+ heading="Short Text Select"
1015
+ label="test"
1016
+ id="short-text-select-dialog"
1017
+ disable-height-constraint="true"
1018
+ >
1019
+ <ic-typography>
1020
+ It has survived not only five centuries, but also the leap into
1021
+ electronic typesetting, remaining essentially unchanged. It was
1022
+ </ic-typography>
1023
+ <ic-select
1024
+ id="select-dropdown-3"
1025
+ label="What is your favourite coffee?"
1026
+ ></ic-select>
1027
+ </ic-dialog>
1028
+ <ic-dialog
1029
+ heading="Long Text Select"
1030
+ id="long-text-select-dialog"
1031
+ disable-height-constraint="true"
1032
+ >
1033
+ <ic-typography>
1034
+ It has survived not only five centuries, but also the leap into
1035
+ electronic typesetting, remaining essentially unchanged. It was
1036
+ popularised in the 1960s with the release of Letraset sheets containing
1037
+ Lorem Ipsum passages, and more recently with desktop publishing software
1038
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
1039
+ Why do we use it?<br /><br />
1040
+ It is a long established fact that a reader will be distracted by the
1041
+ readable content of a page when looking at its layout. The point of
1042
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
1043
+ letters, as opposed to using 'Content here, content here', making it
1044
+ look like readable English. Many desktop publishing packages and web
1045
+ page editors now use Lorem Ipsum as their default model text, and a
1046
+ search for 'lorem ipsum' will uncover many web sites still in their
1047
+ infancy. Various versions have evolved over the years, sometimes by
1048
+ accident, sometimes on purpose (injected humour and the like).
1049
+ </ic-typography>
1050
+ <ic-typography>
1051
+ It has survived not only five centuries, but also the leap into
1052
+ electronic typesetting, remaining essentially unchanged. It was
1053
+ popularised in the 1960s with the release of Letraset sheets containing
1054
+ Lorem Ipsum passages, and more recently with desktop publishing software
1055
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
1056
+ Why do we use it?<br /><br />
1057
+ It is a long established fact that a reader will be distracted by the
1058
+ readable content of a page when looking at its layout. The point of
1059
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
1060
+ letters, as opposed to using 'Content here, content here', making it
1061
+ look like readable English. Many desktop publishing packages and web
1062
+ page editors now use Lorem Ipsum as their default model text, and a
1063
+ search for 'lorem ipsum' will uncover many web sites still in their
1064
+ infancy. Various versions have evolved over the years, sometimes by
1065
+ accident, sometimes on purpose (injected humour and the like).
1066
+ </ic-typography>
1067
+ <ic-typography>
1068
+ It has survived not only five centuries, but also the leap into
1069
+ electronic typesetting, remaining essentially unchanged. It was
1070
+ popularised in the 1960s with the release of Letraset sheets containing
1071
+ Lorem Ipsum passages, and more recently with desktop publishing software
1072
+ like Aldus PageMaker including versions of Lorem Ipsum.<br /><br />
1073
+ Why do we use it?<br /><br />
1074
+ It is a long established fact that a reader will be distracted by the
1075
+ readable content of a page when looking at its layout. The point of
1076
+ using Lorem Ipsum is that it has a more-or-less normal distribution of
1077
+ letters, as opposed to using 'Content here, content here', making it
1078
+ look like readable English. Many desktop publishing packages and web
1079
+ page editors now use Lorem Ipsum as their default model text, and a
1080
+ search for 'lorem ipsum' will uncover many web sites still in their
1081
+ infancy. Various versions have evolved over the years, sometimes by
1082
+ accident, sometimes on purpose (injected humour and the like).
1083
+ </ic-typography>
1084
+ <ic-select
1085
+ id="select-dropdown-2"
1086
+ label="What is your favourite coffee?"
1087
+ ></ic-select>
1088
+ </ic-dialog>
1089
+ `,
1090
+
1091
+ name: "Disable Height Constraint",
1092
+ };
1093
+
1094
+ export const DisableWidthConstraint = {
1095
+ render: () => html`
1096
+ <script>
1097
+ document
1098
+ .querySelector("#full-width-dialog-btn")
1099
+ .addEventListener("click", () => {
1100
+ document.querySelector("#full-width-dialog").showDialog();
1101
+ });
1102
+ </script>
1103
+ <div>
1104
+ <ic-button id="full-width-dialog-btn">Full Width Text Dialog</ic-button>
1105
+ </div>
1106
+ <ic-dialog
1107
+ heading="Full Width Text"
1108
+ label="test"
1109
+ id="full-width-dialog"
1110
+ size="large"
1111
+ disable-width-constraint="true"
1112
+ >
1113
+ <ic-typography>
1114
+ It has survived not only five centuries, but also the leap into
1115
+ electronic typesetting, remaining essentially unchanged. It was
1116
+ popularised in the 1960s with the release of Letraset sheets containing
1117
+ Lorem Ipsum passages, and more recently with desktop publishing software
1118
+ like Aldus PageMaker including versions of Lorem Ipsum.
1119
+ </ic-typography>
1120
+ </ic-dialog>
1121
+ `,
1122
+
1123
+ name: "Disable Width Constraint",
1124
+ };
1125
+
1126
+ export const ShowHideInteractiveElements = {
1127
+ render: () => html`
1128
+ <script>
1129
+ function showSmallDialog() {
1130
+ dialog = document.querySelector("#small-dialog").showDialog();
1131
+ }
1132
+ var btnShow = document.querySelector(".show");
1133
+ btnShow.addEventListener("click", () => {
1134
+ var el = document.createElement("ic-button");
1135
+ el.id = "toggleBtn";
1136
+ el.innerText = "Hello World!";
1137
+ var base = document.querySelector("#base");
1138
+ base.after(el);
1139
+ });
1140
+ var btnHide = document.querySelector(".hide");
1141
+ btnHide.addEventListener("click", () => {
1142
+ if (document.querySelector("#toggleBtn")) {
1143
+ var btn = document.querySelector("#toggleBtn");
1144
+ btn.remove();
1145
+ }
1146
+ });
1147
+ </script>
1148
+ <ic-button variant="primary" onclick="showSmallDialog()"
1149
+ >Launch small dialog</ic-button
1150
+ >
1151
+ <ic-dialog heading="This is a small dialog" label="Small" id="small-dialog">
1152
+ <ic-typography>
1153
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
1154
+ tempor incididunt ut labore et dolore magna aliqua.
1155
+ </ic-typography>
1156
+ <ic-button class="show">Show</ic-button>
1157
+ <ic-button class="hide">Hide</ic-button>
1158
+ <div id="base"></div>
1159
+ </ic-dialog>
1160
+ `,
1161
+
1162
+ name: "show/hide interactive elements",
1163
+ };
1164
+
1165
+ export const HiddenCloseButton = {
1166
+ render: () => html`
1167
+ <script>
1168
+ function showHiddenCloseButtonDialog() {
1169
+ dialog = document.querySelector("#hidden-close-button-dialog");
1170
+ dialog.open = true;
1171
+ }
1172
+ </script>
1173
+ <ic-button variant="primary" onclick="showHiddenCloseButtonDialog()"
1174
+ >Launch dialog with hidden close button</ic-button
1175
+ >
1176
+ <ic-dialog
1177
+ id="hidden-close-button-dialog"
1178
+ heading="This dialog does not have a close button"
1179
+ label="Hidden Close Button Dialog"
1180
+ hide-close-button
1181
+ >
1182
+ <ic-typography>
1183
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
1184
+ tempor incididunt ut labore et dolore magna aliqua.
1185
+ </ic-typography>
1186
+ </ic-dialog>
1187
+ `,
1188
+
1189
+ name: "Hidden close button",
1190
+ };
1191
+
1192
+ export const AutoOpening = {
1193
+ render: () => html`
1194
+ <script>
1195
+ function showAutoOpenCloseButtonDialog() {
1196
+ dialog = document.querySelector("#auto-opening-dialog");
1197
+ dialog.open = true;
1198
+ }
1199
+ </script>
1200
+ <ic-button variant="primary" onclick="showAutoOpenCloseButtonDialog()"
1201
+ >Launch auto opening dialog</ic-button
1202
+ >
1203
+ <ic-dialog
1204
+ id="auto-opening-dialog"
1205
+ heading="This dialog opens automatically using the open prop"
1206
+ label="Auto opening dialog"
1207
+ open
1208
+ >
1209
+ <ic-typography>
1210
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
1211
+ tempor incididunt ut labore et dolore magna aliqua.
1212
+ </ic-typography>
1213
+ </ic-dialog>
1214
+ `,
1215
+
1216
+ name: "Auto Opening",
1217
+ };
1218
+
1219
+ export const Playground = {
1220
+ render: (args) =>
1221
+ html`<ic-dialog
1222
+ heading=${args.heading}
1223
+ label=${args.label}
1224
+ size=${args.size}
1225
+ open=${args.open}
1226
+ close-on-backdrop-click=${args.closeOnBackdropClick}
1227
+ destructive=${args.destructive}
1228
+ dismiss-label=${args.dismissLabel}
1229
+ disable-height-constraint=${args.disableHeightConstraint}
1230
+ disable-width-constraint=${args.disableWidthConstraint}
1231
+ hide-close-button=${args.hideCloseButton}
1232
+ buttons=${args.buttons}
1233
+ id="medium-dialog"
1234
+ >
1235
+ <ic-typography>
1236
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
1237
+ tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor
1238
+ sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
1239
+ ut labore et dolore magna aliqua.
1240
+ </ic-typography>
1241
+ </ic-dialog>`,
1242
+
1243
+ args: defaultArgs,
1244
+
1245
+ argTypes: {
1246
+ size: {
1247
+ options: ["small", "medium", "large"],
1248
+
1249
+ control: {
1250
+ type: "radio",
1251
+ },
1252
+ },
1253
+ },
1254
+
1255
+ name: "Playground",
1256
+ };