@uxf/cms 13.0.3 → 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.
Files changed (69) hide show
  1. package/README.md +1 -1
  2. package/api/index.d.ts +2 -0
  3. package/api/index.js +2 -2
  4. package/api/swr.js +71 -6
  5. package/content-builder/content-builder-header.js +42 -3
  6. package/content-builder/content-builder.js +140 -18
  7. package/content-builder/content-builder.stories.js +24 -5
  8. package/content-builder/forms/content-builder-basic-form.js +212 -25
  9. package/content-builder/forms/content-builder-seo-form.js +92 -8
  10. package/forms/change-password-form/change-password-form.js +152 -15
  11. package/forms/components/wysiwyg-input/wysiwyg-input.js +188 -50
  12. package/forms/components/wysiwyg-input/wysiwyg-input.stories.js +127 -22
  13. package/forms/forgotten-password-form/forgotten-password-form.js +119 -15
  14. package/forms/invite-user-form/invite-user-form.js +171 -13
  15. package/forms/login-form/login-form.js +122 -13
  16. package/forms/renew-password-form/renew-password-form.js +148 -16
  17. package/lib/api/create-axios-instance.d.ts +3 -1
  18. package/lib/api/create-axios-request.d.ts +3 -1
  19. package/lib/api/create-axios-request.js +9 -2
  20. package/lib/api/create-axios-request.test.d.ts +1 -0
  21. package/lib/api/create-axios-request.test.js +32 -0
  22. package/lib/layout/layout.js +126 -28
  23. package/lib/layout/sidebar.js +69 -38
  24. package/lib/menu/ui/menu-item.js +5 -2
  25. package/lib/menu/ui/sub-menu/sub-menu-mobile.js +62 -14
  26. package/lib/menu/ui/sub-menu/sub-menu.js +66 -14
  27. package/lib/menu/ui/sub-menu/use-sub-menu.js +137 -34
  28. package/lib/menu/ui/user-menu.js +178 -14
  29. package/package.json +21 -21
  30. package/pages/content-builder/components/form-content.js +189 -38
  31. package/pages/content-builder/components/form-root-fields.js +3 -3
  32. package/pages/content-builder/components/form.js +142 -27
  33. package/pages/content-builder/components/header.js +44 -5
  34. package/pages/content-builder/content/feature-section.js +67 -15
  35. package/pages/content-builder/content/gallery.js +38 -6
  36. package/pages/content-builder/content/hero-section.js +39 -6
  37. package/pages/content-builder/content/people.js +64 -13
  38. package/pages/content-builder/content/wysiwyg.js +60 -6
  39. package/pages/content-builder/content-builder-page.js +120 -48
  40. package/pages/content-builder/content-field.js +216 -35
  41. package/pages/content-builder/content-header-behaviour.spec.d.ts +1 -0
  42. package/pages/content-builder/content-header-behaviour.spec.js +22 -0
  43. package/pages/content-builder/content-header.js +100 -53
  44. package/pages/content-builder/context/details-visibility-context.js +96 -18
  45. package/pages/forgotten-password-page/forgotten-password-page.js +29 -46
  46. package/pages/grid-page/grid-page.js +292 -76
  47. package/pages/grid-page/history-pathname.d.ts +6 -0
  48. package/pages/grid-page/history-pathname.js +11 -0
  49. package/pages/grid-page/history-pathname.test.d.ts +1 -0
  50. package/pages/grid-page/history-pathname.test.js +11 -0
  51. package/pages/grid-page/use-hidden-columns.js +29 -8
  52. package/pages/invite-user-page/invite-user-page.js +39 -16
  53. package/pages/login-page/login-page.js +44 -50
  54. package/pages/renew-password-page/renew-password-page.js +35 -43
  55. package/pages/translations.d.ts +3 -0
  56. package/pages/translations.js +3 -0
  57. package/security/restricted-page.js +88 -10
  58. package/security/use-logged-user.js +33 -8
  59. package/translations/cs.json +2 -1
  60. package/translations/translations.d.ts +3 -0
  61. package/ui/avatar/avatar.js +3 -2
  62. package/ui/copy-to-clipboard/copy-to-clipboard.js +57 -44
  63. package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +47 -46
  64. package/utils/remove-confirm-handler.js +80 -11
  65. package/utils/use-viewport-height.js +26 -20
  66. package/utils/use-viewport-height.test.d.ts +1 -0
  67. package/utils/use-viewport-height.test.js +37 -0
  68. package/utils/use-visual-viewport-height.d.ts +2 -0
  69. package/utils/use-visual-viewport-height.js +26 -0
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.WysiwygInput = WysiwygInput;
37
+ const compiler_runtime_1 = require("react/compiler-runtime");
37
38
  const classes_1 = require("@uxf/core/constants/classes");
