@mailstep/design-system 0.7.76 → 0.7.77-beta.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/package.json +1 -1
- package/ui/Blocks/CommonGrid/CommonGridContainer.js +5 -3
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.js +2 -2
- package/ui/Blocks/CommonGrid/types.d.ts +3 -1
- package/ui/Blocks/CommonGrid/utils/getExtendedExtraControlButtons.d.ts +3 -0
- package/ui/Blocks/CommonGrid/utils/getExtendedExtraControlButtons.js +23 -0
- package/ui/Blocks/CornerDialog/CornerDialog.js +1 -1
- package/ui/Blocks/Tabs/Tabs.js +1 -1
- package/ui/Elements/Button/types.d.ts +2 -0
- package/ui/Elements/Icon/icons/Reload.d.ts +4 -0
- package/ui/Elements/Icon/icons/Reload.js +13 -0
- package/ui/Elements/Icon/icons/index.d.ts +1 -0
- package/ui/Elements/Icon/icons/index.js +1 -0
- package/ui/index.es.js +8217 -8197
- package/ui/index.umd.js +384 -384
package/package.json
CHANGED
|
@@ -34,6 +34,7 @@ import useEditReadAsColumn from './hooks/useEditReadAsColumn';
|
|
|
34
34
|
import { useGridAutoRowsPerPage } from './hooks/useGridAutoRowsPerPage';
|
|
35
35
|
import useManageColumn from './hooks/useManageColumn';
|
|
36
36
|
import { usePresetState } from './hooks/usePresetsState';
|
|
37
|
+
import { getExtendedExtraControlButtons } from './utils/getExtendedExtraControlButtons';
|
|
37
38
|
import { getRowsPerPage } from './utils/getRowsPerPage';
|
|
38
39
|
import { hasSortTerminated } from './utils/hasSortTerminated';
|
|
39
40
|
import { x } from '@xstyled/styled-components';
|
|
@@ -41,11 +42,12 @@ import { CommonGridWithStyles, BottomWrapper, CommonGridWrap, ContentContainer,
|
|
|
41
42
|
import { getFilters } from './utils';
|
|
42
43
|
var CommonGridContainer = function (props) {
|
|
43
44
|
var _a;
|
|
44
|
-
var _b = props.optimizeFilters, optimizeFilters = _b === void 0 ? false : _b, extraControlButtons = props.extraControlButtons, onBatchAction = props.onBatchAction, processCheckedValues = props.processCheckedValues, processCheckedValuesTitle = props.processCheckedValuesTitle, hideControlButtons = props.hideControlButtons, quickFilter = props.quickFilter, floatingButtonProps = props.floatingButtonProps, queryRowsParam = props.queryRowsParam, customPaginationHandler = props.customPaginationHandler, _c = props.autoHeight, autoHeight = _c === void 0 ? true : _c, gridName = props.gridName, _d = props.withPresets, withPresets = _d === void 0 ? true : _d, _e = props.withManageColumnButton, withManageColumnButton = _e === void 0 ? true : _e, _f = props.withPagination, withPagination = _f === void 0 ? true : _f, allowSortingOnlyUnderTotalRows = props.allowSortingOnlyUnderTotalRows, passDownProps = __rest(props, ["optimizeFilters", "extraControlButtons", "onBatchAction", "processCheckedValues", "processCheckedValuesTitle", "hideControlButtons", "quickFilter", "floatingButtonProps", "queryRowsParam", "customPaginationHandler", "autoHeight", "gridName", "withPresets", "withManageColumnButton", "withPagination", "allowSortingOnlyUnderTotalRows"]);
|
|
45
|
+
var _b = props.optimizeFilters, optimizeFilters = _b === void 0 ? false : _b, extraControlButtons = props.extraControlButtons, onBatchAction = props.onBatchAction, processCheckedValues = props.processCheckedValues, processCheckedValuesTitle = props.processCheckedValuesTitle, hideControlButtons = props.hideControlButtons, quickFilter = props.quickFilter, floatingButtonProps = props.floatingButtonProps, queryRowsParam = props.queryRowsParam, customPaginationHandler = props.customPaginationHandler, _c = props.autoHeight, autoHeight = _c === void 0 ? true : _c, gridName = props.gridName, _d = props.withPresets, withPresets = _d === void 0 ? true : _d, _e = props.withManageColumnButton, withManageColumnButton = _e === void 0 ? true : _e, _f = props.withPagination, withPagination = _f === void 0 ? true : _f, allowSortingOnlyUnderTotalRows = props.allowSortingOnlyUnderTotalRows, onReload = props.onReload, passDownProps = __rest(props, ["optimizeFilters", "extraControlButtons", "onBatchAction", "processCheckedValues", "processCheckedValuesTitle", "hideControlButtons", "quickFilter", "floatingButtonProps", "queryRowsParam", "customPaginationHandler", "autoHeight", "gridName", "withPresets", "withManageColumnButton", "withPagination", "allowSortingOnlyUnderTotalRows", "onReload"]);
|
|
45
46
|
var gridActions = passDownProps.gridActions, gridSelectors = passDownProps.gridSelectors, rowsData = passDownProps.rowsData, actionColumnDefinition = passDownProps.actionColumnDefinition;
|
|
47
|
+
var extendedExtraControlButtons = useMemo(function () { return getExtendedExtraControlButtons(extraControlButtons, onReload); }, [extraControlButtons, onReload]);
|
|
46
48
|
var _g = useState(false), displayManageColumnButton = _g[0], setDisplayManageColumnButton = _g[1];
|
|
47
49
|
var gridRef = useRef(null);
|
|
48
|
-
var withButtonStrip = !!(
|
|
50
|
+
var withButtonStrip = !!(extendedExtraControlButtons === null || extendedExtraControlButtons === void 0 ? void 0 : extendedExtraControlButtons.length) || !hideControlButtons || !!withPresets || !!withManageColumnButton;
|
|
49
51
|
var hasGroups = !!props.columnsDefinitions.find(function (col) { return col.group; });
|
|
50
52
|
var hasFilters = !!props.columnsDefinitions.find(function (col) { return col.filtering; });
|
|
51
53
|
var hasGroupsOrFilters = hasGroups || hasFilters;
|
|
@@ -72,6 +74,6 @@ var CommonGridContainer = function (props) {
|
|
|
72
74
|
allowSortingOnlyUnderTotalRows: allowSortingOnlyUnderTotalRows,
|
|
73
75
|
totalRowsCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount
|
|
74
76
|
}), isSortTerminatedAppeal = _l.isSortTerminatedAppeal, isSortTerminated = _l.isSortTerminated;
|
|
75
|
-
return (_jsxs(_Fragment, { children: [_jsxs(ContentContainer, { ref: gridRef, children: [_jsxs(CommonGridWrap, { withPagination: withPagination, children: [withButtonStrip && (_jsx(HidePrint, { children: _jsx(StyledButtonStrip, { className: "buttonsStrip", children: _jsx(ControlButtons, { hideControlButtons: hideControlButtons, extraControlButtons:
|
|
77
|
+
return (_jsxs(_Fragment, { children: [_jsxs(ContentContainer, { ref: gridRef, children: [_jsxs(CommonGridWrap, { withPagination: withPagination, children: [withButtonStrip && (_jsx(HidePrint, { children: _jsx(StyledButtonStrip, { className: "buttonsStrip", children: _jsx(ControlButtons, { hideControlButtons: hideControlButtons, extraControlButtons: extendedExtraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, quickFilter: quickFilter, displayColumnsDefinitions: displayColumnsDefinitions, filters: filters, setDisplayManageColumnButton: setDisplayManageColumnButton, displayManageColumnButton: displayManageColumnButton, openManageColumnForm: openManageColumnForm, onOpenPresetsModal: onOpenPresetsModal, selectedPresetName: selectedPresetName, withPresets: withPresets, gridName: gridName, withManageColumnButton: withManageColumnButton }) }) })), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { withButtonStrip: withButtonStrip, hasGroupsOrFilters: hasGroupsOrFilters, filters: filters, floatingButtonProps: floatingButtonProps, handleDragEnd: handleDragEnd(false), displayColumnsDefinitions: displayColumnsDefinitions, hasFilters: hasFilters, hasGroups: hasGroups, isSortTerminated: isSortTerminated, hasColouredRows: true }))] }), _jsxs(BottomWrapper, { withPagination: withPagination, children: [(processCheckedValues || !!((_a = actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.actionOptions) === null || _a === void 0 ? void 0 : _a.length)) && (_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionOptions: actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.actionOptions, processCheckedValues: processCheckedValues, processCheckedValuesTitle: processCheckedValuesTitle })), _jsxs(x.div, { display: "flex", justifyContent: "space-between", alignItems: "center", w: "100%", children: [_jsx(GridInfo, { isSortTerminatedAppeal: isSortTerminatedAppeal, isSortTerminated: isSortTerminated }), withPagination && (_jsxs(x.div, { display: "flex", alignItems: "center", className: "paginatorWrapper", children: [_jsx(Pagination, { page: gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.page, itemCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount, itemPerPage: (gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.rowsPerPage) || 10, onPageChange: gridActions === null || gridActions === void 0 ? void 0 : gridActions.setPage, customPaginationHandler: customPaginationHandler, radius: window.innerWidth < 768 ? 3 : 5, rate: window.innerWidth < 768 ? 1 : 4 }), _jsx(TablePagination, { gridActions: gridActions, gridSelectors: gridSelectors, customPaginationHandler: customPaginationHandler, autoRowsPerPage: autoRowsPerPage })] }))] })] })] }), _jsx(GridModals, { manageColumnFormVisible: manageColumnFormVisible, onCloseForm: onCloseForm, resetColumnConfig: resetColumnConfig, onConfirmForm: onConfirmForm, manageColumnsFormDefinitions: manageColumnsFormDefinitions, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, handleDragEnd: handleDragEnd(true), gridName: gridName, gridActions: gridActions, gridSelectors: gridSelectors, onClosePresetsModal: onClosePresetsModal, isPresetsModalOpen: isPresetsModalOpen, selectedPresetName: selectedPresetName, setSelectedPresetName: setSelectedPresetName })] }));
|
|
76
78
|
};
|
|
77
79
|
export default CommonGridContainer;
|
|
@@ -20,7 +20,7 @@ import styled, { x } from '@xstyled/styled-components';
|
|
|
20
20
|
export var Row = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n & > * {\n margin-right: 12px;\n }\n z-index: 2;\n"], ["\n display: flex;\n & > * {\n margin-right: 12px;\n }\n z-index: 2;\n"])));
|
|
21
21
|
var StyledButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: none;\n\n @media (min-width: 1024px) {\n display: block;\n }\n"], ["\n display: none;\n\n @media (min-width: 1024px) {\n display: block;\n }\n"])));
|
|
22
22
|
var ControlButton = function (_a) {
|
|
23
|
-
var hide = _a.hide, node = _a.node, label = _a.label, appearance = _a.appearance, variant = _a.variant, disabled = _a.disabled, onClick = _a.onClick, onSelect = _a.onSelect, options = _a.options, hideChevron = _a.hideChevron, iconLeft = _a.iconLeft;
|
|
23
|
+
var hide = _a.hide, node = _a.node, label = _a.label, appearance = _a.appearance, variant = _a.variant, disabled = _a.disabled, onClick = _a.onClick, onSelect = _a.onSelect, options = _a.options, hideChevron = _a.hideChevron, iconLeft = _a.iconLeft, buttonProps = _a.buttonProps;
|
|
24
24
|
if (hide) {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
@@ -30,7 +30,7 @@ var ControlButton = function (_a) {
|
|
|
30
30
|
return (_jsx(DropdownSelect, { label: label || '', appearance: appearance || 'secondary', variant: variant || 'default', options: options, showChevron: !hideChevron, onSelect: onSelect, disabled: disabled }));
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
return (_jsx(StyledButton, { type: "button", onClick: onClick, disabled: disabled, variant: variant || 'default', appearance: appearance || 'primary', iconLeft: iconLeft, children: label }));
|
|
33
|
+
return (_jsx(StyledButton, __assign({ type: "button", onClick: onClick, disabled: disabled, variant: variant || 'default', appearance: appearance || 'primary', iconLeft: iconLeft }, buttonProps, { children: label })));
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
var ExtraControlButtons = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppearanceValue, VariantValue } from '../../Elements/Button/types';
|
|
1
|
+
import { Props as ButtonProps, AppearanceValue, VariantValue } from '../../Elements/Button/types';
|
|
2
2
|
|
|
3
3
|
export declare const rowClassSymbol: unique symbol;
|
|
4
4
|
type Option = {
|
|
@@ -288,6 +288,7 @@ export type ExtraControlButton = {
|
|
|
288
288
|
hideChevron?: boolean;
|
|
289
289
|
disabled?: boolean;
|
|
290
290
|
iconLeft?: string | React.ReactNode;
|
|
291
|
+
buttonProps?: Omit<ButtonProps, 'children' | 'onClick' | 'disabled' | 'appearance' | 'variant' | 'iconLeft' | 'as'>;
|
|
291
292
|
};
|
|
292
293
|
export type Group = {
|
|
293
294
|
name?: string;
|
|
@@ -306,6 +307,7 @@ export type GridProps = CommonGridProps & {
|
|
|
306
307
|
withManageColumnButton?: boolean;
|
|
307
308
|
withPagination?: boolean;
|
|
308
309
|
allowSortingOnlyUnderTotalRows?: [number, number];
|
|
310
|
+
onReload?: () => void;
|
|
309
311
|
};
|
|
310
312
|
export type Item = {
|
|
311
313
|
title: string | React.ReactNode;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { Reload } from '../../../Elements/Icon/icons/Reload';
|
|
12
|
+
import { ExtraControlButtonPosition } from '../types';
|
|
13
|
+
import compact from 'lodash/compact';
|
|
14
|
+
export var getExtendedExtraControlButtons = function (extraControlButtons, onReload) {
|
|
15
|
+
return compact(__spreadArray([
|
|
16
|
+
onReload && {
|
|
17
|
+
onClick: onReload,
|
|
18
|
+
label: _jsx(Reload, { width: "16px", height: "16px", fill: "white" }),
|
|
19
|
+
position: ExtraControlButtonPosition.TopLeft,
|
|
20
|
+
buttonProps: { 'data-testid': 'reload-button' }
|
|
21
|
+
}
|
|
22
|
+
], (extraControlButtons || []), true));
|
|
23
|
+
};
|
|
@@ -14,5 +14,5 @@ export var CornerDialog = function (_a) {
|
|
|
14
14
|
var _d = statusToColors[intent], fontColor = _d.fontColor, backgroundColor = _d.backgroundColor, fill = _d.fill;
|
|
15
15
|
if (!isOpen)
|
|
16
16
|
return null;
|
|
17
|
-
return (_jsx(Portal, { children: _jsxs(Container, { "$mounted": isMounted, children: [_jsxs(Status, { background: backgroundColor, children: [_jsx(Icon, { icon: statusToIcon[intent], fill: fill }), _jsx(StatusText, { fontColor: fontColor, children: statusToTitle[intent]() })] }), _jsx(Header, { children: title }), _jsx(CloseBtn, { onClick: onClose, children: _jsx(Icon, { icon: "close", size: "25px" }) }), _jsx(Wrapper, { children: children })] }) }));
|
|
17
|
+
return (_jsx(Portal, { children: _jsxs(Container, { "$mounted": isMounted, children: [_jsxs(Status, { background: backgroundColor, children: [_jsx(Icon, { icon: statusToIcon[intent], fill: fill }), _jsx(StatusText, { fontColor: fontColor, children: statusToTitle[intent]() })] }), _jsx(Header, { children: title }), _jsx(CloseBtn, { onClick: onClose, "data-testid": "corner-dialog-close-btn", children: _jsx(Icon, { icon: "close", size: "25px" }) }), _jsx(Wrapper, { children: children })] }) }));
|
|
18
18
|
};
|
package/ui/Blocks/Tabs/Tabs.js
CHANGED
|
@@ -9,7 +9,7 @@ var Tab = function (_a) {
|
|
|
9
9
|
var handleOnClick = useCallback(function () {
|
|
10
10
|
onTabSwitch(value);
|
|
11
11
|
}, [onTabSwitch, value]);
|
|
12
|
-
return (_jsx(StyledTabWrapper, { children: _jsxs(StyledTab, { onClick: !disabled ? handleOnClick : undefined, active: isActive, disabled: disabled, minWidth: minWidth, children: [icon && (_jsx(StyledImageBox, { children: _jsx(Icon, { icon: icon }) })), _jsx(Text, { children: label }), badgeCount === 0 ||
|
|
12
|
+
return (_jsx(StyledTabWrapper, { children: _jsxs(StyledTab, { onClick: !disabled ? handleOnClick : undefined, active: isActive, disabled: disabled, minWidth: minWidth, "data-testid": "tab-".concat(value), children: [icon && (_jsx(StyledImageBox, { children: _jsx(Icon, { icon: icon }) })), _jsx(Text, { children: label }), badgeCount === 0 ||
|
|
13
13
|
(badgeCount && badgeCount > 0 && (_jsx(RoundedWrap, { children: _jsx(Text, { variant: "medium", children: badgeCount }) })))] }) }));
|
|
14
14
|
};
|
|
15
15
|
export var Tabs = function (_a) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
export var Reload = function (props) { return (_jsx("svg", __assign({ baseProfile: "tiny", height: "1em", viewBox: "0 0 32 32", transform: "scale(1.5)", width: "1em" }, props, { children: _jsx("path", { d: "M24 13V7.369L21.899 9.47a8.454 8.454 0 00-6.005-2.495 8.5 8.5 0 000 17 8.49 8.49 0 007.375-4.286l-1.737-.993a6.5 6.5 0 01-5.638 3.278 6.508 6.508 0 01-6.5-6.5c0-3.584 2.916-6.5 6.5-6.5 1.792 0 3.414.732 4.59 1.91L18.369 13H24z" }) }))); };
|