pixelize-design-library 2.3.1-beta.9 → 2.3.3
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/.cursor/TASK-SETUP.md +43 -0
- package/.cursor/agents/be-impl.md +37 -0
- package/.cursor/agents/fe-impl.md +39 -0
- package/.cursor/agents/task-plan.md +56 -0
- package/.cursor/agents/test-create.md +31 -0
- package/.cursor/agents/test-exec.md +26 -0
- package/.cursor/hooks/task-hint.env +1 -0
- package/.cursor/hooks/task-skill-nudge.sh +71 -0
- package/.cursor/hooks/task-slash-guard.sh +31 -0
- package/.cursor/hooks.json +13 -0
- package/.cursor/modules/account-management/MODULE.md +16 -0
- package/.cursor/modules/buttons/MODULE.md +13 -0
- package/.cursor/modules/cards/MODULE.md +13 -0
- package/.cursor/modules/charts/MODULE.md +13 -0
- package/.cursor/modules/common/MODULE.md +13 -0
- package/.cursor/modules/contact-auth/MODULE.md +13 -0
- package/.cursor/modules/data-display/MODULE.md +18 -0
- package/.cursor/modules/feedback/MODULE.md +14 -0
- package/.cursor/modules/form/MODULE.md +13 -0
- package/.cursor/modules/inputs-basic/MODULE.md +13 -0
- package/.cursor/modules/inputs-date-file/MODULE.md +19 -0
- package/.cursor/modules/inputs-select/MODULE.md +15 -0
- package/.cursor/modules/inputs-toggle/MODULE.md +13 -0
- package/.cursor/modules/kanban/MODULE.md +14 -0
- package/.cursor/modules/layout-navigation/MODULE.md +14 -0
- package/.cursor/modules/overlays/MODULE.md +13 -0
- package/.cursor/modules/playground/MODULE.md +15 -0
- package/.cursor/modules/table/MODULE.md +15 -0
- package/.cursor/modules/theme/MODULE.md +15 -0
- package/.cursor/modules/types-exports/MODULE.md +17 -0
- package/.cursor/modules/utility-ui/MODULE.md +15 -0
- package/.cursor/modules/utils-hooks/MODULE.md +13 -0
- package/.cursor/pixelize-task-statusline.sh +64 -0
- package/.cursor/plans/blocked/.gitkeep +0 -0
- package/.cursor/plans/current.md +35 -0
- package/.cursor/plans/done/.gitkeep +0 -0
- package/.cursor/rules +31 -0
- package/.cursor/skills/task/SKILL.md +167 -0
- package/CLAUDE.md +122 -0
- package/dist/Components/Card/PaymentCard/PaymentCard.d.ts +1 -1
- package/dist/Components/Card/PaymentCard/PaymentCard.js +3 -3
- package/dist/Components/Card/PaymentCard/PaymentCardProps.d.ts +1 -0
- package/dist/Components/CopyButton/CopyButton.d.ts +22 -0
- package/dist/Components/CopyButton/CopyButton.js +126 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.d.ts +4 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.js +182 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.test.d.ts +1 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.test.js +84 -0
- package/dist/Components/CustomModulesTable/CustomModulesTableProps.d.ts +54 -0
- package/dist/Components/CustomModulesTable/CustomModulesTableProps.js +2 -0
- package/dist/Components/CustomModulesTable/DeleteModuleModal.d.ts +4 -0
- package/dist/Components/CustomModulesTable/DeleteModuleModal.js +33 -0
- package/dist/Components/CustomModulesTable/EditModuleModal.d.ts +4 -0
- package/dist/Components/CustomModulesTable/EditModuleModal.js +63 -0
- package/dist/Components/Dropdown/DropDown.js +110 -28
- package/dist/Components/Dropdown/Dropdown.test.d.ts +1 -0
- package/dist/Components/Dropdown/Dropdown.test.js +102 -0
- package/dist/Components/Dropdown/DropdownProps.d.ts +4 -1
- package/dist/Components/EmptyState/EmptyState.d.ts +4 -0
- package/dist/Components/EmptyState/EmptyState.js +65 -0
- package/dist/Components/EmptyState/EmptyStateProps.d.ts +28 -0
- package/dist/Components/EmptyState/EmptyStateProps.js +2 -0
- package/dist/Components/FieldSelectModal/FieldSelectModal.d.ts +26 -0
- package/dist/Components/FieldSelectModal/FieldSelectModal.js +107 -0
- package/dist/Components/FilePreview/FilePreview.d.ts +6 -0
- package/dist/Components/FilePreview/FilePreview.js +190 -0
- package/dist/Components/FilePreview/FilePreviewProps.d.ts +26 -0
- package/dist/Components/FilePreview/FilePreviewProps.js +2 -0
- package/dist/Components/LazyWrapper/LazyWrapper.d.ts +10 -0
- package/dist/Components/LazyWrapper/LazyWrapper.js +50 -0
- package/dist/Components/MoreItems/MoreItems.d.ts +4 -0
- package/dist/Components/MoreItems/MoreItems.js +35 -0
- package/dist/Components/MoreItems/MoreItemsProps.d.ts +29 -0
- package/dist/Components/MoreItems/MoreItemsProps.js +2 -0
- package/dist/Components/OrgSwitcher/OrgSwitcher.d.ts +4 -0
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +121 -0
- package/dist/Components/OrgSwitcher/OrgSwitcherProps.d.ts +41 -0
- package/dist/Components/OrgSwitcher/OrgSwitcherProps.js +25 -0
- package/dist/Components/OrganizationDetails/CreateOrgModal.d.ts +4 -0
- package/dist/Components/OrganizationDetails/CreateOrgModal.js +122 -0
- package/dist/Components/OrganizationDetails/DeleteOrgModal.d.ts +4 -0
- package/dist/Components/OrganizationDetails/DeleteOrgModal.js +29 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.d.ts +4 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.js +264 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.test.d.ts +1 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.test.js +122 -0
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.d.ts +88 -0
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.js +2 -0
- package/dist/Components/PdfViewer/PdfViewer.d.ts +15 -0
- package/dist/Components/PdfViewer/PdfViewer.js +29 -0
- package/dist/Components/RolesPermission/DeleteRoleModal.d.ts +4 -0
- package/dist/Components/RolesPermission/DeleteRoleModal.js +29 -0
- package/dist/Components/RolesPermission/RolesPermission.d.ts +4 -0
- package/dist/Components/RolesPermission/RolesPermission.js +243 -0
- package/dist/Components/RolesPermission/RolesPermission.test.d.ts +1 -0
- package/dist/Components/RolesPermission/RolesPermission.test.js +150 -0
- package/dist/Components/RolesPermission/RolesPermissionProps.d.ts +117 -0
- package/dist/Components/RolesPermission/RolesPermissionProps.js +2 -0
- package/dist/Components/ScrollToTop/ScrollToTop.d.ts +19 -0
- package/dist/Components/ScrollToTop/ScrollToTop.js +104 -0
- package/dist/Components/SearchSelect/SearchSelect.dropdownPosition.test.d.ts +1 -0
- package/dist/Components/SearchSelect/SearchSelect.dropdownPosition.test.js +195 -0
- package/dist/Components/SearchSelect/SearchSelect.insideSelect.test.d.ts +1 -0
- package/dist/Components/SearchSelect/SearchSelect.insideSelect.test.js +274 -0
- package/dist/Components/SearchSelect/SearchSelect.js +133 -39
- package/dist/Components/SearchSelect/SearchSelectProps.d.ts +2 -0
- package/dist/Components/SideBar/components/OtherApps.test.js +3 -2
- package/dist/Components/SignInActivityTable/SignInActivityTable.d.ts +4 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.js +95 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.test.d.ts +1 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.test.js +63 -0
- package/dist/Components/SignInActivityTable/SignInActivityTableProps.d.ts +21 -0
- package/dist/Components/SignInActivityTable/SignInActivityTableProps.js +2 -0
- package/dist/Components/StageProgress/StageItem.d.ts +4 -0
- package/dist/Components/StageProgress/StageItem.js +137 -0
- package/dist/Components/StageProgress/StageProgress.d.ts +4 -0
- package/dist/Components/StageProgress/StageProgress.js +59 -0
- package/dist/Components/StageProgress/StageProgressProps.d.ts +85 -0
- package/dist/Components/StageProgress/StageProgressProps.js +27 -0
- package/dist/Components/StageProgress/StepperStage.d.ts +4 -0
- package/dist/Components/StageProgress/StepperStage.js +78 -0
- package/dist/Components/Table/Table.js +66 -45
- package/dist/Components/Table/TableProps.d.ts +4 -2
- package/dist/Components/Table/components/Pagination.js +1 -1
- package/dist/Components/Table/components/TableBody.js +15 -12
- package/dist/Components/Table/components/TableBody.virtualize.test.js +13 -3
- package/dist/Components/Table/components/TableHeader.d.ts +1 -1
- package/dist/Components/Table/components/TableHeader.js +9 -9
- package/dist/Components/Table/hooks/useTable.d.ts +1 -0
- package/dist/Components/Table/hooks/useTable.js +21 -8
- package/dist/Components/Table/settings/ManageColumns.test.js +1 -0
- package/dist/Components/Tag/Tag.d.ts +3 -11
- package/dist/Components/Tag/Tag.js +10 -2
- package/dist/Components/Tag/Tag.styles.d.ts +2 -2
- package/dist/Components/Tag/Tag.styles.js +58 -33
- package/dist/Components/Tag/Tag.test.d.ts +1 -0
- package/dist/Components/Tag/Tag.test.js +68 -0
- package/dist/Components/Tag/TagProps.d.ts +13 -0
- package/dist/Components/Tag/TagProps.js +2 -0
- package/dist/Components/UpgradeButton/UpgradeButton.d.ts +4 -0
- package/dist/Components/UpgradeButton/UpgradeButton.js +73 -0
- package/dist/Components/UpgradeButton/UpgradeButtonProps.d.ts +43 -0
- package/dist/Components/UpgradeButton/UpgradeButtonProps.js +2 -0
- package/dist/Components/UserDetails/AddUserModal.d.ts +4 -0
- package/dist/Components/UserDetails/AddUserModal.js +218 -0
- package/dist/Components/UserDetails/ChangeRoleModal.d.ts +4 -0
- package/dist/Components/UserDetails/ChangeRoleModal.js +150 -0
- package/dist/Components/UserDetails/DeactivateConfirmModal.d.ts +4 -0
- package/dist/Components/UserDetails/DeactivateConfirmModal.js +34 -0
- package/dist/Components/UserDetails/UserDetails.d.ts +4 -0
- package/dist/Components/UserDetails/UserDetails.js +263 -0
- package/dist/Components/UserDetails/UserDetails.test.d.ts +1 -0
- package/dist/Components/UserDetails/UserDetails.test.js +129 -0
- package/dist/Components/UserDetails/UserDetailsProps.d.ts +151 -0
- package/dist/Components/UserDetails/UserDetailsProps.js +2 -0
- package/dist/Theme/componentStyles.d.ts +1 -1
- package/dist/Theme/index.d.ts +4 -4
- package/dist/Theme/index.js +4 -4
- package/dist/index.d.ts +23 -1
- package/dist/index.js +37 -2
- package/package.json +2 -2
- package/.claude/settings.local.json +0 -44
- package/coverage/clover.xml +0 -638
- package/coverage/coverage-final.json +0 -20
- package/coverage/lcov-report/Table/CompactSelect.tsx.html +0 -379
- package/coverage/lcov-report/Table/Components/ActiveFilters.tsx.html +0 -514
- package/coverage/lcov-report/Table/Components/HeaderActions.tsx.html +0 -373
- package/coverage/lcov-report/Table/Components/Pagination.tsx.html +0 -574
- package/coverage/lcov-report/Table/Components/TableActions.tsx.html +0 -574
- package/coverage/lcov-report/Table/Components/TableBody.tsx.html +0 -1027
- package/coverage/lcov-report/Table/Components/TableFilters.tsx.html +0 -397
- package/coverage/lcov-report/Table/Components/TableHeader.tsx.html +0 -1060
- package/coverage/lcov-report/Table/Components/TableLoading.tsx.html +0 -361
- package/coverage/lcov-report/Table/Components/TableSearch.tsx.html +0 -337
- package/coverage/lcov-report/Table/Components/index.html +0 -266
- package/coverage/lcov-report/Table/Components/useDebounce.ts.html +0 -178
- package/coverage/lcov-report/Table/Components/useTable.ts.html +0 -778
- package/coverage/lcov-report/Table/LeftFilterPane.tsx.html +0 -1810
- package/coverage/lcov-report/Table/SelectOperationControls.tsx.html +0 -178
- package/coverage/lcov-report/Table/Table.tsx.html +0 -1567
- package/coverage/lcov-report/Table/TableProps.tsx.html +0 -658
- package/coverage/lcov-report/Table/TableSettings/ManageColumns.tsx.html +0 -619
- package/coverage/lcov-report/Table/TableSettings/TableFilters.tsx.html +0 -229
- package/coverage/lcov-report/Table/TableSettings/TableSettings.tsx.html +0 -532
- package/coverage/lcov-report/Table/TableSettings/index.html +0 -146
- package/coverage/lcov-report/Table/TableToDo.tsx.html +0 -973
- package/coverage/lcov-report/Table/TextOperationControls.tsx.html +0 -271
- package/coverage/lcov-report/Table/filterTypes.ts.html +0 -97
- package/coverage/lcov-report/Table/index.html +0 -176
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -146
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -1836
- package/dist/Assets/defaultLogo.tsx +0 -31
|
@@ -81,26 +81,28 @@ var normalizeMultiValue = function (val) {
|
|
|
81
81
|
return [];
|
|
82
82
|
};
|
|
83
83
|
var SearchSelect = function (_a) {
|
|
84
|
-
var _b, _c, _d, _e, _f
|
|
85
|
-
var id = _a.id, label = _a.label, options = _a.options, onSelect = _a.onSelect, onSearch = _a.onSearch,
|
|
84
|
+
var _b, _c, _d, _e, _f;
|
|
85
|
+
var id = _a.id, label = _a.label, options = _a.options, onSelect = _a.onSelect, onSearch = _a.onSearch, _g = _a.isOptionLoading, isOptionLoading = _g === void 0 ? false : _g, _h = _a.isLoading, isLoading = _h === void 0 ? false : _h, _j = _a.loadingText, loadingText = _j === void 0 ? "Loading..." : _j, _k = _a.placeholder, placeholder = _k === void 0 ? "Select" : _k, value = _a.value, _l = _a.searchQuery, searchQuery = _l === void 0 ? "" : _l, _m = _a.isMultiple, isMultiple = _m === void 0 ? false : _m, _o = _a.isRequired, isRequired = _o === void 0 ? false : _o, _p = _a.error, error = _p === void 0 ? false : _p, errorMessage = _a.errorMessage, helperText = _a.helperText, _q = _a.width, width = _q === void 0 ? "100%" : _q, height = _a.height, _r = _a.size, size = _r === void 0 ? "md" : _r, chip = _a.chip, information = _a.information, isInformation = _a.isInformation, informationMessage = _a.informationMessage, rightIcon = _a.rightIcon, addNew = _a.addNew, _s = _a.isSelectAll, isSelectAll = _s === void 0 ? false : _s, pagination = _a.pagination, insideSelect = _a.insideSelect, isRemoveAllIcon = _a.isRemoveAllIcon;
|
|
86
86
|
var s = (0, searchSelectSize_1.getSearchSelectSizeStyles)((size || "md"));
|
|
87
87
|
var insideSelectBoxHeight = height !== null && height !== void 0 ? height : s.insideSelectDefaultHeight;
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
88
|
+
var _t = (0, react_1.useState)(searchQuery), inputValue = _t[0], setInputValue = _t[1];
|
|
89
|
+
var _u = (0, react_1.useState)(false), isOpen = _u[0], setIsOpen = _u[1];
|
|
90
|
+
var _v = (0, react_1.useState)(true), hasMore = _v[0], setHasMore = _v[1];
|
|
91
91
|
var inputRef = (0, react_1.useRef)(null);
|
|
92
92
|
var containerRef = (0, react_1.useRef)(null);
|
|
93
93
|
var controlRef = (0, react_1.useRef)(null);
|
|
94
|
-
var
|
|
94
|
+
var dropdownMenuRef = (0, react_1.useRef)(null);
|
|
95
|
+
var _w = (0, react_1.useState)({ top: 0, left: 0, width: 0 }), dropdownPos = _w[0], setDropdownPos = _w[1];
|
|
95
96
|
var scrollTimeoutRef = (0, react_1.useRef)(null);
|
|
96
|
-
var
|
|
97
|
-
var
|
|
97
|
+
var _x = (0, react_1.useState)(false), focused = _x[0], setFocused = _x[1];
|
|
98
|
+
var _y = (0, react_1.useState)(false), customSelectOpen = _y[0], setCustomSelectOpen = _y[1];
|
|
98
99
|
var customSelectRef = (0, react_1.useRef)(null);
|
|
99
|
-
var
|
|
100
|
+
var insideSelectMenuRef = (0, react_1.useRef)(null);
|
|
101
|
+
var _z = (0, react_1.useState)({
|
|
100
102
|
top: 0,
|
|
101
103
|
left: 0,
|
|
102
104
|
width: 0,
|
|
103
|
-
}), customSelectPos =
|
|
105
|
+
}), customSelectPos = _z[0], setCustomSelectPos = _z[1];
|
|
104
106
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
105
107
|
(0, react_2.useOutsideClick)({
|
|
106
108
|
ref: containerRef,
|
|
@@ -220,28 +222,81 @@ var SearchSelect = function (_a) {
|
|
|
220
222
|
}
|
|
221
223
|
setCustomSelectOpen(false);
|
|
222
224
|
};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
// Anchor the insideSelect menu to its trigger (viewport-fixed). Prefer below;
|
|
226
|
+
// flip above when near the bottom; clamp horizontally within the viewport.
|
|
227
|
+
var updateInsideSelectPos = (0, react_1.useCallback)(function () {
|
|
228
|
+
var _a, _b;
|
|
229
|
+
if (!customSelectRef.current)
|
|
230
|
+
return;
|
|
231
|
+
var rect = customSelectRef.current.getBoundingClientRect();
|
|
232
|
+
var gutter = 8;
|
|
233
|
+
var vw = window.innerWidth;
|
|
234
|
+
var vh = window.innerHeight;
|
|
235
|
+
var menuW = ((_a = insideSelectMenuRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || Math.max(rect.width, 128);
|
|
236
|
+
var menuH = ((_b = insideSelectMenuRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 160;
|
|
237
|
+
var left = rect.left;
|
|
238
|
+
if (left + menuW > vw - gutter)
|
|
239
|
+
left = rect.right - menuW;
|
|
240
|
+
left = Math.min(Math.max(left, gutter), Math.max(gutter, vw - menuW - gutter));
|
|
241
|
+
var top = rect.bottom;
|
|
242
|
+
var spaceBelow = vh - rect.bottom;
|
|
243
|
+
var spaceAbove = rect.top;
|
|
244
|
+
if (menuH && top + menuH > vh - gutter && spaceAbove > spaceBelow) {
|
|
245
|
+
top = rect.top - menuH;
|
|
231
246
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
247
|
+
top = Math.min(Math.max(top, gutter), Math.max(gutter, vh - menuH - gutter));
|
|
248
|
+
setCustomSelectPos({
|
|
249
|
+
top: top,
|
|
250
|
+
left: left,
|
|
251
|
+
width: menuW,
|
|
252
|
+
});
|
|
253
|
+
}, []);
|
|
254
|
+
var setInsideSelectMenuRef = (0, react_1.useCallback)(function (node) {
|
|
255
|
+
insideSelectMenuRef.current = node;
|
|
256
|
+
if (node)
|
|
257
|
+
updateInsideSelectPos();
|
|
258
|
+
}, [updateInsideSelectPos]);
|
|
259
|
+
(0, react_1.useEffect)(function () {
|
|
260
|
+
if (!customSelectOpen)
|
|
261
|
+
return;
|
|
262
|
+
updateInsideSelectPos();
|
|
263
|
+
window.addEventListener("scroll", updateInsideSelectPos, true);
|
|
264
|
+
window.addEventListener("resize", updateInsideSelectPos);
|
|
265
|
+
return function () {
|
|
266
|
+
window.removeEventListener("scroll", updateInsideSelectPos, true);
|
|
267
|
+
window.removeEventListener("resize", updateInsideSelectPos);
|
|
268
|
+
};
|
|
269
|
+
}, [customSelectOpen, updateInsideSelectPos]);
|
|
270
|
+
// Anchor the main options menu to the control (viewport-fixed). Prefer below;
|
|
271
|
+
// flip above when near the bottom; clamp horizontally within the viewport.
|
|
235
272
|
var updateDropdownPos = (0, react_1.useCallback)(function () {
|
|
273
|
+
var _a, _b;
|
|
236
274
|
if (!controlRef.current)
|
|
237
275
|
return;
|
|
238
276
|
var rect = controlRef.current.getBoundingClientRect();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
277
|
+
var gutter = 8;
|
|
278
|
+
var vw = window.innerWidth;
|
|
279
|
+
var vh = window.innerHeight;
|
|
280
|
+
var menuW = ((_a = dropdownMenuRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || rect.width;
|
|
281
|
+
var menuH = ((_b = dropdownMenuRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 320;
|
|
282
|
+
var left = rect.left;
|
|
283
|
+
if (left + menuW > vw - gutter)
|
|
284
|
+
left = rect.right - menuW;
|
|
285
|
+
left = Math.min(Math.max(left, gutter), Math.max(gutter, vw - menuW - gutter));
|
|
286
|
+
var top = rect.bottom;
|
|
287
|
+
var spaceBelow = vh - rect.bottom;
|
|
288
|
+
var spaceAbove = rect.top;
|
|
289
|
+
if (menuH && top + menuH > vh - gutter && spaceAbove > spaceBelow) {
|
|
290
|
+
top = rect.top - menuH;
|
|
291
|
+
}
|
|
292
|
+
top = Math.min(Math.max(top, gutter), Math.max(gutter, vh - menuH - gutter));
|
|
293
|
+
setDropdownPos({ top: top, left: left, width: rect.width });
|
|
244
294
|
}, []);
|
|
295
|
+
var setDropdownMenuRef = (0, react_1.useCallback)(function (node) {
|
|
296
|
+
dropdownMenuRef.current = node;
|
|
297
|
+
if (node)
|
|
298
|
+
updateDropdownPos();
|
|
299
|
+
}, [updateDropdownPos]);
|
|
245
300
|
(0, react_1.useEffect)(function () {
|
|
246
301
|
if (!isOpen)
|
|
247
302
|
return;
|
|
@@ -267,16 +322,47 @@ var SearchSelect = function (_a) {
|
|
|
267
322
|
: "0 0 0 0.125rem ".concat((_e = theme.colors.boxShadow) === null || _e === void 0 ? void 0 : _e.primary)
|
|
268
323
|
: error
|
|
269
324
|
? "0 0 0 0.125rem ".concat((_f = theme.colors.boxShadow) === null || _f === void 0 ? void 0 : _f.error)
|
|
270
|
-
: "none", transition: "box-shadow 0.2s, border-color 0.2s", onClick: function () {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
325
|
+
: "none", transition: "box-shadow 0.2s, border-color 0.2s", onClick: function () {
|
|
326
|
+
setCustomSelectOpen(false);
|
|
327
|
+
setIsOpen(true);
|
|
328
|
+
} },
|
|
329
|
+
insideSelect && (function () {
|
|
330
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
331
|
+
var insideLabel = (_a = insideSelect.value) === null || _a === void 0 ? void 0 : _a.label;
|
|
332
|
+
var insidePlaceholder = (_b = insideSelect.placeholder) !== null && _b !== void 0 ? _b : "Select";
|
|
333
|
+
return (react_1.default.createElement(react_2.Box, { position: "relative", ref: customSelectRef, flexShrink: 0, ml: s.insideSelectMarginLeft, h: "-webkit-fill-available", borderRight: "0.063rem solid", borderColor: (_d = (_c = theme.colors.boxborder) === null || _c === void 0 ? void 0 : _c[300]) !== null && _d !== void 0 ? _d : theme.colors.gray[200], bg: customSelectOpen
|
|
334
|
+
? (_g = (_f = (_e = theme.colors.primary) === null || _e === void 0 ? void 0 : _e.opacity) === null || _f === void 0 ? void 0 : _f[8]) !== null && _g !== void 0 ? _g : theme.colors.gray[100]
|
|
335
|
+
: (_j = (_h = theme.colors.background) === null || _h === void 0 ? void 0 : _h[400]) !== null && _j !== void 0 ? _j : theme.colors.white, borderRadius: "0.375rem 0 0 0.375rem", transition: "background 0.15s ease, box-shadow 0.15s ease", boxShadow: customSelectOpen
|
|
336
|
+
? "inset 0 0 0 0.063rem ".concat((_k = theme.colors.primary) === null || _k === void 0 ? void 0 : _k[500])
|
|
337
|
+
: "none", onClick: function (e) {
|
|
338
|
+
e.stopPropagation();
|
|
339
|
+
setIsOpen(false);
|
|
340
|
+
setCustomSelectOpen(function (prev) { return !prev; });
|
|
341
|
+
} },
|
|
342
|
+
react_1.default.createElement(react_2.Box, { minW: "4.5rem", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", gap: 1, width: insideSelect.width, height: insideSelectBoxHeight, pl: "0.5rem", pr: "0.375rem" },
|
|
343
|
+
insideLabel ? (react_1.default.createElement(SelectTruncatedLabel_1.default, { label: insideLabel, maxWidth: insideSelect.width || "6rem", fontSize: s.fieldFontSize })) : (react_1.default.createElement(react_2.Text, { fontSize: s.fieldFontSize, fontWeight: 500, color: (_m = (_l = theme.colors.placeholder) === null || _l === void 0 ? void 0 : _l[500]) !== null && _m !== void 0 ? _m : theme.colors.gray[500], isTruncated: true, maxW: insideSelect.width || "6rem" }, insidePlaceholder)),
|
|
344
|
+
react_1.default.createElement(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, color: customSelectOpen ? (_o = theme.colors.primary) === null || _o === void 0 ? void 0 : _o[600] : theme.colors.gray[600], transition: "transform 0.2s ease, color 0.15s ease", transform: customSelectOpen ? "rotate(180deg)" : "rotate(0deg)" },
|
|
345
|
+
react_1.default.createElement(lucide_react_1.ChevronDown, { size: s.chevronSize }))),
|
|
346
|
+
customSelectOpen && (react_1.default.createElement(react_2.Portal, null,
|
|
347
|
+
react_1.default.createElement(react_2.Box, { ref: setInsideSelectMenuRef, id: "custom-select-portal", position: "fixed", top: "".concat(customSelectPos.top, "px"), left: "".concat(customSelectPos.left, "px"), zIndex: 1510, bg: theme.colors.white, border: "0.063rem solid", borderColor: (_q = (_p = theme.colors.boxborder) === null || _p === void 0 ? void 0 : _p[200]) !== null && _q !== void 0 ? _q : theme.colors.gray[200], borderRadius: "0.5rem", boxShadow: (_s = (_r = theme.shadows) === null || _r === void 0 ? void 0 : _r.md) !== null && _s !== void 0 ? _s : "md", minW: "".concat(customSelectPos.width, "px"), maxW: "20rem", py: 1, overflow: "hidden" }, (_t = insideSelect.option) === null || _t === void 0 ? void 0 : _t.map(function (item) {
|
|
348
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
349
|
+
var selected = ((_a = insideSelect.value) === null || _a === void 0 ? void 0 : _a.id) === item.id;
|
|
350
|
+
return (react_1.default.createElement(react_2.Box, { key: item.id, display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, minH: s.optionRowMinH, py: s.optionRowPy, px: "0.75rem", fontSize: s.dropdownTextFontSize, fontWeight: selected ? 600 : 500, color: selected
|
|
351
|
+
? (_c = (_b = theme.colors.primary) === null || _b === void 0 ? void 0 : _b[700]) !== null && _c !== void 0 ? _c : (_d = theme.colors.primary) === null || _d === void 0 ? void 0 : _d[600]
|
|
352
|
+
: (_f = (_e = theme.colors.text) === null || _e === void 0 ? void 0 : _e[700]) !== null && _f !== void 0 ? _f : theme.colors.gray[800], bg: selected
|
|
353
|
+
? (_j = (_h = (_g = theme.colors.primary) === null || _g === void 0 ? void 0 : _g.opacity) === null || _h === void 0 ? void 0 : _h[8]) !== null && _j !== void 0 ? _j : theme.colors.gray[100]
|
|
354
|
+
: "transparent", _hover: {
|
|
355
|
+
bg: selected
|
|
356
|
+
? (_m = (_l = (_k = theme.colors.primary) === null || _k === void 0 ? void 0 : _k.opacity) === null || _l === void 0 ? void 0 : _l[8]) !== null && _m !== void 0 ? _m : theme.colors.gray[100]
|
|
357
|
+
: (_o = theme.colors.gray) === null || _o === void 0 ? void 0 : _o[50],
|
|
358
|
+
}, cursor: "pointer", onClick: function (e) {
|
|
359
|
+
e.stopPropagation();
|
|
360
|
+
handleCustomSelect(item);
|
|
361
|
+
} },
|
|
362
|
+
react_1.default.createElement(react_2.Text, { isTruncated: true }, item.label),
|
|
363
|
+
selected && (react_1.default.createElement(lucide_react_1.Check, { size: s.chevronSize - 2, color: (_p = theme.colors.primary) === null || _p === void 0 ? void 0 : _p[600] }))));
|
|
364
|
+
}))))));
|
|
365
|
+
})(),
|
|
280
366
|
isMultiple
|
|
281
367
|
? selectedValues
|
|
282
368
|
.slice(0, (chip === null || chip === void 0 ? void 0 : chip.maxChips) || selectedValues.length)
|
|
@@ -284,13 +370,17 @@ var SearchSelect = function (_a) {
|
|
|
284
370
|
? item.label.slice(0, chip.maxText) + "…"
|
|
285
371
|
: item.label, onIconClick: (chip === null || chip === void 0 ? void 0 : chip.onClick) ? function () { return handleRemove(item === null || item === void 0 ? void 0 : item.id); } : undefined, icon: (chip === null || chip === void 0 ? void 0 : chip.onClick) ? lucide_react_1.CircleX : undefined, colorScheme: "gray", size: s.tagSize })); })
|
|
286
372
|
: selectedValues.length === 1 &&
|
|
287
|
-
!isOpen && (react_1.default.createElement(react_2.Box, { as: "button", type: "button", onClick: function () {
|
|
373
|
+
!isOpen && (react_1.default.createElement(react_2.Box, { as: "button", type: "button", onClick: function () {
|
|
374
|
+
setCustomSelectOpen(false);
|
|
375
|
+
setIsOpen(true);
|
|
376
|
+
}, fontSize: s.fieldFontSize, color: theme.colors.gray[800], background: "transparent", border: "none", cursor: "pointer", p: 0, display: "flex", alignItems: "center", flex: "1", minW: 0 },
|
|
288
377
|
react_1.default.createElement(SelectTruncatedLabel_1.default, { label: String(selectedValues[0].label), maxWidth: "calc(100% - 2rem)", fontSize: s.fieldFontSize }))),
|
|
289
378
|
(chip === null || chip === void 0 ? void 0 : chip.maxChips) && isMultiple && selectedValues.length > chip.maxChips && (react_1.default.createElement(Tag_1.default, { key: "extra-count", label: "+ ".concat(selectedValues.length - chip.maxChips), colorScheme: "gray", size: s.tagSize })),
|
|
290
379
|
(isOpen || inputValue || !selectedValues.length) && (react_1.default.createElement(react_2.Input, { ref: inputRef, variant: "unstyled", size: size, h: s.fieldHeight, minH: s.fieldHeight, fontSize: s.fieldFontSize, flex: "1",
|
|
291
380
|
// minW="5rem"
|
|
292
381
|
minW: "0", value: inputValue, onChange: function (e) { return setInputValue(e.target.value); }, onFocus: function () {
|
|
293
382
|
setFocused(true);
|
|
383
|
+
setCustomSelectOpen(false);
|
|
294
384
|
setIsOpen(true);
|
|
295
385
|
}, onBlur: function () { return setFocused(false); }, placeholder: selectedValues.length && !isOpen ? "" : placeholder })),
|
|
296
386
|
react_1.default.createElement(react_2.Box, { position: "absolute", right: s.rightOffset, top: "50%", transform: "translateY(-50%)", display: "flex", alignItems: "center", gap: 1 },
|
|
@@ -304,10 +394,14 @@ var SearchSelect = function (_a) {
|
|
|
304
394
|
isLoading ? (react_1.default.createElement(react_2.Spinner, { size: s.spinnerSize })) : isValidIcon(rightIcon === null || rightIcon === void 0 ? void 0 : rightIcon.icon) ? (react_1.default.createElement(react_2.IconButton, { icon: rightIcon === null || rightIcon === void 0 ? void 0 : rightIcon.icon, "aria-label": "right-icon", variant: "ghost", size: s.iconButtonSize, onClick: rightIcon === null || rightIcon === void 0 ? void 0 : rightIcon.onClick })) : (react_1.default.createElement(react_2.Box, { as: "button", onClick: function (e) {
|
|
305
395
|
e.preventDefault();
|
|
306
396
|
e.stopPropagation();
|
|
307
|
-
setIsOpen(function (prev) {
|
|
397
|
+
setIsOpen(function (prev) {
|
|
398
|
+
if (!prev)
|
|
399
|
+
setCustomSelectOpen(false);
|
|
400
|
+
return !prev;
|
|
401
|
+
});
|
|
308
402
|
}, "aria-label": "toggle-dropdown", display: "flex", alignItems: "center" }, isOpen ? (react_1.default.createElement(lucide_react_1.ChevronUp, { size: s.chevronSize })) : (react_1.default.createElement(lucide_react_1.ChevronDown, { size: s.chevronSize }))))))),
|
|
309
403
|
isOpen && (react_1.default.createElement(react_2.Portal, null,
|
|
310
|
-
react_1.default.createElement(react_2.Box, { id: "searchselect-dropdown-portal", position: "
|
|
404
|
+
react_1.default.createElement(react_2.Box, { ref: setDropdownMenuRef, id: "searchselect-dropdown-portal", position: "fixed", top: "".concat(dropdownPos.top, "px"), left: "".concat(dropdownPos.left, "px"), width: "".concat(dropdownPos.width, "px"), zIndex: 1500, maxH: "20rem", borderWidth: 1, borderColor: theme.colors.gray[200], borderRadius: "sm", bg: theme.colors.white, boxShadow: "md", display: "flex", flexDirection: "column" },
|
|
311
405
|
isMultiple && isSelectAll && (react_1.default.createElement(react_2.Box, { py: s.optionRowPy, px: 3, cursor: "pointer", onClick: handleSelectAll, display: "flex", alignItems: "center", gap: 2, borderBottom: "0.063rem solid ".concat(theme.colors.gray[100]) },
|
|
312
406
|
react_1.default.createElement(Checkbox_1.default, { isChecked: allFilteredSelected, sx: { pointerEvents: "none" }, size: s.checkboxSize }),
|
|
313
407
|
react_1.default.createElement(react_2.Text, { fontSize: s.dropdownTextFontSize }, allFilteredSelected ? "Unselect All" : "Select All"))),
|
|
@@ -78,10 +78,11 @@ describe("OtherApps", function () {
|
|
|
78
78
|
beforeEach(function () {
|
|
79
79
|
jest.clearAllMocks();
|
|
80
80
|
});
|
|
81
|
-
it("
|
|
81
|
+
it("renders the section header and inline labels when expanded", function () {
|
|
82
82
|
renderWithChakra(react_1.default.createElement(OtherApps_1.default, { toggle: false, otherApps: sampleApps }));
|
|
83
|
-
expect(react_2.screen.getByText("
|
|
83
|
+
expect(react_2.screen.getByText("Switch app")).toBeInTheDocument();
|
|
84
84
|
expect(react_2.screen.getByText("Billing")).toBeInTheDocument();
|
|
85
|
+
expect(react_2.screen.getByText("Tickets")).toBeInTheDocument();
|
|
85
86
|
expect(react_2.screen.queryAllByRole("tooltip")).toHaveLength(0);
|
|
86
87
|
});
|
|
87
88
|
it("shows flyout with Open label on hover when collapsed", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
var react_1 = __importStar(require("react"));
|
|
51
|
+
var react_2 = require("@chakra-ui/react");
|
|
52
|
+
var lucide_react_1 = require("lucide-react");
|
|
53
|
+
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
54
|
+
var EmptyState_1 = __importDefault(require("../EmptyState/EmptyState"));
|
|
55
|
+
var DEFAULT_LABELS = {
|
|
56
|
+
title: "Recent Sign-in Devices",
|
|
57
|
+
browser: "Browser",
|
|
58
|
+
device: "Device",
|
|
59
|
+
recentActivity: "Recent Activity",
|
|
60
|
+
noActivity: "No recent sign-in activity",
|
|
61
|
+
};
|
|
62
|
+
var SignInActivityTable = function (_a) {
|
|
63
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
64
|
+
var devices = _a.devices, _o = _a.isLoading, isLoading = _o === void 0 ? false : _o, labelOverrides = _a.labels;
|
|
65
|
+
var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
|
|
66
|
+
var labels = (0, react_1.useMemo)(function () { return (__assign(__assign({}, DEFAULT_LABELS), labelOverrides)); }, [labelOverrides]);
|
|
67
|
+
var border = (_e = (_c = (_b = colors === null || colors === void 0 ? void 0 : colors.boxborder) === null || _b === void 0 ? void 0 : _b[200]) !== null && _c !== void 0 ? _c : (_d = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _d === void 0 ? void 0 : _d[200]) !== null && _e !== void 0 ? _e : "#E2E8F0";
|
|
68
|
+
var surface = (_f = colors === null || colors === void 0 ? void 0 : colors.white) !== null && _f !== void 0 ? _f : "#FFFFFF";
|
|
69
|
+
var muted = (_h = (_g = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _g === void 0 ? void 0 : _g[500]) !== null && _h !== void 0 ? _h : "#64748B";
|
|
70
|
+
var heading = (_k = (_j = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _j === void 0 ? void 0 : _j[800]) !== null && _k !== void 0 ? _k : "#1E293B";
|
|
71
|
+
var headBg = (_m = (_l = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _l === void 0 ? void 0 : _l[50]) !== null && _m !== void 0 ? _m : "#F8FAFC";
|
|
72
|
+
var thStyle = {
|
|
73
|
+
fontSize: "0.7rem",
|
|
74
|
+
textTransform: "uppercase",
|
|
75
|
+
letterSpacing: "0.04em",
|
|
76
|
+
color: muted,
|
|
77
|
+
borderColor: border,
|
|
78
|
+
py: 3,
|
|
79
|
+
};
|
|
80
|
+
return (react_1.default.createElement(react_2.Box, { mt: 4, backgroundColor: surface, borderRadius: "xl", border: "1px solid", borderColor: border, boxShadow: "0 1px 2px rgba(16,24,40,0.05)", overflow: "hidden" },
|
|
81
|
+
react_1.default.createElement(react_2.Flex, { px: 4, py: 3, borderBottom: "1px solid", borderColor: border, alignItems: "center" },
|
|
82
|
+
react_1.default.createElement(react_2.Heading, { size: "sm", fontWeight: 600, color: heading }, labels.title)),
|
|
83
|
+
react_1.default.createElement(react_2.Box, { overflowX: "auto" }, isLoading ? (react_1.default.createElement(react_2.VStack, { spacing: 3, p: 4, align: "stretch" }, Array.from({ length: 4 }).map(function (_, idx) { return (react_1.default.createElement(react_2.Skeleton, { key: idx, height: "18px", borderRadius: "md" })); }))) : devices.length === 0 ? (react_1.default.createElement(EmptyState_1.default, { icon: lucide_react_1.MonitorSmartphone, title: labels.noActivity, size: "sm", minH: "160px" })) : (react_1.default.createElement(react_2.Table, { variant: "simple", size: "sm" },
|
|
84
|
+
react_1.default.createElement(react_2.Thead, { bg: headBg },
|
|
85
|
+
react_1.default.createElement(react_2.Tr, null,
|
|
86
|
+
react_1.default.createElement(react_2.Th, __assign({}, thStyle), labels.browser),
|
|
87
|
+
react_1.default.createElement(react_2.Th, __assign({}, thStyle), labels.device),
|
|
88
|
+
react_1.default.createElement(react_2.Th, __assign({}, thStyle), labels.recentActivity))),
|
|
89
|
+
react_1.default.createElement(react_2.Tbody, null, devices.map(function (device, index) { return (react_1.default.createElement(react_2.Tr, { key: index, _hover: { bg: headBg }, transition: "background 0.15s ease" },
|
|
90
|
+
react_1.default.createElement(react_2.Td, { borderColor: border, fontSize: "sm", fontWeight: 500, color: heading }, device.browser || "—"),
|
|
91
|
+
react_1.default.createElement(react_2.Td, { borderColor: border, fontSize: "sm", color: muted }, device.device),
|
|
92
|
+
react_1.default.createElement(react_2.Td, { borderColor: border, fontSize: "sm", color: muted },
|
|
93
|
+
react_1.default.createElement(react_2.Text, null, device.activity)))); })))))));
|
|
94
|
+
};
|
|
95
|
+
exports.default = SignInActivityTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var react_2 = require("@testing-library/react");
|
|
8
|
+
require("@testing-library/jest-dom");
|
|
9
|
+
var react_3 = require("@chakra-ui/react");
|
|
10
|
+
var SignInActivityTable_1 = __importDefault(require("./SignInActivityTable"));
|
|
11
|
+
jest.mock("../../Theme/useCustomTheme", function () { return ({
|
|
12
|
+
useCustomTheme: function () { return ({
|
|
13
|
+
colors: {
|
|
14
|
+
white: "#ffffff",
|
|
15
|
+
gray: {
|
|
16
|
+
50: "#f8fafc",
|
|
17
|
+
100: "#f0f0f0",
|
|
18
|
+
200: "#e2e8f0",
|
|
19
|
+
500: "#64748b",
|
|
20
|
+
600: "#475569",
|
|
21
|
+
800: "#1e293b",
|
|
22
|
+
},
|
|
23
|
+
primary: { 50: "#eef2ff", 500: "#6366f1" },
|
|
24
|
+
boxborder: { 200: "#e2e8f0" },
|
|
25
|
+
},
|
|
26
|
+
}); },
|
|
27
|
+
}); });
|
|
28
|
+
beforeAll(function () {
|
|
29
|
+
Object.defineProperty(window, "matchMedia", {
|
|
30
|
+
writable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
value: jest.fn().mockImplementation(function (query) { return ({
|
|
33
|
+
matches: false,
|
|
34
|
+
media: query,
|
|
35
|
+
onchange: null,
|
|
36
|
+
addListener: jest.fn(),
|
|
37
|
+
removeListener: jest.fn(),
|
|
38
|
+
addEventListener: jest.fn(),
|
|
39
|
+
removeEventListener: jest.fn(),
|
|
40
|
+
dispatchEvent: jest.fn(),
|
|
41
|
+
}); }),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
var devices = [
|
|
45
|
+
{ browser: "Chrome", device: "MacBook Pro", activity: "2 minutes ago" },
|
|
46
|
+
{ browser: "Safari", device: "iPhone 15", activity: "Yesterday" },
|
|
47
|
+
];
|
|
48
|
+
var renderWithChakra = function (ui) {
|
|
49
|
+
return (0, react_2.render)(react_1.default.createElement(react_3.ChakraProvider, null, ui));
|
|
50
|
+
};
|
|
51
|
+
describe("SignInActivityTable", function () {
|
|
52
|
+
it("renders the device rows", function () {
|
|
53
|
+
renderWithChakra(react_1.default.createElement(SignInActivityTable_1.default, { devices: devices }));
|
|
54
|
+
expect(react_2.screen.getByText("Recent Sign-in Devices")).toBeInTheDocument();
|
|
55
|
+
expect(react_2.screen.getByText("Chrome")).toBeInTheDocument();
|
|
56
|
+
expect(react_2.screen.getByText("MacBook Pro")).toBeInTheDocument();
|
|
57
|
+
expect(react_2.screen.getByText("2 minutes ago")).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
it("shows an empty state when there is no activity", function () {
|
|
60
|
+
renderWithChakra(react_1.default.createElement(SignInActivityTable_1.default, { devices: [] }));
|
|
61
|
+
expect(react_2.screen.getByText("No recent sign-in activity")).toBeInTheDocument();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type SignInDevice = {
|
|
2
|
+
browser: string;
|
|
3
|
+
device: string;
|
|
4
|
+
activity: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* All user-facing strings. Provide translated values from the host app; every
|
|
8
|
+
* key has a sensible English default so the component works standalone.
|
|
9
|
+
*/
|
|
10
|
+
export type SignInActivityLabels = {
|
|
11
|
+
title?: string;
|
|
12
|
+
browser?: string;
|
|
13
|
+
device?: string;
|
|
14
|
+
recentActivity?: string;
|
|
15
|
+
noActivity?: string;
|
|
16
|
+
};
|
|
17
|
+
export interface SignInActivityTableProps {
|
|
18
|
+
devices: SignInDevice[];
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
labels?: SignInActivityLabels;
|
|
21
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
var react_1 = __importStar(require("react"));
|
|
51
|
+
var react_2 = require("@chakra-ui/react");
|
|
52
|
+
var lucide_react_1 = require("lucide-react");
|
|
53
|
+
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
54
|
+
var ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
|
|
55
|
+
var StageProgressProps_1 = require("./StageProgressProps");
|
|
56
|
+
var sizeMap = {
|
|
57
|
+
sm: { arrow: 12, minW: "120px", h: "28px", px: 3, font: "0.75rem", icon: 12 },
|
|
58
|
+
md: { arrow: 16, minW: "160px", h: "36px", px: 4, font: "0.875rem", icon: 14 },
|
|
59
|
+
lg: { arrow: 20, minW: "200px", h: "44px", px: 5, font: "1rem", icon: 16 },
|
|
60
|
+
};
|
|
61
|
+
var clipFor = function (index, total, a) {
|
|
62
|
+
var isFirst = index === 0;
|
|
63
|
+
var isLast = index === total - 1;
|
|
64
|
+
if (total === 1)
|
|
65
|
+
return "none";
|
|
66
|
+
if (isFirst)
|
|
67
|
+
return "polygon(0 0, calc(100% - ".concat(a, "px) 0, 100% 50%, calc(100% - ").concat(a, "px) 100%, 0 100%)");
|
|
68
|
+
if (isLast)
|
|
69
|
+
return "polygon(0 0, 100% 0, 100% 100%, 0 100%, ".concat(a, "px 50%)");
|
|
70
|
+
return "polygon(0 0, calc(100% - ".concat(a, "px) 0, 100% 50%, calc(100% - ").concat(a, "px) 100%, 0 100%, ").concat(a, "px 50%)");
|
|
71
|
+
};
|
|
72
|
+
var StageItem = function (_a) {
|
|
73
|
+
var _b;
|
|
74
|
+
var label = _a.label, index = _a.index, total = _a.total, state = _a.state, _c = _a.variant, variant = _c === void 0 ? "chevron" : _c, _d = _a.size, size = _d === void 0 ? "md" : _d, _e = _a.colorScheme, colorScheme = _e === void 0 ? "primary" : _e, onClick = _a.onClick, _f = _a.isReadOnly, isReadOnly = _f === void 0 ? false : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.showCheck, showCheck = _h === void 0 ? false : _h, minWidth = _a.minWidth, _j = _a.scrollIntoViewWhenActive, scrollIntoViewWhenActive = _j === void 0 ? true : _j, _k = _a.tooltipThreshold, tooltipThreshold = _k === void 0 ? 20 : _k;
|
|
75
|
+
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
76
|
+
var palette = (0, StageProgressProps_1.resolveStagePalette)(theme, colorScheme);
|
|
77
|
+
var ref = (0, react_1.useRef)(null);
|
|
78
|
+
var s = sizeMap[size];
|
|
79
|
+
(0, react_1.useEffect)(function () {
|
|
80
|
+
if (state === "active" && scrollIntoViewWhenActive && ref.current) {
|
|
81
|
+
ref.current.scrollIntoView({
|
|
82
|
+
behavior: "smooth",
|
|
83
|
+
inline: "center",
|
|
84
|
+
block: "nearest",
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, [state, scrollIntoViewWhenActive]);
|
|
88
|
+
var bg = state === "active"
|
|
89
|
+
? palette.strong
|
|
90
|
+
: state === "completed"
|
|
91
|
+
? palette.soft
|
|
92
|
+
: palette.muted;
|
|
93
|
+
var color = state === "active"
|
|
94
|
+
? palette.onStrong
|
|
95
|
+
: state === "completed"
|
|
96
|
+
? palette.softText
|
|
97
|
+
: palette.mutedText;
|
|
98
|
+
var interactive = !isReadOnly && !disabled;
|
|
99
|
+
var isFirst = index === 0;
|
|
100
|
+
var isLast = index === total - 1;
|
|
101
|
+
var isChevron = variant === "chevron";
|
|
102
|
+
// Chevron pads extra on the left to clear the inbound notch and on the right
|
|
103
|
+
// to keep text clear of the outgoing arrow point; others are centered.
|
|
104
|
+
var leftPad = isChevron && !isFirst ? s.arrow + s.px * 4 : s.px * 2;
|
|
105
|
+
var rightPad = isChevron ? s.arrow + s.px * 4 : s.px * 2;
|
|
106
|
+
// Chevron overlaps into the previous point, leaving a thin 2px divider.
|
|
107
|
+
var overlap = isChevron && !isFirst ? -(s.arrow - 2) : 0;
|
|
108
|
+
var clipPath = isChevron ? clipFor(index, total, s.arrow) : "none";
|
|
109
|
+
var borderRadius = variant === "pills"
|
|
110
|
+
? "full"
|
|
111
|
+
: variant === "bar"
|
|
112
|
+
? isFirst && isLast
|
|
113
|
+
? "8px"
|
|
114
|
+
: isFirst
|
|
115
|
+
? "8px 2px 2px 8px"
|
|
116
|
+
: isLast
|
|
117
|
+
? "2px 8px 8px 2px"
|
|
118
|
+
: "2px"
|
|
119
|
+
: "0";
|
|
120
|
+
// Upcoming pills read as outlined; other states stay filled.
|
|
121
|
+
var isOutlinePill = variant === "pills" && state === "upcoming";
|
|
122
|
+
var hoverStyles = interactive
|
|
123
|
+
? state === "active"
|
|
124
|
+
? { bg: palette.hover }
|
|
125
|
+
: { bg: palette.strong, color: palette.onStrong, borderColor: palette.strong }
|
|
126
|
+
: undefined;
|
|
127
|
+
var showTooltip = ((_b = label === null || label === void 0 ? void 0 : label.length) !== null && _b !== void 0 ? _b : 0) > tooltipThreshold;
|
|
128
|
+
var content = (react_1.default.createElement(react_2.Box, { ref: ref, role: interactive ? "button" : undefined, "aria-current": state === "active" ? "step" : undefined, onClick: interactive ? onClick : undefined, flexShrink: 0, minWidth: minWidth || s.minW, height: s.h, ml: "".concat(overlap, "px"), pl: "".concat(leftPad, "px"), pr: "".concat(rightPad, "px"), bg: isOutlinePill ? "transparent" : bg, color: isOutlinePill ? palette.mutedText : color, border: isOutlinePill ? "1px solid" : undefined, borderColor: isOutlinePill ? palette.muted : undefined, borderRadius: borderRadius, fontSize: s.font, fontWeight: state === "active" ? 600 : 500, display: "flex", alignItems: "center", justifyContent: isChevron ? "flex-start" : "center", cursor: interactive ? "pointer" : "default", opacity: disabled ? 0.55 : 1, transition: "background 0.18s ease, color 0.18s ease, filter 0.18s ease, border-color 0.18s ease", sx: { clipPath: clipPath }, _hover: interactive ? __assign(__assign({}, hoverStyles), { filter: "brightness(0.97)" }) : undefined },
|
|
129
|
+
react_1.default.createElement(react_2.Flex, { align: "center", justify: isChevron ? "flex-start" : "center", gap: "6px", width: "100%", minW: 0 },
|
|
130
|
+
showCheck && state === "completed" && (react_1.default.createElement(lucide_react_1.Check, { size: s.icon, style: { flexShrink: 0 } })),
|
|
131
|
+
react_1.default.createElement(react_2.Box, { as: "span", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", textAlign: "center", flex: "1" }, label))));
|
|
132
|
+
if (showTooltip) {
|
|
133
|
+
return (react_1.default.createElement(ToolTip_1.default, { label: label, placement: "top", openDelay: 300 }, content));
|
|
134
|
+
}
|
|
135
|
+
return content;
|
|
136
|
+
};
|
|
137
|
+
exports.default = StageItem;
|