xmlui 0.9.10 → 0.9.12
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-BJYj3y8V.mjs → apiInterceptorWorker-dYrfbzdh.mjs} +1 -1
- package/dist/{index-6PAZN2xn.mjs → index-Dh2MThrK.mjs} +2127 -2300
- package/dist/index.css +112 -198
- package/dist/language-server-web-worker.mjs +1 -1
- package/dist/language-server.mjs +1 -1
- package/dist/{lint-DmJOJSJa.mjs → lint-Cd70ckJ6.mjs} +1 -11
- package/dist/{parser-B3m9ZEAK.mjs → parser-CBXS8ft2.mjs} +7 -5
- package/dist/scripts/bin/build-lib.js +42 -1
- package/dist/scripts/bin/vite-xmlui-plugin.js +2 -22
- package/dist/scripts/bin/viteConfig.js +3 -1
- package/dist/scripts/src/abstractions/ComponentDefs.js +2 -20
- package/dist/scripts/src/components/App/App.js +61 -21
- package/dist/scripts/src/components/Button/Button.js +5 -1
- package/dist/scripts/src/components/Button/ButtonNative.js +9 -2
- package/dist/scripts/src/components/Checkbox/Checkbox.js +2 -2
- package/dist/scripts/src/components/ComponentProvider.js +2 -0
- package/dist/scripts/src/components/Footer/Footer.js +1 -1
- package/dist/scripts/src/components/Form/FormContext.js +2 -0
- package/dist/scripts/src/components/FormItem/FormItemNative.js +9 -0
- package/dist/scripts/src/components/Items/Items.js +2 -1
- package/dist/scripts/src/components/List/List.js +2 -1
- package/dist/scripts/src/components/Markdown/Markdown.js +2 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.js +2 -2
- package/dist/scripts/src/components/NumberBox/NumberBox2.js +85 -0
- package/dist/scripts/src/components/NumberBox/NumberBox2Native.js +395 -0
- package/dist/scripts/src/components/NumberBox/numberbox-abstractions.js +35 -0
- package/dist/scripts/src/components/Option/Option.js +2 -1
- package/dist/scripts/src/components/Select/Select.js +8 -0
- package/dist/scripts/src/components/Select/SelectNative.js +24 -10
- package/dist/scripts/src/components/Theme/ThemeNative.js +1 -0
- package/dist/scripts/src/components/VisuallyHidden.js +21 -0
- package/dist/scripts/src/components-core/InspectorContext.js +15 -4
- package/dist/scripts/src/components-core/loader/DataLoader.js +110 -3
- package/dist/scripts/src/components-core/loader/Loader.js +29 -7
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +4 -1
- package/dist/scripts/src/components-core/rendering/ComponentWrapper.js +23 -5
- package/dist/scripts/src/components-core/rendering/Container.js +23 -26
- package/dist/scripts/src/components-core/rendering/StateContainer.js +2 -4
- package/dist/scripts/src/components-core/rendering/reducer.js +6 -5
- package/dist/scripts/src/components-core/utils/extractParam.js +24 -7
- package/dist/scripts/src/components-core/xmlui-parser.js +1 -1
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +1 -1
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +0 -10
- package/dist/scripts/src/parsers/xmlui-parser/utils.js +6 -9
- package/dist/{server-common-oCD2CuF9.mjs → server-common-DW5h7Q34.mjs} +122 -64
- package/dist/style.css +112 -98
- package/dist/xmlui-metadata.mjs +688 -229
- package/dist/xmlui-metadata.umd.js +687 -230
- package/dist/xmlui-parser.d.ts +14 -9
- package/dist/xmlui-parser.mjs +3 -3
- package/dist/xmlui-standalone.umd.js +4483 -7327
- package/dist/xmlui.d.ts +14 -1
- package/dist/xmlui.mjs +2 -1
- package/package.json +6 -4
- package/dist/scripts/src/components-core/devtools/DevTools.js +0 -225
- package/dist/scripts/src/syntax/monaco/grammar.monacoLanguage.js +0 -286
- package/dist/scripts/src/syntax/monaco/xmlui-dark.js +0 -27
- package/dist/scripts/src/syntax/monaco/xmlui-light.js +0 -26
- package/dist/scripts/src/syntax/monaco/xmluiscript.monacoLanguage.js +0 -310
package/dist/language-server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseRegExpLiteral } from "@eslint-community/regexpp";
|
|
2
|
-
import { S as SyntaxKind, C as CharacterCodes } from "./parser-
|
|
2
|
+
import { S as SyntaxKind, C as CharacterCodes } from "./parser-CBXS8ft2.mjs";
|
|
3
3
|
const LinkTargetMd = [
|
|
4
4
|
{
|
|
5
5
|
value: "_self",
|
|
@@ -5541,7 +5541,6 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
5541
5541
|
const shouldCollapseWhitespace = tagName !== "event" && tagName !== "method";
|
|
5542
5542
|
const attrs = getAttributes(node2);
|
|
5543
5543
|
desugarKeyOnlyAttrs(attrs);
|
|
5544
|
-
desugarQuotelessAttrs(attrs, getText);
|
|
5545
5544
|
parseEscapeCharactersInAttrValues(attrs);
|
|
5546
5545
|
parseEscapeCharactersInContent(childNodes);
|
|
5547
5546
|
mergeConsecutiveTexts(childNodes, shouldCollapseWhitespace);
|
|
@@ -5910,15 +5909,6 @@ function desugarKeyOnlyAttrs(attrs) {
|
|
|
5910
5909
|
}
|
|
5911
5910
|
}
|
|
5912
5911
|
}
|
|
5913
|
-
function desugarQuotelessAttrs(attrs, getText) {
|
|
5914
|
-
var _a, _b, _c;
|
|
5915
|
-
for (let attr of attrs) {
|
|
5916
|
-
const attrValue = (_a = attr.children) == null ? void 0 : _a[2];
|
|
5917
|
-
if (((_c = (_b = attr.children) == null ? void 0 : _b[2]) == null ? void 0 : _c.kind) === SyntaxKind.Identifier) {
|
|
5918
|
-
attrValue.text = '"' + getText(attrValue) + '"';
|
|
5919
|
-
}
|
|
5920
|
-
}
|
|
5921
|
-
}
|
|
5922
5912
|
function addToNamespaces(namespaceStack, comp, nsKey, value) {
|
|
5923
5913
|
let nsCommaSeparated = value.split(":");
|
|
5924
5914
|
if (nsCommaSeparated.length > 2) {
|
|
@@ -671,12 +671,15 @@ function tagNameNodesWithoutErrorsMatch(name1, name2, getText) {
|
|
|
671
671
|
}
|
|
672
672
|
function findTokenAtPos(node, position) {
|
|
673
673
|
const chain = [node];
|
|
674
|
-
let chainBeforePos;
|
|
675
674
|
let sharedParents;
|
|
676
675
|
if (node.start > position || position > node.end) {
|
|
677
676
|
return void 0;
|
|
678
677
|
}
|
|
679
|
-
const res = {
|
|
678
|
+
const res = {
|
|
679
|
+
chainAtPos: chain,
|
|
680
|
+
chainBeforePos: void 0,
|
|
681
|
+
sharedParents: void 0
|
|
682
|
+
};
|
|
680
683
|
while (node.children !== void 0 && node.children.length > 0) {
|
|
681
684
|
const nodeAtPosIdx = node.children.findIndex(
|
|
682
685
|
(n) => n.start <= position && (position < n.end || n.kind === SyntaxKind.EndOfFileToken && n.start <= n.end)
|
|
@@ -685,9 +688,8 @@ function findTokenAtPos(node, position) {
|
|
|
685
688
|
const nodeBeforePos = node.children[nodeAtPosIdx - 1];
|
|
686
689
|
if (nodeBeforePos !== void 0 && position <= nodeAtPos.pos) {
|
|
687
690
|
sharedParents = chain.length;
|
|
688
|
-
chainBeforePos = findLastToken(nodeBeforePos);
|
|
689
691
|
return {
|
|
690
|
-
chainBeforePos,
|
|
692
|
+
chainBeforePos: chain.concat(findLastToken(nodeBeforePos)),
|
|
691
693
|
sharedParents,
|
|
692
694
|
chainAtPos: chain.concat(findFirstToken(nodeAtPos))
|
|
693
695
|
};
|
|
@@ -881,7 +883,7 @@ function parseXmlUiMarkup(text) {
|
|
|
881
883
|
}
|
|
882
884
|
}
|
|
883
885
|
if (eat(SyntaxKind.Equal)) {
|
|
884
|
-
if (!eat(SyntaxKind.StringLiteral)
|
|
886
|
+
if (!eat(SyntaxKind.StringLiteral)) {
|
|
885
887
|
const attrFollowWithoutIdent = [SyntaxKind.NodeEnd, SyntaxKind.NodeClose];
|
|
886
888
|
errRecover(Diag_Attr_Value_Expected, attrFollowWithoutIdent);
|
|
887
889
|
}
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
37
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
38
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23,6 +56,14 @@ const buildLib = (_a) => __awaiter(void 0, [_a], void 0, function* ({ watchMode,
|
|
|
23
56
|
const env = (0, vite_1.loadEnv)(mode, process.cwd(), "");
|
|
24
57
|
const umdFileName = `${env.npm_package_name}.js`;
|
|
25
58
|
const esFileName = `${env.npm_package_name}.mjs`;
|
|
59
|
+
let overrides = {};
|
|
60
|
+
try {
|
|
61
|
+
const configOverrides = yield Promise.resolve(`${process.cwd() + `/vite.config-overrides`}`).then(s => __importStar(require(s)));
|
|
62
|
+
overrides = configOverrides.default || {};
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
// console.error(e);
|
|
66
|
+
}
|
|
26
67
|
const config = {
|
|
27
68
|
esbuild: {
|
|
28
69
|
target: "es2020",
|
|
@@ -70,7 +111,7 @@ const buildLib = (_a) => __awaiter(void 0, [_a], void 0, function* ({ watchMode,
|
|
|
70
111
|
},
|
|
71
112
|
},
|
|
72
113
|
},
|
|
73
|
-
plugins: mode === "metadata" ? [] : [(0, plugin_react_1.default)(), (0, vite_plugin_lib_inject_css_1.libInjectCss)()],
|
|
114
|
+
plugins: mode === "metadata" ? [] : [(0, plugin_react_1.default)(), (0, vite_plugin_lib_inject_css_1.libInjectCss)(), ...(overrides.plugins || [])],
|
|
74
115
|
};
|
|
75
116
|
yield (0, vite_1.build)((0, vite_1.defineConfig)(config));
|
|
76
117
|
});
|
|
@@ -47,7 +47,6 @@ const pluginutils_1 = require("@rollup/pluginutils");
|
|
|
47
47
|
const code_behind_collect_1 = require("../src/parsers/scripting/code-behind-collect");
|
|
48
48
|
const fileExtensions_1 = require("../src/parsers/xmlui-parser/fileExtensions");
|
|
49
49
|
const Parser_1 = require("../src/parsers/scripting/Parser");
|
|
50
|
-
const fs = __importStar(require("fs"));
|
|
51
50
|
const path = __importStar(require("path"));
|
|
52
51
|
const xmlui_parser_1 = require("../src/components-core/xmlui-parser");
|
|
53
52
|
const xmluiExtension = new RegExp(`.${fileExtensions_1.componentFileExtension}$`);
|
|
@@ -65,28 +64,9 @@ function viteXmluiPlugin(pluginOptions = {}) {
|
|
|
65
64
|
const moduleNameResolver = (moduleName) => {
|
|
66
65
|
return path.resolve(path.dirname(id), moduleName);
|
|
67
66
|
};
|
|
68
|
-
const moduleResolver = (parentModule, moduleName) => {
|
|
69
|
-
// --- Try with .xmlui.xs extension, and then with .xs.
|
|
70
|
-
try {
|
|
71
|
-
const modulePath = path.resolve(path.dirname(id), `${moduleName}.${fileExtensions_1.codeBehindFileExtension}`);
|
|
72
|
-
return fs.readFileSync(modulePath, {
|
|
73
|
-
encoding: "utf8",
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
catch (_a) {
|
|
77
|
-
try {
|
|
78
|
-
return fs.readFileSync(path.resolve(path.dirname(id), `${moduleName}.${fileExtensions_1.moduleFileExtension}`), {
|
|
79
|
-
encoding: "utf8",
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
throw err;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
67
|
if (xmluiExtension.test(id)) {
|
|
88
68
|
const fileId = "" + itemIndex++;
|
|
89
|
-
let { component, errors, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(code, fileId
|
|
69
|
+
let { component, errors, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(code, fileId);
|
|
90
70
|
if (errors.length > 0) {
|
|
91
71
|
component = (0, xmlui_parser_1.errReportComponent)(errors, id, erroneousCompoundComponentName);
|
|
92
72
|
}
|
|
@@ -115,7 +95,7 @@ function viteXmluiPlugin(pluginOptions = {}) {
|
|
|
115
95
|
// Check, if codeBehind.moduleErrors is not empty (Record<string, ModuleErrors[]>); each module
|
|
116
96
|
// should be checked for errors and warnings. If there are errors, throw an error.
|
|
117
97
|
return {
|
|
118
|
-
code: (0, pluginutils_1.dataToEsm)(codeBehind),
|
|
98
|
+
code: (0, pluginutils_1.dataToEsm)(Object.assign(Object.assign({}, codeBehind), { src: code })),
|
|
119
99
|
map: { mappings: "" },
|
|
120
100
|
};
|
|
121
101
|
}
|
|
@@ -61,7 +61,9 @@ function getViteConfig() {
|
|
|
61
61
|
const configOverrides = yield Promise.resolve(`${process.cwd() + `/vite.config-overrides`}`).then(s => __importStar(require(s)));
|
|
62
62
|
overrides = configOverrides.default || {};
|
|
63
63
|
}
|
|
64
|
-
catch (e) {
|
|
64
|
+
catch (e) {
|
|
65
|
+
// console.error(e);
|
|
66
|
+
}
|
|
65
67
|
return (0, vite_1.defineConfig)({
|
|
66
68
|
plugins: [(0, plugin_react_1.default)(), (0, vite_plugin_svgr_1.default)(), (0, vite_plugin_yaml_1.default)(), (0, vite_xmlui_plugin_1.default)({}), ...(overrides.plugins || [])],
|
|
67
69
|
base: withRelativeRoot ? "" : undefined,
|
|
@@ -2,26 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createMetadata = createMetadata;
|
|
4
4
|
exports.d = d;
|
|
5
|
-
function createMetadata(
|
|
6
|
-
return
|
|
7
|
-
description,
|
|
8
|
-
shortDescription,
|
|
9
|
-
specializedFrom,
|
|
10
|
-
status,
|
|
11
|
-
props,
|
|
12
|
-
events,
|
|
13
|
-
contextVars,
|
|
14
|
-
apis,
|
|
15
|
-
nonVisual,
|
|
16
|
-
opaque,
|
|
17
|
-
themeVars,
|
|
18
|
-
defaultThemeVars,
|
|
19
|
-
themeVarDescriptions,
|
|
20
|
-
toneSpecificThemeVars,
|
|
21
|
-
allowArbitraryProps,
|
|
22
|
-
docFolder,
|
|
23
|
-
isHtmlTag,
|
|
24
|
-
};
|
|
5
|
+
function createMetadata(metadata) {
|
|
6
|
+
return metadata;
|
|
25
7
|
}
|
|
26
8
|
function d(description, availableValues, valueType, defaultValue, isValid, isRequired) {
|
|
27
9
|
return { description, isRequired, availableValues, valueType, defaultValue, isValid };
|
|
@@ -12,6 +12,7 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
12
12
|
const metadata_helpers_1 = require("../../components/metadata-helpers");
|
|
13
13
|
const AppLayoutContext_1 = require("./AppLayoutContext");
|
|
14
14
|
const AppNative_1 = require("./AppNative");
|
|
15
|
+
const react_1 = require("react");
|
|
15
16
|
const COMP = "App";
|
|
16
17
|
exports.AppMd = (0, ComponentDefs_1.createMetadata)({
|
|
17
18
|
status: "stable",
|
|
@@ -97,26 +98,65 @@ exports.AppMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
97
98
|
},
|
|
98
99
|
},
|
|
99
100
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
101
|
+
function AppNode({ node, extractValue, renderChild, style, lookupEventHandler }) {
|
|
102
|
+
const { AppHeader, Footer, NavPanel, restChildren } = (0, react_1.useMemo)(() => {
|
|
103
|
+
var _a;
|
|
104
|
+
let AppHeader;
|
|
105
|
+
let Footer;
|
|
106
|
+
let NavPanel;
|
|
107
|
+
const restChildren = [];
|
|
108
|
+
(_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((rootChild) => {
|
|
109
|
+
var _a;
|
|
110
|
+
let transformedChild = Object.assign({}, rootChild);
|
|
111
|
+
if (rootChild.type === "Theme") {
|
|
112
|
+
transformedChild.children = (_a = rootChild.children) === null || _a === void 0 ? void 0 : _a.filter((child) => {
|
|
113
|
+
if (child.type === "AppHeader") {
|
|
114
|
+
AppHeader = Object.assign(Object.assign({}, rootChild), { children: [
|
|
115
|
+
child
|
|
116
|
+
] });
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
else if (child.type === "Footer") {
|
|
120
|
+
Footer = Object.assign(Object.assign({}, rootChild), { children: [
|
|
121
|
+
child
|
|
122
|
+
] });
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
else if (child.type === "NavPanel") {
|
|
126
|
+
NavPanel = Object.assign(Object.assign({}, rootChild), { children: [
|
|
127
|
+
child
|
|
128
|
+
] });
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
});
|
|
133
|
+
if (!transformedChild.children.length) {
|
|
134
|
+
transformedChild = null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (rootChild.type === "AppHeader") {
|
|
138
|
+
AppHeader = rootChild;
|
|
139
|
+
}
|
|
140
|
+
else if (rootChild.type === "Footer") {
|
|
141
|
+
Footer = rootChild;
|
|
142
|
+
}
|
|
143
|
+
else if (rootChild.type === "NavPanel") {
|
|
144
|
+
NavPanel = rootChild;
|
|
145
|
+
}
|
|
146
|
+
else if (transformedChild !== null) {
|
|
147
|
+
restChildren.push(transformedChild);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
AppHeader,
|
|
152
|
+
Footer,
|
|
153
|
+
NavPanel,
|
|
154
|
+
restChildren
|
|
155
|
+
};
|
|
156
|
+
}, [node.children]);
|
|
120
157
|
const layoutType = extractValue(node.props.layout);
|
|
121
|
-
return ((0, jsx_runtime_1.jsx)(AppNative_1.App, { scrollWholePage: extractValue.asOptionalBoolean(node.props.scrollWholePage, true), noScrollbarGutters: extractValue.asOptionalBoolean(node.props.noScrollbarGutters, false), style:
|
|
158
|
+
return ((0, jsx_runtime_1.jsx)(AppNative_1.App, { scrollWholePage: extractValue.asOptionalBoolean(node.props.scrollWholePage, true), noScrollbarGutters: extractValue.asOptionalBoolean(node.props.noScrollbarGutters, false), style: style, layout: layoutType, loggedInUser: extractValue(node.props.loggedInUser), onReady: lookupEventHandler("ready"), header: renderChild(AppHeader), footer: renderChild(Footer), navPanel: renderChild(NavPanel), navPanelDef: NavPanel, logoContentDef: node.props.logoTemplate, renderChild: renderChild, name: extractValue(node.props.name), logo: extractValue(node.props.logo), logoDark: extractValue(node.props["logo-dark"]), logoLight: extractValue(node.props["logo-light"]), defaultTone: extractValue(node.props.defaultTone), defaultTheme: extractValue(node.props.defaultTheme), children: renderChild(restChildren) }));
|
|
159
|
+
}
|
|
160
|
+
exports.appRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
161
|
+
return ((0, jsx_runtime_1.jsx)(AppNode, { node: node, renderChild: renderChild, extractValue: extractValue, style: layoutCss, lookupEventHandler: lookupEventHandler }));
|
|
122
162
|
});
|
|
@@ -85,6 +85,10 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
85
85
|
type: "string",
|
|
86
86
|
defaultValue: ButtonNative_1.defaultProps.contentPosition,
|
|
87
87
|
},
|
|
88
|
+
contextualLabel: {
|
|
89
|
+
description: `This optional value is used to provide an accessible name for the ${COMP} in the context of its usage.`,
|
|
90
|
+
type: "string",
|
|
91
|
+
},
|
|
88
92
|
},
|
|
89
93
|
events: {
|
|
90
94
|
click: (0, metadata_helpers_1.dClick)(COMP),
|
|
@@ -151,5 +155,5 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
151
155
|
exports.buttonComponentRenderer = (0, renderers_1.createComponentRenderer)("Button", exports.ButtonMd, ({ node, extractValue, renderChild, lookupEventHandler, layoutCss }) => {
|
|
152
156
|
const iconName = extractValue.asString(node.props.icon);
|
|
153
157
|
const label = extractValue.asDisplayText(node.props.label);
|
|
154
|
-
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: extractValue.asOptionalString(node.props.type), variant: extractValue.asOptionalString(node.props.variant), themeColor: extractValue.asOptionalString(node.props.themeColor), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), size: extractValue.asOptionalString(node.props.size), icon: iconName && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName }), iconPosition: extractValue.asOptionalString(node.props.iconPosition), orientation: extractValue.asOptionalString(node.props.orientation), contentPosition: extractValue.asOptionalString(node.props.contentPosition), disabled: !extractValue.asOptionalBoolean(node.props.enabled, true), onClick: lookupEventHandler("click"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), style: layoutCss, children: renderChild(node.children, { type: "Stack", orientation: "horizontal" }) || label }));
|
|
158
|
+
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: extractValue.asOptionalString(node.props.type), variant: extractValue.asOptionalString(node.props.variant), themeColor: extractValue.asOptionalString(node.props.themeColor), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), size: extractValue.asOptionalString(node.props.size), icon: iconName && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName, "aria-hidden": true }), iconPosition: extractValue.asOptionalString(node.props.iconPosition), orientation: extractValue.asOptionalString(node.props.orientation), contentPosition: extractValue.asOptionalString(node.props.contentPosition), disabled: !extractValue.asOptionalBoolean(node.props.enabled, true), onClick: lookupEventHandler("click"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), style: layoutCss, contextualLabel: extractValue.asOptionalString(node.props.contextualLabel), children: renderChild(node.children, { type: "Stack", orientation: "horizontal" }) || label }));
|
|
155
159
|
});
|
|
@@ -53,6 +53,7 @@ const react_1 = __importStar(require("react"));
|
|
|
53
53
|
const classnames_1 = __importDefault(require("classnames"));
|
|
54
54
|
const Button_module_scss_1 = __importDefault(require("./Button.module.scss"));
|
|
55
55
|
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
56
|
+
const VisuallyHidden_1 = require("../VisuallyHidden");
|
|
56
57
|
exports.defaultProps = {
|
|
57
58
|
type: "button",
|
|
58
59
|
iconPosition: "start",
|
|
@@ -64,7 +65,7 @@ exports.defaultProps = {
|
|
|
64
65
|
autoFocus: false,
|
|
65
66
|
};
|
|
66
67
|
exports.Button = react_1.default.forwardRef(function Button(_a, ref) {
|
|
67
|
-
var { id, type = exports.defaultProps.type, icon, iconPosition = exports.defaultProps.iconPosition, contentPosition = exports.defaultProps.contentPosition, orientation = exports.defaultProps.orientation, variant = exports.defaultProps.variant, themeColor = exports.defaultProps.themeColor, size = exports.defaultProps.size, disabled, children, formId, onClick, onFocus, onBlur, style, gap, className, autoFocus = exports.defaultProps.autoFocus } = _a, rest = __rest(_a, ["id", "type", "icon", "iconPosition", "contentPosition", "orientation", "variant", "themeColor", "size", "disabled", "children", "formId", "onClick", "onFocus", "onBlur", "style", "gap", "className", "autoFocus"]);
|
|
68
|
+
var { id, type = exports.defaultProps.type, icon, iconPosition = exports.defaultProps.iconPosition, contentPosition = exports.defaultProps.contentPosition, orientation = exports.defaultProps.orientation, variant = exports.defaultProps.variant, themeColor = exports.defaultProps.themeColor, size = exports.defaultProps.size, disabled, children, formId, onClick, onFocus, onBlur, style, gap, className, autoFocus = exports.defaultProps.autoFocus, contextualLabel } = _a, rest = __rest(_a, ["id", "type", "icon", "iconPosition", "contentPosition", "orientation", "variant", "themeColor", "size", "disabled", "children", "formId", "onClick", "onFocus", "onBlur", "style", "gap", "className", "autoFocus", "contextualLabel"]);
|
|
68
69
|
const innerRef = (0, react_1.useRef)(null);
|
|
69
70
|
const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, innerRef) : innerRef;
|
|
70
71
|
(0, react_1.useEffect)(() => {
|
|
@@ -94,5 +95,11 @@ exports.Button = react_1.default.forwardRef(function Button(_a, ref) {
|
|
|
94
95
|
[Button_module_scss_1.default.ghostAttention]: variant === "ghost" && themeColor === "attention",
|
|
95
96
|
[Button_module_scss_1.default.alignStart]: contentPosition === "start",
|
|
96
97
|
[Button_module_scss_1.default.alignEnd]: contentPosition === "end",
|
|
97
|
-
}), autoFocus: autoFocus, disabled: disabled, form: formId, style: style, onClick: onClick, onFocus: onFocus, onBlur: onBlur, children: [iconToLeft && icon, children, !iconToLeft && icon] })));
|
|
98
|
+
}), autoFocus: autoFocus, disabled: disabled, form: formId, style: style, onClick: onClick, onFocus: onFocus, onBlur: onBlur, children: [icon && iconToLeft && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: icon }), children, icon && !children && (0, jsx_runtime_1.jsx)(IconLabel, { icon: icon, accessibleName: contextualLabel }), icon && !iconToLeft && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: icon })] })));
|
|
98
99
|
});
|
|
100
|
+
const IconLabel = ({ icon, accessibleName = "" }) => {
|
|
101
|
+
// NOTE: the icon object provided is a React object with accessible props attribute.
|
|
102
|
+
// Typing might be off, because TS thinks props is not accessible.
|
|
103
|
+
const iconProps = icon.props;
|
|
104
|
+
return ((0, jsx_runtime_1.jsx)(VisuallyHidden_1.VisuallyHidden, { children: (0, jsx_runtime_1.jsx)("span", { children: accessibleName || (iconProps === null || iconProps === void 0 ? void 0 : iconProps.name) || (iconProps === null || iconProps === void 0 ? void 0 : iconProps.alt) }) }));
|
|
105
|
+
};
|
|
@@ -35,6 +35,7 @@ exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
35
35
|
description: "This property is used to define a custom checkbox input template",
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
+
childrenAsTemplate: "inputTemplate",
|
|
38
39
|
events: {
|
|
39
40
|
gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
|
|
40
41
|
lostFocus: (0, metadata_helpers_1.dLostFocus)(COMP),
|
|
@@ -59,8 +60,7 @@ exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
59
60
|
},
|
|
60
61
|
});
|
|
61
62
|
exports.checkboxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.CheckboxMd, ({ node, extractValue, layoutCss, updateState, lookupEventHandler, state, registerComponentApi, renderChild, layoutContext, }) => {
|
|
62
|
-
|
|
63
|
-
const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
|
|
63
|
+
const inputTemplate = node.props.inputTemplate;
|
|
64
64
|
return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { inputRenderer: inputTemplate
|
|
65
65
|
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
66
66
|
: undefined, enabled: extractValue.asOptionalBoolean(node.props.enabled), style: layoutCss, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, Toggle_1.defaultProps.initialValue), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), indeterminate: extractValue.asOptionalBoolean(node.props.indeterminate), registerComponentApi: registerComponentApi }));
|
|
@@ -42,6 +42,7 @@ const RealTimeAdapter_1 = require("./RealTimeAdapter/RealTimeAdapter");
|
|
|
42
42
|
const Form_1 = require("./Form/Form");
|
|
43
43
|
const EmojiSelector_1 = require("./EmojiSelector/EmojiSelector");
|
|
44
44
|
const NumberBox_1 = require("./NumberBox/NumberBox");
|
|
45
|
+
const NumberBox2_1 = require("./NumberBox/NumberBox2");
|
|
45
46
|
const HoverCard_1 = require("./HoverCard/HoverCard");
|
|
46
47
|
const App_1 = require("./App/App");
|
|
47
48
|
const NavPanel_1 = require("./NavPanel/NavPanel");
|
|
@@ -361,6 +362,7 @@ class ComponentRegistry {
|
|
|
361
362
|
this.registerCoreComponent(TextBox_1.passwordInputComponentRenderer);
|
|
362
363
|
this.registerCoreComponent(EmojiSelector_1.emojiSelectorRenderer);
|
|
363
364
|
this.registerCoreComponent(NumberBox_1.numberBoxComponentRenderer);
|
|
365
|
+
this.registerCoreComponent(NumberBox2_1.numberBox2ComponentRenderer);
|
|
364
366
|
this.registerCoreComponent(HoverCard_1.hoverCardComponentRenderer);
|
|
365
367
|
this.registerCoreComponent(RadioGroup_1.radioGroupRenderer);
|
|
366
368
|
this.registerCoreComponent(FileInput_1.fileInputRenderer);
|
|
@@ -20,7 +20,7 @@ exports.FooterMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
20
20
|
[`fontSize-${COMP}`]: "$fontSize-small",
|
|
21
21
|
[`textColor-${COMP}`]: "$textColor-secondary",
|
|
22
22
|
[`maxWidth-content-${COMP}`]: "$maxWidth-content",
|
|
23
|
-
[`
|
|
23
|
+
[`borderTop-${COMP}`]: `1px solid $borderColor`,
|
|
24
24
|
[`padding-${COMP}`]: "$space-2 $space-4",
|
|
25
25
|
light: {
|
|
26
26
|
// --- No light-specific theme vars
|
|
@@ -35,6 +35,7 @@ const Validations_1 = require("./Validations");
|
|
|
35
35
|
const SliderNative_1 = require("../Slider/SliderNative");
|
|
36
36
|
const ColorPickerNative_1 = require("../ColorPicker/ColorPickerNative");
|
|
37
37
|
const HelperText_1 = require("./HelperText");
|
|
38
|
+
const NumberBox2Native_1 = require("../NumberBox/NumberBox2Native");
|
|
38
39
|
const DEFAULT_LABEL_POSITIONS = {
|
|
39
40
|
checkbox: "end",
|
|
40
41
|
};
|
|
@@ -99,6 +100,14 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
99
100
|
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 })));
|
|
100
101
|
break;
|
|
101
102
|
}
|
|
103
|
+
// NOTE: This is a prototype for the new number field
|
|
104
|
+
// works as good as the regular number field but untested
|
|
105
|
+
// in production.
|
|
106
|
+
case "integer2":
|
|
107
|
+
case "number2": {
|
|
108
|
+
formControl = ((0, jsx_runtime_1.jsx)(NumberBox2Native_1.NumberBox2, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, min: validations.minValue, max: validations.maxValue, integersOnly: type === "integer2" })));
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
102
111
|
case "switch":
|
|
103
112
|
case "checkbox": {
|
|
104
113
|
formControl = ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, Object.assign({}, rest, { value: value, updateState: onStateChange,
|
|
@@ -19,6 +19,7 @@ exports.ItemsMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
19
19
|
},
|
|
20
20
|
itemTemplate: (0, metadata_helpers_1.dComponent)("The component template to display a single item"),
|
|
21
21
|
},
|
|
22
|
+
childrenAsTemplate: "itemTemplate",
|
|
22
23
|
contextVars: {
|
|
23
24
|
$item: (0, metadata_helpers_1.dComponent)("This value represents the current iteration item while the component renders its children."),
|
|
24
25
|
$itemIndex: (0, metadata_helpers_1.dComponent)("This integer value represents the current iteration index (zero-based) while rendering children."),
|
|
@@ -30,6 +31,6 @@ exports.ItemsMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
30
31
|
exports.itemsComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ItemsMd, (rendererContext) => {
|
|
31
32
|
const { node, renderChild, extractValue, layoutContext } = rendererContext;
|
|
32
33
|
return ((0, jsx_runtime_1.jsx)(ItemsNative_1.Items, { items: extractValue(node.props.items) || extractValue(node.props.data), reverse: extractValue(node.props.reverse), renderItem: (contextVars, key) => {
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: node.
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: node.props.itemTemplate, renderChild: renderChild, layoutContext: layoutContext }, key));
|
|
34
35
|
} }));
|
|
35
36
|
});
|
|
@@ -71,6 +71,7 @@ exports.ListMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
71
71
|
defaultValue: true,
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
+
childrenAsTemplate: 'itemTemplate',
|
|
74
75
|
apis: {
|
|
75
76
|
scrollToTop: (0, ComponentDefs_1.d)("This method scrolls the list to the top."),
|
|
76
77
|
scrollToBottom: (0, ComponentDefs_1.d)("This method scrolls the list to the bottom."),
|
|
@@ -83,7 +84,7 @@ exports.ListMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
83
84
|
themeVars: (0, themeVars_1.parseScssVar)(List_module_scss_1.default.themeVars),
|
|
84
85
|
});
|
|
85
86
|
exports.dynamicHeightListComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ListMd, ({ node, extractValue, renderChild, layoutCss, layoutContext, lookupEventHandler, registerComponentApi, }) => {
|
|
86
|
-
const itemTemplate = node.props.itemTemplate
|
|
87
|
+
const itemTemplate = node.props.itemTemplate;
|
|
87
88
|
const hideEmptyGroups = extractValue.asOptionalBoolean(node.props.hideEmptyGroups, true);
|
|
88
89
|
return ((0, jsx_runtime_1.jsx)(ListNative_1.ListNative, { registerComponentApi: registerComponentApi, style: layoutCss, loading: extractValue.asOptionalBoolean(node.props.loading), items: extractValue(node.props.items) || extractValue(node.props.data), limit: extractValue(node.props.limit), groupBy: extractValue(node.props.groupBy), orderBy: extractValue(node.props.orderBy), availableGroups: extractValue(node.props.availableGroups), scrollAnchor: node.props.scrollAnchor, pageInfo: extractValue(node.props.pageInfo), idKey: extractValue(node.props.idKey), requestFetchPrevPage: lookupEventHandler("requestFetchPrevPage"), requestFetchNextPage: lookupEventHandler("requestFetchNextPage"), emptyListPlaceholder: renderChild(node.props.emptyListTemplate), groupsInitiallyExpanded: extractValue.asOptionalBoolean(node.props.groupsInitiallyExpanded), defaultGroups: extractValue(node.props.defaultGroups), borderCollapse: extractValue.asOptionalBoolean(node.props.borderCollapse, true), itemRenderer: itemTemplate &&
|
|
89
90
|
((item, key) => {
|
|
@@ -26,11 +26,13 @@ exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
defaultThemeVars: {
|
|
29
|
+
"backgroundColor-Admonition": "$color-warn-300",
|
|
29
30
|
"borderRadius-Admonition": "$space-4",
|
|
30
31
|
"iconSize-Admonition": "1.5rem",
|
|
31
32
|
"padding-Admonition": "1rem",
|
|
32
33
|
"marginBottom-Admonition": "1rem",
|
|
33
34
|
"marginLeft-Admonition-content": ".5rem",
|
|
35
|
+
"backgroundColor-Blockquote": "$color-warn-200",
|
|
34
36
|
"accentWidth-Blockquote": "3px",
|
|
35
37
|
"accentColor-Blockquote": "$color-surface-500",
|
|
36
38
|
"padding-Blockquote": ".5rem",
|
|
@@ -20,9 +20,9 @@ exports.NavPanelMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
20
20
|
},
|
|
21
21
|
themeVars: (0, themeVars_1.parseScssVar)(NavPanel_module_scss_1.default.themeVars),
|
|
22
22
|
defaultThemeVars: {
|
|
23
|
-
[`backgroundColor-${COMP}`]: "
|
|
23
|
+
[`backgroundColor-${COMP}`]: "$backgroundColor",
|
|
24
24
|
[`border-${COMP}`]: '0px solid $borderColor',
|
|
25
|
-
[`paddingHorizontal-${COMP}`]: "
|
|
25
|
+
[`paddingHorizontal-${COMP}`]: "0",
|
|
26
26
|
[`paddingVertical-logo-${COMP}`]: "$space-4",
|
|
27
27
|
[`paddingHorizontal-logo-${COMP}`]: "$space-4",
|
|
28
28
|
[`marginBottom-logo-${COMP}`]: "$space-4",
|
|
@@ -0,0 +1,85 @@
|
|
|
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.numberBox2ComponentRenderer = exports.NumberBoxMd2 = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const NumberBox_module_scss_1 = __importDefault(require("./NumberBox.module.scss"));
|
|
9
|
+
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
10
|
+
const renderers_1 = require("../../components-core/renderers");
|
|
11
|
+
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
|
+
const metadata_helpers_1 = require("../metadata-helpers");
|
|
13
|
+
const NumberBox2Native_1 = require("./NumberBox2Native");
|
|
14
|
+
const COMP = "NumberBox2";
|
|
15
|
+
exports.NumberBoxMd2 = (0, ComponentDefs_1.createMetadata)({
|
|
16
|
+
status: "experimental",
|
|
17
|
+
description: `A \`${COMP}\` component allows users to input numeric values: either integer or floating ` +
|
|
18
|
+
`point numbers. It also accepts empty values, where the stored value will be of type \`null\`.`,
|
|
19
|
+
props: {
|
|
20
|
+
placeholder: (0, metadata_helpers_1.dPlaceholder)(),
|
|
21
|
+
initialValue: (0, metadata_helpers_1.dInitialValue)(),
|
|
22
|
+
label: (0, metadata_helpers_1.dLabel)(),
|
|
23
|
+
labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
|
|
24
|
+
labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
|
|
25
|
+
labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
|
|
26
|
+
maxLength: (0, metadata_helpers_1.dMaxLength)(),
|
|
27
|
+
autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
|
|
28
|
+
required: (0, metadata_helpers_1.dRequired)(),
|
|
29
|
+
readOnly: (0, metadata_helpers_1.dReadonly)(),
|
|
30
|
+
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
31
|
+
validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
|
|
32
|
+
startText: (0, metadata_helpers_1.dStartText)(),
|
|
33
|
+
startIcon: (0, metadata_helpers_1.dStartIcon)(),
|
|
34
|
+
endText: (0, metadata_helpers_1.dEndText)(),
|
|
35
|
+
endIcon: (0, metadata_helpers_1.dEndIcon)(),
|
|
36
|
+
hasSpinBox: {
|
|
37
|
+
description: `This boolean prop shows (\`true\`) or hides (\`false\`) the spinner buttons for the input field.`,
|
|
38
|
+
valueType: "boolean",
|
|
39
|
+
defaultValue: true,
|
|
40
|
+
},
|
|
41
|
+
step: {
|
|
42
|
+
description: `This prop governs how big the step when clicking on the spinner of the field.`,
|
|
43
|
+
valueType: "number",
|
|
44
|
+
defaultValue: 1,
|
|
45
|
+
},
|
|
46
|
+
integersOnly: {
|
|
47
|
+
description: `This boolean property signs whether the input field accepts integers only (\`true\`) ` +
|
|
48
|
+
`or not (\`false\`).`,
|
|
49
|
+
valueType: "boolean",
|
|
50
|
+
defaultValue: false,
|
|
51
|
+
},
|
|
52
|
+
maxFractionDigits: {
|
|
53
|
+
description: `This prop sets the maximum number of decimal places allowed in the input field. ` +
|
|
54
|
+
`If the number of decimal places is greater than this value, the value will be truncated to the maximum allowed decimal places. `,
|
|
55
|
+
valueType: "number",
|
|
56
|
+
defaultValue: 3,
|
|
57
|
+
},
|
|
58
|
+
zeroOrPositive: {
|
|
59
|
+
description: `This boolean property determines whether the input value can only be 0 or positive numbers ` +
|
|
60
|
+
`(\`true\`) or also negative (\`false\`).`,
|
|
61
|
+
valueType: "boolean",
|
|
62
|
+
defaultValue: false,
|
|
63
|
+
},
|
|
64
|
+
minValue: (0, ComponentDefs_1.d)(`The minimum value the input field allows. Can be a float or an integer if ` +
|
|
65
|
+
`[\`integersOnly\`](#integersonly) is set to \`false\`, otherwise it can only be an integer.`),
|
|
66
|
+
maxValue: (0, ComponentDefs_1.d)(`The maximum value the input field allows. Can be a float or an integer if ` +
|
|
67
|
+
`[\`integersOnly\`](#integersonly) is set to \`false\`, otherwise it can only be an integer.`),
|
|
68
|
+
},
|
|
69
|
+
events: {
|
|
70
|
+
gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
|
|
71
|
+
lostFocus: (0, metadata_helpers_1.dLostFocus)(COMP),
|
|
72
|
+
didChange: (0, metadata_helpers_1.dDidChange)(COMP),
|
|
73
|
+
},
|
|
74
|
+
apis: {
|
|
75
|
+
focus: (0, metadata_helpers_1.dFocus)(COMP),
|
|
76
|
+
value: (0, metadata_helpers_1.dValue)(),
|
|
77
|
+
setValue: (0, metadata_helpers_1.dSetValueApi)(),
|
|
78
|
+
},
|
|
79
|
+
themeVars: (0, themeVars_1.parseScssVar)(NumberBox_module_scss_1.default.themeVars),
|
|
80
|
+
});
|
|
81
|
+
exports.numberBox2ComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NumberBoxMd2, ({ node, state, updateState, lookupEventHandler, extractValue, layoutCss, registerComponentApi, }) => {
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(NumberBox2Native_1.NumberBox2, { style: layoutCss, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue.asOptionalString(node.props.initialValue), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), step: extractValue(node.props.step), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), maxFractionDigits: extractValue.asOptionalNumber(node.props.maxFractionDigits), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly),
|
|
83
|
+
//maxLength={extractValue(node.props.maxLength)}
|
|
84
|
+
label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
|
|
85
|
+
});
|