@mailstep/design-system 0.6.20 → 0.6.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.6.20",
3
+ "version": "0.6.21",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -107,7 +107,7 @@ var DatePickerRange = function (props) {
107
107
  // Check if the second value is not selected and the first value is the same as the initial value
108
108
  var secondDatePickerValue = cleanValue[1] === null ? cleanValue[0] : cleanValue[1];
109
109
  var ref = useClickOutside({ onClose: onClose });
110
- return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue), label: props.label, onFocus: openPicker, iconOnClick: openPicker, appearance: "grid", onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, { className: "ignore-element-for-closing-hook", children: [_jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: (_c = cleanValue[0]) !== null && _c !== void 0 ? _c : '', initialViewDate: initialViewDate[0], secondValue: endRangeValue, onChange: setDateFrom, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true, disabled: cleanValue[0] === null })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, disabled: secondDatePickerValue === null }))] })) }) })] }));
110
+ return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue), label: props.label, onFocus: openPicker, iconOnClick: openPicker, onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, { className: "ignore-element-for-closing-hook", children: [_jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: (_c = cleanValue[0]) !== null && _c !== void 0 ? _c : '', initialViewDate: initialViewDate[0], secondValue: endRangeValue, onChange: setDateFrom, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true, disabled: cleanValue[0] === null })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, disabled: secondDatePickerValue === null }))] })) }) })] }));
111
111
  };
112
112
  export default DatePickerRange;
113
113
  var templateObject_1;
@@ -70,6 +70,6 @@ var NumberRange = function (props) {
70
70
  var onChangeComparator = useEvent(function (option) {
71
71
  onChange({ comparator: option.value, value: fieldValue });
72
72
  });
73
- return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, value: fieldValue, label: label, "data-cy": "".concat(name, "Inp"), onChange: onChangeTextInput, iconOnClick: togglePicker, appearance: "grid", icon: "ellipsisVertical", iconPlacement: "right", type: "text", className: className, autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: renderedComparator, selected: comparator, onClick: onChangeComparator }) }))] }));
73
+ return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, value: fieldValue, label: label, "data-cy": "".concat(name, "Inp"), onChange: onChangeTextInput, iconOnClick: togglePicker, icon: "ellipsisVertical", iconPlacement: "right", type: "text", className: className, autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: renderedComparator, selected: comparator, onClick: onChangeComparator }) }))] }));
74
74
  };
75
75
  export default NumberRange;
@@ -85,6 +85,6 @@ var TextRange = function (props) {
85
85
  var onChangeComparator = useEvent(function (option) {
86
86
  onChange({ comparator: option.value, value: fieldValue, isInvalid: isInvalid });
87
87
  });
88
- return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, "data-test": name, "data-cy": "".concat(name, "Inp"), value: fieldValue, label: label, onChange: onChangeTextInput, iconOnClick: !eqOnly ? togglePicker : undefined, appearance: "grid", icon: !eqOnly ? 'ellipsisVertical' : 'warning', iconPlacement: "right", iconTooltip: eqOnly ? eqOnlyTxt : undefined, type: "text", className: className, error: (!!validation && isInvalid && validation.errorMsg) || '', errorAppearance: 'tooltip', autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: renderedComparator, selected: comparator, onClick: onChangeComparator }) }))] }));
88
+ return (_jsxs("div", { ref: pickerRef, children: [_jsx(Input, __assign({ name: name, "data-test": name, "data-cy": "".concat(name, "Inp"), value: fieldValue, label: label, onChange: onChangeTextInput, iconOnClick: !eqOnly ? togglePicker : undefined, icon: !eqOnly ? 'ellipsisVertical' : 'warning', iconPlacement: "right", iconTooltip: eqOnly ? eqOnlyTxt : undefined, type: "text", className: className, error: (!!validation && isInvalid && validation.errorMsg) || '', errorAppearance: 'tooltip', autoComplete: "off" }, rest)), isOpen && (_jsx(OverlayComponent, { children: _jsx(IconList, { list: renderedComparator, selected: comparator, onClick: onChangeComparator }) }))] }));
89
89
  };
90
90
  export default TextRange;
@@ -25,7 +25,7 @@ var __rest = (this && this.__rest) || function (s, e) {
25
25
  return t;
26
26
  };
27
27
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
28
- import { useCallback, useMemo, memo, useState, useEffect, useRef } from 'react';
28
+ import { useCallback, memo, useState, useEffect, useRef } from 'react';
29
29
  import { components } from 'react-select';
30
30
  import styled, { th } from '@xstyled/styled-components';
31
31
  import { components as selectComponents } from 'react-select';
@@ -57,22 +57,22 @@ export var IconValueContainer = function (props) {
57
57
  var hasValue = rest.hasValue;
58
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
59
  };
60
- // MultiValue container replacement with count of selected options
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'));
61
62
  export var CountMultiValue = function (props) {
62
63
  var _a, _b;
63
64
  var selectVal = props.selectProps.value;
64
65
  var inputVal = props.selectProps.inputValue;
65
- var transValues = useMemo(function () { return ({ count: selectVal.length }); }, [selectVal.length]);
66
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 (_jsx(selectComponents.SingleValue, __assign({}, props, { children: selectVal.length > 1 ? (_jsx(Trans, { id: "datagrid.filterCell.optionsSelectedLabel", message: '{count} options', values: transValues })) : (props.children) })));
67
+ return (_jsxs(_Fragment, { children: [_jsx(selectComponents.MultiValue, __assign({}, props, { children: props.children })), selectVal.length > 1 ? _jsxs(StyledNumber, { children: ["+", selectVal.length - 1] }) : null] }));
68
68
  }
