@mailstep/design-system 0.6.75-beta.6 → 0.6.76
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/Stepper/Stepper.js +0 -1
- package/ui/Blocks/Stepper/hooks/useStepper.js +0 -5
- package/ui/Elements/DatePicker/DatePicker.js +9 -9
- package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +1 -1
- package/ui/Elements/SingleSelect/SingleSelect.d.ts +1 -1
- package/ui/Elements/SingleSelect/SingleSelect.js +9 -9
- package/ui/index.es.js +16688 -16184
- package/ui/index.umd.js +631 -631
package/package.json
CHANGED
|
@@ -8,7 +8,6 @@ export var Stepper = function (_a) {
|
|
|
8
8
|
useEffect(function () {
|
|
9
9
|
var _a;
|
|
10
10
|
if (!!activeStep && !((_a = items[activeStep - 1]) === null || _a === void 0 ? void 0 : _a.completed)) {
|
|
11
|
-
console.log('USE EFFECT RESET');
|
|
12
11
|
handleChangeStep === null || handleChangeStep === void 0 ? void 0 : handleChangeStep(0)();
|
|
13
12
|
}
|
|
14
13
|
}, [items]);
|
|
@@ -4,23 +4,18 @@ export var useStepper = function (_a) {
|
|
|
4
4
|
var _b = useState(0), activeStep = _b[0], setActiveStep = _b[1];
|
|
5
5
|
var _c = useState(false), isSuccess = _c[0], setSuccess = _c[1];
|
|
6
6
|
var handleReset = useCallback(function () {
|
|
7
|
-
console.log('RESET');
|
|
8
7
|
setActiveStep(0);
|
|
9
8
|
setSuccess(false);
|
|
10
9
|
}, []);
|
|
11
10
|
var handleGoToNextStep = useCallback(function () {
|
|
12
|
-
console.log('handleGoToNextStep');
|
|
13
11
|
if (activeStep + 1 === totalSteps) {
|
|
14
|
-
console.log('success, reset');
|
|
15
12
|
handleReset();
|
|
16
13
|
setSuccess(true);
|
|
17
14
|
return;
|
|
18
15
|
}
|
|
19
|
-
console.log('SET ACTIVE STEP', activeStep + 1);
|
|
20
16
|
setActiveStep(activeStep + 1);
|
|
21
17
|
}, [activeStep, totalSteps, handleReset]);
|
|
22
18
|
var handleChangeStep = useCallback(function (step) { return function () {
|
|
23
|
-
console.log('handleChangeStep');
|
|
24
19
|
setActiveStep(step);
|
|
25
20
|
}; }, []);
|
|
26
21
|
return { activeStep: activeStep, handleChangeStep: handleChangeStep, handleGoToNextStep: handleGoToNextStep, isSuccess: isSuccess, handleReset: handleReset };
|
|
@@ -21,20 +21,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import React, { useCallback, useContext } from 'react';
|
|
24
25
|
import moment from 'moment';
|
|
26
|
+
import Input from '../../Forms/Input';
|
|
27
|
+
import { LanguageContext } from '../../ThemeProvider/ThemeProvider';
|
|
28
|
+
import SpaceAroundWrap from '../SpaceAround';
|
|
29
|
+
import DatetimePicker from './Datetime/DateTime';
|
|
30
|
+
import { x } from '@xstyled/styled-components';
|
|
25
31
|
// @TODO each language has 62kb gziped, please replace moment with different lib
|
|
26
32
|
import 'moment/dist/locale/cs';
|
|
33
|
+
import 'moment/dist/locale/el';
|
|
34
|
+
import 'moment/dist/locale/it';
|
|
27
35
|
import 'moment/dist/locale/ru';
|
|
28
36
|
import 'moment/dist/locale/sk';
|
|
29
|
-
import 'moment/dist/locale/it';
|
|
30
|
-
import 'moment/dist/locale/el';
|
|
31
|
-
import React, { useCallback, useContext } from 'react';
|
|
32
|
-
import DatetimePicker from './Datetime/DateTime';
|
|
33
|
-
import { x } from '@xstyled/styled-components';
|
|
34
37
|
import { DatePickerBase } from './styles';
|
|
35
|
-
import SpaceAroundWrap from '../SpaceAround';
|
|
36
|
-
import Input from '../../Forms/Input';
|
|
37
|
-
import { LanguageContext } from '../../ThemeProvider/ThemeProvider';
|
|
38
38
|
var defaultDateFormat = 'DD.MM.YYYY';
|
|
39
39
|
var DatePicker = function (_a) {
|
|
40
40
|
var name = _a.name, value = _a.value, initialViewDate = _a.initialViewDate, error = _a.error, label = _a.label, disabled = _a.disabled, isValidDate = _a.isValidDate, onChange = _a.onChange, _b = _a.dateFormat, dateFormat = _b === void 0 ? defaultDateFormat : _b, _c = _a.timeFormat, timeFormat = _c === void 0 ? false : _c, open = _a.open, _d = _a.secondValue, secondValue = _d === void 0 ? null : _d, input = _a.input, _e = _a.icon, icon = _e === void 0 ? true : _e, _f = _a.showInputLabel, showInputLabel = _f === void 0 ? false : _f, _g = _a.showCalendarLabel, showCalendarLabel = _g === void 0 ? true : _g, _h = _a.spaceAround, spaceAround = _h === void 0 ? false : _h, className = _a.className, onClear = _a.onClear, onInputChange = _a.onInputChange, passProps = __rest(_a, ["name", "value", "initialViewDate", "error", "label", "disabled", "isValidDate", "onChange", "dateFormat", "timeFormat", "open", "secondValue", "input", "icon", "showInputLabel", "showCalendarLabel", "spaceAround", "className", "onClear", "onInputChange"]);
|
|
@@ -43,7 +43,7 @@ var DatePicker = function (_a) {
|
|
|
43
43
|
var stringValue = isValid ? moment(value, format).format(format) : value;
|
|
44
44
|
var locale = useContext(LanguageContext);
|
|
45
45
|
var handleRenderInput = useCallback(function (_, openCalendar) {
|
|
46
|
-
return (_jsx(Input, { type: "text", icon: icon ? 'calendar' : undefined, name: name, error: error, disabled: disabled, isInvalid: !!error, onChange: onInputChange, label: showInputLabel ? label : undefined, value: stringValue, onFocus: openCalendar, iconOnClick: openCalendar, onClear: onClear }));
|
|
46
|
+
return (_jsx(Input, { type: "text", icon: icon ? 'calendar' : undefined, name: name, error: error, disabled: disabled, isInvalid: !!error, onChange: onInputChange, label: showInputLabel ? label : undefined, value: stringValue, onFocus: openCalendar, iconOnClick: openCalendar, onClear: onClear, autoComplete: "off" }));
|
|
47
47
|
}, [name, stringValue, error, label, showInputLabel, isValid, disabled]);
|
|
48
48
|
var handleRenderView = useCallback(function (_, renderCalendar) {
|
|
49
49
|
if (label && !showInputLabel) {
|
|
@@ -52,6 +52,6 @@ export var Timepicker = function (_a) {
|
|
|
52
52
|
useEffect(function () {
|
|
53
53
|
!!value && setTime('minutes', minutes);
|
|
54
54
|
}, [minutes]);
|
|
55
|
-
return (_jsx("td", { colSpan: 7, children: _jsx(x.div, { display: "flex", flexDirection: "column", alignItems: "flex-start", pt: "1rem", w: "fit-content", children: _jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsxs(x.div, { display: "flex", flexDirection: "column", children: [_jsx(Btn, { disabled: disabled, onClick: increaseHour, children: "\u2039" }), _jsx(Btn, { disabled: disabled, onClick: decreaseHour, children: "\u203A" })] }), _jsxs(TimeWrapper, { children: [_jsx(Hours, { value: hours < 10 ? "0".concat(hours) : hours, disabled: disabled, onChange: onHoursChange }), _jsx(x.div, { mx: "7px", color: "lightGray4", children: "|" }), _jsx(Minutes, { value: minutes < 10 ? "0".concat(minutes) : minutes, disabled: disabled, onChange: onMinutesChange })] }), _jsxs(x.div, { display: "flex", flexDirection: "column", children: [_jsx(Btn, { disabled: disabled, onClick: increaseMinutes, children: "\u2039" }), _jsx(Btn, { disabled: disabled, onClick: decreaseMinutes, children: "\u203A" })] })] }) }) }));
|
|
55
|
+
return (_jsx("td", { colSpan: 7, children: _jsx(x.div, { display: "flex", flexDirection: "column", alignItems: "flex-start", pt: "1rem", w: "fit-content", children: _jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsxs(x.div, { display: "flex", flexDirection: "column", children: [_jsx(Btn, { disabled: disabled, onClick: increaseHour, type: "button", children: "\u2039" }), _jsx(Btn, { disabled: disabled, onClick: decreaseHour, type: "button", children: "\u203A" })] }), _jsxs(TimeWrapper, { children: [_jsx(Hours, { value: hours < 10 ? "0".concat(hours) : hours, disabled: disabled, onChange: onHoursChange }), _jsx(x.div, { mx: "7px", color: "lightGray4", children: "|" }), _jsx(Minutes, { value: minutes < 10 ? "0".concat(minutes) : minutes, disabled: disabled, onChange: onMinutesChange })] }), _jsxs(x.div, { display: "flex", flexDirection: "column", children: [_jsx(Btn, { disabled: disabled, onClick: increaseMinutes, type: "button", children: "\u2039" }), _jsx(Btn, { disabled: disabled, onClick: decreaseMinutes, type: "button", children: "\u203A" })] })] }) }) }));
|
|
56
56
|
};
|
|
57
57
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectProps, Option } from '../Select/types';
|
|
2
2
|
type FieldValueType = string | number | (string | number)[] | null;
|
|
3
3
|
export type Props = Omit<SelectProps, 'onChange' | 'loadOptions'> & {
|
|
4
|
-
onChange
|
|
4
|
+
onChange?: (event: {
|
|
5
5
|
target: {
|
|
6
6
|
[key: string]: FieldValueType;
|
|
7
7
|
};
|
|
@@ -56,11 +56,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
56
56
|
};
|
|
57
57
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
58
58
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
59
|
+
import { nanoid } from 'nanoid';
|
|
59
60
|
import { createFilter } from 'react-select';
|
|
60
61
|
import Select from '../Select';
|
|
61
|
-
import omit from 'lodash/fp/omit';
|
|
62
|
-
import { nanoid } from 'nanoid';
|
|
63
62
|
import { i18n } from '@lingui/core';
|
|
63
|
+
import omit from 'lodash/fp/omit';
|
|
64
64
|
var CREATE = "_create_".concat(nanoid(), "_");
|
|
65
65
|
var defaultFilterOption = createFilter();
|
|
66
66
|
var creatableFilterOption = function (option, rawInput) {
|
|
@@ -88,7 +88,7 @@ var SingleSelect = function (props) {
|
|
|
88
88
|
return loadOptions && inputValue.length < asyncLoadMinChars
|
|
89
89
|
? i18n._({
|
|
90
90
|
id: 'components.dropdown.writeMoreChars',
|
|
91
|
-
message: 'Write at least ${asyncLoadMinChars} characters.'
|
|
91
|
+
message: 'Write at least ${asyncLoadMinChars} characters.'
|
|
92
92
|
})
|
|
93
93
|
: i18n._({ id: 'components.dropdown.noOptions', message: 'No options' });
|
|
94
94
|
}, [loadOptions, asyncLoadMinChars]);
|
|
@@ -100,8 +100,8 @@ var SingleSelect = function (props) {
|
|
|
100
100
|
{
|
|
101
101
|
value: CREATE,
|
|
102
102
|
label: "".concat(inputValue, " (").concat(i18n._({ id: 'components.dropdown.newOption', message: 'new value' }), ")"),
|
|
103
|
-
inputValue: inputValue
|
|
104
|
-
}
|
|
103
|
+
inputValue: inputValue
|
|
104
|
+
}
|
|
105
105
|
], false));
|
|
106
106
|
}
|
|
107
107
|
else if (!loadOptions || inputValue.length < asyncLoadMinChars) {
|
|
@@ -159,8 +159,8 @@ var SingleSelect = function (props) {
|
|
|
159
159
|
target: {
|
|
160
160
|
name: name !== null && name !== void 0 ? name : '',
|
|
161
161
|
type: 'change',
|
|
162
|
-
value: value
|
|
163
|
-
}
|
|
162
|
+
value: value
|
|
163
|
+
}
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
166
|
if (onValueChange) {
|
|
@@ -176,8 +176,8 @@ var SingleSelect = function (props) {
|
|
|
176
176
|
target: {
|
|
177
177
|
name: name,
|
|
178
178
|
type: 'blur',
|
|
179
|
-
value: getOptionValue(option)
|
|
180
|
-
}
|
|
179
|
+
value: getOptionValue(option)
|
|
180
|
+
}
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
}, [name, onBlur]);
|