xmlui 0.10.11 → 0.10.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/lib/{index-BuIblMfO.mjs → index-CDOoBf2R.mjs} +1241 -1649
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-CV-9AUzP.mjs → initMock-BAV9RKui.mjs} +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-DzONZF-e.mjs → metadata-utils-D90qqMGc.mjs} +1 -1
- package/dist/lib/{server-common-Dsyp3-Ro.mjs → server-common-lmBDLpUh.mjs} +2595 -2571
- package/dist/lib/{transform-CBz7TQJh.mjs → transform-bHBjkKSL.mjs} +2 -1
- package/dist/lib/xmlui-parser.d.ts +17 -8
- package/dist/lib/xmlui-parser.mjs +2 -2
- package/dist/lib/{xmlui-serializer-Bf9bdvlV.mjs → xmlui-serializer-DB6BLiXK.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +2 -0
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{collectedComponentMetadata-Cdi6AFD3.mjs → collectedComponentMetadata-Dp8BqWQO.mjs} +1315 -1722
- package/dist/metadata/{initMock-B7OlSKKb.mjs → initMock-BvEO8W8r.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/AppHeader/AppHeaderNative.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -1
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +7 -4
- package/dist/scripts/src/components/Avatar/Avatar.js +1 -1
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +6 -6
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +25 -15
- package/dist/scripts/src/components/Charts/LineChart/LineChart.js +5 -5
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +14 -4
- package/dist/scripts/src/components/ComponentProvider.js +0 -2
- package/dist/scripts/src/components/Footer/FooterNative.js +1 -1
- package/dist/scripts/src/components/Form/FormNative.js +5 -3
- package/dist/scripts/src/components/FormItem/FormItemNative.js +0 -9
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/Icon/IconNative.js +24 -6
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +8 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +5 -3
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +208 -78
- package/dist/scripts/src/components/Spinner/SpinnerNative.js +3 -2
- package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +9 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +2 -1
- package/dist/standalone/xmlui-standalone.es.d.ts +2 -0
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBox2.js +0 -99
- package/dist/scripts/src/components/NumberBox/NumberBox2Native.js +0 -420
|
@@ -53,7 +53,7 @@ const AppHeader = (_a) => {
|
|
|
53
53
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
54
54
|
registerSubNavPanelSlot === null || registerSubNavPanelSlot === void 0 ? void 0 : registerSubNavPanelSlot(subNavPanelSlot.current);
|
|
55
55
|
}, []);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.header, className), style: style, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.headerInner, {
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.header, className), style: style, role: "banner", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.headerInner, {
|
|
57
57
|
[AppHeader_module_scss_1.default.full]: !canRestrictContentWidth,
|
|
58
58
|
}), children: [hasRegisteredNavPanel && ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: toggleDrawer, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "hamburger" }), variant: "ghost", className: AppHeader_module_scss_1.default.drawerToggle, style: { color: "inherit", flexShrink: 0 } })), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoAndTitle, children: (showLogo || !navPanelVisible) &&
|
|
59
59
|
(logoContent ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.customLogoContainer, children: logoContent }), safeLogoTitle] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!logoUrl && ((0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoContainer, children: (0, jsx_runtime_1.jsx)(NavLinkNative_1.NavLink, { to: "/", displayActive: false, className: AppHeader_module_scss_1.default.logoLink, children: (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }) })), safeLogoTitle] }))) }), (0, jsx_runtime_1.jsx)("div", { ref: subNavPanelSlot, className: AppHeader_module_scss_1.default.subNavPanelSlot }), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.childrenWrapper, children: children }), profileMenu && (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.rightItems, children: profileMenu })] }) })));
|
|
@@ -43,6 +43,10 @@ exports.AutoCompleteMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
43
43
|
gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
|
|
44
44
|
lostFocus: (0, metadata_helpers_1.dLostFocus)(COMP),
|
|
45
45
|
didChange: (0, metadata_helpers_1.dDidChange)(COMP),
|
|
46
|
+
itemCreated: {
|
|
47
|
+
description: "This event is triggered when a new item is created by the user " +
|
|
48
|
+
"(if `creatable` is enabled).",
|
|
49
|
+
}
|
|
46
50
|
},
|
|
47
51
|
apis: {
|
|
48
52
|
focus: {
|
|
@@ -93,7 +97,7 @@ exports.AutoCompleteMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
93
97
|
},
|
|
94
98
|
});
|
|
95
99
|
exports.autoCompleteComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AutoCompleteMd, ({ node, state, updateState, extractValue, renderChild, lookupEventHandler, registerComponentApi, className, }) => {
|
|
96
|
-
return ((0, jsx_runtime_1.jsx)(AutoCompleteNative_1.AutoComplete, { multi: extractValue.asOptionalBoolean(node.props.multi), className: className, updateState: updateState, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, creatable: extractValue.asOptionalBoolean(node.props.creatable), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), initiallyOpen: extractValue.asOptionalBoolean(node.props.initiallyOpen), optionRenderer: node.props.optionTemplate
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(AutoCompleteNative_1.AutoComplete, { multi: extractValue.asOptionalBoolean(node.props.multi), className: className, updateState: updateState, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, creatable: extractValue.asOptionalBoolean(node.props.creatable), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), onItemCreated: lookupEventHandler("itemCreated"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), initiallyOpen: extractValue.asOptionalBoolean(node.props.initiallyOpen), optionRenderer: node.props.optionTemplate
|
|
97
101
|
? (item, val, inTrigger) => {
|
|
98
102
|
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.optionTemplate, item: item, context: {
|
|
99
103
|
$selectedValue: val,
|
|
@@ -31,6 +31,7 @@ const react_popover_1 = require("@radix-ui/react-popover");
|
|
|
31
31
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
32
32
|
const HiddenOption_1 = require("../Select/HiddenOption");
|
|
33
33
|
const parts_1 = require("../../components-core/parts");
|
|
34
|
+
const PART_LIST_WRAPPER = "listWrapper";
|
|
34
35
|
function isOptionsExist(options, newOptions) {
|
|
35
36
|
return newOptions.some((option) => Array.from(options).some((o) => o.value === option.value || o.label === option.label));
|
|
36
37
|
}
|
|
@@ -46,10 +47,11 @@ exports.defaultProps = {
|
|
|
46
47
|
onDidChange: constants_1.noop,
|
|
47
48
|
onFocus: constants_1.noop,
|
|
48
49
|
onBlur: constants_1.noop,
|
|
50
|
+
onItemCreated: constants_1.noop,
|
|
49
51
|
initiallyOpen: false,
|
|
50
52
|
};
|
|
51
53
|
exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forwardedRef) {
|
|
52
|
-
var { id, initialValue, value, enabled = exports.defaultProps.enabled, placeholder, updateState = exports.defaultProps.updateState, validationStatus = exports.defaultProps.validationStatus, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, registerComponentApi, emptyListTemplate, style, className, children, readOnly = exports.defaultProps.readOnly, autoFocus = exports.defaultProps.autoFocus, dropdownHeight, multi = exports.defaultProps.multi, label, labelPosition, labelWidth, labelBreak, required = exports.defaultProps.required, creatable = exports.defaultProps.creatable, optionRenderer, initiallyOpen = exports.defaultProps.initiallyOpen } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "placeholder", "updateState", "validationStatus", "onDidChange", "onFocus", "onBlur", "registerComponentApi", "emptyListTemplate", "style", "className", "children", "readOnly", "autoFocus", "dropdownHeight", "multi", "label", "labelPosition", "labelWidth", "labelBreak", "required", "creatable", "optionRenderer", "initiallyOpen"]);
|
|
54
|
+
var { id, initialValue, value, enabled = exports.defaultProps.enabled, placeholder, updateState = exports.defaultProps.updateState, validationStatus = exports.defaultProps.validationStatus, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, onItemCreated = exports.defaultProps.onItemCreated, registerComponentApi, emptyListTemplate, style, className, children, readOnly = exports.defaultProps.readOnly, autoFocus = exports.defaultProps.autoFocus, dropdownHeight, multi = exports.defaultProps.multi, label, labelPosition, labelWidth, labelBreak, required = exports.defaultProps.required, creatable = exports.defaultProps.creatable, optionRenderer, initiallyOpen = exports.defaultProps.initiallyOpen } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "placeholder", "updateState", "validationStatus", "onDidChange", "onFocus", "onBlur", "onItemCreated", "registerComponentApi", "emptyListTemplate", "style", "className", "children", "readOnly", "autoFocus", "dropdownHeight", "multi", "label", "labelPosition", "labelWidth", "labelBreak", "required", "creatable", "optionRenderer", "initiallyOpen"]);
|
|
53
55
|
const [referenceElement, setReferenceElement] = (0, react_1.useState)(null);
|
|
54
56
|
const inputRef = (0, react_1.useRef)(null);
|
|
55
57
|
const [open, setOpen] = (0, react_1.useState)(initiallyOpen);
|
|
@@ -184,7 +186,7 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
184
186
|
if (extendedValue.toLowerCase().includes(search.toLowerCase()))
|
|
185
187
|
return 1;
|
|
186
188
|
return 0;
|
|
187
|
-
}, children: [(0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { id: inputId, ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, className: className, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)("div", { ref: setReferenceElement, style: Object.assign({ width: "100%" }, style), className: (0, classnames_1.default)(className, AutoComplete_module_scss_1.default.badgeListWrapper, AutoComplete_module_scss_1.default[validationStatus], {
|
|
189
|
+
}, children: [(0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { id: inputId, ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, className: className, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)("div", { "data-part-id": PART_LIST_WRAPPER, ref: setReferenceElement, style: Object.assign({ width: "100%" }, style), className: (0, classnames_1.default)(className, AutoComplete_module_scss_1.default.badgeListWrapper, AutoComplete_module_scss_1.default[validationStatus], {
|
|
188
190
|
[AutoComplete_module_scss_1.default.disabled]: !enabled,
|
|
189
191
|
[AutoComplete_module_scss_1.default.focused]: isFocused,
|
|
190
192
|
}), children: [Array.isArray(selectedValue) && ((0, jsx_runtime_1.jsx)("div", { className: AutoComplete_module_scss_1.default.badgeList, children: selectedValue.map((v, index) => ((0, jsx_runtime_1.jsxs)("span", { className: AutoComplete_module_scss_1.default.badge, children: [v === null || v === void 0 ? void 0 : v.label, !readOnly && ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", size: "sm", onClick: (event) => {
|
|
@@ -227,9 +229,9 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
227
229
|
if (readOnly)
|
|
228
230
|
return;
|
|
229
231
|
setOpen(!open);
|
|
230
|
-
}, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] })] }) }) })), open && ((0, jsx_runtime_1.jsx)(react_popover_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { asChild: true, style: { width, height: dropdownHeight }, className: AutoComplete_module_scss_1.default.popoverContent, align: "start", onOpenAutoFocus: (e) => e.preventDefault(), children: (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { role: "listbox", className: AutoComplete_module_scss_1.default.commandList, style: { height: dropdownHeight }, children: [(0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode }), creatable && (0, jsx_runtime_1.jsx)(CreatableItem, {}), (0, jsx_runtime_1.jsx)(cmdk_1.CommandGroup, { children: Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(AutoCompleteOption, { value: value, label: label, enabled: enabled, keywords: keywords, readOnly: readOnly }, value))) })] }) }) }))] }) }), children] }) }) }));
|
|
232
|
+
}, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] })] }) }) })), open && ((0, jsx_runtime_1.jsx)(react_popover_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { asChild: true, style: { width, height: dropdownHeight }, className: AutoComplete_module_scss_1.default.popoverContent, align: "start", onOpenAutoFocus: (e) => e.preventDefault(), children: (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { role: "listbox", className: AutoComplete_module_scss_1.default.commandList, style: { height: dropdownHeight }, children: [(0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode }), creatable && (0, jsx_runtime_1.jsx)(CreatableItem, { onNewItem: onItemCreated }), (0, jsx_runtime_1.jsx)(cmdk_1.CommandGroup, { children: Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(AutoCompleteOption, { value: value, label: label, enabled: enabled, keywords: keywords, readOnly: readOnly }, value))) })] }) }) }))] }) }), children] }) }) }));
|
|
231
233
|
});
|
|
232
|
-
function CreatableItem() {
|
|
234
|
+
function CreatableItem({ onNewItem }) {
|
|
233
235
|
const { value, options, inputValue, onChange, setOpen } = (0, AutoCompleteContext_1.useAutoComplete)();
|
|
234
236
|
const { onOptionAdd } = (0, OptionContext_1.useOption)();
|
|
235
237
|
if (isOptionsExist(options, [{ value: inputValue, label: inputValue }]) ||
|
|
@@ -243,6 +245,7 @@ function CreatableItem() {
|
|
|
243
245
|
}, onSelect: (value) => {
|
|
244
246
|
const newOption = { value, label: value, enabled: true };
|
|
245
247
|
onOptionAdd(newOption);
|
|
248
|
+
onNewItem === null || onNewItem === void 0 ? void 0 : onNewItem(value);
|
|
246
249
|
onChange(value);
|
|
247
250
|
setOpen(false);
|
|
248
251
|
}, children: `Create "${inputValue}"` }));
|
|
@@ -51,5 +51,5 @@ exports.AvatarMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
51
51
|
});
|
|
52
52
|
exports.avatarComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AvatarMd, ({ node, extractValue, lookupEventHandler, className, extractResourceUrl }) => {
|
|
53
53
|
var _a;
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(AvatarNative_1.Avatar, { className: className, size: (_a = node.props) === null || _a === void 0 ? void 0 : _a.size, url: extractResourceUrl(node.props.url), name: extractValue(node.props.name), onClick: lookupEventHandler("click") }));
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(AvatarNative_1.Avatar, { className: className, size: (_a = node.props) === null || _a === void 0 ? void 0 : _a.size, url: node.props.url ? extractResourceUrl(node.props.url) : undefined, name: extractValue(node.props.name), onClick: lookupEventHandler("click") }));
|
|
55
55
|
});
|
|
@@ -18,9 +18,8 @@ exports.BarChartMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
18
18
|
description: `This property is used to provide the component with data to display.` +
|
|
19
19
|
`The data needs to be an array of objects.`,
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
description: "
|
|
23
|
-
`E.g. 'id' or 'key'.`,
|
|
21
|
+
yKeys: {
|
|
22
|
+
description: "Specifies the key in the data objects that will be used to label the different data series.",
|
|
24
23
|
valueType: "string",
|
|
25
24
|
},
|
|
26
25
|
stacked: {
|
|
@@ -38,8 +37,9 @@ exports.BarChartMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
38
37
|
availableValues: ["horizontal", "vertical"],
|
|
39
38
|
defaultValue: BarChartNative_1.defaultProps.layout,
|
|
40
39
|
},
|
|
41
|
-
|
|
42
|
-
description: "
|
|
40
|
+
xKey: {
|
|
41
|
+
description: "This property specifies the keys in the data objects that should be used for rendering the bars." +
|
|
42
|
+
`E.g. 'id' or 'key'.`,
|
|
43
43
|
valueType: "string",
|
|
44
44
|
},
|
|
45
45
|
hideX: {
|
|
@@ -87,7 +87,7 @@ exports.BarChartMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
87
87
|
});
|
|
88
88
|
exports.barChartComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.BarChartMd, ({ extractValue, node, className, lookupSyncCallback, renderChild }) => {
|
|
89
89
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
90
|
-
return ((0, jsx_runtime_1.jsx)(BarChartNative_1.BarChart, { className: className, tickFormatterX: lookupSyncCallback((_a = node.props) === null || _a === void 0 ? void 0 : _a.tickFormatterX), tickFormatterY: lookupSyncCallback((_b = node.props) === null || _b === void 0 ? void 0 : _b.tickFormatterY), data: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.data), layout: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.orientation), nameKey: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(BarChartNative_1.BarChart, { className: className, tickFormatterX: lookupSyncCallback((_a = node.props) === null || _a === void 0 ? void 0 : _a.tickFormatterX), tickFormatterY: lookupSyncCallback((_b = node.props) === null || _b === void 0 ? void 0 : _b.tickFormatterY), data: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.data), layout: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.orientation), nameKey: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.xKey), dataKeys: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.yKeys), stacked: extractValue.asOptionalBoolean((_g = node.props) === null || _g === void 0 ? void 0 : _g.stacked), hideX: extractValue.asOptionalBoolean((_h = node.props) === null || _h === void 0 ? void 0 : _h.hideX), hideY: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.hideY), hideTickX: extractValue.asOptionalBoolean((_k = node.props) === null || _k === void 0 ? void 0 : _k.hideTickX), hideTickY: extractValue.asOptionalBoolean((_l = node.props) === null || _l === void 0 ? void 0 : _l.hideTickY), hideTooltip: extractValue.asOptionalBoolean((_m = node.props) === null || _m === void 0 ? void 0 : _m.hideTooltip), showLegend: extractValue.asOptionalBoolean((_o = node.props) === null || _o === void 0 ? void 0 : _o.showLegend), tooltipRenderer: node.props.tooltipTemplate
|
|
91
91
|
? (tooltipData) => {
|
|
92
92
|
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.tooltipTemplate, item: tooltipData, contextVars: {
|
|
93
93
|
$tooltip: tooltipData,
|
|
@@ -67,21 +67,6 @@ function BarChart({ data = [], layout = exports.defaultProps.layout, nameKey, st
|
|
|
67
67
|
// Validate and normalize data
|
|
68
68
|
const validData = (0, react_2.useMemo)(() => (Array.isArray(data) ? data : []), [data]);
|
|
69
69
|
const { getThemeVar } = (0, ThemeContext_1.useTheme)();
|
|
70
|
-
const safeTooltipRenderer = (0, react_1.useCallback)((props) => {
|
|
71
|
-
if (!tooltipRenderer)
|
|
72
|
-
return (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, Object.assign({}, props));
|
|
73
|
-
const payloadObject = {};
|
|
74
|
-
if (props.payload && props.payload.length > 0 && props.payload[0].payload) {
|
|
75
|
-
Object.assign(payloadObject, props.payload[0].payload);
|
|
76
|
-
}
|
|
77
|
-
// Extract tooltip data from Recharts props
|
|
78
|
-
const tooltipData = {
|
|
79
|
-
label: props.label,
|
|
80
|
-
payload: payloadObject,
|
|
81
|
-
active: props.active,
|
|
82
|
-
};
|
|
83
|
-
return tooltipRenderer(tooltipData);
|
|
84
|
-
}, [tooltipRenderer]);
|
|
85
70
|
const colorValues = (0, react_2.useMemo)(() => {
|
|
86
71
|
return [
|
|
87
72
|
getThemeVar("color-primary-500"),
|
|
@@ -122,6 +107,31 @@ function BarChart({ data = [], layout = exports.defaultProps.layout, nameKey, st
|
|
|
122
107
|
getThemeVar("color-secondary-700"),
|
|
123
108
|
];
|
|
124
109
|
}, [getThemeVar]);
|
|
110
|
+
const safeTooltipRenderer = (0, react_1.useCallback)((props) => {
|
|
111
|
+
if (!tooltipRenderer)
|
|
112
|
+
return (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, Object.assign({}, props));
|
|
113
|
+
const payloadArray = [];
|
|
114
|
+
if (props.payload && props.payload.length > 0 && props.payload[0].payload) {
|
|
115
|
+
const originalPayload = props.payload[0].payload;
|
|
116
|
+
// Transform dataKeys into array of objects with label, value, and color
|
|
117
|
+
dataKeys === null || dataKeys === void 0 ? void 0 : dataKeys.forEach((dataKey, index) => {
|
|
118
|
+
if (dataKey in originalPayload) {
|
|
119
|
+
payloadArray.push({
|
|
120
|
+
label: dataKey,
|
|
121
|
+
value: originalPayload[dataKey],
|
|
122
|
+
color: colorValues[index] || colorValues[0]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
// Extract tooltip data from Recharts props
|
|
128
|
+
const tooltipData = {
|
|
129
|
+
label: props.label,
|
|
130
|
+
payload: payloadArray,
|
|
131
|
+
active: props.active,
|
|
132
|
+
};
|
|
133
|
+
return tooltipRenderer(tooltipData);
|
|
134
|
+
}, [tooltipRenderer, dataKeys, colorValues]);
|
|
125
135
|
const config = (0, react_2.useMemo)(() => {
|
|
126
136
|
return Object.assign({}, ...dataKeys.map((key, index) => {
|
|
127
137
|
return {
|
|
@@ -24,12 +24,12 @@ exports.LineChartMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
24
24
|
description: "The data to be displayed in the line chart." +
|
|
25
25
|
"It needs to be an array of objects, where each object represents a data point.",
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
description: "
|
|
27
|
+
xKey: {
|
|
28
|
+
description: "The key in the data objects used for labeling different data series.",
|
|
29
29
|
valueType: "string",
|
|
30
30
|
},
|
|
31
|
-
|
|
32
|
-
description: "
|
|
31
|
+
yKeys: {
|
|
32
|
+
description: "This property specifies the keys in the data objects that should be used for rendering the lines.",
|
|
33
33
|
valueType: "string",
|
|
34
34
|
},
|
|
35
35
|
hideX: {
|
|
@@ -84,7 +84,7 @@ exports.LineChartMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
84
84
|
});
|
|
85
85
|
exports.lineChartComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.LineChartMd, ({ extractValue, node, className, lookupSyncCallback, renderChild }) => {
|
|
86
86
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
87
|
-
return ((0, jsx_runtime_1.jsx)(LineChartNative_1.LineChart, { tickFormatterX: lookupSyncCallback((_a = node.props) === null || _a === void 0 ? void 0 : _a.tickFormatterX), tickFormatterY: lookupSyncCallback((_b = node.props) === null || _b === void 0 ? void 0 : _b.tickFormatterY), hideTickX: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.hideTickX), hideTickY: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.hideTickY), data: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.data), className: className, dataKeys: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(LineChartNative_1.LineChart, { tickFormatterX: lookupSyncCallback((_a = node.props) === null || _a === void 0 ? void 0 : _a.tickFormatterX), tickFormatterY: lookupSyncCallback((_b = node.props) === null || _b === void 0 ? void 0 : _b.tickFormatterY), hideTickX: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.hideTickX), hideTickY: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.hideTickY), data: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.data), className: className, dataKeys: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.yKeys), nameKey: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.xKey), hideX: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.hideX), hideY: extractValue((_j = node.props) === null || _j === void 0 ? void 0 : _j.hideY), hideTooltip: extractValue((_k = node.props) === null || _k === void 0 ? void 0 : _k.hideTooltip), showLegend: extractValue.asOptionalBoolean((_l = node.props) === null || _l === void 0 ? void 0 : _l.showLegend), marginTop: extractValue.asOptionalNumber((_m = node.props) === null || _m === void 0 ? void 0 : _m.marginTop), marginRight: extractValue.asOptionalNumber((_o = node.props) === null || _o === void 0 ? void 0 : _o.marginRight), marginBottom: extractValue.asOptionalNumber((_p = node.props) === null || _p === void 0 ? void 0 : _p.marginBottom), marginLeft: extractValue.asOptionalNumber((_q = node.props) === null || _q === void 0 ? void 0 : _q.marginLeft), tooltipRenderer: node.props.tooltipTemplate
|
|
88
88
|
? (tooltipData) => {
|
|
89
89
|
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.tooltipTemplate, item: tooltipData, contextVars: {
|
|
90
90
|
$tooltip: tooltipData,
|
|
@@ -114,18 +114,28 @@ exports.LineChart = (0, react_1.forwardRef)(function LineChart({ data, dataKeys
|
|
|
114
114
|
const safeTooltipRenderer = (0, react_1.useCallback)((props) => {
|
|
115
115
|
if (!tooltipRenderer)
|
|
116
116
|
return (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, Object.assign({}, props));
|
|
117
|
-
const
|
|
117
|
+
const payloadArray = [];
|
|
118
118
|
if (props.payload && props.payload.length > 0 && props.payload[0].payload) {
|
|
119
|
-
|
|
119
|
+
const originalPayload = props.payload[0].payload;
|
|
120
|
+
// Transform dataKeys into array of objects with label, value, and color
|
|
121
|
+
dataKeys.forEach((dataKey, index) => {
|
|
122
|
+
if (dataKey in originalPayload) {
|
|
123
|
+
payloadArray.push({
|
|
124
|
+
label: dataKey,
|
|
125
|
+
value: originalPayload[dataKey],
|
|
126
|
+
color: colorValues[index] || colorValues[0]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
120
130
|
}
|
|
121
131
|
// Extract tooltip data from Recharts props
|
|
122
132
|
const tooltipData = {
|
|
123
133
|
label: props.label,
|
|
124
|
-
payload:
|
|
134
|
+
payload: payloadArray,
|
|
125
135
|
active: props.active,
|
|
126
136
|
};
|
|
127
137
|
return tooltipRenderer(tooltipData);
|
|
128
|
-
}, [tooltipRenderer]);
|
|
138
|
+
}, [tooltipRenderer, dataKeys, colorValues]);
|
|
129
139
|
(0, react_1.useEffect)(() => {
|
|
130
140
|
const calc = () => {
|
|
131
141
|
var _a, _b, _c;
|
|
@@ -45,7 +45,6 @@ const RealTimeAdapter_1 = require("./RealTimeAdapter/RealTimeAdapter");
|
|
|
45
45
|
const Form_1 = require("./Form/Form");
|
|
46
46
|
const EmojiSelector_1 = require("./EmojiSelector/EmojiSelector");
|
|
47
47
|
const NumberBox_1 = require("./NumberBox/NumberBox");
|
|
48
|
-
const NumberBox2_1 = require("./NumberBox/NumberBox2");
|
|
49
48
|
const HoverCard_1 = require("./HoverCard/HoverCard");
|
|
50
49
|
const App_1 = require("./App/App");
|
|
51
50
|
const NavPanel_1 = require("./NavPanel/NavPanel");
|
|
@@ -411,7 +410,6 @@ class ComponentRegistry {
|
|
|
411
410
|
this.registerCoreComponent(TextBox_1.textBoxComponentRenderer);
|
|
412
411
|
this.registerCoreComponent(TextBox_1.passwordInputComponentRenderer);
|
|
413
412
|
this.registerCoreComponent(NumberBox_1.numberBoxComponentRenderer);
|
|
414
|
-
this.registerCoreComponent(NumberBox2_1.numberBox2ComponentRenderer);
|
|
415
413
|
this.registerCoreComponent(HoverCard_1.hoverCardComponentRenderer);
|
|
416
414
|
this.registerCoreComponent(RadioGroup_1.radioGroupRenderer);
|
|
417
415
|
this.registerCoreComponent(FileInput_1.fileInputRenderer);
|
|
@@ -29,7 +29,7 @@ exports.Footer = (0, react_1.forwardRef)(function Footer(_a, forwardedRef) {
|
|
|
29
29
|
var { children, style, className } = _a, rest = __rest(_a, ["children", "style", "className"]);
|
|
30
30
|
const { layout } = (0, AppLayoutContext_1.useAppLayoutContext)() || {};
|
|
31
31
|
const canRestrictContentWidth = layout !== "vertical-full-header";
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: Footer_module_scss_1.default.outerWrapper, ref: forwardedRef, style: style, children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Footer_module_scss_1.default.wrapper, className, {
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: Footer_module_scss_1.default.outerWrapper, ref: forwardedRef, style: style, role: "contentinfo", children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Footer_module_scss_1.default.wrapper, className, {
|
|
33
33
|
[Footer_module_scss_1.default.full]: !canRestrictContentWidth,
|
|
34
34
|
}), children: children }) })));
|
|
35
35
|
});
|
|
@@ -45,6 +45,8 @@ const formActions_2 = require("../Form/formActions");
|
|
|
45
45
|
const FormContext_1 = require("./FormContext");
|
|
46
46
|
const lodash_es_1 = require("lodash-es");
|
|
47
47
|
const classnames_1 = __importDefault(require("classnames"));
|
|
48
|
+
const PART_CANCEL_BUTTON = "cancelButton";
|
|
49
|
+
const PART_SUBMIT_BUTTON = "submitButton";
|
|
48
50
|
const getByPath = (obj, path) => {
|
|
49
51
|
return (0, lodash_es_1.get)(obj, path);
|
|
50
52
|
};
|
|
@@ -248,7 +250,7 @@ const Form = (0, react_2.forwardRef)(function (_a, ref) {
|
|
|
248
250
|
try {
|
|
249
251
|
const filteredSubject = cleanUpSubject(formState.subject);
|
|
250
252
|
const result = yield (onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(filteredSubject, {
|
|
251
|
-
passAsDefaultBody: true
|
|
253
|
+
passAsDefaultBody: true,
|
|
252
254
|
}));
|
|
253
255
|
dispatch((0, formActions_1.formSubmitted)());
|
|
254
256
|
yield (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(result));
|
|
@@ -321,8 +323,8 @@ const Form = (0, react_2.forwardRef)(function (_a, ref) {
|
|
|
321
323
|
});
|
|
322
324
|
});
|
|
323
325
|
});
|
|
324
|
-
const cancelButton = cancelLabel === "" ? null : ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: "button", themeColor: "secondary", variant: "ghost", onClick: doCancel, children: cancelLabel }, "cancel"));
|
|
325
|
-
const submitButton = (0, react_2.useMemo)(() => ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: "submit", disabled: !isEnabled, children: formState.submitInProgress ? saveInProgressLabel : saveLabel }, "submit")), [isEnabled, formState.submitInProgress, saveInProgressLabel, saveLabel]);
|
|
326
|
+
const cancelButton = cancelLabel === "" ? null : ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_CANCEL_BUTTON, type: "button", themeColor: "secondary", variant: "ghost", onClick: doCancel, children: cancelLabel }, "cancel"));
|
|
327
|
+
const submitButton = (0, react_2.useMemo)(() => ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_SUBMIT_BUTTON, type: "submit", disabled: !isEnabled, children: formState.submitInProgress ? saveInProgressLabel : saveLabel }, "submit")), [isEnabled, formState.submitInProgress, saveInProgressLabel, saveLabel]);
|
|
326
328
|
(0, react_2.useEffect)(() => {
|
|
327
329
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
328
330
|
reset: doReset,
|
|
@@ -35,7 +35,6 @@ 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");
|
|
39
38
|
const ItemsNative_1 = require("../Items/ItemsNative");
|
|
40
39
|
const constants_1 = require("../../components-core/constants");
|
|
41
40
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
@@ -168,14 +167,6 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
168
167
|
formControl = ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, Object.assign({}, rest, { initialValue: initialValue, value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, integersOnly: type === "integer", validationStatus: validationStatus, min: validations.minValue, max: validations.maxValue, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength, gap: gap })));
|
|
169
168
|
break;
|
|
170
169
|
}
|
|
171
|
-
// NOTE: This is a prototype for the new number field
|
|
172
|
-
// works as good as the regular number field but untested
|
|
173
|
-
// in production.
|
|
174
|
-
case "integer2":
|
|
175
|
-
case "number2": {
|
|
176
|
-
formControl = ((0, jsx_runtime_1.jsx)(NumberBox2Native_1.NumberBox2, Object.assign({}, rest, { initialValue: initialValue, value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, min: validations.minValue, max: validations.maxValue, integersOnly: type === "integer2" })));
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
170
|
case "switch":
|
|
180
171
|
case "checkbox": {
|
|
181
172
|
formControl = ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, Object.assign({}, rest, { value: value, updateState: onStateChange,
|
|
@@ -28,9 +28,9 @@ exports.defaultProps = {
|
|
|
28
28
|
const numberRegex = /^[0-9]+$/;
|
|
29
29
|
exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel(_a, ref) {
|
|
30
30
|
var { id, labelPosition = "top", style = {}, className, label, labelBreak = exports.defaultProps.labelBreak, labelWidth, enabled = true, required = false, children, validationInProgress = false, shrinkToLabel = false, onFocus, onBlur, labelStyle, validationResult, isInputTemplateUsed = false } = _a, rest = __rest(_a, ["id", "labelPosition", "style", "className", "label", "labelBreak", "labelWidth", "enabled", "required", "children", "validationInProgress", "shrinkToLabel", "onFocus", "onBlur", "labelStyle", "validationResult", "isInputTemplateUsed"]);
|
|
31
|
-
// --- HACK: the "rest" may contain a "layoutContext" property
|
|
32
|
-
// --- would issue a warning in React.
|
|
33
|
-
if (rest.layoutContext
|
|
31
|
+
// --- HACK: the "rest" may contain a "layoutContext" property that React doesn't recognize
|
|
32
|
+
// --- as a valid DOM attribute, which would issue a warning in React.
|
|
33
|
+
if (rest.layoutContext !== undefined) {
|
|
34
34
|
delete rest.layoutContext;
|
|
35
35
|
}
|
|
36
36
|
// --- END HACK
|
|
@@ -25,14 +25,22 @@ const StyleParser_1 = require("../../parsers/style-parser/StyleParser");
|
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
26
|
exports.Icon = (0, react_1.forwardRef)(function Icon(_a, ref) {
|
|
27
27
|
var _b;
|
|
28
|
-
var { name, fallback, style, className, size, onClick } = _a, restProps = __rest(_a, ["name", "fallback", "style", "className", "size", "onClick"]);
|
|
28
|
+
var { name, fallback, style, className, size, onClick, tabIndex, onKeyDown } = _a, restProps = __rest(_a, ["name", "fallback", "style", "className", "size", "onClick", "tabIndex", "onKeyDown"]);
|
|
29
29
|
const iconRenderer = useFindIconRenderer(name, fallback);
|
|
30
|
+
// Handle keyboard events for clickable icons
|
|
31
|
+
const handleKeyDown = (event) => {
|
|
32
|
+
if (onClick && (event.key === 'Enter' || event.key === ' ')) {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
onClick(event);
|
|
35
|
+
}
|
|
36
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
37
|
+
};
|
|
30
38
|
const computedSize = typeof size === "string" ? mapSizeToIconPack(size) : size;
|
|
31
39
|
const width = computedSize || restProps.width;
|
|
32
40
|
const height = computedSize || restProps.height;
|
|
33
41
|
const computedProps = Object.assign(Object.assign({
|
|
34
42
|
// className is needed to apply a default color to the icon, thus other component classes can override this one
|
|
35
|
-
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 });
|
|
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 });
|
|
36
44
|
// ---
|
|
37
45
|
const customIconUrl = useCustomIconUrl(name);
|
|
38
46
|
if (customIconUrl) {
|
|
@@ -46,19 +54,29 @@ exports.Icon = (0, react_1.forwardRef)(function Icon(_a, ref) {
|
|
|
46
54
|
});
|
|
47
55
|
const CustomIcon = (0, react_1.forwardRef)(function CustomIcon(props, ref) {
|
|
48
56
|
var _a;
|
|
49
|
-
const { url, width, height, name, style, className } = props, rest = __rest(props, ["url", "width", "height", "name", "style", "className"]);
|
|
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
|
+
// Handle keyboard events for clickable icons
|
|
59
|
+
const handleKeyDown = (event) => {
|
|
60
|
+
if (onClick && (event.key === 'Enter' || event.key === ' ')) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
onClick(event);
|
|
63
|
+
}
|
|
64
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
65
|
+
};
|
|
50
66
|
const resourceUrl = (0, ThemeContext_1.useResourceUrl)(url);
|
|
51
67
|
const isSvgIcon = (_a = resourceUrl === null || resourceUrl === void 0 ? void 0 : resourceUrl.toLowerCase()) === null || _a === void 0 ? void 0 : _a.endsWith(".svg");
|
|
52
68
|
const customSvgIconRenderer = (0, IconRegistryContext_1.useCustomSvgIconRenderer)(resourceUrl);
|
|
53
69
|
if (resourceUrl && isSvgIcon) {
|
|
54
|
-
const renderedIcon = customSvgIconRenderer === null || customSvgIconRenderer === void 0 ? void 0 : customSvgIconRenderer(Object.assign({ style,
|
|
70
|
+
const renderedIcon = customSvgIconRenderer === null || customSvgIconRenderer === void 0 ? void 0 : customSvgIconRenderer(Object.assign({ style,
|
|
71
|
+
className,
|
|
72
|
+
onClick, onKeyDown: handleKeyDown, tabIndex: onClick ? (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0) : tabIndex }, rest));
|
|
55
73
|
if (!renderedIcon) {
|
|
56
74
|
//to prevent layout shift
|
|
57
|
-
return ((0, jsx_runtime_1.jsx)("span", Object.assign({}, rest, { ref: ref, style: style, className: className })));
|
|
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 })));
|
|
58
76
|
}
|
|
59
77
|
return renderedIcon;
|
|
60
78
|
}
|
|
61
|
-
return ((0, jsx_runtime_1.jsx)("img", Object.assign({ ref: ref, src: resourceUrl, style: Object.assign({ width, height }, style), alt: name }, rest)));
|
|
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)));
|
|
62
80
|
});
|
|
63
81
|
function useCustomIconUrl(iconName) {
|
|
64
82
|
const { getResourceUrl } = (0, ThemeContext_1.useTheme)();
|
|
@@ -19,6 +19,14 @@ exports.ModalDialogMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
19
19
|
"ideal for forms, confirmations, detailed views, or any content that requires " +
|
|
20
20
|
"focused user attention. Dialogs are programmatically opened using the `open()` " +
|
|
21
21
|
"method and can receive parameters for dynamic content.",
|
|
22
|
+
parts: {
|
|
23
|
+
content: {
|
|
24
|
+
description: "The main content area of the modal dialog.",
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
description: "The title area of the modal dialog.",
|
|
28
|
+
}
|
|
29
|
+
},
|
|
22
30
|
props: {
|
|
23
31
|
fullScreen: {
|
|
24
32
|
description: `Toggles whether the dialog encompasses the whole UI (\`true\`) or not and has a minimum ` +
|
|
@@ -68,6 +68,8 @@ const misc_1 = require("../../components-core/utils/misc");
|
|
|
68
68
|
const IconNative_1 = require("../Icon/IconNative");
|
|
69
69
|
const ButtonNative_1 = require("../Button/ButtonNative");
|
|
70
70
|
const ModalVisibilityContext_1 = require("./ModalVisibilityContext");
|
|
71
|
+
const PART_TITLE = "title";
|
|
72
|
+
const PART_CONTENT = "content";
|
|
71
73
|
// Default props for ModalDialog component
|
|
72
74
|
exports.defaultProps = {
|
|
73
75
|
fullScreen: false,
|
|
@@ -128,7 +130,7 @@ function useModalOpenState(isInitiallyOpen = true, onOpen, onClose) {
|
|
|
128
130
|
return modalStateContext || modalLocalOpenState;
|
|
129
131
|
}
|
|
130
132
|
exports.ModalDialog = react_1.default.forwardRef((_a, ref) => {
|
|
131
|
-
var { children, style, isInitiallyOpen, fullScreen = exports.defaultProps.fullScreen, title, closeButtonVisible = exports.defaultProps.closeButtonVisible, onOpen, onClose } = _a, rest = __rest(_a, ["children", "style", "isInitiallyOpen", "fullScreen", "title", "closeButtonVisible", "onOpen", "onClose"]);
|
|
133
|
+
var { children, style, isInitiallyOpen, fullScreen = exports.defaultProps.fullScreen, title, closeButtonVisible = exports.defaultProps.closeButtonVisible, className, onOpen, onClose } = _a, rest = __rest(_a, ["children", "style", "isInitiallyOpen", "fullScreen", "title", "closeButtonVisible", "className", "onOpen", "onClose"]);
|
|
132
134
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
133
135
|
// NOTE: at this point, we can't use useAppContext here,
|
|
134
136
|
// since the ModalDialog context provider (via ConfirmationModalContextProvider) is mounted outside of the AppContext,
|
|
@@ -178,13 +180,13 @@ exports.ModalDialog = react_1.default.forwardRef((_a, ref) => {
|
|
|
178
180
|
if (!root) {
|
|
179
181
|
return null;
|
|
180
182
|
}
|
|
181
|
-
const Content = ((0, jsx_runtime_1.jsxs)(Dialog.Content, Object.assign({}, rest, { className: (0, classnames_1.default)(ModalDialog_module_scss_1.default.content), onPointerDownOutside: (event) => {
|
|
183
|
+
const Content = ((0, jsx_runtime_1.jsxs)(Dialog.Content, Object.assign({}, rest, { "data-part-id": PART_CONTENT, className: (0, classnames_1.default)(ModalDialog_module_scss_1.default.content, className), onPointerDownOutside: (event) => {
|
|
182
184
|
if (event.target instanceof Element &&
|
|
183
185
|
event.target.closest("._debug-inspect-button") !== null) {
|
|
184
186
|
//we prevent the auto modal close on clicking the inspect button
|
|
185
187
|
event.preventDefault();
|
|
186
188
|
}
|
|
187
|
-
}, ref: composedRef, style: Object.assign(Object.assign({}, style), { gap: undefined }), children: [!!title && ((0, jsx_runtime_1.jsx)(Dialog.Title, { style: { marginTop: 0 }, children: (0, jsx_runtime_1.jsx)("header", { id: "dialogTitle", className: ModalDialog_module_scss_1.default.dialogTitle, children: title }) })), (0, jsx_runtime_1.jsx)("div", { className: ModalDialog_module_scss_1.default.innerContent, style: { gap: style === null || style === void 0 ? void 0 : style.gap }, children: (0, jsx_runtime_1.jsx)(ModalVisibilityContext_1.ModalVisibilityContext.Provider, { value: modalVisibilityContextValue, children: children }) }), closeButtonVisible && ((0, jsx_runtime_1.jsx)(Dialog.Close, { asChild: true, children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", className: ModalDialog_module_scss_1.default.closeButton, "aria-label": "Close", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "close", size: "sm" }), orientation: "vertical" }) }))] })));
|
|
189
|
+
}, ref: composedRef, style: Object.assign(Object.assign({}, style), { gap: undefined }), children: [!!title && ((0, jsx_runtime_1.jsx)(Dialog.Title, { style: { marginTop: 0 }, children: (0, jsx_runtime_1.jsx)("header", { id: "dialogTitle", className: ModalDialog_module_scss_1.default.dialogTitle, "data-part-id": PART_TITLE, children: title }) })), (0, jsx_runtime_1.jsx)("div", { className: ModalDialog_module_scss_1.default.innerContent, style: { gap: style === null || style === void 0 ? void 0 : style.gap }, children: (0, jsx_runtime_1.jsx)(ModalVisibilityContext_1.ModalVisibilityContext.Provider, { value: modalVisibilityContextValue, children: children }) }), closeButtonVisible && ((0, jsx_runtime_1.jsx)(Dialog.Close, { asChild: true, children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", className: ModalDialog_module_scss_1.default.closeButton, "aria-label": "Close", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "close", size: "sm" }), orientation: "vertical" }) }))] })));
|
|
188
190
|
return ((0, jsx_runtime_1.jsx)(Dialog.Root, { open: isOpen, onOpenChange: (open) => (open ? doOpen() : doClose()), children: (0, jsx_runtime_1.jsxs)(Dialog.Portal, { container: root, children: [isDialogRootInShadowDom && (
|
|
189
191
|
/*
|
|
190
192
|
In the Shadow DOM we can omit the Dialog.Overlay,
|