@stratakit/structures 0.4.4 → 0.5.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 +46 -0
- package/dist/AccordionItem.d.ts +1 -1
- package/dist/AccordionItem.js +67 -124
- package/dist/Banner.js +146 -117
- package/dist/Chip.js +83 -58
- package/dist/DEV/Banner.js +7 -4
- package/dist/DEV/ErrorRegion.js +5 -4
- package/dist/DEV/NavigationRail.js +52 -20
- package/dist/DEV/Tabs.js +1 -1
- package/dist/DEV/styles.css.js +1 -1
- package/dist/Dialog.js +140 -132
- package/dist/DropdownMenu.js +206 -239
- package/dist/ErrorRegion.d.ts +31 -13
- package/dist/ErrorRegion.js +127 -153
- package/dist/NavigationRail.d.ts +36 -3
- package/dist/NavigationRail.js +215 -169
- package/dist/Table.js +116 -108
- package/dist/Tabs.d.ts +2 -0
- package/dist/Tabs.js +97 -62
- package/dist/Toolbar.js +23 -43
- package/dist/Tree.js +13 -12
- package/dist/TreeItem.js +394 -315
- package/dist/styles.css.js +1 -1
- package/dist/~utils.ListItem.js +21 -34
- package/dist/~utils.icons.js +26 -46
- package/package.json +13 -18
package/dist/Dialog.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import * as AkDialog from "@ariakit/react/dialog";
|
|
@@ -6,14 +7,15 @@ import { Role } from "@ariakit/react/role";
|
|
|
6
7
|
import { useStoreState } from "@ariakit/react/store";
|
|
7
8
|
import { IconButton, Text } from "@stratakit/bricks";
|
|
8
9
|
import { GhostAligner } from "@stratakit/bricks/secret-internals";
|
|
9
|
-
import {
|
|
10
|
-
forwardRef,
|
|
11
|
-
usePopoverApi
|
|
12
|
-
} from "@stratakit/foundations/secret-internals";
|
|
10
|
+
import { forwardRef, usePopoverApi } from "@stratakit/foundations/secret-internals";
|
|
13
11
|
import cx from "classnames";
|
|
14
12
|
import { Dismiss } from "./~utils.icons.js";
|
|
15
13
|
const DialogRoot = forwardRef((props, forwardedRef) => {
|
|
16
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
backdrop = true,
|
|
16
|
+
unmountOnHide = true,
|
|
17
|
+
...rest
|
|
18
|
+
} = props;
|
|
17
19
|
const store = AkDialog.useDialogStore();
|
|
18
20
|
const contentElement = useStoreState(store, "contentElement");
|
|
19
21
|
const mounted = useStoreState(store, (state) => {
|
|
@@ -21,143 +23,149 @@ const DialogRoot = forwardRef((props, forwardedRef) => {
|
|
|
21
23
|
return props.open ?? state?.mounted;
|
|
22
24
|
});
|
|
23
25
|
if (!mounted) return null;
|
|
24
|
-
return /* @__PURE__ */ jsx(AkDialog.DialogProvider, {
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
return /* @__PURE__ */ jsx(AkDialog.DialogProvider, {
|
|
27
|
+
store,
|
|
28
|
+
children: /* @__PURE__ */ jsx(DialogWrapper, {
|
|
29
|
+
open: props.open,
|
|
30
|
+
children: /* @__PURE__ */ jsxs(AkDialog.Dialog, {
|
|
31
|
+
unmountOnHide,
|
|
32
|
+
portal: false,
|
|
33
|
+
...rest,
|
|
34
|
+
backdrop: backdrop === true ? /* @__PURE__ */ jsx(DialogBackdrop, {}) : backdrop,
|
|
35
|
+
className: cx("\u{1F95D}Dialog", props.className),
|
|
36
|
+
ref: forwardedRef,
|
|
37
|
+
children: [/* @__PURE__ */ jsx(AkDialog.DialogDismiss, {
|
|
38
|
+
hidden: true
|
|
39
|
+
}), /* @__PURE__ */ jsx(PortalContext.Provider, {
|
|
40
|
+
value: contentElement,
|
|
41
|
+
children: props.children
|
|
42
|
+
})]
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
});
|
|
39
46
|
});
|
|
40
47
|
function DialogWrapper(props) {
|
|
48
|
+
const $ = _c(9);
|
|
41
49
|
const [wrapper, setWrapper] = React.useState(null);
|
|
42
50
|
const store = AkDialog.useDialogContext();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
let t0;
|
|
52
|
+
if ($[0] !== props.open) {
|
|
53
|
+
t0 = (state) => props.open ?? state?.open;
|
|
54
|
+
$[0] = props.open;
|
|
55
|
+
$[1] = t0;
|
|
56
|
+
} else {
|
|
57
|
+
t0 = $[1];
|
|
58
|
+
}
|
|
59
|
+
const open = useStoreState(store, t0);
|
|
60
|
+
let t1;
|
|
61
|
+
if ($[2] !== open || $[3] !== wrapper) {
|
|
62
|
+
t1 = {
|
|
63
|
+
element: wrapper,
|
|
64
|
+
open
|
|
65
|
+
};
|
|
66
|
+
$[2] = open;
|
|
67
|
+
$[3] = wrapper;
|
|
68
|
+
$[4] = t1;
|
|
69
|
+
} else {
|
|
70
|
+
t1 = $[4];
|
|
71
|
+
}
|
|
72
|
+
const popoverProps = usePopoverApi(t1);
|
|
50
73
|
const mounted = useStoreState(store, "mounted");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
const t2 = mounted ? void 0 : true;
|
|
75
|
+
let t3;
|
|
76
|
+
if ($[5] !== popoverProps || $[6] !== props.children || $[7] !== t2) {
|
|
77
|
+
t3 = jsx(Portal, {
|
|
54
78
|
className: "\u{1F95D}DialogWrapper",
|
|
55
79
|
ref: setWrapper,
|
|
56
80
|
...popoverProps,
|
|
57
|
-
hidden:
|
|
81
|
+
hidden: t2,
|
|
58
82
|
children: props.children
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
...props,
|
|
68
|
-
className: cx("\u{1F95D}DialogHeader", props.className),
|
|
69
|
-
ref: forwardedRef
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
const DialogHeading = forwardRef(
|
|
75
|
-
(props, forwardedRef) => {
|
|
76
|
-
return /* @__PURE__ */ jsx(
|
|
77
|
-
AkDialog.DialogHeading,
|
|
78
|
-
{
|
|
79
|
-
...props,
|
|
80
|
-
className: cx("\u{1F95D}DialogHeading", props.className),
|
|
81
|
-
render: /* @__PURE__ */ jsx(Text, { variant: "body-lg", render: props.render ?? /* @__PURE__ */ jsx("h1", {}) }),
|
|
82
|
-
ref: forwardedRef
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
const DialogCloseButton = forwardRef(
|
|
88
|
-
(props, forwardedRef) => {
|
|
89
|
-
const { label = "Dismiss", ...rest } = props;
|
|
90
|
-
return /* @__PURE__ */ jsx(GhostAligner, { align: "inline-end", children: /* @__PURE__ */ jsx(
|
|
91
|
-
AkDialog.DialogDismiss,
|
|
92
|
-
{
|
|
93
|
-
...rest,
|
|
94
|
-
render: /* @__PURE__ */ jsx(
|
|
95
|
-
IconButton,
|
|
96
|
-
{
|
|
97
|
-
render: props.render,
|
|
98
|
-
variant: "ghost",
|
|
99
|
-
label,
|
|
100
|
-
icon: /* @__PURE__ */ jsx(Dismiss, {})
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
ref: forwardedRef
|
|
104
|
-
}
|
|
105
|
-
) });
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
const DialogContent = forwardRef(
|
|
109
|
-
(props, forwardedRef) => {
|
|
110
|
-
return /* @__PURE__ */ jsx(
|
|
111
|
-
Role,
|
|
112
|
-
{
|
|
113
|
-
...props,
|
|
114
|
-
className: cx("\u{1F95D}DialogContent", props.className),
|
|
115
|
-
ref: forwardedRef
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
const DialogFooter = forwardRef(
|
|
121
|
-
(props, forwardedRef) => {
|
|
122
|
-
return /* @__PURE__ */ jsx(
|
|
123
|
-
Role,
|
|
124
|
-
{
|
|
125
|
-
...props,
|
|
126
|
-
className: cx("\u{1F95D}DialogFooter", props.className),
|
|
127
|
-
ref: forwardedRef
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
const DialogActionList = forwardRef(
|
|
133
|
-
(props, forwardedRef) => {
|
|
134
|
-
const { actions, ...rest } = props;
|
|
135
|
-
return /* @__PURE__ */ jsx(
|
|
136
|
-
Role,
|
|
137
|
-
{
|
|
138
|
-
role: "list",
|
|
139
|
-
...rest,
|
|
140
|
-
className: cx("\u{1F95D}DialogActionList", props.className),
|
|
141
|
-
ref: forwardedRef,
|
|
142
|
-
children: React.Children.map(actions, (action) => {
|
|
143
|
-
return /* @__PURE__ */ jsx("div", { role: "listitem", children: action });
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
);
|
|
83
|
+
});
|
|
84
|
+
$[5] = popoverProps;
|
|
85
|
+
$[6] = props.children;
|
|
86
|
+
$[7] = t2;
|
|
87
|
+
$[8] = t3;
|
|
88
|
+
} else {
|
|
89
|
+
t3 = $[8];
|
|
147
90
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
)
|
|
91
|
+
return t3;
|
|
92
|
+
}
|
|
93
|
+
const DialogHeader = forwardRef((props, forwardedRef) => {
|
|
94
|
+
return /* @__PURE__ */ jsx(Role, {
|
|
95
|
+
...props,
|
|
96
|
+
className: cx("\u{1F95D}DialogHeader", props.className),
|
|
97
|
+
ref: forwardedRef
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const DialogHeading = forwardRef((props, forwardedRef) => {
|
|
101
|
+
return /* @__PURE__ */ jsx(AkDialog.DialogHeading, {
|
|
102
|
+
...props,
|
|
103
|
+
className: cx("\u{1F95D}DialogHeading", props.className),
|
|
104
|
+
render: /* @__PURE__ */ jsx(Text, {
|
|
105
|
+
variant: "body-lg",
|
|
106
|
+
render: props.render ?? /* @__PURE__ */ jsx("h1", {})
|
|
107
|
+
}),
|
|
108
|
+
ref: forwardedRef
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
const DialogCloseButton = forwardRef((props, forwardedRef) => {
|
|
112
|
+
const {
|
|
113
|
+
label = "Dismiss",
|
|
114
|
+
...rest
|
|
115
|
+
} = props;
|
|
116
|
+
return /* @__PURE__ */ jsx(GhostAligner, {
|
|
117
|
+
align: "inline-end",
|
|
118
|
+
children: /* @__PURE__ */ jsx(AkDialog.DialogDismiss, {
|
|
119
|
+
...rest,
|
|
120
|
+
render: /* @__PURE__ */ jsx(IconButton, {
|
|
121
|
+
render: props.render,
|
|
122
|
+
variant: "ghost",
|
|
123
|
+
label,
|
|
124
|
+
icon: /* @__PURE__ */ jsx(Dismiss, {})
|
|
125
|
+
}),
|
|
126
|
+
ref: forwardedRef
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
const DialogContent = forwardRef((props, forwardedRef) => {
|
|
131
|
+
return /* @__PURE__ */ jsx(Role, {
|
|
132
|
+
...props,
|
|
133
|
+
className: cx("\u{1F95D}DialogContent", props.className),
|
|
134
|
+
ref: forwardedRef
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
const DialogFooter = forwardRef((props, forwardedRef) => {
|
|
138
|
+
return /* @__PURE__ */ jsx(Role, {
|
|
139
|
+
...props,
|
|
140
|
+
className: cx("\u{1F95D}DialogFooter", props.className),
|
|
141
|
+
ref: forwardedRef
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
const DialogActionList = forwardRef((props, forwardedRef) => {
|
|
145
|
+
const {
|
|
146
|
+
actions,
|
|
147
|
+
...rest
|
|
148
|
+
} = props;
|
|
149
|
+
return /* @__PURE__ */ jsx(Role, {
|
|
150
|
+
role: "list",
|
|
151
|
+
...rest,
|
|
152
|
+
className: cx("\u{1F95D}DialogActionList", props.className),
|
|
153
|
+
ref: forwardedRef,
|
|
154
|
+
children: React.Children.map(actions, (action) => {
|
|
155
|
+
return /* @__PURE__ */ jsx("div", {
|
|
156
|
+
role: "listitem",
|
|
157
|
+
children: action
|
|
158
|
+
});
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
const DialogBackdrop = forwardRef((props, forwardedRef) => {
|
|
163
|
+
return /* @__PURE__ */ jsx(Role, {
|
|
164
|
+
...props,
|
|
165
|
+
className: cx("\u{1F95D}DialogBackdrop", props.className),
|
|
166
|
+
ref: forwardedRef
|
|
167
|
+
});
|
|
168
|
+
});
|
|
161
169
|
export {
|
|
162
170
|
DialogActionList as ActionList,
|
|
163
171
|
DialogBackdrop as Backdrop,
|