@uxf/cms 14.0.0 → 14.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/api/index.d.ts +2 -0
- package/api/index.js +2 -2
- package/api/swr.js +71 -6
- package/content-builder/content-builder-header.js +42 -3
- package/content-builder/content-builder.js +140 -18
- package/content-builder/content-builder.stories.js +24 -5
- package/content-builder/forms/content-builder-basic-form.js +212 -25
- package/content-builder/forms/content-builder-seo-form.js +92 -8
- package/forms/change-password-form/change-password-form.js +152 -15
- package/forms/components/wysiwyg-input/wysiwyg-input.js +188 -50
- package/forms/components/wysiwyg-input/wysiwyg-input.stories.js +127 -22
- package/forms/forgotten-password-form/forgotten-password-form.js +119 -15
- package/forms/invite-user-form/invite-user-form.js +171 -13
- package/forms/login-form/login-form.js +122 -13
- package/forms/renew-password-form/renew-password-form.js +148 -16
- package/lib/api/create-axios-instance.d.ts +3 -1
- package/lib/api/create-axios-request.d.ts +3 -1
- package/lib/api/create-axios-request.js +9 -2
- package/lib/api/create-axios-request.test.d.ts +1 -0
- package/lib/api/create-axios-request.test.js +32 -0
- package/lib/layout/layout.js +126 -28
- package/lib/layout/sidebar.js +65 -26
- package/lib/menu/ui/sub-menu/sub-menu-mobile.js +62 -14
- package/lib/menu/ui/sub-menu/sub-menu.js +66 -14
- package/lib/menu/ui/sub-menu/use-sub-menu.js +137 -34
- package/lib/menu/ui/user-menu.js +178 -14
- package/package.json +20 -20
- package/pages/content-builder/components/form-content.js +189 -38
- package/pages/content-builder/components/form-root-fields.js +3 -3
- package/pages/content-builder/components/form.js +142 -27
- package/pages/content-builder/components/header.js +44 -5
- package/pages/content-builder/content/feature-section.js +67 -15
- package/pages/content-builder/content/gallery.js +38 -6
- package/pages/content-builder/content/hero-section.js +39 -6
- package/pages/content-builder/content/people.js +64 -13
- package/pages/content-builder/content/wysiwyg.js +60 -6
- package/pages/content-builder/content-builder-page.js +120 -48
- package/pages/content-builder/content-field.js +216 -35
- package/pages/content-builder/content-header.js +100 -53
- package/pages/content-builder/context/details-visibility-context.js +95 -17
- package/pages/forgotten-password-page/forgotten-password-page.js +29 -46
- package/pages/grid-page/grid-page.js +291 -75
- package/pages/grid-page/use-hidden-columns.js +29 -8
- package/pages/invite-user-page/invite-user-page.js +39 -16
- package/pages/login-page/login-page.js +44 -50
- package/pages/renew-password-page/renew-password-page.js +35 -43
- package/security/restricted-page.js +88 -10
- package/security/use-logged-user.js +33 -8
- package/ui/avatar/avatar.js +3 -2
- package/ui/copy-to-clipboard/copy-to-clipboard.js +57 -44
- package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +47 -46
- package/utils/remove-confirm-handler.js +80 -11
- package/utils/use-viewport-height.js +25 -7
- package/utils/use-visual-viewport-height.js +5 -2
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.RenewPasswordForm = RenewPasswordForm;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const translations_1 = require("@uxf/core-react/translations");
|
|
38
39
|
const form_1 = require("@uxf/form/form");
|
|
39
40
|
const text_input_1 = require("@uxf/form/text-input");
|
|
@@ -41,22 +42,153 @@ const button_1 = require("@uxf/ui/button");
|
|
|
41
42
|
const react_1 = __importStar(require("react"));
|
|
42
43
|
const react_hook_form_1 = require("react-hook-form");
|
|
43
44
|
function RenewPasswordForm(props) {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const $ = (0, compiler_runtime_1.c)(38);
|
|
46
|
+
let defaultValues;
|
|
47
|
+
let formProps;
|
|
48
|
+
if ($[0] !== props) {
|
|
49
|
+
({
|
|
50
|
+
defaultValues,
|
|
51
|
+
...formProps
|
|
52
|
+
} = props);
|
|
53
|
+
$[0] = props;
|
|
54
|
+
$[1] = defaultValues;
|
|
55
|
+
$[2] = formProps;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
defaultValues = $[1];
|
|
59
|
+
formProps = $[2];
|
|
60
|
+
}
|
|
46
61
|
const t = (0, translations_1.useUxfTranslation)();
|
|
47
62
|
const [formDisabled, setFormDisabled] = (0, react_1.useState)(true);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
let t0;
|
|
64
|
+
if ($[3] !== defaultValues) {
|
|
65
|
+
t0 = {
|
|
66
|
+
defaultValues
|
|
67
|
+
};
|
|
68
|
+
$[3] = defaultValues;
|
|
69
|
+
$[4] = t0;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
t0 = $[4];
|
|
73
|
+
}
|
|
74
|
+
const formApi = (0, react_hook_form_1.useForm)(t0);
|
|
75
|
+
let t1;
|
|
76
|
+
let t2;
|
|
77
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
78
|
+
t1 = () => {
|
|
79
|
+
setFormDisabled(false);
|
|
80
|
+
};
|
|
81
|
+
t2 = [];
|
|
82
|
+
$[5] = t1;
|
|
83
|
+
$[6] = t2;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
t1 = $[5];
|
|
87
|
+
t2 = $[6];
|
|
88
|
+
}
|
|
89
|
+
(0, react_1.useEffect)(t1, t2);
|
|
90
|
+
const t3 = formApi.control;
|
|
91
|
+
let t4;
|
|
92
|
+
if ($[7] !== t) {
|
|
93
|
+
t4 = t("uxf-cms-renew-password-form:new-password");
|
|
94
|
+
$[7] = t;
|
|
95
|
+
$[8] = t4;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
t4 = $[8];
|
|
99
|
+
}
|
|
100
|
+
let t5;
|
|
101
|
+
if ($[9] !== formApi.control || $[10] !== formDisabled || $[11] !== props.passwordRules || $[12] !== t4) {
|
|
102
|
+
t5 = react_1.default.createElement(text_input_1.TextInput, { control: t3, isDisabled: formDisabled, isRequired: true, label: t4, name: "password", rules: props.passwordRules, type: "password" });
|
|
103
|
+
$[9] = formApi.control;
|
|
104
|
+
$[10] = formDisabled;
|
|
105
|
+
$[11] = props.passwordRules;
|
|
106
|
+
$[12] = t4;
|
|
107
|
+
$[13] = t5;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
t5 = $[13];
|
|
111
|
+
}
|
|
112
|
+
const t6 = formApi.control;
|
|
113
|
+
let t7;
|
|
114
|
+
if ($[14] !== t) {
|
|
115
|
+
t7 = t("uxf-cms-renew-password-form:new-password-again");
|
|
116
|
+
$[14] = t;
|
|
117
|
+
$[15] = t7;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
t7 = $[15];
|
|
121
|
+
}
|
|
122
|
+
let t8;
|
|
123
|
+
if ($[16] !== formApi || $[17] !== t) {
|
|
124
|
+
t8 = {
|
|
125
|
+
validate: v => v === formApi.getValues("password") || t("uxf-cms-renew-password-form:passwords-must-match")
|
|
126
|
+
};
|
|
127
|
+
$[16] = formApi;
|
|
128
|
+
$[17] = t;
|
|
129
|
+
$[18] = t8;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
t8 = $[18];
|
|
133
|
+
}
|
|
134
|
+
let t9;
|
|
135
|
+
if ($[19] !== formApi.control || $[20] !== formDisabled || $[21] !== t7 || $[22] !== t8) {
|
|
136
|
+
t9 = react_1.default.createElement(text_input_1.TextInput, { control: t6, isDisabled: formDisabled, isRequired: true, label: t7, name: "passwordAgain", rules: t8, type: "password" });
|
|
137
|
+
$[19] = formApi.control;
|
|
138
|
+
$[20] = formDisabled;
|
|
139
|
+
$[21] = t7;
|
|
140
|
+
$[22] = t8;
|
|
141
|
+
$[23] = t9;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
t9 = $[23];
|
|
145
|
+
}
|
|
146
|
+
const t10 = formDisabled || formApi.formState.isSubmitting;
|
|
147
|
+
const t11 = formApi.formState.isSubmitting;
|
|
148
|
+
let t12;
|
|
149
|
+
if ($[24] !== t) {
|
|
150
|
+
t12 = t("uxf-cms-renew-password-form:change-password");
|
|
151
|
+
$[24] = t;
|
|
152
|
+
$[25] = t12;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
t12 = $[25];
|
|
156
|
+
}
|
|
157
|
+
let t13;
|
|
158
|
+
if ($[26] !== formApi.formState.isSubmitting || $[27] !== t10 || $[28] !== t12) {
|
|
159
|
+
t13 = react_1.default.createElement(button_1.Button, { isDisabled: t10, isFullWidth: true, isLoading: t11, type: "submit" }, t12);
|
|
160
|
+
$[26] = formApi.formState.isSubmitting;
|
|
161
|
+
$[27] = t10;
|
|
162
|
+
$[28] = t12;
|
|
163
|
+
$[29] = t13;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
t13 = $[29];
|
|
167
|
+
}
|
|
168
|
+
let t14;
|
|
169
|
+
if ($[30] !== t13 || $[31] !== t5 || $[32] !== t9) {
|
|
170
|
+
t14 = react_1.default.createElement("div", { className: "space-y-6" },
|
|
171
|
+
t5,
|
|
172
|
+
t9,
|
|
173
|
+
t13);
|
|
174
|
+
$[30] = t13;
|
|
175
|
+
$[31] = t5;
|
|
176
|
+
$[32] = t9;
|
|
177
|
+
$[33] = t14;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
t14 = $[33];
|
|
181
|
+
}
|
|
182
|
+
let t15;
|
|
183
|
+
if ($[34] !== formApi || $[35] !== formProps || $[36] !== t14) {
|
|
184
|
+
t15 = react_1.default.createElement(form_1.Form, { formApi: formApi, id: "renew-password-form", ...formProps }, t14);
|
|
185
|
+
$[34] = formApi;
|
|
186
|
+
$[35] = formProps;
|
|
187
|
+
$[36] = t14;
|
|
188
|
+
$[37] = t15;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
t15 = $[37];
|
|
192
|
+
}
|
|
193
|
+
return t15;
|
|
62
194
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import axios, { AxiosRequestConfig } from "axios";
|
|
2
2
|
export declare function createAxiosInstance(baseURL: string, requestConfig?: AxiosRequestConfig): {
|
|
3
3
|
axiosInstance: axios.AxiosInstance;
|
|
4
|
-
axiosRequest: <Response>(ctx: any, url: string, method: axios.Method, body: object | null, query: object | null
|
|
4
|
+
axiosRequest: <Response>(ctx: any, url: string, method: axios.Method, body: object | null, query: object | null, options?: {
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}) => Promise<axios.AxiosResponse<Response, any, {}, any>>;
|
|
5
7
|
useAxiosRequest: <Response extends Record<string, any> | boolean, RequestBody extends Record<string, any> | null, RequestQuery extends Record<string, any> | null, RequestPath extends Record<string, any> | null>(url: string, method: axios.Method, config: import("./types").RequestConfig<RequestBody, RequestQuery, RequestPath>) => [import("axios-hooks").ResponseValues<Response, any, any>, import("./types").Execute<Response, RequestBody, RequestQuery, RequestPath>];
|
|
6
8
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, Method } from "axios";
|
|
2
2
|
/** @deprecated use swr */
|
|
3
|
-
export declare const createAxiosRequest: (baseURL: string, axiosInstance: AxiosInstance, requestConfig: AxiosRequestConfig) => <Response>(ctx: any, url: string, method: Method, body: object | null, query: object | null
|
|
3
|
+
export declare const createAxiosRequest: (baseURL: string, axiosInstance: AxiosInstance, requestConfig: AxiosRequestConfig) => <Response>(ctx: any, url: string, method: Method, body: object | null, query: object | null, options?: {
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
}) => Promise<import("axios").AxiosResponse<Response, any, {}, any>>;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAxiosRequest = void 0;
|
|
4
4
|
const qs_1 = require("@uxf/core/utils/qs");
|
|
5
|
+
const axios_1 = require("axios");
|
|
5
6
|
const bad_request_error_1 = require("../../errors/bad-request-error");
|
|
6
7
|
const forbidden_error_1 = require("../../errors/forbidden-error");
|
|
7
8
|
const network_error_1 = require("../../errors/network-error");
|
|
8
9
|
const unauthorized_error_1 = require("../../errors/unauthorized-error");
|
|
9
10
|
/** @deprecated use swr */
|
|
10
|
-
const createAxiosRequest = (baseURL, axiosInstance, requestConfig) => (ctx, url, method, body, query) => {
|
|
11
|
-
var _a;
|
|
11
|
+
const createAxiosRequest = (baseURL, axiosInstance, requestConfig) => (ctx, url, method, body, query, options) => {
|
|
12
|
+
var _a, _b;
|
|
12
13
|
return axiosInstance
|
|
13
14
|
.request({
|
|
14
15
|
baseURL,
|
|
@@ -17,8 +18,14 @@ const createAxiosRequest = (baseURL, axiosInstance, requestConfig) => (ctx, url,
|
|
|
17
18
|
url: query && Object.keys(query).length > 0 ? `${url}?${(0, qs_1.stringify)(query)}` : url,
|
|
18
19
|
method,
|
|
19
20
|
data: body,
|
|
21
|
+
signal: (_b = options === null || options === void 0 ? void 0 : options.signal) !== null && _b !== void 0 ? _b : requestConfig.signal,
|
|
20
22
|
})
|
|
21
23
|
.catch((error) => {
|
|
24
|
+
// An aborted request carries the request it sent and no response, which the branches below would
|
|
25
|
+
// report as a network failure.
|
|
26
|
+
if ((0, axios_1.isCancel)(error)) {
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
22
29
|
if (error.response) {
|
|
23
30
|
if (error.response.status === 400) {
|
|
24
31
|
throw new bad_request_error_1.BadRequestError(error.response.data);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const axios_1 = require("axios");
|
|
4
|
+
const network_error_1 = require("../../errors/network-error");
|
|
5
|
+
const create_axios_request_1 = require("./create-axios-request");
|
|
6
|
+
function createInstance(request) {
|
|
7
|
+
return { request };
|
|
8
|
+
}
|
|
9
|
+
test("passes the abort signal on to axios", async () => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const request = jest.fn(() => Promise.resolve({ data: [] }));
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
await (0, create_axios_request_1.createAxiosRequest)("", createInstance(request), {})(null, "/api/x", "get", null, null, {
|
|
14
|
+
signal: controller.signal,
|
|
15
|
+
});
|
|
16
|
+
expect((_b = (_a = request.mock.calls.at(0)) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.signal).toBe(controller.signal);
|
|
17
|
+
});
|
|
18
|
+
test("rejects a cancelled request as cancelled, not as a network error", async () => {
|
|
19
|
+
// As axios rejects an aborted request: with the request it sent, which the error mapping took for a request
|
|
20
|
+
// that got no response.
|
|
21
|
+
const request = jest.fn(() => Promise.reject(new axios_1.CanceledError(undefined, undefined, {})));
|
|
22
|
+
const result = (0, create_axios_request_1.createAxiosRequest)("", createInstance(request), {})(null, "/api/x", "get", null, null);
|
|
23
|
+
await expect(result).rejects.toBeInstanceOf(axios_1.CanceledError);
|
|
24
|
+
await expect(result).rejects.not.toBeInstanceOf(network_error_1.NetworkError);
|
|
25
|
+
});
|
|
26
|
+
test("keeps a signal configured on the instance when the call passes none", async () => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const request = jest.fn(() => Promise.resolve({ data: [] }));
|
|
29
|
+
const controller = new AbortController();
|
|
30
|
+
await (0, create_axios_request_1.createAxiosRequest)("", createInstance(request), { signal: controller.signal })(null, "/api/x", "get", null, null);
|
|
31
|
+
expect((_b = (_a = request.mock.calls.at(0)) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.signal).toBe(controller.signal);
|
|
32
|
+
});
|
package/lib/layout/layout.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.Layout = void 0;
|
|
8
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
8
9
|
const rem_1 = require("@uxf/styles/units/rem");
|
|
9
10
|
const loader_1 = require("@uxf/ui/loader/loader");
|
|
10
11
|
const head_1 = __importDefault(require("next/head"));
|
|
@@ -13,35 +14,132 @@ const breadcrumbs_1 = require("./breadcrumbs");
|
|
|
13
14
|
const layout_container_1 = require("./layout-container");
|
|
14
15
|
const sidebar_1 = require("./sidebar");
|
|
15
16
|
const styles_1 = require("./styles");
|
|
16
|
-
const Layout =
|
|
17
|
+
const Layout = props => {
|
|
17
18
|
var _a, _b;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
react_1.default.createElement("
|
|
19
|
+
const $ = (0, compiler_runtime_1.c)(33);
|
|
20
|
+
let t0;
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
|
+
t0 = react_1.default.createElement("meta", { content: "width=device-width, initial-scale=1", name: "viewport" });
|
|
24
|
+
t1 = react_1.default.createElement("meta", { charSet: "utf-8" });
|
|
25
|
+
$[0] = t0;
|
|
26
|
+
$[1] = t1;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
t0 = $[0];
|
|
30
|
+
t1 = $[1];
|
|
31
|
+
}
|
|
32
|
+
const t2 = `${props.title} | ${props.appName}`;
|
|
33
|
+
let t3;
|
|
34
|
+
if ($[2] !== t2) {
|
|
35
|
+
t3 = react_1.default.createElement(head_1.default, null,
|
|
36
|
+
t0,
|
|
37
|
+
t1,
|
|
38
|
+
react_1.default.createElement("title", null, t2));
|
|
39
|
+
$[2] = t2;
|
|
40
|
+
$[3] = t3;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
t3 = $[3];
|
|
44
|
+
}
|
|
45
|
+
let t4;
|
|
46
|
+
if ($[4] !== props.Logo || $[5] !== props.menuConfiguration) {
|
|
47
|
+
t4 = react_1.default.createElement(sidebar_1.Sidebar, { Logo: props.Logo, menuConfiguration: props.menuConfiguration });
|
|
48
|
+
$[4] = props.Logo;
|
|
49
|
+
$[5] = props.menuConfiguration;
|
|
50
|
+
$[6] = t4;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
t4 = $[6];
|
|
54
|
+
}
|
|
55
|
+
const t5 = `uxf-cms-layout__main ${(_a = props.mainClassName) !== null && _a !== void 0 ? _a : ""}`;
|
|
56
|
+
let t6;
|
|
57
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
58
|
+
t6 = {
|
|
59
|
+
"--drawer-width": (0, rem_1.rem)(styles_1.drawerWidth)
|
|
60
|
+
};
|
|
61
|
+
$[7] = t6;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
t6 = $[7];
|
|
65
|
+
}
|
|
66
|
+
let t7;
|
|
67
|
+
if ($[8] !== props.Avatar || $[9] !== props.CustomHeader || $[10] !== props.Header || $[11] !== props.MessageBar || $[12] !== props.TitleRightContainer || $[13] !== props.ToolbarRight || $[14] !== props.breadcrumbs || $[15] !== props.children || $[16] !== props.containerType || $[17] !== props.headerContainerType || $[18] !== props.loading || $[19] !== props.stickyHeader || $[20] !== props.subtitle || $[21] !== props.title) {
|
|
68
|
+
t7 = props.loading ? react_1.default.createElement("div", { className: "uxf-cms-layout__loading" },
|
|
69
|
+
react_1.default.createElement("div", { className: "uxf-cms-layout__loading-inner" },
|
|
70
|
+
react_1.default.createElement(loader_1.Loader, null),
|
|
71
|
+
react_1.default.createElement("p", { className: "uxf-cms-layout__loading-text" }, "Na\u010D\u00EDt\u00E1m\u2026"))) : react_1.default.createElement(react_1.default.Fragment, null,
|
|
72
|
+
props.CustomHeader ? props.CustomHeader : react_1.default.createElement("div", { className: `${props.Header ? "uxf-cms-layout__header" : ""} ${props.stickyHeader ? "uxf-cms-layout__header--sticky" : ""}` },
|
|
73
|
+
props.ToolbarRight && react_1.default.createElement("div", { className: "uxf-cms-layout__toolbar" }, props.ToolbarRight),
|
|
74
|
+
props.MessageBar,
|
|
75
|
+
react_1.default.createElement(layout_container_1.LayoutContainer, { className: "uxf-cms-layout__container--basic", type: (_b = props.headerContainerType) !== null && _b !== void 0 ? _b : props.containerType },
|
|
76
|
+
react_1.default.createElement("div", { className: "uxf-cms-layout__avatar-title-wrapper" },
|
|
77
|
+
props.Avatar,
|
|
78
|
+
react_1.default.createElement("div", { className: "uxf-cms-layout__breadcrumbs-title-wrapper" },
|
|
79
|
+
props.breadcrumbs && react_1.default.createElement(breadcrumbs_1.Breadcrumbs, { items: props.breadcrumbs }),
|
|
80
|
+
react_1.default.createElement("div", { className: "uxf-cms-layout__title-wrapper" },
|
|
81
|
+
react_1.default.createElement("h1", { className: "uxf-cms-layout__title" }, props.title),
|
|
82
|
+
props.TitleRightContainer),
|
|
83
|
+
props.subtitle,
|
|
84
|
+
props.Header)))),
|
|
85
|
+
react_1.default.createElement(layout_container_1.LayoutContainer, { type: props.containerType }, props.children));
|
|
86
|
+
$[8] = props.Avatar;
|
|
87
|
+
$[9] = props.CustomHeader;
|
|
88
|
+
$[10] = props.Header;
|
|
89
|
+
$[11] = props.MessageBar;
|
|
90
|
+
$[12] = props.TitleRightContainer;
|
|
91
|
+
$[13] = props.ToolbarRight;
|
|
92
|
+
$[14] = props.breadcrumbs;
|
|
93
|
+
$[15] = props.children;
|
|
94
|
+
$[16] = props.containerType;
|
|
95
|
+
$[17] = props.headerContainerType;
|
|
96
|
+
$[18] = props.loading;
|
|
97
|
+
$[19] = props.stickyHeader;
|
|
98
|
+
$[20] = props.subtitle;
|
|
99
|
+
$[21] = props.title;
|
|
100
|
+
$[22] = t7;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
t7 = $[22];
|
|
104
|
+
}
|
|
105
|
+
let t8;
|
|
106
|
+
if ($[23] !== props.FooterBar || $[24] !== t5 || $[25] !== t7) {
|
|
107
|
+
t8 = react_1.default.createElement("main", { className: t5, style: t6 },
|
|
108
|
+
t7,
|
|
109
|
+
props.FooterBar);
|
|
110
|
+
$[23] = props.FooterBar;
|
|
111
|
+
$[24] = t5;
|
|
112
|
+
$[25] = t7;
|
|
113
|
+
$[26] = t8;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
t8 = $[26];
|
|
117
|
+
}
|
|
118
|
+
let t9;
|
|
119
|
+
if ($[27] !== t4 || $[28] !== t8) {
|
|
120
|
+
t9 = react_1.default.createElement("div", { className: "uxf-cms-layout" },
|
|
24
121
|
react_1.default.createElement("div", { className: "uxf-cms-layout__wrapper" },
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
122
|
+
t4,
|
|
123
|
+
t8));
|
|
124
|
+
$[27] = t4;
|
|
125
|
+
$[28] = t8;
|
|
126
|
+
$[29] = t9;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
t9 = $[29];
|
|
130
|
+
}
|
|
131
|
+
let t10;
|
|
132
|
+
if ($[30] !== t3 || $[31] !== t9) {
|
|
133
|
+
t10 = react_1.default.createElement(react_1.default.Fragment, null,
|
|
134
|
+
t3,
|
|
135
|
+
t9);
|
|
136
|
+
$[30] = t3;
|
|
137
|
+
$[31] = t9;
|
|
138
|
+
$[32] = t10;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
t10 = $[32];
|
|
142
|
+
}
|
|
143
|
+
return t10;
|
|
46
144
|
};
|
|
47
145
|
exports.Layout = Layout;
|
package/lib/layout/sidebar.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Sidebar = void 0;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const use_media_query_1 = require("@uxf/core-react/hooks/use-media-query");
|
|
38
39
|
const rem_1 = require("@uxf/styles/units/rem");
|
|
39
40
|
const react_1 = __importStar(require("react"));
|
|
@@ -43,37 +44,75 @@ const menu_1 = require("../menu");
|
|
|
43
44
|
const mobile_bar_1 = require("../menu/mobile-bar");
|
|
44
45
|
const user_menu_1 = require("../menu/ui/user-menu");
|
|
45
46
|
const styles_1 = require("./styles");
|
|
46
|
-
const uxfLogo =
|
|
47
|
+
const uxfLogo = react_1.default.createElement("svg", { height: "30", viewBox: "0 0 179 40", width: "134" },
|
|
47
48
|
react_1.default.createElement("path", { clipRule: "evenodd", d: "M33.563 12.874a9.103 9.103 0 0 0 0-12.874L20.69 12.874l.107.105a9.103 9.103 0 0 0 12.766-.105Zm-20.69-6.437a9.103 9.103 0 0 1 .106 12.766l-.105.107L0 6.437a9.103 9.103 0 0 1 12.874 0ZM40 33.563 27.127 20.69l-.106.107a9.103 9.103 0 0 0 12.98 12.766Zm-20.69-6.437-.107-.105A9.103 9.103 0 0 0 6.437 40l12.874-12.874Z", fill: "#FFF", fillRule: "evenodd" }),
|
|
48
|
-
react_1.default.createElement("path", { clipRule: "evenodd", d: "m84.325 7.295 5.133 8.675h.199l5.158-8.675h6.078l-7.768 12.727 7.942 12.727h-6.19l-5.22-8.687h-.199l-5.22 8.687h-6.165l7.967-12.727-7.818-12.727h6.103Zm-24.194 0v16.07c0 .97.214 1.832.64 2.586a4.58 4.58 0 0 0 1.809 1.777c.779.431 1.686.647 2.722.647 1.044 0 1.953-.216 2.728-.647a4.591 4.591 0 0 0 1.802-1.777c.427-.754.64-1.616.64-2.585V7.296h5.382v16.53c0 1.856-.441 3.48-1.324 4.872-.882 1.392-2.115 2.475-3.697 3.25-1.583.775-3.426 1.162-5.531 1.162-2.113 0-3.96-.387-5.543-1.162-1.583-.775-2.813-1.858-3.692-3.25-.878-1.392-1.317-3.016-1.317-4.872V7.296h5.381ZM170.25 13.41c2.411 0 4.311.51 5.698 1.529 1.388 1.019 2.198 2.407 2.43 4.164l-4.847.298a2.555 2.555 0 0 0-.534-1.125 2.942 2.942 0 0 0-1.075-.808c-.444-.203-.972-.304-1.585-.304-.821 0-1.512.172-2.076.515-.563.344-.845.802-.845 1.374 0 .456.182.84.547 1.156.364.315.99.567 1.877.758l3.455.696c1.856.381 3.24.994 4.151 1.84.912.845 1.367 1.955 1.367 3.33 0 1.252-.366 2.35-1.1 3.294-.733.945-1.736 1.68-3.007 2.206-1.272.526-2.737.79-4.394.79-2.527 0-4.539-.529-6.034-1.585-1.496-1.057-2.372-2.496-2.629-4.32l5.208-.273c.157.77.538 1.357 1.143 1.759.605.402 1.38.603 2.324.603.928 0 1.676-.18 2.244-.54.567-.361.855-.827.864-1.4-.009-.48-.212-.875-.609-1.186-.398-.31-1.011-.55-1.84-.715l-3.306-.659c-1.864-.372-3.25-1.019-4.157-1.938-.908-.92-1.361-2.093-1.361-3.518 0-1.226.333-2.283 1-3.17.667-.886 1.608-1.57 2.821-2.05 1.214-.48 2.637-.72 4.27-.72Zm-36.686.373a12.285 12.285 0 0 0-3.051-.373c-1.525 0-2.865.23-4.021.69-1.156.46-2.098 1.114-2.827 1.964-.73.849-1.219 1.854-1.467 3.014l4.897.397c.182-.63.555-1.153 1.119-1.572.563-.418 1.321-.627 2.274-.627.903 0 1.601.215 2.094.646.493.43.74 1.04.74 1.827v.075c0 .405-.153.712-.46.92-.307.206-.8.362-1.479.465-.68.104-1.574.214-2.685.33-.944.09-1.845.248-2.703.472a7.698 7.698 0 0 0-2.293.994 4.727 4.727 0 0 0-1.591 1.74c-.39.721-.584 1.612-.584 2.673 0 1.259.275 2.31.826 3.15a5.147 5.147 0 0 0 2.256 1.902c.953.427 2.038.64 3.257.64.944 0 1.777-.126 2.498-.38a5.55 5.55 0 0 0 1.852-1.055 5.31 5.31 0 0 0 1.23-1.573h.149v2.648h5.022V19.873c0-1.135-.22-2.11-.659-2.927a5.655 5.655 0 0 0-1.796-2.007 8.039 8.039 0 0 0-2.598-1.156Zm-13.424-2.05V7.294h-16.853v25.454h5.381V22.235h10.354v-4.438h-10.354v-6.065h11.472Zm32.603 1.677c1.326 0 2.482.29 3.468.87.986.58 1.753 1.407 2.3 2.48.546 1.073.82 2.35.82 3.834V32.75h-5.295V21.539c.008-1.169-.29-2.082-.895-2.74-.605-.66-1.437-.989-2.498-.989-.713 0-1.34.153-1.883.46a3.166 3.166 0 0 0-1.268 1.336c-.302.584-.458 1.286-.466 2.107V32.75h-5.295V13.659h5.047v3.368H147a5.358 5.358 0 0 1 2.126-2.641c.994-.65 2.2-.976 3.616-.976Zm-20.061 10.782c.286-.087.512-.184.678-.292v2.026c0 .671-.17 1.272-.51 1.802-.34.53-.808.951-1.404 1.262-.597.31-1.285.466-2.064.466-.812 0-1.481-.189-2.007-.566-.526-.377-.789-.925-.789-1.646 0-.497.128-.914.385-1.25.257-.335.617-.602 1.082-.801a6.547 6.547 0 0 1 1.628-.435l.969-.143a24.15 24.15 0 0 0 1.069-.186c.356-.071.677-.15.963-.237Z", fill: "#FFF", fillRule: "evenodd" }))
|
|
49
|
-
const Sidebar =
|
|
50
|
-
var _a, _b,
|
|
49
|
+
react_1.default.createElement("path", { clipRule: "evenodd", d: "m84.325 7.295 5.133 8.675h.199l5.158-8.675h6.078l-7.768 12.727 7.942 12.727h-6.19l-5.22-8.687h-.199l-5.22 8.687h-6.165l7.967-12.727-7.818-12.727h6.103Zm-24.194 0v16.07c0 .97.214 1.832.64 2.586a4.58 4.58 0 0 0 1.809 1.777c.779.431 1.686.647 2.722.647 1.044 0 1.953-.216 2.728-.647a4.591 4.591 0 0 0 1.802-1.777c.427-.754.64-1.616.64-2.585V7.296h5.382v16.53c0 1.856-.441 3.48-1.324 4.872-.882 1.392-2.115 2.475-3.697 3.25-1.583.775-3.426 1.162-5.531 1.162-2.113 0-3.96-.387-5.543-1.162-1.583-.775-2.813-1.858-3.692-3.25-.878-1.392-1.317-3.016-1.317-4.872V7.296h5.381ZM170.25 13.41c2.411 0 4.311.51 5.698 1.529 1.388 1.019 2.198 2.407 2.43 4.164l-4.847.298a2.555 2.555 0 0 0-.534-1.125 2.942 2.942 0 0 0-1.075-.808c-.444-.203-.972-.304-1.585-.304-.821 0-1.512.172-2.076.515-.563.344-.845.802-.845 1.374 0 .456.182.84.547 1.156.364.315.99.567 1.877.758l3.455.696c1.856.381 3.24.994 4.151 1.84.912.845 1.367 1.955 1.367 3.33 0 1.252-.366 2.35-1.1 3.294-.733.945-1.736 1.68-3.007 2.206-1.272.526-2.737.79-4.394.79-2.527 0-4.539-.529-6.034-1.585-1.496-1.057-2.372-2.496-2.629-4.32l5.208-.273c.157.77.538 1.357 1.143 1.759.605.402 1.38.603 2.324.603.928 0 1.676-.18 2.244-.54.567-.361.855-.827.864-1.4-.009-.48-.212-.875-.609-1.186-.398-.31-1.011-.55-1.84-.715l-3.306-.659c-1.864-.372-3.25-1.019-4.157-1.938-.908-.92-1.361-2.093-1.361-3.518 0-1.226.333-2.283 1-3.17.667-.886 1.608-1.57 2.821-2.05 1.214-.48 2.637-.72 4.27-.72Zm-36.686.373a12.285 12.285 0 0 0-3.051-.373c-1.525 0-2.865.23-4.021.69-1.156.46-2.098 1.114-2.827 1.964-.73.849-1.219 1.854-1.467 3.014l4.897.397c.182-.63.555-1.153 1.119-1.572.563-.418 1.321-.627 2.274-.627.903 0 1.601.215 2.094.646.493.43.74 1.04.74 1.827v.075c0 .405-.153.712-.46.92-.307.206-.8.362-1.479.465-.68.104-1.574.214-2.685.33-.944.09-1.845.248-2.703.472a7.698 7.698 0 0 0-2.293.994 4.727 4.727 0 0 0-1.591 1.74c-.39.721-.584 1.612-.584 2.673 0 1.259.275 2.31.826 3.15a5.147 5.147 0 0 0 2.256 1.902c.953.427 2.038.64 3.257.64.944 0 1.777-.126 2.498-.38a5.55 5.55 0 0 0 1.852-1.055 5.31 5.31 0 0 0 1.23-1.573h.149v2.648h5.022V19.873c0-1.135-.22-2.11-.659-2.927a5.655 5.655 0 0 0-1.796-2.007 8.039 8.039 0 0 0-2.598-1.156Zm-13.424-2.05V7.294h-16.853v25.454h5.381V22.235h10.354v-4.438h-10.354v-6.065h11.472Zm32.603 1.677c1.326 0 2.482.29 3.468.87.986.58 1.753 1.407 2.3 2.48.546 1.073.82 2.35.82 3.834V32.75h-5.295V21.539c.008-1.169-.29-2.082-.895-2.74-.605-.66-1.437-.989-2.498-.989-.713 0-1.34.153-1.883.46a3.166 3.166 0 0 0-1.268 1.336c-.302.584-.458 1.286-.466 2.107V32.75h-5.295V13.659h5.047v3.368H147a5.358 5.358 0 0 1 2.126-2.641c.994-.65 2.2-.976 3.616-.976Zm-20.061 10.782c.286-.087.512-.184.678-.292v2.026c0 .671-.17 1.272-.51 1.802-.34.53-.808.951-1.404 1.262-.597.31-1.285.466-2.064.466-.812 0-1.481-.189-2.007-.566-.526-.377-.789-.925-.789-1.646 0-.497.128-.914.385-1.25.257-.335.617-.602 1.082-.801a6.547 6.547 0 0 1 1.628-.435l.969-.143a24.15 24.15 0 0 0 1.069-.186c.356-.071.677-.15.963-.237Z", fill: "#FFF", fillRule: "evenodd" }));
|
|
50
|
+
const Sidebar = props => {
|
|
51
|
+
var _a, _b, _d, _e;
|
|
52
|
+
const $ = (0, compiler_runtime_1.c)(10);
|
|
51
53
|
const deviceHeight = (_a = (0, use_visual_viewport_height_1.useVisualViewportHeight)()) !== null && _a !== void 0 ? _a : 0;
|
|
52
54
|
const [isMenuOpen, setIsMenuOpen] = (0, react_1.useState)(false);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
let t0;
|
|
56
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
57
|
+
t0 = () => setIsMenuOpen(_temp);
|
|
58
|
+
$[0] = t0;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
t0 = $[0];
|
|
62
|
+
}
|
|
63
|
+
const toggleMenu = t0;
|
|
55
64
|
const isDesktop = (0, use_media_query_1.useMediaQuery)(`(min-width: ${tw_screens_1.twScreens.md})`);
|
|
56
65
|
const isPageLocked = isMenuOpen && !isDesktop;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
document.body.style.overflow =
|
|
66
|
+
let t1;
|
|
67
|
+
let t2;
|
|
68
|
+
if ($[1] !== isPageLocked) {
|
|
69
|
+
t1 = () => {
|
|
70
|
+
if (!isPageLocked) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const previousOverflow = document.body.style.overflow;
|
|
74
|
+
document.body.style.overflow = "hidden";
|
|
75
|
+
return () => {
|
|
76
|
+
document.body.style.overflow = previousOverflow;
|
|
77
|
+
};
|
|
66
78
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
t2 = [isPageLocked];
|
|
80
|
+
$[1] = isPageLocked;
|
|
81
|
+
$[2] = t1;
|
|
82
|
+
$[3] = t2;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
t1 = $[2];
|
|
86
|
+
t2 = $[3];
|
|
87
|
+
}
|
|
88
|
+
(0, react_1.useEffect)(t1, t2);
|
|
89
|
+
let t3;
|
|
90
|
+
if ($[4] !== deviceHeight || $[5] !== isMenuOpen || $[6] !== props.CustomSidebar || $[7] !== props.Logo || $[8] !== props.menuConfiguration) {
|
|
91
|
+
t3 = (_b = props.CustomSidebar) !== null && _b !== void 0 ? _b : react_1.default.createElement("div", { className: "uxf-cms-sidebar", style: {
|
|
92
|
+
"--drawer-width": (0, rem_1.rem)(styles_1.drawerWidth)
|
|
93
|
+
} },
|
|
94
|
+
react_1.default.createElement("div", { className: `uxf-cms-sidebar__content ${isMenuOpen ? "uxf-cms-sidebar__content--open" : "uxf-cms-sidebar__content--closed"}`, style: {
|
|
95
|
+
"--device-height": (0, rem_1.rem)(deviceHeight)
|
|
96
|
+
} },
|
|
97
|
+
react_1.default.createElement("div", { className: "uxf-cms-sidebar__logo" }, (_d = props.Logo) !== null && _d !== void 0 ? _d : uxfLogo),
|
|
98
|
+
props.menuConfiguration && props.menuConfiguration.length > 0 && react_1.default.createElement(react_1.default.Fragment, null,
|
|
99
|
+
react_1.default.createElement("div", { className: `uxf-cms-sidebar__nav ${((_e = props.menuConfiguration.at(0)) === null || _e === void 0 ? void 0 : _e.type) === "super-section" ? "uxf-cms-sidebar__nav--super-section" : ""}` },
|
|
100
|
+
react_1.default.createElement(menu_1.Menu, { menu: props.menuConfiguration })),
|
|
101
|
+
react_1.default.createElement(user_menu_1.UserMenu, { menu: props.menuConfiguration }))),
|
|
102
|
+
props.menuConfiguration && react_1.default.createElement(mobile_bar_1.MobileBar, { menuConfiguration: props.menuConfiguration, toggleMenu: toggleMenu }));
|
|
103
|
+
$[4] = deviceHeight;
|
|
104
|
+
$[5] = isMenuOpen;
|
|
105
|
+
$[6] = props.CustomSidebar;
|
|
106
|
+
$[7] = props.Logo;
|
|
107
|
+
$[8] = props.menuConfiguration;
|
|
108
|
+
$[9] = t3;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
t3 = $[9];
|
|
112
|
+
}
|
|
113
|
+
return t3;
|
|
78
114
|
};
|
|
79
115
|
exports.Sidebar = Sidebar;
|
|
116
|
+
function _temp(prev) {
|
|
117
|
+
return !prev;
|
|
118
|
+
}
|