@mailstep/design-system 0.6.39 → 0.6.40
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/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 +1388 -1378
- package/ui/index.umd.js +168 -167
- package/ui/Elements/Select/themes/CustomComponents.d.ts +0 -8
- package/ui/Elements/Select/themes/CustomComponents.js +0 -137
package/package.json
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
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
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
2
|
import React from 'react';
|
|
12
3
|
export var oversizedArrayColumns = 25;
|
|
@@ -28,7 +19,8 @@ export var enumColumn = {
|
|
|
28
19
|
name: 'enumColumn',
|
|
29
20
|
title: 'Enum Column',
|
|
30
21
|
flexBasis: 160,
|
|
31
|
-
filterOptions:
|
|
22
|
+
filterOptions: enumValues.map(function (v) { return ({ value: v, label: v }); }),
|
|
23
|
+
filterExtraProps: { isMulti: true, checkAllButton: true },
|
|
32
24
|
filtering: true,
|
|
33
25
|
sorting: false,
|
|
34
26
|
};
|
|
@@ -113,6 +113,7 @@ export type ColumnDefinition<ColumnName extends string = string> = ColumnBasePro
|
|
|
113
113
|
isBigInt?: boolean;
|
|
114
114
|
isUuid?: boolean;
|
|
115
115
|
defaultComparator?: string;
|
|
116
|
+
checkAllButton?: boolean;
|
|
116
117
|
};
|
|
117
118
|
getFilterCriteria?: (value: string) => {
|
|
118
119
|
[column: string]: any;
|
|
@@ -0,0 +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
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { components as selectComponents } from 'react-select';
|
|
14
|
+
import Checkbox from '../../../Forms/Checkbox/Checkbox';
|
|
15
|
+
import Toggle from '../../Toggle/Toggle';
|
|
16
|
+
import SelectedIndicator from '../components/SelectedIndicator';
|
|
17
|
+
export var ChevronOption = function (props) {
|
|
18
|
+
var theme = props.theme, isSelected = props.isSelected, selectOption = props.selectOption, children = props.children, data = props.data;
|
|
19
|
+
var showCheckbox = !!(theme.optionVariant == 'checkbox');
|
|
20
|
+
var showToggle = !!(theme.optionVariant == 'toggle');
|
|
21
|
+
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 })] })));
|
|
22
|
+
};
|
|
23
|
+
export default ChevronOption;
|
|
@@ -0,0 +1,21 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { components as selectComponents } from 'react-select';
|
|
14
|
+
import SelectAll from '../components/SelectAll';
|
|
15
|
+
import ResetAll from '../components/ResetAll';
|
|
16
|
+
var ConnectedMenu = function (props) {
|
|
17
|
+
var theme = props.theme;
|
|
18
|
+
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;
|
|
19
|
+
return (_jsxs(selectComponents.MenuList, __assign({}, props, { children: [selectAllButton && (_jsx(SelectAll, { theme: theme, onCustomSelectAll: onCustomSelectAll, onCustomDeselectAll: onCustomDeselectAll, value: value, options: options, maxMenuHeight: maxMenuHeight })), props.children, resetGridButton && _jsx(ResetAll, { onReset: resetGrid })] })));
|
|
20
|
+
};
|
|
21
|
+
export default ConnectedMenu;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
import { components as selectComponents } from 'react-select';
|
|
18
|
+
import styled, { th } from '@xstyled/styled-components';
|
|
19
|
+
// MultiValue container with count of selected options
|
|
20
|
+
var StyledNumber = styled.div(templateObject_1 || (templateObject_1 = __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'));
|
|
21
|
+
var CountMultiValue = function (props) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
var selectVal = props.selectProps.value;
|
|
24
|
+
var inputVal = props.selectProps.inputValue;
|
|
25
|
+
if (!inputVal && ((_a = props.data) === null || _a === void 0 ? void 0 : _a.value) == ((_b = selectVal[0]) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx(selectComponents.MultiValue, __assign({}, props, { children: props.children })), selectVal.length > 1 ? _jsxs(StyledNumber, { children: ["+", selectVal.length - 1] }) : null] }));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export default CountMultiValue;
|
|
33
|
+
var templateObject_1;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import { components as selectComponents } from 'react-select';
|
|
14
|
+
export var CustomInput = function (props) {
|
|
15
|
+
var name = props.selectProps.name;
|
|
16
|
+
var value = !!name ? "".concat(name, "Inp") : props.id;
|
|
17
|
+
return _jsx(selectComponents.Input, __assign({}, props, { "data-cy": value }));
|
|
18
|
+
};
|
|
19
|
+
export default CustomInput;
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { components as selectComponents } from 'react-select';
|
|
18
|
+
import styled from '@xstyled/styled-components';
|
|
19
|
+
import { ArrowDown } from '../../Icon/icons/ArrowDown';
|
|
20
|
+
import { ArrowUp } from '../../Icon/icons/ArrowUp';
|
|
21
|
+
// Option with chevron form new design
|
|
22
|
+
var ChevronDiv = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-self: center;\n display: flex;\n"], ["\n align-self: center;\n display: flex;\n"])));
|
|
23
|
+
export var DropdownIndicator = function (props) {
|
|
24
|
+
var _a = props.selectProps, menuIsOpen = _a.menuIsOpen, name = _a.name;
|
|
25
|
+
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" }) }) })));
|
|
26
|
+
};
|
|
27
|
+
export default DropdownIndicator;
|
|
28
|
+
var templateObject_1;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { components } from 'react-select';
|
|
29
|
+
import Icon from '../../Icon/Icon';
|
|
30
|
+
import styled from '@xstyled/styled-components';
|
|
31
|
+
// Value container with icon
|
|
32
|
+
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) {
|
|
33
|
+
var hasValue = _a.hasValue;
|
|
34
|
+
return (hasValue ? 'black' : '#a3b3c1');
|
|
35
|
+
});
|
|
36
|
+
var IconValueContainer = function (props) {
|
|
37
|
+
var _a;
|
|
38
|
+
// eslint-disable-next-line react/prop-types
|
|
39
|
+
var children = props.children, rest = __rest(props, ["children"]);
|
|
40
|
+
var icon = (_a = rest.selectProps) === null || _a === void 0 ? void 0 : _a.icon;
|
|
41
|
+
var hasValue = rest.hasValue;
|
|
42
|
+
return (_jsxs(_Fragment, { children: [icon && (_jsx(IconDiv, { className: "inputIcon", hasValue: hasValue, children: _jsx(Icon, { icon: icon }) })), _jsx(components.ValueContainer, __assign({}, rest, { children: children }))] }));
|
|
43
|
+
};
|
|
44
|
+
export default IconValueContainer;
|
|
45
|
+
var templateObject_1;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Paragraph3 } from '../../Typography/Typography';
|
|
7
|
+
import styled from '@xstyled/styled-components';
|
|
8
|
+
import { Trans } from '@lingui/react';
|
|
9
|
+
var ResetWrap = styled.div(templateObject_1 || (templateObject_1 = __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"])));
|
|
10
|
+
var ResetAll = function (_a) {
|
|
11
|
+
var onReset = _a.onReset;
|
|
12
|
+
return (_jsx(ResetWrap, { onClick: onReset, children: _jsx(Paragraph3, { variant: "semiBold", children: _jsx(Trans, { id: "dataGrid.buttonClearConfig", message: "Reset config" }) }) }));
|
|
13
|
+
};
|
|
14
|
+
export default ResetAll;
|
|
15
|
+
var templateObject_1;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectProps, CustomTheme } from '../types';
|
|
2
|
+
type Props = {
|
|
3
|
+
onCustomSelectAll: () => void;
|
|
4
|
+
onCustomDeselectAll: () => void;
|
|
5
|
+
value: SelectProps['value'];
|
|
6
|
+
options: SelectProps['options'];
|
|
7
|
+
maxMenuHeight: number;
|
|
8
|
+
theme: CustomTheme;
|
|
9
|
+
};
|
|
10
|
+
declare const SelectAll: ({ onCustomSelectAll, onCustomDeselectAll, value, options, maxMenuHeight, theme }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default SelectAll;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useCallback, useState, useEffect, useRef } from 'react';
|
|
7
|
+
import styled, { th } from '@xstyled/styled-components';
|
|
8
|
+
import { Trans } from '@lingui/react';
|
|
9
|
+
import Checkbox from '../../../Forms/Checkbox/Checkbox';
|
|
10
|
+
import Toggle from '../../Toggle/Toggle';
|
|
11
|
+
import SelectedIndicator from '../components/SelectedIndicator';
|
|
12
|
+
var SelectAllWrap = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n margin: 0px 2px 1px 0px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n cursor: pointer;\n\n :hover {\n background-color: ", ";\n }\n"], ["\n display: flex;\n margin: 0px 2px 1px 0px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n cursor: pointer;\n\n :hover {\n background-color: ", ";\n }\n"])), function (_a) {
|
|
13
|
+
var additionalPadding = _a.additionalPadding;
|
|
14
|
+
return (additionalPadding ? '8px 27px 8px 10px' : '10px 10px');
|
|
15
|
+
}, function (_a) {
|
|
16
|
+
var isSelected = _a.isSelected;
|
|
17
|
+
return (isSelected ? th.color('red20') : 'transparent');
|
|
18
|
+
}, function (_a) {
|
|
19
|
+
var isSelected = _a.isSelected;
|
|
20
|
+
return (isSelected ? th.color('red1') : th.color('textPrimary'));
|
|
21
|
+
}, function (_a) {
|
|
22
|
+
var isSelected = _a.isSelected;
|
|
23
|
+
return (isSelected ? th.color('red30') : th.color('bgLightGray1'));
|
|
24
|
+
});
|
|
25
|
+
var SelectAll = function (_a) {
|
|
26
|
+
var onCustomSelectAll = _a.onCustomSelectAll, onCustomDeselectAll = _a.onCustomDeselectAll, value = _a.value, options = _a.options, maxMenuHeight = _a.maxMenuHeight, theme = _a.theme;
|
|
27
|
+
var showCheckbox = !!(theme.optionVariant === 'checkbox');
|
|
28
|
+
var showToggle = !!(theme.optionVariant === 'toggle');
|
|
29
|
+
var ref = useRef(null);
|
|
30
|
+
var _b = useState(false), additionalPadding = _b[0], setAdditionalPadding = _b[1];
|
|
31
|
+
var _c = useState(false), isSelected = _c[0], setIsSelected = _c[1];
|
|
32
|
+
var handleSelectAll = useCallback(function () {
|
|
33
|
+
if (!isSelected) {
|
|
34
|
+
setIsSelected(true);
|
|
35
|
+
onCustomSelectAll();
|
|
36
|
+
}
|
|
37
|
+
else if (isSelected) {
|
|
38
|
+
setIsSelected(false);
|
|
39
|
+
onCustomDeselectAll();
|
|
40
|
+
}
|
|
41
|
+
}, [isSelected, onCustomDeselectAll, onCustomSelectAll]);
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
var _a;
|
|
44
|
+
// if the height of all options is higher than maxMenuHeight and the slider is displayed => the indentation needs to be increased
|
|
45
|
+
((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && setAdditionalPadding(ref.current.offsetHeight * ((options === null || options === void 0 ? void 0 : options.length) || 0) > maxMenuHeight);
|
|
46
|
+
}, [additionalPadding, maxMenuHeight, options === null || options === void 0 ? void 0 : options.length, value]);
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (value && Array.isArray(value)) {
|
|
49
|
+
(options === null || options === void 0 ? void 0 : options.length) === value.length && setIsSelected(true);
|
|
50
|
+
(options === null || options === void 0 ? void 0 : options.length) !== value.length && setIsSelected(false);
|
|
51
|
+
}
|
|
52
|
+
}, [maxMenuHeight, options === null || options === void 0 ? void 0 : options.length, value]);
|
|
53
|
+
return (_jsxs(SelectAllWrap, { isSelected: isSelected, onClick: handleSelectAll, 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' })] }));
|
|
54
|
+
};
|
|
55
|
+
export default SelectAll;
|
|
56
|
+
var templateObject_1;
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
import styled from '@xstyled/styled-components';
|
|
6
|
+
var SelectedIndicator = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-right: 12px;\n"], ["\n padding-right: 12px;\n"])));
|
|
7
|
+
export default SelectedIndicator;
|
|
8
|
+
var templateObject_1;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, memo } from 'react';
|
|
3
|
+
// Option for big lists
|
|
4
|
+
var SimplifiedOptionInner = function (props) {
|
|
5
|
+
var styles = props.getStyles('option', props);
|
|
6
|
+
var data = props.data, selectOption = props.selectOption, innerProps = props.innerProps;
|
|
7
|
+
var handleClick = useCallback(function () { return selectOption(data); }, [data, selectOption]);
|
|
8
|
+
return (_jsx("div", { style: styles, onClick: handleClick, onMouseOver: innerProps.onMouseOver, onMouseMove: innerProps.onMouseMove, children: props.label }));
|
|
9
|
+
};
|
|
10
|
+
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); });
|
|
11
|
+
export default SimplifiedOption;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ConnectedMenu from '../components/ConnectedMenu';
|
|
2
|
+
import IconValueContainer from '../components/IconValueContainer';
|
|
3
|
+
import SimplifiedOption from '../components/SimplifiedOption';
|
|
4
|
+
import CountMultiValue from '../components/CountMultiValue';
|
|
5
|
+
import ChevronOption from '../components/ChevronOption';
|
|
6
|
+
import DropdownIndicator from '../components/DropdownIndicator';
|
|
7
|
+
import CustomInput from '../components/CustomInput';
|
|
2
8
|
import { getCustomTheme as getFormCustomTheme, CustomStyles as SelectCustomStyles } from './selectStyles';
|
|
3
9
|
import { useTheme } from '@xstyled/styled-components';
|
|
4
10
|
import { useMemo } from 'react';
|
|
@@ -19,7 +25,7 @@ export var useStylesAndComponents = function (style, optionVariant, multiLabelVa
|
|
|
19
25
|
components.DropdownIndicator = null;
|
|
20
26
|
}
|
|
21
27
|
if (showResetGridButton || showSelectAllButton) {
|
|
22
|
-
components.
|
|
28
|
+
components.MenuList = ConnectedMenu;
|
|
23
29
|
}
|
|
24
30
|
components.Input = CustomInput;
|
|
25
31
|
var themes = getFormCustomTheme(systemTheme, optionVariant, style == 'gridFilter');
|
|
@@ -1,42 +1,4 @@
|
|
|
1
|
-
import { SelectProps } from '../types';
|
|
2
|
-
import { ControlProps, CSSObjectWithLabel } from 'react-select';
|
|
3
|
-
type BaseColors = {
|
|
4
|
-
primary: string;
|
|
5
|
-
optionTextColor: string;
|
|
6
|
-
inputDisabledColor: string;
|
|
7
|
-
inputBorderColor: string;
|
|
8
|
-
whiteBackgroundColor: string;
|
|
9
|
-
inputTextColor: string;
|
|
10
|
-
placeholderTextColor: string;
|
|
11
|
-
activeOptionBackground: string;
|
|
12
|
-
disabledTextColor: string;
|
|
13
|
-
inputBorderHoverColor: string;
|
|
14
|
-
menuHoverBackgroundColor: string;
|
|
15
|
-
dropdownIndicatorColor: string;
|
|
16
|
-
hoverToActiveOptionBackground: string;
|
|
17
|
-
defaultControlColor: string;
|
|
18
|
-
};
|
|
19
|
-
type BaseState<ThemeType = BaseColors> = {
|
|
20
|
-
theme: ThemeType;
|
|
21
|
-
isSelected: boolean;
|
|
22
|
-
isFocused: boolean;
|
|
23
|
-
isDisabled: boolean;
|
|
24
|
-
isMulti: boolean;
|
|
25
|
-
selectProps: SelectProps;
|
|
26
|
-
} & ControlProps;
|
|
27
|
-
type StylesConfig<T = BaseState> = Record<string, (styles: CSSObjectWithLabel, state: T) => CSSObjectWithLabel>;
|
|
28
|
-
type CustomTheme = {
|
|
29
|
-
colors: BaseColors;
|
|
30
|
-
height: string | number;
|
|
31
|
-
focusBoxShadow?: string;
|
|
32
|
-
textWeightNormal: string;
|
|
33
|
-
optionVariant: Required<SelectProps>['optionVariant'];
|
|
34
|
-
borderRadius: string;
|
|
35
|
-
font: string;
|
|
36
|
-
narrowIndicators: boolean;
|
|
37
|
-
flexWrap: 'wrap' | 'nowrap';
|
|
38
|
-
};
|
|
39
|
-
type State = BaseState<CustomTheme>;
|
|
1
|
+
import { SelectProps, StylesConfig, CustomTheme } from '../types';
|
|
40
2
|
export declare const CustomStyles: StylesConfig<State>;
|
|
41
3
|
type ThemeGetter = (theme: any) => CustomTheme;
|
|
42
4
|
export declare const getCustomTheme: (theme: any, optionVariant: Required<SelectProps>['optionVariant'], useFilterSubvariant: boolean) => ThemeGetter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { SpaceAround } from '../SpaceAround/types';
|
|
3
|
-
import { Theme } from 'react-select';
|
|
3
|
+
import { Theme, ControlProps, CSSObjectWithLabel } from 'react-select';
|
|
4
4
|
export type Option<Value = string | number> = {
|
|
5
5
|
value: Value;
|
|
6
6
|
label: string | number;
|
|
@@ -53,3 +53,40 @@ export type SelectProps = {
|
|
|
53
53
|
systemTheme?: Theme;
|
|
54
54
|
menuPlacement?: string;
|
|
55
55
|
};
|
|
56
|
+
export type BaseColors = {
|
|
57
|
+
primary: string;
|
|
58
|
+
optionTextColor: string;
|
|
59
|
+
inputDisabledColor: string;
|
|
60
|
+
inputBorderColor: string;
|
|
61
|
+
whiteBackgroundColor: string;
|
|
62
|
+
inputTextColor: string;
|
|
63
|
+
placeholderTextColor: string;
|
|
64
|
+
activeOptionBackground: string;
|
|
65
|
+
disabledTextColor: string;
|
|
66
|
+
inputBorderHoverColor: string;
|
|
67
|
+
menuHoverBackgroundColor: string;
|
|
68
|
+
dropdownIndicatorColor: string;
|
|
69
|
+
hoverToActiveOptionBackground: string;
|
|
70
|
+
defaultControlColor: string;
|
|
71
|
+
};
|
|
72
|
+
type BaseState<ThemeType = BaseColors> = {
|
|
73
|
+
theme: ThemeType;
|
|
74
|
+
isSelected: boolean;
|
|
75
|
+
isFocused: boolean;
|
|
76
|
+
isDisabled: boolean;
|
|
77
|
+
isMulti: boolean;
|
|
78
|
+
selectProps: SelectProps;
|
|
79
|
+
} & ControlProps;
|
|
80
|
+
export type StylesConfig<T = BaseState> = Record<string, (styles: CSSObjectWithLabel, state: T) => CSSObjectWithLabel>;
|
|
81
|
+
export type CustomTheme = {
|
|
82
|
+
colors: BaseColors;
|
|
83
|
+
height: string | number;
|
|
84
|
+
focusBoxShadow?: string;
|
|
85
|
+
textWeightNormal: string;
|
|
86
|
+
optionVariant: Required<SelectProps>['optionVariant'];
|
|
87
|
+
borderRadius: string;
|
|
88
|
+
font: string;
|
|
89
|
+
narrowIndicators: boolean;
|
|
90
|
+
flexWrap: 'wrap' | 'nowrap';
|
|
91
|
+
};
|
|
92
|
+
export {};
|