@mailstep/design-system 0.5.0-beta.19 → 0.5.0-beta.20

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.5.0-beta.19",
3
+ "version": "0.5.0-beta.20",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -30,8 +30,6 @@
30
30
  "@fortawesome/pro-regular-svg-icons": "^6.0.0",
31
31
  "@fortawesome/pro-solid-svg-icons": "^6.3.0",
32
32
  "@fortawesome/react-fontawesome": "^0.2.0",
33
- "@lingui/cli": "3.17.2",
34
- "@lingui/macro": "3.17.2",
35
33
  "@lingui/react": "3.17.2",
36
34
  "@popperjs/core": "^2.11.8",
37
35
  "@storybook/addon-controls": "7.6.8",
@@ -86,14 +84,12 @@
86
84
  "swiper": "^11.0.3",
87
85
  "tslib": "^2.6.2",
88
86
  "typescript": "^5.0.4",
89
- "vite": "^4.4.5",
87
+ "vite": "^5.0.10",
90
88
  "vite-plugin-dts": "^3.6.4",
91
89
  "vite-plugin-static-copy": "^1.0.0",
92
90
  "webpack": "^5.82.1"
93
91
  },
94
92
  "peerDependencies": {
95
- "@babel/core": "^7.20.12",
96
- "@babel/preset-typescript": "^7.23.3",
97
93
  "@fortawesome/fontawesome-svg-core": "^6.3.0",
98
94
  "@fortawesome/free-brands-svg-icons": "^6.1.1",
99
95
  "@fortawesome/pro-duotone-svg-icons": "^6.0.0",
@@ -101,12 +97,10 @@
101
97
  "@fortawesome/pro-regular-svg-icons": "^6.0.0",
102
98
  "@fortawesome/pro-solid-svg-icons": "^6.3.0",
103
99
  "@fortawesome/react-fontawesome": "^0.2.0",
104
- "@lingui/cli": "3.17.2",
105
- "@lingui/macro": "3.17.2",
106
100
  "@lingui/react": "3.17.2",
101
+ "@lingui/core": "3.17.2",
107
102
  "@popperjs/core": "^2.11.8",
108
103
  "@xstyled/styled-components": "^3.8.0",
109
- "babel-loader": "^9.1.3",
110
104
  "babel-plugin-macros": "^3.1.0",
111
105
  "immer": "9.0.7",
112
106
  "lodash": "^4.17.21",
@@ -3,6 +3,7 @@ import { Trans } from '@lingui/react';
3
3
  import { x } from '@xstyled/styled-components';
4
4
  import Select from '../../Elements/Select';
5
5
  import ButtonMore from './components/ButtonMore/ButtonMore';
6
+ import { i18n } from '@lingui/core';
6
7
  export var getCreateButton = function (onCreate, canCreate, disabled) { return ({
7
8
  label: _jsx(Trans, { id: "dataGrid.actionOptions.createNew", message: "Create new" }),
8
9
  style: 'primary',
@@ -42,7 +43,7 @@ export var getEshopSelect = function (eshopOptions, selectedEshop, onChange, isC
42
43
  if (eshopOptions.length > 1) {
43
44
  eshops.push({
44
45
  position: 'top-right',
45
- node: (_jsx(x.div, { w: "200px", "data-cy": "eshopSelect", children: _jsx(Select, { name: "eshop", options: eshopOptions, value: selectedEshop, onChange: onChange, isSearchable: false, isClearable: isClearable, disabled: !eshopOptions.length, placeholder: '1' }) })),
46
+ node: (_jsx(x.div, { w: "200px", "data-cy": "eshopSelect", children: _jsx(Select, { name: "eshop", options: eshopOptions, value: selectedEshop, onChange: onChange, isSearchable: false, isClearable: isClearable, disabled: !eshopOptions.length, placeholder: i18n._({ id: 'products.eshopFilterPlaceholder', message: 'Select eshop...' }) }) })),
46
47
  });
47
48
  }
48
49
  return eshops;
@@ -10,6 +10,7 @@ import { useGridActionTrigger, useToggleAllCheckbox } from '../../utils/public';
10
10
  import { useModal } from '../../../Modal/hooks/useModal';
11
11
  import { Button } from '../../../../Elements/Button';
12
12
  import ButtonMore from '../ButtonMore/ButtonMore';
13
+ import { i18n } from '@lingui/core';
13
14
  var Wrap = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n margin-right: 2;\n gap: 24px;\n background-color: red;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n width: 100%;\n margin-right: 2;\n gap: 24px;\n background-color: red;\n position: relative;\n"])));
14
15
  var ActionsWrap = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translate(-50%);\n width: 596px;\n padding: 12px 24px;\n border-radius: 10px;\n background-color: #fff;\n box-shadow: dropShadow;\n z-index: 2;\n"], ["\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translate(-50%);\n width: 596px;\n padding: 12px 24px;\n border-radius: 10px;\n background-color: #fff;\n box-shadow: dropShadow;\n z-index: 2;\n"])));
15
16
  var StyledText = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 14px;\n line-height: 18px;\n color: blue2;\n font-weight: 600;\n"], ["\n font-size: 14px;\n line-height: 18px;\n color: blue2;\n font-weight: 600;\n"])));
@@ -42,7 +43,11 @@ var ActionHead = function (_a) {
42
43
  return [];
43
44
  }, [actionColumn, onSubmit]);
44
45
  var canExport = typeof onExport === 'function';
45
- return (_jsx(Wrap, { children: checkedRowsCount > 0 && (_jsx(ActionsWrap, { children: _jsxs(ContentWrap, { children: [_jsx(StyledText, { children: _jsx(Trans, { id: "dataGrid.checkedRowsCount", message: "Selected {checkedRowsCount} items", values: { checkedRowsCount: checkedRowsCount } }) }), _jsxs(ButtonsWrap, { children: [_jsx(Button, { type: "button", onClick: checkAll, appearance: "secondaryLg", "data-cy": "checkAllBtn", disabled: checked, children: _jsx(Trans, { id: "dataGrid.checkAll", message: "Check all" }) }), canExport && (_jsx(Button, { type: "button", onClick: onExportClick, appearance: "primary", "data-cy": "exportBtn", disabled: !rowsData.length, children: _jsx(Trans, { id: "dataGrid.actionOptions.export", message: "Export" }) })), ((_b = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _b === void 0 ? void 0 : _b.length) && (_jsx(ButtonMore, { items: actionsOptions, disabled: !enabledActions.length || !rowsData.length, dropdownPosition: "top" }))] })] }) })) }));
46
+ return (_jsx(Wrap, { children: checkedRowsCount > 0 && (_jsx(ActionsWrap, { children: _jsxs(ContentWrap, { children: [_jsx(StyledText, { children: i18n._({
47
+ id: 'dataGrid.checkedRowsCount',
48
+ message: "Selected {checkedRowsCount} items",
49
+ values: { checkedRowsCount: checkedRowsCount },
50
+ }) }), _jsxs(ButtonsWrap, { children: [_jsx(Button, { type: "button", onClick: checkAll, appearance: "secondaryLg", "data-cy": "checkAllBtn", disabled: checked, children: _jsx(Trans, { id: "dataGrid.checkAll", message: "Check all" }) }), canExport && (_jsx(Button, { type: "button", onClick: onExportClick, appearance: "primary", "data-cy": "exportBtn", disabled: !rowsData.length, children: _jsx(Trans, { id: "dataGrid.actionOptions.export", message: "Export" }) })), ((_b = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _b === void 0 ? void 0 : _b.length) && (_jsx(ButtonMore, { items: actionsOptions, disabled: !enabledActions.length || !rowsData.length, dropdownPosition: "top" }))] })] }) })) }));
46
51
  };
47
52
  export default ActionHead;
48
53
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -23,11 +23,11 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import { useMemo } from 'react';
25
25
  import GridSelect from '../GridSelect';
26
- import { Trans } from '@lingui/react';
26
+ import { i18n } from '@lingui/core';
27
27
  var getFlagOptions = function () { return [
28
- { value: '', label: _jsx(Trans, { id: "dataGrid.columnActive.filterOptions.all", message: "All" }) },
29
- { value: '1', label: _jsx(Trans, { id: "dataGrid.columnActive.filterOptions.yes", message: "Yes" }) },
30
- { value: '0', label: _jsx(Trans, { id: "dataGrid.columnActive.filterOptions.no", message: "No" }) },
28
+ { value: '', label: i18n._({ id: 'dataGrid.columnActive.filterOptions.all', message: 'All' }) },
29
+ { value: '1', label: i18n._({ id: 'dataGrid.columnActive.filterOptions.yes', message: 'Yes' }) },
30
+ { value: '0', label: i18n._({ id: 'dataGrid.columnActive.filterOptions.no', message: 'No' }) },
31
31
  ]; };
32
32
  var SelectFilter = function (_a) {
33
33
  var restProps = __rest(_a, []);
@@ -32,7 +32,7 @@ import { sameDate } from './utils/sameDate';
32
32
  import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
33
33
  import DatePicker from '../../../../Elements/DatePicker';
34
34
  import Input from '../../../../Forms/Input';
35
- import { Trans } from '@lingui/react';
35
+ import { i18n } from '@lingui/core';
36
36
  var RangeWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n margin-right: 20px;\n"], ["\n display: inline-flex;\n margin-right: 20px;\n"
37
37
  // User readable date range.
38
38
  ])));
@@ -64,7 +64,7 @@ var DatePickerRange = function (props) {
64
64
  var _e = useState((_a = value === null || value === void 0 ? void 0 : value[0]) !== null && _a !== void 0 ? _a : undefined), startRangeValue = _e[0], setStartRangeValue = _e[1];
65
65
  var _f = useState((_b = value === null || value === void 0 ? void 0 : value[1]) !== null && _b !== void 0 ? _b : undefined), endRangeValue = _f[0], setEndRangeValue = _f[1];
66
66
  var timeFormat = filterTime ? 'HH:mm' : false;
67
- var placeholder = '1';
67
+ var placeholder = i18n._({ id: 'dataGrid.filterCell', message: 'Type to filter' });
68
68
  var cleanValue = React.useMemo(function () { return [
69
69
  typeof (value === null || value === void 0 ? void 0 : value[0]) === 'string' ? new Date(value[0]) : (value === null || value === void 0 ? void 0 : value[0]) || undefined,
70
70
  typeof (value === null || value === void 0 ? void 0 : value[1]) === 'string' ? new Date(value[1]) : (value === null || value === void 0 ? void 0 : value[1]) || undefined,
@@ -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 && _jsx(Trans, { 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 && _jsx(Trans, { 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, 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 }))] })) }) })] }));
111
111
  };
