@uxf/cms 14.0.0 → 14.3.1

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 (54) hide show
  1. package/api/index.d.ts +2 -0
  2. package/api/index.js +2 -2
  3. package/api/swr.js +71 -6
  4. package/content-builder/content-builder-header.js +42 -3
  5. package/content-builder/content-builder.js +140 -18
  6. package/content-builder/content-builder.stories.js +24 -5
  7. package/content-builder/forms/content-builder-basic-form.js +212 -25
  8. package/content-builder/forms/content-builder-seo-form.js +92 -8
  9. package/forms/change-password-form/change-password-form.js +152 -15
  10. package/forms/components/wysiwyg-input/wysiwyg-input.js +188 -50
  11. package/forms/components/wysiwyg-input/wysiwyg-input.stories.js +127 -22
  12. package/forms/forgotten-password-form/forgotten-password-form.js +119 -15
  13. package/forms/invite-user-form/invite-user-form.js +171 -13
  14. package/forms/login-form/login-form.js +122 -13
  15. package/forms/renew-password-form/renew-password-form.js +148 -16
  16. package/lib/api/create-axios-instance.d.ts +3 -1
  17. package/lib/api/create-axios-request.d.ts +3 -1
  18. package/lib/api/create-axios-request.js +9 -2
  19. package/lib/api/create-axios-request.test.d.ts +1 -0
  20. package/lib/api/create-axios-request.test.js +32 -0
  21. package/lib/layout/layout.js +126 -28
  22. package/lib/layout/sidebar.js +65 -26
  23. package/lib/menu/ui/sub-menu/sub-menu-mobile.js +62 -14
  24. package/lib/menu/ui/sub-menu/sub-menu.js +66 -14
  25. package/lib/menu/ui/sub-menu/use-sub-menu.js +137 -34
  26. package/lib/menu/ui/user-menu.js +178 -14
  27. package/package.json +20 -20
  28. package/pages/content-builder/components/form-content.js +189 -38
  29. package/pages/content-builder/components/form-root-fields.js +3 -3
  30. package/pages/content-builder/components/form.js +142 -27
  31. package/pages/content-builder/components/header.js +44 -5
  32. package/pages/content-builder/content/feature-section.js +67 -15
  33. package/pages/content-builder/content/gallery.js +38 -6
  34. package/pages/content-builder/content/hero-section.js +39 -6
  35. package/pages/content-builder/content/people.js +64 -13
  36. package/pages/content-builder/content/wysiwyg.js +60 -6
  37. package/pages/content-builder/content-builder-page.js +120 -48
  38. package/pages/content-builder/content-field.js +216 -35
  39. package/pages/content-builder/content-header.js +100 -53
  40. package/pages/content-builder/context/details-visibility-context.js +95 -17
  41. package/pages/forgotten-password-page/forgotten-password-page.js +29 -46
  42. package/pages/grid-page/grid-page.js +291 -75
  43. package/pages/grid-page/use-hidden-columns.js +29 -8
  44. package/pages/invite-user-page/invite-user-page.js +39 -16
  45. package/pages/login-page/login-page.js +44 -50
  46. package/pages/renew-password-page/renew-password-page.js +35 -43
  47. package/security/restricted-page.js +88 -10
  48. package/security/use-logged-user.js +33 -8
  49. package/ui/avatar/avatar.js +3 -2
  50. package/ui/copy-to-clipboard/copy-to-clipboard.js +57 -44
  51. package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +47 -46
  52. package/utils/remove-confirm-handler.js +80 -11
  53. package/utils/use-viewport-height.js +25 -7
  54. package/utils/use-visual-viewport-height.js +5 -2
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ContentField = void 0;
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
7
8
  const dnd_1 = require("@uxf/dnd");
8
9
  const button_1 = require("@uxf/ui/button");
9
10
  const dialog_panel_1 = require("@uxf/ui/dialog/dialog-panel");
@@ -13,47 +14,227 @@ const react_1 = __importDefault(require("react"));
13
14
  const react_hook_form_1 = require("react-hook-form");
14
15
  const form_content_1 = require("./components/form-content");
15
16
  const details_visibility_context_1 = require("./context/details-visibility-context");
