xmlui 0.9.21 → 0.9.25
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/apiInterceptorWorker-CFF3bC6o.mjs +818 -0
- package/dist/{index-B3CWFAxa.mjs → index-DtxDGaqF.mjs} +11942 -3291
- package/dist/index.css +1301 -564
- package/dist/language-server-web-worker.mjs +1 -1
- package/dist/language-server.mjs +1 -1
- package/dist/lint-CYAUfk0_.mjs +168 -0
- package/dist/metadata-utils-CCIMqe69.mjs +466 -0
- package/dist/scripts/package.json +252 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +0 -1
- package/dist/scripts/src/components/App/AppNative.js +21 -9
- package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -2
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +13 -10
- package/dist/scripts/src/components/Bookmark/BookmarkNative.js +5 -1
- package/dist/scripts/src/components/CodeBlock/CodeBlock.js +31 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +82 -0
- package/dist/scripts/src/components/ComponentProvider.js +5 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +1 -0
- package/dist/scripts/src/components/Form/FormContext.js +5 -4
- package/dist/scripts/src/components/Form/FormNative.js +41 -43
- package/dist/scripts/src/components/Form/formActions.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItem.js +6 -3
- package/dist/scripts/src/components/FormItem/FormItemNative.js +56 -15
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- package/dist/scripts/src/components/Heading/Heading.js +13 -0
- package/dist/scripts/src/components/Heading/HeadingNative.js +1 -1
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +7 -3
- package/dist/scripts/src/components/Icon/DarkToLightIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LightToDark.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +4 -0
- package/dist/scripts/src/components/Image/ImageNative.js +1 -1
- package/dist/scripts/src/components/Items/ItemsNative.js +8 -6
- package/dist/scripts/src/components/Link/Link.js +5 -5
- package/dist/scripts/src/components/List/ListNative.js +1 -1
- package/dist/scripts/src/components/Markdown/Markdown.js +52 -16
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +34 -73
- package/dist/scripts/src/components/Markdown/highlight-code.js +160 -0
- package/dist/scripts/src/components/Markdown/parse-binding-expr.js +60 -0
- package/dist/scripts/src/components/Markdown/utils.js +282 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +4 -5
- package/dist/scripts/src/components/NestedApp/NestedApp.js +61 -0
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +125 -0
- package/dist/scripts/src/components/NestedApp/Tooltip.js +46 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -1
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
- package/dist/scripts/src/components/Option/Option.js +3 -2
- package/dist/scripts/src/components/Select/Select.js +5 -3
- package/dist/scripts/src/components/Select/SelectNative.js +53 -40
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +1 -1
- package/dist/scripts/src/components/Spinner/Spinner.js +0 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -0
- package/dist/scripts/src/components/Text/Text.js +12 -1
- package/dist/scripts/src/components/Text/TextNative.js +5 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +6 -1
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/Theme/ThemeNative.js +7 -3
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -3
- package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
- package/dist/scripts/src/components-core/TableOfContentsContext.js +1 -1
- package/dist/scripts/src/components-core/appContext/date-functions.js +23 -0
- package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +13 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +199 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
- package/dist/scripts/src/components-core/interception/Backend.js +128 -0
- package/dist/scripts/src/components-core/interception/Errors.js +129 -0
- package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
- package/dist/scripts/src/components-core/interception/IndexedDb.js +207 -0
- package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/rendering/AppContent.js +336 -0
- package/dist/scripts/src/components-core/rendering/AppRoot.js +84 -0
- package/dist/scripts/src/components-core/rendering/AppWrapper.js +49 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +17 -7
- package/dist/scripts/src/components-core/rendering/Container.js +2 -1
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -7
- package/dist/scripts/src/components-core/theming/themes/root.js +1 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/hooks.js +26 -0
- package/dist/scripts/src/components-core/utils/misc.js +1 -1
- package/dist/scripts/src/components-core/utils/request-params.js +70 -0
- package/dist/scripts/src/logging/LoggerContext.js +22 -0
- package/dist/scripts/src/logging/LoggerInitializer.js +14 -0
- package/dist/scripts/src/logging/LoggerService.js +60 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +7 -0
- package/dist/{server-common-DW5h7Q34.mjs → server-common-9TiLMTJj.mjs} +106 -98
- package/dist/style.css +3314 -2823
- package/dist/{lint-EcgF-9Wr.mjs → transform-DC0Gy6qw.mjs} +1246 -540
- package/dist/xmlui-metadata.mjs +2850 -2665
- package/dist/xmlui-metadata.umd.js +2850 -2665
- package/dist/xmlui-parser.d.ts +49 -4
- package/dist/xmlui-parser.mjs +49 -48
- package/dist/xmlui-standalone.umd.js +34674 -31457
- package/dist/xmlui.d.ts +3 -1
- package/dist/xmlui.mjs +10 -10
- package/package.json +3 -1
- package/dist/apiInterceptorWorker-7aKQ2rBj.mjs +0 -8447
- package/dist/parser-CBXS8ft2.mjs +0 -1196
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formControlTypesMd = exports.formControlTypes = exports.FormContext = exports.validationModeMd = exports.defaultValidationMode = exports.validationModeValues = exports.validationSeverityMd = exports.validationSeverityValues = void 0;
|
|
4
|
-
exports.useFormContext = useFormContext;
|
|
5
4
|
exports.useFormContextPart = useFormContextPart;
|
|
6
5
|
const use_context_selector_1 = require("use-context-selector");
|
|
7
6
|
exports.validationSeverityValues = ["error", "warning", "valid", "none"];
|
|
@@ -28,9 +27,6 @@ exports.validationModeMd = [
|
|
|
28
27
|
}
|
|
29
28
|
];
|
|
30
29
|
exports.FormContext = (0, use_context_selector_1.createContext)(undefined);
|
|
31
|
-
function useFormContext() {
|
|
32
|
-
return (0, use_context_selector_1.useContext)(exports.FormContext);
|
|
33
|
-
}
|
|
34
30
|
function useFormContextPart(selector) {
|
|
35
31
|
return (0, use_context_selector_1.useContextSelector)(exports.FormContext, selector);
|
|
36
32
|
}
|
|
@@ -52,6 +48,7 @@ exports.formControlTypes = [
|
|
|
52
48
|
"switch",
|
|
53
49
|
"slider",
|
|
54
50
|
"colorpicker",
|
|
51
|
+
"items",
|
|
55
52
|
];
|
|
56
53
|
exports.formControlTypesMd = [
|
|
57
54
|
{
|
|
@@ -110,6 +107,10 @@ exports.formControlTypesMd = [
|
|
|
110
107
|
value: "colorpicker",
|
|
111
108
|
description: "Renders ColorPicker",
|
|
112
109
|
},
|
|
110
|
+
{
|
|
111
|
+
value: "items",
|
|
112
|
+
description: "Renders Items",
|
|
113
|
+
},
|
|
113
114
|
{
|
|
114
115
|
value: "custom",
|
|
115
116
|
description: "Custom control specified in children",
|
|
@@ -16,7 +16,6 @@ exports.defaultProps = exports.getByPath = void 0;
|
|
|
16
16
|
exports.FormWithContextVar = FormWithContextVar;
|
|
17
17
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
18
|
const react_1 = require("react");
|
|
19
|
-
const react_2 = require("react");
|
|
20
19
|
const react_dom_1 = require("react-dom");
|
|
21
20
|
const immer_1 = __importDefault(require("immer"));
|
|
22
21
|
const Form_module_scss_1 = __importDefault(require("./Form.module.scss"));
|
|
@@ -32,27 +31,9 @@ const ValidationSummary_1 = require("../ValidationSummary/ValidationSummary");
|
|
|
32
31
|
const Validations_1 = require("../FormItem/Validations");
|
|
33
32
|
const formActions_2 = require("../Form/formActions");
|
|
34
33
|
const FormContext_1 = require("./FormContext");
|
|
35
|
-
const
|
|
36
|
-
const keys = path.split(".");
|
|
37
|
-
for (let i = 0; i < keys.length; i++) {
|
|
38
|
-
const currentKey = keys[i];
|
|
39
|
-
const nextKey = keys[i + 1];
|
|
40
|
-
if (typeof nextKey !== "undefined") {
|
|
41
|
-
obj[currentKey] = obj[currentKey] ? obj[currentKey] : {};
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
obj[currentKey] = val;
|
|
45
|
-
}
|
|
46
|
-
obj = obj[currentKey];
|
|
47
|
-
}
|
|
48
|
-
};
|
|
34
|
+
const lodash_es_1 = require("lodash-es");
|
|
49
35
|
const getByPath = (obj, path) => {
|
|
50
|
-
|
|
51
|
-
let ret = obj;
|
|
52
|
-
for (let i = 0; i < keys.length; i++) {
|
|
53
|
-
ret = ret === null || ret === void 0 ? void 0 : ret[keys[i]];
|
|
54
|
-
}
|
|
55
|
-
return ret;
|
|
36
|
+
return (0, lodash_es_1.get)(obj, path);
|
|
56
37
|
};
|
|
57
38
|
exports.getByPath = getByPath;
|
|
58
39
|
const formReducer = (0, immer_1.default)((state, action) => {
|
|
@@ -71,16 +52,17 @@ const formReducer = (0, immer_1.default)((state, action) => {
|
|
|
71
52
|
switch (action.type) {
|
|
72
53
|
case formActions_1.FormActionKind.FIELD_INITIALIZED: {
|
|
73
54
|
if (!state.interactionFlags[uid].isDirty || action.payload.force) {
|
|
74
|
-
|
|
55
|
+
(0, lodash_es_1.set)(state.subject, uid, action.payload.value);
|
|
75
56
|
}
|
|
76
57
|
break;
|
|
77
58
|
}
|
|
78
59
|
case formActions_1.FormActionKind.FIELD_REMOVED: {
|
|
79
60
|
delete state.validationResults[uid];
|
|
61
|
+
delete state.interactionFlags[uid];
|
|
80
62
|
break;
|
|
81
63
|
}
|
|
82
64
|
case formActions_1.FormActionKind.FIELD_VALUE_CHANGED: {
|
|
83
|
-
|
|
65
|
+
(0, lodash_es_1.set)(state.subject, uid, action.payload.value);
|
|
84
66
|
state.interactionFlags[uid].isDirty = true;
|
|
85
67
|
state.interactionFlags[uid].forceShowValidationResult = false;
|
|
86
68
|
break;
|
|
@@ -170,6 +152,7 @@ const formReducer = (0, immer_1.default)((state, action) => {
|
|
|
170
152
|
return Object.assign(Object.assign({}, initialState), { subject: originalSubject, resetVersion: ((_e = state.resetVersion) !== null && _e !== void 0 ? _e : 0) + 1 });
|
|
171
153
|
}
|
|
172
154
|
default:
|
|
155
|
+
break;
|
|
173
156
|
}
|
|
174
157
|
});
|
|
175
158
|
const initialState = {
|
|
@@ -188,13 +171,22 @@ exports.defaultProps = {
|
|
|
188
171
|
itemLabelBreak: true,
|
|
189
172
|
keepModalOpenOnSubmit: false,
|
|
190
173
|
};
|
|
191
|
-
|
|
174
|
+
// --- Remove the properties from formState.subject where the property name ends with UNBOUND_FIELD_SUFFIX
|
|
175
|
+
function cleanUpSubject(subject) {
|
|
176
|
+
return Object.entries(subject || {}).reduce((acc, [key, value]) => {
|
|
177
|
+
if (!key.endsWith(formActions_1.UNBOUND_FIELD_SUFFIX)) {
|
|
178
|
+
acc[key] = value;
|
|
179
|
+
}
|
|
180
|
+
return acc;
|
|
181
|
+
}, {});
|
|
182
|
+
}
|
|
183
|
+
const Form = (0, react_1.forwardRef)(function ({ formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, enabled = true, cancelLabel = "Cancel", saveLabel = "Save", saveInProgressLabel = "Saving...", swapCancelAndSave, onSubmit, onCancel, onReset, buttonRow, id, registerComponentApi, itemLabelBreak = true, itemLabelWidth, itemLabelPosition = "top", keepModalOpenOnSubmit = false, }, ref) {
|
|
192
184
|
const formRef = (0, react_1.useRef)(null);
|
|
193
185
|
(0, react_1.useImperativeHandle)(ref, () => formRef.current);
|
|
194
|
-
const [confirmSubmitModalVisible, setConfirmSubmitModalVisible] = (0,
|
|
186
|
+
const [confirmSubmitModalVisible, setConfirmSubmitModalVisible] = (0, react_1.useState)(false);
|
|
195
187
|
const requestModalFormClose = (0, ModalVisibilityContext_1.useModalFormClose)();
|
|
196
188
|
const isEnabled = enabled && !formState.submitInProgress;
|
|
197
|
-
const formContextValue = (0,
|
|
189
|
+
const formContextValue = (0, react_1.useMemo)(() => {
|
|
198
190
|
return {
|
|
199
191
|
itemLabelBreak,
|
|
200
192
|
itemLabelWidth,
|
|
@@ -203,7 +195,6 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
203
195
|
originalSubject: initialValue,
|
|
204
196
|
validationResults: formState.validationResults,
|
|
205
197
|
interactionFlags: formState.interactionFlags,
|
|
206
|
-
resetVersion: formState.resetVersion,
|
|
207
198
|
dispatch,
|
|
208
199
|
enabled: isEnabled,
|
|
209
200
|
};
|
|
@@ -212,7 +203,6 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
212
203
|
formState.interactionFlags,
|
|
213
204
|
formState.subject,
|
|
214
205
|
formState.validationResults,
|
|
215
|
-
formState.resetVersion,
|
|
216
206
|
initialValue,
|
|
217
207
|
isEnabled,
|
|
218
208
|
itemLabelBreak,
|
|
@@ -242,13 +232,7 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
242
232
|
const prevFocused = document.activeElement;
|
|
243
233
|
dispatch((0, formActions_1.formSubmitting)());
|
|
244
234
|
try {
|
|
245
|
-
|
|
246
|
-
const filteredSubject = Object.entries(formState.subject).reduce((acc, [key, value]) => {
|
|
247
|
-
if (!key.endsWith(formActions_1.UNBOUND_FIELD_SUFFIX)) {
|
|
248
|
-
acc[key] = value;
|
|
249
|
-
}
|
|
250
|
-
return acc;
|
|
251
|
-
}, {});
|
|
235
|
+
const filteredSubject = cleanUpSubject(formState.subject);
|
|
252
236
|
yield (onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(filteredSubject, {
|
|
253
237
|
passAsDefaultBody: true,
|
|
254
238
|
}));
|
|
@@ -323,19 +307,19 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
323
307
|
});
|
|
324
308
|
});
|
|
325
309
|
const cancelButton = cancelLabel === "" ? null : ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: "button", themeColor: "secondary", variant: "ghost", onClick: doCancel, children: cancelLabel }, "cancel"));
|
|
326
|
-
const submitButton = (0,
|
|
327
|
-
(0,
|
|
310
|
+
const submitButton = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: "submit", disabled: !isEnabled, children: formState.submitInProgress ? saveInProgressLabel : saveLabel }, "submit")), [isEnabled, formState.submitInProgress, saveInProgressLabel, saveLabel]);
|
|
311
|
+
(0, react_1.useEffect)(() => {
|
|
328
312
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
329
313
|
reset: doReset,
|
|
330
314
|
update: updateData,
|
|
331
315
|
});
|
|
332
316
|
}, [doReset, updateData, registerComponentApi]);
|
|
333
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("form", { style: style, className: Form_module_scss_1.default.wrapper, onSubmit: doSubmit, onReset: doReset, id: id, ref: formRef, children: [(0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults }), (0, jsx_runtime_1.jsx)(FormContext_1.FormContext.Provider, { value: formContextValue, children: children }), buttonRow || ((0, jsx_runtime_1.jsxs)("div", { className: Form_module_scss_1.default.buttonRow, children: [swapCancelAndSave && [submitButton, cancelButton], !swapCancelAndSave && [cancelButton, submitButton]] }))] }), confirmSubmitModalVisible && ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialog, { onClose: () => setConfirmSubmitModalVisible(false), isInitiallyOpen: true, title: "Are you sure want to move forward?", children: (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "vertical", style: { gap: "0.5rem" }, children: [(0, jsx_runtime_1.jsx)(TextNative_1.Text, { children: "The following warnings were found during validation. Please make sure you are willing to move forward despite these issues." }), (0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults, fieldValidationResults: formState.validationResults }), (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "horizontal", horizontalAlignment: "end", style: { gap: "1em" }, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", onClick: () => setConfirmSubmitModalVisible(false), children: "No" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => doSubmit(), autoFocus: true, children: "Yes, proceed" })] })] }) }))] }));
|
|
317
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("form", { style: style, className: Form_module_scss_1.default.wrapper, onSubmit: doSubmit, onReset: doReset, id: id, ref: formRef, children: [(0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults }), (0, jsx_runtime_1.jsx)(FormContext_1.FormContext.Provider, { value: formContextValue, children: children }), buttonRow || ((0, jsx_runtime_1.jsxs)("div", { className: Form_module_scss_1.default.buttonRow, children: [swapCancelAndSave && [submitButton, cancelButton], !swapCancelAndSave && [cancelButton, submitButton]] }))] }, formState.resetVersion), confirmSubmitModalVisible && ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialog, { onClose: () => setConfirmSubmitModalVisible(false), isInitiallyOpen: true, title: "Are you sure want to move forward?", children: (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "vertical", style: { gap: "0.5rem" }, children: [(0, jsx_runtime_1.jsx)(TextNative_1.Text, { children: "The following warnings were found during validation. Please make sure you are willing to move forward despite these issues." }), (0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults, fieldValidationResults: formState.validationResults }), (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "horizontal", horizontalAlignment: "end", style: { gap: "1em" }, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", onClick: () => setConfirmSubmitModalVisible(false), children: "No" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => doSubmit(), autoFocus: true, children: "Yes, proceed" })] })] }) }))] }));
|
|
334
318
|
});
|
|
335
319
|
Form.displayName = "Form";
|
|
336
320
|
function FormWithContextVar({ node, renderChild, extractValue, style, lookupEventHandler, registerComponentApi, }) {
|
|
337
|
-
const [formState, dispatch] = (0,
|
|
338
|
-
const
|
|
321
|
+
const [formState, dispatch] = (0, react_1.useReducer)(formReducer, initialState);
|
|
322
|
+
const $data = (0, react_1.useMemo)(() => {
|
|
339
323
|
const updateData = (change) => {
|
|
340
324
|
if (typeof change !== "object" || change === null || change === undefined) {
|
|
341
325
|
return;
|
|
@@ -350,14 +334,17 @@ function FormWithContextVar({ node, renderChild, extractValue, style, lookupEven
|
|
|
350
334
|
});
|
|
351
335
|
});
|
|
352
336
|
};
|
|
337
|
+
return Object.assign(Object.assign({}, cleanUpSubject(formState.subject)), { update: updateData });
|
|
338
|
+
}, [formState.subject]);
|
|
339
|
+
const nodeWithItem = (0, react_1.useMemo)(() => {
|
|
353
340
|
return {
|
|
354
341
|
type: "Fragment",
|
|
355
342
|
vars: {
|
|
356
|
-
$data:
|
|
343
|
+
$data: $data,
|
|
357
344
|
},
|
|
358
345
|
children: node.children,
|
|
359
346
|
};
|
|
360
|
-
}, [
|
|
347
|
+
}, [$data, node.children]);
|
|
361
348
|
const initialValue = extractValue(node.props.data);
|
|
362
349
|
const submitMethod = extractValue.asOptionalString(node.props.submitMethod) || (initialValue ? "put" : "post");
|
|
363
350
|
const submitUrl = extractValue.asOptionalString(node.props.submitUrl) ||
|
|
@@ -366,6 +353,17 @@ function FormWithContextVar({ node, renderChild, extractValue, style, lookupEven
|
|
|
366
353
|
defaultHandler: submitUrl
|
|
367
354
|
? `(eventArgs)=> Actions.callApi({ url: "${submitUrl}", method: "${submitMethod}", body: eventArgs })`
|
|
368
355
|
: undefined,
|
|
369
|
-
|
|
356
|
+
context: {
|
|
357
|
+
$data,
|
|
358
|
+
},
|
|
359
|
+
}), onCancel: lookupEventHandler("cancel", {
|
|
360
|
+
context: {
|
|
361
|
+
$data,
|
|
362
|
+
},
|
|
363
|
+
}), onReset: lookupEventHandler("reset", {
|
|
364
|
+
context: {
|
|
365
|
+
$data,
|
|
366
|
+
},
|
|
367
|
+
}), initialValue: initialValue, buttonRow: renderChild(node.props.buttonRowTemplate), registerComponentApi: registerComponentApi, enabled: extractValue.asOptionalBoolean(node.props.enabled, true) &&
|
|
370
368
|
!extractValue.asOptionalBoolean(node.props.loading, false), children: renderChild(nodeWithItem) }));
|
|
371
369
|
}
|
|
@@ -151,6 +151,9 @@ exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
151
151
|
inputTemplate: {
|
|
152
152
|
description: "This property is used to define a custom input template.",
|
|
153
153
|
},
|
|
154
|
+
gap: {
|
|
155
|
+
description: "This property defines the gap between the adornments and the input area.",
|
|
156
|
+
},
|
|
154
157
|
},
|
|
155
158
|
events: {
|
|
156
159
|
validate: (0, ComponentDefs_1.d)(`This event is used to define a custom validation function.`),
|
|
@@ -174,7 +177,7 @@ exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
174
177
|
});
|
|
175
178
|
exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.FormItemMd, ({ node, renderChild, extractValue, layoutCss, layoutContext, lookupEventHandler, lookupAction, registerComponentApi, }) => {
|
|
176
179
|
var _a;
|
|
177
|
-
const _b = node.props, { bindTo, autoFocus, label, labelPosition, labelWidth, labelBreak, enabled, required, type, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity, customValidationsDebounce, validationMode, maxTextLength } = _b, rest = __rest(_b, ["bindTo", "autoFocus", "label", "labelPosition", "labelWidth", "labelBreak", "enabled", "required", "type", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "customValidationsDebounce", "validationMode", "maxTextLength"]);
|
|
180
|
+
const _b = node.props, { bindTo, autoFocus, label, labelPosition, labelWidth, labelBreak, enabled, required, type, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity, customValidationsDebounce, validationMode, maxTextLength, gap } = _b, rest = __rest(_b, ["bindTo", "autoFocus", "label", "labelPosition", "labelWidth", "labelBreak", "enabled", "required", "type", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "customValidationsDebounce", "validationMode", "maxTextLength", "gap"]);
|
|
178
181
|
//extractValue works as a memoization mechanism too (if there's nothing to resolve, it won't produce a new object every time)
|
|
179
182
|
const resolvedValidationPropsAndEvents = extractValue({
|
|
180
183
|
required: extractValue.asOptionalBoolean(required),
|
|
@@ -203,9 +206,9 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
|
|
|
203
206
|
const formItemType = extractValue.asOptionalString(type);
|
|
204
207
|
const isCustomFormItem = formItemType === undefined && !!node.children;
|
|
205
208
|
const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
|
|
206
|
-
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem, Object.assign({ style: layoutCss, layoutContext: layoutContext, labelBreak: extractValue.asOptionalBoolean(labelBreak), labelWidth: extractValue.asOptionalString(labelWidth), bindTo: extractValue.asString(bindTo), autoFocus: extractValue.asOptionalBoolean(autoFocus), enabled: extractValue.asOptionalBoolean(enabled), label: extractValue.asOptionalString(label), labelPosition: extractValue.asOptionalString(labelPosition), type: isCustomFormItem ? "custom" : formItemType, validations: resolvedValidationPropsAndEvents, onValidate: lookupEventHandler("validate"), customValidationsDebounce: extractValue.asOptionalNumber(customValidationsDebounce), validationMode: extractValue.asOptionalString(validationMode), registerComponentApi: registerComponentApi, maxTextLength: extractValue(maxTextLength), inputRenderer: inputTemplate
|
|
209
|
+
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem, Object.assign({ style: layoutCss, layoutContext: layoutContext, labelBreak: extractValue.asOptionalBoolean(labelBreak), labelWidth: extractValue.asOptionalString(labelWidth), bindTo: extractValue.asString(bindTo), autoFocus: extractValue.asOptionalBoolean(autoFocus), enabled: extractValue.asOptionalBoolean(enabled), label: extractValue.asOptionalString(label), labelPosition: extractValue.asOptionalString(labelPosition), type: isCustomFormItem ? "custom" : formItemType, validations: resolvedValidationPropsAndEvents, onValidate: lookupEventHandler("validate"), customValidationsDebounce: extractValue.asOptionalNumber(customValidationsDebounce), validationMode: extractValue.asOptionalString(validationMode), registerComponentApi: registerComponentApi, maxTextLength: extractValue(maxTextLength), itemIndex: extractValue("{$itemIndex}"), initialValue: extractValue(node.props.initialValue), inputRenderer: inputTemplate
|
|
207
210
|
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
208
|
-
: undefined }, resolvedRestProps, { children: isCustomFormItem ? ((0, jsx_runtime_1.jsx)(FormItemNative_1.CustomFormItem, { renderChild: renderChild, node: node, bindTo: extractValue.asString(bindTo) })) : (renderChild(node.children, {
|
|
211
|
+
: undefined, gap: extractValue.asOptionalString(gap) }, resolvedRestProps, { children: isCustomFormItem ? ((0, jsx_runtime_1.jsx)(FormItemNative_1.CustomFormItem, { renderChild: renderChild, node: node, bindTo: extractValue.asString(bindTo) })) : (renderChild(node.children, {
|
|
209
212
|
type: formItemType,
|
|
210
213
|
})) })));
|
|
211
214
|
});
|
|
@@ -36,6 +36,8 @@ const SliderNative_1 = require("../Slider/SliderNative");
|
|
|
36
36
|
const ColorPickerNative_1 = require("../ColorPicker/ColorPickerNative");
|
|
37
37
|
const HelperText_1 = require("./HelperText");
|
|
38
38
|
const NumberBox2Native_1 = require("../NumberBox/NumberBox2Native");
|
|
39
|
+
const ItemsNative_1 = require("../Items/ItemsNative");
|
|
40
|
+
const constants_1 = require("../../components-core/constants");
|
|
39
41
|
const DEFAULT_LABEL_POSITIONS = {
|
|
40
42
|
checkbox: "end",
|
|
41
43
|
};
|
|
@@ -45,32 +47,63 @@ exports.defaultProps = {
|
|
|
45
47
|
enabled: true,
|
|
46
48
|
customValidationsDebounce: 0,
|
|
47
49
|
};
|
|
50
|
+
const FormItemContext = (0, react_1.createContext)({ parentFormItemId: null });
|
|
51
|
+
function ArrayLikeFormItem({ children, formItemId, registerComponentApi, value = constants_1.EMPTY_ARRAY, updateState, }) {
|
|
52
|
+
const formContextValue = (0, react_1.useMemo)(() => {
|
|
53
|
+
return {
|
|
54
|
+
parentFormItemId: formItemId,
|
|
55
|
+
};
|
|
56
|
+
}, [formItemId]);
|
|
57
|
+
const addItem = (0, misc_1.useEvent)((item) => {
|
|
58
|
+
updateState({ value: [...value, item] });
|
|
59
|
+
});
|
|
60
|
+
const removeItem = (0, misc_1.useEvent)((index) => {
|
|
61
|
+
updateState({ value: value.filter((item, i) => i !== index) });
|
|
62
|
+
});
|
|
63
|
+
(0, react_1.useEffect)(() => {
|
|
64
|
+
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
65
|
+
addItem: addItem,
|
|
66
|
+
removeItem: removeItem,
|
|
67
|
+
});
|
|
68
|
+
}, [addItem, registerComponentApi, removeItem]);
|
|
69
|
+
return (0, jsx_runtime_1.jsx)(FormItemContext.Provider, { value: formContextValue, children: children });
|
|
70
|
+
}
|
|
48
71
|
exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
49
|
-
var
|
|
50
|
-
var { style, bindTo, type = exports.defaultProps.type, label, enabled = exports.defaultProps.enabled, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, children, validations, onValidate, customValidationsDebounce = exports.defaultProps.customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer"]);
|
|
72
|
+
var { style, bindTo, type = exports.defaultProps.type, label, enabled = exports.defaultProps.enabled, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, children, validations, onValidate, customValidationsDebounce = exports.defaultProps.customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer, itemIndex, initialValue: initialValueFromProps, gap } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer", "itemIndex", "initialValue", "gap"]);
|
|
51
73
|
const defaultId = (0, react_1.useId)();
|
|
52
|
-
const
|
|
74
|
+
const { parentFormItemId } = (0, react_1.useContext)(FormItemContext);
|
|
75
|
+
const formItemId = (0, react_1.useMemo)(() => {
|
|
76
|
+
const safeBindTo = bindTo || `${defaultId}${formActions_1.UNBOUND_FIELD_SUFFIX}`;
|
|
77
|
+
if (parentFormItemId) {
|
|
78
|
+
if (itemIndex !== undefined) {
|
|
79
|
+
let parentFieldReference = `${parentFormItemId}[${itemIndex}]`;
|
|
80
|
+
if (bindTo !== undefined && bindTo.trim() === "") {
|
|
81
|
+
return parentFieldReference;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return `${parentFieldReference}.${safeBindTo}`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return safeBindTo;
|
|
90
|
+
}
|
|
91
|
+
}, [bindTo, defaultId, itemIndex, parentFormItemId]);
|
|
53
92
|
const labelWidthValue = (0, FormContext_1.useFormContextPart)((value) => labelWidth || value.itemLabelWidth);
|
|
54
93
|
const labelBreakValue = (0, FormContext_1.useFormContextPart)((value) => labelBreak !== undefined ? labelBreak : value.itemLabelBreak);
|
|
55
94
|
const labelPositionValue = (0, FormContext_1.useFormContextPart)((value) => labelPosition || value.itemLabelPosition || DEFAULT_LABEL_POSITIONS[type]);
|
|
56
|
-
const resetVersion = (_b = (0, FormContext_1.useFormContext)()) === null || _b === void 0 ? void 0 : _b.resetVersion;
|
|
57
95
|
const initialValueFromSubject = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.originalSubject, formItemId));
|
|
58
|
-
const initialValue = initialValueFromSubject === undefined ?
|
|
96
|
+
const initialValue = initialValueFromSubject === undefined ? initialValueFromProps : initialValueFromSubject;
|
|
59
97
|
const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, formItemId));
|
|
60
98
|
const validationResult = (0, FormContext_1.useFormContextPart)((value) => value.validationResults[formItemId]);
|
|
61
99
|
const dispatch = (0, FormContext_1.useFormContextPart)((value) => value.dispatch);
|
|
62
100
|
const formEnabled = (0, FormContext_1.useFormContextPart)((value) => value.enabled);
|
|
63
101
|
const isEnabled = enabled && formEnabled;
|
|
64
102
|
(0, react_1.useEffect)(() => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
dispatch((0, formActions_1.fieldInitialized)(newId, initialValue));
|
|
68
|
-
}, [bindTo, dispatch, initialValue]);
|
|
69
|
-
(0, react_1.useEffect)(() => {
|
|
70
|
-
if (resetVersion) {
|
|
71
|
-
dispatch((0, formActions_1.fieldInitialized)(formItemId, initialValue, true));
|
|
103
|
+
if (initialValue !== undefined) {
|
|
104
|
+
dispatch((0, formActions_1.fieldInitialized)(formItemId, initialValue));
|
|
72
105
|
}
|
|
73
|
-
}, [
|
|
106
|
+
}, [dispatch, formItemId, initialValue]);
|
|
74
107
|
(0, Validations_1.useValidation)(validations, onValidate, value, dispatch, formItemId, customValidationsDebounce);
|
|
75
108
|
const onStateChange = (0, react_1.useCallback)(({ value }, options) => {
|
|
76
109
|
//we already handled the initial value in the useEffect with fieldInitialized(...);
|
|
@@ -108,7 +141,7 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
108
141
|
}
|
|
109
142
|
case "number":
|
|
110
143
|
case "integer": {
|
|
111
|
-
formControl = ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, integersOnly: type === "integer", validationStatus: validationStatus, min: validations.minValue, max: validations.maxValue, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength })));
|
|
144
|
+
formControl = ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, integersOnly: type === "integer", validationStatus: validationStatus, min: validations.minValue, max: validations.maxValue, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength, gap: gap })));
|
|
112
145
|
break;
|
|
113
146
|
}
|
|
114
147
|
// NOTE: This is a prototype for the new number field
|
|
@@ -131,7 +164,8 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
131
164
|
break;
|
|
132
165
|
}
|
|
133
166
|
case "text": {
|
|
134
|
-
|
|
167
|
+
console.log("gap", gap);
|
|
168
|
+
formControl = ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength, gap: gap })));
|
|
135
169
|
break;
|
|
136
170
|
}
|
|
137
171
|
case "password": {
|
|
@@ -150,6 +184,10 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
150
184
|
formControl = ((0, jsx_runtime_1.jsx)(ColorPickerNative_1.ColorPicker, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus })));
|
|
151
185
|
break;
|
|
152
186
|
}
|
|
187
|
+
case "items": {
|
|
188
|
+
formControl = ((0, jsx_runtime_1.jsx)(ArrayLikeFormItem, { formItemId: formItemId, registerComponentApi: registerComponentApi, updateState: onStateChange, value: value, children: (0, jsx_runtime_1.jsx)(ItemsNative_1.Items, { items: value, renderItem: inputRenderer }) }));
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
153
191
|
case "custom": {
|
|
154
192
|
formControl = children;
|
|
155
193
|
break;
|
|
@@ -171,6 +209,9 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
171
209
|
(validationResult === null || validationResult === void 0 ? void 0 : validationResult.validations.map((singleValidation, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [singleValidation.isValid && !!singleValidation.validMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.validMessage, status: "valid", style: { opacity: singleValidation.stale ? 0.5 : undefined } })), !singleValidation.isValid && !!singleValidation.invalidMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.invalidMessage, status: singleValidation.severity, style: { opacity: singleValidation.stale ? 0.5 : undefined } }))] }, i)))) }), children: formControl }));
|
|
172
210
|
});
|
|
173
211
|
function CustomFormItem({ renderChild, node, bindTo, }) {
|
|
212
|
+
// IMPORTANT NOTE:
|
|
213
|
+
// why we use useFormContextPart, and not useFormContext?
|
|
214
|
+
// because we want to avoid re-rendering the whole form when the form state changes.
|
|
174
215
|
const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, bindTo));
|
|
175
216
|
const validationResult = (0, FormContext_1.useFormContextPart)((value) => value.validationResults[bindTo]);
|
|
176
217
|
const dispatch = (0, FormContext_1.useFormContextPart)((value) => value.dispatch);
|
|
@@ -14,7 +14,7 @@ const numberRegex = /^[0-9]+$/;
|
|
|
14
14
|
exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel({ id, labelPosition = "top", style, label, labelBreak = true, labelWidth, enabled = true, required = false, children, validationInProgress = false, shrinkToLabel = false, onFocus, onBlur, labelStyle, validationResult, isInputTemplateUsed = false, }, ref) {
|
|
15
15
|
const generatedId = (0, react_1.useId)();
|
|
16
16
|
const inputId = id || generatedId;
|
|
17
|
-
if (label === undefined) {
|
|
17
|
+
if (label === undefined && !validationResult) {
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { style: style, id: inputId, ref: ref, children: children }));
|
|
19
19
|
// return cloneElement(children as ReactElement, {
|
|
20
20
|
// ...mergeProps((children as ReactElement).props, {
|
|
@@ -84,6 +84,9 @@ exports.H1Md = (0, ComponentDefs_1.createMetadata)({
|
|
|
84
84
|
[`fontSize-${H1}`]: "$fontSize-large",
|
|
85
85
|
[`marginTop-${H1}`]: "0",
|
|
86
86
|
[`marginBottom-${H1}`]: "0",
|
|
87
|
+
[`fontSize-${H1}-markdown`]: "$fontSize-larger",
|
|
88
|
+
[`marginTop-${H1}-markdown`]: "0",
|
|
89
|
+
[`marginBottom-${H1}-markdown`]: "$space-6",
|
|
87
90
|
light: {
|
|
88
91
|
// --- No light-specific theme vars
|
|
89
92
|
},
|
|
@@ -106,6 +109,8 @@ exports.H2Md = (0, ComponentDefs_1.createMetadata)({
|
|
|
106
109
|
[`fontSize-${H2}`]: "$fontSize-medium",
|
|
107
110
|
[`marginTop-${H2}`]: "0",
|
|
108
111
|
[`marginBottom-${H2}`]: "0",
|
|
112
|
+
[`marginTop-${H2}-markdown`]: "$space-10",
|
|
113
|
+
[`marginBottom-${H2}-markdown`]: "$space-3",
|
|
109
114
|
light: {
|
|
110
115
|
// --- No light-specific theme vars
|
|
111
116
|
},
|
|
@@ -128,6 +133,8 @@ exports.H3Md = (0, ComponentDefs_1.createMetadata)({
|
|
|
128
133
|
[`fontSize-${H3}`]: "$fontSize-normal",
|
|
129
134
|
[`marginTop-${H3}`]: "0",
|
|
130
135
|
[`marginBottom-${H3}`]: "0",
|
|
136
|
+
[`marginTop-${H3}-markdown`]: "$space-6",
|
|
137
|
+
[`marginBottom-${H3}-markdown`]: "$space-2",
|
|
131
138
|
light: {
|
|
132
139
|
// --- No light-specific theme vars
|
|
133
140
|
},
|
|
@@ -150,6 +157,8 @@ exports.H4Md = (0, ComponentDefs_1.createMetadata)({
|
|
|
150
157
|
[`fontSize-${H4}`]: "$fontSize-small",
|
|
151
158
|
[`marginTop-${H4}`]: "0",
|
|
152
159
|
[`marginBottom-${H4}`]: "0",
|
|
160
|
+
[`marginTop-${H4}-markdown`]: "$space-5",
|
|
161
|
+
[`marginBottom-${H4}-markdown`]: "$space-1",
|
|
153
162
|
light: {
|
|
154
163
|
// --- No light-specific theme vars
|
|
155
164
|
},
|
|
@@ -172,6 +181,8 @@ exports.H5Md = (0, ComponentDefs_1.createMetadata)({
|
|
|
172
181
|
[`fontSize-${H5}`]: "$fontSize-smaller",
|
|
173
182
|
[`marginTop-${H5}`]: "0",
|
|
174
183
|
[`marginBottom-${H5}`]: "0",
|
|
184
|
+
[`marginTop-${H5}-markdown`]: "0",
|
|
185
|
+
[`marginBottom-${H5}-markdown`]: "$space-0",
|
|
175
186
|
light: {
|
|
176
187
|
// --- No light-specific theme vars
|
|
177
188
|
},
|
|
@@ -194,6 +205,8 @@ exports.H6Md = (0, ComponentDefs_1.createMetadata)({
|
|
|
194
205
|
[`fontSize-${H6}`]: "$fontSize-tiny",
|
|
195
206
|
[`marginTop-${H6}`]: "0",
|
|
196
207
|
[`marginBottom-${H6}`]: "0",
|
|
208
|
+
[`marginTop-${H6}-markdown`]: "0",
|
|
209
|
+
[`marginBottom-${H6}-markdown`]: "$space-0",
|
|
197
210
|
light: {
|
|
198
211
|
// --- No light-specific theme vars
|
|
199
212
|
},
|
|
@@ -59,5 +59,5 @@ exports.Heading = (0, react_1.forwardRef)(function Heading(_a, forwardedRef) {
|
|
|
59
59
|
[Heading_module_scss_1.default.truncateOverflow]: maxLines > 0,
|
|
60
60
|
[Heading_module_scss_1.default.preserveLinebreaks]: preserveLinebreaks,
|
|
61
61
|
[Heading_module_scss_1.default.noEllipsis]: !ellipses,
|
|
62
|
-
}) }, furtherProps, { children: [anchorId && ((0, jsx_runtime_1.jsx)("span", { ref: anchorRef, id: anchorId,
|
|
62
|
+
}) }, furtherProps, { children: [anchorId && ((0, jsx_runtime_1.jsx)("span", { ref: anchorRef, id: anchorId, className: Heading_module_scss_1.default.anchorRef, "data-anchor": true })), children] })));
|
|
63
63
|
});
|
|
@@ -655,7 +655,7 @@ exports.HtmlImgMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
655
655
|
loading: (0, ComponentDefs_1.d)("Specifies the loading behavior of the image"),
|
|
656
656
|
referrerPolicy: (0, ComponentDefs_1.d)("Specifies the referrer policy for the image"),
|
|
657
657
|
sizes: (0, ComponentDefs_1.d)("Specifies image sizes for different page layouts"),
|
|
658
|
-
}
|
|
658
|
+
}
|
|
659
659
|
});
|
|
660
660
|
exports.htmlImgTagRenderer = (0, renderers_1.createComponentRenderer)("img", exports.HtmlImgMd, ({ node, renderChild, extractValue, extractResourceUrl, layoutCss }) => {
|
|
661
661
|
const p = new extractParam_1.PropsTrasform(extractValue, extractResourceUrl, layoutCss, node.props);
|
|
@@ -750,6 +750,10 @@ exports.HtmlLiMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
750
750
|
props: {
|
|
751
751
|
value: (0, ComponentDefs_1.d)("Specifies the value of the list item (if the parent is an ordered list)"),
|
|
752
752
|
},
|
|
753
|
+
defaultThemeVars: {
|
|
754
|
+
"marginLeft-HtmlLi": "$space-6",
|
|
755
|
+
"paddingLeft-HtmlLi": "$space-1",
|
|
756
|
+
}
|
|
753
757
|
});
|
|
754
758
|
exports.htmlLiTagRenderer = (0, renderers_1.createComponentRenderer)("li", exports.HtmlLiMd, ({ node, renderChild, extractValue, extractResourceUrl, layoutCss }) => {
|
|
755
759
|
const p = new extractParam_1.PropsTrasform(extractValue, extractResourceUrl, layoutCss, node.props);
|
|
@@ -1362,8 +1366,8 @@ exports.HtmlUlMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
1362
1366
|
isHtmlTag: true,
|
|
1363
1367
|
themeVars: (0, themeVars_1.parseScssVar)(HtmlTags_module_scss_1.default.themeVarsList), // Use only themeVarsList
|
|
1364
1368
|
defaultThemeVars: {
|
|
1365
|
-
"marginTop-HtmlUl": "$space-
|
|
1366
|
-
"marginBottom-HtmlUl": "$space-
|
|
1369
|
+
"marginTop-HtmlUl": "$space-2",
|
|
1370
|
+
"marginBottom-HtmlUl": "$space-2",
|
|
1367
1371
|
},
|
|
1368
1372
|
});
|
|
1369
1373
|
exports.htmlUlTagRenderer = (0, renderers_1.createComponentRenderer)("ul", exports.HtmlUlMd, // Use HtmlOlMd instead of HtmlListMd
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DarkToLightIcon = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const dark_to_light_svg_react_1 = __importDefault(require("./svg/dark_to_light.svg?react"));
|
|
9
|
+
const DarkToLightIcon = (props) => ((0, jsx_runtime_1.jsx)(dark_to_light_svg_react_1.default, Object.assign({}, props)));
|
|
10
|
+
exports.DarkToLightIcon = DarkToLightIcon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LightToDarkIcon = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const light_to_dark_svg_react_1 = __importDefault(require("./svg/light_to_dark.svg?react"));
|
|
9
|
+
const LightToDarkIcon = (props) => ((0, jsx_runtime_1.jsx)(light_to_dark_svg_react_1.default, Object.assign({}, props)));
|
|
10
|
+
exports.LightToDarkIcon = LightToDarkIcon;
|
|
@@ -81,6 +81,8 @@ const TrendingLevelIcon_1 = require("./Icon/TrendingLevelIcon");
|
|
|
81
81
|
const Inspect_1 = require("./Icon/Inspect");
|
|
82
82
|
const MoonIcon_1 = require("./Icon/MoonIcon");
|
|
83
83
|
const StarsIcon_1 = require("./Icon/StarsIcon");
|
|
84
|
+
const LightToDark_1 = require("./Icon/LightToDark");
|
|
85
|
+
const DarkToLightIcon_1 = require("./Icon/DarkToLightIcon");
|
|
84
86
|
const pool = new Map();
|
|
85
87
|
function registerIconRenderer(name, renderer) {
|
|
86
88
|
if (typeof name === "object") {
|
|
@@ -143,6 +145,8 @@ registerIconRenderer("plus", (props) => (0, jsx_runtime_1.jsx)(PlusIcon_1.PlusIc
|
|
|
143
145
|
registerIconRenderer("inspect", (props) => (0, jsx_runtime_1.jsx)(Inspect_1.InspectIcon, Object.assign({}, props)));
|
|
144
146
|
registerIconRenderer("plus-circle", (props) => (0, jsx_runtime_1.jsx)(ai_1.AiOutlinePlusCircle, Object.assign({}, props)));
|
|
145
147
|
registerIconRenderer("filledplus", (props) => (0, jsx_runtime_1.jsx)(FillPlusCricleIcon_1.FillPlusCircleIcon, Object.assign({}, props)));
|
|
148
|
+
registerIconRenderer("darkToLight", (props) => (0, jsx_runtime_1.jsx)(DarkToLightIcon_1.DarkToLightIcon, Object.assign({}, props)));
|
|
149
|
+
registerIconRenderer("lightToDark", (props) => (0, jsx_runtime_1.jsx)(LightToDark_1.LightToDarkIcon, Object.assign({}, props)));
|
|
146
150
|
registerIconRenderer("checkmark", (props) => (0, jsx_runtime_1.jsx)(CheckIcon_1.CheckIcon, Object.assign({}, props)));
|
|
147
151
|
registerIconRenderer("valid", (props) => (0, jsx_runtime_1.jsx)(fi_1.FiCheckCircle, Object.assign({}, props)));
|
|
148
152
|
registerIconRenderer("info", (props) => (0, jsx_runtime_1.jsx)(fi_1.FiAlertOctagon, Object.assign({}, props)));
|
|
@@ -11,5 +11,5 @@ const Image_module_scss_1 = __importDefault(require("./Image.module.scss"));
|
|
|
11
11
|
exports.Image = (0, react_1.forwardRef)(function Img({ src, alt, fit = "contain", style, onClick, aspectRatio, lazyLoad }, ref) {
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)("img", { src: src, ref: ref, alt: alt, loading: lazyLoad ? "lazy" : "eager", className: (0, classnames_1.default)(Image_module_scss_1.default.img, {
|
|
13
13
|
[Image_module_scss_1.default.clickable]: !!onClick,
|
|
14
|
-
}), style: Object.assign(Object.assign({ objectFit: fit, boxShadow: "none" }, style), { aspectRatio: aspectRatio }), onClick: onClick }));
|
|
14
|
+
}), style: Object.assign(Object.assign({ objectFit: fit, boxShadow: "none" }, style), { flexShrink: 1, aspectRatio: aspectRatio }), onClick: onClick }));
|
|
15
15
|
});
|
|
@@ -18,10 +18,12 @@ function Items({ items, renderItem, reverse = false }) {
|
|
|
18
18
|
if (!itemsToRender || !Array.isArray(itemsToRender)) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: itemsToRender.map((item, index) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: itemsToRender.map((item, index) => {
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderItem === null || renderItem === void 0 ? void 0 : renderItem({
|
|
23
|
+
$item: item,
|
|
24
|
+
$itemIndex: index,
|
|
25
|
+
$isFirst: index === 0,
|
|
26
|
+
$isLast: index === itemsToRender.length - 1,
|
|
27
|
+
}, index) }, index);
|
|
28
|
+
}) }));
|
|
27
29
|
}
|
|
@@ -41,14 +41,14 @@ exports.LinkMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
41
41
|
defaultThemeVars: {
|
|
42
42
|
[`border-${COMP}`]: "0px solid $borderColor",
|
|
43
43
|
[`textColor-${COMP}--hover--active`]: `$textColor-${COMP}--active`,
|
|
44
|
-
[`textDecorationColor-${COMP}--hover`]: "$color-
|
|
45
|
-
[`
|
|
44
|
+
[`textDecorationColor-${COMP}--hover`]: "$color-primary-400",
|
|
45
|
+
[`textColor-${COMP}--hover`]: `$color-primary-400`,
|
|
46
|
+
[`textDecorationColor-${COMP}--active`]: "$color-primary-200",
|
|
46
47
|
[`fontWeight-${COMP}--active`]: "$fontWeight-bold",
|
|
47
|
-
[`textDecorationColor-${COMP}`]: "$color-
|
|
48
|
+
[`textDecorationColor-${COMP}`]: "$color-primary-400",
|
|
48
49
|
[`textUnderlineOffset-${COMP}`]: "$space-1",
|
|
49
50
|
[`textDecorationLine-${COMP}`]: "underline",
|
|
50
|
-
[`textDecorationStyle-${COMP}`]: "
|
|
51
|
-
[`textDecorationThickness-${COMP}`]: "$space-0_5",
|
|
51
|
+
[`textDecorationStyle-${COMP}`]: "solid",
|
|
52
52
|
[`outlineColor-${COMP}--focus`]: "$outlineColor--focus",
|
|
53
53
|
[`outlineWidth-${COMP}--focus`]: "$outlineWidth--focus",
|
|
54
54
|
[`outlineStyle-${COMP}--focus`]: "$outlineStyle--focus",
|
|
@@ -94,7 +94,7 @@ function useListData({ groupsInitiallyExpanded = true, expanded = constants_1.EM
|
|
|
94
94
|
if (!limit) {
|
|
95
95
|
return sortedItems;
|
|
96
96
|
}
|
|
97
|
-
return sortedItems.slice(0, limit
|
|
97
|
+
return sortedItems.slice(0, limit);
|
|
98
98
|
}, [sortedItems, limit]);
|
|
99
99
|
const sectionedItems = (0, react_1.useMemo)(() => {
|
|
100
100
|
if (groupBy === undefined) {
|