@plastic-js/tsumiki 0.1.38 → 0.1.39
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/dist/components/Dialog.js +10 -10
- package/docs/api.md +7 -3
- package/package.json +1 -1
|
@@ -5,9 +5,11 @@ import { css, keyframes } from "@emotion/css";
|
|
|
5
5
|
import { Dialog } from "@plastic-js/ark";
|
|
6
6
|
import { mergeProps as mergeProps$2, splitProps } from "@plastic-js/plastic";
|
|
7
7
|
//#region src/components/Dialog.jsx
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
8
|
+
var _tmpl6 = template("<div data-scope=\"dialog\" data-part=\"footer\"></div>");
|
|
9
|
+
var _tmpl5 = template("<div data-scope=\"dialog\" data-part=\"body\"></div>");
|
|
10
|
+
var _tmpl4 = template("<div data-scope=\"dialog\" data-part=\"header\"><div><!><!></div><!></div>");
|
|
11
|
+
var _tmpl3 = template("<button data-part=\"positive-trigger\" type=\"button\"></button>");
|
|
12
|
+
var _tmpl2 = template("<button data-part=\"negative-trigger\" type=\"button\"></button>");
|
|
11
13
|
var _tmpl = template("<div><!><!></div>");
|
|
12
14
|
var backdropModalClass = css({
|
|
13
15
|
position: "fixed",
|
|
@@ -63,7 +65,6 @@ var contentModalClass = css({
|
|
|
63
65
|
flexDirection: "column",
|
|
64
66
|
color: "var(--tsu-fg)",
|
|
65
67
|
boxShadow: "var(--tsu-shadow-lg)",
|
|
66
|
-
overflowY: "auto",
|
|
67
68
|
animation: `${modalContentIn} 200ms ease`
|
|
68
69
|
});
|
|
69
70
|
var contentSheetClass = css({
|
|
@@ -75,7 +76,6 @@ var contentSheetClass = css({
|
|
|
75
76
|
flexDirection: "column",
|
|
76
77
|
color: "var(--tsu-fg)",
|
|
77
78
|
boxShadow: "var(--tsu-shadow-lg)",
|
|
78
|
-
overflowY: "auto",
|
|
79
79
|
animation: `${sheetContentIn} 250ms ease`
|
|
80
80
|
});
|
|
81
81
|
var headerClass = css({
|
|
@@ -126,7 +126,7 @@ var bodySheetNoHeaderClass = css({ paddingTop: "calc(var(--tsu-container-padding
|
|
|
126
126
|
var footerClass = css({
|
|
127
127
|
display: "flex",
|
|
128
128
|
gap: "var(--tsu-spacing-md)",
|
|
129
|
-
padding: "
|
|
129
|
+
padding: "var(--tsu-spacing-lg) var(--tsu-container-padding-lg) var(--tsu-container-padding-lg)",
|
|
130
130
|
flexShrink: 0
|
|
131
131
|
});
|
|
132
132
|
var footerBtnClass = css({
|
|
@@ -240,7 +240,7 @@ var Dialog$1 = (props) => {
|
|
|
240
240
|
return _el0;
|
|
241
241
|
}), _el1);
|
|
242
242
|
insert(_el0, () => local.showConfirm && (() => {
|
|
243
|
-
const _el0 =
|
|
243
|
+
const _el0 = _tmpl3.cloneNode(true);
|
|
244
244
|
insert(_el0, () => read(local.loading) ? "Loading…" : local.confirmText);
|
|
245
245
|
setProp(_el0, "className", () => `${btnClass} ${local.danger ? btnDangerClass : btnPrimaryClass}`);
|
|
246
246
|
setProp(_el0, "disabled", () => read(local.loading));
|
|
@@ -281,7 +281,7 @@ var Dialog$1 = (props) => {
|
|
|
281
281
|
},
|
|
282
282
|
children: [
|
|
283
283
|
() => hasHeader && (() => {
|
|
284
|
-
const _el0 =
|
|
284
|
+
const _el0 = _tmpl4.cloneNode(true);
|
|
285
285
|
const _el1 = _el0.firstChild;
|
|
286
286
|
const _el2 = _el1.firstChild;
|
|
287
287
|
const _el3 = _el1.firstChild.nextSibling;
|
|
@@ -310,13 +310,13 @@ var Dialog$1 = (props) => {
|
|
|
310
310
|
return _el0;
|
|
311
311
|
}),
|
|
312
312
|
() => {
|
|
313
|
-
const _el0 =
|
|
313
|
+
const _el0 = _tmpl5.cloneNode(true);
|
|
314
314
|
insert(_el0, () => local.children);
|
|
315
315
|
setProp(_el0, "className", () => isSheet && !local.title && !(local.closeable ?? true) ? `${bodyClass} ${bodySheetNoHeaderClass}` : bodyClass);
|
|
316
316
|
return _el0;
|
|
317
317
|
},
|
|
318
318
|
() => hasFooter && (() => {
|
|
319
|
-
const _el0 =
|
|
319
|
+
const _el0 = _tmpl6.cloneNode(true);
|
|
320
320
|
insert(_el0, () => footerContent);
|
|
321
321
|
setProp(_el0, "className", () => footerClass);
|
|
322
322
|
return _el0;
|
package/docs/api.md
CHANGED
|
@@ -639,16 +639,17 @@ Passthrough: Ark `Root` props (`value`, `min`, `max`, …).
|
|
|
639
639
|
|
|
640
640
|
**Exports:** `Dialog` · Escape hatch: `Dialog.origin.{Root, Trigger, Backdrop, Positioner, Content, Title, Description, CloseTrigger}`
|
|
641
641
|
|
|
642
|
+
**Rendered DOM parts:** content is `[data-scope="dialog"][data-part="content"]`; tsumiki adds `data-part="header"`, `data-part="body"`, `data-part="footer"`, and the action buttons `data-part="negative-trigger"` / `data-part="positive-trigger"`. `title`, `description`, and `closeTrigger` carry `data-part` from Ark.
|
|
643
|
+
|
|
642
644
|
| Prop | Type | Default | Description |
|
|
643
645
|
|---|---|---|---|
|
|
644
|
-
| `mode` | `string` | `'
|
|
646
|
+
| `mode` | `string` | `'sheet'` | `'modal'` (centered) or `'sheet'` (bottom sheet). |
|
|
645
647
|
| `open` | `boolean \| (() => boolean)` | — | **Required** controlled open state. |
|
|
646
|
-
| `onOpenChange` | `(
|
|
648
|
+
| `onOpenChange` | `(open: boolean) => void` | — | Fired on every open/close with the new `open` boolean; sync your state here. |
|
|
647
649
|
| `onOpen` | `() => void` | — | Fired when opened. |
|
|
648
650
|
| `onClose` | `() => void` | — | Fired when closed. |
|
|
649
651
|
| `title` | `string` | — | Dialog title. |
|
|
650
652
|
| `icon` | `node` | — | Optional icon above the title. |
|
|
651
|
-
| `message` | `string` | — | Body text. |
|
|
652
653
|
| `showCancel` | `boolean` | `true` | Show the cancel button. |
|
|
653
654
|
| `showConfirm` | `boolean` | `true` | Show the confirm button. |
|
|
654
655
|
| `cancelText` | `string` | `'Cancel'` | Cancel button label. |
|
|
@@ -665,6 +666,9 @@ Passthrough: Ark `Root` props (`value`, `min`, `max`, …).
|
|
|
665
666
|
| `class` | `string` | — | Content class. |
|
|
666
667
|
| `children` | `node` | — | Custom body content. |
|
|
667
668
|
|
|
669
|
+
**Known issues:**
|
|
670
|
+
- Pressing <kbd>Escape</kbd> closes both the Dialog and any nested overlay (e.g. `DateInput`, `Select`) that is open inside it. There is currently no event coordination between the two — both react to the same key press.
|
|
671
|
+
|
|
668
672
|
### ConfirmDialog
|
|
669
673
|
|
|
670
674
|
Imperative + declarative confirm dialog built on `Dialog`.
|