@mailstep/design-system 0.6.39 → 0.6.41
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/components/gridCells/EnumInCell.js +1 -1
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +2 -10
- package/ui/Blocks/CommonGrid/types.d.ts +1 -0
- package/ui/Elements/Select/components/ChevronOption.d.ts +2 -0
- package/ui/Elements/Select/components/ChevronOption.js +23 -0
- package/ui/Elements/Select/components/ConnectedMenu.d.ts +2 -0
- package/ui/Elements/Select/components/ConnectedMenu.js +21 -0
- package/ui/Elements/Select/components/CountMultiValue.d.ts +2 -0
- package/ui/Elements/Select/components/CountMultiValue.js +33 -0
- package/ui/Elements/Select/components/CustomInput.d.ts +2 -0
- package/ui/Elements/Select/components/CustomInput.js +19 -0
- package/ui/Elements/Select/components/DropdownIndicator.d.ts +2 -0
- package/ui/Elements/Select/components/DropdownIndicator.js +28 -0
- package/ui/Elements/Select/components/IconValueContainer.d.ts +2 -0
- package/ui/Elements/Select/components/IconValueContainer.js +45 -0
- package/ui/Elements/Select/components/ResetAll.d.ts +5 -0
- package/ui/Elements/Select/components/ResetAll.js +15 -0
- package/ui/Elements/Select/components/SelectAll.d.ts +11 -0
- package/ui/Elements/Select/components/SelectAll.js +56 -0
- package/ui/Elements/Select/components/SelectedIndicator.d.ts +2 -0
- package/ui/Elements/Select/components/SelectedIndicator.js +8 -0
- package/ui/Elements/Select/components/SimplifiedOption.d.ts +3 -0
- package/ui/Elements/Select/components/SimplifiedOption.js +11 -0
- package/ui/Elements/Select/themes/index.js +8 -2
- package/ui/Elements/Select/themes/selectStyles.d.ts +1 -39
- package/ui/Elements/Select/types.d.ts +38 -1
- package/ui/index.es.js +1389 -1379
- package/ui/index.umd.js +169 -168
- package/ui/Elements/Select/themes/CustomComponents.d.ts +0 -8
- package/ui/Elements/Select/themes/CustomComponents.js +0 -137
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const SimplifiedOption: React.MemoExoticComponent<(props: any) => any>;
|
|
3
|
-
export declare const IconValueContainer: (props: any) => any;
|
|
4
|
-
export declare const CountMultiValue: (props: any) => any;
|
|
5
|
-
export declare const ChevronOption: (props: any) => any;
|
|
6
|
-
export declare const ConnectedMenu: (props: any) => any;
|
|
7
|
-
export declare const CustomInput: (props: any) => any;
|
|
8
|
-
export declare const DropdownIndicator: (props: any) => any;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
|
6
|
-
__assign = Object.assign || function(t) {
|
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
-
s = arguments[i];
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
-
t[p[i]] = s[p[i]];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
-
import { useCallback, memo, useState, useEffect, useRef } from 'react';
|
|
29
|
-
import { components } from 'react-select';
|
|
30
|
-
import styled, { th } from '@xstyled/styled-components';
|
|
31
|
-
import { components as selectComponents } from 'react-select';
|
|
32
|
-
import { Trans } from '@lingui/react';
|
|
33
|
-
import Icon from '../../Icon/Icon';
|
|
34
|
-
import { Paragraph3 } from '../../Typography/Typography';
|
|
35
|
-
import Checkbox from '../../../Forms/Checkbox/Checkbox';
|
|
36
|
-
import Toggle from '../../Toggle/Toggle';
|
|
37
|
-
import { ArrowDown } from '../../Icon/icons/ArrowDown';
|
|
38
|
-
import { ArrowUp } from '../../Icon/icons/ArrowUp';
|
|
39
|
-
// Option for big lists
|
|
40
|
-
var SimplifiedOptionInner = function (props) {
|
|
41
|
-
var styles = props.getStyles('option', props);
|
|
42
|
-
var data = props.data, selectOption = props.selectOption, innerProps = props.innerProps;
|
|
43
|
-
var handleClick = useCallback(function () { return selectOption(data); }, [data, selectOption]);
|
|
44
|
-
return (_jsx("div", { style: styles, onClick: handleClick, onMouseOver: innerProps.onMouseOver, onMouseMove: innerProps.onMouseMove, children: props.label }));
|
|
45
|
-
};
|
|
46
|
-
export var SimplifiedOption = memo(SimplifiedOptionInner, function (prevProps, nextProps) { var _a, _b; return prevProps.isFocused === nextProps.isFocused && ((_a = prevProps.data) === null || _a === void 0 ? void 0 : _a.label) === ((_b = nextProps.data) === null || _b === void 0 ? void 0 : _b.label); });
|
|
47
|
-
// Value container with icon
|
|
48
|
-
var IconDiv = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left: 12px;\n align-self: center;\n & > * {\n color: ", ";\n }\n"], ["\n padding-left: 12px;\n align-self: center;\n & > * {\n color: ", ";\n }\n"])), function (_a) {
|
|
49
|
-
var hasValue = _a.hasValue;
|
|
50
|
-
return (hasValue ? 'black' : '#a3b3c1');
|
|
51
|
-
});
|
|
52
|
-
export var IconValueContainer = function (props) {
|
|
53
|
-
var _a;
|
|
54
|
-
// eslint-disable-next-line react/prop-types
|
|
55
|
-
var children = props.children, rest = __rest(props, ["children"]);
|
|
56
|
-
var icon = (_a = rest.selectProps) === null || _a === void 0 ? void 0 : _a.icon;
|
|
57
|
-
var hasValue = rest.hasValue;
|
|
58
|
-
return (_jsxs(_Fragment, { children: [icon && (_jsx(IconDiv, { className: "inputIcon", hasValue: hasValue, children: _jsx(Icon, { icon: icon }) })), _jsx(components.ValueContainer, __assign({}, rest, { children: children }))] }));
|
|
59
|
-
};
|
|
60
|
-
// MultiValue container with count of selected options
|
|
61
|
-
var StyledNumber = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n height: 25px;\n justify-content: center;\n align-items: center;\n display: flex;\n border-radius: md;\n padding: 2px 6px;\n"], ["\n background: ", ";\n height: 25px;\n justify-content: center;\n align-items: center;\n display: flex;\n border-radius: md;\n padding: 2px 6px;\n"])), th.color('lightGray7'));
|
|
62
|
-
export var CountMultiValue = function (props) {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
var selectVal = props.selectProps.value;
|
|
65
|
-
var inputVal = props.selectProps.inputValue;
|
|
66
|
-
if (!inputVal && ((_a = props.data) === null || _a === void 0 ? void 0 : _a.value) == ((_b = selectVal[0]) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
67
|
-
return (_jsxs(_Fragment, { children: [_jsx(selectComponents.MultiValue, __assign({}, props, { children: props.children })), selectVal.length > 1 ? _jsxs(StyledNumber, { children: ["+", selectVal.length - 1] }) : null] }));
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
// Option with chevron form new design
|
|
74
|
-
var ChevronDiv = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-self: center;\n display: flex;\n"], ["\n align-self: center;\n display: flex;\n"])));
|
|
75
|
-
var SelectedIndicator = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-right: 12px;\n"], ["\n padding-right: 12px;\n"])));
|
|
76
|
-
export var ChevronOption = function (props) {
|
|
77
|
-
var theme = props.theme, isSelected = props.isSelected, selectOption = props.selectOption, children = props.children, data = props.data;
|
|
78
|
-
var showCheckbox = !!(theme.optionVariant == 'checkbox');
|
|
79
|
-
var showToggle = !!(theme.optionVariant == 'toggle');
|
|
80
|
-
return (_jsxs(selectComponents.Option, __assign({}, props, { children: [(showCheckbox || showToggle) && (_jsxs(SelectedIndicator, { children: [showCheckbox && _jsx(Checkbox, { checked: isSelected, size: 2, readOnly: true }), showToggle && _jsx(Toggle, { name: "", onChange: selectOption, checked: isSelected, spaceAround: false, variant: 'grid' })] })), _jsx("span", { className: "label", "data-cy": "dropdownModalOption".concat(data.index), children: children })] })));
|
|
81
|
-
};
|
|
82
|
-
// menu with check all and reset config button
|
|
83
|
-
var SelectAll = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n margin: 4px 18px -10px 8px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n :hover {\n cursor: pointer;\n background-color: ", ";\n }\n"], ["\n display: flex;\n margin: 4px 18px -10px 8px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n :hover {\n cursor: pointer;\n background-color: ", ";\n }\n"])), function (_a) {
|
|
84
|
-
var additionalPadding = _a.additionalPadding;
|
|
85
|
-
return (additionalPadding ? '8px 27px 8px 10px' : '8px 10px');
|
|
86
|
-
}, function (_a) {
|
|
87
|
-
var isSelected = _a.isSelected;
|
|
88
|
-
return (isSelected ? th.color('red20') : 'transparent');
|
|
89
|
-
}, function (_a) {
|
|
90
|
-
var isSelected = _a.isSelected;
|
|
91
|
-
return (isSelected ? th.color('red1') : th.color('textPrimary'));
|
|
92
|
-
}, function (_a) {
|
|
93
|
-
var isSelected = _a.isSelected;
|
|
94
|
-
return (isSelected ? th.color('red30') : th.color('bgLightGray1'));
|
|
95
|
-
});
|
|
96
|
-
var ConfigWrap = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n text-align: center;\n cursor: pointer;\n color: red1;\n text-decoration: underline;\n margin: 0 30px 0 20px;\n padding-bottom: 7px;\n :first-letter {\n text-transform: capitalize;\n }\n :hover {\n color: red3;\n }\n"], ["\n text-align: center;\n cursor: pointer;\n color: red1;\n text-decoration: underline;\n margin: 0 30px 0 20px;\n padding-bottom: 7px;\n :first-letter {\n text-transform: capitalize;\n }\n :hover {\n color: red3;\n }\n"])));
|
|
97
|
-
export var ConnectedMenu = function (props) {
|
|
98
|
-
var theme = props.theme;
|
|
99
|
-
var _a = props.selectProps, resetGrid = _a.resetGrid, onCustomSelectAll = _a.onCustomSelectAll, onCustomDeselectAll = _a.onCustomDeselectAll, value = _a.value, options = _a.options, resetGridButton = _a.resetGridButton, selectAllButton = _a.selectAllButton, maxMenuHeight = _a.maxMenuHeight;
|
|
100
|
-
var showCheckbox = !!(theme.optionVariant === 'checkbox');
|
|
101
|
-
var showToggle = !!(theme.optionVariant === 'toggle');
|
|
102
|
-
var _b = useState(false), isSelected = _b[0], setIsSelected = _b[1];
|
|
103
|
-
var _c = useState(false), additionalPadding = _c[0], setAdditionalPadding = _c[1];
|
|
104
|
-
var ref = useRef(null);
|
|
105
|
-
useEffect(function () {
|
|
106
|
-
var _a;
|
|
107
|
-
// if the height of all options is higher than maxMenuHeight and the slider is displayed => the indentation needs to be increased
|
|
108
|
-
((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && setAdditionalPadding(ref.current.offsetHeight * options.length > maxMenuHeight);
|
|
109
|
-
if (value) {
|
|
110
|
-
options.length === value.length && setIsSelected(true);
|
|
111
|
-
options.length !== value.length && setIsSelected(false);
|
|
112
|
-
}
|
|
113
|
-
else
|
|
114
|
-
return;
|
|
115
|
-
}, [additionalPadding, maxMenuHeight, options.length, value]);
|
|
116
|
-
var selectAll = useCallback(function () {
|
|
117
|
-
if (!isSelected) {
|
|
118
|
-
setIsSelected(true);
|
|
119
|
-
onCustomSelectAll();
|
|
120
|
-
}
|
|
121
|
-
else if (isSelected) {
|
|
122
|
-
setIsSelected(false);
|
|
123
|
-
onCustomDeselectAll();
|
|
124
|
-
}
|
|
125
|
-
}, [isSelected, onCustomDeselectAll, onCustomSelectAll]);
|
|
126
|
-
return (_jsxs(selectComponents.Menu, __assign({}, props, { children: [selectAllButton && (_jsxs(SelectAll, { isSelected: isSelected, onClick: selectAll, ref: ref, additionalPadding: additionalPadding, children: [(showCheckbox || showToggle) && (_jsxs(SelectedIndicator, { children: [showCheckbox && _jsx(Checkbox, { checked: isSelected, size: 2, readOnly: true }), showToggle && _jsx(Toggle, { name: "", checked: isSelected, spaceAround: false, variant: 'grid' })] })), _jsx(Trans, { id: "datagrid.filterCell.selectAllLabel", message: 'select all' })] })), props.children, resetGridButton && (_jsx(ConfigWrap, { onClick: resetGrid, children: _jsx(Paragraph3, { variant: "semiBold", children: _jsx(Trans, { id: "dataGrid.buttonClearConfig", message: "Reset config" }) }) }))] })));
|
|
127
|
-
};
|
|
128
|
-
export var CustomInput = function (props) {
|
|
129
|
-
var name = props.selectProps.name;
|
|
130
|
-
var value = !!name ? "".concat(name, "Inp") : props.id;
|
|
131
|
-
return _jsx(selectComponents.Input, __assign({}, props, { "data-cy": value }));
|
|
132
|
-
};
|
|
133
|
-
export var DropdownIndicator = function (props) {
|
|
134
|
-
var _a = props.selectProps, menuIsOpen = _a.menuIsOpen, name = _a.name;
|
|
135
|
-
return (_jsx(selectComponents.DropdownIndicator, __assign({}, props, { children: _jsx(ChevronDiv, { className: "chevron", "data-cy": "".concat(name, "ChevronBtn"), children: menuIsOpen ? _jsx(ArrowUp, { width: "16px" }) : _jsx(ArrowDown, { width: "16px" }) }) })));
|
|
136
|
-
};
|
|
137
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|