16
- const ContentField = (props) => {
17
+ const ContentField = props => {
17
18
  var _a;
18
- const { fields, remove, insert, move } = (0, react_hook_form_1.useFieldArray)({
19
- name: `${props.name}.data`,
20
- control: props.control,
21
- });
22
- const createSection = (component, index) => {
23
- insert(index + 1, { type: component.getConfig().type, content: null });
24
- (0, modal_service_1.closeModal)();
25
- };
26
- const { activeItem, itemsIds, sensors, dropAnimationConfig, onDragStart, onDragEnd, onDragCancel } = (0, dnd_1.useSortableSingle)(fields, (fromIndex, toIndex) => move(fromIndex, toIndex));
27
- const activeItemIndex = fields.findIndex((f) => f.id === (activeItem === null || activeItem === void 0 ? void 0 : activeItem.id));
19
+ const $ = (0, compiler_runtime_1.c)(62);
20
+ const t0 = `${props.name}.data`;
21
+ let t1;
22
+ if ($[0] !== props.control || $[1] !== t0) {
23
+ t1 = {
24
+ name: t0,
25
+ control: props.control
26
+ };
27
+ $[0] = props.control;
28
+ $[1] = t0;
29
+ $[2] = t1;
30
+ }
31
+ else {
32
+ t1 = $[2];
33
+ }
34
+ const { fields, remove, insert, move } = (0, react_hook_form_1.useFieldArray)(t1);
35
+ let t2;
36
+ if ($[3] !== insert) {
37
+ t2 = (component, index) => {
38
+ insert(index + 1, {
39
+ type: component.getConfig().type,
40
+ content: null
41
+ });
42
+ (0, modal_service_1.closeModal)();
43
+ };
44
+ $[3] = insert;
45
+ $[4] = t2;
46
+ }
47
+ else {
48
+ t2 = $[4];
49
+ }
50
+ const createSection = t2;
51
+ let t3;
52
+ if ($[5] !== move) {
53
+ t3 = (fromIndex, toIndex) => move(fromIndex, toIndex);
54
+ $[5] = move;
55
+ $[6] = t3;
56
+ }
57
+ else {
58
+ t3 = $[6];
59
+ }
60
+ const { activeItem, itemsIds, sensors, dropAnimationConfig, onDragStart, onDragEnd, onDragCancel } = (0, dnd_1.useSortableSingle)(fields, t3);
61
+ let t4;
62
+ if ($[7] !== (activeItem === null || activeItem === void 0 ? void 0 : activeItem.id) || $[8] !== fields) {
63
+ let t5;
64
+ if ($[10] !== (activeItem === null || activeItem === void 0 ? void 0 : activeItem.id)) {
65
+ t5 = f => f.id === (activeItem === null || activeItem === void 0 ? void 0 : activeItem.id);
66
+ $[10] = activeItem === null || activeItem === void 0 ? void 0 : activeItem.id;
67
+ $[11] = t5;
68
+ }
69
+ else {
70
+ t5 = $[11];
71
+ }
72
+ t4 = fields.findIndex(t5);
73
+ $[7] = activeItem === null || activeItem === void 0 ? void 0 : activeItem.id;
74
+ $[8] = fields;
75
+ $[9] = t4;
76
+ }
77
+ else {
78
+ t4 = $[9];
79
+ }
80
+ const activeItemIndex = t4;
28
81
  const setVisibilityForAll = (0, details_visibility_context_1.useDetailsVisibilityControls)();
29
- return (react_1.default.createElement("div", { className: "uxf-cb__content" },
30
- react_1.default.createElement("div", { className: "uxf-cb__content-header mb-4 mt-6 flex flex-wrap items-center justify-between gap-4" },
31
- react_1.default.createElement("h2", { className: "uxf-typo-h5" }, "Obsah"),
32
- fields.length > 1 && (react_1.default.createElement("div", { className: "flex justify-end space-x-4" },
33
- react_1.default.createElement(button_1.Button, { onClick: () => setVisibilityForAll(true), size: "sm", variant: "secondary" },
34
- react_1.default.createElement(icon_1.Icon, { className: "mr-1", name: "arrow-down-from-line" }),
35
- "otev\u0159\u00EDt v\u0161e"),
36
- react_1.default.createElement(button_1.Button, { onClick: () => setVisibilityForAll(false), size: "sm", variant: "secondary" },
37
- react_1.default.createElement(icon_1.Icon, { className: "mr-1", name: "arrow-up-to-line" }),
38
- "zav\u0159\u00EDt v\u0161e")))),
39
- react_1.default.createElement(dnd_1.DndContext, { onDragCancel: onDragCancel, onDragEnd: onDragEnd, onDragStart: onDragStart, sensors: sensors },
40
- react_1.default.createElement(dnd_1.SortableContext, { items: itemsIds, strategy: dnd_1.verticalListSortingStrategy },
41
- react_1.default.createElement("div", { className: "space-y-4 pl-8" }, fields.map((field, index) => {
42
- var _a;
43
- return (react_1.default.createElement("div", { key: field.id },
44
- react_1.default.createElement(form_content_1.FormContent, { contentComponents: props.contentComponents, control: props.control, createSection: createSection, id: field.id, index: index, name: `${props.name}.data[${index}]`, onRemove: () => remove(index), title: (_a = props.contentComponents
45
- .find((c) => c.getConfig().type === field.type)) === null || _a === void 0 ? void 0 : _a.getConfig().label })));
46
- }))),
47
- react_1.default.createElement(dnd_1.DragOverlay, { dropAnimation: dropAnimationConfig }, activeItem ? (react_1.default.createElement(form_content_1.FormContent, { ...activeItem, contentComponents: props.contentComponents, control: props.control, createSection: createSection, index: activeItemIndex, name: `${props.name}.data[${activeItemIndex}]`, onRemove: () => remove(activeItemIndex), showAddButton: false, title: (_a = props.contentComponents
48
- .find((c) => c.getConfig().type === activeItem.type)) === null || _a === void 0 ? void 0 : _a.getConfig().label })) : null)),
49
- fields.length < 1 && (react_1.default.createElement("div", null,
82
+ let t5;
83
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
84
+ t5 = react_1.default.createElement("h2", { className: "uxf-typo-h5" }, "Obsah");
85
+ $[12] = t5;
86
+ }
87
+ else {
88
+ t5 = $[12];
89
+ }
90
+ let t6;
91
+ if ($[13] !== fields.length || $[14] !== setVisibilityForAll) {
92
+ t6 = fields.length > 1 && react_1.default.createElement("div", { className: "flex justify-end space-x-4" },
93
+ react_1.default.createElement(button_1.Button, { onClick: () => setVisibilityForAll(true), size: "sm", variant: "secondary" },
94
+ react_1.default.createElement(icon_1.Icon, { className: "mr-1", name: "arrow-down-from-line" }),
95
+ "otev\u0159\u00EDt v\u0161e"),
96
+ react_1.default.createElement(button_1.Button, { onClick: () => setVisibilityForAll(false), size: "sm", variant: "secondary" },
97
+ react_1.default.createElement(icon_1.Icon, { className: "mr-1", name: "arrow-up-to-line" }),
98
+ "zav\u0159\u00EDt v\u0161e"));
99
+ $[13] = fields.length;
100
+ $[14] = setVisibilityForAll;
101
+ $[15] = t6;
102
+ }
103
+ else {
104
+ t6 = $[15];
105
+ }
106
+ let t7;
107
+ if ($[16] !== t6) {
108
+ t7 = react_1.default.createElement("div", { className: "uxf-cb__content-header mb-4 mt-6 flex flex-wrap items-center justify-between gap-4" },
109
+ t5,
110
+ t6);
111
+ $[16] = t6;
112
+ $[17] = t7;
113
+ }
114
+ else {
115
+ t7 = $[17];
116
+ }
117
+ let t8;
118
+ if ($[18] !== createSection || $[19] !== fields || $[20] !== props.contentComponents || $[21] !== props.control || $[22] !== props.name || $[23] !== remove) {
119
+ let t9;
120
+ if ($[25] !== createSection || $[26] !== props.contentComponents || $[27] !== props.control || $[28] !== props.name || $[29] !== remove) {
121
+ t9 = (field, index_0) => { var _a; return react_1.default.createElement("div", { key: field.id },
122
+ react_1.default.createElement(form_content_1.FormContent, { contentComponents: props.contentComponents, control: props.control, createSection: createSection, id: field.id, index: index_0, name: `${props.name}.data[${index_0}]`, onRemove: () => remove(index_0), title: (_a = props.contentComponents.find(c => c.getConfig().type === field.type)) === null || _a === void 0 ? void 0 : _a.getConfig().label })); };
123
+ $[25] = createSection;
124
+ $[26] = props.contentComponents;
125
+ $[27] = props.control;
126
+ $[28] = props.name;
127
+ $[29] = remove;
128
+ $[30] = t9;
129
+ }
130
+ else {
131
+ t9 = $[30];
132
+ }
133
+ t8 = fields.map(t9);
134
+ $[18] = createSection;
135
+ $[19] = fields;
136
+ $[20] = props.contentComponents;
137
+ $[21] = props.control;
138
+ $[22] = props.name;
139
+ $[23] = remove;
140
+ $[24] = t8;
141
+ }
142
+ else {
143
+ t8 = $[24];
144
+ }
145
+ let t9;
146
+ if ($[31] !== t8) {
147
+ t9 = react_1.default.createElement("div", { className: "space-y-4 pl-8" }, t8);
148
+ $[31] = t8;
149
+ $[32] = t9;
150
+ }
151
+ else {
152
+ t9 = $[32];
153
+ }
154
+ let t10;
155
+ if ($[33] !== itemsIds || $[34] !== t9) {
156
+ t10 = react_1.default.createElement(dnd_1.SortableContext, { items: itemsIds, strategy: dnd_1.verticalListSortingStrategy }, t9);
157
+ $[33] = itemsIds;
158
+ $[34] = t9;
159
+ $[35] = t10;
160
+ }
161
+ else {
162
+ t10 = $[35];
163
+ }
164
+ let t11;
165
+ if ($[36] !== activeItem || $[37] !== activeItemIndex || $[38] !== createSection || $[39] !== props.contentComponents || $[40] !== props.control || $[41] !== props.name || $[42] !== remove) {
166
+ t11 = activeItem ? react_1.default.createElement(form_content_1.FormContent, { ...activeItem, contentComponents: props.contentComponents, control: props.control, createSection: createSection, index: activeItemIndex, name: `${props.name}.data[${activeItemIndex}]`, onRemove: () => remove(activeItemIndex), showAddButton: false, title: (_a = props.contentComponents.find(c_0 => c_0.getConfig().type === activeItem.type)) === null || _a === void 0 ? void 0 : _a.getConfig().label }) : null;
167
+ $[36] = activeItem;
168
+ $[37] = activeItemIndex;
169
+ $[38] = createSection;
170
+ $[39] = props.contentComponents;
171
+ $[40] = props.control;
172
+ $[41] = props.name;
173
+ $[42] = remove;
174
+ $[43] = t11;
175
+ }
176
+ else {
177
+ t11 = $[43];
178
+ }
179
+ let t12;
180
+ if ($[44] !== dropAnimationConfig || $[45] !== t11) {
181
+ t12 = react_1.default.createElement(dnd_1.DragOverlay, { dropAnimation: dropAnimationConfig }, t11);
182
+ $[44] = dropAnimationConfig;
183
+ $[45] = t11;
184
+ $[46] = t12;
185
+ }
186
+ else {
187
+ t12 = $[46];
188
+ }
189
+ let t13;
190
+ if ($[47] !== onDragCancel || $[48] !== onDragEnd || $[49] !== onDragStart || $[50] !== sensors || $[51] !== t10 || $[52] !== t12) {
191
+ t13 = react_1.default.createElement(dnd_1.DndContext, { onDragCancel: onDragCancel, onDragEnd: onDragEnd, onDragStart: onDragStart, sensors: sensors },
192
+ t10,
193
+ t12);
194
+ $[47] = onDragCancel;
195
+ $[48] = onDragEnd;
196
+ $[49] = onDragStart;
197
+ $[50] = sensors;
198
+ $[51] = t10;
199
+ $[52] = t12;
200
+ $[53] = t13;
201
+ }
202
+ else {
203
+ t13 = $[53];
204
+ }
205
+ let t14;
206
+ if ($[54] !== createSection || $[55] !== fields.length || $[56] !== props.contentComponents) {
207
+ t14 = fields.length < 1 && react_1.default.createElement("div", null,
50
208
  react_1.default.createElement(button_1.Button, { className: "h-20 border-2 border-dashed border-gray-600", isFullWidth: true, onClick: () => (0, modal_service_1.openModal)({
51
- children: (react_1.default.createElement(dialog_panel_1.DialogPanel, { width: "sm" },
209
+ children: react_1.default.createElement(dialog_panel_1.DialogPanel, { width: "sm" },
52
210
  react_1.default.createElement("div", { className: "px-4 py-6" },
53
211
  react_1.default.createElement("h2", { className: "uxf-typo-h5 mb-4" }, "P\u0159idat sekci"),
54
- react_1.default.createElement("div", { className: "space-y-4" }, props.contentComponents.map((component) => (react_1.default.createElement(button_1.Button, { isFullWidth: true, key: component.getConfig().type, onClick: () => createSection(component, 0), variant: "secondary" }, component.getConfig().label))))))),
212
+ react_1.default.createElement("div", { className: "space-y-4" }, props.contentComponents.map(component_0 => react_1.default.createElement(button_1.Button, { isFullWidth: true, key: component_0.getConfig().type, onClick: () => createSection(component_0, 0), variant: "secondary" }, component_0.getConfig().label)))))
55
213
  }), size: "lg", variant: "text" },
56
214
  react_1.default.createElement(icon_1.Icon, { className: "mr-3", name: "plus", size: 16 }),
57
- "P\u0159idat sekci")))));
215
+ "P\u0159idat sekci"));
216
+ $[54] = createSection;
217
+ $[55] = fields.length;
218
+ $[56] = props.contentComponents;
219
+ $[57] = t14;
220
+ }
221
+ else {
222
+ t14 = $[57];
223
+ }
224
+ let t15;
225
+ if ($[58] !== t13 || $[59] !== t14 || $[60] !== t7) {
226
+ t15 = react_1.default.createElement("div", { className: "uxf-cb__content" },
227
+ t7,
228
+ t13,
229
+ t14);
230
+ $[58] = t13;
231
+ $[59] = t14;
232
+ $[60] = t7;
233
+ $[61] = t15;
234
+ }
235
+ else {
236
+ t15 = $[61];
237
+ }
238
+ return t15;
58
239
  };