69
69
  else {
70
70
  return null;
71
71
  }
72
72
  };
73
73
  // Option with chevron form new design
74
- var ChevronDiv = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: center;\n display: flex;\n"], ["\n align-self: center;\n display: flex;\n"])));
75
- var SelectedIndicator = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-right: 12px;\n"], ["\n padding-right: 12px;\n"])));
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
76
  export var ChevronOption = function (props) {
77
77
  var theme = props.theme, isSelected = props.isSelected, selectOption = props.selectOption, children = props.children, data = props.data;
78
78
  var showCheckbox = !!(theme.optionVariant == 'checkbox');
@@ -80,7 +80,7 @@ export var ChevronOption = function (props) {
80
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
81
  };
82
82
  // menu with check all and reset config button
83
- var SelectAll = styled.div(templateObject_4 || (templateObject_4 = __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) {
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
84
  var additionalPadding = _a.additionalPadding;
85
85
  return (additionalPadding ? '8px 27px 8px 10px' : '8px 10px');
86
86
  }, function (_a) {
@@ -93,7 +93,7 @@ var SelectAll = styled.div(templateObject_4 || (templateObject_4 = __makeTemplat
93
93
  var isSelected = _a.isSelected;
94
94
  return (isSelected ? th.color('red30') : th.color('bgLightGray1'));
95
95
  });
96
- var ConfigWrap = styled.div(templateObject_5 || (templateObject_5 = __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"])));
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
97
  export var ConnectedMenu = function (props) {
98
98
  var theme = props.theme;
99
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;
@@ -134,4 +134,4 @@ export var DropdownIndicator = function (props) {
134
134
  var _a = props.selectProps, menuIsOpen = _a.menuIsOpen, name = _a.name;
135
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
136
  };
137
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
137
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -34,6 +34,7 @@ type CustomTheme = {
34
34
  borderRadius: string;
35
35
  font: string;
36
36
  narrowIndicators: boolean;
37
+ flexWrap: 'wrap' | 'nowrap';
37
38
  };
38
39
  type State = BaseState<CustomTheme>;
39
40
  export declare const CustomStyles: StylesConfig<State>;
@@ -19,10 +19,14 @@ export var CustomStyles = {
19
19
  return __assign(__assign({}, styles), { borderColor: selectProps.isInvalid ? colors.primary : isFocused ? colors.inputTextColor : colors.inputBorderColor, backgroundColor: isDisabled ? colors.menuHoverBackgroundColor : colors.whiteBackgroundColor, boxShadow: theme.focusBoxShadow, borderRadius: theme.borderRadius, '& input': {
20
20
  fontWeight: theme.textWeightNormal,
21
21
  fontFamily: theme.font,
22
- }, '&:hover': __assign(__assign({}, ((_b = styles['&:hover']) !== null && _b !== void 0 ? _b : {})), { borderColor: colors.inputBorderHoverColor }), fontSize: '14px', minHeight: theme.height, minWidth: 'min-content', '.inputIcon': {
22
+ }, '&:hover': __assign(__assign({}, ((_b = styles['&:hover']) !== null && _b !== void 0 ? _b : {})), { borderColor: colors.inputBorderHoverColor }), fontSize: '14px', minWidth: 'min-content', '.inputIcon': {
23
23
  color: isDisabled ? colors.defaultControlColor : !!selectProps.value ? colors.inputTextColor : colors.defaultControlColor,
24
24
  } });
25
25
  },
26
+ valueContainer: function (styles, _a) {
27
+ var theme = _a.theme;
28
+ return __assign(__assign({}, styles), { width: '50px', flexWrap: theme.flexWrap });
29
+ },
26
30
  singleValue: function (styles, _a) {
27
31
  var selectProps = _a.selectProps, theme = _a.theme, isDisabled = _a.isDisabled;
28
32
  return __assign(__assign({}, styles), { position: 'absolute', top: '50%', transform: 'translateY(-50%)', color: selectProps.isInvalid
@@ -140,6 +144,6 @@ export var getCustomTheme = function (theme, optionVariant, useFilterSubvariant)
140
144
  hoverToActiveOptionBackground: th.color('red30')({ theme: theme }),
141
145
  };
142
146
  return function (reactSelectTheme) {
143
- return __assign(__assign({}, reactSelectTheme), { colors: customColors, focusBoxShadow: null, height: useFilterSubvariant ? '32px' : '38px', textWeightNormal: th.fontWeight('normal')({ theme: theme }), optionVariant: optionVariant, borderRadius: th.radius('lg')({ theme: theme }), font: th.font('primary')({ theme: theme }), narrowIndicators: !!useFilterSubvariant });
147
+ return __assign(__assign({}, reactSelectTheme), { colors: customColors, focusBoxShadow: null, height: '38px', flexWrap: useFilterSubvariant ? 'nowrap' : 'wrap', textWeightNormal: th.fontWeight('normal')({ theme: theme }), optionVariant: optionVariant, borderRadius: th.radius('lg')({ theme: theme }), font: th.font('primary')({ theme: theme }), narrowIndicators: !!useFilterSubvariant });
144
148
  };
145
149
  };