xmlui 0.10.14 → 0.10.15
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-779mp2Bm.mjs → index-axjeT2uJ.mjs} +719 -380
- package/dist/lib/{initMock-CAXdczCj.mjs → initMock-BoTWMs19.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-D90qqMGc.mjs → metadata-utils-CtY0QcvH.mjs} +2 -1
- package/dist/lib/{server-common-lmBDLpUh.mjs → server-common-Cine5nRR.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +83 -5
- package/dist/lib/xmlui.mjs +72 -37
- package/dist/metadata/{collectedComponentMetadata-7DFXlw-J.mjs → collectedComponentMetadata-CQywuPDB.mjs} +671 -399
- package/dist/metadata/{initMock-AFWEftc6.mjs → initMock-Bi5kF5Af.mjs} +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +2 -3
- package/dist/scripts/src/components/AppState/AppState.js +32 -2
- package/dist/scripts/src/components/AppState/AppStateNative.js +27 -3
- package/dist/scripts/src/components/Button/Button.js +5 -1
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +41 -2
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +7 -9
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +182 -123
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +14 -6
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +15 -9
- package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +3 -1
- package/dist/scripts/src/components/Slider/SliderNative.js +2 -2
- package/dist/scripts/src/components/Table/Table.js +7 -1
- package/dist/scripts/src/components/Table/TableNative.js +4 -1
- package/dist/scripts/src/components/Table/useRowSelection.js +215 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +1 -5
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +368 -324
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +10 -15
- package/dist/scripts/src/components/Theme/ThemeNative.js +2 -6
- package/dist/scripts/src/components/TimeInput/TimeInput.js +1 -5
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +2 -9
- package/dist/scripts/src/components-core/ApiBoundComponent.js +38 -24
- package/dist/scripts/src/components-core/RestApiProxy.js +0 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +54 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +80 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +1 -0
- package/dist/scripts/src/components-core/parts.js +4 -1
- package/dist/scripts/src/components-core/rendering/AppRoot.js +2 -1
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +31 -46
- package/dist/scripts/src/components-core/rendering/nodeUtils.js +6 -0
- package/dist/scripts/src/components-core/theming/layout-resolver.js +2 -0
- package/dist/scripts/src/index.js +38 -1
- package/dist/scripts/src/testing/ComponentDrivers.js +1 -29
- package/dist/scripts/src/testing/drivers/NumberBoxDriver.js +44 -0
- package/dist/scripts/src/testing/drivers/SliderDriver.js +20 -0
- package/dist/scripts/src/testing/drivers/TextBoxDriver.js +20 -0
- package/dist/scripts/src/testing/fixtures.js +35 -9
- package/dist/standalone/xmlui-standalone.es.d.ts +154 -9
- package/dist/standalone/xmlui-standalone.umd.js +35 -35
- package/package.json +2 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.15",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@radix-ui/react-accordion": "^1.2.0",
|
|
35
35
|
"@radix-ui/react-alert-dialog": "^1.1.2",
|
|
36
36
|
"@radix-ui/react-dialog": "1.0.5",
|
|
37
|
-
"@radix-ui/react-dropdown-menu": "2.
|
|
37
|
+
"@radix-ui/react-dropdown-menu": "2.1.16",
|
|
38
38
|
"@radix-ui/react-focus-scope": "1.0.4",
|
|
39
39
|
"@radix-ui/react-hover-card": "1.0.7",
|
|
40
40
|
"@radix-ui/react-popover": "^1.1.2",
|
|
@@ -131,7 +131,6 @@
|
|
|
131
131
|
"@types/react-datepicker": "4.19.5",
|
|
132
132
|
"@types/react-dom": "18.2.8",
|
|
133
133
|
"@types/react-measure": "^2.0.8",
|
|
134
|
-
"@types/react-pdf": "5.7.2",
|
|
135
134
|
"@types/react-window": "1.8.8",
|
|
136
135
|
"@types/yargs": "17.0.31",
|
|
137
136
|
"@typescript-eslint/eslint-plugin": "8.15.0",
|
|
@@ -12,6 +12,10 @@ exports.AppStateMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
12
12
|
"across your entire application. Unlike component variables that are scoped " +
|
|
13
13
|
"locally, AppState allows any component to access and update shared state " +
|
|
14
14
|
"without prop drilling.",
|
|
15
|
+
events: {
|
|
16
|
+
didUpdate: (0, metadata_helpers_1.d)("This event is fired when the AppState value is updated. The event provides " +
|
|
17
|
+
"the new state value as its parameter."),
|
|
18
|
+
},
|
|
15
19
|
props: {
|
|
16
20
|
bucket: {
|
|
17
21
|
description: `This property is the identifier of the bucket to which the \`${COMP}\` instance is bound. ` +
|
|
@@ -36,9 +40,35 @@ exports.AppStateMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
36
40
|
newState: "An object that specifies the new state value.",
|
|
37
41
|
},
|
|
38
42
|
},
|
|
43
|
+
appendToList: {
|
|
44
|
+
signature: "appendToList(key: string, id: any)",
|
|
45
|
+
description: "This method appends an item to an array in the application state object bound to the" +
|
|
46
|
+
" `AppState` instance.",
|
|
47
|
+
parameters: {
|
|
48
|
+
key: "The key of the array in the state object.",
|
|
49
|
+
id: "The item to append to the array.",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
removeFromList: {
|
|
53
|
+
signature: "removeFromList(key: string, id: any)",
|
|
54
|
+
description: "This method removes an item from an array in the application state object bound to the" +
|
|
55
|
+
" `AppState` instance.",
|
|
56
|
+
parameters: {
|
|
57
|
+
key: "The key of the array in the state object.",
|
|
58
|
+
id: "The item to remove from the array.",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
listIncludes: {
|
|
62
|
+
signature: "listIncludes(key: string, id: any)",
|
|
63
|
+
description: "This method checks if an array in the application state object contains a specific item.",
|
|
64
|
+
parameters: {
|
|
65
|
+
key: "The key of the array in the state object.",
|
|
66
|
+
id: "The item to check for in the array.",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
39
69
|
},
|
|
40
70
|
nonVisual: true,
|
|
41
71
|
});
|
|
42
|
-
exports.appStateComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppStateMd, ({ node, extractValue, updateState, registerComponentApi }) => {
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(AppStateNative_1.AppState, { bucket: extractValue(node.props.bucket), initialValue: extractValue(node.props.initialValue), updateState: updateState, registerComponentApi: registerComponentApi }));
|
|
72
|
+
exports.appStateComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppStateMd, ({ node, extractValue, updateState, registerComponentApi, lookupEventHandler }) => {
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(AppStateNative_1.AppState, { bucket: extractValue(node.props.bucket), initialValue: extractValue(node.props.initialValue), updateState: updateState, registerComponentApi: registerComponentApi, onDidUpdate: lookupEventHandler("didUpdate") }));
|
|
44
74
|
});
|
|
@@ -7,7 +7,7 @@ const AppStateContext_1 = require("../../components/App/AppStateContext");
|
|
|
7
7
|
exports.defaultProps = {
|
|
8
8
|
bucket: "default",
|
|
9
9
|
};
|
|
10
|
-
function AppState({ bucket = exports.defaultProps.bucket, updateState, initialValue, registerComponentApi, }) {
|
|
10
|
+
function AppState({ bucket = exports.defaultProps.bucket, updateState, initialValue, registerComponentApi, onDidUpdate, }) {
|
|
11
11
|
const registerAppState = (0, AppStateContext_1.useAppStateContextPart)((value) => value.registerAppState);
|
|
12
12
|
const update = (0, AppStateContext_1.useAppStateContextPart)((value) => value.update);
|
|
13
13
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
@@ -18,11 +18,35 @@ function AppState({ bucket = exports.defaultProps.bucket, updateState, initialVa
|
|
|
18
18
|
const value = (0, AppStateContext_1.useAppStateContextPart)((value) => value.appState[bucket]);
|
|
19
19
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
20
20
|
updateState({ value });
|
|
21
|
-
|
|
21
|
+
// Fire the didUpdate event when value changes
|
|
22
|
+
if (onDidUpdate) {
|
|
23
|
+
onDidUpdate({ bucket, value, previousValue: undefined }); // Note: previousValue tracking could be added if needed
|
|
24
|
+
}
|
|
25
|
+
}, [updateState, value, onDidUpdate, bucket]);
|
|
22
26
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
23
27
|
registerComponentApi({
|
|
24
28
|
update: (patch) => update(bucket, patch),
|
|
29
|
+
appendToList: (key, id) => {
|
|
30
|
+
const currentState = value || {};
|
|
31
|
+
const currentArray = currentState[key] || [];
|
|
32
|
+
// Only add if the id doesn't already exist in the array
|
|
33
|
+
if (!currentArray.includes(id)) {
|
|
34
|
+
const newArray = [...currentArray, id];
|
|
35
|
+
update(bucket, { [key]: newArray });
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
removeFromList: (key, id) => {
|
|
39
|
+
const currentState = value || {};
|
|
40
|
+
const currentArray = currentState[key] || [];
|
|
41
|
+
const newArray = currentArray.filter((item) => item !== id);
|
|
42
|
+
update(bucket, { [key]: newArray });
|
|
43
|
+
},
|
|
44
|
+
listIncludes: (key, id) => {
|
|
45
|
+
const currentState = value || {};
|
|
46
|
+
const currentArray = currentState[key] || [];
|
|
47
|
+
return currentArray.includes(id);
|
|
48
|
+
},
|
|
25
49
|
});
|
|
26
|
-
}, [bucket, registerComponentApi, update]);
|
|
50
|
+
}, [bucket, registerComponentApi, update, value]);
|
|
27
51
|
return null;
|
|
28
52
|
}
|
|
@@ -12,6 +12,7 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
12
12
|
const metadata_helpers_1 = require("../../components/metadata-helpers");
|
|
13
13
|
const IconNative_1 = require("../Icon/IconNative");
|
|
14
14
|
const ButtonNative_1 = require("./ButtonNative");
|
|
15
|
+
const nodeUtils_1 = require("../../components-core/rendering/nodeUtils");
|
|
15
16
|
const COMP = "Button";
|
|
16
17
|
exports.ButtonMd = (0, metadata_helpers_1.createMetadata)({
|
|
17
18
|
status: "stable",
|
|
@@ -156,5 +157,8 @@ exports.ButtonMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
156
157
|
exports.buttonComponentRenderer = (0, renderers_1.createComponentRenderer)("Button", exports.ButtonMd, ({ node, extractValue, renderChild, lookupEventHandler, className }) => {
|
|
157
158
|
const iconName = extractValue.asString(node.props.icon);
|
|
158
159
|
const label = extractValue.asDisplayText(node.props.label);
|
|
159
|
-
|
|
160
|
+
const renderedChildren = (0, nodeUtils_1.hasRenderableChildren)(node.children)
|
|
161
|
+
? renderChild(node.children, { type: "Stack", orientation: "horizontal" })
|
|
162
|
+
: label;
|
|
163
|
+
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: extractValue.asOptionalString(node.props.type), variant: extractValue.asOptionalString(node.props.variant), themeColor: extractValue.asOptionalString(node.props.themeColor), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), size: extractValue.asOptionalString(node.props.size), icon: iconName && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName, "aria-hidden": true }), iconPosition: extractValue.asOptionalString(node.props.iconPosition), orientation: extractValue.asOptionalString(node.props.orientation), contentPosition: extractValue.asOptionalString(node.props.contentPosition), disabled: !extractValue.asOptionalBoolean(node.props.enabled, true), onClick: lookupEventHandler("click"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), className: className, contextualLabel: extractValue.asOptionalString(node.props.contextualLabel), children: renderedChildren }));
|
|
160
164
|
});
|
|
@@ -74,7 +74,8 @@ const renderActiveShape = (props) => {
|
|
|
74
74
|
const { cx, cy, innerRadius, outerRadius, startAngle, endAngle, fill } = props;
|
|
75
75
|
return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)(recharts_1.Sector, { cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius + 10, startAngle: startAngle, endAngle: endAngle, fill: fill }), (0, jsx_runtime_1.jsx)(recharts_1.Sector, { cx: cx, cy: cy, startAngle: startAngle, endAngle: endAngle, innerRadius: outerRadius + 6, outerRadius: outerRadius + 10, fill: fill })] }));
|
|
76
76
|
};
|
|
77
|
-
function PieChart({ data, dataKey, nameKey, style, className, showLabel = exports.defaultProps.showLabel, showLabelList = exports.defaultProps.showLabelList, labelListPosition = exports.defaultProps.labelListPosition, innerRadius = exports.defaultProps.innerRadius, children, outerRadius
|
|
77
|
+
function PieChart({ data, dataKey, nameKey, style, className, showLabel = exports.defaultProps.showLabel, showLabelList = exports.defaultProps.showLabelList, labelListPosition = exports.defaultProps.labelListPosition, innerRadius = exports.defaultProps.innerRadius, children, outerRadius, // no default; we'll compute when undefined or "auto"
|
|
78
|
+
showLegend = exports.defaultProps.showLegend, }) {
|
|
78
79
|
const { getThemeVar } = (0, ThemeContext_1.useTheme)();
|
|
79
80
|
const colorValues = (0, react_1.useMemo)(() => {
|
|
80
81
|
return [
|
|
@@ -122,7 +123,45 @@ function PieChart({ data, dataKey, nameKey, style, className, showLabel = export
|
|
|
122
123
|
return data.map((item, index) => (Object.assign(Object.assign({}, item), { fill: item.fill || colorValues[index % colorValues.length] })));
|
|
123
124
|
}, [colorValues, data]);
|
|
124
125
|
const chartContextValue = (0, ChartProvider_1.useChartContextValue)({ dataKey, nameKey });
|
|
125
|
-
|
|
126
|
+
// --- measurement for auto radius ---
|
|
127
|
+
const wrapperRef = (0, react_1.useRef)(null);
|
|
128
|
+
const [box, setBox] = (0, react_1.useState)({ width: 0, height: 0 });
|
|
129
|
+
(0, react_1.useEffect)(() => {
|
|
130
|
+
if (!wrapperRef.current || typeof window === "undefined" || !window.ResizeObserver)
|
|
131
|
+
return;
|
|
132
|
+
const ro = new window.ResizeObserver((entries) => {
|
|
133
|
+
var _a;
|
|
134
|
+
const cr = (_a = entries[0]) === null || _a === void 0 ? void 0 : _a.contentRect;
|
|
135
|
+
if (cr)
|
|
136
|
+
setBox({ width: cr.width, height: cr.height });
|
|
137
|
+
});
|
|
138
|
+
ro.observe(wrapperRef.current);
|
|
139
|
+
return () => ro.disconnect();
|
|
140
|
+
}, []);
|
|
141
|
+
// Sizing heuristics
|
|
142
|
+
const RING_PADDING = 8; // keep ring off the SVG edge
|
|
143
|
+
const LABEL_GUTTER_OUTSIDE = 16; // space for connectors/labels
|
|
144
|
+
const LABEL_GUTTER_INSIDE = 6; // small breathing room if labels inside/off
|
|
145
|
+
const MIN_RING_THICKNESS = 12; // maintain legibility on small canvases
|
|
146
|
+
// Are labels drawn outside the ring?
|
|
147
|
+
const labelsOutside = !!showLabel || (showLabelList && labelListPosition === "outside");
|
|
148
|
+
// Resolve outerRadius: explicit value wins; otherwise compute from measured box
|
|
149
|
+
const resolvedOuterRadius = (0, react_1.useMemo)(() => {
|
|
150
|
+
const wantsAuto = outerRadius === undefined ||
|
|
151
|
+
(typeof outerRadius === "string" && outerRadius.toLowerCase() === "auto");
|
|
152
|
+
if (!wantsAuto)
|
|
153
|
+
return outerRadius;
|
|
154
|
+
const base = Math.min(box.width, box.height) / 2;
|
|
155
|
+
const gutter = labelsOutside ? LABEL_GUTTER_OUTSIDE : LABEL_GUTTER_INSIDE;
|
|
156
|
+
const inner = Number(innerRadius) || 0;
|
|
157
|
+
const derived = Math.max(inner + MIN_RING_THICKNESS, base - gutter - RING_PADDING);
|
|
158
|
+
// Fallback before first measurement
|
|
159
|
+
if (!Number.isFinite(derived) || derived <= 0) {
|
|
160
|
+
return labelsOutside ? "72%" : "88%";
|
|
161
|
+
}
|
|
162
|
+
return derived;
|
|
163
|
+
}, [outerRadius, box.width, box.height, labelsOutside, innerRadius]);
|
|
164
|
+
return ((0, jsx_runtime_1.jsxs)(ChartProvider_1.default, { value: chartContextValue, children: [children, (0, jsx_runtime_1.jsx)("div", { ref: wrapperRef, className: (0, classnames_1.default)(PieChartNative_module_scss_1.default.wrapper, className), style: style, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", minWidth: 0, children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, { margin: { top: 8, right: 8, bottom: labelsOutside ? 16 : 8, left: 8 }, children: [(0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { content: (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, {}) }), (0, jsx_runtime_1.jsx)(recharts_1.Pie, { data: chartData, dataKey: dataKey, nameKey: nameKey, innerRadius: innerRadius, outerRadius: resolvedOuterRadius, paddingAngle: 1, activeShape: renderActiveShape, label: showLabel ? renderCustomizedLabel : false, labelLine: showLabel, children: chartContextValue.labelList
|
|
126
165
|
? chartContextValue.labelList
|
|
127
166
|
: showLabelList && ((0, jsx_runtime_1.jsx)(recharts_1.LabelList, { position: labelListPosition, dataKey: nameKey, className: PieChartNative_module_scss_1.default.labelList, stroke: "none", fill: "currentColor", fontSize: 12 })) }), chartContextValue.legend ? chartContextValue.legend : showLegend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, {})] }) }) })] }));
|
|
128
167
|
}
|
|
@@ -56,9 +56,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
56
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
57
57
|
};
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.MenuItem = exports.defaultMenuItemProps = exports.DropdownMenu = exports.defaultDropdownMenuProps = void 0;
|
|
60
|
-
exports.SubMenuItem = SubMenuItem;
|
|
61
|
-
exports.MenuSeparator = MenuSeparator;
|
|
59
|
+
exports.MenuSeparator = exports.SubMenuItem = exports.MenuItem = exports.defaultMenuItemProps = exports.DropdownMenu = exports.defaultDropdownMenuProps = void 0;
|
|
62
60
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
63
61
|
const react_1 = require("react");
|
|
64
62
|
const react_2 = require("react");
|
|
@@ -139,10 +137,10 @@ exports.MenuItem = (0, react_1.forwardRef)(function MenuItem({ children, onClick
|
|
|
139
137
|
}
|
|
140
138
|
}, ref: ref, children: [iconToStart && icon, (0, jsx_runtime_1.jsx)("div", { className: DropdownMenu_module_scss_1.default.wrapper, children: label !== null && label !== void 0 ? label : children }), !iconToStart && icon] }));
|
|
141
139
|
});
|
|
142
|
-
function SubMenuItem({ children, label, triggerTemplate }) {
|
|
140
|
+
exports.SubMenuItem = (0, react_1.forwardRef)(function SubMenuItem({ children, label, triggerTemplate }, ref) {
|
|
143
141
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
144
|
-
return ((0, jsx_runtime_1.jsxs)(ReactDropdownMenu.Sub, { children: [(0, jsx_runtime_1.jsx)(ReactDropdownMenu.SubTrigger, { className: DropdownMenu_module_scss_1.default.DropdownMenuSubTrigger, asChild: true, children: triggerTemplate ? triggerTemplate : (0, jsx_runtime_1.jsx)("div", { children: label }) }), (0, jsx_runtime_1.jsx)(ReactDropdownMenu.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(ReactDropdownMenu.SubContent, { className: DropdownMenu_module_scss_1.default.DropdownMenuSubContent, children: children }) })] }));
|
|
145
|
-
}
|
|
146
|
-
function MenuSeparator() {
|
|
147
|
-
return (0, jsx_runtime_1.jsx)(ReactDropdownMenu.Separator, { className: DropdownMenu_module_scss_1.default.DropdownMenuSeparator });
|
|
148
|
-
}
|
|
142
|
+
return ((0, jsx_runtime_1.jsxs)(ReactDropdownMenu.Sub, { children: [(0, jsx_runtime_1.jsx)(ReactDropdownMenu.SubTrigger, { className: DropdownMenu_module_scss_1.default.DropdownMenuSubTrigger, asChild: true, ref: ref, children: triggerTemplate ? triggerTemplate : (0, jsx_runtime_1.jsx)("div", { children: label }) }), (0, jsx_runtime_1.jsx)(ReactDropdownMenu.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(ReactDropdownMenu.SubContent, { className: DropdownMenu_module_scss_1.default.DropdownMenuSubContent, children: children }) })] }));
|
|
143
|
+
});
|
|
144
|
+
exports.MenuSeparator = (0, react_1.forwardRef)(function MenuSeparator(props, ref) {
|
|
145
|
+
return (0, jsx_runtime_1.jsx)(ReactDropdownMenu.Separator, Object.assign({ ref: ref, className: DropdownMenu_module_scss_1.default.DropdownMenuSeparator }, props));
|
|
146
|
+
});
|
|
@@ -27,7 +27,7 @@ exports.defaultProps = {
|
|
|
27
27
|
};
|
|
28
28
|
const numberRegex = /^[0-9]+$/;
|
|
29
29
|
exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel(_a, ref) {
|
|
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, onLabelClick } = _a, rest = __rest(_a, ["id", "labelPosition", "style", "className", "label", "labelBreak", "labelWidth", "enabled", "required", "children", "validationInProgress", "shrinkToLabel", "onFocus", "onBlur", "labelStyle", "validationResult", "isInputTemplateUsed", "onLabelClick"]);
|
|
30
|
+
var { id, testId, 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, onLabelClick } = _a, rest = __rest(_a, ["id", "testId", "labelPosition", "style", "className", "label", "labelBreak", "labelWidth", "enabled", "required", "children", "validationInProgress", "shrinkToLabel", "onFocus", "onBlur", "labelStyle", "validationResult", "isInputTemplateUsed", "onLabelClick"]);
|
|
31
31
|
// --- HACK: the "rest" may contain a "layoutContext" property that React doesn't recognize
|
|
32
32
|
// --- as a valid DOM attribute, which would issue a warning in React.
|
|
33
33
|
if (rest.layoutContext !== undefined) {
|
|
@@ -47,7 +47,7 @@ exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel(_a, ref)
|
|
|
47
47
|
// }),
|
|
48
48
|
// });
|
|
49
49
|
}
|
|
50
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { ref: ref, style: style, className: (0, classnames_1.default)(className, FormItem_module_scss_1.default.itemWithLabel), children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(FormItem_module_scss_1.default.container, {
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { "data-testid": testId, ref: ref, style: style, className: (0, classnames_1.default)(className, FormItem_module_scss_1.default.itemWithLabel), children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(FormItem_module_scss_1.default.container, {
|
|
51
51
|
[FormItem_module_scss_1.default.top]: labelPosition === "top",
|
|
52
52
|
[FormItem_module_scss_1.default.bottom]: labelPosition === "bottom",
|
|
53
53
|
[FormItem_module_scss_1.default.start]: labelPosition === "start",
|
|
@@ -57,5 +57,5 @@ exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel(_a, ref)
|
|
|
57
57
|
[FormItem_module_scss_1.default.required]: required,
|
|
58
58
|
[FormItem_module_scss_1.default.disabled]: !enabled,
|
|
59
59
|
[FormItem_module_scss_1.default.labelBreak]: labelBreak,
|
|
60
|
-
}), children: [label, " ", required && (0, jsx_runtime_1.jsx)("span", { className: FormItem_module_scss_1.default.requiredMark, children: "*" }), validationInProgress && ((0, jsx_runtime_1.jsx)(SpinnerNative_1.Spinner, { style: { height: "1em", width: "1em", marginLeft: "1em", alignSelf: "center" } }))] })), (0, jsx_runtime_1.jsx)(react_slot_1.Slot, { "data-part-id": parts_1.PART_LABELED_ITEM, id: !isInputTemplateUsed ? inputId : undefined, children: children })] }), validationResult] })));
|
|
60
|
+
}), children: [label, " ", required && (0, jsx_runtime_1.jsx)("span", { className: FormItem_module_scss_1.default.requiredMark, children: "*" }), validationInProgress && ((0, jsx_runtime_1.jsx)(SpinnerNative_1.Spinner, { style: { height: "1em", width: "1em", marginLeft: "1em", alignSelf: "center" } }))] })), (0, jsx_runtime_1.jsx)(react_slot_1.Slot, { "data-part-id": parts_1.PART_LABELED_ITEM, id: !isInputTemplateUsed ? inputId : undefined, "data-testid": undefined, children: children })] }), validationResult] })));
|
|
61
61
|
});
|
|
@@ -9,145 +9,204 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
12
13
|
const fixtures_1 = require("../../testing/fixtures");
|
|
13
14
|
fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
|
|
14
|
-
(0, fixtures_1.test)("
|
|
15
|
+
(0, fixtures_1.test)("displays menuitems after click", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
15
16
|
yield initTestBed(`
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
<NavGroup label="Pages">
|
|
18
|
+
<NavLink label="Page 1" />
|
|
19
|
+
<NavGroup label="subpages">
|
|
20
|
+
<NavLink label="inner page 2" />
|
|
21
|
+
<NavLink label="inner page 3" />
|
|
22
|
+
</NavGroup>
|
|
23
|
+
<NavLink label="Page 4" />
|
|
24
|
+
</NavGroup>
|
|
25
|
+
`);
|
|
26
|
+
yield page.getByRole("button", { name: "Pages", exact: true }).click();
|
|
27
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem")).toHaveCount(3);
|
|
28
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 1" })).toBeVisible();
|
|
29
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "subpages" })).toBeVisible();
|
|
30
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 4" })).toBeVisible();
|
|
31
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "inner page 2" })).not.toBeVisible();
|
|
32
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "inner page 3" })).not.toBeVisible();
|
|
19
33
|
}));
|
|
20
|
-
(0, fixtures_1.test)("
|
|
34
|
+
(0, fixtures_1.test)("disabled navgroup can't open", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
21
35
|
yield initTestBed(`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
<NavGroup label="Pages" enabled="false">
|
|
37
|
+
<NavLink label="Page 1" />
|
|
38
|
+
<NavGroup label="subpages">
|
|
39
|
+
<NavLink label="inner page 2" />
|
|
40
|
+
<NavLink label="inner page 3" />
|
|
41
|
+
</NavGroup>
|
|
42
|
+
<NavLink label="Page 4" />
|
|
43
|
+
</NavGroup>
|
|
44
|
+
`);
|
|
45
|
+
const pagesBtn = page.getByRole("button", { name: "Pages", exact: true });
|
|
46
|
+
yield (0, fixtures_1.expect)(pagesBtn).toBeDisabled();
|
|
47
|
+
yield pagesBtn.click({ force: true });
|
|
48
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 1" })).not.toBeVisible();
|
|
49
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "inner page 2" })).not.toBeVisible();
|
|
50
|
+
}));
|
|
51
|
+
(0, fixtures_1.test)("component trigger has correct aria labels", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
52
|
+
yield initTestBed(`<NavGroup testId="navGroup" label="NavGroup"/>`);
|
|
53
|
+
const button = page.getByTestId("navGroup");
|
|
54
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
55
|
+
yield (0, fixtures_1.expect)(button).toHaveAttribute("aria-expanded", "false");
|
|
56
|
+
yield button.click();
|
|
57
|
+
yield (0, fixtures_1.expect)(button).toHaveAttribute("aria-expanded", "true");
|
|
58
|
+
}));
|
|
59
|
+
(0, fixtures_1.test)("expanded in vertical layout to show link of current page", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
60
|
+
yield initTestBed(`
|
|
61
|
+
<App layout="vertical">
|
|
62
|
+
<NavPanel>
|
|
63
|
+
<NavGroup label="Current-upper">
|
|
64
|
+
<NavGroup label="Current">
|
|
65
|
+
<NavLink label="link-to-current-page" to="/" />
|
|
66
|
+
</NavGroup>
|
|
67
|
+
</NavGroup>
|
|
68
|
+
</NavPanel>
|
|
69
|
+
</App>`);
|
|
70
|
+
yield (0, fixtures_1.expect)(page.getByText("link-to-current-page")).toBeVisible();
|
|
26
71
|
}));
|
|
27
72
|
});
|
|
28
|
-
(0, fixtures_1.test)("
|
|
29
|
-
yield initTestBed(`
|
|
30
|
-
<NavGroup testId="navGroup" label="NavGroup">
|
|
31
|
-
</NavGroup>`);
|
|
32
|
-
const button = page.getByTestId("navGroup");
|
|
33
|
-
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
34
|
-
yield (0, fixtures_1.expect)(button).toHaveAttribute("aria-expanded", "false");
|
|
35
|
-
yield button.click();
|
|
36
|
-
yield (0, fixtures_1.expect)(button).toHaveAttribute("aria-expanded", "true");
|
|
37
|
-
}));
|
|
38
|
-
// TODO: depending on layout, different component lists are rendered - need to test for all of them
|
|
39
|
-
/* test("component list content has correct aria labels", async ({ initTestBed, page }) => {
|
|
40
|
-
await initTestBed(`
|
|
41
|
-
<NavGroup testId="navGroup" label="NavGroup">
|
|
42
|
-
<NavLink label="link" to="/asd" />
|
|
43
|
-
</NavGroup>`);
|
|
44
|
-
const button = page.getByTestId("navGroup");
|
|
45
|
-
const content = page.getByRole('menuitem', { name: 'link' });
|
|
46
|
-
|
|
47
|
-
await button.click();
|
|
48
|
-
|
|
49
|
-
await expect(content).toBeVisible();
|
|
50
|
-
await expect(content).toHaveAttribute("aria-hidden", "false");
|
|
51
|
-
}); */
|
|
52
|
-
(0, fixtures_1.test)("expanded in NavPanel + vertical app layout if current page is same as link in group", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
73
|
+
(0, fixtures_1.test)("nested disabled navgroup can't open", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
53
74
|
yield initTestBed(`
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
75
|
+
<NavGroup label="Pages" >
|
|
76
|
+
<NavLink label="Page 1" />
|
|
77
|
+
<NavGroup label="subpages" enabled="false">
|
|
78
|
+
<NavLink label="inner page 2" />
|
|
79
|
+
<NavLink label="inner page 3" />
|
|
80
|
+
</NavGroup>
|
|
81
|
+
<NavLink label="Page 4" />
|
|
58
82
|
</NavGroup>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
yield
|
|
62
|
-
yield (0, fixtures_1.expect)(page.
|
|
83
|
+
`);
|
|
84
|
+
const pagesBtn = page.getByRole("button", { name: "Pages", exact: true });
|
|
85
|
+
yield pagesBtn.click();
|
|
86
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 1" })).toBeVisible();
|
|
87
|
+
const subpagesBtn = page.getByRole("menuitem", { name: "subpages" });
|
|
88
|
+
yield (0, fixtures_1.expect)(subpagesBtn).toBeDisabled();
|
|
89
|
+
yield subpagesBtn.click({ force: true });
|
|
90
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "inner page 2" })).not.toBeVisible();
|
|
63
91
|
}));
|
|
64
|
-
(0, fixtures_1.test)("
|
|
92
|
+
(0, fixtures_1.test)("initiallyExpanded works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
65
93
|
yield initTestBed(`
|
|
66
|
-
<
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</NavPanel>
|
|
72
|
-
</App>`);
|
|
73
|
-
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
74
|
-
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
75
|
-
}));
|
|
76
|
-
(0, fixtures_1.test)("expanded in NavPanel + vertical app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
77
|
-
yield initTestBed(`
|
|
78
|
-
<App layout="vertical">
|
|
79
|
-
<NavPanel>
|
|
80
|
-
<NavGroup testId="navGroup" label="NavGroup">
|
|
81
|
-
<NavLink label="link" to="/" />
|
|
82
|
-
</NavGroup>
|
|
83
|
-
</NavPanel>
|
|
84
|
-
</App>`);
|
|
85
|
-
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
86
|
-
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).toBeVisible();
|
|
87
|
-
}));
|
|
88
|
-
(0, fixtures_1.test)("collapsed in NavPanel + horizontal app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
89
|
-
yield initTestBed(`
|
|
90
|
-
<App layout="horizontal">
|
|
91
|
-
<NavPanel>
|
|
92
|
-
<NavGroup testId="navGroup" label="NavGroup">
|
|
93
|
-
<NavLink label="link" to="/" />
|
|
94
|
-
</NavGroup>
|
|
95
|
-
</NavPanel>
|
|
96
|
-
</App>`);
|
|
97
|
-
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
98
|
-
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
99
|
-
}));
|
|
100
|
-
(0, fixtures_1.test)("click expands group in NavPanel + horizontal app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
101
|
-
yield initTestBed(`
|
|
102
|
-
<App layout="horizontal">
|
|
103
|
-
<NavPanel>
|
|
104
|
-
<NavGroup testId="navGroup" label="NavGroup">
|
|
105
|
-
<NavLink label="link" to="/" />
|
|
106
|
-
</NavGroup>
|
|
107
|
-
</NavPanel>
|
|
108
|
-
</App>`);
|
|
109
|
-
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
110
|
-
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "link" })).not.toBeVisible();
|
|
111
|
-
yield page.getByTestId("navGroup").click();
|
|
112
|
-
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "link" })).toBeVisible();
|
|
113
|
-
}));
|
|
114
|
-
(0, fixtures_1.test)("collapsed in vertical app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
115
|
-
yield initTestBed(`
|
|
116
|
-
<App layout="vertical">
|
|
117
|
-
<NavGroup testId="navGroup" label="NavGroup">
|
|
118
|
-
<NavLink label="link" to="/asd" />
|
|
94
|
+
<NavGroup label="Pages" initiallyExpanded="true">
|
|
95
|
+
<NavLink label="Page 1" />
|
|
96
|
+
<NavGroup label="subpages">
|
|
97
|
+
<NavLink label="inner page 2" />
|
|
98
|
+
<NavLink label="inner page 3" />
|
|
119
99
|
</NavGroup>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
<NavLink label="Page 4" />
|
|
101
|
+
</NavGroup>
|
|
102
|
+
`);
|
|
103
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 1" })).toBeVisible();
|
|
104
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "inner page 2" })).not.toBeVisible();
|
|
123
105
|
}));
|
|
124
|
-
(
|
|
106
|
+
fixtures_1.test.fixme("nested initiallyExpanded works", component_test_helpers_1.SKIP_REASON.XMLUI_BUG("see https://github.com/radix-ui/primitives/issues/2551#issuecomment-2457236467 . The suggested workaround does not work for us, if you were to do it, you would see the hover effect not working for the inner most menu items."), (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
125
107
|
yield initTestBed(`
|
|
126
|
-
<
|
|
127
|
-
<
|
|
128
|
-
|
|
108
|
+
<NavGroup label="Pages" initiallyExpanded="true">
|
|
109
|
+
<NavLink label="Page 1" />
|
|
110
|
+
<NavGroup label="subpages" initiallyExpanded="true">
|
|
111
|
+
<NavLink label="inner page 2" />
|
|
112
|
+
<NavLink label="inner page 3" />
|
|
129
113
|
</NavGroup>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
114
|
+
<NavLink label="Page 4" />
|
|
115
|
+
</NavGroup>
|
|
116
|
+
`);
|
|
117
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 1" })).toBeVisible();
|
|
118
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "inner page 2" })).toBeVisible();
|
|
133
119
|
}));
|
|
134
|
-
(0, fixtures_1.test)("
|
|
120
|
+
(0, fixtures_1.test)("expands even without label", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
135
121
|
yield initTestBed(`
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
|
|
122
|
+
<NavGroup >
|
|
123
|
+
<NavLink label="Page 1" />
|
|
124
|
+
<NavGroup label="subpages">
|
|
125
|
+
<NavLink label="inner page 2" />
|
|
126
|
+
<NavLink label="inner page 3" />
|
|
139
127
|
</NavGroup>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}));
|
|
144
|
-
|
|
145
|
-
yield
|
|
146
|
-
<App layout="horizontal">
|
|
147
|
-
<NavGroup testId="navGroup" label="NavGroup">
|
|
148
|
-
<NavLink label="link" to="/" />
|
|
149
|
-
</NavGroup>
|
|
150
|
-
</App>`);
|
|
151
|
-
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
152
|
-
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
128
|
+
<NavLink label="Page 4" />
|
|
129
|
+
</NavGroup>
|
|
130
|
+
`);
|
|
131
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 1" })).not.toBeVisible();
|
|
132
|
+
yield page.getByRole("button").click();
|
|
133
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Page 1" })).toBeVisible();
|
|
153
134
|
}));
|
|
135
|
+
fixtures_1.test.describe("icon props", () => {
|
|
136
|
+
(0, fixtures_1.test)("icon appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
137
|
+
const { testIcons } = yield initTestBed(`<App layout="vertical">
|
|
138
|
+
<NavPanel>
|
|
139
|
+
<NavGroup icon="bell" label="NavGroup">
|
|
140
|
+
<NavLink label="link" to="/" />
|
|
141
|
+
</NavGroup>
|
|
142
|
+
</NavPanel>
|
|
143
|
+
</App>`);
|
|
144
|
+
yield (0, fixtures_1.expect)(testIcons.bellIcon).toBeVisible();
|
|
145
|
+
}));
|
|
146
|
+
(0, fixtures_1.test)("iconHorizontal shows in horizontal layout submenu", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
147
|
+
const { testIcons } = yield initTestBed(`
|
|
148
|
+
<App layout="horizontal">
|
|
149
|
+
<NavPanel>
|
|
150
|
+
<NavGroup label="Send To">
|
|
151
|
+
<NavGroup icon="users" label="Team"
|
|
152
|
+
iconHorizontalExpanded="bell" iconHorizontalCollapsed="eye">
|
|
153
|
+
<NavLink label="Jane" />
|
|
154
|
+
</NavGroup>
|
|
155
|
+
</NavGroup>
|
|
156
|
+
</NavPanel>
|
|
157
|
+
</App>
|
|
158
|
+
`);
|
|
159
|
+
const bell = testIcons.bellIcon;
|
|
160
|
+
const eye = testIcons.eyeIcon;
|
|
161
|
+
yield (0, fixtures_1.expect)(bell).not.toBeVisible();
|
|
162
|
+
yield (0, fixtures_1.expect)(eye).not.toBeVisible();
|
|
163
|
+
yield page.getByRole("button", { name: "Send to" }).click();
|
|
164
|
+
yield (0, fixtures_1.expect)(bell).not.toBeVisible();
|
|
165
|
+
yield (0, fixtures_1.expect)(eye).toBeVisible();
|
|
166
|
+
yield page.getByRole("menuitem", { name: "Team" }).hover();
|
|
167
|
+
yield (0, fixtures_1.expect)(bell).toBeVisible();
|
|
168
|
+
yield (0, fixtures_1.expect)(eye).not.toBeVisible();
|
|
169
|
+
}));
|
|
170
|
+
(0, fixtures_1.test)("iconVertical shows in horizontal layout top lvl navgroup", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
171
|
+
const { testIcons } = yield initTestBed(`
|
|
172
|
+
<App layout="horizontal">
|
|
173
|
+
<NavPanel>
|
|
174
|
+
<NavGroup icon="users" label="Team"
|
|
175
|
+
iconVerticalExpanded="bell" iconVerticalCollapsed="eye">
|
|
176
|
+
<NavLink label="Jane" />
|
|
177
|
+
</NavGroup>
|
|
178
|
+
</NavPanel>
|
|
179
|
+
</App>
|
|
180
|
+
`);
|
|
181
|
+
const bell = testIcons.bellIcon;
|
|
182
|
+
const eye = testIcons.eyeIcon;
|
|
183
|
+
yield (0, fixtures_1.expect)(bell).not.toBeVisible();
|
|
184
|
+
yield (0, fixtures_1.expect)(eye).toBeVisible();
|
|
185
|
+
yield page.getByText("Team").click();
|
|
186
|
+
yield (0, fixtures_1.expect)(bell).toBeVisible();
|
|
187
|
+
yield (0, fixtures_1.expect)(eye).not.toBeVisible();
|
|
188
|
+
}));
|
|
189
|
+
(0, fixtures_1.test)("iconVertical shows in vertical layout submenu", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
190
|
+
const { testIcons } = yield initTestBed(`
|
|
191
|
+
<App layout="vertical">
|
|
192
|
+
<NavPanel>
|
|
193
|
+
<NavGroup label="Send To">
|
|
194
|
+
<NavGroup icon="users" label="Team"
|
|
195
|
+
iconVerticalExpanded="bell" iconVerticalCollapsed="eye">
|
|
196
|
+
<NavLink label="Jane" />
|
|
197
|
+
</NavGroup>
|
|
198
|
+
</NavGroup>
|
|
199
|
+
</NavPanel>
|
|
200
|
+
</App>
|
|
201
|
+
`);
|
|
202
|
+
const bell = testIcons.bellIcon;
|
|
203
|
+
const eye = testIcons.eyeIcon;
|
|
204
|
+
yield (0, fixtures_1.expect)(bell).not.toBeVisible();
|
|
205
|
+
yield page.getByText("Send to").click();
|
|
206
|
+
yield (0, fixtures_1.expect)(bell).not.toBeVisible();
|
|
207
|
+
yield (0, fixtures_1.expect)(eye).toBeVisible();
|
|
208
|
+
yield page.getByText("Team").click();
|
|
209
|
+
yield (0, fixtures_1.expect)(bell).toBeVisible();
|
|
210
|
+
yield (0, fixtures_1.expect)(eye).not.toBeVisible();
|
|
211
|
+
}));
|
|
212
|
+
});
|