@zazz-ui/core 0.13.0 → 0.14.0

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 (84) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +5 -9
  3. package/dist/sri.json +34 -30
  4. package/dist/zazz.css +1 -1
  5. package/dist/zazz.js +1 -1
  6. package/editor/zazz.css-data.json +173 -3
  7. package/editor/zazz.html-data.json +138 -0
  8. package/editor/zazz.language-data.json +313 -125
  9. package/editor/zazz.lint-data.json +1501 -1383
  10. package/package.json +1 -5
  11. package/src/base/_defaults.css +1 -1
  12. package/src/base/_reset.css +16 -2
  13. package/src/base/_variables.css +43 -31
  14. package/src/base/carousel-scroll.d.ts +161 -0
  15. package/src/base/carousel-scroll.d.ts.map +1 -0
  16. package/src/base/carousel-scroll.js +1035 -0
  17. package/src/base/carousel-scroll.ts +1227 -0
  18. package/src/base/carousel.d.ts +34 -0
  19. package/src/base/carousel.d.ts.map +1 -0
  20. package/src/base/carousel.js +279 -0
  21. package/src/base/carousel.ts +292 -0
  22. package/src/base/dialog-lifecycle.js +1 -1
  23. package/src/base/dialog-lifecycle.ts +1 -1
  24. package/src/base/gesture.d.ts +201 -0
  25. package/src/base/gesture.d.ts.map +1 -0
  26. package/src/base/gesture.js +317 -0
  27. package/src/base/gesture.ts +494 -0
  28. package/src/base/kit-styling.d.ts.map +1 -1
  29. package/src/base/kit-styling.js +182 -162
  30. package/src/base/kit-styling.ts +182 -162
  31. package/src/base/utils.d.ts +1 -1
  32. package/src/base/utils.js +2 -2
  33. package/src/base/utils.ts +2 -2
  34. package/src/globals.d.ts +7 -30
  35. package/src/head.d.ts.map +1 -1
  36. package/src/head.js +1 -25
  37. package/src/head.ts +1 -25
  38. package/src/index.css +1 -0
  39. package/src/index.d.ts +6 -5
  40. package/src/index.d.ts.map +1 -1
  41. package/src/index.js +6 -5
  42. package/src/index.ts +6 -5
  43. package/src/manifest.d.ts +1 -1
  44. package/src/manifest.d.ts.map +1 -1
  45. package/src/manifest.js +25 -13
  46. package/src/manifest.ts +26 -14
  47. package/src/primitives/button/button.css +1 -1
  48. package/src/primitives/carousel/carousel.css +103 -20
  49. package/src/primitives/carousel/carousel.d.ts +4 -32
  50. package/src/primitives/carousel/carousel.d.ts.map +1 -1
  51. package/src/primitives/carousel/carousel.js +39 -14
  52. package/src/primitives/carousel/carousel.ts +21 -25
  53. package/src/primitives/dialog/dialog.css +14 -8
  54. package/src/primitives/drawer/drawer-indent.html +27 -0
  55. package/src/primitives/drawer/drawer-nested.html +72 -0
  56. package/src/primitives/drawer/drawer-responsive-dialog.html +44 -0
  57. package/src/primitives/drawer/drawer-snap.html +26 -0
  58. package/src/primitives/drawer/drawer.css +528 -0
  59. package/src/primitives/drawer/drawer.d.ts +24 -0
  60. package/src/primitives/drawer/drawer.d.ts.map +1 -0
  61. package/src/primitives/drawer/drawer.html +42 -0
  62. package/src/primitives/drawer/drawer.js +765 -0
  63. package/src/primitives/drawer/drawer.ts +823 -0
  64. package/src/primitives/fields/fields.css +4 -2
  65. package/src/primitives/input/input.css +4 -3
  66. package/src/primitives/input-group/input-group.css +5 -5
  67. package/src/primitives/lightbox/lightbox.css +2 -2
  68. package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
  69. package/src/primitives/lightbox/lightbox.js +9 -8
  70. package/src/primitives/lightbox/lightbox.ts +9 -8
  71. package/src/primitives/password-group/password-group.css +5 -5
  72. package/src/primitives/radio/radio.css +15 -10
  73. package/src/primitives/slider/slider.css +2 -2
  74. package/src/primitives/switch/switch.css +6 -6
  75. package/src/primitives/tabs/tabs.css +10 -10
  76. package/src/primitives/toaster/toaster.css +29 -1
  77. package/src/primitives/toaster/toaster.d.ts.map +1 -1
  78. package/src/primitives/toaster/toaster.js +117 -9
  79. package/src/primitives/toaster/toaster.ts +136 -9
  80. package/src/primitives/tooltip/tooltip.css +93 -10
  81. package/src/base/embla.d.ts +0 -90
  82. package/src/base/embla.d.ts.map +0 -1
  83. package/src/base/embla.js +0 -878
  84. package/src/base/embla.ts +0 -1066
