@tonycodes-ui/mortar 0.25.0 → 0.26.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/CHANGELOG.md +3 -2
- package/DESIGN.md +1 -1
- package/catalog.json +368 -356
- package/cli/audit.mjs +276 -1
- package/dist/agent-data.json +1 -1
- package/dist/foundation.d.ts +4 -1
- package/dist/foundation.js +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/internal.d.ts +23 -3
- package/dist/internal.js +74 -4
- package/dist/primitives.d.ts +7 -1
- package/dist/primitives.js +7 -2
- package/dist/workspace.d.ts +7 -1
- package/dist/workspace.js +8 -2
- package/docs/agents.md +2 -1
- package/docs/theming.md +1 -1
- package/package.json +1 -1
- package/src/foundation.tsx +13 -2
- package/src/index.ts +1 -0
- package/src/internal.tsx +135 -2
- package/src/overlays.css +23 -0
- package/src/primitives.tsx +48 -13
- package/src/workspace.tsx +57 -18
package/src/primitives.tsx
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
rovingIndex,
|
|
40
40
|
useDomId,
|
|
41
41
|
useField,
|
|
42
|
+
type OverlayPortal,
|
|
42
43
|
} from "./internal.js";
|
|
43
44
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
44
45
|
/** accent: the brand's accent fill (its accent gradient when it defines one) with on-accent text. */
|
|
@@ -761,6 +762,7 @@ export function Modal({
|
|
|
761
762
|
actions,
|
|
762
763
|
size = "md",
|
|
763
764
|
className,
|
|
765
|
+
portal = "document",
|
|
764
766
|
}: {
|
|
765
767
|
open: boolean;
|
|
766
768
|
onClose: () => void;
|
|
@@ -771,24 +773,57 @@ export function Modal({
|
|
|
771
773
|
size?: "md" | "lg";
|
|
772
774
|
/** On the dialog panel. */
|
|
773
775
|
className?: string;
|
|
776
|
+
/**
|
|
777
|
+
* document (default) portals over the page. contained keeps the overlay
|
|
778
|
+
* inside the nearest ThemeProvider scope="container" host.
|
|
779
|
+
*/
|
|
780
|
+
portal?: OverlayPortal;
|
|
774
781
|
}) {
|
|
775
782
|
const component = useComponentName("Modal");
|
|
783
|
+
const titleId = useId();
|
|
784
|
+
const panelClass = cx("m-dialog-panel", className);
|
|
785
|
+
const panelSize = size === "md" ? undefined : size;
|
|
786
|
+
const heading = (
|
|
787
|
+
<div className="m-dialog-heading">
|
|
788
|
+
{portal === "contained" ? (
|
|
789
|
+
<h2 id={titleId}>{title}</h2>
|
|
790
|
+
) : (
|
|
791
|
+
<DialogTitle>{title}</DialogTitle>
|
|
792
|
+
)}
|
|
793
|
+
<Button variant="ghost" onClick={onClose} aria-label="Close dialog">
|
|
794
|
+
Close
|
|
795
|
+
</Button>
|
|
796
|
+
</div>
|
|
797
|
+
);
|
|
798
|
+
const body = (
|
|
799
|
+
<>
|
|
800
|
+
{heading}
|
|
801
|
+
{children}
|
|
802
|
+
{actions && <div className="m-actions">{actions}</div>}
|
|
803
|
+
</>
|
|
804
|
+
);
|
|
776
805
|
return (
|
|
777
|
-
<DialogFrame
|
|
806
|
+
<DialogFrame
|
|
807
|
+
open={open}
|
|
808
|
+
onClose={onClose}
|
|
809
|
+
component={component}
|
|
810
|
+
portal={portal}
|
|
811
|
+
labelledBy={portal === "contained" ? titleId : undefined}
|
|
812
|
+
>
|
|
778
813
|
<div className="m-dialog-position">
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
Close
|
|
787
|
-
</Button>
|
|
814
|
+
{portal === "contained" ? (
|
|
815
|
+
<div
|
|
816
|
+
className={panelClass}
|
|
817
|
+
data-size={panelSize}
|
|
818
|
+
onClick={(event) => event.stopPropagation()}
|
|
819
|
+
>
|
|
820
|
+
{body}
|
|
788
821
|
</div>
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
822
|
+
) : (
|
|
823
|
+
<DialogPanel className={panelClass} data-size={panelSize}>
|
|
824
|
+
{body}
|
|
825
|
+
</DialogPanel>
|
|
826
|
+
)}
|
|
792
827
|
</div>
|
|
793
828
|
</DialogFrame>
|
|
794
829
|
);
|
package/src/workspace.tsx
CHANGED
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
componentRoot,
|
|
19
19
|
cx,
|
|
20
20
|
useComponentName,
|
|
21
|
+
type OverlayPortal,
|
|
21
22
|
} from "./internal.js";
|
|
22
|
-
|
|
23
23
|
export interface SlideOverProps {
|
|
24
24
|
open: boolean;
|
|
25
25
|
onClose: () => void;
|
|
@@ -31,6 +31,11 @@ export interface SlideOverProps {
|
|
|
31
31
|
size?: "md" | "lg" | "xl";
|
|
32
32
|
/** Class on the sliding panel. */
|
|
33
33
|
className?: string;
|
|
34
|
+
/**
|
|
35
|
+
* document (default) portals over the page. contained keeps the overlay
|
|
36
|
+
* inside the nearest ThemeProvider scope="container" host.
|
|
37
|
+
*/
|
|
38
|
+
portal?: OverlayPortal;
|
|
34
39
|
}
|
|
35
40
|
export function SlideOver({
|
|
36
41
|
open,
|
|
@@ -41,25 +46,59 @@ export function SlideOver({
|
|
|
41
46
|
actions,
|
|
42
47
|
size = "md",
|
|
43
48
|
className,
|
|
49
|
+
portal = "document",
|
|
44
50
|
}: SlideOverProps) {
|
|
51
|
+
const titleId = useId();
|
|
52
|
+
const panelClass = cx("m-slide-over", className);
|
|
53
|
+
const panelSize = size === "md" ? undefined : size;
|
|
54
|
+
const header = (
|
|
55
|
+
<header>
|
|
56
|
+
<div>
|
|
57
|
+
{portal === "contained" ? (
|
|
58
|
+
<h2 id={titleId}>{title}</h2>
|
|
59
|
+
) : (
|
|
60
|
+
<DialogTitle>{title}</DialogTitle>
|
|
61
|
+
)}
|
|
62
|
+
{description &&
|
|
63
|
+
(portal === "contained" ? (
|
|
64
|
+
<p>{description}</p>
|
|
65
|
+
) : (
|
|
66
|
+
<Description>{description}</Description>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
<Button variant="ghost" onClick={onClose} aria-label="Close panel">
|
|
70
|
+
<Close />
|
|
71
|
+
</Button>
|
|
72
|
+
</header>
|
|
73
|
+
);
|
|
74
|
+
const body = (
|
|
75
|
+
<>
|
|
76
|
+
{header}
|
|
77
|
+
<div className="m-slide-over-body">{children}</div>
|
|
78
|
+
{actions && <footer className="m-actions">{actions}</footer>}
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
45
81
|
return (
|
|
46
|
-
<DialogFrame
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
82
|
+
<DialogFrame
|
|
83
|
+
open={open}
|
|
84
|
+
onClose={onClose}
|
|
85
|
+
component="SlideOver"
|
|
86
|
+
portal={portal}
|
|
87
|
+
labelledBy={portal === "contained" ? titleId : undefined}
|
|
88
|
+
>
|
|
89
|
+
{portal === "contained" ? (
|
|
90
|
+
<div
|
|
91
|
+
className={panelClass}
|
|
92
|
+
data-size={panelSize}
|
|
93
|
+
onClick={(event) => event.stopPropagation()}
|
|
94
|
+
>
|
|
95
|
+
{body}
|
|
96
|
+
</div>
|
|
97
|
+
) : (
|
|
98
|
+
<DialogPanel className={panelClass} data-size={panelSize}>
|
|
99
|
+
{body}
|
|
100
|
+
</DialogPanel>
|
|
101
|
+
)}
|
|
63
102
|
</DialogFrame>
|
|
64
103
|
);
|
|
65
104
|
}
|