xmlui 0.7.23 → 0.7.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-BZ3Gd4mb.mjs → apiInterceptorWorker-B0H9MD6w.mjs} +14 -7
- package/dist/{core-BfTKHuQQ.mjs → core-BmjxDmQl.mjs} +2060 -1868
- package/dist/index-Brmiu4kS.mjs +33493 -0
- package/dist/index.css +1 -1
- package/dist/scripts/src/components/Accordion/Accordion.js +1 -5
- package/dist/scripts/src/components/Badge/Badge.js +2 -6
- package/dist/scripts/src/components/Button/Button.js +2 -1
- package/dist/scripts/src/components/Card/Card.js +2 -7
- package/dist/scripts/src/components/Checkbox/Checkbox.js +8 -2
- package/dist/scripts/src/components/ComponentProvider.js +4 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +2 -2
- package/dist/scripts/src/components/DatePicker/DatePicker.js +12 -6
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +4 -3
- package/dist/scripts/src/components/Footer/Footer.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItem.js +10 -4
- package/dist/scripts/src/components/FormItem/FormItemNative.js +3 -3
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +2 -2
- package/dist/scripts/src/components/FormSection/FormSection.js +2 -1
- package/dist/scripts/src/components/Heading/Heading.js +7 -14
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +39 -0
- package/dist/scripts/src/components/IconProvider.js +2 -0
- package/dist/scripts/src/components/Markdown/Markdown.js +1 -1
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +105 -11
- package/dist/scripts/src/components/Option/Option.js +7 -2
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +7 -4
- package/dist/scripts/src/components/RadioGroup/RadioItem.js +19 -0
- package/dist/scripts/src/components/RadioGroup/RadioItemNative.js +49 -0
- package/dist/scripts/src/components/Splitter/Splitter.js +8 -10
- package/dist/scripts/src/components/Stack/Stack.js +30 -15
- package/dist/scripts/src/components/Table/Table.js +0 -1
- package/dist/scripts/src/components/Toggle/Toggle.js +36 -18
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +1 -3
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +7 -12
- package/dist/scripts/src/components-core/theming/extendThemeUtils.js +0 -67
- package/dist/scripts/src/components-core/theming/layout-resolver.js +1 -20
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +406 -3
- package/dist/scripts/src/components-core/xmlui-parser.js +17 -2
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +4 -1
- package/dist/scripts/src/parsers/xmlui-parser/ParserError.js +2 -2
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +3 -3
- package/dist/style.css +1 -1
- package/dist/{wasm-SPaT1zC5.mjs → wasm-DQxwEHae.mjs} +3 -1
- package/dist/xmlui-metadata.mjs +3541 -3875
- package/dist/xmlui-metadata.umd.js +19 -18
- package/dist/xmlui-standalone.umd.js +221 -190
- package/dist/xmlui.d.ts +1 -8
- package/dist/xmlui.mjs +1 -1
- package/package.json +5 -3
- package/dist/index-C9zkAour.mjs +0 -32761
|
@@ -7,18 +7,22 @@ exports.Markdown = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
10
|
+
const remark_gfm_1 = __importDefault(require("remark-gfm"));
|
|
11
|
+
const unist_util_visit_1 = require("unist-util-visit");
|
|
10
12
|
const Markdown_module_scss_1 = __importDefault(require("./Markdown.module.scss"));
|
|
13
|
+
const HtmlTags_module_scss_1 = __importDefault(require("../HtmlTags/HtmlTags.module.scss"));
|
|
11
14
|
const HeadingNative_1 = require("../Heading/HeadingNative");
|
|
12
15
|
const TextNative_1 = require("../Text/TextNative");
|
|
13
16
|
const LinkNative_1 = require("../Link/LinkNative");
|
|
14
17
|
const ImageNative_1 = require("../Image/ImageNative");
|
|
15
|
-
|
|
18
|
+
const Toggle_1 = require("../Toggle/Toggle");
|
|
19
|
+
exports.Markdown = (0, react_1.memo)(function Markdown({ extractValue, removeIndents = false, children, style, }) {
|
|
16
20
|
if (typeof children !== "string") {
|
|
17
21
|
return null;
|
|
18
22
|
}
|
|
19
23
|
children = removeIndents ? removeTextIndents(children) : children;
|
|
20
24
|
const textLayoutToUse = { textAlign: style === null || style === void 0 ? void 0 : style.textAlign };
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(react_markdown_1.default, { components: {
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default, [bindingExpression, { extractValue }]], components: {
|
|
22
26
|
h1({ id, children }) {
|
|
23
27
|
return ((0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { uid: id, style: textLayoutToUse, level: "h1", sx: { lineHeight: "initial" }, children: children }));
|
|
24
28
|
},
|
|
@@ -38,7 +42,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = false,
|
|
|
38
42
|
return ((0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { uid: id, level: "h6", sx: { lineHeight: "initial" }, children: children }));
|
|
39
43
|
},
|
|
40
44
|
p({ id, children }) {
|
|
41
|
-
return (0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, style: textLayoutToUse, children: children });
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, style: textLayoutToUse, children: children }));
|
|
42
46
|
},
|
|
43
47
|
code({ id, children }) {
|
|
44
48
|
return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "code", children: children }));
|
|
@@ -52,6 +56,9 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = false,
|
|
|
52
56
|
em({ id, children }) {
|
|
53
57
|
return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "em", children: children }));
|
|
54
58
|
},
|
|
59
|
+
del({ id, children }) {
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "deleted", children: children }));
|
|
61
|
+
},
|
|
55
62
|
blockquote({ children }) {
|
|
56
63
|
return (0, jsx_runtime_1.jsx)(Blockquote, { style: textLayoutToUse, children: children });
|
|
57
64
|
},
|
|
@@ -64,9 +71,6 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = false,
|
|
|
64
71
|
li({ children }) {
|
|
65
72
|
return (0, jsx_runtime_1.jsx)(ListItem, { style: textLayoutToUse, children: children });
|
|
66
73
|
},
|
|
67
|
-
// This needs a parser plugin for the ~ and ~~ signs that are available via react-markdown-gfm
|
|
68
|
-
// or we implement our own parser?
|
|
69
|
-
// del: variant="deleted"
|
|
70
74
|
hr() {
|
|
71
75
|
return (0, jsx_runtime_1.jsx)(HorizontalRule, {});
|
|
72
76
|
},
|
|
@@ -75,7 +79,32 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = false,
|
|
|
75
79
|
},
|
|
76
80
|
img({ src, alt }) {
|
|
77
81
|
return (0, jsx_runtime_1.jsx)(ImageNative_1.Image, { src: src, alt: alt });
|
|
78
|
-
}
|
|
82
|
+
},
|
|
83
|
+
// TODO: somehow get the label from the containing li element
|
|
84
|
+
input({ disabled, checked }) {
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { variant: "checkbox", readOnly: disabled, value: checked }));
|
|
86
|
+
},
|
|
87
|
+
table({ children }) {
|
|
88
|
+
return (0, jsx_runtime_1.jsx)("table", { className: HtmlTags_module_scss_1.default.htmlTable, children: children });
|
|
89
|
+
},
|
|
90
|
+
tr({ children }) {
|
|
91
|
+
return (0, jsx_runtime_1.jsx)("tr", { className: HtmlTags_module_scss_1.default.htmlTr, children: children });
|
|
92
|
+
},
|
|
93
|
+
td({ children }) {
|
|
94
|
+
return (0, jsx_runtime_1.jsx)("td", { className: HtmlTags_module_scss_1.default.htmlTd, children: children });
|
|
95
|
+
},
|
|
96
|
+
th({ children }) {
|
|
97
|
+
return (0, jsx_runtime_1.jsx)("th", { className: HtmlTags_module_scss_1.default.htmlTh, children: children });
|
|
98
|
+
},
|
|
99
|
+
thead({ children }) {
|
|
100
|
+
return (0, jsx_runtime_1.jsx)("thead", { className: HtmlTags_module_scss_1.default.htmlThead, children: children });
|
|
101
|
+
},
|
|
102
|
+
tbody({ children }) {
|
|
103
|
+
return (0, jsx_runtime_1.jsx)("tbody", { className: HtmlTags_module_scss_1.default.htmlTbody, children: children });
|
|
104
|
+
},
|
|
105
|
+
tfoot({ children }) {
|
|
106
|
+
return (0, jsx_runtime_1.jsx)("tfoot", { className: HtmlTags_module_scss_1.default.htmlTfoot, children: children });
|
|
107
|
+
},
|
|
79
108
|
}, children: children }));
|
|
80
109
|
});
|
|
81
110
|
function removeTextIndents(input) {
|
|
@@ -94,14 +123,79 @@ const HorizontalRule = () => {
|
|
|
94
123
|
return (0, jsx_runtime_1.jsx)("hr", { className: Markdown_module_scss_1.default.horizontalRule });
|
|
95
124
|
};
|
|
96
125
|
const Blockquote = ({ children, style }) => {
|
|
97
|
-
return (0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.blockquote, style: style, children: children });
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.blockquote, style: style, children: children }));
|
|
98
127
|
};
|
|
99
128
|
const UnorderedList = ({ children, style }) => {
|
|
100
|
-
return (0, jsx_runtime_1.jsx)("ul", { className: Markdown_module_scss_1.default.unorderedList, style: style, children: children });
|
|
129
|
+
return ((0, jsx_runtime_1.jsx)("ul", { className: Markdown_module_scss_1.default.unorderedList, style: style, children: children }));
|
|
101
130
|
};
|
|
102
131
|
const OrderedList = ({ children, style }) => {
|
|
103
|
-
return (0, jsx_runtime_1.jsx)("ol", { className: Markdown_module_scss_1.default.orderedList, style: style, children: children });
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)("ol", { className: Markdown_module_scss_1.default.orderedList, style: style, children: children }));
|
|
104
133
|
};
|
|
105
134
|
const ListItem = ({ children, style }) => {
|
|
106
|
-
return (0, jsx_runtime_1.jsx)("li", { className: Markdown_module_scss_1.default.listItem, style: style, children: children });
|
|
135
|
+
return ((0, jsx_runtime_1.jsx)("li", { className: Markdown_module_scss_1.default.listItem, style: style, children: children }));
|
|
107
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* Finds and evaluates given binding expressions in markdown text.
|
|
139
|
+
* The binding expressions are of the form `${...}$`.
|
|
140
|
+
* @param extractValue The function to resolve binding expressions
|
|
141
|
+
* @returns visitor function that processes the binding expressions
|
|
142
|
+
*/
|
|
143
|
+
function bindingExpression({ extractValue }) {
|
|
144
|
+
return (tree) => {
|
|
145
|
+
(0, unist_util_visit_1.visit)(tree, "text", (node) => {
|
|
146
|
+
return detectBindingExpression(node);
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
function detectBindingExpression(node) {
|
|
150
|
+
// Remove empty ${} expressions first
|
|
151
|
+
node.value = node.value.replace(/\$\{\s*\}/g, "");
|
|
152
|
+
const regex = /\$\{((?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*)\}/g;
|
|
153
|
+
const parts = node.value.split(regex);
|
|
154
|
+
if (parts.length > 1) {
|
|
155
|
+
node.type = "html";
|
|
156
|
+
node.value = parts
|
|
157
|
+
.map((part, index) => {
|
|
158
|
+
const extracted = index % 2 === 0 ? part : extractValue(`{${part}}`);
|
|
159
|
+
const resultExpr = mapByType(extracted);
|
|
160
|
+
// The result expression might be an object, in that case we stringify it here,
|
|
161
|
+
// at the last step, so that there are no unnecessary apostrophes
|
|
162
|
+
return typeof resultExpr === "object" && resultExpr !== null
|
|
163
|
+
? JSON.stringify(resultExpr)
|
|
164
|
+
: resultExpr;
|
|
165
|
+
})
|
|
166
|
+
.join("");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function mapByType(extracted) {
|
|
170
|
+
if (extracted === null) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
else if (extracted === undefined || typeof extracted === "undefined") {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
else if (typeof extracted === "object") {
|
|
177
|
+
const arrowFuncResult = parseArrowFunc(extracted);
|
|
178
|
+
if (arrowFuncResult) {
|
|
179
|
+
return arrowFuncResult;
|
|
180
|
+
}
|
|
181
|
+
if (Array.isArray(extracted)) {
|
|
182
|
+
return extracted;
|
|
183
|
+
}
|
|
184
|
+
return Object.fromEntries(Object.entries(extracted).map(([key, value]) => {
|
|
185
|
+
return [key, mapByType(value)];
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
return extracted;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function parseArrowFunc(extracted) {
|
|
193
|
+
if (extracted.hasOwnProperty("type") &&
|
|
194
|
+
extracted.type === "ArrowE" &&
|
|
195
|
+
(extracted === null || extracted === void 0 ? void 0 : extracted._ARROW_EXPR_) &&
|
|
196
|
+
extracted.hasOwnProperty("source")) {
|
|
197
|
+
return extracted.source;
|
|
198
|
+
}
|
|
199
|
+
return "";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -7,6 +7,7 @@ const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
|
7
7
|
const renderers_1 = require("../../components-core/renderers");
|
|
8
8
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
9
9
|
const OptionTypeProvider_1 = require("../Option/OptionTypeProvider");
|
|
10
|
+
const container_helpers_1 = require("../container-helpers");
|
|
10
11
|
const COMP = "Option";
|
|
11
12
|
exports.OptionMd = (0, ComponentDefs_1.createMetadata)({
|
|
12
13
|
description: `\`${COMP}\` is a non-visual component describing a selection option. Other components ` +
|
|
@@ -18,6 +19,7 @@ exports.OptionMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
18
19
|
value: (0, ComponentDefs_1.d)(`This property defines the value of the option. If \`value\` is not defined, ` +
|
|
19
20
|
`\`Option\` will use the \`label\` as the value.`),
|
|
20
21
|
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
22
|
+
optionTemplate: (0, ComponentDefs_1.d)("This property is used to define a custom option template"),
|
|
21
23
|
},
|
|
22
24
|
});
|
|
23
25
|
const OptionNative = (0, react_1.memo)((props) => {
|
|
@@ -28,6 +30,9 @@ const OptionNative = (0, react_1.memo)((props) => {
|
|
|
28
30
|
return (0, jsx_runtime_1.jsx)(OptionType, Object.assign({}, props));
|
|
29
31
|
});
|
|
30
32
|
OptionNative.displayName = "OptionNative";
|
|
31
|
-
exports.optionComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.OptionMd, ({ node, extractValue, layoutCss, renderChild }) => {
|
|
32
|
-
|
|
33
|
+
exports.optionComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.OptionMd, ({ node, extractValue, layoutCss, renderChild, layoutContext }) => {
|
|
34
|
+
const optionTemplate = node.children || node.props.optionTemplate;
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(OptionNative, { optionRenderer: optionTemplate
|
|
36
|
+
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: optionTemplate, renderChild: renderChild, contextVars: contextVars, layoutContext: layoutContext }))
|
|
37
|
+
: undefined, value: extractValue(node.props.value), label: extractValue.asOptionalString(node.props.label) || renderChild(node.children), enabled: extractValue.asOptionalBoolean(node.props.enabled), style: layoutCss }));
|
|
33
38
|
});
|
|
@@ -89,15 +89,18 @@ exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup({ id, value = "
|
|
|
89
89
|
[RadioGroup_module_scss_1.default.disabled]: !enabled,
|
|
90
90
|
}), children: children }) }) }) }));
|
|
91
91
|
});
|
|
92
|
-
const RadioGroupOption = ({ value, label, enabled = true }) => {
|
|
92
|
+
const RadioGroupOption = ({ value, label, enabled = true, optionRenderer, style, }) => {
|
|
93
93
|
const id = (0, react_1.useId)();
|
|
94
94
|
const validationContext = (0, react_1.useContext)(RadioGroupValidationStatusContext);
|
|
95
|
-
const statusStyles = {
|
|
95
|
+
const statusStyles = (0, react_1.useMemo)(() => ({
|
|
96
96
|
[RadioGroup_module_scss_1.default.disabled]: !enabled,
|
|
97
97
|
[RadioGroup_module_scss_1.default.error]: value === validationContext.value && validationContext.status === "error",
|
|
98
98
|
[RadioGroup_module_scss_1.default.warning]: value === validationContext.value && validationContext.status === "warning",
|
|
99
99
|
[RadioGroup_module_scss_1.default.valid]: value === validationContext.value && validationContext.status === "valid",
|
|
100
|
-
};
|
|
101
|
-
|
|
100
|
+
}), [enabled, validationContext.status, validationContext.value, value]);
|
|
101
|
+
const item = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption, statusStyles), value: value, disabled: !enabled, id: id, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator, statusStyles) }) }), (0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.label, statusStyles), children: label !== null && label !== void 0 ? label : value })] })), [enabled, id, label, statusStyles, value]);
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.radioOptionContainer, style: style, children: optionRenderer ? (0, jsx_runtime_1.jsxs)("label", { className: RadioGroup_module_scss_1.default.optionLabel, children: [(0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.itemContainer, children: item }), optionRenderer({
|
|
103
|
+
$checked: value === validationContext.value,
|
|
104
|
+
})] }) : item }, id));
|
|
102
105
|
};
|
|
103
106
|
exports.RadioGroupOption = RadioGroupOption;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.radioItemComponentRenderer = exports.RadioItemMd = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
6
|
+
const renderers_1 = require("../../components-core/renderers");
|
|
7
|
+
const RadioItemNative_1 = require("./RadioItemNative");
|
|
8
|
+
const COMP = "RadioItem";
|
|
9
|
+
exports.RadioItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
10
|
+
status: "experimental",
|
|
11
|
+
description: `The \`${COMP}\` component is a radio button that is part of a group of radio buttons.`,
|
|
12
|
+
props: {
|
|
13
|
+
checked: (0, ComponentDefs_1.d)("This property specifies whether the radio button is checked."),
|
|
14
|
+
value: (0, ComponentDefs_1.d)("This property specifies the value of the radio button."),
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
exports.radioItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.RadioItemMd, ({ node, extractValue }) => {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(RadioItemNative_1.RadioItem, { checked: extractValue(node.props.checked), value: extractValue(node.props.value) }));
|
|
19
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.RadioItem = void 0;
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const react_1 = require("react");
|
|
42
|
+
const RadioGroup_module_scss_1 = __importDefault(require("./RadioGroup.module.scss"));
|
|
43
|
+
const InnerRadioGroup = __importStar(require("@radix-ui/react-radio-group"));
|
|
44
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
45
|
+
const RadioItem = ({ checked, style, value }) => {
|
|
46
|
+
const id = (0, react_1.useId)();
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.radioOptionContainer, style: style, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption), id: id, value: value, checked: checked, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator) }) }) }, id));
|
|
48
|
+
};
|
|
49
|
+
exports.RadioItem = RadioItem;
|
|
@@ -29,6 +29,9 @@ const baseSplitterMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
29
29
|
`value is in pixels or percentages.`),
|
|
30
30
|
floating: (0, ComponentDefs_1.d)(`Toggles whether the resizer is visible (\`false\`) or not (\`true\`) when not hovered ` +
|
|
31
31
|
`or dragged. The default value is \`false\`, meaning the resizer is visible all the time.`),
|
|
32
|
+
orientation: (0, ComponentDefs_1.d)(`Sets whether the \`Splitter\` divides the container horizontally and lays out the ` +
|
|
33
|
+
`section on top of each other (\`vertical\`), or vertically by placing the sections ` +
|
|
34
|
+
`next to each other (\`horizontal\`).`),
|
|
32
35
|
},
|
|
33
36
|
events: {
|
|
34
37
|
resize: (0, ComponentDefs_1.d)(`This event fires when the component is resized.`),
|
|
@@ -41,47 +44,42 @@ const baseSplitterMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
41
44
|
[`cursor-resizer-vertical-${COMP}`]: "ns-resize",
|
|
42
45
|
},
|
|
43
46
|
});
|
|
44
|
-
exports.SplitterMd = Object.assign(Object.assign({}, baseSplitterMd), { props: Object.assign(
|
|
45
|
-
`section on top of each other (\`vertical\`), or vertically by placing the sections ` +
|
|
46
|
-
`next to each other (\`horizontal\`).`) }) });
|
|
47
|
+
exports.SplitterMd = Object.assign(Object.assign({}, baseSplitterMd), { props: Object.assign({}, baseSplitterMd.props) });
|
|
47
48
|
exports.HSplitterMd = Object.assign(Object.assign({}, baseSplitterMd), { specializedFrom: COMP });
|
|
48
49
|
exports.VSplitterMd = Object.assign(Object.assign({}, baseSplitterMd), { specializedFrom: COMP });
|
|
49
50
|
const DEFAULT_ORIENTATION = "vertical";
|
|
50
51
|
function renderSplitter(_a) {
|
|
51
52
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
52
|
-
var { node, extractValue,
|
|
53
|
+
var { node, extractValue, layoutCss, renderChild, lookupEventHandler, orientation = (_b = extractValue(node.props.orientation)) !== null && _b !== void 0 ? _b : DEFAULT_ORIENTATION, } = _a;
|
|
53
54
|
if (!(0, misc_1.isComponentDefChildren)(node.children)) {
|
|
54
55
|
throw new EngineError_1.NotAComponentDefError();
|
|
55
56
|
}
|
|
56
57
|
return ((0, jsx_runtime_1.jsx)(SplitterNative_1.Splitter, { style: layoutCss, swapped: extractValue.asOptionalBoolean((_c = node.props) === null || _c === void 0 ? void 0 : _c.swapped), orientation: orientation, splitterTemplate: renderChild((_d = node.props) === null || _d === void 0 ? void 0 : _d.splitterTemplate), initialPrimarySize: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.initialPrimarySize), minPrimarySize: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.minPrimarySize), maxPrimarySize: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.maxPrimarySize), floating: extractValue.asOptionalBoolean((_h = node.props) === null || _h === void 0 ? void 0 : _h.floating), resize: lookupEventHandler("resize"), children: renderChild(node.children) }));
|
|
57
58
|
}
|
|
58
|
-
exports.splitterComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SplitterMd, ({ node, extractValue, renderChild, layoutCss,
|
|
59
|
+
exports.splitterComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SplitterMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
59
60
|
return renderSplitter({
|
|
60
61
|
node,
|
|
61
62
|
extractValue,
|
|
62
63
|
layoutCss,
|
|
63
|
-
layoutNonCss,
|
|
64
64
|
renderChild,
|
|
65
65
|
lookupEventHandler: lookupEventHandler,
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
|
-
exports.vSplitterComponentRenderer = (0, renderers_1.createComponentRenderer)("VSplitter", exports.VSplitterMd, ({ node, extractValue, renderChild, layoutCss,
|
|
68
|
+
exports.vSplitterComponentRenderer = (0, renderers_1.createComponentRenderer)("VSplitter", exports.VSplitterMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
69
69
|
return renderSplitter({
|
|
70
70
|
node,
|
|
71
71
|
extractValue,
|
|
72
72
|
layoutCss,
|
|
73
|
-
layoutNonCss,
|
|
74
73
|
renderChild,
|
|
75
74
|
orientation: "vertical",
|
|
76
75
|
lookupEventHandler: lookupEventHandler,
|
|
77
76
|
});
|
|
78
77
|
});
|
|
79
|
-
exports.hSplitterComponentRenderer = (0, renderers_1.createComponentRenderer)("HSplitter", exports.HSplitterMd, ({ node, extractValue, renderChild, layoutCss,
|
|
78
|
+
exports.hSplitterComponentRenderer = (0, renderers_1.createComponentRenderer)("HSplitter", exports.HSplitterMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
80
79
|
return renderSplitter({
|
|
81
80
|
node,
|
|
82
81
|
extractValue,
|
|
83
82
|
layoutCss,
|
|
84
|
-
layoutNonCss,
|
|
85
83
|
renderChild,
|
|
86
84
|
orientation: "horizontal",
|
|
87
85
|
lookupEventHandler: lookupEventHandler,
|
|
@@ -23,6 +23,10 @@ const stackMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
23
23
|
reverse: (0, ComponentDefs_1.d)(`Optional boolean property to reverse the order of child elements.`),
|
|
24
24
|
wrapContent: (0, ComponentDefs_1.d)(`Optional boolean which wraps the content if set to true and the available space is not big ` +
|
|
25
25
|
`enough. Works in all orientations.`),
|
|
26
|
+
orientation: (0, ComponentDefs_1.d)(`An optional property that governs the Stack's orientation (whether the Stack lays out its ` +
|
|
27
|
+
`children in a row or a column).`),
|
|
28
|
+
horizontalAlignment: HORIZONTAL_ALIGNMENT,
|
|
29
|
+
verticalAlignment: VERTICAL_ALIGNMENT,
|
|
26
30
|
hoverContainer: (0, ComponentDefs_1.d)("Reserved for future use"),
|
|
27
31
|
visibleOnHover: (0, ComponentDefs_1.d)("Reserved for future use"),
|
|
28
32
|
},
|
|
@@ -32,15 +36,14 @@ const stackMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
32
36
|
},
|
|
33
37
|
themeVars: (0, themeVars_1.parseScssVar)(Stack_module_scss_1.default.themeVars),
|
|
34
38
|
});
|
|
35
|
-
exports.StackMd = Object.assign(Object.assign({}, stackMd), { props: Object.assign(
|
|
36
|
-
|
|
37
|
-
exports.
|
|
38
|
-
exports.HStackMd = Object.assign(Object.assign({}, exports.StackMd), { specializedFrom: COMP, description: `This component represents a stack rendering its contents horizontally.`, props: Object.assign(Object.assign({}, stackMd.props), { horizontalAlignment: HORIZONTAL_ALIGNMENT, verticalAlignment: VERTICAL_ALIGNMENT }) });
|
|
39
|
+
exports.StackMd = Object.assign(Object.assign({}, stackMd), { props: Object.assign({}, stackMd.props) });
|
|
40
|
+
exports.VStackMd = Object.assign(Object.assign({}, exports.StackMd), { specializedFrom: COMP, description: `This component represents a stack rendering its contents vertically.`, props: Object.assign({}, stackMd.props) });
|
|
41
|
+
exports.HStackMd = Object.assign(Object.assign({}, exports.StackMd), { specializedFrom: COMP, description: `This component represents a stack rendering its contents horizontally.`, props: Object.assign({}, stackMd.props) });
|
|
39
42
|
exports.CVStackMd = Object.assign(Object.assign({}, exports.StackMd), { specializedFrom: COMP, description: `This component represents a stack that renders its contents vertically ` +
|
|
40
43
|
`and aligns that in the center along both axes.` });
|
|
41
44
|
exports.CHStackMd = Object.assign(Object.assign({}, exports.StackMd), { specializedFrom: COMP, description: `This component represents a stack that renders its contents horizontally ` +
|
|
42
45
|
`and aligns that in the center along both axes.` });
|
|
43
|
-
function renderStack({ node,
|
|
46
|
+
function renderStack({ node, extractValue, layoutCss, orientation, horizontalAlignment, verticalAlignment, lookupEventHandler, renderChild, }) {
|
|
44
47
|
var _a, _b, _c;
|
|
45
48
|
if (!(0, misc_1.isComponentDefChildren)(node.children)) {
|
|
46
49
|
throw new EngineError_1.NotAComponentDefError();
|
|
@@ -50,42 +53,55 @@ function renderStack({ node, layoutNonCss, extractValue, layoutCss, lookupEventH
|
|
|
50
53
|
orientation,
|
|
51
54
|
}) }));
|
|
52
55
|
}
|
|
53
|
-
exports.stackComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.StackMd, ({ node, extractValue, renderChild, layoutCss,
|
|
56
|
+
exports.stackComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.StackMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
const orientation = extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.orientation) || StackNative_1.DEFAULT_ORIENTATION;
|
|
59
|
+
const horizontalAlignment = extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.horizontalAlignment);
|
|
60
|
+
const verticalAlignment = extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.verticalAlignment);
|
|
54
61
|
return renderStack({
|
|
55
62
|
node,
|
|
56
|
-
layoutNonCss,
|
|
57
63
|
extractValue,
|
|
58
64
|
layoutCss,
|
|
65
|
+
orientation,
|
|
66
|
+
horizontalAlignment,
|
|
67
|
+
verticalAlignment,
|
|
59
68
|
lookupEventHandler,
|
|
60
69
|
renderChild,
|
|
61
70
|
});
|
|
62
71
|
});
|
|
63
|
-
exports.vStackComponentRenderer = (0, renderers_1.createComponentRenderer)("VStack", exports.VStackMd, ({ node, extractValue, renderChild, layoutCss,
|
|
72
|
+
exports.vStackComponentRenderer = (0, renderers_1.createComponentRenderer)("VStack", exports.VStackMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
const horizontalAlignment = extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.horizontalAlignment);
|
|
75
|
+
const verticalAlignment = extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.verticalAlignment);
|
|
64
76
|
return renderStack({
|
|
65
77
|
node,
|
|
66
|
-
layoutNonCss,
|
|
67
78
|
extractValue,
|
|
68
79
|
layoutCss,
|
|
69
80
|
lookupEventHandler,
|
|
70
81
|
renderChild,
|
|
71
82
|
orientation: "vertical",
|
|
83
|
+
horizontalAlignment,
|
|
84
|
+
verticalAlignment,
|
|
72
85
|
});
|
|
73
86
|
});
|
|
74
|
-
exports.hStackComponentRenderer = (0, renderers_1.createComponentRenderer)("HStack", exports.HStackMd, ({ node, extractValue, renderChild, layoutCss,
|
|
87
|
+
exports.hStackComponentRenderer = (0, renderers_1.createComponentRenderer)("HStack", exports.HStackMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
const horizontalAlignment = extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.horizontalAlignment);
|
|
90
|
+
const verticalAlignment = extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.verticalAlignment);
|
|
75
91
|
return renderStack({
|
|
76
92
|
node,
|
|
77
|
-
layoutNonCss,
|
|
78
93
|
extractValue,
|
|
79
94
|
layoutCss,
|
|
80
95
|
lookupEventHandler,
|
|
81
96
|
renderChild,
|
|
82
97
|
orientation: "horizontal",
|
|
98
|
+
horizontalAlignment,
|
|
99
|
+
verticalAlignment,
|
|
83
100
|
});
|
|
84
101
|
});
|
|
85
|
-
exports.cvStackComponentRenderer = (0, renderers_1.createComponentRenderer)("CVStack", exports.CVStackMd, ({ node, extractValue, renderChild, layoutCss,
|
|
102
|
+
exports.cvStackComponentRenderer = (0, renderers_1.createComponentRenderer)("CVStack", exports.CVStackMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
86
103
|
return renderStack({
|
|
87
104
|
node,
|
|
88
|
-
layoutNonCss,
|
|
89
105
|
extractValue,
|
|
90
106
|
layoutCss,
|
|
91
107
|
lookupEventHandler,
|
|
@@ -95,10 +111,9 @@ exports.cvStackComponentRenderer = (0, renderers_1.createComponentRenderer)("CVS
|
|
|
95
111
|
verticalAlignment: "center",
|
|
96
112
|
});
|
|
97
113
|
});
|
|
98
|
-
exports.chStackComponentRenderer = (0, renderers_1.createComponentRenderer)("CHStack", exports.CHStackMd, ({ node, extractValue, renderChild, layoutCss,
|
|
114
|
+
exports.chStackComponentRenderer = (0, renderers_1.createComponentRenderer)("CHStack", exports.CHStackMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler }) => {
|
|
99
115
|
return renderStack({
|
|
100
116
|
node,
|
|
101
|
-
layoutNonCss,
|
|
102
117
|
extractValue,
|
|
103
118
|
layoutCss,
|
|
104
119
|
lookupEventHandler,
|
|
@@ -87,7 +87,6 @@ exports.TableMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
87
87
|
[`padding-horizontal-cell-first-${COMP}`]: "$space-5",
|
|
88
88
|
[`padding-horizontal-cell-last-${COMP}`]: "$space-5",
|
|
89
89
|
[`padding-vertical-cell-${COMP}`]: "$space-2",
|
|
90
|
-
[`padding-cell-${COMP}`]: `$padding-vertical-cell-${COMP} $padding-horizontal-cell-${COMP}`,
|
|
91
90
|
[`thickness-border-cell-${COMP}`]: "1px",
|
|
92
91
|
[`style-border-cell-${COMP}`]: "solid",
|
|
93
92
|
[`border-cell-${COMP}`]: `$thickness-border-cell-${COMP} $style-border-cell-${COMP} $color-border-cell-${COMP}`,
|
|
@@ -38,60 +38,78 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.Toggle = void 0;
|
|
40
40
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
const react_1 =
|
|
41
|
+
const react_1 = require("react");
|
|
42
|
+
const react_2 = require("react");
|
|
43
|
+
const react_3 = __importStar(require("react"));
|
|
42
44
|
const classnames_1 = __importDefault(require("classnames"));
|
|
43
45
|
const Toggle_module_scss_1 = __importDefault(require("./Toggle.module.scss"));
|
|
44
46
|
const constants_1 = require("../../components-core/constants");
|
|
45
47
|
const misc_1 = require("../../components-core/utils/misc");
|
|
46
48
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
47
|
-
exports.Toggle = (0,
|
|
48
|
-
const
|
|
49
|
-
|
|
49
|
+
exports.Toggle = (0, react_3.forwardRef)(function Toggle({ id, initialValue = false, value = false, enabled = true, style, readOnly, validationStatus = "none", updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, variant = "checkbox", indeterminate = false, className, label, labelPosition = "start", labelWidth, labelBreak, required, registerComponentApi, inputRenderer, }, forwardedRef) {
|
|
50
|
+
const generatedId = (0, react_1.useId)();
|
|
51
|
+
const inputId = id || generatedId;
|
|
52
|
+
const innerRef = react_3.default.useRef(null);
|
|
53
|
+
(0, react_3.useEffect)(() => {
|
|
50
54
|
updateState({ value: initialValue }, { initial: true });
|
|
51
55
|
}, [initialValue, updateState]);
|
|
52
|
-
const updateValue = (0,
|
|
56
|
+
const updateValue = (0, react_3.useCallback)((value) => {
|
|
53
57
|
var _a;
|
|
54
58
|
if (((_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.checked) === value)
|
|
55
59
|
return;
|
|
56
60
|
updateState({ value });
|
|
57
61
|
onDidChange(value);
|
|
58
62
|
}, [onDidChange, updateState]);
|
|
59
|
-
const onInputChange = (0,
|
|
63
|
+
const onInputChange = (0, react_3.useCallback)((event) => {
|
|
60
64
|
if (readOnly) {
|
|
61
65
|
return;
|
|
62
66
|
}
|
|
63
67
|
updateState({ value: event.target.checked });
|
|
64
68
|
onDidChange(event.target.checked);
|
|
65
69
|
}, [onDidChange, readOnly, updateState]);
|
|
66
|
-
const handleOnFocus = (0,
|
|
70
|
+
const handleOnFocus = (0, react_3.useCallback)(() => {
|
|
67
71
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
68
72
|
}, [onFocus]);
|
|
69
|
-
const handleOnBlur = (0,
|
|
73
|
+
const handleOnBlur = (0, react_3.useCallback)(() => {
|
|
70
74
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
71
75
|
}, [onBlur]);
|
|
72
|
-
(0,
|
|
76
|
+
(0, react_3.useEffect)(() => {
|
|
73
77
|
if (typeof indeterminate === "boolean" && innerRef.current) {
|
|
74
78
|
innerRef.current.indeterminate = indeterminate;
|
|
75
79
|
}
|
|
76
80
|
}, [indeterminate]);
|
|
77
|
-
const focus = (0,
|
|
81
|
+
const focus = (0, react_3.useCallback)(() => {
|
|
78
82
|
var _a;
|
|
79
83
|
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
80
84
|
}, []);
|
|
81
85
|
const setValue = (0, misc_1.useEvent)((newValue) => {
|
|
82
86
|
updateValue(newValue);
|
|
83
87
|
});
|
|
84
|
-
(0,
|
|
88
|
+
(0, react_3.useEffect)(() => {
|
|
85
89
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
86
90
|
focus,
|
|
87
91
|
setValue,
|
|
88
92
|
});
|
|
89
93
|
}, [focus, registerComponentApi, setValue]);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
const input = (0, react_2.useMemo)(() => ((0, jsx_runtime_1.jsx)("input", { id: inputId, ref: innerRef, type: "checkbox", role: variant, checked: value, disabled: !enabled, required: required, readOnly: readOnly, "aria-readonly": readOnly, "aria-checked": value, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, className: (0, classnames_1.default)(Toggle_module_scss_1.default.resetAppearance, className, {
|
|
95
|
+
[Toggle_module_scss_1.default.checkbox]: variant === "checkbox",
|
|
96
|
+
[Toggle_module_scss_1.default.switch]: variant === "switch",
|
|
97
|
+
[Toggle_module_scss_1.default.error]: validationStatus === "error",
|
|
98
|
+
[Toggle_module_scss_1.default.warning]: validationStatus === "warning",
|
|
99
|
+
[Toggle_module_scss_1.default.valid]: validationStatus === "valid",
|
|
100
|
+
}) })), [
|
|
101
|
+
className,
|
|
102
|
+
enabled,
|
|
103
|
+
handleOnBlur,
|
|
104
|
+
handleOnFocus,
|
|
105
|
+
onInputChange,
|
|
106
|
+
readOnly,
|
|
107
|
+
required,
|
|
108
|
+
validationStatus,
|
|
109
|
+
value,
|
|
110
|
+
variant,
|
|
111
|
+
]);
|
|
112
|
+
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { ref: forwardedRef, id: inputId, label: label, style: style, labelPosition: labelPosition, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, isInputTemplateUsed: !!inputRenderer, shrinkToLabel: true, labelStyle: { pointerEvents: readOnly ? "none" : undefined }, children: inputRenderer ? ((0, jsx_runtime_1.jsxs)("label", { className: Toggle_module_scss_1.default.label, children: [(0, jsx_runtime_1.jsx)("div", { className: Toggle_module_scss_1.default.inputContainer, children: input }), inputRenderer({
|
|
113
|
+
$checked: value,
|
|
114
|
+
})] })) : (input) }));
|
|
97
115
|
});
|
|
@@ -157,7 +157,7 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
157
157
|
return getResourceUrl(extractedUrl);
|
|
158
158
|
}, [getResourceUrl, valueExtractor]);
|
|
159
159
|
// --- Collect and compile the layout property values
|
|
160
|
-
const { cssProps
|
|
160
|
+
const { cssProps } = (0, react_1.useMemo)(() => {
|
|
161
161
|
const resolvedLayoutProps = {};
|
|
162
162
|
descriptorHelper_1.layoutOptionKeys.forEach((key) => {
|
|
163
163
|
if (safeNode.props && key in safeNode.props) {
|
|
@@ -175,7 +175,6 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
175
175
|
// --- As compileLayout generates new cssProps and nonCssProps objects every time, we need to
|
|
176
176
|
// --- memoize them using shallow comparison to avoid unnecessary re-renders.
|
|
177
177
|
const stableLayoutCss = (0, hooks_1.useShallowCompareMemoize)(cssProps);
|
|
178
|
-
const stableLayoutNonCss = (0, hooks_1.useShallowCompareMemoize)(nonCssProps);
|
|
179
178
|
// --- No special behavior, let's render the component according to its definition.
|
|
180
179
|
let renderedNode = null;
|
|
181
180
|
let renderingError = null;
|
|
@@ -194,7 +193,6 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
194
193
|
renderChild: memoedRenderChild,
|
|
195
194
|
registerComponentApi: memoedRegisterComponentApi,
|
|
196
195
|
layoutCss: stableLayoutCss,
|
|
197
|
-
layoutNonCss: stableLayoutNonCss,
|
|
198
196
|
layoutContext: layoutContextRef === null || layoutContextRef === void 0 ? void 0 : layoutContextRef.current,
|
|
199
197
|
uid,
|
|
200
198
|
};
|