@reforma/components 0.3.3 → 0.4.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/dist/Composer/parts.d.ts +1 -1
- package/dist/Composer/parts.d.ts.map +1 -1
- package/dist/Composer/parts.js +102 -98
- package/dist/Composer/parts.js.map +1 -1
- package/dist/Composer/reforma/Composer.module.css +1 -1
- package/dist/Composer/reforma/Composer.module.css.js +24 -22
- package/dist/Composer/reforma/Composer.module.css.js.map +1 -1
- package/dist/Composer/types.d.ts +1 -1
- package/dist/Composer/types.d.ts.map +1 -1
- package/dist/Modal/Modal.d.ts +2 -2
- package/dist/Modal/Modal.d.ts.map +1 -1
- package/dist/Modal/Modal.js +6 -3
- package/dist/Modal/Modal.js.map +1 -1
- package/dist/SettingsLayout/SettingsLayout.d.ts +1 -0
- package/dist/SettingsLayout/SettingsLayout.d.ts.map +1 -1
- package/dist/SettingsLayout/SettingsLayout.js +332 -292
- package/dist/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/SettingsLayout/SettingsLayout.module.css +1 -1
- package/dist/SettingsLayout/SettingsLayout.module.css.js +20 -18
- package/dist/SettingsLayout/SettingsLayout.module.css.js.map +1 -1
- package/dist/chat/Attachment/Attachment.d.ts.map +1 -1
- package/dist/chat/Attachment/Attachment.js +14 -16
- package/dist/chat/Attachment/Attachment.js.map +1 -1
- package/dist/chat/Attachment/Attachment.module.css +1 -1
- package/dist/chat/Tool/Tool.d.ts.map +1 -1
- package/dist/chat/Tool/Tool.js +77 -75
- package/dist/chat/Tool/Tool.js.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.d.ts.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.js +18 -17
- package/dist/chat/Tool/agent/AgentTool.js.map +1 -1
- package/dist/chat/Tool/check-page/CheckPageTool.d.ts +4 -0
- package/dist/chat/Tool/check-page/CheckPageTool.d.ts.map +1 -0
- package/dist/chat/Tool/check-page/CheckPageTool.js +75 -0
- package/dist/chat/Tool/check-page/CheckPageTool.js.map +1 -0
- package/dist/chat/Tool/check-page/index.d.ts +2 -0
- package/dist/chat/Tool/check-page/index.d.ts.map +1 -0
- package/dist/chat/Tool/check-page/index.js +5 -0
- package/dist/chat/Tool/check-page/index.js.map +1 -0
- package/dist/index.js +156 -155
- package/dist/modals/ConfirmModal.d.ts +2 -0
- package/dist/modals/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/ConfirmModal.js +88 -60
- package/dist/modals/ConfirmModal.js.map +1 -1
- package/dist/modals/index.d.ts +1 -1
- package/dist/modals/index.d.ts.map +1 -1
- package/dist/modals/index.js +2 -1
- package/dist/openui/functions/index.d.ts +59 -59
- package/dist/openui/functions/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/node_modules/clsx/dist/clsx.js +0 -18
- package/dist/node_modules/clsx/dist/clsx.js.map +0 -1
- package/dist/node_modules/react-aria/dist/private/interactions/useFocusable.js +0 -17
- package/dist/node_modules/react-aria/dist/private/interactions/useFocusable.js.map +0 -1
- package/dist/node_modules/react-aria/dist/private/utils/useObjectRef.js +0 -34
- package/dist/node_modules/react-aria/dist/private/utils/useObjectRef.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/errors.js +0 -38
- package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/parse.js +0 -21
- package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -822
- package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/api.js +0 -561
- package/dist/node_modules/zod/v4/core/api.js.map +0 -1
- package/dist/node_modules/zod/v4/core/checks.js +0 -262
- package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
- package/dist/node_modules/zod/v4/core/core.js +0 -97
- package/dist/node_modules/zod/v4/core/core.js.map +0 -1
- package/dist/node_modules/zod/v4/core/doc.js +0 -35
- package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
- package/dist/node_modules/zod/v4/core/errors.js +0 -79
- package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -308
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/memoizer.js +0 -203
- package/dist/node_modules/zod/v4/core/memoizer.js.map +0 -1
- package/dist/node_modules/zod/v4/core/parse.js +0 -113
- package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/core/regexes.js +0 -59
- package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
- package/dist/node_modules/zod/v4/core/registries.js +0 -41
- package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
- package/dist/node_modules/zod/v4/core/schemas.js +0 -1104
- package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -380
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
- package/dist/node_modules/zod/v4/core/util.js +0 -465
- package/dist/node_modules/zod/v4/core/util.js.map +0 -1
- package/dist/node_modules/zod/v4/core/versions.js +0 -9
- package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
- package/dist/node_modules/zod/v4/locales/en.js +0 -97
- package/dist/node_modules/zod/v4/locales/en.js.map +0 -1
|
@@ -1,254 +1,281 @@
|
|
|
1
|
-
import { MOTION_EASE_UI as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { MOTION_EASE_UI as ne } from "@reforma/constants";
|
|
2
|
+
import { AttentionCircle as re } from "@reforma/icons/14";
|
|
3
|
+
import { cn as N } from "@reforma/lib";
|
|
4
|
+
import { useReducedMotion as M, AnimatePresence as ie, motion as oe } from "motion/react";
|
|
5
|
+
import { use as w, useState as y, useRef as E, createContext as I, useCallback as k, useEffect as C, useMemo as j } from "react";
|
|
6
|
+
import { createPortal as se } from "react-dom";
|
|
7
|
+
import { Alert as ae, AlertIcon as ce, AlertTitle as le, AlertAction as de } from "../Alert/Alert.js";
|
|
8
|
+
import { Box as B } from "../Box/Box.js";
|
|
9
|
+
import { Breadcrumb as A } from "../Breadcrumb/Breadcrumb.js";
|
|
10
|
+
import { Button as O } from "../Button/Button.js";
|
|
11
|
+
import { For as V } from "../For/For.js";
|
|
12
|
+
import { tooltipWithHotkey as ue } from "../Hotkey/Hotkey.js";
|
|
13
|
+
import { ListBox as fe, ListBoxItem as me } from "../List/ListBox.js";
|
|
14
|
+
import { ModalContext as ve } from "../Modal/hooks/useModalProvider.js";
|
|
15
|
+
import { confirmDiscardChanges as ge } from "../modals/ConfirmModal.js";
|
|
16
|
+
import { Scrollable as he } from "../Scrollable/Scrollable.js";
|
|
17
|
+
import { Show as _ } from "../Show/Show.js";
|
|
18
|
+
import { Text as ye } from "../Text/Text.js";
|
|
19
|
+
import { toast as pe } from "../Toast/Toast.js";
|
|
20
|
+
import l from "./SettingsLayout.module.css.js";
|
|
21
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
22
|
+
const H = oe.create(he), K = 0.35, R = 32, Se = -12, be = ["mod", "s"];
|
|
23
|
+
function Ne(e) {
|
|
24
|
+
return !(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey ? !1 : e.key === "s" || e.key === "S";
|
|
21
25
|
}
|
|
22
|
-
function
|
|
26
|
+
function U(e) {
|
|
23
27
|
return {
|
|
24
|
-
duration:
|
|
25
|
-
ease:
|
|
28
|
+
duration: e ? 0 : K,
|
|
29
|
+
ease: ne
|
|
26
30
|
};
|
|
27
31
|
}
|
|
28
|
-
function
|
|
32
|
+
function we(e) {
|
|
29
33
|
return {
|
|
30
|
-
duration:
|
|
34
|
+
duration: e ? 0 : K,
|
|
31
35
|
ease: "easeOut"
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
|
-
function
|
|
38
|
+
function Y(e, r) {
|
|
35
39
|
return {
|
|
36
|
-
opacity:
|
|
37
|
-
x:
|
|
40
|
+
opacity: e ? 0 : 1,
|
|
41
|
+
x: e && !r ? Se : 0,
|
|
38
42
|
y: 0
|
|
39
43
|
};
|
|
40
44
|
}
|
|
41
|
-
const
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
const z = /* @__PURE__ */ I(null), G = /* @__PURE__ */ I(null), F = /* @__PURE__ */ I(null);
|
|
46
|
+
function P(e, r) {
|
|
47
|
+
if (e === !0) {
|
|
48
|
+
r();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
e !== !1 && e.then((a) => {
|
|
52
|
+
a && r();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function L() {
|
|
56
|
+
const e = w(z);
|
|
57
|
+
if (!e)
|
|
45
58
|
throw new Error("useSettingsLayout must be used inside SettingsLayout");
|
|
46
|
-
return
|
|
59
|
+
return e;
|
|
47
60
|
}
|
|
48
|
-
const
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
61
|
+
const W = /* @__PURE__ */ I(null);
|
|
62
|
+
function Xe() {
|
|
63
|
+
const e = w(W);
|
|
64
|
+
if (!e)
|
|
52
65
|
throw new Error("useSettingsSave must be used inside SettingsLayout.Content with saveable prop");
|
|
53
|
-
return
|
|
66
|
+
return e;
|
|
54
67
|
}
|
|
55
|
-
function
|
|
56
|
-
items:
|
|
57
|
-
defaultSelected:
|
|
58
|
-
defaultStack:
|
|
59
|
-
className:
|
|
60
|
-
children:
|
|
68
|
+
function q({
|
|
69
|
+
items: e,
|
|
70
|
+
defaultSelected: r,
|
|
71
|
+
defaultStack: a,
|
|
72
|
+
className: c,
|
|
73
|
+
children: s
|
|
61
74
|
}) {
|
|
62
|
-
const [
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
value:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
const [i, d] = y(r ?? e[0]?.id ?? ""), [n, o] = y(() => a ? [...a] : []), u = E(null);
|
|
76
|
+
return /* @__PURE__ */ t(F, {
|
|
77
|
+
value: u,
|
|
78
|
+
children: /* @__PURE__ */ t(z, {
|
|
79
|
+
value: {
|
|
80
|
+
items: e,
|
|
81
|
+
selectedId: i,
|
|
82
|
+
select: (f) => {
|
|
83
|
+
const m = f !== i, b = n.length > 0;
|
|
84
|
+
!m && !b || P(u.current?.() ?? !0, () => {
|
|
85
|
+
m && d(f), o([]);
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
stack: n,
|
|
89
|
+
push: (f) => o((m) => [...m, f]),
|
|
90
|
+
rename: (f, m) => o((b) => b.map((v) => v.id === f && v.label !== m ? {
|
|
91
|
+
...v,
|
|
92
|
+
label: m
|
|
93
|
+
} : v)),
|
|
94
|
+
pop: () => {
|
|
95
|
+
n.length !== 0 && P(u.current?.() ?? !0, () => {
|
|
96
|
+
o((f) => f.slice(0, -1));
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
reset: () => {
|
|
100
|
+
n.length !== 0 && P(u.current?.() ?? !0, () => {
|
|
101
|
+
o([]);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
69
104
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
label: y
|
|
75
|
-
} : f)),
|
|
76
|
-
pop: () => d((u) => u.slice(0, -1)),
|
|
77
|
-
reset: () => d([])
|
|
78
|
-
},
|
|
79
|
-
children: /* @__PURE__ */ e("div", {
|
|
80
|
-
className: g(c.root, r),
|
|
81
|
-
children: i
|
|
105
|
+
children: /* @__PURE__ */ t("div", {
|
|
106
|
+
className: N(l.root, c),
|
|
107
|
+
children: s
|
|
108
|
+
})
|
|
82
109
|
})
|
|
83
110
|
});
|
|
84
111
|
}
|
|
85
|
-
function
|
|
86
|
-
title:
|
|
87
|
-
className:
|
|
88
|
-
"aria-label":
|
|
89
|
-
footer:
|
|
112
|
+
function J({
|
|
113
|
+
title: e,
|
|
114
|
+
className: r,
|
|
115
|
+
"aria-label": a = "Settings sections",
|
|
116
|
+
footer: c
|
|
90
117
|
}) {
|
|
91
118
|
const {
|
|
92
|
-
items:
|
|
93
|
-
selectedId:
|
|
94
|
-
select:
|
|
95
|
-
} =
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
className:
|
|
98
|
-
children: [/* @__PURE__ */
|
|
99
|
-
when:
|
|
100
|
-
children: /* @__PURE__ */
|
|
119
|
+
items: s,
|
|
120
|
+
selectedId: i,
|
|
121
|
+
select: d
|
|
122
|
+
} = L();
|
|
123
|
+
return /* @__PURE__ */ p("div", {
|
|
124
|
+
className: N(l.sidebar, r),
|
|
125
|
+
children: [/* @__PURE__ */ t(_, {
|
|
126
|
+
when: e,
|
|
127
|
+
children: /* @__PURE__ */ t(ye, {
|
|
101
128
|
variant: "sm",
|
|
102
129
|
color: "secondary",
|
|
103
|
-
className:
|
|
104
|
-
children:
|
|
130
|
+
className: l.sidebarTitle,
|
|
131
|
+
children: e
|
|
105
132
|
})
|
|
106
|
-
}), /* @__PURE__ */
|
|
107
|
-
"aria-label":
|
|
133
|
+
}), /* @__PURE__ */ t(fe, {
|
|
134
|
+
"aria-label": a,
|
|
108
135
|
size: "md",
|
|
109
136
|
selectionMode: "single",
|
|
110
|
-
selectedKeys: [
|
|
137
|
+
selectedKeys: [i],
|
|
111
138
|
disallowEmptySelection: !0,
|
|
112
|
-
children: /* @__PURE__ */
|
|
113
|
-
each:
|
|
114
|
-
children: (n) => /* @__PURE__ */
|
|
139
|
+
children: /* @__PURE__ */ t(V, {
|
|
140
|
+
each: s,
|
|
141
|
+
children: (n) => /* @__PURE__ */ t(me, {
|
|
115
142
|
id: n.id,
|
|
116
143
|
icon: n.icon,
|
|
117
144
|
textValue: n.label,
|
|
118
|
-
onPress: () =>
|
|
145
|
+
onPress: () => d(n.id),
|
|
119
146
|
children: n.label
|
|
120
147
|
}, n.id)
|
|
121
148
|
})
|
|
122
|
-
}), /* @__PURE__ */
|
|
123
|
-
when:
|
|
124
|
-
children: /* @__PURE__ */
|
|
125
|
-
className:
|
|
126
|
-
children:
|
|
149
|
+
}), /* @__PURE__ */ t(_, {
|
|
150
|
+
when: c,
|
|
151
|
+
children: /* @__PURE__ */ t("div", {
|
|
152
|
+
className: l.sidebarFooter,
|
|
153
|
+
children: c
|
|
127
154
|
})
|
|
128
155
|
})]
|
|
129
156
|
});
|
|
130
157
|
}
|
|
131
|
-
function
|
|
158
|
+
function Le() {
|
|
132
159
|
const {
|
|
133
|
-
items:
|
|
134
|
-
selectedId:
|
|
135
|
-
stack:
|
|
136
|
-
reset:
|
|
137
|
-
} =
|
|
138
|
-
return /* @__PURE__ */
|
|
160
|
+
items: e,
|
|
161
|
+
selectedId: r,
|
|
162
|
+
stack: a,
|
|
163
|
+
reset: c
|
|
164
|
+
} = L(), s = e.find((i) => i.id === r)?.label ?? "";
|
|
165
|
+
return /* @__PURE__ */ p(A, {
|
|
139
166
|
variant: "heading-2",
|
|
140
|
-
className:
|
|
141
|
-
children: [
|
|
142
|
-
children:
|
|
143
|
-
}, "root") : /* @__PURE__ */
|
|
144
|
-
onPress:
|
|
145
|
-
children:
|
|
146
|
-
}, "root"), /* @__PURE__ */
|
|
147
|
-
each:
|
|
148
|
-
children: (
|
|
149
|
-
children:
|
|
150
|
-
},
|
|
167
|
+
className: l.title,
|
|
168
|
+
children: [a.length === 0 ? /* @__PURE__ */ t(A.Page, {
|
|
169
|
+
children: s
|
|
170
|
+
}, "root") : /* @__PURE__ */ t(A.Link, {
|
|
171
|
+
onPress: c,
|
|
172
|
+
children: s
|
|
173
|
+
}, "root"), /* @__PURE__ */ t(V, {
|
|
174
|
+
each: a,
|
|
175
|
+
children: (i) => /* @__PURE__ */ t(A.Page, {
|
|
176
|
+
children: i.label
|
|
177
|
+
}, i.id)
|
|
151
178
|
})]
|
|
152
179
|
});
|
|
153
180
|
}
|
|
154
|
-
function
|
|
155
|
-
paneKey:
|
|
156
|
-
className:
|
|
157
|
-
children:
|
|
181
|
+
function Q({
|
|
182
|
+
paneKey: e,
|
|
183
|
+
className: r,
|
|
184
|
+
children: a
|
|
158
185
|
}) {
|
|
159
186
|
const {
|
|
160
|
-
stack:
|
|
161
|
-
} =
|
|
162
|
-
return
|
|
187
|
+
stack: c
|
|
188
|
+
} = L(), s = w(G), i = M(), d = e ? c.findIndex((o) => o.id === e) : -1, n = d >= 0 && d < c.length - 1;
|
|
189
|
+
return s ? /* @__PURE__ */ se(/* @__PURE__ */ t(ie, {
|
|
163
190
|
initial: !1,
|
|
164
|
-
children:
|
|
165
|
-
className:
|
|
166
|
-
contentClass:
|
|
167
|
-
initial:
|
|
191
|
+
children: e ? /* @__PURE__ */ t(H, {
|
|
192
|
+
className: N(l.overlay, r),
|
|
193
|
+
contentClass: N(l.scrollContent, l.paneContent),
|
|
194
|
+
initial: i ? !1 : {
|
|
168
195
|
opacity: 0,
|
|
169
|
-
x:
|
|
196
|
+
x: R
|
|
170
197
|
},
|
|
171
|
-
animate:
|
|
172
|
-
exit:
|
|
198
|
+
animate: Y(n, i),
|
|
199
|
+
exit: i ? void 0 : {
|
|
173
200
|
opacity: 0,
|
|
174
|
-
x:
|
|
201
|
+
x: R,
|
|
175
202
|
pointerEvents: "none"
|
|
176
203
|
},
|
|
177
|
-
transition:
|
|
204
|
+
transition: U(i),
|
|
178
205
|
inert: n,
|
|
179
|
-
children:
|
|
180
|
-
},
|
|
181
|
-
}),
|
|
206
|
+
children: a
|
|
207
|
+
}, e) : null
|
|
208
|
+
}), s) : null;
|
|
182
209
|
}
|
|
183
|
-
function
|
|
184
|
-
className:
|
|
185
|
-
action:
|
|
186
|
-
footer:
|
|
187
|
-
children:
|
|
210
|
+
function X({
|
|
211
|
+
className: e,
|
|
212
|
+
action: r,
|
|
213
|
+
footer: a,
|
|
214
|
+
children: c
|
|
188
215
|
}) {
|
|
189
216
|
const {
|
|
190
|
-
selectedId:
|
|
191
|
-
stack:
|
|
192
|
-
} =
|
|
193
|
-
return /* @__PURE__ */
|
|
194
|
-
value:
|
|
195
|
-
children: /* @__PURE__ */
|
|
196
|
-
className:
|
|
197
|
-
children: [/* @__PURE__ */
|
|
198
|
-
className:
|
|
199
|
-
children: [/* @__PURE__ */
|
|
200
|
-
}), /* @__PURE__ */
|
|
217
|
+
selectedId: s,
|
|
218
|
+
stack: i
|
|
219
|
+
} = L(), [d, n] = y(null), o = M(), u = i.length > 0, S = j(() => Y(u, o), [u, o]);
|
|
220
|
+
return /* @__PURE__ */ t(G, {
|
|
221
|
+
value: d,
|
|
222
|
+
children: /* @__PURE__ */ p("div", {
|
|
223
|
+
className: N(l.content, e),
|
|
224
|
+
children: [/* @__PURE__ */ p("div", {
|
|
225
|
+
className: l.header,
|
|
226
|
+
children: [/* @__PURE__ */ t(Le, {}), r]
|
|
227
|
+
}), /* @__PURE__ */ t("div", {
|
|
201
228
|
ref: n,
|
|
202
|
-
className:
|
|
203
|
-
children: /* @__PURE__ */
|
|
204
|
-
className:
|
|
205
|
-
contentClass:
|
|
206
|
-
initial:
|
|
229
|
+
className: l.viewport,
|
|
230
|
+
children: /* @__PURE__ */ t(H, {
|
|
231
|
+
className: l.scroll,
|
|
232
|
+
contentClass: l.scrollContent,
|
|
233
|
+
initial: o ? !1 : {
|
|
207
234
|
opacity: 0.6,
|
|
208
235
|
y: 8
|
|
209
236
|
},
|
|
210
|
-
animate:
|
|
211
|
-
transition:
|
|
212
|
-
inert:
|
|
213
|
-
children:
|
|
214
|
-
},
|
|
215
|
-
}),
|
|
237
|
+
animate: S,
|
|
238
|
+
transition: u ? U(o) : we(o),
|
|
239
|
+
inert: u,
|
|
240
|
+
children: c
|
|
241
|
+
}, s)
|
|
242
|
+
}), a]
|
|
216
243
|
})
|
|
217
244
|
});
|
|
218
245
|
}
|
|
219
|
-
function
|
|
220
|
-
children:
|
|
246
|
+
function Z({
|
|
247
|
+
children: e
|
|
221
248
|
}) {
|
|
222
|
-
return /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ t(B, {
|
|
223
250
|
align: "center",
|
|
224
251
|
justify: "center",
|
|
225
252
|
gap: "lg",
|
|
226
253
|
grow: !0,
|
|
227
254
|
fullWidth: !0,
|
|
228
255
|
fullHeight: !0,
|
|
229
|
-
children:
|
|
256
|
+
children: e
|
|
230
257
|
});
|
|
231
258
|
}
|
|
232
|
-
function
|
|
233
|
-
headerRight:
|
|
234
|
-
footer:
|
|
235
|
-
saveable:
|
|
236
|
-
className:
|
|
237
|
-
children:
|
|
259
|
+
function $({
|
|
260
|
+
headerRight: e,
|
|
261
|
+
footer: r,
|
|
262
|
+
saveable: a,
|
|
263
|
+
className: c,
|
|
264
|
+
children: s
|
|
238
265
|
}) {
|
|
239
|
-
return
|
|
240
|
-
headerRight:
|
|
241
|
-
footer:
|
|
242
|
-
className:
|
|
243
|
-
children:
|
|
244
|
-
}) : /* @__PURE__ */
|
|
245
|
-
className:
|
|
246
|
-
action:
|
|
247
|
-
footer:
|
|
248
|
-
children:
|
|
266
|
+
return a ? /* @__PURE__ */ t(Te, {
|
|
267
|
+
headerRight: e,
|
|
268
|
+
footer: r,
|
|
269
|
+
className: c,
|
|
270
|
+
children: s
|
|
271
|
+
}) : /* @__PURE__ */ t(X, {
|
|
272
|
+
className: c,
|
|
273
|
+
action: e,
|
|
274
|
+
footer: r,
|
|
275
|
+
children: s
|
|
249
276
|
});
|
|
250
277
|
}
|
|
251
|
-
const
|
|
278
|
+
const xe = 1e3, Ce = {
|
|
252
279
|
save: {
|
|
253
280
|
dirty: "Save changes",
|
|
254
281
|
saving: "Saving…",
|
|
@@ -262,139 +289,152 @@ const vt = 1e3, pt = {
|
|
|
262
289
|
tooltip: "Add"
|
|
263
290
|
}
|
|
264
291
|
};
|
|
265
|
-
function
|
|
266
|
-
return typeof
|
|
267
|
-
dirty:
|
|
268
|
-
saving:
|
|
269
|
-
saved:
|
|
270
|
-
tooltip:
|
|
271
|
-
} :
|
|
292
|
+
function Ae(e) {
|
|
293
|
+
return typeof e == "object" ? {
|
|
294
|
+
dirty: e.dirty,
|
|
295
|
+
saving: e.saving,
|
|
296
|
+
saved: e.saved,
|
|
297
|
+
tooltip: e.tooltip ?? e.dirty
|
|
298
|
+
} : Ce[e];
|
|
299
|
+
}
|
|
300
|
+
function Ee(e, r) {
|
|
301
|
+
return e === "saving" ? r.saving : e === "saved" ? r.saved : "You have unsaved changes";
|
|
272
302
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
303
|
+
function Ie({
|
|
304
|
+
state: e,
|
|
305
|
+
copy: r,
|
|
306
|
+
onSave: a,
|
|
307
|
+
onDiscard: c
|
|
308
|
+
}) {
|
|
309
|
+
const s = Ee(e, r);
|
|
310
|
+
return /* @__PURE__ */ t("div", {
|
|
311
|
+
className: l.saveEnter,
|
|
312
|
+
children: /* @__PURE__ */ t("div", {
|
|
313
|
+
className: l.saveClip,
|
|
314
|
+
children: /* @__PURE__ */ p(ae, {
|
|
315
|
+
children: [/* @__PURE__ */ t(ce, {
|
|
316
|
+
children: /* @__PURE__ */ t(re, {})
|
|
317
|
+
}), /* @__PURE__ */ t(le, {
|
|
318
|
+
children: s
|
|
319
|
+
}), e === "saved" ? null : /* @__PURE__ */ t(de, {
|
|
320
|
+
children: /* @__PURE__ */ p(B, {
|
|
321
|
+
direction: "row",
|
|
322
|
+
align: "center",
|
|
323
|
+
gap: "sm",
|
|
324
|
+
wrap: !1,
|
|
325
|
+
children: [/* @__PURE__ */ t(O, {
|
|
326
|
+
variant: "filling",
|
|
327
|
+
color: "secondary",
|
|
328
|
+
size: "sm",
|
|
329
|
+
isDisabled: e === "saving",
|
|
330
|
+
onPress: c,
|
|
331
|
+
children: "Discard"
|
|
332
|
+
}), /* @__PURE__ */ t(O, {
|
|
333
|
+
color: "primary",
|
|
334
|
+
size: "sm",
|
|
335
|
+
isDisabled: e === "saving",
|
|
336
|
+
tooltip: e === "dirty" ? ue(r.tooltip, be) : void 0,
|
|
337
|
+
onPress: a,
|
|
338
|
+
children: e === "saving" ? r.saving : r.dirty
|
|
339
|
+
})]
|
|
340
|
+
})
|
|
341
|
+
})]
|
|
342
|
+
})
|
|
343
|
+
})
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
function Te({
|
|
347
|
+
headerRight: e,
|
|
348
|
+
footer: r,
|
|
349
|
+
className: a,
|
|
350
|
+
children: c
|
|
278
351
|
}) {
|
|
279
352
|
const {
|
|
280
|
-
selectedId:
|
|
281
|
-
} =
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
}, []),
|
|
286
|
-
if (
|
|
287
|
-
|
|
353
|
+
selectedId: s
|
|
354
|
+
} = L(), i = w(F), d = w(ve)?.modal, [n, o] = y("idle"), [u, S] = y("save"), x = E(null), T = E(null), f = E(void 0), [m, b] = y(s);
|
|
355
|
+
m !== s && (b(s), o("idle"), S("save"));
|
|
356
|
+
const v = k((g) => {
|
|
357
|
+
o((h) => g ? "dirty" : h === "dirty" ? "idle" : h);
|
|
358
|
+
}, []), D = k(async () => {
|
|
359
|
+
if (x.current) {
|
|
360
|
+
o("saving");
|
|
288
361
|
try {
|
|
289
|
-
const
|
|
290
|
-
|
|
362
|
+
const g = await x.current();
|
|
363
|
+
o(g ? "saved" : "dirty");
|
|
291
364
|
} catch {
|
|
292
|
-
|
|
365
|
+
pe.error({
|
|
293
366
|
message: "Something went wrong while saving."
|
|
294
|
-
}),
|
|
367
|
+
}), o("dirty");
|
|
295
368
|
}
|
|
296
369
|
}
|
|
297
370
|
}, []);
|
|
298
|
-
|
|
299
|
-
if (
|
|
371
|
+
C(() => {
|
|
372
|
+
if (n !== "dirty")
|
|
300
373
|
return;
|
|
301
|
-
const
|
|
302
|
-
|
|
374
|
+
const g = (h) => {
|
|
375
|
+
Ne(h) && (h.preventDefault(), h.stopPropagation(), D());
|
|
303
376
|
};
|
|
304
|
-
return window.addEventListener("keydown",
|
|
305
|
-
window.removeEventListener("keydown",
|
|
377
|
+
return window.addEventListener("keydown", g, !0), () => {
|
|
378
|
+
window.removeEventListener("keydown", g, !0);
|
|
306
379
|
};
|
|
307
|
-
}, [
|
|
308
|
-
|
|
309
|
-
},
|
|
310
|
-
clearTimeout(
|
|
311
|
-
}), [
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
children:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
footer: s,
|
|
343
|
-
action: /* @__PURE__ */ e("div", {
|
|
344
|
-
className: c.headerAction,
|
|
345
|
-
children: /* @__PURE__ */ e(V, {
|
|
346
|
-
mode: "popLayout",
|
|
347
|
-
initial: !1,
|
|
348
|
-
children: S ? /* @__PURE__ */ e(A.div, {
|
|
349
|
-
className: c.saveAction,
|
|
350
|
-
initial: {
|
|
351
|
-
opacity: 0,
|
|
352
|
-
scale: 0.92
|
|
353
|
-
},
|
|
354
|
-
animate: {
|
|
355
|
-
opacity: 1,
|
|
356
|
-
scale: 1
|
|
357
|
-
},
|
|
358
|
-
exit: {
|
|
359
|
-
opacity: 0,
|
|
360
|
-
scale: 0.92
|
|
361
|
-
},
|
|
362
|
-
transition: O,
|
|
363
|
-
children: S
|
|
364
|
-
}, "save") : t ? /* @__PURE__ */ e(A.div, {
|
|
365
|
-
className: c.saveAction,
|
|
366
|
-
initial: {
|
|
367
|
-
opacity: 0
|
|
368
|
-
},
|
|
369
|
-
animate: {
|
|
370
|
-
opacity: 1
|
|
371
|
-
},
|
|
372
|
-
exit: {
|
|
373
|
-
opacity: 0
|
|
374
|
-
},
|
|
375
|
-
transition: O,
|
|
376
|
-
children: t
|
|
377
|
-
}, "header-right") : null
|
|
378
|
-
})
|
|
380
|
+
}, [D, n]), C(() => (n === "saved" && (f.current = setTimeout(() => {
|
|
381
|
+
o("idle");
|
|
382
|
+
}, xe)), () => {
|
|
383
|
+
clearTimeout(f.current);
|
|
384
|
+
}), [n]), C(() => {
|
|
385
|
+
if (d) {
|
|
386
|
+
if (n === "dirty" || n === "saving") {
|
|
387
|
+
d.unsaved();
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
d.saved();
|
|
391
|
+
}
|
|
392
|
+
}, [d, n]), C(() => {
|
|
393
|
+
if (i)
|
|
394
|
+
return i.current = () => n !== "dirty" && n !== "saving" ? !0 : ge(), () => {
|
|
395
|
+
i.current = null;
|
|
396
|
+
};
|
|
397
|
+
}, [i, n]);
|
|
398
|
+
const ee = j(() => ({
|
|
399
|
+
saveRef: x,
|
|
400
|
+
discardRef: T,
|
|
401
|
+
onDirtyChange: v,
|
|
402
|
+
setSaveVerb: S
|
|
403
|
+
}), [v]), te = Ae(u);
|
|
404
|
+
return /* @__PURE__ */ t(W, {
|
|
405
|
+
value: ee,
|
|
406
|
+
children: /* @__PURE__ */ t(X, {
|
|
407
|
+
className: a,
|
|
408
|
+
footer: n === "idle" ? r : /* @__PURE__ */ t(Ie, {
|
|
409
|
+
state: n,
|
|
410
|
+
copy: te,
|
|
411
|
+
onSave: () => {
|
|
412
|
+
D();
|
|
413
|
+
},
|
|
414
|
+
onDiscard: () => T.current?.()
|
|
379
415
|
}),
|
|
380
|
-
|
|
416
|
+
action: e ? /* @__PURE__ */ t("div", {
|
|
417
|
+
className: l.headerAction,
|
|
418
|
+
children: e
|
|
419
|
+
}) : void 0,
|
|
420
|
+
children: c
|
|
381
421
|
})
|
|
382
422
|
});
|
|
383
423
|
}
|
|
384
|
-
const
|
|
385
|
-
Sidebar:
|
|
386
|
-
Content:
|
|
387
|
-
Pane:
|
|
388
|
-
Empty:
|
|
424
|
+
const Ze = Object.assign(q, {
|
|
425
|
+
Sidebar: J,
|
|
426
|
+
Content: $,
|
|
427
|
+
Pane: Q,
|
|
428
|
+
Empty: Z
|
|
389
429
|
});
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
430
|
+
q.displayName = "SettingsLayout";
|
|
431
|
+
J.displayName = "SettingsLayout.Sidebar";
|
|
432
|
+
$.displayName = "SettingsLayout.Content";
|
|
433
|
+
Q.displayName = "SettingsLayout.Pane";
|
|
434
|
+
Z.displayName = "SettingsLayout.Empty";
|
|
395
435
|
export {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
436
|
+
Ze as SettingsLayout,
|
|
437
|
+
L as useSettingsLayout,
|
|
438
|
+
Xe as useSettingsSave
|
|
399
439
|
};
|
|
400
440
|
//# sourceMappingURL=SettingsLayout.js.map
|