@plastic-js/tsumiki 0.1.37 → 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/DateInput.js +4 -3
- package/dist/components/Dialog.js +11 -12
- package/docs/api.md +7 -3
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Portal_default from "./Portal.js";
|
|
1
2
|
import Icon from "./Icon.js";
|
|
2
3
|
import { expandCircular, makeWheel } from "./DateWheel.js";
|
|
3
4
|
import { Fragment, insert, jsx, mergeProps, setProp, template } from "@plastic-js/plastic/jsx-runtime";
|
|
@@ -100,7 +101,7 @@ var calendarIconClass = css({
|
|
|
100
101
|
var overlayClass = css({
|
|
101
102
|
position: "fixed",
|
|
102
103
|
inset: 0,
|
|
103
|
-
zIndex:
|
|
104
|
+
zIndex: 1400,
|
|
104
105
|
display: "flex",
|
|
105
106
|
flexDirection: "column",
|
|
106
107
|
justifyContent: "flex-end",
|
|
@@ -322,7 +323,7 @@ var DateInput = (props = {}) => {
|
|
|
322
323
|
const monthWheel = makeWheel(monthItems, monthStartIdx, true);
|
|
323
324
|
const [dayItemsArr, dayStartIdx] = expandCircular(days, selDay - 1);
|
|
324
325
|
const dayWheel = makeWheel(dayItemsArr, dayStartIdx, true);
|
|
325
|
-
return () => {
|
|
326
|
+
return jsx(Portal_default, mergeProps({ children: () => {
|
|
326
327
|
const _el0 = _tmpl3.cloneNode(true);
|
|
327
328
|
const _el1 = _el0.firstChild;
|
|
328
329
|
const _el2 = _el0.firstChild.nextSibling;
|
|
@@ -432,7 +433,7 @@ var DateInput = (props = {}) => {
|
|
|
432
433
|
setProp(_el2, "className", () => sheetClass);
|
|
433
434
|
setProp(_el0, "className", () => `${overlayClass} ${openClass}`);
|
|
434
435
|
return _el0;
|
|
435
|
-
};
|
|
436
|
+
} }));
|
|
436
437
|
}] });
|
|
437
438
|
};
|
|
438
439
|
//#endregion
|
|
@@ -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({
|
|
@@ -137,8 +137,7 @@ var footerBtnClass = css({
|
|
|
137
137
|
"&.tsu-dialog-footer--center": { justifyContent: "center" }
|
|
138
138
|
});
|
|
139
139
|
var btnClass = css({
|
|
140
|
-
flex:
|
|
141
|
-
whiteSpace: "nowrap",
|
|
140
|
+
flex: 1,
|
|
142
141
|
height: "var(--tsu-comp-height-xl)",
|
|
143
142
|
borderRadius: "var(--tsu-radius-l1-lg)",
|
|
144
143
|
border: "1px solid var(--tsu-neutral-7)",
|
|
@@ -241,7 +240,7 @@ var Dialog$1 = (props) => {
|
|
|
241
240
|
return _el0;
|
|
242
241
|
}), _el1);
|
|
243
242
|
insert(_el0, () => local.showConfirm && (() => {
|
|
244
|
-
const _el0 =
|
|
243
|
+
const _el0 = _tmpl3.cloneNode(true);
|
|
245
244
|
insert(_el0, () => read(local.loading) ? "Loading…" : local.confirmText);
|
|
246
245
|
setProp(_el0, "className", () => `${btnClass} ${local.danger ? btnDangerClass : btnPrimaryClass}`);
|
|
247
246
|
setProp(_el0, "disabled", () => read(local.loading));
|
|
@@ -282,7 +281,7 @@ var Dialog$1 = (props) => {
|
|
|
282
281
|
},
|
|
283
282
|
children: [
|
|
284
283
|
() => hasHeader && (() => {
|
|
285
|
-
const _el0 =
|
|
284
|
+
const _el0 = _tmpl4.cloneNode(true);
|
|
286
285
|
const _el1 = _el0.firstChild;
|
|
287
286
|
const _el2 = _el1.firstChild;
|
|
288
287
|
const _el3 = _el1.firstChild.nextSibling;
|
|
@@ -311,13 +310,13 @@ var Dialog$1 = (props) => {
|
|
|
311
310
|
return _el0;
|
|
312
311
|
}),
|
|
313
312
|
() => {
|
|
314
|
-
const _el0 =
|
|
313
|
+
const _el0 = _tmpl5.cloneNode(true);
|
|
315
314
|
insert(_el0, () => local.children);
|
|
316
315
|
setProp(_el0, "className", () => isSheet && !local.title && !(local.closeable ?? true) ? `${bodyClass} ${bodySheetNoHeaderClass}` : bodyClass);
|
|
317
316
|
return _el0;
|
|
318
317
|
},
|
|
319
318
|
() => hasFooter && (() => {
|
|
320
|
-
const _el0 =
|
|
319
|
+
const _el0 = _tmpl6.cloneNode(true);
|
|
321
320
|
insert(_el0, () => footerContent);
|
|
322
321
|
setProp(_el0, "className", () => footerClass);
|
|
323
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`.
|