@mezzanine-ui/react 1.0.0-beta.1 → 1.0.0-beta.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/Anchor/Anchor.d.ts +51 -18
- package/Anchor/Anchor.js +15 -15
- package/Anchor/AnchorGroup.d.ts +34 -0
- package/Anchor/AnchorGroup.js +37 -0
- package/Anchor/AnchorItem.d.ts +30 -0
- package/Anchor/AnchorItem.js +65 -0
- package/Anchor/index.d.ts +2 -0
- package/Anchor/index.js +1 -0
- package/Anchor/utils.d.ts +13 -0
- package/Anchor/utils.js +95 -0
- package/AutoComplete/AutoComplete.d.ts +194 -0
- package/AutoComplete/AutoComplete.js +419 -0
- package/AutoComplete/index.d.ts +2 -0
- package/AutoComplete/index.js +1 -0
- package/AutoComplete/useAutoCompleteCreation.d.ts +33 -0
- package/AutoComplete/useAutoCompleteCreation.js +201 -0
- package/AutoComplete/useAutoCompleteKeyboard.d.ts +31 -0
- package/AutoComplete/useAutoCompleteKeyboard.js +149 -0
- package/AutoComplete/useAutoCompleteSearch.d.ts +16 -0
- package/AutoComplete/useAutoCompleteSearch.js +69 -0
- package/AutoComplete/useCreationTracker.d.ts +17 -0
- package/AutoComplete/useCreationTracker.js +47 -0
- package/Badge/Badge.js +2 -2
- package/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/Button/Button.js +13 -11
- package/Button/index.d.ts +1 -1
- package/Button/typings.d.ts +27 -4
- package/Description/Description.d.ts +30 -0
- package/Description/Description.js +13 -0
- package/Description/DescriptionContent.d.ts +41 -0
- package/Description/DescriptionContent.js +14 -0
- package/Description/DescriptionGroup.d.ts +13 -0
- package/Description/DescriptionGroup.js +12 -0
- package/Description/DescriptionTitle.d.ts +45 -0
- package/Description/DescriptionTitle.js +17 -0
- package/Description/index.d.ts +8 -0
- package/Description/index.js +4 -0
- package/Dropdown/Dropdown.d.ts +43 -3
- package/Dropdown/Dropdown.js +154 -35
- package/Dropdown/DropdownAction.d.ts +1 -1
- package/Dropdown/DropdownAction.js +1 -4
- package/Dropdown/DropdownItem.d.ts +21 -4
- package/Dropdown/DropdownItem.js +23 -10
- package/Dropdown/DropdownItemCard.d.ts +5 -5
- package/Dropdown/DropdownItemCard.js +11 -10
- package/Dropdown/DropdownStatus.d.ts +2 -2
- package/Dropdown/DropdownStatus.js +29 -0
- package/Dropdown/dropdownKeydownHandler.d.ts +2 -1
- package/Dropdown/dropdownKeydownHandler.js +73 -0
- package/Dropdown/highlightText.js +5 -1
- package/Dropdown/shortcutTextHandler.d.ts +24 -0
- package/Dropdown/shortcutTextHandler.js +171 -0
- package/Form/FormControlContext.d.ts +2 -2
- package/Form/FormField.d.ts +56 -4
- package/Form/FormField.js +10 -6
- package/Form/FormHintText.d.ts +24 -1
- package/Form/FormHintText.js +4 -4
- package/Form/FormLabel.d.ts +6 -3
- package/Form/FormLabel.js +5 -3
- package/Input/Input.d.ts +29 -3
- package/Input/Input.js +22 -6
- package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.js +1 -1
- package/Modal/Modal.d.ts +103 -11
- package/Modal/Modal.js +14 -9
- package/Modal/ModalBodyForVerification.d.ts +59 -0
- package/Modal/ModalBodyForVerification.js +99 -0
- package/Modal/ModalControl.d.ts +2 -2
- package/Modal/ModalControl.js +1 -1
- package/Modal/ModalFooter.d.ts +119 -1
- package/Modal/ModalFooter.js +15 -3
- package/Modal/ModalHeader.d.ts +26 -7
- package/Modal/ModalHeader.js +33 -7
- package/Modal/index.d.ts +4 -5
- package/Modal/index.js +1 -2
- package/Modal/useModalContainer.d.ts +12 -3
- package/Modal/useModalContainer.js +28 -6
- package/Navigation/CollapsedMenu.d.ts +6 -0
- package/Navigation/CollapsedMenu.js +16 -0
- package/Navigation/Navigation.d.ts +17 -3
- package/Navigation/Navigation.js +48 -33
- package/Navigation/NavigationFooter.js +4 -2
- package/Navigation/NavigationHeader.d.ts +11 -1
- package/Navigation/NavigationHeader.js +6 -3
- package/Navigation/NavigationOption.d.ts +3 -2
- package/Navigation/NavigationOption.js +45 -26
- package/Navigation/NavigationOptionCategory.js +20 -2
- package/Navigation/context.d.ts +2 -0
- package/Navigation/useVisibleItems.d.ts +5 -0
- package/Navigation/useVisibleItems.js +54 -0
- package/NotificationCenter/NotificationCenter.d.ts +124 -0
- package/NotificationCenter/NotificationCenter.js +259 -0
- package/NotificationCenter/NotificationCenterDrawer.d.ts +89 -0
- package/NotificationCenter/index.d.ts +3 -0
- package/NotificationCenter/index.js +1 -0
- package/PageFooter/PageFooter.d.ts +19 -9
- package/PageFooter/PageFooter.js +10 -10
- package/PageHeader/PageHeader.js +4 -12
- package/PageToolbar/PageToolbar.d.ts +2 -6
- package/PageToolbar/utils.js +4 -12
- package/Select/index.d.ts +0 -2
- package/Select/index.js +0 -1
- package/Slider/useSlider.js +1 -1
- package/Table/Table.d.ts +53 -15
- package/Table/Table.js +178 -82
- package/Table/TableContext.d.ts +18 -42
- package/Table/components/TableActionsCell.d.ts +26 -0
- package/Table/components/TableActionsCell.js +78 -0
- package/Table/components/TableBody.d.ts +2 -5
- package/Table/components/TableBody.js +16 -19
- package/Table/components/TableBulkActions.d.ts +15 -0
- package/Table/components/TableBulkActions.js +26 -0
- package/Table/components/TableCell.d.ts +2 -0
- package/Table/components/TableCell.js +42 -10
- package/Table/components/TableColGroup.js +10 -112
- package/Table/components/TableColumnTitleMenu.d.ts +6 -0
- package/Table/components/TableColumnTitleMenu.js +20 -0
- package/Table/components/TableDragHandleCell.d.ts +2 -0
- package/Table/components/TableDragHandleCell.js +8 -1
- package/Table/components/TableExpandCell.d.ts +2 -0
- package/Table/components/TableExpandCell.js +8 -1
- package/Table/components/TableExpandedRow.js +3 -2
- package/Table/components/TableHeader.d.ts +2 -4
- package/Table/components/TableHeader.js +11 -14
- package/Table/components/TableResizeHandle.js +3 -7
- package/Table/components/TableRow.js +54 -20
- package/Table/components/TableSelectionCell.d.ts +5 -0
- package/Table/components/TableSelectionCell.js +12 -1
- package/Table/components/index.d.ts +1 -0
- package/Table/components/index.js +1 -0
- package/Table/hooks/index.d.ts +1 -1
- package/Table/hooks/index.js +1 -1
- package/Table/hooks/useTableDataSource.d.ts +2 -2
- package/Table/hooks/useTableExpansion.js +0 -6
- package/Table/hooks/useTableFixedOffsets.d.ts +1 -1
- package/Table/hooks/useTableFixedOffsets.js +24 -26
- package/Table/hooks/useTableResizedColumns.d.ts +2 -0
- package/Table/hooks/useTableResizedColumns.js +22 -0
- package/Table/hooks/useTableScroll.d.ts +3 -1
- package/Table/hooks/useTableScroll.js +25 -19
- package/Table/hooks/useTableSelection.js +32 -8
- package/Table/hooks/useTableVirtualization.d.ts +1 -1
- package/Table/index.d.ts +4 -4
- package/Table/index.js +5 -3
- package/Table/utils/calculateColumnWidths.d.ts +28 -0
- package/Table/utils/calculateColumnWidths.js +80 -0
- package/Table/utils/index.d.ts +2 -0
- package/Table/utils/index.js +1 -0
- package/Table/utils/useTableRowSelection.d.ts +5 -5
- package/Table/utils/useTableRowSelection.js +14 -6
- package/Tag/TagGroup.d.ts +3 -0
- package/Tag/index.d.ts +2 -0
- package/Tag/index.js +1 -0
- package/Upload/UploadPictureCard.js +1 -1
- package/index.d.ts +36 -20
- package/index.js +26 -7
- package/package.json +4 -4
- package/utils/format-number-with-commas.d.ts +4 -0
- package/utils/format-number-with-commas.js +27 -0
- package/utils/parse-number-with-commas.d.ts +4 -0
- package/utils/parse-number-with-commas.js +22 -0
- package/Modal/ModalActions.d.ts +0 -9
- package/Modal/ModalActions.js +0 -20
- package/Modal/ModalBody.d.ts +0 -7
- package/Modal/ModalBody.js +0 -14
- package/Notification/Notification.d.ts +0 -54
- package/Notification/Notification.js +0 -76
- package/Notification/index.d.ts +0 -3
- package/Notification/index.js +0 -1
- package/Select/AutoComplete.d.ts +0 -107
- package/Select/AutoComplete.js +0 -114
- package/Table/hooks/useTableColumns.d.ts +0 -8
- package/Table/hooks/useTableColumns.js +0 -91
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
3
|
-
import { DRAG_HANDLE_COLUMN_WIDTH, EXPANSION_COLUMN_WIDTH, SELECTION_COLUMN_WIDTH } from '@mezzanine-ui/core/table';
|
|
4
|
-
|
|
5
|
-
function useTableColumns({ actionConfig, columns, }) {
|
|
6
|
-
const { dragHandleFixed, expansionFixed, selectionFixed } = actionConfig;
|
|
7
|
-
const [resizedColumnWidths, setResizedColumnWidths] = useState(new Map());
|
|
8
|
-
const parseFixed = (fixed) => {
|
|
9
|
-
if (fixed === true || fixed === 'start')
|
|
10
|
-
return 'start';
|
|
11
|
-
if (fixed === 'end')
|
|
12
|
-
return 'end';
|
|
13
|
-
return null;
|
|
14
|
-
};
|
|
15
|
-
const { fixedEndColumns, fixedStartColumns, scrollableColumns } = useMemo(() => {
|
|
16
|
-
const start = [];
|
|
17
|
-
const end = [];
|
|
18
|
-
const scrollable = [];
|
|
19
|
-
columns.forEach((col) => {
|
|
20
|
-
const fixedPos = parseFixed(col.fixed);
|
|
21
|
-
if (fixedPos === 'start') {
|
|
22
|
-
start.push(col);
|
|
23
|
-
}
|
|
24
|
-
else if (fixedPos === 'end') {
|
|
25
|
-
end.push(col);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
scrollable.push(col);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
fixedEndColumns: end,
|
|
33
|
-
fixedStartColumns: start,
|
|
34
|
-
scrollableColumns: scrollable,
|
|
35
|
-
};
|
|
36
|
-
}, [columns]);
|
|
37
|
-
const totalFixedStartWidth = useMemo(() => {
|
|
38
|
-
let width = 0;
|
|
39
|
-
if (dragHandleFixed) {
|
|
40
|
-
width += DRAG_HANDLE_COLUMN_WIDTH;
|
|
41
|
-
}
|
|
42
|
-
if (expansionFixed) {
|
|
43
|
-
width += EXPANSION_COLUMN_WIDTH;
|
|
44
|
-
}
|
|
45
|
-
if (selectionFixed) {
|
|
46
|
-
width += SELECTION_COLUMN_WIDTH;
|
|
47
|
-
}
|
|
48
|
-
fixedStartColumns.forEach((col) => {
|
|
49
|
-
var _a, _b;
|
|
50
|
-
width += (_b = (_a = resizedColumnWidths.get(col.key)) !== null && _a !== void 0 ? _a : col.width) !== null && _b !== void 0 ? _b : 0;
|
|
51
|
-
});
|
|
52
|
-
return width;
|
|
53
|
-
}, [
|
|
54
|
-
selectionFixed,
|
|
55
|
-
expansionFixed,
|
|
56
|
-
dragHandleFixed,
|
|
57
|
-
fixedStartColumns,
|
|
58
|
-
resizedColumnWidths,
|
|
59
|
-
]);
|
|
60
|
-
const totalFixedEndWidth = useMemo(() => {
|
|
61
|
-
let width = 0;
|
|
62
|
-
fixedEndColumns.forEach((col) => {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
width += (_b = (_a = resizedColumnWidths.get(col.key)) !== null && _a !== void 0 ? _a : col.width) !== null && _b !== void 0 ? _b : 0;
|
|
65
|
-
});
|
|
66
|
-
return width;
|
|
67
|
-
}, [fixedEndColumns, resizedColumnWidths]);
|
|
68
|
-
const getResizedColumnWidth = useCallback((key) => {
|
|
69
|
-
return resizedColumnWidths.get(key);
|
|
70
|
-
}, [resizedColumnWidths]);
|
|
71
|
-
const setResizedColumnWidth = useCallback((key, width) => {
|
|
72
|
-
setResizedColumnWidths((prev) => {
|
|
73
|
-
const next = new Map(prev);
|
|
74
|
-
next.set(key, width);
|
|
75
|
-
return next;
|
|
76
|
-
});
|
|
77
|
-
}, []);
|
|
78
|
-
return {
|
|
79
|
-
resizedColumnWidths,
|
|
80
|
-
columns: columns,
|
|
81
|
-
fixedEndColumns,
|
|
82
|
-
fixedStartColumns,
|
|
83
|
-
getResizedColumnWidth,
|
|
84
|
-
scrollableColumns,
|
|
85
|
-
setResizedColumnWidth,
|
|
86
|
-
totalFixedEndWidth,
|
|
87
|
-
totalFixedStartWidth,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export { useTableColumns };
|