112
112
  export default DatePickerRange;
113
113
  var templateObject_1;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const List: import("styled-components").StyledComponent<"ul", import("@xstyled/system").Theme, {}, never>;
3
2
  export declare const ListItem: import("styled-components").StyledComponent<"li", import("@xstyled/system").Theme, {}, never>;
4
3
  export declare const ListItemContent: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {
@@ -8,7 +7,7 @@ export declare const ListItemIcon: import("styled-components").StyledComponent<"
8
7
  type Item = {
9
8
  value: string;
10
9
  icon: string;
11
- label: string | JSX.Element;
10
+ label: string;
12
11
  };
13
12
  type IconListProps = {
14
13
  list: Item[];
@@ -3,6 +3,7 @@ import { useCallback, useState } from 'react';
3
3
  import { x } from '@xstyled/styled-components';
4
4
  import { ActionRow } from './components/ActionRow';
5
5
  import { Input } from '../../../../Forms/Input/Input';
6
+ import { i18n } from '@lingui/core';
6
7
  var ManageColumnForm = function (_a) {
7
8
  var columns = _a.columns, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions;
8
9
  var _b = useState(''), searchedValue = _b[0], setSearchedValue = _b[1];
@@ -12,9 +13,7 @@ var ManageColumnForm = function (_a) {
12
13
  var clear = useCallback(function () {
13
14
  setSearchedValue('');
14
15
  }, [setSearchedValue]);
15
- return (_jsxs(x.div, { children: [_jsx(Input, { icon: "search", type: "text", value: searchedValue,
16
- // placeholder={<Trans id="manageColumn.searchPlaceholder" message="Find column..." />}
17
- 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) {
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) {
18
17
  return (_jsx(ActionRow, { column: column, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, searchedValue: searchedValue }, index));
19
18
  }) })] }));
20
19
  };
@@ -21,7 +21,7 @@ import Toggle from '../../../../../Elements/Toggle/Toggle';
21
21
  import { Group } from '../../../../../Elements/Icon/icons/Group';
22
22
  import { isObject } from 'lodash';
23
23
  import { H6 } from '../../../../../Elements/Typography/Typography';
24
- import { Trans } from '@lingui/react';
24
+ import { i18n } from '@lingui/core';
25
25
  var RowLayout = styled(x.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n align-items: center;\n justify-content: space-between;\n padding: 16px;\n height: 52px;\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 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');
@@ -30,7 +30,10 @@ export var ActionRow = function (_a) {
30
30
  var _b, _c, _d, _e, _f;
31
31
  var column = _a.column, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions, searchedValue = _a.searchedValue;
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 translatedValue = isObject(column === null || column === void 0 ? void 0 : column.title) && 'props' in column.title && ((_c = column.title) === null || _c === void 0 ? void 0 : _c.props) && (_jsx(Trans, { id: (_e = (_d = column.title) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e.id, values: (_f = column.title) === null || _f === void 0 ? void 0 : _f.props.message }));
33
+ var translatedValue = isObject(column === null || column === void 0 ? void 0 : column.title) &&
34
+ 'props' in column.title &&
35
+ ((_c = column.title) === null || _c === void 0 ? void 0 : _c.props) &&
36
+ i18n._({ id: (_e = (_d = column.title) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e.id, message: (_f = column.title) === null || _f === void 0 ? void 0 : _f.props.message });
34
37
  var isVisible = translatedValue && translatedValue.toLocaleLowerCase().includes(searchedValue.toLocaleLowerCase());
35
38
  var handleToggleChange = useCallback(function () {
36
39
  setColumnsConfigOptions(function (prevOptions) {
@@ -25,30 +25,30 @@ import { useCallback, useState } from 'react';
25
25
  import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
26
26
  import { Input } from '../../../../Forms/Input/Input';
27
27
  import IconList from '../IconList';
28
- import { Trans } from '@lingui/react';
28
+ import { i18n } from '@lingui/core';
29
29
  var OverlayComponentDefault = function (_a) {
30
30
  var children = _a.children;
31
31
  return _jsx("div", { children: children });
32
32
  };
33
33
  var createNumberComparators = function () { return [
34
- { label: _jsx(Trans, { id: "dataGrid.comparator.equals", message: "Equals" }), value: 'eq', icon: 'equals' },
35
- { label: _jsx(Trans, { id: "dataGrid.comparator.notEquals", message: "Not equal" }), value: 'neq', icon: 'notEqual' },
36
- { label: _jsx(Trans, { id: "dataGrid.comparator.lessThan", message: "Less than" }), value: 'lt', icon: 'lessThen' },
34
+ { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
35
+ { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
36
+ { label: i18n._({ id: 'dataGrid.comparator.lessThan', message: 'Less than' }), value: 'lt', icon: 'lessThen' },
37
37
  {
38
- label: _jsx(Trans, { id: "dataGrid.comparator.lessThanOrEquals", message: "Less than or equals" }),
38
+ label: i18n._({ id: 'dataGrid.comparator.lessThanOrEquals', message: 'Less than or equals' }),
39
39
  value: 'lte',
40
40
  icon: 'lessThanEqual',
41
41
  },
42
- { label: _jsx(Trans, { id: "dataGrid.comparator.greaterThan", message: "Greater than" }), value: 'gt', icon: 'greaterThan' },
42
+ { label: i18n._({ id: 'dataGrid.comparator.greaterThan', message: 'Greater than' }), value: 'gt', icon: 'greaterThan' },
43
43
  {
44
- label: _jsx(Trans, { id: "dataGrid.comparator.greaterThanOrEquals", message: "Greater than or equal" }),
44
+ label: i18n._({ id: 'dataGrid.comparator.greaterThanOrEquals', message: 'Greater than or equal' }),
45
45
  value: 'gte',
46
46
  icon: 'greaterThanEqual',
47
47
  },
48
48
  ]; };
49
49
  var createEqualComparators = [
50
- { label: _jsx(Trans, { id: "dataGrid.comparator.equals", message: "Equals" }), value: 'eq', icon: 'equals' },
51
- { label: _jsx(Trans, { id: "dataGrid.comparator.notEquals", message: "Not equal" }), value: 'neq', icon: 'notEqual' },
50
+ { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
51
+ { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
52
52
  ];
53
53
  var NumberRange = function (props) {
54
54
  var numberComparators = createNumberComparators();
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { FilterComponentProps } from '../../types';
3
2
  export type ComparatorValue = 'eq' | 'neq' | 'lt' | 'lte' | 'gt' | 'gte';
4
3
  export type NumberRangeValue = {
@@ -6,7 +5,7 @@ export type NumberRangeValue = {
6
5
  value?: string | number;
7
6
  };
8
7
  export type Comparator = {
9
- label: string | JSX.Element;
8
+ label: string;
10
9
  value: string;
11
10
  icon: string;
12
11
  };
@@ -33,60 +33,20 @@ var OverlayComponentDefault = function (_a) {
33
33
  };
34
34
  export var ipv4 = /^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/;
35
35
  var createTextComparators = function () { return [
36
- {
37
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
38
- value: 'like',
39
- icon: 'check',
40
- },
41
- {
42
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
43
- value: 'notLike',
44
- icon: 'false',
45
- },
46
- {
47
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
48
- value: 'eq',
49
- icon: 'equals',
50
- },
51
- {
52
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
53
- value: 'neq',
54
- icon: 'notEqual',
55
- },
56
- {
57
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
58
- value: 'startsWith',
59
- icon: 'startsWith',
60
- },
61
- {
62
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
63
- value: 'endsWith',
64
- icon: 'endsWith',
65
- },
36
+ { label: i18n._({ id: 'dataGrid.comparator.contains', message: 'Contains' }), value: 'like', icon: 'check' },
37
+ { label: i18n._({ id: 'dataGrid.comparator.notContains', message: 'Not contains' }), value: 'notLike', icon: 'false' },
38
+ { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
39
+ { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
40
+ { label: i18n._({ id: 'dataGrid.comparator.startsWith', message: 'Starts with' }), value: 'startsWith', icon: 'startsWith' },
41
+ { label: i18n._({ id: 'dataGrid.comparator.endsWith', message: 'Ends with' }), value: 'endsWith', icon: 'endsWith' },
66
42
  ]; };
67
43
  var createPresentTextComparators = function () { return [
68
- {
69
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
70
- value: 'like',
71
- icon: 'check',
72
- },
73
- {
74
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
75
- value: 'in',
76
- icon: 'equals',
77
- },
44
+ { label: i18n._({ id: 'dataGrid.comparator.contains', message: 'Contains' }), value: 'like', icon: 'check' },
45
+ { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'in', icon: 'equals' },
78
46
  ]; };
79
47
  var createEqualComparators = function () { return [
80
- {
81
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
82
- value: 'eq',
83
- icon: 'equals',
84
- },
85
- {
86
- label: i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }),
87
- value: 'neq',
88
- icon: 'notEqual',
89
- },
48
+ { label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
49
+ { label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
90
50
  ]; };
91
51
  var validations = {
92
52
  ip: {
@@ -96,7 +56,7 @@ var validations = {
96
56
  };
97
57
  var TextRange = function (props) {
98
58
  var name = props.name, _a = props.value, value = _a === void 0 ? {} : _a, label = props.label, onChange = props.onChange, className = props.className, _b = props.OverlayComponent, OverlayComponent = _b === void 0 ? OverlayComponentDefault : _b, eqOnly = props.eqOnly, isPresent = props.isPresent, isEqual = props.isEqual, defaultComparator = props.defaultComparator, validationKey = props.validation, rest = __rest(props, ["name", "value", "label", "onChange", "className", "OverlayComponent", "eqOnly", "isPresent", "isEqual", "defaultComparator", "validation"]);
99
- var eqOnlyTxt = '1';
59
+ var eqOnlyTxt = i18n._({ id: 'dataGrid.filterTxtEqWarning', message: 'This filter can only do exact match' });
100
60
  var _c = useState(false), isOpen = _c[0], setOpen = _c[1];
101
61
  var textComparators = createTextComparators();
102
62
  var presentTextComparators = createPresentTextComparators();
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  export declare const rowClassSymbol: unique symbol;
3
3
  type Option = {
4
4
  value: string | number;
5
- label: string | number | JSX.Element;
5
+ label: string | number;
6
6
  };
7
7
  type ButtonPublicInterfaceProps = {
8
8
  children?: React.ReactNode;
@@ -4,7 +4,7 @@ import { DatetimepickerProps } from './Datetime/types';
4
4
  export type DatePickerType = DatetimepickerProps & {
5
5
  onChange: (value: string | Date) => void;
6
6
  disabled?: boolean;
7
- label?: string | JSX.Element;
7
+ label?: string;
8
8
  name?: string;
9
9
  initialViewDate?: Date | null;
10
10
  secondValue?: Date | null;
@@ -46,7 +46,7 @@ export interface DatetimepickerProps {
46
46
  timeConstraints?: TimeConstraints;
47
47
  closeOnClickOutside?: boolean;
48
48
  secondValue?: Date | null;
49
- label?: string | JSX.Element;
49
+ label?: string;
50
50
  }
51
51
  export interface DatetimepickerState {
52
52
  updateOn: string;
@@ -28,10 +28,10 @@ import { useTheme } from '@xstyled/styled-components';
28
28
  import SpaceAroundWrap from '../SpaceAround';
29
29
  import { FieldLabel } from '../Label';
30
30
  import { ErrorMessage } from '../ErrorMessage';
31
- import { Trans } from '@lingui/react';
31
+ import { i18n } from '@lingui/core';
32
32
  var emptyOptions = [];
33
- var noOptionsMessage = function () { return _jsx(Trans, { id: "select.noOptions", message: "no options" }); };
34
- var loadingMessage = function () { return _jsx(Trans, { id: "components.dropdown.loading", message: "Loading..." }); };
33
+ var noOptionsMessage = function () { return i18n._({ id: 'select.noOptions', message: 'no options' }); };
34
+ var loadingMessage = function () { return i18n._({ id: 'components.dropdown.loading', message: 'Loading...' }); };
35
35
  var Select = function (_a) {
36
36
  var label = _a.label, name = _a.name, _b = _a.value, value = _b === void 0 ? '' : _b, _c = _a.options, options = _c === void 0 ? emptyOptions : _c, defaultOptions = _a.defaultOptions, loadOptions = _a.loadOptions, onChange = _a.onChange, onBlur = _a.onBlur, error = _a.error, isInvalid = _a.isInvalid, isLoading = _a.isLoading, isDarkPlaceholderText = _a.isDarkPlaceholderText, _d = _a.spaceAround, spaceAround = _d === void 0 ? false : _d, disabled = _a.disabled, onInputChange = _a.onInputChange, isSearchable = _a.isSearchable, isMulti = _a.isMulti, className = _a.className, _e = _a.useSimplifiedOptions, useSimplifiedOptions = _e === void 0 ? false : _e, _f = _a.showSelectAllButton, showSelectAllButton = _f === void 0 ? false : _f, _g = _a.showResetGridButton, showResetGridButton = _g === void 0 ? false : _g, style = _a.style, optionVariant = _a.optionVariant, multiLabelVariant = _a.multiLabelVariant, containerVariant = _a.containerVariant, placeholder = _a.placeholder, placeholderIcon = _a.placeholderIcon, innerRef = _a.innerRef, maxMenuHeight = _a.maxMenuHeight, getOptionValue = _a.getOptionValue, resetGrid = _a.resetGrid, passTroughProps = __rest(_a, ["label", "name", "value", "options", "defaultOptions", "loadOptions", "onChange", "onBlur", "error", "isInvalid", "isLoading", "isDarkPlaceholderText", "spaceAround", "disabled", "onInputChange", "isSearchable", "isMulti", "className", "useSimplifiedOptions", "showSelectAllButton", "showResetGridButton", "style", "optionVariant", "multiLabelVariant", "containerVariant", "placeholder", "placeholderIcon", "innerRef", "maxMenuHeight", "getOptionValue", "resetGrid"]);
37
37
  var isAsync = !!loadOptions;
@@ -64,6 +64,6 @@ var Select = function (_a) {
64
64
  var handleLoadOptions = useMemo(function () {
65
65
  return loadOptions ? function (fulltext) { return loadOptions(fulltext); } : undefined;
66
66
  }, [loadOptions]);
67
- return (_jsxs(SpaceAroundWrap, { spaceAround: spaceAround, className: className, children: [_jsxs(Wrapper, { children: [label && _jsx(FieldLabel, { htmlFor: name, children: label }), _jsx(RenderComponent, __assign({ id: name, name: name, options: options, loadOptions: handleLoadOptions, defaultOptions: defaultOptions, value: selectedOption, onChange: onChange, onBlur: onBlur, isDisabled: disabled || isLoading, isLoading: isLoading, isInvalid: isInvalid !== undefined ? isInvalid : !!error, isDarkPlaceholderText: isDarkPlaceholderText, placeholder: placeholder, styles: customStyles, theme: customTheme, icon: icon, hideSelectedOptions: !!(isMulti && multiLabelVariant != 'count'), onInputChange: onInputChange, isSearchable: isAsync || isSearchable, isMulti: isMulti, classNamePrefix: "react-select", components: customComponents, closeMenuOnSelect: isMulti ? false : undefined }, passTroughProps, { ref: innerRef, tabIndex: null, systemTheme: theme, resetGrid: resetGrid, onCustomSelectAll: setAllOptions, onCustomDeselectAll: unsetAllOptions, selectAllButton: showSelectAllButton, resetGridButton: showResetGridButton, maxMenuHeight: modifiedMaxMenuHeight, getOptionValue: getOptionValue, noOptionsMessage: noOptionsMessage, loadingMessage: loadingMessage }))] }), error && _jsx(ErrorMessage, { children: error })] }));
67
+ return (_jsxs(SpaceAroundWrap, { spaceAround: spaceAround, className: className, children: [_jsxs(Wrapper, { children: [label && _jsx(FieldLabel, { htmlFor: name, children: label }), _jsx(RenderComponent, __assign({ id: name, name: name, options: options, loadOptions: handleLoadOptions, defaultOptions: defaultOptions, value: selectedOption, onChange: onChange, onBlur: onBlur, isDisabled: disabled || isLoading, isLoading: isLoading, isInvalid: isInvalid !== undefined ? isInvalid : !!error, isDarkPlaceholderText: isDarkPlaceholderText, placeholder: placeholder || i18n._({ id: 'components.dropdown.placeholder', message: 'Select...' }), styles: customStyles, theme: customTheme, icon: icon, hideSelectedOptions: !!(isMulti && multiLabelVariant != 'count'), onInputChange: onInputChange, isSearchable: isAsync || isSearchable, isMulti: isMulti, classNamePrefix: "react-select", components: customComponents, closeMenuOnSelect: isMulti ? false : undefined }, passTroughProps, { ref: innerRef, tabIndex: null, systemTheme: theme, resetGrid: resetGrid, onCustomSelectAll: setAllOptions, onCustomDeselectAll: unsetAllOptions, selectAllButton: showSelectAllButton, resetGridButton: showResetGridButton, maxMenuHeight: modifiedMaxMenuHeight, getOptionValue: getOptionValue, noOptionsMessage: noOptionsMessage, loadingMessage: loadingMessage }))] }), error && _jsx(ErrorMessage, { children: error })] }));
68
68
  };
69
69
  export default Select;
@@ -3,7 +3,7 @@ import { SpaceAround } from '../SpaceAround/types';
3
3
  import { Theme } from 'react-select';
4
4
  export type Option<Value = string | number> = {
5
5
  value: Value;
6
- label: string | number | JSX.Element;
6
+ label: string | number;
7
7
  isDisabled?: boolean;
8
8
  isFixed?: boolean;
9
9
  color?: string;
@@ -54,13 +54,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
54
54
  }
55
55
  return to.concat(ar || Array.prototype.slice.call(from));
56
56
  };
57
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
57
+ import { jsx as _jsx } from "react/jsx-runtime";
58
58
  import { useCallback, useEffect, useMemo, useState } from 'react';
59
59
  import { createFilter } from 'react-select';
60
60
  import Select from '../Select';
61
61
  import omit from 'lodash/fp/omit';
62
62
  import { nanoid } from 'nanoid';
63
- import { Trans } from '@lingui/react';
64
63
  import { i18n } from '@lingui/core';
65
64
  var CREATE = "_create_".concat(nanoid(), "_");
66
65
  var defaultFilterOption = createFilter();
@@ -80,15 +79,18 @@ var getOptionValue = function (selectedOption) {
80
79
  return selectedOption.value;
81
80
  }
82
81
  };
83
- var loadingMessage = function () { return _jsx(Trans, { id: "components.dropdown.loading", message: "Loading..." }); };
82
+ var loadingMessage = function () { return i18n._({ id: 'components.dropdown.loading', message: 'Loading...' }); };
84
83
  var SingleSelect = function (props) {
85
- var name = props.name, onChange = props.onChange, onBlur = props.onBlur, onValueChange = props.onValueChange, loadOptions = props.loadOptions, _a = props.asyncLoadMinChars, asyncLoadMinChars = _a === void 0 ? 0 : _a, isLocked = props.isLocked, lockedText = props.lockedText, //= <Trans id="components.dropdown.notReact" message="Select related values first..." />,
86
- disabled = props.disabled, placeholder = props.placeholder, // = <Trans id="components.dropdown.placeholder" message="Select..." />,
87
- preload = props.preload, initialOptions = props.initialOptions, onCreateOption = props.onCreateOption, options = props.options, filterOption = props.filterOption;
88
- var _b = useState(false), isCreating = _b[0], setIsCreating = _b[1];
84
+ var name = props.name, onChange = props.onChange, onBlur = props.onBlur, onValueChange = props.onValueChange, loadOptions = props.loadOptions, _a = props.asyncLoadMinChars, asyncLoadMinChars = _a === void 0 ? 0 : _a, isLocked = props.isLocked, _b = props.lockedText, lockedText = _b === void 0 ? i18n._({ id: 'components.dropdown.notReact', message: 'Select related values first...' }) : _b, disabled = props.disabled, _c = props.placeholder, placeholder = _c === void 0 ? i18n._({ id: 'components.dropdown.placeholder', message: 'Select...' }) : _c, preload = props.preload, initialOptions = props.initialOptions, onCreateOption = props.onCreateOption, options = props.options, filterOption = props.filterOption;
85
+ var _d = useState(false), isCreating = _d[0], setIsCreating = _d[1];
89
86
  var asAsync = !!loadOptions || !!onCreateOption;
90
87
  var noOptionsMessage = useCallback(function (inputValue) {
91
- return loadOptions && inputValue.length < asyncLoadMinChars ? (_jsx(Trans, { id: "components.dropdown.writeMoreChars", message: "Write at least ${asyncLoadMinChars} characters." })) : (_jsx(Trans, { id: "components.dropdown.noOptions", message: "No options" }));
88
+ return loadOptions && inputValue.length < asyncLoadMinChars
89
+ ? i18n._({
90
+ id: 'components.dropdown.writeMoreChars',
91
+ message: 'Write at least ${asyncLoadMinChars} characters.',
92
+ })
93
+ : i18n._({ id: 'components.dropdown.noOptions', message: 'No options' });
92
94
  }, [loadOptions, asyncLoadMinChars]);
93
95
  var handleLoadOptions = useCallback(function (inputValue) {
94
96
  if (onCreateOption) {
@@ -97,7 +99,7 @@ var SingleSelect = function (props) {
97
99
  return Promise.resolve(__spreadArray(__spreadArray([], (options || []), true), [
98
100
  {
99
101
  value: CREATE,
100
- label: (_jsxs(_Fragment, { children: ["$", inputValue, " ", _jsx(Trans, { id: "components.dropdown.newOption", message: "new value" })] })),
102
+ label: "".concat(inputValue, " (").concat(i18n._({ id: 'components.dropdown.newOption', message: 'new value' }), ")"),
101
103
  inputValue: inputValue,
102
104
  },
103
105
  ], false));
@@ -109,13 +111,13 @@ var SingleSelect = function (props) {
109
111
  return loadOptions(inputValue, false);
110
112
  }
111
113
  }, [onCreateOption, loadOptions, asyncLoadMinChars, options]);
112
- var _c = useState(options || []), loadedDefaultOptions = _c[0], setLoadedDefaultOptions = _c[1];
114
+ var _e = useState(options || []), loadedDefaultOptions = _e[0], setLoadedDefaultOptions = _e[1];
113
115
  useEffect(function () {
114
116
  if (loadOptions && preload && !props.value)
115
117
  loadOptions('', false).then(setLoadedDefaultOptions);
116
118
  // eslint-disable-next-line react-hooks/exhaustive-deps
117
119
  }, [loadOptions]); // this is intentional
118
- var _d = useState(null), storedSelectedOption = _d[0], setStoredSelectedOption = _d[1];
120
+ var _f = useState(null), storedSelectedOption = _f[0], setStoredSelectedOption = _f[1];
119
121
  useEffect(function () {
120
122
  if (initialOptions && initialOptions.length) {
121
123
  var selectedOption = initialOptions.find(function (option) { return option.value == props.value; }) || null;
@@ -136,7 +138,7 @@ var SingleSelect = function (props) {
136
138
  if (!(onCreateOption && (option === null || option === void 0 ? void 0 : option.value) == CREATE)) return [3 /*break*/, 4];
137
139
  if (!((option === null || option === void 0 ? void 0 : option.inputValue) && ((_b = (_a = option === null || option === void 0 ? void 0 : option.inputValue) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.length) < 2)) return [3 /*break*/, 1];
138
140
  props === null || props === void 0 ? void 0 : props.form.setFieldTouched(name, true, true);
139
- props === null || props === void 0 ? void 0 : props.form.setFieldError(name, i18n._(/*i18n*/ { id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }));
141
+ props === null || props === void 0 ? void 0 : props.form.setFieldError(name, i18n._({ id: 'form.general.min2Chars', message: 'Minimal length is 2 characters.' }));
140
142
  return [2 /*return*/];
141
143
  case 1:
142
144
  setIsCreating(true);