@@ -1,32 +1,4 @@
1
- /**
2
- * @fileoverview `<ui-carousel>` — HTML web component for carousels.
3
- * @description Light-DOM custom element that wraps standard carousel markup
4
- * and owns the Embla lifecycle: it initializes on connect (via
5
- * `EmblaInit.initRoot`) and destroys its instances on disconnect, so
6
- * dynamically inserted or SPA-swapped carousels need no manual wiring.
7
- *
8
- * The element *is* the carousel root — CSS and `embla.js` target
9
- * `:is(ui-carousel, [data-ui~="carousel"])` directly, and `data-carousel-*`
10
- * configuration attributes are read off the element (see embla.js for the
11
- * full attribute reference). No shadow DOM; children are regular markup.
12
- *
13
- * Carousels inside a closed `<dialog>` defer initialization until the dialog
14
- * first opens (a closed dialog is `display: none`, so Embla cannot measure
15
- * the viewport).
16
- *
17
- * @example
18
- * <ui-carousel data-carousel-loop="true">
19
- * <div data-carousel-slot="viewport">
20
- * <div data-carousel-slot="container">
21
- * <div data-carousel-slot="slide">Slide 1</div>
22
- * <div data-carousel-slot="slide">Slide 2</div>
23
- * </div>
24
- * </div>
25
- * <button type="button" data-carousel-slot="prev">Prev</button>
26
- * <button type="button" data-carousel-slot="next">Next</button>
27
- * </ui-carousel>
28
- */
29
- import type { EmblaCarouselType } from "embla-carousel";
1
+ import type { CarouselApi } from "../../base/carousel-scroll.ts";
30
2
  import { ZazzElement } from "../../base/zazz-element.ts";
