@mailstep/design-system 0.6.2 → 0.6.3-beta.1
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 +2 -2
- package/ui/Blocks/CommonGrid/components/HeadRow.js +1 -1
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.d.ts +3 -1
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +16 -4
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.d.ts +5 -1
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.js +5 -4
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.d.ts +4 -0
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +59 -6
- package/ui/Blocks/Modal/Modal.js +2 -2
- package/ui/Blocks/Modal/stories/Modal.stories.js +1 -5
- package/ui/Blocks/Modal/styles.d.ts +0 -4
- package/ui/Blocks/Modal/styles.js +3 -10
- package/ui/Blocks/Tabs/Tabs.js +2 -2
- package/ui/Blocks/Tabs/types.d.ts +0 -1
- package/ui/Elements/ErrorMessage/ErrorMessage.js +1 -1
- package/ui/Elements/Paragraph/Paragraph.d.ts +2 -0
- package/ui/Elements/Paragraph/Paragraph.js +3 -0
- package/ui/Elements/Paragraph/index.d.ts +3 -0
- package/ui/Elements/Paragraph/index.js +3 -0
- package/ui/Elements/Paragraph/stories/Paragraph.stories.d.ts +17 -0
- package/ui/Elements/Paragraph/stories/Paragraph.stories.js +34 -0
- package/ui/Elements/Select/themes/formStyles.d.ts +3 -0
- package/ui/Elements/Select/themes/formStyles.js +10 -1
- package/ui/Elements/Text/types.d.ts +2 -2
- package/ui/Forms/Checkbox/Checkbox.js +2 -3
- package/ui/Forms/Checkbox/stories/Checkbox.stories.js +1 -1
- package/ui/Forms/Checkbox/styles.d.ts +1 -1
- package/ui/Forms/Checkbox/styles.js +1 -1
- package/ui/Forms/RadioButton/RadioButton.js +1 -4
- package/ui/Forms/RadioButton/styles.d.ts +1 -1
- package/ui/Forms/RadioButton/styles.js +1 -1
- package/ui/ThemeProvider/themes/default.js +1 -1
- package/ui/index.d.ts +3 -1
- package/ui/index.es.js +4999 -4972
- package/ui/index.js +3 -1
- package/ui/index.umd.js +405 -412
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ var StyledCommonGrid = function (props) {
|
|
|
60
60
|
gridActions: gridActions,
|
|
61
61
|
gridSelectors: gridSelectors,
|
|
62
62
|
onClose: onClose,
|
|
63
|
-
}), columnsConfigValues = _d.columnsConfigValues, setColumnsConfigOptions = _d.setColumnsConfigOptions, onConfirmForm = _d.onConfirmForm, resetColumnConfig = _d.resetColumnConfig;
|
|
64
|
-
return (_jsxs(ContentContainer, { children: [_jsxs(CommonGridWrap, { children: [_jsx(HidePrint, { children: _jsxs(StyledButtonStrip, { className: "buttonsStrip", children: [!hideControlButtons && (_jsx(ControlButtons, { extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, eshopSelect: eshopSelect })), _jsx(StyledColumnButton, { type: "button", sizing: "iconLg", appearance: "ghost", icon: _jsx(Settings2, {}), onClick: openManageColumnForm, children: _jsx(H6, { variant: "semiBold", children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) })] }) }), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { filters: filters, gridRef: gridRef, height: gridHeight, floatingButtonProps: floatingButtonProps, hasColouredRows: true }))] }), _jsx(HidePrint, { children: _jsxs(BottomWrapper, { ref: paginationRef, isFixed: !!gridHeight, children: [processCheckedValues && (_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionColumn: actionColumnDefinition, processCheckedValues: processCheckedValues, processCheckedValuesTitle: processCheckedValuesTitle })), _jsxs(x.div, { display: "flex", justifyContent: "center", alignItems: "center", className: "paginatorWrapper", w: "100%", h: window.innerWidth > 1204 ? '60px' : '32px', 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 }), _jsx(TablePagination, { gridActions: gridActions, gridSelectors: gridSelectors, customPaginationHandler: customPaginationHandler })] })] }) }), manageColumnFormVisible && (_jsx(Modal, { title: _jsx(Trans, { id: "manageColumn.title", message: "Manage columns" }), onClose:
|
|
63
|
+
}), columnsConfigValues = _d.columnsConfigValues, setColumnsConfigOptions = _d.setColumnsConfigOptions, onConfirmForm = _d.onConfirmForm, resetColumnConfig = _d.resetColumnConfig, handleDragEnd = _d.handleDragEnd, onCloseForm = _d.onCloseForm, displayColumnsDefinitions = _d.displayColumnsDefinitions;
|
|
64
|
+
return (_jsxs(ContentContainer, { children: [_jsxs(CommonGridWrap, { children: [_jsx(HidePrint, { children: _jsxs(StyledButtonStrip, { className: "buttonsStrip", children: [!hideControlButtons && (_jsx(ControlButtons, { extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, eshopSelect: eshopSelect })), _jsx(StyledColumnButton, { type: "button", sizing: "iconLg", appearance: "ghost", icon: _jsx(Settings2, {}), onClick: openManageColumnForm, children: _jsx(H6, { variant: "semiBold", children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) })] }) }), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { filters: filters, gridRef: gridRef, height: gridHeight, floatingButtonProps: floatingButtonProps, hasColouredRows: true }))] }), _jsx(HidePrint, { children: _jsxs(BottomWrapper, { ref: paginationRef, isFixed: !!gridHeight, children: [processCheckedValues && (_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionColumn: actionColumnDefinition, processCheckedValues: processCheckedValues, processCheckedValuesTitle: processCheckedValuesTitle })), _jsxs(x.div, { display: "flex", justifyContent: "center", alignItems: "center", className: "paginatorWrapper", w: "100%", h: window.innerWidth > 1204 ? '60px' : '32px', 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 }), _jsx(TablePagination, { gridActions: gridActions, gridSelectors: gridSelectors, customPaginationHandler: customPaginationHandler })] })] }) }), manageColumnFormVisible && (_jsx(Modal, { title: _jsx(Trans, { id: "manageColumn.title", message: "Manage columns" }), onClose: onCloseForm, onCancel: onCloseForm, onExtraAction: resetColumnConfig, onConfirm: onConfirmForm, width: "auto", minWidth: "350px", hasFooter: true, extraActionLabel: _jsx(Trans, { id: "dataGrid.buttonClearConfig", message: "Reset config" }), cancelLabel: _jsx(Trans, { id: "form.buttonCancel", message: "Cancel" }), confirmLabel: _jsx(Trans, { id: "form.buttonConfirm", message: "Confirm" }), children: _jsx(ManageColumnForm, { columns: displayColumnsDefinitions, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, handleDragEnd: handleDragEnd }) }))] }));
|
|
65
65
|
};
|
|
66
66
|
export default StyledCommonGrid;
|
|
@@ -48,7 +48,7 @@ var HeadRow = function (_a) {
|
|
|
48
48
|
// move column from a position to the new position
|
|
49
49
|
var column = newOrderColumns[fromIndex];
|
|
50
50
|
newOrderColumns.splice(fromIndex, 1);
|
|
51
|
-
newOrderColumns.splice(toIndex, 0, column);
|
|
51
|
+
newOrderColumns.splice(toIndex === -1 ? 0 : toIndex, 0, column);
|
|
52
52
|
setColumnsOrder(newOrderColumns);
|
|
53
53
|
}, [setColumnsOrder, columnsOrder, columns]);
|
|
54
54
|
var _e = useState(false), isDragDisabled = _e[0], setIsDragDisabled = _e[1];
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ColumnConfig, CommonGridProps } from '../../types';
|
|
3
|
+
import { DropResult } from 'react-beautiful-dnd';
|
|
3
4
|
type ManageColumnProps = {
|
|
4
5
|
columns?: CommonGridProps['columnsDefinitions'];
|
|
5
6
|
columnsConfigValues?: string[];
|
|
6
7
|
setColumnsConfigOptions: (value: React.SetStateAction<{
|
|
7
8
|
[x: string]: ColumnConfig | {};
|
|
8
9
|
}>) => void;
|
|
10
|
+
handleDragEnd: (item: DropResult) => void;
|
|
9
11
|
};
|
|
10
|
-
declare const ManageColumnForm: ({ columns, columnsConfigValues, setColumnsConfigOptions }: ManageColumnProps) => JSX.Element;
|
|
12
|
+
declare const ManageColumnForm: ({ columns, columnsConfigValues, setColumnsConfigOptions, handleDragEnd, }: ManageColumnProps) => JSX.Element;
|
|
11
13
|
export default ManageColumnForm;
|
|
@@ -1,11 +1,23 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import { useCallback, useState } from 'react';
|
|
3
14
|
import { x } from '@xstyled/styled-components';
|
|
4
15
|
import { ActionRow } from './components/ActionRow';
|
|
5
16
|
import { Input } from '../../../../Forms/Input/Input';
|
|
6
17
|
import { i18n } from '@lingui/core';
|
|
18
|
+
import { DragDropContext, Draggable, Droppable, } from 'react-beautiful-dnd';
|
|
7
19
|
var ManageColumnForm = function (_a) {
|
|
8
|
-
var columns = _a.columns, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions;
|
|
20
|
+
var columns = _a.columns, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions, handleDragEnd = _a.handleDragEnd;
|
|
9
21
|
var _b = useState(''), searchedValue = _b[0], setSearchedValue = _b[1];
|
|
10
22
|
var onChangeInputValue = useCallback(function (e) {
|
|
11
23
|
setSearchedValue(e.target.value);
|
|
@@ -13,8 +25,8 @@ var ManageColumnForm = function (_a) {
|
|
|
13
25
|
var clear = useCallback(function () {
|
|
14
26
|
setSearchedValue('');
|
|
15
27
|
}, [setSearchedValue]);
|
|
16
|
-
return (_jsxs(x.div, { children: [_jsx(Input, { icon: "search", type: "text", value: searchedValue, placeholder: i18n._({ id: 'manageColumn.searchPlaceholder', message: 'Find column...' }), onChange: onChangeInputValue, onClear: clear, variant: "gray" }), _jsx(x.div, { h: "400px", overflowY: "scroll", mt: "20px", children: columns === null || columns === void 0 ? void 0 : columns.map(function (column, index) {
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
return (_jsxs(x.div, { children: [_jsx(Input, { icon: "search", type: "text", value: searchedValue, placeholder: i18n._({ id: 'manageColumn.searchPlaceholder', message: 'Find column...' }), onChange: onChangeInputValue, onClear: clear, variant: "gray" }), _jsx(DragDropContext, { onDragEnd: handleDragEnd, children: _jsx(Droppable, { droppableId: "droppable", direction: "vertical", children: function (droppableProvided) { return (_jsx(x.div, __assign({ h: "400px", overflowY: "scroll", mt: "20px", ref: droppableProvided.innerRef }, droppableProvided.droppableProps, { children: columns === null || columns === void 0 ? void 0 : columns.map(function (column, index) {
|
|
29
|
+
return (_jsx(Draggable, { draggableId: column.name, index: index, isDragDisabled: !!searchedValue, children: function (draggableProvided, snapshot) { return (_jsx(ActionRow, { column: column, innerRef: draggableProvided.innerRef, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, searchedValue: searchedValue, draggableProps: draggableProvided.draggableProps, dragHandleProps: draggableProvided.dragHandleProps }, index)); } }, column.name));
|
|
30
|
+
}) }))); } }) })] }));
|
|
19
31
|
};
|
|
20
32
|
export default ManageColumnForm;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ColumnConfig, ColumnDefinition } from '../../../types';
|
|
3
|
+
import { DraggableProps, DraggableProvidedDragHandleProps } from 'react-beautiful-dnd';
|
|
3
4
|
type ActionRowProps = {
|
|
4
5
|
column: ColumnDefinition;
|
|
5
6
|
columnsConfigValues: string[] | undefined;
|
|
@@ -7,6 +8,9 @@ type ActionRowProps = {
|
|
|
7
8
|
[x: string]: ColumnConfig | {};
|
|
8
9
|
}>) => void;
|
|
9
10
|
searchedValue: string;
|
|
11
|
+
innerRef?: Function;
|
|
12
|
+
draggableProps?: DraggableProps | any;
|
|
13
|
+
dragHandleProps?: DraggableProvidedDragHandleProps | null;
|
|
10
14
|
};
|
|
11
|
-
export declare const ActionRow: ({ column, columnsConfigValues, setColumnsConfigOptions, searchedValue }: ActionRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const ActionRow: ({ column, columnsConfigValues, setColumnsConfigOptions, searchedValue, innerRef, draggableProps, dragHandleProps, }: ActionRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
export {};
|
|
@@ -14,7 +14,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
import { useCallback, useState } from 'react';
|
|
17
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
18
18
|
import { x, th } from '@xstyled/styled-components';
|
|
19
19
|
import styled from 'styled-components';
|
|
20
20
|
import Toggle from '../../../../../Elements/Toggle/Toggle';
|
|
@@ -22,14 +22,15 @@ import { Group } from '../../../../../Elements/Icon/icons/Group';
|
|
|
22
22
|
import { isObject } from 'lodash';
|
|
23
23
|
import { H6 } from '../../../../../Elements/Typography/Typography';
|
|
24
24
|
import { i18n } from '@lingui/core';
|
|
25
|
-
var RowLayout = styled
|
|
25
|
+
var RowLayout = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n align-items: center;\n justify-content: space-between;\n padding: 16px;\n height: 52px;\n background-color: white;\n border: 1px solid ", ";\n border-radius: 8px;\n margin-bottom: 15px;\n"], ["\n display: ", ";\n align-items: center;\n justify-content: space-between;\n padding: 16px;\n height: 52px;\n background-color: white;\n border: 1px solid ", ";\n border-radius: 8px;\n margin-bottom: 15px;\n"])), function (_a) {
|
|
26
26
|
var $isVisible = _a.$isVisible;
|
|
27
27
|
return ($isVisible ? 'flex' : 'none');
|
|
28
28
|
}, th.color('lightGray6'));
|
|
29
29
|
export var ActionRow = function (_a) {
|
|
30
30
|
var _b, _c, _d, _e, _f;
|
|
31
|
-
var column = _a.column, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions, searchedValue = _a.searchedValue;
|
|
31
|
+
var column = _a.column, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions, searchedValue = _a.searchedValue, innerRef = _a.innerRef, draggableProps = _a.draggableProps, dragHandleProps = _a.dragHandleProps;
|
|
32
32
|
var _g = useState((_b = columnsConfigValues === null || columnsConfigValues === void 0 ? void 0 : columnsConfigValues.includes(column.name)) !== null && _b !== void 0 ? _b : false), isSelected = _g[0], setIsSelected = _g[1];
|
|
33
|
+
var style = useMemo(function () { return (__assign({}, draggableProps === null || draggableProps === void 0 ? void 0 : draggableProps.style)); }, [draggableProps]);
|
|
33
34
|
var translatedValue = isObject(column === null || column === void 0 ? void 0 : column.title) &&
|
|
34
35
|
'props' in column.title &&
|
|
35
36
|
((_c = column.title) === null || _c === void 0 ? void 0 : _c.props) &&
|
|
@@ -42,6 +43,6 @@ export var ActionRow = function (_a) {
|
|
|
42
43
|
});
|
|
43
44
|
setIsSelected(!isSelected);
|
|
44
45
|
}, [setColumnsConfigOptions, isSelected, column.name]);
|
|
45
|
-
return (_jsxs(RowLayout, { "$isVisible": isVisible, children: [_jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsx(x.div, { w: "28px", children: _jsx(Toggle, { name: "", variant: "grid", onChange: handleToggleChange, spaceAround: false, checked: isSelected }) }), _jsx(H6, { variant: "medium", ml: "8px", children: translatedValue })] }), _jsx(Group, {})] }));
|
|
46
|
+
return (_jsxs(RowLayout, __assign({ "$isVisible": isVisible }, draggableProps, dragHandleProps, { ref: innerRef, style: style, children: [_jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsx(x.div, { w: "28px", children: _jsx(Toggle, { name: "", variant: "grid", onChange: handleToggleChange, spaceAround: false, checked: isSelected }) }), _jsx(H6, { variant: "medium", ml: "8px", children: translatedValue })] }), _jsx(Group, {})] })));
|
|
46
47
|
};
|
|
47
48
|
var templateObject_1;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { DropResult } from 'react-beautiful-dnd';
|
|
2
3
|
import { CommonGridProps, GridActionsType, GridSelectorsType } from '../types';
|
|
3
4
|
type Props = {
|
|
4
5
|
columns: CommonGridProps['columnsDefinitions'];
|
|
@@ -15,5 +16,8 @@ declare const useManageColumn: ({ columns, gridSelectors, gridActions, onClose }
|
|
|
15
16
|
}>>;
|
|
16
17
|
onConfirmForm: () => void;
|
|
17
18
|
resetColumnConfig: () => void;
|
|
19
|
+
handleDragEnd: (item: DropResult) => void;
|
|
20
|
+
onCloseForm: () => void;
|
|
21
|
+
displayColumnsDefinitions: import("../types").ColumnDefinition<string>[];
|
|
18
22
|
};
|
|
19
23
|
export default useManageColumn;
|
|
@@ -9,12 +9,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
13
22
|
var useManageColumn = function (_a) {
|
|
14
23
|
var columns = _a.columns, gridSelectors = _a.gridSelectors, gridActions = _a.gridActions, onClose = _a.onClose;
|
|
15
|
-
var resetGrid = gridActions.resetGrid, setColumnConfig = gridActions.setColumnConfig;
|
|
16
|
-
var columnConfig = gridSelectors.columnConfig;
|
|
24
|
+
var resetGrid = gridActions.resetGrid, setColumnConfig = gridActions.setColumnConfig, setColumnsOrder = gridActions.setColumnsOrder;
|
|
25
|
+
var columnConfig = gridSelectors.columnConfig, columnsOrder = gridSelectors.columnsOrder;
|
|
17
26
|
var _b = useState(__assign({}, columnConfig)), columnsConfigOptions = _b[0], setColumnsConfigOptions = _b[1];
|
|
27
|
+
var _c = useState(columnsOrder || columns.map(function (col) { return col.name; })), updatedColumnsOrder = _c[0], setUpdatedColumnsOrder = _c[1];
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
(columnsOrder === null || columnsOrder === void 0 ? void 0 : columnsOrder.length) && (setUpdatedColumnsOrder === null || setUpdatedColumnsOrder === void 0 ? void 0 : setUpdatedColumnsOrder(columnsOrder));
|
|
30
|
+
}, [columnsOrder]);
|
|
18
31
|
var columnsConfigValues = useMemo(function () {
|
|
19
32
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (column) {
|
|
20
33
|
var _a;
|
|
@@ -22,13 +35,53 @@ var useManageColumn = function (_a) {
|
|
|
22
35
|
return (column === null || column === void 0 ? void 0 : column.alwaysOn) || typeof isHidden === 'boolean' ? !isHidden : !(column === null || column === void 0 ? void 0 : column.defaultHidden);
|
|
23
36
|
}).map(function (column) { return column.name; });
|
|
24
37
|
}, [columnConfig, columns]);
|
|
38
|
+
var columnsOrderValues = useMemo(function () {
|
|
39
|
+
var order = (columnsOrder === null || columnsOrder === void 0 ? void 0 : columnsOrder.length) ? columnsOrder : columns.map(function (column) { return column.name; });
|
|
40
|
+
return order;
|
|
41
|
+
}, [columns, columnsOrder]);
|
|
25
42
|
var onConfirmForm = useCallback(function () {
|
|
26
|
-
(setColumnConfig === null || setColumnConfig === void 0 ? void 0 : setColumnConfig(columnsConfigOptions)) && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
27
|
-
}, [columnsConfigOptions, onClose, setColumnConfig]);
|
|
43
|
+
(setColumnConfig === null || setColumnConfig === void 0 ? void 0 : setColumnConfig(columnsConfigOptions)) && (setColumnsOrder === null || setColumnsOrder === void 0 ? void 0 : setColumnsOrder(updatedColumnsOrder)) && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
44
|
+
}, [columnsConfigOptions, updatedColumnsOrder, onClose, setColumnConfig]);
|
|
28
45
|
var resetColumnConfig = useCallback(function () {
|
|
46
|
+
setUpdatedColumnsOrder(columnsOrderValues);
|
|
29
47
|
(resetGrid === null || resetGrid === void 0 ? void 0 : resetGrid()) && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
30
48
|
setColumnsConfigOptions(columnConfig || {});
|
|
31
49
|
}, [onClose, resetGrid]);
|
|
32
|
-
|
|
50
|
+
var onCloseForm = useCallback(function () {
|
|
51
|
+
setUpdatedColumnsOrder(columnsOrderValues);
|
|
52
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
53
|
+
}, []);
|
|
54
|
+
var handleDragEnd = useCallback(function (item) {
|
|
55
|
+
var destination = item.destination, source = item.source;
|
|
56
|
+
var to = destination === null || destination === void 0 ? void 0 : destination.index;
|
|
57
|
+
var from = source === null || source === void 0 ? void 0 : source.index;
|
|
58
|
+
if (to === from || !destination) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
var newOrderColumns = __spreadArray([], updatedColumnsOrder, true);
|
|
62
|
+
var fromIndex = newOrderColumns.findIndex(function (column) { return columns[from].name === column; });
|
|
63
|
+
var toIndex = newOrderColumns.findIndex(function (column) { return to && columns[to].name === column; });
|
|
64
|
+
// move column from a position to the new position
|
|
65
|
+
var column = newOrderColumns[fromIndex];
|
|
66
|
+
newOrderColumns.splice(fromIndex, 1);
|
|
67
|
+
newOrderColumns.splice(toIndex === -1 ? 0 : toIndex, 0, column);
|
|
68
|
+
setUpdatedColumnsOrder(newOrderColumns);
|
|
69
|
+
}, [columns, updatedColumnsOrder]);
|
|
70
|
+
var displayColumnsDefinitions = useMemo(function () {
|
|
71
|
+
return columns.sort(function (col1, col2) {
|
|
72
|
+
var i = (updatedColumnsOrder || []).indexOf(col1.name);
|
|
73
|
+
var j = (updatedColumnsOrder || []).indexOf(col2.name);
|
|
74
|
+
return i > j ? 1 : i < j ? -1 : 0;
|
|
75
|
+
});
|
|
76
|
+
}, [columns, updatedColumnsOrder]);
|
|
77
|
+
return {
|
|
78
|
+
columnsConfigValues: columnsConfigValues,
|
|
79
|
+
setColumnsConfigOptions: setColumnsConfigOptions,
|
|
80
|
+
onConfirmForm: onConfirmForm,
|
|
81
|
+
resetColumnConfig: resetColumnConfig,
|
|
82
|
+
handleDragEnd: handleDragEnd,
|
|
83
|
+
onCloseForm: onCloseForm,
|
|
84
|
+
displayColumnsDefinitions: displayColumnsDefinitions,
|
|
85
|
+
};
|
|
33
86
|
};
|
|
34
87
|
export default useManageColumn;
|
package/ui/Blocks/Modal/Modal.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { memo, useCallback, useMemo, useEffect } from 'react';
|
|
3
3
|
import { Icon, Cancel } from '../../Elements/Icon';
|
|
4
4
|
import { H2, H5 } from '../../Elements/Typography';
|
|
5
|
-
import { DialogOverlay, DialogWindow, HeaderContainer, ButtonsContainer, ContentContainer, TitleContainer, CloseButton,
|
|
5
|
+
import { DialogOverlay, DialogWindow, HeaderContainer, ButtonsContainer, ContentContainer, TitleContainer, CloseButton, } from './styles';
|
|
6
6
|
import { x } from '@xstyled/styled-components';
|
|
7
7
|
import { Button } from '../../Elements/Button';
|
|
8
8
|
import { Portal } from '../../Elements/Portal';
|
|
@@ -32,5 +32,5 @@ export var Modal = memo(function (_a) {
|
|
|
32
32
|
if (!isShown) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
|
-
return (_jsx(Portal, { children: _jsx(DialogOverlay, { backgroundColor: overlayColor, children: _jsxs(DialogWindow, { ref: dialogRef, style: dialogStyle, "$backgroundColor": background, top: top, "data-cy": "dialogWindow", onClick: closeEverywhere ? closeDialog : undefined, "$minWidth": minWidth, "$minHeight": minHeight, "$maxWidth": maxWidth, "$maxHeight": maxHeight, variant: variant, children: [title && hasHeader && (_jsx(HeaderContainer, { variant: variant, children: _jsxs(TitleContainer, { children: [titleIcon && (_jsx(x.div, { as: "span", className: "icon", children: typeof titleIcon === 'string' ? _jsx(Icon, { icon: titleIcon, fill: "blue2" }) : titleIcon })), variant == 'default' ? (_jsx(H2, { mt: 0, mb: 0, variant: "bold", children: title })) : (_jsx(H5, { mt: 0, mb: 0, variant: "bold", children: title }))] }) })), withCloseIcon && (_jsx(CloseButton, { onClick: closeDialog, "data-cy": "dialogCloseBtn", children: _jsx(Cancel, { width: "11px", height: "11px" }) })), _jsx(ContentContainer, { variant: variant, children: children }), hasFooter && (onExtraAction || onCancel || onConfirm) && (_jsxs(ButtonsContainer, { hasSpaceBetween: !!onExtraAction, children: [onExtraAction && (_jsx(Button, { type: "button", onClick: onExtraAction, isLoading: isLoading, "data-cy": "extraActionBtn", appearance: "ghostDanger", children: extraActionLabel })), _jsxs(
|
|
35
|
+
return (_jsx(Portal, { children: _jsx(DialogOverlay, { backgroundColor: overlayColor, children: _jsxs(DialogWindow, { ref: dialogRef, style: dialogStyle, "$backgroundColor": background, top: top, "data-cy": "dialogWindow", onClick: closeEverywhere ? closeDialog : undefined, "$minWidth": minWidth, "$minHeight": minHeight, "$maxWidth": maxWidth, "$maxHeight": maxHeight, variant: variant, children: [title && hasHeader && (_jsx(HeaderContainer, { variant: variant, children: _jsxs(TitleContainer, { children: [titleIcon && (_jsx(x.div, { as: "span", className: "icon", children: typeof titleIcon === 'string' ? _jsx(Icon, { icon: titleIcon, fill: "blue2" }) : titleIcon })), variant == 'default' ? (_jsx(H2, { mt: 0, mb: 0, variant: "bold", children: title })) : (_jsx(H5, { mt: 0, mb: 0, variant: "bold", children: title }))] }) })), withCloseIcon && (_jsx(CloseButton, { onClick: closeDialog, "data-cy": "dialogCloseBtn", children: _jsx(Cancel, { width: "11px", height: "11px" }) })), _jsx(ContentContainer, { variant: variant, children: children }), hasFooter && (onExtraAction || onCancel || onConfirm) && (_jsxs(ButtonsContainer, { hasSpaceBetween: !!onExtraAction, children: [onExtraAction && (_jsx(Button, { type: "button", onClick: onExtraAction, isLoading: isLoading, "data-cy": "extraActionBtn", appearance: "ghostDanger", children: extraActionLabel })), _jsxs(x.div, { children: [onCancel && (_jsx(Button, { type: "button", onClick: onCancel, isLoading: isLoading, "data-cy": "cancelBtn", appearance: "primaryLight", children: cancelLabel ? cancelLabel : 'Cancel' })), onConfirm && (_jsx(Button, { type: "button", onClick: onDialogConfirmClick, isLoading: isLoading, disabled: isConfirmDisabled, "data-cy": "submitBtn", children: confirmLabel ? confirmLabel : 'Submit' }))] })] }))] }) }) }));
|
|
36
36
|
});
|
|
@@ -32,7 +32,7 @@ export var ModalTopPosition = {
|
|
|
32
32
|
title: 'Modal default version',
|
|
33
33
|
children: _jsx(_Fragment, { children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed condimentum id eros ac consequat." }),
|
|
34
34
|
variant: 'default',
|
|
35
|
-
top: '0'
|
|
35
|
+
top: '0'
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
export var ModalWithCloseAndConfirmBtns = {
|
|
@@ -40,10 +40,6 @@ export var ModalWithCloseAndConfirmBtns = {
|
|
|
40
40
|
children: _jsx(_Fragment, { children: "Modal with narrow width" }),
|
|
41
41
|
title: 'Modal title',
|
|
42
42
|
width: 'narrow',
|
|
43
|
-
withCloseIcon: true,
|
|
44
|
-
onCancel: function () { return console.log('Cancel'); },
|
|
45
|
-
onConfirm: function () { return console.log('Confirm'); },
|
|
46
|
-
onExtraAction: undefined,
|
|
47
43
|
},
|
|
48
44
|
};
|
|
49
45
|
export var ModalWithoutCloseButton = {
|
|
@@ -21,8 +21,4 @@ export declare const TitleContainer: import("styled-components").StyledComponent
|
|
|
21
21
|
export declare const ButtonsContainer: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
22
22
|
hasSpaceBetween: boolean;
|
|
23
23
|
}, never>;
|
|
24
|
-
export declare const ButtonsWrapper: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
25
|
-
hasExtraAction: boolean;
|
|
26
|
-
hasBothButtons: boolean;
|
|
27
|
-
}, never>;
|
|
28
24
|
export declare const CloseButton: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -67,16 +67,9 @@ export var ContentContainer = styled.div(templateObject_13 || (templateObject_13
|
|
|
67
67
|
return variantStyles(Component.ContentContainer, variant);
|
|
68
68
|
});
|
|
69
69
|
export var TitleContainer = styled.div(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n display: flex;\n flex-flow: row;\n align-items: center;\n color: typoPrimary;\n padding-right: 34px;\n\n > div:first-of-type {\n margin-right: 0.5em;\n display: block;\n }\n\n .icon {\n font-size: 24px;\n margin-right: 15px;\n display: flex;\n\n @media (max-width: 576px) {\n font-size: 18px;\n margin-right: 12px;\n }\n }\n"], ["\n display: flex;\n flex-flow: row;\n align-items: center;\n color: typoPrimary;\n padding-right: 34px;\n\n > div:first-of-type {\n margin-right: 0.5em;\n display: block;\n }\n\n .icon {\n font-size: 24px;\n margin-right: 15px;\n display: flex;\n\n @media (max-width: 576px) {\n font-size: 18px;\n margin-right: 12px;\n }\n }\n"])));
|
|
70
|
-
export var ButtonsContainer = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"])), th.color('lightGray6'), function (_a) {
|
|
70
|
+
export var ButtonsContainer = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n > div > * {\n margin: 0 0.5em;\n }\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n > div > * {\n margin: 0 0.5em;\n }\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"])), th.color('lightGray6'), function (_a) {
|
|
71
71
|
var hasSpaceBetween = _a.hasSpaceBetween;
|
|
72
72
|
return (hasSpaceBetween ? 'space-between' : 'flex-end');
|
|
73
73
|
});
|
|
74
|
-
export var
|
|
75
|
-
|
|
76
|
-
return (hasExtraAction ? 'auto' : '100%');
|
|
77
|
-
}, function (_a) {
|
|
78
|
-
var hasBothButtons = _a.hasBothButtons;
|
|
79
|
-
return (hasBothButtons ? '50%' : 'auto');
|
|
80
|
-
});
|
|
81
|
-
export var CloseButton = styled.div(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"], ["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"])));
|
|
82
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17;
|
|
74
|
+
export var CloseButton = styled.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"], ["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"])));
|
|
75
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16;
|
package/ui/Blocks/Tabs/Tabs.js
CHANGED
|
@@ -5,11 +5,11 @@ import { Text } from '../../Elements/Text';
|
|
|
5
5
|
import { Icon } from '../../Elements/Icon';
|
|
6
6
|
var Tab = function (_a) {
|
|
7
7
|
var tabDefinition = _a.tabDefinition, value = _a.value, isActive = _a.isActive, onTabSwitch = _a.onTabSwitch;
|
|
8
|
-
var icon = tabDefinition.icon, label = tabDefinition.label, badgeCount = tabDefinition.badgeCount
|
|
8
|
+
var icon = tabDefinition.icon, label = tabDefinition.label, badgeCount = tabDefinition.badgeCount;
|
|
9
9
|
var handleOnClick = useCallback(function () {
|
|
10
10
|
onTabSwitch(value);
|
|
11
11
|
}, [onTabSwitch, value]);
|
|
12
|
-
return (_jsx(StyledTabWrapper, { children: _jsxs(StyledTab, { onClick:
|
|
12
|
+
return (_jsx(StyledTabWrapper, { children: _jsxs(StyledTab, { onClick: handleOnClick, active: isActive, children: [icon && (_jsx(StyledImageBox, { children: _jsx(Icon, { icon: icon }) })), _jsx(Text, { children: label }), isActive && badgeCount && badgeCount > 0 && (_jsx(RoundedWrap, { children: _jsx(Text, { variant: "medium", children: badgeCount }) }))] }) }));
|
|
13
13
|
};
|
|
14
14
|
export var Tabs = function (_a) {
|
|
15
15
|
var tabsDefinition = _a.tabsDefinition, activeTab = _a.activeTab, onTabSwitch = _a.onTabSwitch, mb = _a.mb;
|
|
@@ -11,7 +11,7 @@ var ErrorWrap = styled.div(templateObject_2 || (templateObject_2 = __makeTemplat
|
|
|
11
11
|
var StyledWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .inline {\n margin-top: 1;\n svg {\n margin-right: 2;\n }\n }\n .tooltip {\n ", "\n svg {\n position: absolute;\n top: 0;\n right: 0;\n }\n }\n"], ["\n .inline {\n margin-top: 1;\n svg {\n margin-right: 2;\n }\n }\n .tooltip {\n ", "\n svg {\n position: absolute;\n top: 0;\n right: 0;\n }\n }\n"])), tooltip);
|
|
12
12
|
var ErrorMessage = function (_a) {
|
|
13
13
|
var children = _a.children, appearance = _a.appearance;
|
|
14
|
-
return (_jsx(StyledWrapper, { children: _jsxs(ErrorWrap, { className: appearance, children: [_jsx(Icon, { icon: "
|
|
14
|
+
return (_jsx(StyledWrapper, { children: _jsxs(ErrorWrap, { className: appearance, children: [_jsx(Icon, { icon: "danger" }), _jsx("span", { children: children })] }) }));
|
|
15
15
|
};
|
|
16
16
|
export default ErrorMessage;
|
|
17
17
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
argTypes: {
|
|
7
|
+
backgroundColor: {
|
|
8
|
+
control: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Primary: Story;
|
|
15
|
+
export declare const Secondary: Story;
|
|
16
|
+
export declare const Large: Story;
|
|
17
|
+
export declare const Small: Story;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Paragraph } from '../';
|
|
2
|
+
var meta = {
|
|
3
|
+
title: 'Elements/Paragraph',
|
|
4
|
+
component: Paragraph,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
argTypes: {
|
|
7
|
+
backgroundColor: { control: 'color' },
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
12
|
+
export var Primary = {
|
|
13
|
+
args: {
|
|
14
|
+
primary: true,
|
|
15
|
+
label: 'Paragraph',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export var Secondary = {
|
|
19
|
+
args: {
|
|
20
|
+
label: 'Paragraph',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export var Large = {
|
|
24
|
+
args: {
|
|
25
|
+
size: 'large',
|
|
26
|
+
label: 'Paragraph',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export var Small = {
|
|
30
|
+
args: {
|
|
31
|
+
size: 'small',
|
|
32
|
+
label: 'Paragraph',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -8,6 +8,9 @@ type CustomTheme = Omit<BaseStylesTheme, 'colors'> & {
|
|
|
8
8
|
inputBorderHoverColor: string;
|
|
9
9
|
menuHoverBackgroundColor: string;
|
|
10
10
|
dropdownIndicatorColor: string;
|
|
11
|
+
hoverToActiveOptionBackground: string;
|
|
12
|
+
scrollbarThumbColor: string;
|
|
13
|
+
scrollbarTrackColor: string;
|
|
11
14
|
};
|
|
12
15
|
textWeightRegular: string;
|
|
13
16
|
textWeightSemiBold: string;
|
|
@@ -58,7 +58,13 @@ export var CustomStyles = __assign(__assign({}, baseStylesConfig), { control: fu
|
|
|
58
58
|
marginBottom: '2px',
|
|
59
59
|
lineHeight: '22px',
|
|
60
60
|
borderRadius: th.radius('ml')({ theme: selectProps === null || selectProps === void 0 ? void 0 : selectProps.systemTheme }),
|
|
61
|
-
'&:hover': {
|
|
61
|
+
'&:hover': {
|
|
62
|
+
backgroundColor: isSelected
|
|
63
|
+
? theme.colors.hoverToActiveOptionBackground
|
|
64
|
+
: !isDisabled
|
|
65
|
+
? theme.colors.menuHoverBackgroundColor
|
|
66
|
+
: undefined,
|
|
67
|
+
},
|
|
62
68
|
};
|
|
63
69
|
}, menu: function (styles, state) {
|
|
64
70
|
var _a;
|
|
@@ -95,6 +101,9 @@ export var getCustomTheme = function (theme, optionVariant, useFilterSubvariant)
|
|
|
95
101
|
menuBackgroundColor: th.color('white')({ theme: theme }),
|
|
96
102
|
menuHoverBackgroundColor: th.color('bgLightGray1')({ theme: theme }),
|
|
97
103
|
dropdownIndicatorColor: th.color('gray1')({ theme: theme }),
|
|
104
|
+
hoverToActiveOptionBackground: th.color('red30')({ theme: theme }),
|
|
105
|
+
scrollbarThumbColor: th.color('lightGray5')({ theme: theme }),
|
|
106
|
+
scrollbarTrackColor: th.color('bgLightGray1')({ theme: theme }),
|
|
98
107
|
};
|
|
99
108
|
return function (reactSelectTheme) {
|
|
100
109
|
return __assign(__assign({}, reactSelectTheme), { colors: customColors, focusBoxShadow: null, height: useFilterSubvariant ? '32px' : '38px', textWeightRegular: th.fontWeight('regular')({ theme: theme }), textWeightSemiBold: th.fontWeight('semiBold')({ theme: theme }), textWeightBold: th.fontWeight('bold')({ theme: theme }), optionVariant: optionVariant, borderRadius: th.radius('lg')({ theme: theme }), font: th.font('primary')({ theme: theme }), narrowIndicators: !!useFilterSubvariant });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export type TextProps = {
|
|
3
|
-
children?:
|
|
3
|
+
children?: string | number | JSX.Element | (JSX.Element | undefined)[];
|
|
4
4
|
fontSize?: number;
|
|
5
5
|
fontWeight?: string;
|
|
6
6
|
variant?: 'normal' | 'medium' | 'semiBold' | 'bold';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo
|
|
2
|
+
import { memo } from 'react';
|
|
3
3
|
import { CheckboxWrap, CheckIcon, FakeInput, Label } from './styles';
|
|
4
4
|
import { th, useTheme } from '@xstyled/styled-components';
|
|
5
5
|
var Checkbox = function (_a) {
|
|
6
6
|
var name = _a.name, label = _a.label, onChange = _a.onChange, checked = _a.checked, defaultChecked = _a.defaultChecked, _b = _a.size, size = _b === void 0 ? 4 : _b, className = _a.className, disabled = _a.disabled, inputRef = _a.inputRef, readOnly = _a.readOnly, _c = _a.minusIcon, minusIcon = _c === void 0 ? false : _c;
|
|
7
7
|
var theme = useTheme();
|
|
8
8
|
var themeSize = th.fontSize(size)({ theme: theme });
|
|
9
|
-
|
|
10
|
-
return (_jsxs(CheckboxWrap, { size: themeSize, className: className, children: [_jsx("input", { type: "checkbox", ref: inputRef, name: name, checked: checked, defaultChecked: defaultChecked, disabled: disabled, onChange: onChange, value: "", readOnly: readOnly, "data-cy": name && "".concat(name, "Checkbox"), id: id }), _jsx(FakeInput, { size: themeSize, children: _jsx(CheckIcon, { icon: minusIcon ? 'minus' : 'check', size: themeSize }) }), label && _jsx(Label, { htmlFor: id, children: label })] }));
|
|
9
|
+
return (_jsxs(CheckboxWrap, { size: themeSize, className: className, children: [_jsx("input", { type: "checkbox", ref: inputRef, name: name, checked: checked, defaultChecked: defaultChecked, disabled: disabled, onChange: onChange, value: "", readOnly: readOnly, "data-cy": name && "".concat(name, "Checkbox") }), _jsx(FakeInput, { size: themeSize, children: _jsx(CheckIcon, { icon: minusIcon ? 'minus' : 'check', size: themeSize }) }), label && _jsx(Label, { children: label })] }));
|
|
11
10
|
};
|
|
12
11
|
export default memo(Checkbox);
|
|
@@ -8,4 +8,4 @@ export declare const CheckIcon: import("styled-components").StyledComponent<({ i
|
|
|
8
8
|
export declare const CheckboxWrap: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
9
9
|
size: string | number;
|
|
10
10
|
}, never>;
|
|
11
|
-
export declare const Label: import("styled-components").StyledComponent<"
|
|
11
|
+
export declare const Label: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -22,5 +22,5 @@ export var CheckboxWrap = styled.div(templateObject_3 || (templateObject_3 = __m
|
|
|
22
22
|
var size = _a.size;
|
|
23
23
|
return size;
|
|
24
24
|
});
|
|
25
|
-
export var Label = styled.
|
|
25
|
+
export var Label = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"], ["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"])));
|
|
26
26
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -22,11 +22,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { CenterDot, Item, Label, PaintoverLayer, StyledRadio, Wrapper } from './styles';
|
|
25
|
-
import { useId } from 'react';
|
|
26
25
|
var RadioButton = function (_a) {
|
|
27
26
|
var label = _a.label, id = _a.id, name = _a.name, _b = _a.disabled, disabled = _b === void 0 ? false : _b, onChange = _a.onChange, rest = __rest(_a, ["label", "id", "name", "disabled", "onChange"]);
|
|
28
|
-
|
|
29
|
-
var inputId = id || customId;
|
|
30
|
-
return (_jsxs(Wrapper, { children: [_jsxs(Item, { children: [_jsx(StyledRadio, __assign({ type: "radio", id: inputId, name: name, disabled: disabled, onChange: onChange }, rest)), _jsx(PaintoverLayer, { disabled: disabled, children: _jsx(CenterDot, {}) })] }), label && _jsx(Label, { htmlFor: inputId, children: label })] }));
|
|
27
|
+
return (_jsxs(Wrapper, { children: [_jsxs(Item, { children: [_jsx(StyledRadio, __assign({ type: "radio", id: id, name: name, disabled: disabled, onChange: onChange }, rest)), _jsx(PaintoverLayer, { disabled: disabled, children: _jsx(CenterDot, {}) })] }), label && _jsx(Label, { children: label })] }));
|
|
31
28
|
};
|
|
32
29
|
export default RadioButton;
|
|
@@ -7,4 +7,4 @@ export declare const CenterDot: import("styled-components").StyledComponent<"spa
|
|
|
7
7
|
export declare const StyledRadio: import("styled-components").StyledComponent<"input", import("@xstyled/system").Theme, {
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
}, never>;
|
|
10
|
-
export declare const Label: import("styled-components").StyledComponent<"
|
|
10
|
+
export declare const Label: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -11,5 +11,5 @@ export var StyledRadio = styled.input(templateObject_5 || (templateObject_5 = __
|
|
|
11
11
|
var disabled = _a.disabled;
|
|
12
12
|
return (disabled ? 'default' : 'pointer');
|
|
13
13
|
});
|
|
14
|
-
export var Label = styled.
|
|
14
|
+
export var Label = styled.span(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"], ["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"])));
|
|
15
15
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
package/ui/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import Line from './Elements/Line';
|
|
|
18
18
|
import Link from './Elements/Link';
|
|
19
19
|
import Logo from './Elements/Logo';
|
|
20
20
|
import Pagination from './Elements/Pagination';
|
|
21
|
+
import Paragraph from './Elements/Paragraph';
|
|
21
22
|
import Portal from './Elements/Portal';
|
|
22
23
|
import ProgressBar from './Elements/ProgressBar';
|
|
23
24
|
import SimpleLink from './Elements/SimpleLink';
|
|
@@ -40,7 +41,7 @@ import MultiSelect from './Elements/MultiSelect';
|
|
|
40
41
|
import Select from './Elements/Select';
|
|
41
42
|
import DropdownSelect from './Elements/DropdownSelect';
|
|
42
43
|
import TextArea from './Forms/TextArea';
|
|
43
|
-
export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, };
|
|
44
|
+
export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Paragraph, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, };
|
|
44
45
|
export * from './Blocks/CornerDialog';
|
|
45
46
|
export * from './Blocks/ImageList';
|
|
46
47
|
export * from './Blocks/LightBox';
|
|
@@ -61,6 +62,7 @@ export * from './Elements/Line';
|
|
|
61
62
|
export * from './Elements/Link';
|
|
62
63
|
export * from './Elements/Logo';
|
|
63
64
|
export * from './Elements/Pagination';
|
|
65
|
+
export * from './Elements/Paragraph';
|
|
64
66
|
export * from './Elements/Portal';
|
|
65
67
|
export * from './Elements/ProgressBar';
|
|
66
68
|
export * from './Elements/SimpleLink';
|