59
240
  exports.ContentField = ContentField;
@@ -1,65 +1,112 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
6
  exports.ContentHeader = void 0;
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
37
8
  const use_clickable_props_1 = require("@uxf/core-react/clickable/use-clickable-props");
38
9
  const translations_1 = require("@uxf/core-react/translations");
39
10
  const icon_1 = require("@uxf/ui/icon");
40
11
  const icon_button_1 = require("@uxf/ui/icon-button");
41
- const react_1 = __importStar(require("react"));
12
+ const react_1 = __importDefault(require("react"));
42
13
  const details_visibility_context_1 = require("./context/details-visibility-context");
43
- const ContentHeader = (props) => {
14
+ const ContentHeader = props => {
15
+ const $ = (0, compiler_runtime_1.c)(21);
44
16
  const [visibility, toggleVisibility] = (0, details_visibility_context_1.useDetailsVisibilityForSection)(props.id);
45
17
  const t = (0, translations_1.useUxfTranslation)();
46
- const removeHandler = (0, react_1.useCallback)((event) => {
47
- event.stopPropagation();
48
- // eslint-disable-next-line no-alert
49
- if (confirm(t("uxf-cms-pages-content-builder:confirm-delete-section"))) {
50
- props.onRemove();
51
- }
52
- },
53
- // eslint-disable-next-line react-hooks/exhaustive-deps
54
- [props.onRemove, t]);
55
- const clickableProps = (0, use_clickable_props_1.useClickableProps)({
56
- className: "flex w-full cursor-pointer flex-row items-center justify-between p-4",
57
- onClick: toggleVisibility,
58
- });
59
- return (react_1.default.createElement("div", { ...clickableProps },
60
- react_1.default.createElement("h3", { className: "uxf-typo-h6" }, props.title),
61
- react_1.default.createElement("div", { className: "flex items-center space-x-4" },
62
- react_1.default.createElement(icon_button_1.IconButton, { iconName: "delete", label: t("uxf-cms-pages-content-builder:components.content-header.delete-section"), onClick: removeHandler, size: "sm", variant: "secondary" }),
63
- react_1.default.createElement(icon_1.Icon, { name: `${visibility ? "chevronUp" : "chevronDown"}`, size: 16 }))));
18
+ let t0;
19
+ if ($[0] !== props || $[1] !== t) {
20
+ t0 = event => {
21
+ event.stopPropagation();
22
+ if (confirm(t("uxf-cms-pages-content-builder:confirm-delete-section"))) {
23
+ props.onRemove();
24
+ }
25
+ };
26
+ $[0] = props;
27
+ $[1] = t;
28
+ $[2] = t0;
29
+ }
30
+ else {
31
+ t0 = $[2];
32
+ }
33
+ const removeHandler = t0;
34
+ let t1;
35
+ if ($[3] !== toggleVisibility) {
36
+ t1 = {
37
+ className: "flex w-full cursor-pointer flex-row items-center justify-between p-4",
38
+ onClick: toggleVisibility
39
+ };
40
+ $[3] = toggleVisibility;
41
+ $[4] = t1;
42
+ }
43
+ else {
44
+ t1 = $[4];
45
+ }
46
+ const clickableProps = (0, use_clickable_props_1.useClickableProps)(t1);
47
+ let t2;
48
+ if ($[5] !== props.title) {
49
+ t2 = react_1.default.createElement("h3", { className: "uxf-typo-h6" }, props.title);
50
+ $[5] = props.title;
51
+ $[6] = t2;
52
+ }
53
+ else {
54
+ t2 = $[6];
55
+ }
56
+ let t3;
57
+ if ($[7] !== t) {
58
+ t3 = t("uxf-cms-pages-content-builder:components.content-header.delete-section");
59
+ $[7] = t;
60
+ $[8] = t3;
61
+ }
62
+ else {
63
+ t3 = $[8];
64
+ }
65
+ let t4;
66
+ if ($[9] !== removeHandler || $[10] !== t3) {
67
+ t4 = react_1.default.createElement(icon_button_1.IconButton, { iconName: "delete", label: t3, onClick: removeHandler, size: "sm", variant: "secondary" });
68
+ $[9] = removeHandler;
69
+ $[10] = t3;
70
+ $[11] = t4;
71
+ }
72
+ else {
73
+ t4 = $[11];
74
+ }
75
+ const t5 = `${visibility ? "chevronUp" : "chevronDown"}`;
76
+ let t6;
77
+ if ($[12] !== t5) {
78
+ t6 = react_1.default.createElement(icon_1.Icon, { name: t5, size: 16 });
79
+ $[12] = t5;
80
+ $[13] = t6;
81
+ }
82
+ else {
83
+ t6 = $[13];
84
+ }
85
+ let t7;
86
+ if ($[14] !== t4 || $[15] !== t6) {
87
+ t7 = react_1.default.createElement("div", { className: "flex items-center space-x-4" },
88
+ t4,
89
+ t6);
90
+ $[14] = t4;
91
+ $[15] = t6;
92
+ $[16] = t7;
93
+ }
94
+ else {
95
+ t7 = $[16];
96
+ }
97
+ let t8;
98
+ if ($[17] !== clickableProps || $[18] !== t2 || $[19] !== t7) {
99
+ t8 = react_1.default.createElement("div", { ...clickableProps },
100
+ t2,
101
+ t7);
102
+ $[17] = clickableProps;
103
+ $[18] = t2;
104
+ $[19] = t7;
105
+ $[20] = t8;
106
+ }
107
+ else {
108
+ t8 = $[20];
109
+ }
110
+ return t8;
64
111
  };
65
112
  exports.ContentHeader = ContentHeader;
@@ -34,36 +34,114 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.DetailsVisibilityProvider = exports.useDetailsVisibilityControls = exports.useDetailsVisibilityForSection = void 0;
37
+ const compiler_runtime_1 = require("react/compiler-runtime");
37
38
  const noop_1 = require("@uxf/core/utils/noop");
38
39
  const global_context_1 = require("@uxf/core-react/global-context");
39
40
  const react_1 = __importStar(require("react"));
40
41
  const DetailsVisibilityContext = (0, global_context_1.createGlobalContext)("cms/content-builder/details-visibility", [[], noop_1.noop, true, noop_1.noop]);
41
- const useDetailsVisibility = () => (0, react_1.useContext)(DetailsVisibilityContext);
42
- const useDetailsVisibilityForSection = (sectionId) => {
42
+ const useDetailsVisibility = () => {
43
+ return (0, react_1.useContext)(DetailsVisibilityContext);
44
+ };
45
+ const useDetailsVisibilityForSection = sectionId => {
43
46
  var _a;
47
+ const $ = (0, compiler_runtime_1.c)(10);
44
48
  const [detailsVisibility, setDetailsVisibility, defaultVisibility] = useDetailsVisibility();
45
- const nullableVisibility = (_a = detailsVisibility.find((item) => item.id === sectionId)) === null || _a === void 0 ? void 0 : _a.visible;
49
+ let t0;
50
+ if ($[0] !== detailsVisibility || $[1] !== sectionId) {
51
+ t0 = (_a = detailsVisibility.find(item => item.id === sectionId)) === null || _a === void 0 ? void 0 : _a.visible;
52
+ $[0] = detailsVisibility;
53
+ $[1] = sectionId;
54
+ $[2] = t0;
55
+ }
56
+ else {
57
+ t0 = $[2];
58
+ }
59
+ const nullableVisibility = t0;
46
60
  const visibility = typeof nullableVisibility === "boolean" ? nullableVisibility : defaultVisibility;
47
- const toggleVisibility = (0, react_1.useCallback)(() => {
48
- setDetailsVisibility((prev) => [
49
- ...prev.filter((i) => i.id !== sectionId),
50
- { id: sectionId, visible: !visibility },
51
- ]);
52
- }, [visibility, sectionId, setDetailsVisibility]);
53
- return [visibility, toggleVisibility];
61
+ let t1;
62
+ if ($[3] !== sectionId || $[4] !== setDetailsVisibility || $[5] !== visibility) {
63
+ t1 = () => {
64
+ setDetailsVisibility(prev => [...prev.filter(i => i.id !== sectionId), {
65
+ id: sectionId,
66
+ visible: !visibility
67
+ }]);
68
+ };
69
+ $[3] = sectionId;
70
+ $[4] = setDetailsVisibility;
71
+ $[5] = visibility;
72
+ $[6] = t1;
73
+ }
74
+ else {
75
+ t1 = $[6];
76
+ }
77
+ const toggleVisibility = t1;
78
+ let t2;
79
+ if ($[7] !== toggleVisibility || $[8] !== visibility) {
80
+ t2 = [visibility, toggleVisibility];
81
+ $[7] = toggleVisibility;
82
+ $[8] = visibility;
83
+ $[9] = t2;
84
+ }
85
+ else {
86
+ t2 = $[9];
87
+ }
88
+ return t2;
54
89
  };
55
90
  exports.useDetailsVisibilityForSection = useDetailsVisibilityForSection;
56
91
  const useDetailsVisibilityControls = () => {
92
+ const $ = (0, compiler_runtime_1.c)(3);
57
93
  const [, setDetailsVisibility, , setDefaultVisibility] = useDetailsVisibility();
58
- return (0, react_1.useCallback)((visible) => {
59
- setDefaultVisibility(visible);
60
- setDetailsVisibility((prev) => prev.map((i) => ({ ...i, visible })));
61
- }, [setDefaultVisibility, setDetailsVisibility]);
94
+ let t0;
95
+ if ($[0] !== setDefaultVisibility || $[1] !== setDetailsVisibility) {
96
+ t0 = visible => {
97
+ setDefaultVisibility(visible);
98
+ setDetailsVisibility(prev => prev.map(i => ({
99
+ ...i,
100
+ visible
101
+ })));
102
+ };
103
+ $[0] = setDefaultVisibility;
104
+ $[1] = setDetailsVisibility;
105
+ $[2] = t0;
106
+ }
107
+ else {
108
+ t0 = $[2];
109
+ }
110
+ return t0;
62
111
  };
63
112
  exports.useDetailsVisibilityControls = useDetailsVisibilityControls;
64
- const DetailsVisibilityProvider = (props) => {
113
+ const DetailsVisibilityProvider = props => {
114
+ const $ = (0, compiler_runtime_1.c)(7);
65
115
  const [defaultVisibility, setDefaultVisibility] = (0, react_1.useState)(true);
66
- const [detailsVisibility, setDetailsVisibility] = (0, react_1.useState)([]);
67
- return (react_1.default.createElement(DetailsVisibilityContext, { value: [detailsVisibility, setDetailsVisibility, defaultVisibility, setDefaultVisibility] }, props.children));
116
+ let t0;
117
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
118
+ t0 = [];
119
+ $[0] = t0;
120
+ }
121
+ else {
122
+ t0 = $[0];
123
+ }
124
+ const [detailsVisibility, setDetailsVisibility] = (0, react_1.useState)(t0);
125
+ let t1;
126
+ if ($[1] !== defaultVisibility || $[2] !== detailsVisibility) {
127
+ t1 = [detailsVisibility, setDetailsVisibility, defaultVisibility, setDefaultVisibility];
128
+ $[1] = defaultVisibility;
129
+ $[2] = detailsVisibility;
130
+ $[3] = t1;
131
+ }
132
+ else {
133
+ t1 = $[3];
134
+ }
135
+ let t2;
136
+ if ($[4] !== props.children || $[5] !== t1) {
137
+ t2 = react_1.default.createElement(DetailsVisibilityContext, { value: t1 }, props.children);
138
+ $[4] = props.children;
139
+ $[5] = t1;
140
+ $[6] = t2;
141
+ }
142
+ else {
143
+ t2 = $[6];
144
+ }
145
+ return t2;
68
146
  };
69
147
  exports.DetailsVisibilityProvider = DetailsVisibilityProvider;
@@ -1,59 +1,42 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
6
  exports.ForgottenPasswordPage = void 0;
37
- const react_1 = __importStar(require("react"));
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
8
+ const react_1 = __importDefault(require("react"));
38
9
  const forgotten_password_form_1 = require("../../forms/forgotten-password-form");
39
10
  const login_layout_1 = require("../../lib/login-layout");
40
11
  const INITIAL_VALUES = {
41
- username: "",
12
+ username: ""
42
13
  };
43
- const ForgottenPasswordPage = (config) => {
14
+ const ForgottenPasswordPage = config => {
44
15
  const Component = () => {
45
16
  var _a;
46
- const onSubmit = (0, react_1.useCallback)(async (values) => {
47
- try {
48
- await config.onSubmit(values.username);
49
- }
50
- catch (e) {
51
- config.handleError(e);
52
- }
53
- }, []);
54
- return (react_1.default.createElement(login_layout_1.LoginLayout, { Logo: (_a = config.ui) === null || _a === void 0 ? void 0 : _a.Logo, pageTitle: config.pageTitle, title: config.title },
55
- react_1.default.createElement(forgotten_password_form_1.ForgottenPasswordForm, { defaultValues: INITIAL_VALUES, onLogin: config.onLogin, onSubmit: onSubmit })));
17
+ const $ = (0, compiler_runtime_1.c)(1);
18
+ const onSubmit = _temp;
19
+ let t0;
20
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21
+ t0 = react_1.default.createElement(login_layout_1.LoginLayout, { Logo: (_a = config.ui) === null || _a === void 0 ? void 0 : _a.Logo, pageTitle: config.pageTitle, title: config.title },
22
+ react_1.default.createElement(forgotten_password_form_1.ForgottenPasswordForm, { defaultValues: INITIAL_VALUES, onLogin: config.onLogin, onSubmit: onSubmit }));
23
+ $[0] = t0;
24
+ }
25
+ else {
26
+ t0 = $[0];
27
+ }
28
+ return t0;
56
29
  };
57
30
  return Component;
58
31
  };
59
32
  exports.ForgottenPasswordPage = ForgottenPasswordPage;
33
+ async function _temp(values) {
34
+ ;
35
+ try {
36
+ await config.onSubmit(values.username);
37
+ }
38
+ catch (t0) {
39
+ const e = t0;
40
+ config.handleError(e);
41
+ }
42
+ }