armtek-uikit-react 1.0.154 → 1.0.155
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/index.js +1 -2
- package/lib/const/styles.js +1 -5
- package/lib/helpers/genericForwardRef.js +3 -7
- package/lib/helpers/getColorClasses.js +6 -10
- package/lib/helpers/getSizeClasses.js +5 -9
- package/lib/helpers/getVariantClasses.js +5 -9
- package/lib/helpers/helpers.js +10 -19
- package/lib/helpers/index.js +1 -6
- package/lib/hooks/useClickOutside.js +4 -8
- package/lib/hooks/useEnhancedEffect.js +3 -8
- package/lib/hooks/useEventCallback.js +4 -11
- package/lib/hooks/useLazyRef.js +4 -8
- package/lib/hooks/useTimeout.js +6 -12
- package/lib/services/DateService.js +2 -7
- package/package.json +1 -1
- package/types/theme.js +1 -3
- package/ui/Accordion/Accordion.classes.js +14 -19
- package/ui/Accordion/Accordion.js +35 -38
- package/ui/Accordion/index.d.ts +1 -1
- package/ui/Accordion/index.js +1 -9
- package/ui/Adornment/Adornment.js +11 -16
- package/ui/Adornment/index.js +2 -9
- package/ui/Alert/Alert.js +16 -20
- package/ui/Alert/index.js +1 -8
- package/ui/Avatar/Avatar.js +18 -22
- package/ui/Avatar/index.js +1 -8
- package/ui/AvatarGroup/AvatarGroup.js +14 -18
- package/ui/AvatarGroup/index.js +1 -8
- package/ui/BackDrop/BackDrop.js +9 -13
- package/ui/BackDrop/BackDropBase.js +11 -15
- package/ui/BackDrop/index.js +1 -8
- package/ui/Badge/Badge.js +12 -16
- package/ui/Badge/index.js +1 -8
- package/ui/Button/Button.js +15 -19
- package/ui/Button/index.js +1 -8
- package/ui/ButtonGroup/ButtonGroup.js +10 -15
- package/ui/ButtonGroup/index.js +2 -8
- package/ui/ButtonIcon/ButtonIcon.js +11 -16
- package/ui/ButtonIcon/index.js +1 -8
- package/ui/Card/Card.js +7 -12
- package/ui/Card/index.js +1 -8
- package/ui/Chip/Chip.js +15 -19
- package/ui/Chip/index.js +1 -8
- package/ui/Dropdown/Dropdown.js +16 -20
- package/ui/Dropdown/index.js +1 -8
- package/ui/Form/Checkbox/Checkbox.js +19 -22
- package/ui/Form/Checkbox/index.js +1 -8
- package/ui/Form/DateField/DateField.js +25 -28
- package/ui/Form/DateField/index.js +1 -8
- package/ui/Form/DatePicker/DatePicker.js +13 -21
- package/ui/Form/DatePicker/index.js +1 -8
- package/ui/Form/FormControls/FormControls.js +15 -19
- package/ui/Form/FormControls/index.js +1 -8
- package/ui/Form/Interval/Interval.js +20 -23
- package/ui/Form/Interval/IntervalSlide.js +13 -16
- package/ui/Form/Interval/index.js +2 -9
- package/ui/Form/Password/Password.js +14 -17
- package/ui/Form/Password/index.js +1 -8
- package/ui/Form/Period/Period.js +21 -24
- package/ui/Form/Period/index.js +1 -8
- package/ui/Form/PeriodSelect/PeriodSelect.js +9 -13
- package/ui/Form/PeriodSelect/index.js +1 -8
- package/ui/Form/Radio/Radio.js +8 -13
- package/ui/Form/Radio/index.js +1 -8
- package/ui/Form/Rating/Rating.js +13 -16
- package/ui/Form/Rating/index.js +1 -8
- package/ui/Form/Select/Select.js +49 -50
- package/ui/Form/Select/SelectOptionList.js +8 -13
- package/ui/Form/Select/SelectOptionsContainer.js +6 -11
- package/ui/Form/Select/SelectSummary.js +32 -37
- package/ui/Form/Select/index.js +3 -12
- package/ui/Form/Switch/Switch.js +10 -14
- package/ui/Form/Switch/index.js +1 -8
- package/ui/Form/TextArea/TextArea.js +15 -19
- package/ui/Form/TextArea/index.js +1 -8
- package/ui/Form/TextField/TextField.js +34 -39
- package/ui/Form/TextField/index.js +2 -10
- package/ui/Form/TimeField/TimeField.js +8 -13
- package/ui/Form/TimeField/index.js +1 -8
- package/ui/Form/TimePicker/TimePicker.js +8 -12
- package/ui/Form/TimePicker/index.js +1 -8
- package/ui/HelperText/HelperText.js +7 -12
- package/ui/HelperText/index.js +1 -8
- package/ui/Icon/Icon.js +9 -14
- package/ui/Icon/Mi.js +10 -15
- package/ui/Icon/Mis.js +7 -11
- package/ui/Icon/index.js +3 -11
- package/ui/Link/Link.js +7 -12
- package/ui/Link/index.js +1 -8
- package/ui/List/ListItem.js +20 -26
- package/ui/List/index.js +1 -8
- package/ui/Loader/Loader.js +7 -12
- package/ui/Loader/index.js +1 -8
- package/ui/Logo/Logo.js +25 -29
- package/ui/Logo/index.js +1 -8
- package/ui/Modal/BaseModal.js +24 -28
- package/ui/Modal/Modal.js +8 -13
- package/ui/Modal/index.js +1 -8
- package/ui/Pagination/Pagination.js +36 -39
- package/ui/Pagination/index.js +1 -8
- package/ui/Paper/Paper.js +7 -12
- package/ui/Paper/index.js +1 -8
- package/ui/Popover/Popover.js +11 -16
- package/ui/Popover/index.js +1 -8
- package/ui/Popper/Popper.js +8 -12
- package/ui/Popper/PopperBase.js +11 -14
- package/ui/Popper/index.js +2 -9
- package/ui/Skeleton/Skeleton.js +5 -11
- package/ui/Skeleton/index.js +1 -8
- package/ui/Slider/RcSlider.js +0 -1
- package/ui/Slider/Slider.js +15 -19
- package/ui/Slider/index.js +1 -8
- package/ui/Stack/Stack.js +12 -17
- package/ui/Stack/index.js +1 -8
- package/ui/Status/Status.js +11 -15
- package/ui/Status/index.js +1 -8
- package/ui/Stepper/StepItem.js +18 -22
- package/ui/Stepper/StepItemIcon.js +11 -16
- package/ui/Stepper/Stepper.js +13 -17
- package/ui/Stepper/index.js +1 -8
- package/ui/Table/Table.js +17 -19
- package/ui/Table/TableBase.js +6 -11
- package/ui/Table/TableCell.js +10 -15
- package/ui/Table/TableRow.js +8 -13
- package/ui/Table/index.js +3 -10
- package/ui/Tooltip/Tooltip.js +20 -23
- package/ui/Tooltip/index.js +1 -8
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
import Interval from "./Interval";
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import Slider from "../../Slider/Slider";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
9
|
const IntervalSlide = props => {
|
|
12
10
|
let {
|
|
13
11
|
onChange,
|
|
14
12
|
...restProps
|
|
15
13
|
} = props;
|
|
16
|
-
let [value, setValue] =
|
|
14
|
+
let [value, setValue] = useState([props.min, props.max]);
|
|
17
15
|
const handleChange = value => {
|
|
18
16
|
setValue(value);
|
|
19
17
|
if (onChange) onChange(value);
|
|
@@ -21,15 +19,15 @@ const IntervalSlide = props => {
|
|
|
21
19
|
const handleSlide = value => {
|
|
22
20
|
if (Array.isArray(value)) handleChange(value);
|
|
23
21
|
};
|
|
24
|
-
return /*#__PURE__*/(
|
|
25
|
-
children: /*#__PURE__*/(
|
|
26
|
-
children: [/*#__PURE__*/(
|
|
22
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
23
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
24
|
+
children: [/*#__PURE__*/_jsx(Interval, {
|
|
27
25
|
value: value,
|
|
28
26
|
...restProps,
|
|
29
27
|
onChange: setValue
|
|
30
|
-
}), /*#__PURE__*/(
|
|
28
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
31
29
|
className: 'arm-intervalslide__slider',
|
|
32
|
-
children: /*#__PURE__*/(
|
|
30
|
+
children: /*#__PURE__*/_jsx(Slider, {
|
|
33
31
|
range: true,
|
|
34
32
|
min: props.min,
|
|
35
33
|
max: props.max,
|
|
@@ -42,5 +40,4 @@ const IntervalSlide = props => {
|
|
|
42
40
|
})
|
|
43
41
|
});
|
|
44
42
|
};
|
|
45
|
-
|
|
46
|
-
module.exports = exports.default;
|
|
43
|
+
export default IntervalSlide;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = exports.IntervalSlide = void 0;
|
|
6
|
-
var _Interval = _interopRequireDefault(require("./Interval"));
|
|
7
|
-
exports.default = _Interval.default;
|
|
8
|
-
var _IntervalSlide = _interopRequireDefault(require("./IntervalSlide"));
|
|
9
|
-
exports.IntervalSlide = _IntervalSlide.default;
|
|
1
|
+
export { default } from "./Interval";
|
|
2
|
+
export { default as IntervalSlide } from "./IntervalSlide";
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const Password = exports.Password = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
3
|
+
import TextField from "../TextField/TextField";
|
|
4
|
+
import { forwardRef, useRef, useState } from 'react';
|
|
5
|
+
import ButtonIcon from "../../ButtonIcon";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
|
+
export const Password = /*#__PURE__*/forwardRef((props, ref) => {
|
|
12
9
|
let {
|
|
13
10
|
onChange,
|
|
14
11
|
...restProps
|
|
15
12
|
} = props;
|
|
16
|
-
let [value, setValue] =
|
|
17
|
-
let [isPassword, setIsPassword] =
|
|
18
|
-
const inputRef =
|
|
13
|
+
let [value, setValue] = useState('');
|
|
14
|
+
let [isPassword, setIsPassword] = useState(true);
|
|
15
|
+
const inputRef = useRef(ref);
|
|
19
16
|
const handleChange = e => {
|
|
20
17
|
setValue(e.target.value);
|
|
21
18
|
if (onChange) onChange(e);
|
|
@@ -23,19 +20,19 @@ const Password = exports.Password = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
23
20
|
const handleClick = () => {
|
|
24
21
|
setIsPassword(prev => !prev);
|
|
25
22
|
};
|
|
26
|
-
return /*#__PURE__*/(
|
|
27
|
-
children: /*#__PURE__*/(
|
|
23
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
24
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
28
25
|
value: value,
|
|
29
26
|
ref: inputRef,
|
|
30
27
|
...restProps,
|
|
31
28
|
type: isPassword ? 'password' : 'text',
|
|
32
29
|
onChange: handleChange,
|
|
33
|
-
endAdornment: /*#__PURE__*/(
|
|
30
|
+
endAdornment: /*#__PURE__*/_jsx(ButtonIcon, {
|
|
34
31
|
size: 'medium',
|
|
35
32
|
variant: 'transparent',
|
|
36
33
|
color: 'neutral',
|
|
37
34
|
onClick: handleClick,
|
|
38
|
-
children: /*#__PURE__*/(
|
|
35
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
39
36
|
className: 'material_icon',
|
|
40
37
|
children: isPassword ? 'visibility_off' : 'visibility'
|
|
41
38
|
})
|
|
@@ -43,4 +40,4 @@ const Password = exports.Password = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
43
40
|
})
|
|
44
41
|
});
|
|
45
42
|
});
|
|
46
|
-
|
|
43
|
+
export default Password;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _Password = _interopRequireDefault(require("./Password"));
|
|
7
|
-
exports.default = _Password.default;
|
|
8
|
-
module.exports = exports.default;
|
|
1
|
+
export { default } from "./Password";
|
package/ui/Form/Period/Period.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const Period = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
3
|
+
import TextField from "../TextField/TextField";
|
|
4
|
+
import { forwardRef, useState } from 'react';
|
|
5
|
+
import ButtonIcon from "../../ButtonIcon";
|
|
6
|
+
import Card from "../../Card/Card";
|
|
7
|
+
import DatePicker from "../DatePicker/DatePicker";
|
|
8
|
+
import { DateService } from "../../../lib/services/DateService";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
const Period = /*#__PURE__*/forwardRef((props, ref) => {
|
|
15
13
|
let {
|
|
16
14
|
onChange,
|
|
17
15
|
format = 'dd.MM.yyyy',
|
|
18
16
|
onInput,
|
|
19
17
|
...restProps
|
|
20
18
|
} = props;
|
|
21
|
-
let [active, setActive] =
|
|
22
|
-
let [value, setValue] =
|
|
19
|
+
let [active, setActive] = useState(false);
|
|
20
|
+
let [value, setValue] = useState([new Date(), null]);
|
|
23
21
|
const handleClick = () => {
|
|
24
22
|
setActive(true);
|
|
25
23
|
};
|
|
@@ -42,30 +40,30 @@ const Period = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
42
40
|
};
|
|
43
41
|
let realValue = Array.isArray(props.value) ? props.value : value;
|
|
44
42
|
let displayValue = '';
|
|
45
|
-
if (realValue[0] && realValue[1]) displayValue = `${
|
|
46
|
-
return /*#__PURE__*/(
|
|
47
|
-
children: /*#__PURE__*/(
|
|
43
|
+
if (realValue[0] && realValue[1]) displayValue = `${DateService(realValue[0]).format('dd.MM.yyyy')} - ${DateService(realValue[1]).format('dd.MM.yyyy')}`;
|
|
44
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
45
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
48
46
|
className: 'arm-period',
|
|
49
|
-
children: [/*#__PURE__*/(
|
|
47
|
+
children: [/*#__PURE__*/_jsx(TextField, {
|
|
50
48
|
ref: ref,
|
|
51
49
|
placeholder: 'дд.мм.гггг - дд.мм.гггг',
|
|
52
50
|
...restProps,
|
|
53
51
|
value: displayValue,
|
|
54
52
|
onChange: () => null,
|
|
55
53
|
onFocus: handleClick,
|
|
56
|
-
endAdornment: /*#__PURE__*/(
|
|
54
|
+
endAdornment: /*#__PURE__*/_jsx(ButtonIcon, {
|
|
57
55
|
size: 'medium',
|
|
58
56
|
variant: 'transparent',
|
|
59
57
|
color: 'neutral',
|
|
60
58
|
onClick: handleClick,
|
|
61
|
-
children: /*#__PURE__*/(
|
|
59
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
62
60
|
className: 'material_icon',
|
|
63
61
|
children: "calendar_today"
|
|
64
62
|
})
|
|
65
63
|
})
|
|
66
|
-
}), active && /*#__PURE__*/(
|
|
64
|
+
}), active && /*#__PURE__*/_jsx(Card, {
|
|
67
65
|
className: 'arm-period__picker',
|
|
68
|
-
children: /*#__PURE__*/(
|
|
66
|
+
children: /*#__PURE__*/_jsx(DatePicker, {
|
|
69
67
|
onChange: handleChange,
|
|
70
68
|
selectsRange: true,
|
|
71
69
|
onBlur: () => {
|
|
@@ -79,5 +77,4 @@ const Period = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
79
77
|
})
|
|
80
78
|
});
|
|
81
79
|
});
|
|
82
|
-
|
|
83
|
-
module.exports = exports.default;
|
|
80
|
+
export default Period;
|
package/ui/Form/Period/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _Period = _interopRequireDefault(require("./Period"));
|
|
7
|
-
exports.default = _Period.default;
|
|
8
|
-
module.exports = exports.default;
|
|
1
|
+
export { default } from "./Period";
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
import DatePicker from "../DatePicker/DatePicker";
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
7
|
const PeriodSelect = () => {
|
|
11
|
-
const [startDate, setStartDate] =
|
|
12
|
-
const [endDate, setEndDate] =
|
|
8
|
+
const [startDate, setStartDate] = useState(new Date());
|
|
9
|
+
const [endDate, setEndDate] = useState(null);
|
|
13
10
|
const handleChange = date => {
|
|
14
11
|
setStartDate(date[0]);
|
|
15
12
|
setEndDate(date[1]);
|
|
16
13
|
};
|
|
17
|
-
return /*#__PURE__*/(
|
|
18
|
-
children: /*#__PURE__*/(
|
|
14
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
15
|
+
children: /*#__PURE__*/_jsx(DatePicker, {
|
|
19
16
|
selected: startDate,
|
|
20
17
|
onChange: handleChange,
|
|
21
18
|
startDate: startDate,
|
|
@@ -24,5 +21,4 @@ const PeriodSelect = () => {
|
|
|
24
21
|
})
|
|
25
22
|
});
|
|
26
23
|
};
|
|
27
|
-
|
|
28
|
-
module.exports = exports.default;
|
|
24
|
+
export default PeriodSelect;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _PeriodSelect = _interopRequireDefault(require("./PeriodSelect"));
|
|
7
|
-
exports.default = _PeriodSelect.default;
|
|
8
|
-
module.exports = exports.default;
|
|
1
|
+
export { default } from "./PeriodSelect";
|
package/ui/Form/Radio/Radio.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _Checkbox = _interopRequireDefault(require("../Checkbox/Checkbox"));
|
|
7
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
1
|
+
import Checkbox from "../Checkbox/Checkbox";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
5
|
const Radio = props => {
|
|
10
|
-
return /*#__PURE__*/(
|
|
11
|
-
children: /*#__PURE__*/(
|
|
6
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
7
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
12
8
|
...props,
|
|
13
|
-
className: (
|
|
9
|
+
className: clsx(props.className, 'arm-radio'),
|
|
14
10
|
type: 'radio'
|
|
15
11
|
})
|
|
16
12
|
});
|
|
17
13
|
};
|
|
18
|
-
|
|
19
|
-
module.exports = exports.default;
|
|
14
|
+
export default Radio;
|
package/ui/Form/Radio/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _Radio = _interopRequireDefault(require("./Radio"));
|
|
7
|
-
exports.default = _Radio.default;
|
|
8
|
-
module.exports = exports.default;
|
|
1
|
+
export { default } from "./Radio";
|
package/ui/Form/Rating/Rating.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
8
|
const Rating = props => {
|
|
11
9
|
let {
|
|
12
10
|
size = 'large',
|
|
13
11
|
onChange,
|
|
14
12
|
...restProps
|
|
15
13
|
} = props;
|
|
16
|
-
let [value, setValue] =
|
|
17
|
-
let [hovered, setHovered] =
|
|
14
|
+
let [value, setValue] = useState(props.defaultValue || 0);
|
|
15
|
+
let [hovered, setHovered] = useState(0);
|
|
18
16
|
let realValue = props.value !== undefined ? props.value : value;
|
|
19
17
|
const handleClick = index => () => {
|
|
20
18
|
setValue(index);
|
|
@@ -26,19 +24,19 @@ const Rating = props => {
|
|
|
26
24
|
const handleLeaveRating = () => {
|
|
27
25
|
setHovered(realValue);
|
|
28
26
|
};
|
|
29
|
-
return /*#__PURE__*/(
|
|
30
|
-
children: /*#__PURE__*/(
|
|
27
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
28
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
31
29
|
className: 'arm-rating',
|
|
32
30
|
onMouseLeave: handleLeaveRating,
|
|
33
|
-
children: [/*#__PURE__*/(
|
|
31
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
34
32
|
value: value,
|
|
35
33
|
...restProps,
|
|
36
34
|
type: "hidden"
|
|
37
35
|
}), [...Array(5)].map((_, index) => {
|
|
38
|
-
return /*#__PURE__*/(
|
|
36
|
+
return /*#__PURE__*/_jsx("div", {
|
|
39
37
|
onClick: handleClick(index + 1),
|
|
40
38
|
onMouseEnter: handleMouseEnter(index + 1),
|
|
41
|
-
className: (
|
|
39
|
+
className: clsx('material_icon', {
|
|
42
40
|
['material_icon_solid']: index + 1 <= hovered || index + 1 <= realValue,
|
|
43
41
|
'arm-rating__item_disabled': !!restProps.disabled
|
|
44
42
|
}, 'arm-rating__item', ['arm-rating__item_' + size]),
|
|
@@ -48,5 +46,4 @@ const Rating = props => {
|
|
|
48
46
|
})
|
|
49
47
|
});
|
|
50
48
|
};
|
|
51
|
-
|
|
52
|
-
module.exports = exports.default;
|
|
49
|
+
export default Rating;
|
package/ui/Form/Rating/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _Rating = _interopRequireDefault(require("./Rating"));
|
|
7
|
-
exports.default = _Rating.default;
|
|
8
|
-
module.exports = exports.default;
|
|
1
|
+
export { default } from "./Rating";
|
package/ui/Form/Select/Select.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const getOptionValue = option => option.value || option.text;
|
|
3
|
+
import TextField from "../TextField/TextField";
|
|
4
|
+
import { forwardRef, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import useClickOutside from "../../../lib/hooks/useClickOutside";
|
|
7
|
+
import ButtonIcon from "../../ButtonIcon";
|
|
8
|
+
import Adornment from "../../Adornment";
|
|
9
|
+
import { SelectSummary, SelectSummaryChips } from "./SelectSummary";
|
|
10
|
+
import Popover from "../../Popover/Popover";
|
|
11
|
+
import { fixedForwardRef } from "../../../lib/helpers";
|
|
12
|
+
import { SelectOptionsContainer } from "./SelectOptionsContainer";
|
|
13
|
+
import { SelectOptionList } from "./SelectOptionList";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
export const getOptionValue = option => option.value || option.text;
|
|
20
18
|
|
|
21
19
|
// let selectEl!: HTMLSelectElement
|
|
22
|
-
|
|
20
|
+
|
|
23
21
|
function Select(props, ref) {
|
|
24
22
|
var _options$find;
|
|
25
23
|
let {
|
|
@@ -46,12 +44,12 @@ function Select(props, ref) {
|
|
|
46
44
|
query,
|
|
47
45
|
...inputProps
|
|
48
46
|
} = props;
|
|
49
|
-
let [active, setActive] =
|
|
50
|
-
let [selected, setSelected] =
|
|
51
|
-
let [focused, setFocused] =
|
|
52
|
-
let [q, setQ] =
|
|
53
|
-
const anchorEl =
|
|
54
|
-
const inlineOptRef = (
|
|
47
|
+
let [active, setActive] = useState(!!defaultOpen);
|
|
48
|
+
let [selected, setSelected] = useState(defaultValue || (multiple ? [] : ''));
|
|
49
|
+
let [focused, setFocused] = useState(false);
|
|
50
|
+
let [q, setQ] = useState('');
|
|
51
|
+
const anchorEl = useRef(null);
|
|
52
|
+
const inlineOptRef = useClickOutside(handleClose);
|
|
55
53
|
const handleOpen = () => {
|
|
56
54
|
if (!inputProps.disabled) {
|
|
57
55
|
setActive(true);
|
|
@@ -136,16 +134,16 @@ function Select(props, ref) {
|
|
|
136
134
|
if (onClose) onClose();else setActive(false);
|
|
137
135
|
}
|
|
138
136
|
let displayClear = clear && (multiple ? realValue && realValue.length > 0 : !!realValue);
|
|
139
|
-
let selectEndAdornment = /*#__PURE__*/(
|
|
140
|
-
children: [/*#__PURE__*/(
|
|
137
|
+
let selectEndAdornment = /*#__PURE__*/_jsxs(_Fragment, {
|
|
138
|
+
children: [/*#__PURE__*/_jsx(Adornment, {
|
|
141
139
|
children: endAdornment
|
|
142
|
-
}), displayClear && /*#__PURE__*/(
|
|
143
|
-
children: /*#__PURE__*/(
|
|
140
|
+
}), displayClear && /*#__PURE__*/_jsx(Adornment, {
|
|
141
|
+
children: /*#__PURE__*/_jsx(ButtonIcon, {
|
|
144
142
|
size: 'small',
|
|
145
143
|
onClick: handleResetAll,
|
|
146
144
|
mi: 'close'
|
|
147
145
|
})
|
|
148
|
-
}), /*#__PURE__*/(
|
|
146
|
+
}), /*#__PURE__*/_jsx(ButtonIcon, {
|
|
149
147
|
size: 'small',
|
|
150
148
|
color: 'neutral',
|
|
151
149
|
onClick: handleOpen,
|
|
@@ -153,28 +151,28 @@ function Select(props, ref) {
|
|
|
153
151
|
mi: 'arrow_drop_down'
|
|
154
152
|
})]
|
|
155
153
|
});
|
|
156
|
-
const cachedWrapperProps =
|
|
154
|
+
const cachedWrapperProps = useMemo(() => ({
|
|
157
155
|
onClick: handleOpen
|
|
158
156
|
}), []);
|
|
159
|
-
const cachedClasses =
|
|
157
|
+
const cachedClasses = useMemo(() => {
|
|
160
158
|
var _inputProps$classes;
|
|
161
159
|
return {
|
|
162
160
|
...inputProps.classes,
|
|
163
|
-
wrapper: (
|
|
161
|
+
wrapper: clsx((_inputProps$classes = inputProps.classes) == null ? void 0 : _inputProps$classes.wrapper, 'arm-select__wrapper')
|
|
164
162
|
};
|
|
165
163
|
}, []);
|
|
166
|
-
const cachedStyles =
|
|
164
|
+
const cachedStyles = useMemo(() => ({
|
|
167
165
|
pointerEvents: 'none'
|
|
168
166
|
}), []);
|
|
169
|
-
return /*#__PURE__*/(
|
|
170
|
-
children: /*#__PURE__*/(
|
|
167
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
168
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
171
169
|
className: className,
|
|
172
|
-
children: [/*#__PURE__*/(
|
|
170
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
173
171
|
className: 'arm-select',
|
|
174
|
-
children: [/*#__PURE__*/(
|
|
172
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
175
173
|
className: 'arm-select__input_wrapper',
|
|
176
174
|
ref: anchorEl,
|
|
177
|
-
children: /*#__PURE__*/(
|
|
175
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
178
176
|
...inputProps,
|
|
179
177
|
classes: cachedClasses,
|
|
180
178
|
onChange: handleSearch,
|
|
@@ -188,12 +186,12 @@ function Select(props, ref) {
|
|
|
188
186
|
style: cachedStyles,
|
|
189
187
|
WrapperProps: cachedWrapperProps
|
|
190
188
|
})
|
|
191
|
-
}), multiple && !realActive && /*#__PURE__*/(
|
|
189
|
+
}), multiple && !realActive && /*#__PURE__*/_jsx(SelectSummaryChips, {
|
|
192
190
|
options: selectedOptions,
|
|
193
191
|
disabled: inputProps.disabled,
|
|
194
192
|
onDelete: handleSelect
|
|
195
193
|
})]
|
|
196
|
-
}), realActive && (!inline && anchorEl.current ? /*#__PURE__*/(
|
|
194
|
+
}), realActive && (!inline && anchorEl.current ? /*#__PURE__*/_jsx(Popover, {
|
|
197
195
|
classes: {
|
|
198
196
|
paper: 'px-0'
|
|
199
197
|
},
|
|
@@ -202,7 +200,7 @@ function Select(props, ref) {
|
|
|
202
200
|
open: realActive,
|
|
203
201
|
onClose: handleClose,
|
|
204
202
|
placement: 'bottom-start',
|
|
205
|
-
children: /*#__PURE__*/(
|
|
203
|
+
children: /*#__PURE__*/_jsx(SelectOptions, {
|
|
206
204
|
disabled: inputProps.disabled,
|
|
207
205
|
options: options,
|
|
208
206
|
multiple: multiple,
|
|
@@ -216,9 +214,9 @@ function Select(props, ref) {
|
|
|
216
214
|
onSelectAll: handleSelectAll,
|
|
217
215
|
onSubmit: handleSubmit
|
|
218
216
|
})
|
|
219
|
-
}) : /*#__PURE__*/(
|
|
217
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
220
218
|
ref: inlineOptRef,
|
|
221
|
-
children: /*#__PURE__*/(
|
|
219
|
+
children: /*#__PURE__*/_jsx(SelectOptions, {
|
|
222
220
|
disabled: inputProps.disabled,
|
|
223
221
|
options: options,
|
|
224
222
|
multiple: multiple,
|
|
@@ -236,7 +234,7 @@ function Select(props, ref) {
|
|
|
236
234
|
})
|
|
237
235
|
});
|
|
238
236
|
}
|
|
239
|
-
const SelectOptions =
|
|
237
|
+
export const SelectOptions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
240
238
|
let {
|
|
241
239
|
options,
|
|
242
240
|
value,
|
|
@@ -251,20 +249,20 @@ const SelectOptions = exports.SelectOptions = /*#__PURE__*/(0, _react.forwardRef
|
|
|
251
249
|
...callbacks
|
|
252
250
|
} = props;
|
|
253
251
|
if (multiple && optionControls === undefined) optionControls = true;
|
|
254
|
-
return /*#__PURE__*/(
|
|
255
|
-
children: /*#__PURE__*/(
|
|
252
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
253
|
+
children: /*#__PURE__*/_jsxs(SelectOptionsContainer, {
|
|
256
254
|
ref: ref,
|
|
257
255
|
inline: !!inline,
|
|
258
|
-
children: [beforeList, /*#__PURE__*/(
|
|
256
|
+
children: [beforeList, /*#__PURE__*/_jsx(SelectOptionList, {
|
|
259
257
|
options: options,
|
|
260
258
|
multiple: multiple,
|
|
261
259
|
value: value,
|
|
262
260
|
listStyle: listStyle,
|
|
263
261
|
disabled: disabled,
|
|
264
262
|
onChange: onClick
|
|
265
|
-
}), afterList, !!optionControls && !!multiple && /*#__PURE__*/(
|
|
263
|
+
}), afterList, !!optionControls && !!multiple && /*#__PURE__*/_jsx("div", {
|
|
266
264
|
className: 'arm-selectSummary__wrapper',
|
|
267
|
-
children: /*#__PURE__*/(
|
|
265
|
+
children: /*#__PURE__*/_jsx(SelectSummary, {
|
|
268
266
|
options: options,
|
|
269
267
|
value: value,
|
|
270
268
|
onClose: onClick,
|
|
@@ -289,4 +287,5 @@ const SelectOptions = exports.SelectOptions = /*#__PURE__*/(0, _react.forwardRef
|
|
|
289
287
|
// text: '123123123'
|
|
290
288
|
// },]} />
|
|
291
289
|
// }
|
|
292
|
-
|
|
290
|
+
|
|
291
|
+
export default fixedForwardRef(Select);
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.SelectOptionList = void 0;
|
|
6
|
-
var _List = _interopRequireDefault(require("../../List"));
|
|
7
|
-
var _Select = require("./Select");
|
|
8
|
-
var _helpers = require("../../../lib/helpers");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
1
|
+
import ListItem from "../../List";
|
|
2
|
+
import { getOptionValue } from "./Select";
|
|
3
|
+
import { fixedForwardRef } from "../../../lib/helpers";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
5
|
function SelectOptionListBase(props, ref) {
|
|
11
6
|
const {
|
|
12
7
|
options,
|
|
@@ -16,14 +11,14 @@ function SelectOptionListBase(props, ref) {
|
|
|
16
11
|
disabled,
|
|
17
12
|
onChange
|
|
18
13
|
} = props;
|
|
19
|
-
return /*#__PURE__*/(
|
|
14
|
+
return /*#__PURE__*/_jsx("div", {
|
|
20
15
|
ref: ref,
|
|
21
16
|
className: "arm-options__list",
|
|
22
17
|
children: options.map((item, index) => {
|
|
23
|
-
let optValue =
|
|
18
|
+
let optValue = getOptionValue(item);
|
|
24
19
|
let active = multiple === true && value ? value.includes(optValue) : optValue === value;
|
|
25
20
|
let checked = listStyle === 'checkbox' && !!multiple ? active : undefined;
|
|
26
|
-
return /*#__PURE__*/(
|
|
21
|
+
return /*#__PURE__*/_jsx(ListItem, {
|
|
27
22
|
disabled: disabled || !!item.disabled,
|
|
28
23
|
checked: checked,
|
|
29
24
|
active: active,
|
|
@@ -33,4 +28,4 @@ function SelectOptionListBase(props, ref) {
|
|
|
33
28
|
})
|
|
34
29
|
});
|
|
35
30
|
}
|
|
36
|
-
const SelectOptionList =
|
|
31
|
+
export const SelectOptionList = fixedForwardRef(SelectOptionListBase);
|