xmlui 0.10.15 → 0.10.16
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/lib/{index-axjeT2uJ.mjs → index-D4RYJasT.mjs} +2251 -575
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-BoTWMs19.mjs → initMock-qzTZlH-6.mjs} +1 -1
- package/dist/lib/xmlui-parser.d.ts +1 -1
- package/dist/lib/xmlui.d.ts +4 -6
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{collectedComponentMetadata-CQywuPDB.mjs → collectedComponentMetadata-BQaefK3f.mjs} +2536 -861
- package/dist/metadata/{initMock-Bi5kF5Af.mjs → initMock-Cz6QssI3.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Animation/AnimationNative.js +5 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +1 -5
- package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +263 -82
- package/dist/scripts/src/components/Form/FormNative.js +33 -25
- package/dist/scripts/src/components/Icon/IconNative.js +18 -15
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -4
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +109 -426
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +18 -4
- package/dist/scripts/src/components/Option/Option.js +3 -1
- package/dist/scripts/src/components/Select/HiddenOption.js +1 -1
- package/dist/scripts/src/components/Slider/Slider.spec.js +46 -13
- package/dist/scripts/src/components/Slider/SliderNative.js +19 -9
- package/dist/scripts/src/components/Tree/Tree-dynamic.spec.js +2894 -0
- package/dist/scripts/src/components/Tree/Tree.spec.js +2932 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +266 -10
- package/dist/scripts/src/components/Tree/TreeNative.js +1048 -23
- package/dist/scripts/src/components/Tree/testData.js +272 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +1 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +13 -14
- package/dist/scripts/src/components-core/utils/treeUtils.js +187 -12
- package/dist/scripts/src/testing/ComponentDrivers.js +77 -3
- package/dist/scripts/src/testing/drivers/NumberBoxDriver.js +2 -2
- package/dist/scripts/src/testing/drivers/TreeDriver.js +13 -0
- package/dist/scripts/src/testing/fixtures.js +7 -2
- package/dist/standalone/xmlui-standalone.es.d.ts +4 -6
- package/dist/standalone/xmlui-standalone.umd.js +34 -34
- package/package.json +1 -1
- package/dist/scripts/src/components/Animation/Animation.js +0 -50
- package/dist/scripts/src/testing/drivers/SliderDriver.js +0 -20
|
@@ -26,10 +26,10 @@ const StyleParser_1 = require("../../parsers/style-parser/StyleParser");
|
|
|
26
26
|
exports.Icon = (0, react_1.forwardRef)(function Icon(_a, ref) {
|
|
27
27
|
var _b;
|
|
28
28
|
var { name, fallback, style, className, size, onClick, tabIndex, onKeyDown } = _a, restProps = __rest(_a, ["name", "fallback", "style", "className", "size", "onClick", "tabIndex", "onKeyDown"]);
|
|
29
|
-
const iconRenderer = useFindIconRenderer(name, fallback);
|
|
29
|
+
const { iconRenderer, iconName } = useFindIconRenderer(name, fallback);
|
|
30
30
|
// Handle keyboard events for clickable icons
|
|
31
31
|
const handleKeyDown = (event) => {
|
|
32
|
-
if (onClick && (event.key ===
|
|
32
|
+
if (onClick && (event.key === "Enter" || event.key === " ")) {
|
|
33
33
|
event.preventDefault();
|
|
34
34
|
onClick(event);
|
|
35
35
|
}
|
|
@@ -40,7 +40,7 @@ exports.Icon = (0, react_1.forwardRef)(function Icon(_a, ref) {
|
|
|
40
40
|
const height = computedSize || restProps.height;
|
|
41
41
|
const computedProps = Object.assign(Object.assign({
|
|
42
42
|
// className is needed to apply a default color to the icon, thus other component classes can override this one
|
|
43
|
-
className: (0, classnames_1.default)(Icon_module_scss_1.default.base, className, { [Icon_module_scss_1.default.clickable]: !!onClick }) }, restProps), { size: computedSize, width: width, height: height, style: Object.assign(Object.assign({}, style), { "--icon-width": width, "--icon-height": height }), onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex });
|
|
43
|
+
className: (0, classnames_1.default)(Icon_module_scss_1.default.base, className, { [Icon_module_scss_1.default.clickable]: !!onClick }) }, restProps), { size: computedSize, width: width, height: height, style: Object.assign(Object.assign({}, style), { "--icon-width": width, "--icon-height": height }), "data-icon-name": iconName, onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex });
|
|
44
44
|
// ---
|
|
45
45
|
const customIconUrl = useCustomIconUrl(name);
|
|
46
46
|
if (customIconUrl) {
|
|
@@ -50,14 +50,14 @@ exports.Icon = (0, react_1.forwardRef)(function Icon(_a, ref) {
|
|
|
50
50
|
if (!renderedIcon) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
|
-
return (0, jsx_runtime_1.jsx)("span", { ref: ref, style: { display: "inline-block" }, children: renderedIcon });
|
|
53
|
+
return ((0, jsx_runtime_1.jsx)("span", { ref: ref, style: { display: "inline-block" }, children: renderedIcon }));
|
|
54
54
|
});
|
|
55
55
|
const CustomIcon = (0, react_1.forwardRef)(function CustomIcon(props, ref) {
|
|
56
56
|
var _a;
|
|
57
57
|
const { url, width, height, name, style, className, onClick, onKeyDown, tabIndex } = props, rest = __rest(props, ["url", "width", "height", "name", "style", "className", "onClick", "onKeyDown", "tabIndex"]);
|
|
58
58
|
// Handle keyboard events for clickable icons
|
|
59
59
|
const handleKeyDown = (event) => {
|
|
60
|
-
if (onClick && (event.key ===
|
|
60
|
+
if (onClick && (event.key === "Enter" || event.key === " ")) {
|
|
61
61
|
event.preventDefault();
|
|
62
62
|
onClick(event);
|
|
63
63
|
}
|
|
@@ -69,14 +69,14 @@ const CustomIcon = (0, react_1.forwardRef)(function CustomIcon(props, ref) {
|
|
|
69
69
|
if (resourceUrl && isSvgIcon) {
|
|
70
70
|
const renderedIcon = customSvgIconRenderer === null || customSvgIconRenderer === void 0 ? void 0 : customSvgIconRenderer(Object.assign({ style,
|
|
71
71
|
className,
|
|
72
|
-
onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex }, rest));
|
|
72
|
+
onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex, "data-icon-name": name }, rest));
|
|
73
73
|
if (!renderedIcon) {
|
|
74
74
|
//to prevent layout shift
|
|
75
|
-
return ((0, jsx_runtime_1.jsx)("span", Object.assign({}, rest, { ref: ref, style: style, className: className, onClick: onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex })));
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)("span", Object.assign({}, rest, { "data-icon-name": name, ref: ref, style: style, className: className, onClick: onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex })));
|
|
76
76
|
}
|
|
77
77
|
return renderedIcon;
|
|
78
78
|
}
|
|
79
|
-
return ((0, jsx_runtime_1.jsx)("img", Object.assign({ ref: ref, src: resourceUrl, style: Object.assign({ width, height }, style), alt: name, onClick: onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex }, rest)));
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)("img", Object.assign({ ref: ref, src: resourceUrl, "data-icon-name": name, style: Object.assign({ width, height }, style), alt: name, onClick: onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex }, rest)));
|
|
80
80
|
});
|
|
81
81
|
function useCustomIconUrl(iconName) {
|
|
82
82
|
const { getResourceUrl } = (0, ThemeContext_1.useTheme)();
|
|
@@ -104,21 +104,24 @@ function useFindIconRenderer(name, fallback) {
|
|
|
104
104
|
// Component specific icon
|
|
105
105
|
if (parts.length > 1) {
|
|
106
106
|
const iconRenderer = iconRegistry.lookupIconRenderer(`${parts[0].toLowerCase()}${separator}${parts[1]}`);
|
|
107
|
-
if (iconRenderer)
|
|
108
|
-
return iconRenderer;
|
|
107
|
+
if (iconRenderer) {
|
|
108
|
+
return { iconRenderer, iconName: name };
|
|
109
|
+
}
|
|
109
110
|
}
|
|
110
111
|
// General icon
|
|
111
112
|
if (parts.length === 1) {
|
|
112
113
|
const iconRenderer = iconRegistry.lookupIconRenderer(parts[0]);
|
|
113
|
-
if (iconRenderer)
|
|
114
|
-
return iconRenderer;
|
|
114
|
+
if (iconRenderer) {
|
|
115
|
+
return { iconRenderer, iconName: name };
|
|
116
|
+
}
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
if (fallback && typeof fallback === "string") {
|
|
118
120
|
const iconRenderer = iconRegistry.lookupIconRenderer(fallback.toLowerCase());
|
|
119
|
-
if (iconRenderer)
|
|
120
|
-
return iconRenderer;
|
|
121
|
+
if (iconRenderer) {
|
|
122
|
+
return { iconRenderer, iconName: fallback };
|
|
123
|
+
}
|
|
121
124
|
}
|
|
122
|
-
return null;
|
|
125
|
+
return { iconRenderer: null, iconName: null };
|
|
123
126
|
}
|
|
124
127
|
exports.default = exports.Icon;
|
|
@@ -36,7 +36,7 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
|
|
|
36
36
|
const appContext = (0, AppContext_1.useAppContext)();
|
|
37
37
|
const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
|
|
38
38
|
const { activeTheme: currentTheme, activeThemeTone, activeThemeId } = (0, ThemeContext_1.useTheme)();
|
|
39
|
-
const safePopOutUrl = (0, utils_1.withoutTrailingSlash)(popOutUrl || ((_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.popOutUrl) || "https://
|
|
39
|
+
const safePopOutUrl = (0, utils_1.withoutTrailingSlash)(popOutUrl || ((_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.popOutUrl) || "https://playground.xmlui.org/#/playground");
|
|
40
40
|
const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
const data = {
|
|
42
42
|
standalone: {
|
|
@@ -118,10 +118,10 @@ exports.NumberBoxMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
118
118
|
},
|
|
119
119
|
});
|
|
120
120
|
exports.numberBoxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NumberBoxMd, ({ node, state, updateState, lookupEventHandler, extractValue, className, registerComponentApi, }) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
extractedInitialValue = Number(extractedInitialValue);
|
|
121
|
+
let extractedInitialValue;
|
|
122
|
+
try {
|
|
123
|
+
extractedInitialValue = extractValue.asOptionalNumber(node.props.initialValue);
|
|
125
124
|
}
|
|
125
|
+
catch (_a) { }
|
|
126
126
|
return ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, { className: className, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractedInitialValue, step: extractValue(node.props.step), 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), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), 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), gap: extractValue.asOptionalString(node.props.gap), endIcon: extractValue.asOptionalString(node.props.endIcon), spinnerUpIcon: extractValue.asOptionalString(node.props.spinnerUpIcon), spinnerDownIcon: extractValue.asOptionalString(node.props.spinnerDownIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength), 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) }));
|
|
127
127
|
});
|