@tapestry-ui/modal 0.1.0 → 0.2.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A WCAG 2.1 AA modal panel for **Preact**, built on the native
4
4
  `<dialog>` element. Pinned title, pinned header, **one scrollable
5
- middle**, pinned footer — [@tapestry-ui/drawer](https://www.npmjs.com/package/@tapestry-ui/drawer)'s
5
+ middle**, pinned footer — [@tapestry-ui/accordion](https://www.npmjs.com/package/@tapestry-ui/accordion)'s
6
6
  container contract shipped as a component instead of a README warning.
7
7
 
8
8
  ```sh
@@ -23,7 +23,7 @@ const [open, setOpen] = useState(false);
23
23
  footer="I closes the bundle" /* pinned below it */
24
24
  >
25
25
  <TokenList /> {/* THE scrollable middle */}
26
- <Drawer summary="SOUND">…</Drawer>
26
+ <Disclosure summary="SOUND">…</Disclosure>
27
27
  </Modal>
28
28
  ```
29
29
 
package/dist/modal.js CHANGED
@@ -65,7 +65,7 @@ export function Modal(props) {
65
65
  };
66
66
  if (!props.open)
67
67
  return null;
68
- return (_jsxs("dialog", { ref: dialogRef, id: id, class: cx('tui-modal', props.class), "data-part": "root", "data-modal": modal ? '' : undefined, "aria-labelledby": props.title != null ? titleId : undefined, "aria-label": props.title == null ? props.label : undefined, onCancel: onCancel, onClick: onBackdropClick, children: [props.showClose !== false && (_jsx("button", { type: "button", class: cx('tui-modal-close', props.closeClass), "data-part": "close", "aria-label": props.closeLabel ?? 'Close', onClick: () => props.onClose(), children: "\u00D7" })), props.title != null && (_jsx("div", { id: titleId, class: cx('tui-modal-title', props.titleClass), "data-part": "title", children: props.title })), props.header != null && (_jsx("div", { class: cx('tui-modal-header', props.headerClass), "data-part": "header", children: props.header })), _jsx("div", { class: cx('tui-modal-content', props.contentClass), "data-part": "content", children: props.children }), props.footer != null && (_jsx("footer", { class: cx('tui-modal-footer', props.footerClass), "data-part": "footer", children: props.footer }))] }));
68
+ return (_jsxs("dialog", { ref: dialogRef, id: id, class: cx('tui-modal', props.class), "data-part": "root", "data-modal": modal ? '' : undefined, "aria-labelledby": props.title != null ? titleId : undefined, "aria-label": props.title == null ? props.label : undefined, onCancel: onCancel, onClick: onBackdropClick, children: [props.showClose !== false && (_jsx("button", { type: "button", class: cx('tui-modal__close', props.closeClass), "data-part": "close", "aria-label": props.closeLabel ?? 'Close', onClick: () => props.onClose(), children: "\u00D7" })), props.title != null && (_jsx("div", { id: titleId, class: cx('tui-modal__title', props.titleClass), "data-part": "title", children: props.title })), props.header != null && (_jsx("div", { class: cx('tui-modal__header', props.headerClass), "data-part": "header", children: props.header })), _jsx("div", { class: cx('tui-modal__content', props.contentClass), "data-part": "content", children: props.children }), props.footer != null && (_jsx("footer", { class: cx('tui-modal__footer', props.footerClass), "data-part": "footer", children: props.footer }))] }));
69
69
  }
70
70
  function cx(...parts) {
71
71
  return parts.filter(Boolean).join(' ');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tapestry-ui/modal",
3
- "version": "0.1.0",
4
- "description": "A WCAG 2.1 AA modal panel for Preact on the native <dialog> element — pinned header, ONE scrollable middle, pinned footer. The drawer's container contract, shipped as a component instead of a README warning.",
3
+ "version": "0.2.0",
4
+ "description": "A WCAG 2.1 AA modal panel for Preact on the native <dialog> element \u2014 pinned header, ONE scrollable middle, pinned footer. The drawer's container contract, shipped as a component instead of a README warning.",
5
5
  "license": "MIT",
6
6
  "author": "Brandon Minton",
7
7
  "type": "module",
@@ -15,6 +15,9 @@
15
15
  },
16
16
  "./styles.css": "./styles.css"
17
17
  },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
18
21
  "files": [
19
22
  "dist",
20
23
  "styles.css",
package/styles.css CHANGED
@@ -4,7 +4,7 @@
4
4
  (the dialog's UA background is the browser's, not ours).
5
5
 
6
6
  THE SKELETON IS THE POINT: title, header and footer are pinned;
7
- .tui-modal-content is the ONE region that grows and scrolls. That
7
+ .tui-modal__content is the ONE region that grows and scrolls. That
8
8
  flex/min-height/overflow trio is the container contract the drawer's
9
9
  README warns about — here it is load-bearing, not advice. */
10
10
  .tui-modal {
@@ -20,13 +20,13 @@
20
20
  .tui-modal::backdrop {
21
21
  background: var(--tui-modal-backdrop, rgba(0, 0, 0, 0.4));
22
22
  }
23
- .tui-modal-content {
23
+ .tui-modal__content {
24
24
  flex: 1 1 auto; /* the ONE scrollable middle… */
25
25
  min-height: 0; /* …allowed to actually shrink… */
26
26
  overflow-y: auto; /* …owns ALL the growth. THE CONTRACT. */
27
27
  overscroll-behavior: contain;
28
28
  }
29
- .tui-modal-close {
29
+ .tui-modal__close {
30
30
  position: absolute;
31
31
  top: var(--tui-modal-close-inset, 0.4em);
32
32
  right: var(--tui-modal-close-inset, 0.4em);
@@ -42,12 +42,12 @@
42
42
  opacity: 0.7;
43
43
  line-height: 1;
44
44
  }
45
- .tui-modal-close:hover { opacity: 1; }
46
- .tui-modal-close:focus-visible,
45
+ .tui-modal__close:hover { opacity: 1; }
46
+ .tui-modal__close:focus-visible,
47
47
  .tui-modal :focus-visible {
48
48
  outline: var(--tui-modal-focus, 2px solid currentColor);
49
49
  outline-offset: 2px;
50
50
  }
51
- .tui-modal-footer { flex: none; }
52
- .tui-modal-title,
53
- .tui-modal-header { flex: none; }
51
+ .tui-modal__footer { flex: none; }
52
+ .tui-modal__title,
53
+ .tui-modal__header { flex: none; }