38
39
  const cx_1 = require("@uxf/core/utils/cx");
39
40
  const file_1 = require("@uxf/core/utils/file");
@@ -47,59 +48,196 @@ const react_1 = __importStar(require("react"));
47
48
  const react_hook_form_1 = require("react-hook-form");
48
49
  const api_1 = require("../../../api");
49
50
  function WysiwygInput(props) {
50
- var _a, _b, _c, _d;
51
+ var _a, _b, _d, _e, _f;
52
+ const $ = (0, compiler_runtime_1.c)(65);
51
53
  const t = (0, translations_1.useUxfTranslation)();
52
- const { field, fieldState } = (0, react_hook_form_1.useController)({
53
- control: props.control,
54
- defaultValue: props.defaultValue,
55
- name: props.name,
56
- rules: {
57
- required: props.isRequired
58
- ? props.requiredMessage || t("uxf-cms-wysiwyg-input:validation.required")
59
- : undefined,
60
- ...props.rules,
61
- },
62
- shouldUnregister: props.shouldUnregister,
63
- });
64
- const plugins = (0, react_1.useMemo)(() => {
65
- var _a;
66
- return props.plugins && props.plugins.length > 0
67
- ? (0, wysiwyg_1.createPluginsWithUi)(props.plugins)
68
- : (0, create_all_plugins_with_ui_1.createAllPluginsWithUi)((_a = props.allPluginsOptions) !== null && _a !== void 0 ? _a : { image: { getImageUrl: file_1.getFileUrl, uploadImage: api_1.uploadFile } });
69
- }, [props.allPluginsOptions, props.plugins]);
54
+ let t0;
55
+ if ($[0] !== props.isRequired || $[1] !== props.requiredMessage || $[2] !== t) {
56
+ t0 = props.isRequired ? props.requiredMessage || t("uxf-cms-wysiwyg-input:validation.required") : undefined;
57
+ $[0] = props.isRequired;
58
+ $[1] = props.requiredMessage;
59
+ $[2] = t;
60
+ $[3] = t0;
61
+ }
62
+ else {
63
+ t0 = $[3];
64
+ }
65
+ let t1;
66
+ if ($[4] !== props.rules || $[5] !== t0) {
67
+ t1 = {
68
+ required: t0,
69
+ ...props.rules
70
+ };
71
+ $[4] = props.rules;
72
+ $[5] = t0;
73
+ $[6] = t1;
74
+ }
75
+ else {
76
+ t1 = $[6];
77
+ }
78
+ let t2;
79
+ if ($[7] !== props.control || $[8] !== props.defaultValue || $[9] !== props.name || $[10] !== props.shouldUnregister || $[11] !== t1) {
80
+ t2 = {
81
+ control: props.control,
82
+ defaultValue: props.defaultValue,
83
+ name: props.name,
84
+ rules: t1,
85
+ shouldUnregister: props.shouldUnregister
86
+ };
87
+ $[7] = props.control;
88
+ $[8] = props.defaultValue;
89
+ $[9] = props.name;
90
+ $[10] = props.shouldUnregister;
91
+ $[11] = t1;
92
+ $[12] = t2;
93
+ }
94
+ else {
95
+ t2 = $[12];
96
+ }
97
+ const { field, fieldState } = (0, react_hook_form_1.useController)(t2);
98
+ let t3;
99
+ if ($[13] !== props.allPluginsOptions || $[14] !== props.plugins) {
100
+ t3 = props.plugins && props.plugins.length > 0 ? (0, wysiwyg_1.createPluginsWithUi)(props.plugins) : (0, create_all_plugins_with_ui_1.createAllPluginsWithUi)((_a = props.allPluginsOptions) !== null && _a !== void 0 ? _a : {
101
+ image: {
102
+ getImageUrl: file_1.getFileUrl,
103
+ uploadImage: api_1.uploadFile
104
+ }
105
+ });
106
+ $[13] = props.allPluginsOptions;
107
+ $[14] = props.plugins;
108
+ $[15] = t3;
109
+ }
110
+ else {
111
+ t3 = $[15];
112
+ }
113
+ const plugins = t3;
70
114
  const generatedId = (0, react_1.useId)();
71
- const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
115
+ const id = (_b = props.id) !== null && _b !== void 0 ? _b : generatedId;
72
116
  const innerRef = (0, react_1.useRef)(null);
73
117
  const editorRef = (0, react_1.useRef)(null);
74
118
  const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
75
- const isInvalid = (0, is_not_nil_1.isNotNil)(fieldState.error);
76
- const errorId = isInvalid ? `${props.id}--error-message` : undefined;
77
- const rootClassName = (0, cx_1.cx)("uxf-text-input", ((_b = props._isFocused) !== null && _b !== void 0 ? _b : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
78
- const onFocus = (0, react_1.useCallback)((e) => {
79
- var _a, _b;
80
- input.onFocus(e);
81
- (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
82
- // Trigger editor focus via ref
83
- (_b = editorRef.current) === null || _b === void 0 ? void 0 : _b.focus();
84
- }, [input, props]);
85
- const onBlur = (0, react_1.useCallback)((e) => {
86
- var _a;
87
- field.onBlur();
88
- input.onBlur(e);
89
- (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
90
- }, [field, input, props]);
91
- return (react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: errorId, form: props.form, helperText: (_d = (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label, name: props.name },
92
- react_1.default.createElement(wysiwyg_1.WysiwygEditor, { customPluginsToolbarButtons: props.customPluginsToolbarButtons, editableProps: {
93
- "aria-describedby": errorId,
94
- "aria-invalid": isInvalid,
95
- autoComplete: props.autoComplete,
96
- disabled: props.isDisabled,
97
- form: props.form,
98
- onBlur,
99
- onFocus,
100
- onKeyDown: props.onKeyDown,
101
- placeholder: props.placeholder,
102
- readOnly: props.isReadOnly,
103
- required: props.isRequired,
104
- }, id: id, initialValue: field.value, onChange: field.onChange, plugins: plugins, ref: editorRef, ...props.editorProps })));
119
+ let errorId;
120
+ let isInvalid;
121
+ let t4;
122
+ if ($[16] !== fieldState.error || $[17] !== input || $[18] !== props._isFocused || $[19] !== props.className || $[20] !== props.id || $[21] !== props.isDisabled || $[22] !== props.isReadOnly || $[23] !== props.isRequired) {
123
+ isInvalid = (0, is_not_nil_1.isNotNil)(fieldState.error);
124
+ errorId = isInvalid ? `${props.id}--error-message` : undefined;
125
+ t4 = (0, cx_1.cx)("uxf-text-input", ((_d = props._isFocused) !== null && _d !== void 0 ? _d : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
126
+ $[16] = fieldState.error;
127
+ $[17] = input;
128
+ $[18] = props._isFocused;
129
+ $[19] = props.className;
130
+ $[20] = props.id;
131
+ $[21] = props.isDisabled;
132
+ $[22] = props.isReadOnly;
133
+ $[23] = props.isRequired;
134
+ $[24] = errorId;
135
+ $[25] = isInvalid;
136
+ $[26] = t4;
137
+ }
138
+ else {
139
+ errorId = $[24];
140
+ isInvalid = $[25];
141
+ t4 = $[26];
142
+ }
143
+ const rootClassName = t4;
144
+ let t5;
145
+ if ($[27] !== input || $[28] !== props) {
146
+ t5 = e => {
147
+ var _a, _b;
148
+ input.onFocus(e);
149
+ (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
150
+ (_b = editorRef.current) === null || _b === void 0 ? void 0 : _b.focus();
151
+ };
152
+ $[27] = input;
153
+ $[28] = props;
154
+ $[29] = t5;
155
+ }
156
+ else {
157
+ t5 = $[29];
158
+ }
159
+ const onFocus = t5;
160
+ let t6;
161
+ if ($[30] !== field || $[31] !== input || $[32] !== props) {
162
+ t6 = e_0 => {
163
+ var _a;
164
+ field.onBlur();
165
+ input.onBlur(e_0);
166
+ (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e_0);
167
+ };
168
+ $[30] = field;
169
+ $[31] = input;
170
+ $[32] = props;
171
+ $[33] = t6;
172
+ }
173
+ else {
174
+ t6 = $[33];
175
+ }
176
+ const onBlur = t6;
177
+ const t7 = (_f = (_e = fieldState.error) === null || _e === void 0 ? void 0 : _e.message) !== null && _f !== void 0 ? _f : props.helperText;
178
+ let t8;
179
+ if ($[34] !== errorId || $[35] !== isInvalid || $[36] !== onBlur || $[37] !== onFocus || $[38] !== props.autoComplete || $[39] !== props.form || $[40] !== props.isDisabled || $[41] !== props.isReadOnly || $[42] !== props.isRequired || $[43] !== props.onKeyDown || $[44] !== props.placeholder) {
180
+ t8 = {
181
+ "aria-describedby": errorId,
182
+ "aria-invalid": isInvalid,
183
+ autoComplete: props.autoComplete,
184
+ disabled: props.isDisabled,
185
+ form: props.form,
186
+ onBlur,
187
+ onFocus,
188
+ onKeyDown: props.onKeyDown,
189
+ placeholder: props.placeholder,
190
+ readOnly: props.isReadOnly,
191
+ required: props.isRequired
192
+ };
193
+ $[34] = errorId;
194
+ $[35] = isInvalid;
195
+ $[36] = onBlur;
196
+ $[37] = onFocus;
197
+ $[38] = props.autoComplete;
198
+ $[39] = props.form;
199
+ $[40] = props.isDisabled;
200
+ $[41] = props.isReadOnly;
201
+ $[42] = props.isRequired;
202
+ $[43] = props.onKeyDown;
203
+ $[44] = props.placeholder;
204
+ $[45] = t8;
205
+ }
206
+ else {
207
+ t8 = $[45];
208
+ }
209
+ let t9;
210
+ if ($[46] !== field.onChange || $[47] !== field.value || $[48] !== id || $[49] !== plugins || $[50] !== props.customPluginsToolbarButtons || $[51] !== props.editorProps || $[52] !== t8) {
211
+ t9 = react_1.default.createElement(wysiwyg_1.WysiwygEditor, { customPluginsToolbarButtons: props.customPluginsToolbarButtons, editableProps: t8, id: id, initialValue: field.value, onChange: field.onChange, plugins: plugins, ref: editorRef, ...props.editorProps });
212
+ $[46] = field.onChange;
213
+ $[47] = field.value;
214
+ $[48] = id;
215
+ $[49] = plugins;
216
+ $[50] = props.customPluginsToolbarButtons;
217
+ $[51] = props.editorProps;
218
+ $[52] = t8;
219
+ $[53] = t9;
220
+ }
221
+ else {
222
+ t9 = $[53];
223
+ }
224
+ let t10;
225
+ if ($[54] !== errorId || $[55] !== id || $[56] !== props.form || $[57] !== props.hiddenLabel || $[58] !== props.isRequired || $[59] !== props.label || $[60] !== props.name || $[61] !== rootClassName || $[62] !== t7 || $[63] !== t9) {
226
+ t10 = react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: errorId, form: props.form, helperText: t7, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label, name: props.name }, t9);
227
+ $[54] = errorId;
228
+ $[55] = id;
229
+ $[56] = props.form;
230
+ $[57] = props.hiddenLabel;
231
+ $[58] = props.isRequired;
232
+ $[59] = props.label;
233
+ $[60] = props.name;
234
+ $[61] = rootClassName;
235
+ $[62] = t7;
236
+ $[63] = t9;
237
+ $[64] = t10;
238
+ }
239
+ else {
240
+ t10 = $[64];
241
+ }
242
+ return t10;
105
243
  }
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Default = Default;
37
+ const compiler_runtime_1 = require("react/compiler-runtime");
37
38
  const form_1 = require("@uxf/form/form");
38
39
  const text_input_1 = require("@uxf/form/text-input");
39
40
  const button_1 = require("@uxf/ui/button");
@@ -49,27 +50,131 @@ const wysiwyg_input_1 = require("./wysiwyg-input");
49
50
  * Image upload is faked here. `WysiwygInput` otherwise defaults to the real `uploadFile` API.
50
51
  */
51
52
  function Default() {
53
+ const $ = (0, compiler_runtime_1.c)(21);
52
54
  const [submitted, setSubmitted] = (0, react_1.useState)(null);
53
- const formApi = (0, react_hook_form_1.useForm)({
54
- defaultValues: { content: [], perex: "", title: "" },
55
- });
56
- return (react_1.default.createElement("div", { className: "p-8" },
57
- react_1.default.createElement(form_1.Form, { formApi: formApi, id: "article-form", onSubmit: (data) => setSubmitted(data) },
58
- react_1.default.createElement(widget_1.Widget, { className: "[&>*]:p-4", footer: react_1.default.createElement("div", { className: "text-right" },
59
- react_1.default.createElement(button_1.Button, { type: "submit" }, "Ulo\u017Eit")), withDividers: true },
60
- react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, label: "Titulek", name: "title" }),
61
- react_1.default.createElement(wysiwyg_input_1.WysiwygInput, { allPluginsOptions: {
62
- image: {
63
- getImageUrl: (file) => file.name,
64
- uploadImage: async (file) => ({
65
- extension: ".ext",
66
- id: 1,
67
- name: URL.createObjectURL(file),
68
- namespace: "wysiwyg",
69
- uuid: "this-should-be-some-random-uuid",
70
- }),
71
- },
72
- }, control: formApi.control, isRequired: true, label: "Obsah", name: "content", placeholder: "Za\u010Dni ps\u00E1t\u2026", requiredMessage: "Obsah je povinn\u00FD" }),
73
- react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, label: "Perex", name: "perex" }))),
74
- submitted && (react_1.default.createElement("pre", { className: "mt-8 overflow-x-auto rounded bg-gray-100 p-4 text-xs", "data-testid": "submitted-value" }, JSON.stringify(submitted, null, 2)))));
55
+ let t0;
56
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
57
+ t0 = {
58
+ defaultValues: {
59
+ content: [],
60
+ perex: "",
61
+ title: ""
62
+ }
63
+ };
64
+ $[0] = t0;
65
+ }
66
+ else {
67
+ t0 = $[0];
68
+ }
69
+ const formApi = (0, react_hook_form_1.useForm)(t0);
70
+ let t1;
71
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
72
+ t1 = data => setSubmitted(data);
73
+ $[1] = t1;
74
+ }
75
+ else {
76
+ t1 = $[1];
77
+ }
78
+ let t2;
79
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
80
+ t2 = react_1.default.createElement("div", { className: "text-right" },
81
+ react_1.default.createElement(button_1.Button, { type: "submit" }, "Ulo\u017Eit"));
82
+ $[2] = t2;
83
+ }
84
+ else {
85
+ t2 = $[2];
86
+ }
87
+ let t3;
88
+ if ($[3] !== formApi.control) {
89
+ t3 = react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, label: "Titulek", name: "title" });
90
+ $[3] = formApi.control;
91
+ $[4] = t3;
92
+ }
93
+ else {
94
+ t3 = $[4];
95
+ }
96
+ let t4;
97
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
98
+ t4 = {
99
+ image: {
100
+ getImageUrl: _temp,
101
+ uploadImage: _temp2
102
+ }
103
+ };
104
+ $[5] = t4;
105
+ }
106
+ else {
107
+ t4 = $[5];
108
+ }
109
+ let t5;
110
+ let t6;
111
+ if ($[6] !== formApi.control) {
112
+ t5 = react_1.default.createElement(wysiwyg_input_1.WysiwygInput, { allPluginsOptions: t4, control: formApi.control, isRequired: true, label: "Obsah", name: "content", placeholder: "Za\u010Dni ps\xE1t\u2026", requiredMessage: "Obsah je povinn\xFD" });
113
+ t6 = react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, label: "Perex", name: "perex" });
114
+ $[6] = formApi.control;
115
+ $[7] = t5;
116
+ $[8] = t6;
117
+ }
118
+ else {
119
+ t5 = $[7];
120
+ t6 = $[8];
121
+ }
122
+ let t7;
123
+ if ($[9] !== t3 || $[10] !== t5 || $[11] !== t6) {
124
+ t7 = react_1.default.createElement(widget_1.Widget, { className: "[&>*]:p-4", footer: t2, withDividers: true },
125
+ t3,
126
+ t5,
127
+ t6);
128
+ $[9] = t3;
129
+ $[10] = t5;
130
+ $[11] = t6;
131
+ $[12] = t7;
132
+ }
133
+ else {
134
+ t7 = $[12];
135
+ }
136
+ let t8;
137
+ if ($[13] !== formApi || $[14] !== t7) {
138
+ t8 = react_1.default.createElement(form_1.Form, { formApi: formApi, id: "article-form", onSubmit: t1 }, t7);
139
+ $[13] = formApi;
140
+ $[14] = t7;
141
+ $[15] = t8;
142
+ }
143
+ else {
144
+ t8 = $[15];
145
+ }
146
+ let t9;
147
+ if ($[16] !== submitted) {
148
+ t9 = submitted && react_1.default.createElement("pre", { className: "mt-8 overflow-x-auto rounded bg-gray-100 p-4 text-xs", "data-testid": "submitted-value" }, JSON.stringify(submitted, null, 2));
149
+ $[16] = submitted;
150
+ $[17] = t9;
151
+ }
152
+ else {
153
+ t9 = $[17];
154
+ }
155
+ let t10;
156
+ if ($[18] !== t8 || $[19] !== t9) {
157
+ t10 = react_1.default.createElement("div", { className: "p-8" },
158
+ t8,
159
+ t9);
160
+ $[18] = t8;
161
+ $[19] = t9;
162
+ $[20] = t10;
163
+ }
164
+ else {
165
+ t10 = $[20];
166
+ }
167
+ return t10;
168
+ }
169
+ async function _temp2(file_0) {
170
+ return {
171
+ extension: ".ext",
172
+ id: 1,
173
+ name: URL.createObjectURL(file_0),
174
+ namespace: "wysiwyg",
175
+ uuid: "this-should-be-some-random-uuid"
176
+ };
177
+ }
178
+ function _temp(file) {
179
+ return file.name;
75
180
  }
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ForgottenPasswordForm = void 0;
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,125 @@ const button_1 = require("@uxf/ui/button");
41
42
  const text_link_1 = require("@uxf/ui/text-link");
