@designa8/vibedesign-monday-com-internal-v1-2-176b 0.0.2 → 0.1.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 +1 -1
- package/dist/index.cjs +76 -52
- package/dist/index.js +76 -52
- package/dist/styles.css +7 -0
- package/package.json +1 -1
- package/src/atoms/Modal/Modal.tsx +87 -40
- package/src/atoms/Modal/preview.tsx +58 -1
- package/src/tokens.css +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-monday-com-internal-v1-2-176b
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.0
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.1.0**.
|
|
4
4
|
Tokens, atoms, molecules, organisms, and templates — import from the package root;
|
|
5
5
|
never hardcode visual values in consumer code.
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -6505,6 +6505,8 @@ var Modal = React55.forwardRef(
|
|
|
6505
6505
|
closeLabel = "Close dialog",
|
|
6506
6506
|
closeOnScrim = true,
|
|
6507
6507
|
bodyClassName,
|
|
6508
|
+
placement = "center",
|
|
6509
|
+
size = "md",
|
|
6508
6510
|
className,
|
|
6509
6511
|
children,
|
|
6510
6512
|
"aria-label": ariaLabel,
|
|
@@ -6546,11 +6548,14 @@ var Modal = React55.forwardRef(
|
|
|
6546
6548
|
};
|
|
6547
6549
|
if (!mounted) return null;
|
|
6548
6550
|
const state = open ? "open" : "closed";
|
|
6551
|
+
const isTop = placement === "top";
|
|
6552
|
+
const hasHeader = Boolean(icon || title || description || !hideClose);
|
|
6549
6553
|
return (0, import_react_dom5.createPortal)(
|
|
6550
6554
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
6551
6555
|
"div",
|
|
6552
6556
|
{
|
|
6553
6557
|
"data-state": state,
|
|
6558
|
+
"data-placement": placement,
|
|
6554
6559
|
"aria-hidden": open ? void 0 : true,
|
|
6555
6560
|
className: "fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none",
|
|
6556
6561
|
style: { zIndex: "var(--z-modal, 1200)" },
|
|
@@ -6564,68 +6569,87 @@ var Modal = React55.forwardRef(
|
|
|
6564
6569
|
className: "fixed inset-0 bg-scrim/40 transition-opacity duration-200 ease-out data-[state=closed]:opacity-0 data-[state=open]:opacity-100"
|
|
6565
6570
|
}
|
|
6566
6571
|
),
|
|
6567
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6572
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6568
6573
|
"div",
|
|
6569
6574
|
{
|
|
6570
|
-
ref:
|
|
6571
|
-
role: "dialog",
|
|
6572
|
-
"aria-modal": "true",
|
|
6573
|
-
"aria-labelledby": title ? titleId : void 0,
|
|
6574
|
-
"aria-label": title ? void 0 : ariaLabel ?? "Dialog",
|
|
6575
|
-
"aria-describedby": description ? descId : void 0,
|
|
6576
|
-
"data-state": state,
|
|
6575
|
+
ref: wrapRef,
|
|
6577
6576
|
className: cn49(
|
|
6578
|
-
"
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
className
|
|
6577
|
+
"fixed inset-0 flex justify-center",
|
|
6578
|
+
isTop ? (
|
|
6579
|
+
// Pinned near the top at every breakpoint — never bottom-aligned.
|
|
6580
|
+
"items-start px-base pt-[12dvh] pb-base"
|
|
6581
|
+
) : "items-end p-base sm:items-center"
|
|
6584
6582
|
),
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6583
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
6584
|
+
"div",
|
|
6585
|
+
{
|
|
6586
|
+
ref: setRefs,
|
|
6587
|
+
role: "dialog",
|
|
6588
|
+
"aria-modal": "true",
|
|
6589
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
6590
|
+
"aria-label": title ? void 0 : ariaLabel ?? "Dialog",
|
|
6591
|
+
"aria-describedby": description ? descId : void 0,
|
|
6592
|
+
"data-state": state,
|
|
6593
|
+
"data-placement": placement,
|
|
6594
|
+
className: cn49(
|
|
6595
|
+
"relative flex max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-lg border border-hairline-soft bg-canvas text-ink shadow-modal",
|
|
6596
|
+
size === "lg" ? "sm:w-[var(--container-palette,40rem)]" : "sm:w-[var(--container-modal,32rem)]",
|
|
6597
|
+
"transition-[transform,translate,scale,opacity,visibility] duration-200 ease-out",
|
|
6598
|
+
"data-[state=open]:visible data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100",
|
|
6599
|
+
isTop ? "data-[state=closed]:-translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0" : "data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0",
|
|
6600
|
+
"data-[state=closed]:invisible",
|
|
6601
|
+
className
|
|
6602
|
+
),
|
|
6603
|
+
...rest,
|
|
6604
|
+
children: [
|
|
6605
|
+
hasHeader ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex shrink-0 items-start justify-between gap-md px-lg pt-lg", children: [
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex min-w-0 flex-col gap-xs", children: [
|
|
6607
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6608
|
+
"span",
|
|
6609
|
+
{
|
|
6610
|
+
"aria-hidden": "true",
|
|
6611
|
+
className: cn49(
|
|
6612
|
+
"mb-xs inline-flex size-12 items-center justify-center rounded-md",
|
|
6613
|
+
tone === "danger" ? "bg-semantic-error-soft text-semantic-error" : "bg-primary-soft text-primary"
|
|
6614
|
+
),
|
|
6615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Icon, { name: icon, size: 26 })
|
|
6616
|
+
}
|
|
6617
|
+
) : null,
|
|
6618
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { id: titleId, className: "text-heading-md text-ink", children: title }) : null,
|
|
6619
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { id: descId, className: "text-body-md text-body", children: description }) : null
|
|
6620
|
+
] }),
|
|
6621
|
+
!hideClose && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6622
|
+
IconButton,
|
|
6623
|
+
{
|
|
6624
|
+
icon: "x",
|
|
6625
|
+
variant: "ghost",
|
|
6626
|
+
size: "sm",
|
|
6627
|
+
"aria-label": closeLabel,
|
|
6628
|
+
onClick: () => onOpenChange(false)
|
|
6629
|
+
}
|
|
6630
|
+
)
|
|
6631
|
+
] }) : null,
|
|
6632
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6633
|
+
"div",
|
|
6591
6634
|
{
|
|
6592
|
-
"aria-hidden": "true",
|
|
6593
6635
|
className: cn49(
|
|
6594
|
-
"
|
|
6595
|
-
|
|
6636
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
6637
|
+
hasHeader ? cn49("px-lg", children ? "pt-base pb-lg" : "pb-base") : bodyClassName ? (
|
|
6638
|
+
// Chromeless panel: the caller owns the body padding (e.g. a palette
|
|
6639
|
+
// that pins its own search row and scrolls only the results).
|
|
6640
|
+
void 0
|
|
6641
|
+
) : "p-lg",
|
|
6642
|
+
bodyClassName
|
|
6596
6643
|
),
|
|
6597
|
-
children
|
|
6644
|
+
children
|
|
6598
6645
|
}
|
|
6599
|
-
) : null,
|
|
6600
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { id: titleId, className: "text-heading-md text-ink", children: title }) : null,
|
|
6601
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { id: descId, className: "text-body-md text-body", children: description }) : null
|
|
6602
|
-
] }),
|
|
6603
|
-
!hideClose && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6604
|
-
IconButton,
|
|
6605
|
-
{
|
|
6606
|
-
icon: "x",
|
|
6607
|
-
variant: "ghost",
|
|
6608
|
-
size: "sm",
|
|
6609
|
-
"aria-label": closeLabel,
|
|
6610
|
-
onClick: () => onOpenChange(false)
|
|
6611
|
-
}
|
|
6612
|
-
)
|
|
6613
|
-
] }),
|
|
6614
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6615
|
-
"div",
|
|
6616
|
-
{
|
|
6617
|
-
className: cn49(
|
|
6618
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg",
|
|
6619
|
-
children ? "pt-base pb-lg" : "pb-base",
|
|
6620
|
-
bodyClassName
|
|
6621
6646
|
),
|
|
6622
|
-
children
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
]
|
|
6647
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { "data-modal-footer": "", className: "flex shrink-0 items-center justify-end gap-sm px-lg pb-lg", children: footer }) : null
|
|
6648
|
+
]
|
|
6649
|
+
}
|
|
6650
|
+
)
|
|
6627
6651
|
}
|
|
6628
|
-
)
|
|
6652
|
+
)
|
|
6629
6653
|
]
|
|
6630
6654
|
}
|
|
6631
6655
|
),
|
package/dist/index.js
CHANGED
|
@@ -6381,6 +6381,8 @@ var Modal = React55.forwardRef(
|
|
|
6381
6381
|
closeLabel = "Close dialog",
|
|
6382
6382
|
closeOnScrim = true,
|
|
6383
6383
|
bodyClassName,
|
|
6384
|
+
placement = "center",
|
|
6385
|
+
size = "md",
|
|
6384
6386
|
className,
|
|
6385
6387
|
children,
|
|
6386
6388
|
"aria-label": ariaLabel,
|
|
@@ -6422,11 +6424,14 @@ var Modal = React55.forwardRef(
|
|
|
6422
6424
|
};
|
|
6423
6425
|
if (!mounted) return null;
|
|
6424
6426
|
const state = open ? "open" : "closed";
|
|
6427
|
+
const isTop = placement === "top";
|
|
6428
|
+
const hasHeader = Boolean(icon || title || description || !hideClose);
|
|
6425
6429
|
return createPortal5(
|
|
6426
6430
|
/* @__PURE__ */ jsxs52(
|
|
6427
6431
|
"div",
|
|
6428
6432
|
{
|
|
6429
6433
|
"data-state": state,
|
|
6434
|
+
"data-placement": placement,
|
|
6430
6435
|
"aria-hidden": open ? void 0 : true,
|
|
6431
6436
|
className: "fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none",
|
|
6432
6437
|
style: { zIndex: "var(--z-modal, 1200)" },
|
|
@@ -6440,68 +6445,87 @@ var Modal = React55.forwardRef(
|
|
|
6440
6445
|
className: "fixed inset-0 bg-scrim/40 transition-opacity duration-200 ease-out data-[state=closed]:opacity-0 data-[state=open]:opacity-100"
|
|
6441
6446
|
}
|
|
6442
6447
|
),
|
|
6443
|
-
/* @__PURE__ */ jsx55(
|
|
6448
|
+
/* @__PURE__ */ jsx55(
|
|
6444
6449
|
"div",
|
|
6445
6450
|
{
|
|
6446
|
-
ref:
|
|
6447
|
-
role: "dialog",
|
|
6448
|
-
"aria-modal": "true",
|
|
6449
|
-
"aria-labelledby": title ? titleId : void 0,
|
|
6450
|
-
"aria-label": title ? void 0 : ariaLabel ?? "Dialog",
|
|
6451
|
-
"aria-describedby": description ? descId : void 0,
|
|
6452
|
-
"data-state": state,
|
|
6451
|
+
ref: wrapRef,
|
|
6453
6452
|
className: cn49(
|
|
6454
|
-
"
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
className
|
|
6453
|
+
"fixed inset-0 flex justify-center",
|
|
6454
|
+
isTop ? (
|
|
6455
|
+
// Pinned near the top at every breakpoint — never bottom-aligned.
|
|
6456
|
+
"items-start px-base pt-[12dvh] pb-base"
|
|
6457
|
+
) : "items-end p-base sm:items-center"
|
|
6460
6458
|
),
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6459
|
+
children: /* @__PURE__ */ jsxs52(
|
|
6460
|
+
"div",
|
|
6461
|
+
{
|
|
6462
|
+
ref: setRefs,
|
|
6463
|
+
role: "dialog",
|
|
6464
|
+
"aria-modal": "true",
|
|
6465
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
6466
|
+
"aria-label": title ? void 0 : ariaLabel ?? "Dialog",
|
|
6467
|
+
"aria-describedby": description ? descId : void 0,
|
|
6468
|
+
"data-state": state,
|
|
6469
|
+
"data-placement": placement,
|
|
6470
|
+
className: cn49(
|
|
6471
|
+
"relative flex max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-lg border border-hairline-soft bg-canvas text-ink shadow-modal",
|
|
6472
|
+
size === "lg" ? "sm:w-[var(--container-palette,40rem)]" : "sm:w-[var(--container-modal,32rem)]",
|
|
6473
|
+
"transition-[transform,translate,scale,opacity,visibility] duration-200 ease-out",
|
|
6474
|
+
"data-[state=open]:visible data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100",
|
|
6475
|
+
isTop ? "data-[state=closed]:-translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0" : "data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0",
|
|
6476
|
+
"data-[state=closed]:invisible",
|
|
6477
|
+
className
|
|
6478
|
+
),
|
|
6479
|
+
...rest,
|
|
6480
|
+
children: [
|
|
6481
|
+
hasHeader ? /* @__PURE__ */ jsxs52("div", { className: "flex shrink-0 items-start justify-between gap-md px-lg pt-lg", children: [
|
|
6482
|
+
/* @__PURE__ */ jsxs52("div", { className: "flex min-w-0 flex-col gap-xs", children: [
|
|
6483
|
+
icon ? /* @__PURE__ */ jsx55(
|
|
6484
|
+
"span",
|
|
6485
|
+
{
|
|
6486
|
+
"aria-hidden": "true",
|
|
6487
|
+
className: cn49(
|
|
6488
|
+
"mb-xs inline-flex size-12 items-center justify-center rounded-md",
|
|
6489
|
+
tone === "danger" ? "bg-semantic-error-soft text-semantic-error" : "bg-primary-soft text-primary"
|
|
6490
|
+
),
|
|
6491
|
+
children: /* @__PURE__ */ jsx55(Icon, { name: icon, size: 26 })
|
|
6492
|
+
}
|
|
6493
|
+
) : null,
|
|
6494
|
+
title ? /* @__PURE__ */ jsx55("h2", { id: titleId, className: "text-heading-md text-ink", children: title }) : null,
|
|
6495
|
+
description ? /* @__PURE__ */ jsx55("p", { id: descId, className: "text-body-md text-body", children: description }) : null
|
|
6496
|
+
] }),
|
|
6497
|
+
!hideClose && /* @__PURE__ */ jsx55(
|
|
6498
|
+
IconButton,
|
|
6499
|
+
{
|
|
6500
|
+
icon: "x",
|
|
6501
|
+
variant: "ghost",
|
|
6502
|
+
size: "sm",
|
|
6503
|
+
"aria-label": closeLabel,
|
|
6504
|
+
onClick: () => onOpenChange(false)
|
|
6505
|
+
}
|
|
6506
|
+
)
|
|
6507
|
+
] }) : null,
|
|
6508
|
+
/* @__PURE__ */ jsx55(
|
|
6509
|
+
"div",
|
|
6467
6510
|
{
|
|
6468
|
-
"aria-hidden": "true",
|
|
6469
6511
|
className: cn49(
|
|
6470
|
-
"
|
|
6471
|
-
|
|
6512
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
6513
|
+
hasHeader ? cn49("px-lg", children ? "pt-base pb-lg" : "pb-base") : bodyClassName ? (
|
|
6514
|
+
// Chromeless panel: the caller owns the body padding (e.g. a palette
|
|
6515
|
+
// that pins its own search row and scrolls only the results).
|
|
6516
|
+
void 0
|
|
6517
|
+
) : "p-lg",
|
|
6518
|
+
bodyClassName
|
|
6472
6519
|
),
|
|
6473
|
-
children
|
|
6520
|
+
children
|
|
6474
6521
|
}
|
|
6475
|
-
) : null,
|
|
6476
|
-
title ? /* @__PURE__ */ jsx55("h2", { id: titleId, className: "text-heading-md text-ink", children: title }) : null,
|
|
6477
|
-
description ? /* @__PURE__ */ jsx55("p", { id: descId, className: "text-body-md text-body", children: description }) : null
|
|
6478
|
-
] }),
|
|
6479
|
-
!hideClose && /* @__PURE__ */ jsx55(
|
|
6480
|
-
IconButton,
|
|
6481
|
-
{
|
|
6482
|
-
icon: "x",
|
|
6483
|
-
variant: "ghost",
|
|
6484
|
-
size: "sm",
|
|
6485
|
-
"aria-label": closeLabel,
|
|
6486
|
-
onClick: () => onOpenChange(false)
|
|
6487
|
-
}
|
|
6488
|
-
)
|
|
6489
|
-
] }),
|
|
6490
|
-
/* @__PURE__ */ jsx55(
|
|
6491
|
-
"div",
|
|
6492
|
-
{
|
|
6493
|
-
className: cn49(
|
|
6494
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg",
|
|
6495
|
-
children ? "pt-base pb-lg" : "pb-base",
|
|
6496
|
-
bodyClassName
|
|
6497
6522
|
),
|
|
6498
|
-
children
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
]
|
|
6523
|
+
footer ? /* @__PURE__ */ jsx55("div", { "data-modal-footer": "", className: "flex shrink-0 items-center justify-end gap-sm px-lg pb-lg", children: footer }) : null
|
|
6524
|
+
]
|
|
6525
|
+
}
|
|
6526
|
+
)
|
|
6503
6527
|
}
|
|
6504
|
-
)
|
|
6528
|
+
)
|
|
6505
6529
|
]
|
|
6506
6530
|
}
|
|
6507
6531
|
),
|
package/dist/styles.css
CHANGED
|
@@ -139,6 +139,7 @@
|
|
|
139
139
|
--spacing-gutter: 24px;
|
|
140
140
|
--container-drawer: 28rem;
|
|
141
141
|
--container-modal: 32rem;
|
|
142
|
+
--container-palette: 40rem;
|
|
142
143
|
--grid-template-columns-system: repeat(12, minmax(0, 1fr));
|
|
143
144
|
}
|
|
144
145
|
}
|
|
@@ -319,6 +320,9 @@
|
|
|
319
320
|
.relative {
|
|
320
321
|
position: relative;
|
|
321
322
|
}
|
|
323
|
+
.sticky {
|
|
324
|
+
position: sticky;
|
|
325
|
+
}
|
|
322
326
|
.inset-0 {
|
|
323
327
|
inset: 0;
|
|
324
328
|
}
|
|
@@ -334,6 +338,9 @@
|
|
|
334
338
|
.-top-lg {
|
|
335
339
|
top: calc(var(--spacing-lg) * -1);
|
|
336
340
|
}
|
|
341
|
+
.top-0 {
|
|
342
|
+
top: 0;
|
|
343
|
+
}
|
|
337
344
|
.top-1\/2 {
|
|
338
345
|
top: calc(1 / 2 * 100%);
|
|
339
346
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designa8/vibedesign-monday-com-internal-v1-2-176b",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Complete design system \"My Project monday.com-internal-v1\" generated by Atoms Design.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -5,6 +5,12 @@ import { Icon, type IconName } from "../Icon";
|
|
|
5
5
|
|
|
6
6
|
export type ModalTone = "default" | "danger";
|
|
7
7
|
|
|
8
|
+
/** `center` is the classic dialog. `top` pins the panel near the top of the viewport (command palette). */
|
|
9
|
+
export type ModalPlacement = "center" | "top";
|
|
10
|
+
|
|
11
|
+
/** `md` is the standard dialog width, `lg` the wider palette width. */
|
|
12
|
+
export type ModalSize = "md" | "lg";
|
|
13
|
+
|
|
8
14
|
export interface ModalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
9
15
|
/** Controlled open state. */
|
|
10
16
|
open: boolean;
|
|
@@ -29,6 +35,16 @@ export interface ModalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "
|
|
|
29
35
|
closeOnScrim?: boolean;
|
|
30
36
|
/** Extra classes for the scrolling body. */
|
|
31
37
|
bodyClassName?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Vertical anchoring of the panel. `center` (default) is a classic dialog;
|
|
40
|
+
* `top` sits about 12vh from the top at every breakpoint, for a command palette.
|
|
41
|
+
*/
|
|
42
|
+
placement?: ModalPlacement;
|
|
43
|
+
/**
|
|
44
|
+
* Panel width. `md` (default) is the standard dialog width; `lg` uses the wider
|
|
45
|
+
* palette width from `sm` up (full width below `sm`).
|
|
46
|
+
*/
|
|
47
|
+
size?: ModalSize;
|
|
32
48
|
}
|
|
33
49
|
|
|
34
50
|
const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
@@ -48,6 +64,8 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
48
64
|
closeLabel = "Close dialog",
|
|
49
65
|
closeOnScrim = true,
|
|
50
66
|
bodyClassName,
|
|
67
|
+
placement = "center",
|
|
68
|
+
size = "md",
|
|
51
69
|
className,
|
|
52
70
|
children,
|
|
53
71
|
"aria-label": ariaLabel,
|
|
@@ -100,10 +118,16 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
100
118
|
|
|
101
119
|
if (!mounted) return null;
|
|
102
120
|
const state = open ? "open" : "closed";
|
|
121
|
+
const isTop = placement === "top";
|
|
122
|
+
|
|
123
|
+
// A header row is only rendered when it actually has something in it, so a
|
|
124
|
+
// chromeless panel (palette body, media) starts flush at the top edge.
|
|
125
|
+
const hasHeader = Boolean(icon || title || description || !hideClose);
|
|
103
126
|
|
|
104
127
|
return createPortal(
|
|
105
128
|
<div
|
|
106
129
|
data-state={state}
|
|
130
|
+
data-placement={placement}
|
|
107
131
|
aria-hidden={open ? undefined : true}
|
|
108
132
|
className="fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none"
|
|
109
133
|
style={{ zIndex: "var(--z-modal, 1200)" }}
|
|
@@ -114,7 +138,16 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
114
138
|
data-state={state}
|
|
115
139
|
className="fixed inset-0 bg-scrim/40 transition-opacity duration-200 ease-out data-[state=closed]:opacity-0 data-[state=open]:opacity-100"
|
|
116
140
|
/>
|
|
117
|
-
<div
|
|
141
|
+
<div
|
|
142
|
+
ref={wrapRef}
|
|
143
|
+
className={cn(
|
|
144
|
+
"fixed inset-0 flex justify-center",
|
|
145
|
+
isTop
|
|
146
|
+
? // Pinned near the top at every breakpoint — never bottom-aligned.
|
|
147
|
+
"items-start px-base pt-[12dvh] pb-base"
|
|
148
|
+
: "items-end p-base sm:items-center",
|
|
149
|
+
)}
|
|
150
|
+
>
|
|
118
151
|
<div
|
|
119
152
|
ref={setRefs}
|
|
120
153
|
role="dialog"
|
|
@@ -123,56 +156,70 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
123
156
|
aria-label={title ? undefined : ariaLabel ?? "Dialog"}
|
|
124
157
|
aria-describedby={description ? descId : undefined}
|
|
125
158
|
data-state={state}
|
|
159
|
+
data-placement={placement}
|
|
126
160
|
className={cn(
|
|
127
161
|
"relative flex max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-lg border border-hairline-soft bg-canvas text-ink shadow-modal",
|
|
128
|
-
"
|
|
162
|
+
size === "lg"
|
|
163
|
+
? "sm:w-[var(--container-palette,40rem)]"
|
|
164
|
+
: "sm:w-[var(--container-modal,32rem)]",
|
|
129
165
|
"transition-[transform,translate,scale,opacity,visibility] duration-200 ease-out",
|
|
130
166
|
"data-[state=open]:visible data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100",
|
|
131
|
-
|
|
167
|
+
isTop
|
|
168
|
+
? "data-[state=closed]:-translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0"
|
|
169
|
+
: "data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0",
|
|
170
|
+
"data-[state=closed]:invisible",
|
|
132
171
|
className,
|
|
133
172
|
)}
|
|
134
173
|
{...rest}
|
|
135
174
|
>
|
|
136
|
-
|
|
137
|
-
<div className="flex
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
{hasHeader ? (
|
|
176
|
+
<div className="flex shrink-0 items-start justify-between gap-md px-lg pt-lg">
|
|
177
|
+
<div className="flex min-w-0 flex-col gap-xs">
|
|
178
|
+
{icon ? (
|
|
179
|
+
<span
|
|
180
|
+
aria-hidden="true"
|
|
181
|
+
className={cn(
|
|
182
|
+
"mb-xs inline-flex size-12 items-center justify-center rounded-md",
|
|
183
|
+
tone === "danger"
|
|
184
|
+
? "bg-semantic-error-soft text-semantic-error"
|
|
185
|
+
: "bg-primary-soft text-primary",
|
|
186
|
+
)}
|
|
187
|
+
>
|
|
188
|
+
<Icon name={icon} size={26} />
|
|
189
|
+
</span>
|
|
190
|
+
) : null}
|
|
191
|
+
{title ? (
|
|
192
|
+
<h2 id={titleId} className="text-heading-md text-ink">
|
|
193
|
+
{title}
|
|
194
|
+
</h2>
|
|
195
|
+
) : null}
|
|
196
|
+
{description ? (
|
|
197
|
+
<p id={descId} className="text-body-md text-body">
|
|
198
|
+
{description}
|
|
199
|
+
</p>
|
|
200
|
+
) : null}
|
|
201
|
+
</div>
|
|
202
|
+
{!hideClose && (
|
|
203
|
+
<IconButton
|
|
204
|
+
icon="x"
|
|
205
|
+
variant="ghost"
|
|
206
|
+
size="sm"
|
|
207
|
+
aria-label={closeLabel}
|
|
208
|
+
onClick={() => onOpenChange(false)}
|
|
209
|
+
/>
|
|
210
|
+
)}
|
|
161
211
|
</div>
|
|
162
|
-
|
|
163
|
-
<IconButton
|
|
164
|
-
icon="x"
|
|
165
|
-
variant="ghost"
|
|
166
|
-
size="sm"
|
|
167
|
-
aria-label={closeLabel}
|
|
168
|
-
onClick={() => onOpenChange(false)}
|
|
169
|
-
/>
|
|
170
|
-
)}
|
|
171
|
-
</div>
|
|
212
|
+
) : null}
|
|
172
213
|
<div
|
|
173
214
|
className={cn(
|
|
174
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain
|
|
175
|
-
|
|
215
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
216
|
+
hasHeader
|
|
217
|
+
? cn("px-lg", children ? "pt-base pb-lg" : "pb-base")
|
|
218
|
+
: bodyClassName
|
|
219
|
+
? // Chromeless panel: the caller owns the body padding (e.g. a palette
|
|
220
|
+
// that pins its own search row and scrolls only the results).
|
|
221
|
+
undefined
|
|
222
|
+
: "p-lg",
|
|
176
223
|
bodyClassName,
|
|
177
224
|
)}
|
|
178
225
|
>
|
|
@@ -12,18 +12,32 @@ const TEMPLATES = [
|
|
|
12
12
|
{ value: "content-pipeline", label: "Content pipeline" },
|
|
13
13
|
];
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const COMMANDS = [
|
|
16
|
+
"New board",
|
|
17
|
+
"New workflow",
|
|
18
|
+
"Invite teammates",
|
|
19
|
+
"Open settings",
|
|
20
|
+
"Search the archive",
|
|
21
|
+
"Toggle dark mode",
|
|
22
|
+
"Export as CSV",
|
|
23
|
+
"Manage notifications",
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
type Which = "plan" | "form" | "delete" | "palette" | null;
|
|
16
27
|
|
|
17
28
|
export default function ModalPreview() {
|
|
18
29
|
const [which, setWhich] = React.useState<Which>(null);
|
|
19
30
|
const [name, setName] = React.useState("Marketing campaign");
|
|
20
31
|
const [template, setTemplate] = React.useState<string>("marketing-calendar");
|
|
32
|
+
const [query, setQuery] = React.useState("");
|
|
21
33
|
const [last, setLast] = React.useState("Nothing confirmed yet.");
|
|
22
34
|
const close = (o: boolean) => {
|
|
23
35
|
if (!o) setWhich(null);
|
|
24
36
|
};
|
|
25
37
|
const templateLabelId = React.useId();
|
|
26
38
|
|
|
39
|
+
const results = COMMANDS.filter((c) => c.toLowerCase().includes(query.trim().toLowerCase()));
|
|
40
|
+
|
|
27
41
|
return (
|
|
28
42
|
<div className="w-full max-w-3xl mx-auto p-lg">
|
|
29
43
|
<div className="flex w-full flex-col items-center gap-base rounded-lg border border-hairline-soft bg-canvas p-xl shadow-card">
|
|
@@ -37,6 +51,9 @@ export default function ModalPreview() {
|
|
|
37
51
|
<Button variant="danger" aria-haspopup="dialog" onClick={() => setWhich("delete")}>
|
|
38
52
|
Delete board
|
|
39
53
|
</Button>
|
|
54
|
+
<Button variant="neutral" aria-haspopup="dialog" onClick={() => setWhich("palette")}>
|
|
55
|
+
Command palette
|
|
56
|
+
</Button>
|
|
40
57
|
</div>
|
|
41
58
|
<p className="text-body-sm text-muted" aria-live="polite">
|
|
42
59
|
{last}
|
|
@@ -126,6 +143,46 @@ export default function ModalPreview() {
|
|
|
126
143
|
</>
|
|
127
144
|
}
|
|
128
145
|
/>
|
|
146
|
+
|
|
147
|
+
{/* Top-anchored, wide, header-less panel: search pinned at the top, only the list scrolls. */}
|
|
148
|
+
<Modal
|
|
149
|
+
open={which === "palette"}
|
|
150
|
+
onOpenChange={close}
|
|
151
|
+
placement="top"
|
|
152
|
+
size="lg"
|
|
153
|
+
hideClose
|
|
154
|
+
aria-label="Command palette"
|
|
155
|
+
bodyClassName="p-0"
|
|
156
|
+
>
|
|
157
|
+
<div className="sticky top-0 z-10 flex shrink-0 flex-col gap-xs border-b border-hairline-soft bg-canvas px-lg py-base">
|
|
158
|
+
<FormField
|
|
159
|
+
label="Search commands"
|
|
160
|
+
placeholder="Type a command…"
|
|
161
|
+
value={query}
|
|
162
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
<ul className="flex flex-col p-xs">
|
|
166
|
+
{results.length === 0 ? (
|
|
167
|
+
<li className="px-md py-base text-body-sm text-muted">No matching commands.</li>
|
|
168
|
+
) : (
|
|
169
|
+
results.map((cmd) => (
|
|
170
|
+
<li key={cmd}>
|
|
171
|
+
<Button
|
|
172
|
+
variant="ghost"
|
|
173
|
+
className="w-full justify-start"
|
|
174
|
+
onClick={() => {
|
|
175
|
+
setLast(`Ran “${cmd}”.`);
|
|
176
|
+
setWhich(null);
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
{cmd}
|
|
180
|
+
</Button>
|
|
181
|
+
</li>
|
|
182
|
+
))
|
|
183
|
+
)}
|
|
184
|
+
</ul>
|
|
185
|
+
</Modal>
|
|
129
186
|
</div>
|
|
130
187
|
);
|
|
131
188
|
}
|
package/src/tokens.css
CHANGED