@widergy/energy-ui 3.121.3 → 3.122.0
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/CHANGELOG.md +7 -0
- package/dist/components/UTAvatar/constants.js +44 -1
- package/dist/components/UTAvatar/index.js +31 -8
- package/dist/components/UTAvatar/stories/UTAvatar.mdx +13 -0
- package/dist/components/UTAvatar/stories/UTAvatar.stories.js +38 -0
- package/dist/components/UTAvatar/stories/UTAvatarColors.stories.js +91 -0
- package/dist/components/UTAvatar/stories/UTAvatarShapes.stories.js +51 -0
- package/dist/components/UTAvatar/stories/UTAvatarSizes.stories.js +106 -0
- package/dist/components/UTAvatar/stories/UTAvatarTypes.stories.js +51 -0
- package/dist/components/UTAvatar/stories/storiesConstants.js +155 -0
- package/dist/components/UTAvatar/styles.module.scss +24 -0
- package/dist/components/UTBodyPlaceholder/UTBodyPlaceholder.mdx +11 -0
- package/dist/components/UTBodyPlaceholder/UTBodyPlaceholder.stories.js +76 -0
- package/dist/components/UTBodyPlaceholder/constants.js +14 -0
- package/dist/components/UTBodyPlaceholder/index.js +45 -0
- package/dist/components/UTBodyPlaceholder/styles.module.scss +34 -0
- package/dist/components/UTButton/constants.js +8 -5
- package/dist/components/UTButton/stories/UTButton.mdx +13 -0
- package/dist/components/UTButton/stories/UTButton.stories.js +38 -0
- package/dist/components/UTButton/stories/UTButtonAdornments.stories.js +52 -0
- package/dist/components/UTButton/stories/UTButtonColorThemes.stories.js +52 -0
- package/dist/components/UTButton/stories/UTButtonSizes.stories.js +40 -0
- package/dist/components/UTButton/stories/UTButtonStates.stories.js +34 -0
- package/dist/components/UTButton/stories/UTButtonVariants.stories.js +61 -0
- package/dist/components/UTButton/stories/storiesConstants.js +220 -0
- package/dist/components/UTButton/theme.js +15 -14
- package/dist/components/UTButton/utils.js +2 -2
- package/dist/components/UTDataElement/UTDataElement.stories.js +2 -1
- package/dist/components/UTDataElement/theme.js +2 -1
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/CollapsedPanelContent/constants.js +11 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/CollapsedPanelContent/index.js +34 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/CollapsedPanelContent/layout.js +46 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryEmpty/index.js +36 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryEmpty/layout.js +50 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryHeader/constants.js +8 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryHeader/index.js +55 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryHeader/layout.js +78 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryItem/constants.js +21 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryItem/index.js +80 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryItem/layout.js +132 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/constants.js +7 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/index.js +62 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/layout.js +78 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/utils.js +23 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentHeader/constants.js +16 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentHeader/index.js +75 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentHeader/layout.js +136 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentPopper/constants.js +11 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentPopper/index.js +40 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentPopper/layout.js +55 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/index.js +37 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/components/ExpandedPanelContent/layout.js +44 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/index.js +57 -0
- package/dist/components/UTFilterGrouping/components/GroupingPanel/layout.js +64 -0
- package/dist/components/UTFilterGrouping/constants.js +10 -0
- package/dist/components/UTFilterGrouping/context.js +9 -0
- package/dist/components/UTFilterGrouping/index.js +187 -0
- package/dist/components/UTFilterGrouping/layout.js +43 -0
- package/dist/components/UTFilterGrouping/stories/UTFilterGrouping.mdx +13 -0
- package/dist/components/UTFilterGrouping/stories/UTFilterGrouping.stories.js +315 -0
- package/dist/components/UTFilterGrouping/stories/constants.json +282 -0
- package/dist/components/UTFilterGrouping/stories/fixtures.js +162 -0
- package/dist/components/UTFilterGrouping/stories/props.schema.json +163 -0
- package/dist/components/UTFilterGrouping/stories/styles.module.scss +19 -0
- package/dist/components/UTFilterGrouping/stories/tests.js +250 -0
- package/dist/components/UTFilterGrouping/stories/utils.js +178 -0
- package/dist/components/UTFilterGrouping/styles.module.scss +251 -0
- package/dist/components/UTFilterGrouping/theme.js +55 -0
- package/dist/components/UTFilterGrouping/types.js +51 -0
- package/dist/components/UTFilterGrouping/utils.js +27 -0
- package/dist/components/UTGraph/UTGraph.stories.js +1 -1
- package/dist/components/UTIcon/UTIcon.mdx +17 -0
- package/dist/components/UTIcon/UTIcon.stories.js +2 -1
- package/dist/components/UTIcon/index.js +2 -19
- package/dist/components/UTKpi/UTKpi.stories.js +2 -1
- package/dist/components/UTLabel/UTLabel.stories.js +2 -1
- package/dist/components/UTPanel/UTPanel.stories.js +2 -1
- package/dist/components/UTRadioGroup/UTRadioGroup.stories.js +2 -1
- package/dist/components/UTSearchField/index.js +8 -2
- package/dist/components/UTSearchField/stories/UTSearchField.mdx +11 -0
- package/dist/components/UTSearchField/stories/UTSearchField.stories.js +250 -0
- package/dist/components/UTSignature/UTSignature.stories.js +2 -1
- package/dist/components/UTStatus/UTStatus.stories.js +2 -1
- package/dist/components/UTSwitch/versions/V1/theme.js +5 -4
- package/dist/components/UTTable/UTTable.stories.js +2 -1
- package/dist/constants/Palette.js +1 -0
- package/dist/constants/testIds.js +53 -1
- package/dist/types/iconTypes.js +25 -0
- package/package.json +8 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.filterItemsFixture = void 0;
|
|
7
|
+
var _test = require("@storybook/test");
|
|
8
|
+
var _testIds = require("../../../constants/testIds");
|
|
9
|
+
var _constants = _interopRequireDefault(require("./constants.json"));
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const {
|
|
13
|
+
CLIENT_FILTER,
|
|
14
|
+
DELETE_BUTTON,
|
|
15
|
+
DELETE_BUTTON_TOOLTIP,
|
|
16
|
+
EDIT_BUTTON,
|
|
17
|
+
EDIT_BUTTON_TOOLTIP,
|
|
18
|
+
NAME,
|
|
19
|
+
NAME_CONTAINER,
|
|
20
|
+
PINNED,
|
|
21
|
+
USER_FILTER
|
|
22
|
+
} = _testIds.ID_CONSTANTS;
|
|
23
|
+
const {
|
|
24
|
+
MISC
|
|
25
|
+
} = _constants.default;
|
|
26
|
+
const {
|
|
27
|
+
HOVERABLE_KEY,
|
|
28
|
+
HOVERABLE_VALUE,
|
|
29
|
+
HTML_ELEMENTS
|
|
30
|
+
} = MISC;
|
|
31
|
+
const {
|
|
32
|
+
ARTICLE,
|
|
33
|
+
DIV
|
|
34
|
+
} = HTML_ELEMENTS;
|
|
35
|
+
const filterItemsFixture = async _ref => {
|
|
36
|
+
let {
|
|
37
|
+
args,
|
|
38
|
+
canvas,
|
|
39
|
+
category,
|
|
40
|
+
existingIds,
|
|
41
|
+
filters,
|
|
42
|
+
step,
|
|
43
|
+
suiteTitle,
|
|
44
|
+
testIds,
|
|
45
|
+
tooltipsContentMap
|
|
46
|
+
} = _ref;
|
|
47
|
+
const {
|
|
48
|
+
handleSelectFilter,
|
|
49
|
+
onDeleteFilterGrouping,
|
|
50
|
+
onEditFilterGrouping
|
|
51
|
+
} = args;
|
|
52
|
+
const {
|
|
53
|
+
popperLabel,
|
|
54
|
+
popperTitle
|
|
55
|
+
} = testIds;
|
|
56
|
+
const {
|
|
57
|
+
deleteButton,
|
|
58
|
+
editButton
|
|
59
|
+
} = tooltipsContentMap;
|
|
60
|
+
await step(suiteTitle, async () => {
|
|
61
|
+
if (filters.length === 0) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
for (let index = 0; index < filters.length; index++) {
|
|
65
|
+
const filter = filters[index];
|
|
66
|
+
const {
|
|
67
|
+
description,
|
|
68
|
+
name: itemName,
|
|
69
|
+
pinned
|
|
70
|
+
} = filter;
|
|
71
|
+
// eslint-disable-next-line no-await-in-loop
|
|
72
|
+
await step("Item: ".concat(itemName), async () => {
|
|
73
|
+
const targetItemName = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(pinned ? CLIENT_FILTER : USER_FILTER) && id.includes(NAME) && id.includes(index) && !id.includes(NAME_CONTAINER)));
|
|
74
|
+
await step('Initial content', async () => {
|
|
75
|
+
if (pinned) {
|
|
76
|
+
const targetPinnedIcon = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(PINNED) && id.includes(index)));
|
|
77
|
+
(0, _test.expect)(targetPinnedIcon).toBeInTheDocument();
|
|
78
|
+
}
|
|
79
|
+
(0, _test.expect)(targetItemName.innerText).toBe(itemName);
|
|
80
|
+
(0, _test.expect)(targetItemName).toBeInTheDocument();
|
|
81
|
+
});
|
|
82
|
+
const targetItemNameContainer = targetItemName.closest(ARTICLE);
|
|
83
|
+
const targetItemTitleContainer = targetItemName.closest(DIV);
|
|
84
|
+
await step('Select item', async () => {
|
|
85
|
+
await _test.userEvent.click(targetItemTitleContainer);
|
|
86
|
+
(0, _test.expect)(handleSelectFilter).toHaveBeenCalled();
|
|
87
|
+
(0, _test.expect)(handleSelectFilter).toHaveBeenCalledWith(filter);
|
|
88
|
+
});
|
|
89
|
+
if (!pinned) {
|
|
90
|
+
targetItemNameContainer.setAttribute(HOVERABLE_KEY, HOVERABLE_VALUE);
|
|
91
|
+
await (0, _utils.delay)(500);
|
|
92
|
+
const targetEditButton = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(USER_FILTER) && id.includes(EDIT_BUTTON) && id.includes(index)));
|
|
93
|
+
const targetDeleteButton = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(USER_FILTER) && id.includes(DELETE_BUTTON) && id.includes(index)));
|
|
94
|
+
await step('Actions', async () => {
|
|
95
|
+
await step('Edit', async () => {
|
|
96
|
+
await _test.userEvent.click(targetEditButton);
|
|
97
|
+
(0, _test.expect)(targetEditButton).toBeVisible();
|
|
98
|
+
(0, _test.expect)(onEditFilterGrouping).toHaveBeenCalled();
|
|
99
|
+
(0, _test.expect)(onEditFilterGrouping).toHaveBeenCalledWith(filter);
|
|
100
|
+
});
|
|
101
|
+
await step('Delete', async () => {
|
|
102
|
+
await _test.userEvent.click(targetDeleteButton);
|
|
103
|
+
(0, _test.expect)(targetDeleteButton).toBeVisible();
|
|
104
|
+
(0, _test.expect)(onDeleteFilterGrouping).toHaveBeenCalled();
|
|
105
|
+
(0, _test.expect)(onDeleteFilterGrouping).toHaveBeenCalledWith(filter);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
await step('Hovers', async () => {
|
|
110
|
+
if (description || itemName.length > 20) {
|
|
111
|
+
await step('Popper hover', async () => {
|
|
112
|
+
await _test.userEvent.hover(targetItemName);
|
|
113
|
+
await (0, _utils.delay)(500);
|
|
114
|
+
let targetPopperLabel;
|
|
115
|
+
if (description) {
|
|
116
|
+
targetPopperLabel = _test.screen.getByTestId(popperLabel);
|
|
117
|
+
(0, _test.expect)(targetPopperLabel).toBeVisible();
|
|
118
|
+
(0, _test.expect)(targetPopperLabel.innerText).toBe(description);
|
|
119
|
+
}
|
|
120
|
+
const targetPopperTitle = _test.screen.getByTestId(popperTitle);
|
|
121
|
+
(0, _test.expect)(targetPopperTitle).toBeVisible();
|
|
122
|
+
(0, _test.expect)(targetPopperTitle.innerText).toBe(itemName);
|
|
123
|
+
await _test.userEvent.unhover(targetItemName);
|
|
124
|
+
(0, _test.expect)(targetPopperTitle).not.toBeVisible();
|
|
125
|
+
if (description) {
|
|
126
|
+
(0, _test.expect)(targetPopperLabel).not.toBeVisible();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (!pinned) {
|
|
131
|
+
const targetEditButton = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(USER_FILTER) && id.includes(EDIT_BUTTON) && id.includes(index)));
|
|
132
|
+
const targetDeleteButton = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(USER_FILTER) && id.includes(DELETE_BUTTON) && id.includes(index)));
|
|
133
|
+
await step('Actions hover', async () => {
|
|
134
|
+
await step('Edit', async () => {
|
|
135
|
+
await _test.userEvent.hover(targetEditButton);
|
|
136
|
+
await (0, _utils.delay)(500);
|
|
137
|
+
const targetEditButtonTooltip = _test.screen.getByTestId(existingIds.find(id => id.includes(category) && id.includes(USER_FILTER) && id.includes(EDIT_BUTTON_TOOLTIP) && id.includes(index)));
|
|
138
|
+
(0, _test.expect)(targetEditButtonTooltip).toBeVisible();
|
|
139
|
+
(0, _test.expect)(targetEditButtonTooltip.innerText).toBe(editButton);
|
|
140
|
+
await _test.userEvent.unhover(targetEditButton);
|
|
141
|
+
await (0, _utils.delay)(500);
|
|
142
|
+
(0, _test.expect)(targetEditButtonTooltip).not.toBeVisible();
|
|
143
|
+
});
|
|
144
|
+
await step('Delete', async () => {
|
|
145
|
+
await _test.userEvent.hover(targetDeleteButton);
|
|
146
|
+
await (0, _utils.delay)(500);
|
|
147
|
+
const targetDeleteButtonTooltip = _test.screen.getByTestId(existingIds.find(id => id.includes(category) && id.includes(USER_FILTER) && id.includes(DELETE_BUTTON_TOOLTIP) && id.includes(index)));
|
|
148
|
+
(0, _test.expect)(targetDeleteButtonTooltip).toBeVisible();
|
|
149
|
+
(0, _test.expect)(targetDeleteButtonTooltip.innerText).toBe(deleteButton);
|
|
150
|
+
await _test.userEvent.unhover(targetDeleteButton);
|
|
151
|
+
await (0, _utils.delay)(500);
|
|
152
|
+
(0, _test.expect)(targetDeleteButtonTooltip).not.toBeVisible();
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
targetItemNameContainer.removeAttribute(HOVERABLE_KEY);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
exports.filterItemsFixture = filterItemsFixture;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://utfiltergrouping.dev/schemas/categories.schema.json",
|
|
4
|
+
"title": "UTFilterGrouping Configuration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Complete configuration for UTFilterGrouping component",
|
|
7
|
+
"required": ["CATEGORIES", "CATEGORIES_CONFIG"],
|
|
8
|
+
"additionalProperties": true,
|
|
9
|
+
"properties": {
|
|
10
|
+
"CATEGORIES": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"description": "Array of categories with their filters",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": ["id", "category", "name", "filters"],
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"properties": {
|
|
18
|
+
"id": {
|
|
19
|
+
"type": "number",
|
|
20
|
+
"description": "Unique identifier for the category"
|
|
21
|
+
},
|
|
22
|
+
"category": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Category code (e.g., 'procedure', 'claim')"
|
|
25
|
+
},
|
|
26
|
+
"name": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Display name for the category"
|
|
29
|
+
},
|
|
30
|
+
"filters": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"description": "Array of filters within this category",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"required": ["id", "name", "category", "order", "pinned", "visible"],
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"properties": {
|
|
38
|
+
"id": {
|
|
39
|
+
"type": "number",
|
|
40
|
+
"description": "Unique identifier for the filter"
|
|
41
|
+
},
|
|
42
|
+
"name": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Display name for the filter"
|
|
45
|
+
},
|
|
46
|
+
"category": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Category code this filter belongs to"
|
|
49
|
+
},
|
|
50
|
+
"description": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Optional description for the filter"
|
|
53
|
+
},
|
|
54
|
+
"order": {
|
|
55
|
+
"type": "number",
|
|
56
|
+
"description": "Order position of the filter within the category"
|
|
57
|
+
},
|
|
58
|
+
"pinned": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Whether the filter is pinned"
|
|
61
|
+
},
|
|
62
|
+
"visible": {
|
|
63
|
+
"type": "boolean",
|
|
64
|
+
"description": "Whether the filter is visible"
|
|
65
|
+
},
|
|
66
|
+
"backoffice_user_id": {
|
|
67
|
+
"type": ["string", "null"],
|
|
68
|
+
"description": "ID of the backoffice user who created this filter, or null for system filters"
|
|
69
|
+
},
|
|
70
|
+
"filter_params": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"description": "Array of filter parameters",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"additionalProperties": true,
|
|
76
|
+
"properties": {
|
|
77
|
+
"key": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"description": "Parameter key"
|
|
80
|
+
},
|
|
81
|
+
"values": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "Parameter values"
|
|
84
|
+
},
|
|
85
|
+
"assigned_user": {
|
|
86
|
+
"type": "null",
|
|
87
|
+
"description": "Assigned user for the filter"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"CATEGORIES_CONFIG": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"description": "Configuration for category icons and colors",
|
|
101
|
+
"additionalProperties": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"required": ["icon", "avatarPalette"],
|
|
104
|
+
"properties": {
|
|
105
|
+
"icon": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"description": "Icon name for the category"
|
|
108
|
+
},
|
|
109
|
+
"avatarPalette": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"description": "Array of color configurations for the category avatar",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"required": ["color", "backgroundColor", "colorTheme"],
|
|
115
|
+
"properties": {
|
|
116
|
+
"color": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"description": "Text color"
|
|
119
|
+
},
|
|
120
|
+
"backgroundColor": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "Background color (CSS variable or color value)"
|
|
123
|
+
},
|
|
124
|
+
"colorTheme": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"description": "Color theme name"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"TOOLTIPS_CONTENT_MAP": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"description": "Map of tooltip content for various UI elements",
|
|
137
|
+
"additionalProperties": {
|
|
138
|
+
"type": "string"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"DATA_TEST_ID": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"description": "Base data-testid for the component"
|
|
144
|
+
},
|
|
145
|
+
"NO_FILTERS_TITLE": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"description": "Title to display when there are no filters"
|
|
148
|
+
},
|
|
149
|
+
"NO_FILTERS_TEXT": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"description": "Text to display when there are no filters"
|
|
152
|
+
},
|
|
153
|
+
"PANEL_TITLE": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"description": "Title for the filter panel"
|
|
156
|
+
},
|
|
157
|
+
"POSITION": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"enum": ["left", "right"],
|
|
160
|
+
"description": "Position of the filter panel"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.storyContainer {
|
|
2
|
+
display: flex;
|
|
3
|
+
height: calc(100vh - 2rem);
|
|
4
|
+
width: calc(100vw - 2rem);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.defaultContainer {
|
|
8
|
+
background-color: #EABFFF;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 16px;
|
|
13
|
+
padding: 16px;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.bodyPlaceholder {
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UTFilterGroupingTests = void 0;
|
|
7
|
+
var _test = require("@storybook/test");
|
|
8
|
+
var _testIds = require("../../../constants/testIds");
|
|
9
|
+
var _constants = _interopRequireDefault(require("./constants.json"));
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
var _fixtures = require("./fixtures");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
/* eslint-disable no-await-in-loop */
|
|
14
|
+
/* eslint-disable no-restricted-syntax */
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
AVATAR,
|
|
18
|
+
CLIENT_FILTER,
|
|
19
|
+
COLLAPSE_BUTTON,
|
|
20
|
+
DESCRIPTION,
|
|
21
|
+
EXPANDED_PANEL_CONTENT_CATEGORY_EMPTY,
|
|
22
|
+
ICON,
|
|
23
|
+
LABEL,
|
|
24
|
+
NAME,
|
|
25
|
+
NAME_CONTAINER,
|
|
26
|
+
PERSISTENT_FILTER,
|
|
27
|
+
TITLE
|
|
28
|
+
} = _testIds.ID_CONSTANTS;
|
|
29
|
+
const {
|
|
30
|
+
CATEGORIES,
|
|
31
|
+
MISC,
|
|
32
|
+
TEST_IDS,
|
|
33
|
+
TOOLTIPS_CONTENT_MAP
|
|
34
|
+
} = _constants.default;
|
|
35
|
+
const {
|
|
36
|
+
HOVERABLE_KEY,
|
|
37
|
+
HOVERABLE_VALUE,
|
|
38
|
+
HTML_ELEMENTS,
|
|
39
|
+
SEARCH_STRING,
|
|
40
|
+
SHIELD_KEY,
|
|
41
|
+
SHIELD_VALUE,
|
|
42
|
+
TESTING_SHIELD
|
|
43
|
+
} = MISC;
|
|
44
|
+
const {
|
|
45
|
+
HEADER
|
|
46
|
+
} = HTML_ELEMENTS;
|
|
47
|
+
const {
|
|
48
|
+
expandButton,
|
|
49
|
+
headerCollapseButton,
|
|
50
|
+
headerCollapseButtonTooltip,
|
|
51
|
+
headerSearchButton,
|
|
52
|
+
headerSearchButtonTooltip,
|
|
53
|
+
headerSearchField,
|
|
54
|
+
headerSearchFieldCustomAction,
|
|
55
|
+
headerTitle
|
|
56
|
+
} = TEST_IDS;
|
|
57
|
+
const UTFilterGroupingTests = async _ref => {
|
|
58
|
+
let {
|
|
59
|
+
args,
|
|
60
|
+
canvasElement,
|
|
61
|
+
step
|
|
62
|
+
} = _ref;
|
|
63
|
+
const testingShield = _test.screen.getByTestId(TESTING_SHIELD);
|
|
64
|
+
testingShield.setAttribute(SHIELD_KEY, SHIELD_VALUE);
|
|
65
|
+
const existingIds = (0, _utils.createExistingIds)(CATEGORIES, TEST_IDS);
|
|
66
|
+
const canvas = (0, _test.within)(canvasElement);
|
|
67
|
+
await (0, _utils.delay)(500);
|
|
68
|
+
await step('Verify initial state', async () => {
|
|
69
|
+
const filteredIds = [...existingIds].filter(id => !(0, _utils.idBelongsToHoverableItem)(id) && !(0, _utils.idBelongsToCollapsedItem)(id) && !(0, _utils.idBelongsToNonStartItem)(id));
|
|
70
|
+
for (const id of filteredIds) {
|
|
71
|
+
const element = canvas.getByTestId(id);
|
|
72
|
+
(0, _test.expect)(element).toBeInTheDocument();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
await step('Header', async () => {
|
|
76
|
+
const title = canvas.getByTestId(headerTitle);
|
|
77
|
+
const hoverableParent = title.closest(HEADER);
|
|
78
|
+
hoverableParent.setAttribute(HOVERABLE_KEY, HOVERABLE_VALUE);
|
|
79
|
+
await (0, _utils.delay)(500);
|
|
80
|
+
await step('Hovers', async () => {
|
|
81
|
+
const searchTargetElement = canvas.getByTestId(headerSearchButton);
|
|
82
|
+
const collapseTargetElement = canvas.getByTestId(headerCollapseButton);
|
|
83
|
+
await step('Main hover', async () => {
|
|
84
|
+
await (0, _test.expect)(searchTargetElement).toBeVisible();
|
|
85
|
+
await (0, _test.expect)(collapseTargetElement).toBeVisible();
|
|
86
|
+
});
|
|
87
|
+
await step('Actions Hover', async () => {
|
|
88
|
+
await step('Search', async () => {
|
|
89
|
+
await _test.userEvent.hover(searchTargetElement);
|
|
90
|
+
await (0, _utils.delay)(500);
|
|
91
|
+
const searchTargetTooltip = canvas.getByTestId(headerSearchButtonTooltip);
|
|
92
|
+
await (0, _test.expect)(searchTargetTooltip).toBeVisible();
|
|
93
|
+
await _test.userEvent.unhover(searchTargetElement);
|
|
94
|
+
});
|
|
95
|
+
await step('Collapse', async () => {
|
|
96
|
+
await _test.userEvent.hover(collapseTargetElement);
|
|
97
|
+
await (0, _utils.delay)(500);
|
|
98
|
+
const collapseTargetTooltip = canvas.getByTestId(headerCollapseButtonTooltip);
|
|
99
|
+
await (0, _test.expect)(collapseTargetTooltip).toBeVisible();
|
|
100
|
+
await _test.userEvent.unhover(collapseTargetElement);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
await step('Actions', async () => {
|
|
105
|
+
await step('Search action', async () => {
|
|
106
|
+
const randomFilterId = existingIds.find(id => id.includes(CLIENT_FILTER) && id.includes(NAME));
|
|
107
|
+
const targetClientFilter = canvas.getByTestId(randomFilterId);
|
|
108
|
+
const targetClientFilterText = targetClientFilter.innerText;
|
|
109
|
+
const searchTargetElement = canvas.getByTestId(headerSearchButton);
|
|
110
|
+
await _test.userEvent.click(searchTargetElement);
|
|
111
|
+
const targetField = canvas.getByTestId(headerSearchField);
|
|
112
|
+
(0, _test.expect)(targetField).toBeVisible();
|
|
113
|
+
await _test.userEvent.type(targetField, SEARCH_STRING);
|
|
114
|
+
await (0, _utils.delay)(500);
|
|
115
|
+
(0, _test.expect)(targetClientFilter).not.toBeInTheDocument();
|
|
116
|
+
await _test.userEvent.clear(targetField);
|
|
117
|
+
await _test.userEvent.type(targetField, targetClientFilterText);
|
|
118
|
+
(0, _test.expect)(canvas.getByTestId(randomFilterId)).toBeInTheDocument();
|
|
119
|
+
const customAction = canvas.getByTestId(headerSearchFieldCustomAction);
|
|
120
|
+
await _test.userEvent.click(customAction);
|
|
121
|
+
(0, _test.expect)(targetField).not.toBeInTheDocument();
|
|
122
|
+
(0, _test.expect)(canvas.getByTestId(randomFilterId)).toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
await step('Collapse action', async () => {
|
|
125
|
+
const collapseTargetElement = canvas.getByTestId(headerCollapseButton);
|
|
126
|
+
await _test.userEvent.click(collapseTargetElement);
|
|
127
|
+
const targetExpandButton = canvas.getByTestId(expandButton);
|
|
128
|
+
(0, _test.expect)(targetExpandButton).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
hoverableParent.removeAttribute(HOVERABLE_KEY);
|
|
132
|
+
});
|
|
133
|
+
await step('Collapsed panel', async () => {
|
|
134
|
+
const targetExpandButton = canvas.getByTestId(expandButton);
|
|
135
|
+
await step('Content exists', async () => {
|
|
136
|
+
(0, _test.expect)(targetExpandButton).toBeInTheDocument();
|
|
137
|
+
});
|
|
138
|
+
await step('Action', async () => {
|
|
139
|
+
await _test.userEvent.click(targetExpandButton);
|
|
140
|
+
await (0, _utils.delay)(500);
|
|
141
|
+
const collapseButton = canvas.getByTestId(headerCollapseButton);
|
|
142
|
+
(0, _test.expect)(targetExpandButton).not.toBeInTheDocument();
|
|
143
|
+
(0, _test.expect)(collapseButton).toBeInTheDocument();
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
for (const {
|
|
147
|
+
category,
|
|
148
|
+
filters,
|
|
149
|
+
name
|
|
150
|
+
} of CATEGORIES) {
|
|
151
|
+
await step("Category: ".concat(category), async () => {
|
|
152
|
+
await step('Header', async () => {
|
|
153
|
+
const targetAvatar = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(AVATAR)));
|
|
154
|
+
const targetTitle = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(LABEL)));
|
|
155
|
+
const targetAvatarParent = targetAvatar.closest(HEADER);
|
|
156
|
+
await step('Initial content', async () => {
|
|
157
|
+
(0, _test.expect)(targetAvatar).toBeInTheDocument();
|
|
158
|
+
(0, _test.expect)(targetTitle.innerText).toBe(name);
|
|
159
|
+
(0, _test.expect)(targetTitle).toBeInTheDocument();
|
|
160
|
+
});
|
|
161
|
+
_test.userEvent.hover(targetAvatarParent);
|
|
162
|
+
await (0, _utils.delay)(500);
|
|
163
|
+
const targetCollapseCategoryButton = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(COLLAPSE_BUTTON)));
|
|
164
|
+
await step('Category hover', async () => {
|
|
165
|
+
(0, _test.expect)(targetCollapseCategoryButton).toBeInTheDocument();
|
|
166
|
+
});
|
|
167
|
+
await step('Category collapse', async () => {
|
|
168
|
+
await _test.userEvent.click(targetCollapseCategoryButton);
|
|
169
|
+
const targetUserFilter = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(CLIENT_FILTER) && id.includes(NAME)));
|
|
170
|
+
await (0, _utils.delay)(500);
|
|
171
|
+
(0, _test.expect)(targetUserFilter).not.toBeVisible();
|
|
172
|
+
await _test.userEvent.click(targetCollapseCategoryButton);
|
|
173
|
+
await (0, _utils.delay)(500);
|
|
174
|
+
(0, _test.expect)(targetUserFilter).toBeVisible();
|
|
175
|
+
});
|
|
176
|
+
_test.userEvent.unhover(targetAvatarParent);
|
|
177
|
+
});
|
|
178
|
+
const clientFilters = filters.filter(_ref2 => {
|
|
179
|
+
let {
|
|
180
|
+
pinned
|
|
181
|
+
} = _ref2;
|
|
182
|
+
return pinned;
|
|
183
|
+
});
|
|
184
|
+
const userFilters = filters.filter(_ref3 => {
|
|
185
|
+
let {
|
|
186
|
+
pinned
|
|
187
|
+
} = _ref3;
|
|
188
|
+
return !pinned;
|
|
189
|
+
});
|
|
190
|
+
await (0, _fixtures.filterItemsFixture)({
|
|
191
|
+
args,
|
|
192
|
+
canvas,
|
|
193
|
+
category,
|
|
194
|
+
existingIds,
|
|
195
|
+
filters: clientFilters,
|
|
196
|
+
step,
|
|
197
|
+
suiteTitle: 'Client filters',
|
|
198
|
+
testIds: TEST_IDS,
|
|
199
|
+
tooltipsContentMap: TOOLTIPS_CONTENT_MAP
|
|
200
|
+
});
|
|
201
|
+
await (0, _fixtures.filterItemsFixture)({
|
|
202
|
+
args,
|
|
203
|
+
canvas,
|
|
204
|
+
category,
|
|
205
|
+
existingIds,
|
|
206
|
+
filters: userFilters,
|
|
207
|
+
step,
|
|
208
|
+
suiteTitle: 'User filters',
|
|
209
|
+
testIds: TEST_IDS,
|
|
210
|
+
tooltipsContentMap: TOOLTIPS_CONTENT_MAP
|
|
211
|
+
});
|
|
212
|
+
if (filters.filter(_ref4 => {
|
|
213
|
+
let {
|
|
214
|
+
pinned
|
|
215
|
+
} = _ref4;
|
|
216
|
+
return pinned;
|
|
217
|
+
}).length === 0) {
|
|
218
|
+
await step('Category without user filters', async () => {
|
|
219
|
+
const targetEmptyCategoryIcon = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(EXPANDED_PANEL_CONTENT_CATEGORY_EMPTY) && id.includes(ICON)));
|
|
220
|
+
const targetEmptyCategoryTitle = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(EXPANDED_PANEL_CONTENT_CATEGORY_EMPTY) && id.includes(TITLE)));
|
|
221
|
+
const targetEmptyCategoryDescription = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(EXPANDED_PANEL_CONTENT_CATEGORY_EMPTY) && id.includes(DESCRIPTION)));
|
|
222
|
+
(0, _test.expect)(targetEmptyCategoryIcon).toBeVisible();
|
|
223
|
+
(0, _test.expect)(targetEmptyCategoryTitle).toBeVisible();
|
|
224
|
+
(0, _test.expect)(targetEmptyCategoryDescription).toBeVisible();
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
await step('Collapsed category with selected item', async () => {
|
|
228
|
+
const targetAvatar = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(AVATAR)));
|
|
229
|
+
const targetAvatarParent = targetAvatar.closest(HEADER);
|
|
230
|
+
const selectedClientFilter = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(CLIENT_FILTER) && id.includes(NAME_CONTAINER) && id.includes('0')));
|
|
231
|
+
await _test.userEvent.click(selectedClientFilter);
|
|
232
|
+
await _test.userEvent.hover(targetAvatarParent);
|
|
233
|
+
await (0, _utils.delay)(500);
|
|
234
|
+
const targetCollapseCategoryButton = canvas.getByTestId(existingIds.find(id => id.includes(category) && id.includes(COLLAPSE_BUTTON)));
|
|
235
|
+
await _test.userEvent.click(targetCollapseCategoryButton);
|
|
236
|
+
await (0, _utils.delay)(500);
|
|
237
|
+
const persistentClientFilter = canvas.getByTestId(existingIds.find(id => id.includes(PERSISTENT_FILTER) && id.includes(category)));
|
|
238
|
+
(0, _test.expect)(selectedClientFilter).not.toBeVisible();
|
|
239
|
+
(0, _test.expect)(persistentClientFilter).toBeVisible();
|
|
240
|
+
await _test.userEvent.click(targetCollapseCategoryButton);
|
|
241
|
+
await (0, _utils.delay)(500);
|
|
242
|
+
(0, _test.expect)(selectedClientFilter).toBeVisible();
|
|
243
|
+
(0, _test.expect)(persistentClientFilter).not.toBeVisible();
|
|
244
|
+
await _test.userEvent.unhover(targetAvatarParent);
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
testingShield.removeAttribute(SHIELD_KEY);
|
|
249
|
+
};
|
|
250
|
+
exports.UTFilterGroupingTests = UTFilterGroupingTests;
|