42
43
  const react_1 = __importStar(require("react"));
43
44
  const react_hook_form_1 = require("react-hook-form");
44
- const ForgottenPasswordForm = (props) => {
45
- // eslint-disable-next-line react/destructuring-assignment
46
- const { defaultValues, onLogin, ...formProps } = props;
45
+ const ForgottenPasswordForm = props => {
46
+ const $ = (0, compiler_runtime_1.c)(29);
47
+ let defaultValues;
48
+ let formProps;
49
+ let onLogin;
50
+ if ($[0] !== props) {
51
+ ({
52
+ defaultValues,
53
+ onLogin,
54
+ ...formProps
55
+ } = props);
56
+ $[0] = props;
57
+ $[1] = defaultValues;
58
+ $[2] = formProps;
59
+ $[3] = onLogin;
60
+ }
61
+ else {
62
+ defaultValues = $[1];
63
+ formProps = $[2];
64
+ onLogin = $[3];
65
+ }
47
66
  const t = (0, translations_1.useUxfTranslation)();
48
- const formApi = (0, react_hook_form_1.useForm)({
49
- defaultValues,
50
- });
67
+ let t0;
68
+ if ($[4] !== defaultValues) {
69
+ t0 = {
70
+ defaultValues
71
+ };
72
+ $[4] = defaultValues;
73
+ $[5] = t0;
74
+ }
75
+ else {
76
+ t0 = $[5];
77
+ }
78
+ const formApi = (0, react_hook_form_1.useForm)(t0);
51
79
  const [formDisabled, setFormDisabled] = (0, react_1.useState)(true);
52
- (0, react_1.useEffect)(() => {
53
- setFormDisabled(false);
54
- }, []);
55
- return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "forgotten-password-form", ...formProps },
56
- react_1.default.createElement("div", { className: "space-y-6" },
57
- react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: "E-mail", name: "username", type: "text" }),
58
- react_1.default.createElement(button_1.Button, { isDisabled: formDisabled || formApi.formState.isSubmitting, isFullWidth: true, isLoading: formApi.formState.isSubmitting, type: "submit" }, t("uxf-cms-forgotten-password-form:reset-password")),
59
- onLogin && (react_1.default.createElement("div", { className: "text-right" },
60
- react_1.default.createElement(text_link_1.TextLink, { className: "uxf-typo-medium2 text-primary", isDisabled: formApi.formState.isSubmitting, onClick: onLogin }, t("uxf-cms-forgotten-password-form:login")))))));
80
+ let t1;
81
+ let t2;
82
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
83
+ t1 = () => {
84
+ setFormDisabled(false);
85
+ };
86
+ t2 = [];
87
+ $[6] = t1;
88
+ $[7] = t2;
89
+ }
90
+ else {
91
+ t1 = $[6];
92
+ t2 = $[7];
93
+ }
94
+ (0, react_1.useEffect)(t1, t2);
95
+ let t3;
96
+ if ($[8] !== formApi.control || $[9] !== formDisabled) {
97
+ t3 = react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: "E-mail", name: "username", type: "text" });
98
+ $[8] = formApi.control;
99
+ $[9] = formDisabled;
100
+ $[10] = t3;
101
+ }
102
+ else {
103
+ t3 = $[10];
104
+ }
105
+ const t4 = formDisabled || formApi.formState.isSubmitting;
106
+ const t5 = formApi.formState.isSubmitting;
107
+ let t6;
108
+ if ($[11] !== t) {
109
+ t6 = t("uxf-cms-forgotten-password-form:reset-password");
110
+ $[11] = t;
111
+ $[12] = t6;
112
+ }
113
+ else {
114
+ t6 = $[12];
115
+ }
116
+ let t7;
117
+ if ($[13] !== formApi.formState.isSubmitting || $[14] !== t4 || $[15] !== t6) {
118
+ t7 = react_1.default.createElement(button_1.Button, { isDisabled: t4, isFullWidth: true, isLoading: t5, type: "submit" }, t6);
119
+ $[13] = formApi.formState.isSubmitting;
120
+ $[14] = t4;
121
+ $[15] = t6;
122
+ $[16] = t7;
123
+ }
124
+ else {
125
+ t7 = $[16];
126
+ }
127
+ let t8;
128
+ if ($[17] !== formApi.formState.isSubmitting || $[18] !== onLogin || $[19] !== t) {
129
+ t8 = onLogin && react_1.default.createElement("div", { className: "text-right" },
130
+ react_1.default.createElement(text_link_1.TextLink, { className: "uxf-typo-medium2 text-primary", isDisabled: formApi.formState.isSubmitting, onClick: onLogin }, t("uxf-cms-forgotten-password-form:login")));
131
+ $[17] = formApi.formState.isSubmitting;
132
+ $[18] = onLogin;
133
+ $[19] = t;
134
+ $[20] = t8;
135
+ }
136
+ else {
137
+ t8 = $[20];
138
+ }
139
+ let t9;
140
+ if ($[21] !== t3 || $[22] !== t7 || $[23] !== t8) {
141
+ t9 = react_1.default.createElement("div", { className: "space-y-6" },
142
+ t3,
143
+ t7,
144
+ t8);
145
+ $[21] = t3;
146
+ $[22] = t7;
147
+ $[23] = t8;
148
+ $[24] = t9;
149
+ }
150
+ else {
151
+ t9 = $[24];
152
+ }
153
+ let t10;
154
+ if ($[25] !== formApi || $[26] !== formProps || $[27] !== t9) {
155
+ t10 = react_1.default.createElement(form_1.Form, { formApi: formApi, id: "forgotten-password-form", ...formProps }, t9);
156
+ $[25] = formApi;
157
+ $[26] = formProps;
158
+ $[27] = t9;
159
+ $[28] = t10;
160
+ }
161
+ else {
162
+ t10 = $[28];
163
+ }
164
+ return t10;
61
165
  };
62
166
  exports.ForgottenPasswordForm = ForgottenPasswordForm;