31
3
  declare class UiCarouselElement extends ZazzElement {
32
4
  protected setup(signal: AbortSignal): void;
@@ -37,10 +9,10 @@ declare class UiCarouselElement extends ZazzElement {
37
9
  */
38
10
  init(): void;
39
11
  /**
40
- * @returns The Embla v9 API (`goTo`, `goToNext`, `selectedSnap`, lowercase
41
- * events such as `reinit`), or null before initialization.
12
+ * @returns The carousel API (`goTo`, `goToNext`, `goToPrev`, `selectedSnap`,
13
+ * `play`, `stop`), or null before initialization.
42
14
  */
43
- get api(): EmblaCarouselType | null;
15
+ get api(): CarouselApi | null;
44
16
  }
45
17
  export { UiCarouselElement };
46
18
  //# sourceMappingURL=carousel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["carousel.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAE5E,cAAM,iBAAkB,SAAQ,WAAW;IACzC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAUzC;IAED,SAAS,CAAC,QAAQ,IAAI,IAAI,CAazB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,CAEX;IAED;;;OAGG;IACH,IAAI,GAAG,IAAI,iBAAiB,GAAG,IAAI,CAElC;CACF;AAID,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["carousel.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAE5E,cAAM,iBAAkB,SAAQ,WAAW;IACzC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAUzC;IAED,SAAS,CAAC,QAAQ,IAAI,IAAI,CAQzB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,CAEX;IAED;;;OAGG;IACH,IAAI,GAAG,IAAI,WAAW,GAAG,IAAI,CAE5B;CACF;AAID,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,11 +1,40 @@
1
1
  "use strict";
2
- import { EmblaInit } from "../../base/embla.js";
2
+ /**
3
+ * @fileoverview `<ui-carousel>` — HTML web component for carousels.
4
+ * @description Light-DOM custom element that wraps standard carousel markup
5
+ * and owns the carousel's lifecycle: it initializes on connect (via
6
+ * `Carousel.initRoot`) and tears down on disconnect, so dynamically inserted
7
+ * or SPA-swapped carousels need no manual wiring.
8
+ *
9
+ * The element *is* the carousel root — CSS and `base/carousel.js` target
10
+ * `:is(ui-carousel, [data-ui~="carousel"])` directly, and `data-carousel-*`
11
+ * configuration attributes are read off the element (see base/carousel.js for
12
+ * the full attribute reference). No shadow DOM; children are regular markup.
13
+ *
14
+ * Carousels inside a closed `<dialog>` defer initialization until the dialog
15
+ * first opens (a closed dialog is `display: none`, so the viewport cannot be
16
+ * measured).
17
+ *
18
+ * @example
19
+ * <ui-carousel data-carousel-loop="true">
20
+ * <div data-carousel-slot="viewport">
21
+ * <div data-carousel-slot="container">
22
+ * <div data-carousel-slot="slide">Slide 1</div>
23
+ * <div data-carousel-slot="slide">Slide 2</div>
24
+ * <div data-carousel-slot="slide">Slide 3</div>
25
+ * </div>
26
+ * </div>
27
+ * <button type="button" data-carousel-slot="prev">Prev</button>
28
+ * <button type="button" data-carousel-slot="next">Next</button>
29
+ * </ui-carousel>
30
+ */
31
+ import { Carousel } from "../../base/carousel.js";
3
32
  import { ZazzElement, defineZazzElement } from "../../base/zazz-element.js";
4
33
  class UiCarouselElement extends ZazzElement {
5
34
  setup(signal) {
6
35
  const dialog = this.closest("dialog");
7
36
  if (dialog && !dialog.open) {
8
- // Closed dialogs are display:none — Embla can't measure the viewport.
37
+ // Closed dialogs are display:none — the viewport can't be measured.
9
38
  // Initialize on the dialog's open instead (zazz:dialog-open).
10
39
  dialog.addEventListener("zazz:dialog-open", () => this.init(), { signal });
11
40
  return;
@@ -13,14 +42,10 @@ class UiCarouselElement extends ZazzElement {
13
42
  this.init();
14
43
  }
15
44
  teardown() {
16
- // Abort first so the per-carousel DOM listeners (prev/next, dots, thumbs,
17
- // drag-click suppression) are removed before the Embla instances are torn down.
18
- this._emblaController?.abort();
19
- delete this._emblaController;
20
- this._emblaApi?.destroy();
21
- this._emblaApiThumb?.destroy();
22
- delete this._emblaApi;
23
- delete this._emblaApiThumb;
45
+ // Aborting removes every listener and observer the engine bound and
46
+ // restores the markup (slide order, the template dot, state tokens).
47
+ this._carouselController?.abort();
48
+ delete this._carouselController;
24
49
  // Allow re-initialization if the element is re-inserted.
25
50
  this.removeAttribute("data-carousel-init");
26
51
  }
@@ -29,14 +54,14 @@ class UiCarouselElement extends ZazzElement {
29
54
  * roots and roots inside closed dialogs are skipped by `initRoot`.
30
55
  */
31
56
  init() {
32
- EmblaInit.initRoot(this);
57
+ Carousel.initRoot(this);
33
58
  }
34
59
  /**
35
- * @returns The Embla v9 API (`goTo`, `goToNext`, `selectedSnap`, lowercase
36
- * events such as `reinit`), or null before initialization.
60
+ * @returns The carousel API (`goTo`, `goToNext`, `goToPrev`, `selectedSnap`,
61
+ * `play`, `stop`), or null before initialization.
37
62
  */
38
63
  get api() {
39
- return this._emblaApi ?? null;
64
+ return this._carousel ?? null;
40
65
  }
41
66
  }
42
67
  defineZazzElement("ui-carousel", UiCarouselElement);
@@ -3,18 +3,18 @@
3
3
  /**
4
4
  * @fileoverview `<ui-carousel>` — HTML web component for carousels.
5
5
  * @description Light-DOM custom element that wraps standard carousel markup
6
- * and owns the Embla lifecycle: it initializes on connect (via
7
- * `EmblaInit.initRoot`) and destroys its instances on disconnect, so
8
- * dynamically inserted or SPA-swapped carousels need no manual wiring.
6
+ * and owns the carousel's lifecycle: it initializes on connect (via
7
+ * `Carousel.initRoot`) and tears down on disconnect, so dynamically inserted
8
+ * or SPA-swapped carousels need no manual wiring.
9
9
  *
10
- * The element *is* the carousel root — CSS and `embla.js` target
10
+ * The element *is* the carousel root — CSS and `base/carousel.js` target
11
11
  * `:is(ui-carousel, [data-ui~="carousel"])` directly, and `data-carousel-*`
12
- * configuration attributes are read off the element (see embla.js for the
13
- * full attribute reference). No shadow DOM; children are regular markup.
12
+ * configuration attributes are read off the element (see base/carousel.js for
13
+ * the full attribute reference). No shadow DOM; children are regular markup.
14
14
  *
15
15
  * Carousels inside a closed `<dialog>` defer initialization until the dialog
16
- * first opens (a closed dialog is `display: none`, so Embla cannot measure
17
- * the viewport).
16
+ * first opens (a closed dialog is `display: none`, so the viewport cannot be
17
+ * measured).
18
18
  *
19
19
  * @example
20
20
  * <ui-carousel data-carousel-loop="true">
@@ -22,6 +22,7 @@
22
22
  * <div data-carousel-slot="container">
23
23
  * <div data-carousel-slot="slide">Slide 1</div>
24
24
  * <div data-carousel-slot="slide">Slide 2</div>
25
+ * <div data-carousel-slot="slide">Slide 3</div>
25
26
  * </div>
26
27
  * </div>
27
28
  * <button type="button" data-carousel-slot="prev">Prev</button>
@@ -29,15 +30,15 @@
29
30
  * </ui-carousel>
30
31
  */
31
32
 
32
- import type { EmblaCarouselType } from "embla-carousel";
33
- import { EmblaInit } from "../../base/embla.ts";
33
+ import { Carousel } from "../../base/carousel.ts";
34
+ import type { CarouselApi } from "../../base/carousel-scroll.ts";
34
35
  import { ZazzElement, defineZazzElement } from "../../base/zazz-element.ts";
35
36
 
36
37
  class UiCarouselElement extends ZazzElement {
37
38
  protected setup(signal: AbortSignal): void {
38
39
  const dialog = this.closest("dialog");
39
40
  if (dialog && !dialog.open) {
40
- // Closed dialogs are display:none — Embla can't measure the viewport.
41
+ // Closed dialogs are display:none — the viewport can't be measured.
41
42
  // Initialize on the dialog's open instead (zazz:dialog-open).
42
43
  dialog.addEventListener("zazz:dialog-open", () => this.init(), { signal });
43
44
  return;
@@ -47,15 +48,10 @@ class UiCarouselElement extends ZazzElement {
47
48
  }
48
49
 
49
50
  protected teardown(): void {
50
- // Abort first so the per-carousel DOM listeners (prev/next, dots, thumbs,
51
- // drag-click suppression) are removed before the Embla instances are torn down.
52
- this._emblaController?.abort();
53
- delete this._emblaController;
54
-
55
- this._emblaApi?.destroy();
56
- this._emblaApiThumb?.destroy();
57
- delete this._emblaApi;
58
- delete this._emblaApiThumb;
51
+ // Aborting removes every listener and observer the engine bound and
52
+ // restores the markup (slide order, the template dot, state tokens).
53
+ this._carouselController?.abort();
54
+ delete this._carouselController;
59
55
 
60
56
  // Allow re-initialization if the element is re-inserted.
61
57
  this.removeAttribute("data-carousel-init");
@@ -66,15 +62,15 @@ class UiCarouselElement extends ZazzElement {
66
62
  * roots and roots inside closed dialogs are skipped by `initRoot`.
67
63
  */
68
64
  init(): void {
69
- EmblaInit.initRoot(this);
65
+ Carousel.initRoot(this);
70
66
  }
71
67
 
72
68
  /**
73
- * @returns The Embla v9 API (`goTo`, `goToNext`, `selectedSnap`, lowercase
74
- * events such as `reinit`), or null before initialization.
69
+ * @returns The carousel API (`goTo`, `goToNext`, `goToPrev`, `selectedSnap`,
70
+ * `play`, `stop`), or null before initialization.
75
71
  */
76
- get api(): EmblaCarouselType | null {
77
- return this._emblaApi ?? null;
72
+ get api(): CarouselApi | null {
73
+ return this._carousel ?? null;
78
74
  }
79
75
  }
80
76
 
@@ -20,7 +20,10 @@
20
20
  * by default) over its preset; a narrow window with a mouse keeps the preset; style
21
21
  * queries are Firefox 151+, Chrome 111+, Safari 18+, an older engine keeps the preset
22
22
  * @uses env(safe-area-inset-bottom) — the full-height content slot clears the home indicator
23
- * @consumedby alert-dialog.css, command.css, lightbox.css, mobile-menu.css
23
+ * @uses translate, scale — in the transition list for consumers that move a dialog with
24
+ * them (drawer.js drags with an inline translate and releases into these
25
+ * transitions; a drawer behind another is scaled back)
26
+ * @consumedby alert-dialog.css, command.css, drawer.css, lightbox.css, mobile-menu.css
24
27
  */
25
28
 
26
29
  @layer variables {
@@ -49,7 +52,7 @@
49
52
  --ui-dialog-translate--start: 0, 0, 0;
50
53
  --ui-dialog-translate--end: 0, 0, 0;
51
54
  --ui-dialog-transition-delay--start: 0ms;
52
- --ui-dialog-transition-delay--end: 150ms;
55
+ --ui-dialog-transition-delay--end: 0ms;
53
56
  }
54
57
  }
55
58
 
@@ -86,6 +89,8 @@
86
89
  transition:
87
90
  opacity var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
88
91
  transform var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
92
+ translate var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
93
+ scale var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
89
94
  padding var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
90
95
  block-size var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
91
96
  inline-size var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
@@ -345,25 +350,26 @@
345
350
  query reads the hook on the dialog's parent, never on the dialog itself: set it on :root
346
351
  for the site, or on one dialog's parent for that dialog alone. A viewport query, not a
347
352
  container one, because a top-layer dialog is sized by the viewport. Style queries are
348
- Firefox 151+; an older engine keeps the preset. */
353
+ Firefox 151+; an older engine keeps the preset. A drawer (drawer.css) is a bottom sheet
354
+ here instead, so every rule steps aside for it. */
349
355
  @media (width < 40rem) and (not (hover: hover)) {
350
356
  @container style(--ui-dialog-mobile-size: layout-bleed) {
351
357
  /* Not :where(): the viewport decides the height here, over a consumer's own cap
352
358
  on the same element (command's list max-block-size loads later at equal
353
359
  specificity). Utilities still win through the layer order. */
354
- [data-ui~="dialog"] [data-dialog-slot~="content"] {
360
+ [data-ui~="dialog"]:where(:not([data-ui~="drawer"])) [data-dialog-slot~="content"] {
355
361
  place-content: start stretch;
356
362
  block-size: 100%;
357
363
  padding-block-end: env(safe-area-inset-bottom, 0px);
358
364
  }
359
365
 
360
- [data-ui~="dialog"] [data-dialog-slot~="body"] {
366
+ [data-ui~="dialog"]:where(:not([data-ui~="drawer"])) [data-dialog-slot~="body"] {
361
367
  block-size: 100%;
362
368
  max-block-size: 100%;
363
369
  margin-block-end: auto;
364
370
  }
365
371
 
366
- :where([data-ui~="dialog"]) {
372
+ :where([data-ui~="dialog"]:not([data-ui~="drawer"])) {
367
373
  --ui-dialog-border-color: transparent;
368
374
 
369
375
  --_dialog-w: 100dvi;
@@ -378,7 +384,7 @@
378
384
  container: none;
379
385
  }
380
386
 
381
- :where(dialog)::backdrop {
387
+ :where(dialog:not([data-ui~="drawer"]))::backdrop {
382
388
  inline-size: 100dvi;
383
389
  block-size: 100dvb;
384
390
  inset: 0;
@@ -389,7 +395,7 @@
389
395
  }
390
396
 
391
397
  @container style(--ui-dialog-mobile-size: layout-full) {
392
- :where([data-ui~="dialog"]) {
398
+ :where([data-ui~="dialog"]:not([data-ui~="drawer"])) {
393
399
  --_dialog-w: calc(100dvi - var(--gutters) * 2);
394
400
  }
395
401
  }
@@ -0,0 +1,27 @@
1
+ <ui-drawer-indent style="--p: 6">
2
+ <button data-ui="button" type="button" command="show-modal" commandfor="drawer-indent-1">
3
+ Open drawer
4
+ </button>
5
+ </ui-drawer-indent>
6
+ <dialog id="drawer-indent-1" data-ui="drawer" closedby="any">
7
+ <div data-drawer-slot="handle"></div>
8
+ <div data-drawer-slot="content">
9
+ <header data-drawer-slot="header">
10
+ <h2
11
+ style="
12
+ --font-size: var(--font-size-lg);
13
+ --font-weight: strong;
14
+ --font-family: var(--font-family-heading);
15
+ "
16
+ >
17
+ Share this page
18
+ </h2>
19
+ <p style="--text: var(--color-muted-foreground)">
20
+ The page behind steps back while the drawer is open, and follows as you drag it down.
21
+ </p>
22
+ </header>
23
+ <div data-drawer-slot="body">
24
+ <p>Wrap the page in the indent element once; every drawer on the page uses it.</p>
25
+ </div>
26
+ </div>
27
+ </dialog>
@@ -0,0 +1,72 @@
1
+ <button data-ui="button" type="button" command="show-modal" commandfor="drawer-nested-1">
2
+ Open drawer
3
+ </button>
4
+ <dialog id="drawer-nested-1" data-ui="drawer" closedby="any">
5
+ <div data-drawer-slot="handle"></div>
6
+ <div data-drawer-slot="content">
7
+ <header data-drawer-slot="header">
8
+ <h2
9
+ style="
10
+ --font-size: var(--font-size-lg);
11
+ --font-weight: strong;
12
+ --font-family: var(--font-family-heading);
13
+ "
14
+ >
15
+ Your order
16
+ </h2>
17
+ <p style="--text: var(--color-muted-foreground)">
18
+ Open the second drawer: this one steps back behind it.
19
+ </p>
20
+ </header>
21
+ <div data-drawer-slot="body">
22
+ <p>Two items, arriving Thursday.</p>
23
+ </div>
24
+ <footer data-drawer-slot="footer">
25
+ <button data-ui="button" type="button" commandfor="drawer-nested-1" command="close">
26
+ Close
27
+ </button>
28
+ <button
29
+ data-ui="button"
30
+ data-button-variant="primary"
31
+ type="button"
32
+ command="show-modal"
33
+ commandfor="drawer-nested-2"
34
+ >
35
+ Change address
36
+ </button>
37
+ </footer>
38
+ </div>
39
+ </dialog>
40
+ <dialog id="drawer-nested-2" data-ui="drawer" closedby="any">
41
+ <div data-drawer-slot="handle"></div>
42
+ <div data-drawer-slot="content">
43
+ <header data-drawer-slot="header">
44
+ <h2
45
+ style="
46
+ --font-size: var(--font-size-lg);
47
+ --font-weight: strong;
48
+ --font-family: var(--font-family-heading);
49
+ "
50
+ >
51
+ Delivery address
52
+ </h2>
53
+ <p style="--text: var(--color-muted-foreground)">
54
+ Drag this drawer down and the one behind follows it back.
55
+ </p>
56
+ </header>
57
+ <div data-drawer-slot="body">
58
+ <p>14 Harbour Street, Flat 3.</p>
59
+ </div>
60
+ <footer data-drawer-slot="footer">
61
+ <button
62
+ data-ui="button"
63
+ data-button-variant="primary"
64
+ type="button"
65
+ commandfor="drawer-nested-2"
66
+ command="close"
67
+ >
68
+ Done
69
+ </button>
70
+ </footer>
71
+ </div>
72
+ </dialog>
@@ -0,0 +1,44 @@
1
+ <button data-ui="button" type="button" command="show-modal" commandfor="drawer-responsive-dialog-1">
2
+ Open dialog
3
+ </button>
4
+ <dialog id="drawer-responsive-dialog-1" data-ui="dialog drawer" closedby="any">
5
+ <div data-drawer-slot="handle"></div>
6
+ <div data-dialog-slot="content">
7
+ <header data-dialog-slot="header">
8
+ <h2
9
+ style="
10
+ --font-size: var(--font-size-lg);
11
+ --font-weight: strong;
12
+ --font-family: var(--font-family-heading);
13
+ "
14
+ >
15
+ Confirm your order
16
+ </h2>
17
+ <p style="--text: var(--color-muted-foreground)">
18
+ A dialog on a desktop, and a drawer you can swipe away on a phone.
19
+ </p>
20
+ </header>
21
+ <div data-dialog-slot="body">
22
+ <p>The markup is a dialog with its usual slots, plus the drawer identity and a handle.</p>
23
+ </div>
24
+ <footer data-dialog-slot="footer">
25
+ <button
26
+ data-ui="button"
27
+ type="button"
28
+ commandfor="drawer-responsive-dialog-1"
29
+ command="close"
30
+ >
31
+ Cancel
32
+ </button>
33
+ <button
34
+ data-ui="button"
35
+ data-button-variant="primary"
36
+ type="button"
37
+ commandfor="drawer-responsive-dialog-1"
38
+ command="close"
39
+ >
40
+ Confirm
41
+ </button>
42
+ </footer>
43
+ </div>
44
+ </dialog>
@@ -0,0 +1,26 @@
1
+ <button data-ui="button" type="button" command="show-modal" commandfor="drawer-snap-1">
2
+ Open drawer
3
+ </button>
4
+ <dialog id="drawer-snap-1" data-ui="drawer" data-drawer-snap="12rem 0.5 1" closedby="any">
5
+ <button type="button" data-drawer-slot="handle" aria-label="Resize drawer"></button>
6
+ <div data-drawer-slot="content">
7
+ <header data-drawer-slot="header">
8
+ <h2
9
+ style="
10
+ --font-size: var(--font-size-lg);
11
+ --font-weight: strong;
12
+ --font-family: var(--font-family-heading);
13
+ "
14
+ >
15
+ Nearby places
16
+ </h2>
17
+ <p style="--text: var(--color-muted-foreground)">
18
+ Drag up for more, or press the handle to step through the sizes.
19
+ </p>
20
+ </header>
21
+ <div data-drawer-slot="body">
22
+ <p>The drawer rests at three heights. Its content scrolls once it is fully open.</p>
23
+ <p>Flick down from the smallest height to close it.</p>
24
+ </div>
25
+ </div>
26
+ </dialog>