armtek-uikit-react 1.0.27 → 1.0.29
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/assets/Adornment.scss +1 -0
- package/assets/Period.scss +1 -0
- package/assets/TextField.scss +0 -6
- package/package.json +1 -1
- package/ui/Adornment/index.d.ts +1 -1
- package/ui/Adornment/index.js +1 -1
- package/ui/Form/DateField/DateField.d.ts +4 -11
- package/ui/Form/DateField/DateField.js +6 -1
- package/ui/Form/Password/Password.d.ts +3 -1
- package/ui/Form/Password/Password.js +1 -1
- package/ui/Form/Select/Select.d.ts +2 -0
- package/ui/Form/Select/Select.js +37 -7
- package/ui/Form/TextField/TextField.d.ts +5 -1
- package/ui/Form/TextField/TextField.js +12 -12
package/assets/Adornment.scss
CHANGED
package/assets/Period.scss
CHANGED
package/assets/TextField.scss
CHANGED
|
@@ -139,15 +139,9 @@
|
|
|
139
139
|
color: $color-error-dark;
|
|
140
140
|
}
|
|
141
141
|
.textfield__adornment{
|
|
142
|
-
@include flex();
|
|
143
|
-
position: relative;
|
|
144
142
|
z-index: 5;
|
|
145
143
|
height: 100%;
|
|
146
144
|
padding-right: 10px;
|
|
147
|
-
font-size: 0;
|
|
148
|
-
& > *{
|
|
149
|
-
margin-left: $size-step;
|
|
150
|
-
}
|
|
151
145
|
}
|
|
152
146
|
.textfield__helperText{
|
|
153
147
|
margin-top: calc($size-step / 2);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.29","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
package/ui/Adornment/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Adornment';
|
|
2
|
-
export
|
|
2
|
+
export { AdornmentContainer } from './Adornment';
|
package/ui/Adornment/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./Adornment";
|
|
2
|
-
export
|
|
2
|
+
export { AdornmentContainer } from "./Adornment";
|
|
@@ -4,23 +4,16 @@ export type DateFieldProps = {
|
|
|
4
4
|
format?: string;
|
|
5
5
|
onInput?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
6
6
|
onChange?: (value: Date | null) => void;
|
|
7
|
+
value?: Date | null;
|
|
7
8
|
showTime?: boolean;
|
|
8
9
|
showTimeOnly?: boolean;
|
|
9
|
-
} & TextFieldProps
|
|
10
|
+
} & Omit<TextFieldProps, 'onChange' | 'value'>;
|
|
10
11
|
declare const DateField: import("react").ForwardRefExoticComponent<{
|
|
11
12
|
format?: string | undefined;
|
|
12
13
|
onInput?: ((e: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
13
14
|
onChange?: ((value: Date | null) => void) | undefined;
|
|
15
|
+
value?: Date | null | undefined;
|
|
14
16
|
showTime?: boolean | undefined;
|
|
15
17
|
showTimeOnly?: boolean | undefined;
|
|
16
|
-
} &
|
|
17
|
-
label?: string | undefined;
|
|
18
|
-
size?: "large" | "small" | undefined;
|
|
19
|
-
variant?: import("../../../types/theme").VariantType | undefined;
|
|
20
|
-
error?: boolean | undefined;
|
|
21
|
-
success?: boolean | undefined;
|
|
22
|
-
helperText?: string | undefined;
|
|
23
|
-
endAdornment?: import("react").ReactNode;
|
|
24
|
-
multiline?: boolean | undefined;
|
|
25
|
-
} & Omit<import("react").InputHTMLAttributes<any>, "size"> & import("react").RefAttributes<unknown>>;
|
|
18
|
+
} & Omit<TextFieldProps, "value" | "onChange"> & import("react").RefAttributes<unknown>>;
|
|
26
19
|
export default DateField;
|
|
@@ -35,6 +35,7 @@ const DateField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
35
35
|
showTime,
|
|
36
36
|
showTimeOnly,
|
|
37
37
|
disabled,
|
|
38
|
+
value,
|
|
38
39
|
...restProps
|
|
39
40
|
} = props;
|
|
40
41
|
let [date, setDate] = useState(null);
|
|
@@ -43,10 +44,11 @@ const DateField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
43
44
|
setDate(d);
|
|
44
45
|
if (onChange) onChange(d);
|
|
45
46
|
};
|
|
47
|
+
let realValue = value !== undefined ? value : date;
|
|
46
48
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
47
49
|
children: /*#__PURE__*/_jsx(DatePicker, {
|
|
48
50
|
onChange: handleChange,
|
|
49
|
-
selected:
|
|
51
|
+
selected: realValue,
|
|
50
52
|
showTimeSelect: !!showTime,
|
|
51
53
|
timeIntervals: 15,
|
|
52
54
|
showTimeSelectOnly: !!showTimeOnly && !!showTime,
|
|
@@ -67,6 +69,9 @@ const DateField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
67
69
|
const PickerCard = props => {
|
|
68
70
|
return /*#__PURE__*/_jsx(Card, {
|
|
69
71
|
className: props.className,
|
|
72
|
+
style: {
|
|
73
|
+
zIndex: 6
|
|
74
|
+
},
|
|
70
75
|
children: props.children
|
|
71
76
|
});
|
|
72
77
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const Password: import("react").ForwardRefExoticComponent<{
|
|
1
|
+
export declare const Password: import("react").ForwardRefExoticComponent<{
|
|
2
2
|
label?: string | undefined;
|
|
3
3
|
size?: "large" | "small" | undefined;
|
|
4
4
|
variant?: import("../../../types/theme").VariantType | undefined;
|
|
@@ -7,5 +7,7 @@ declare const Password: import("react").ForwardRefExoticComponent<{
|
|
|
7
7
|
helperText?: string | undefined;
|
|
8
8
|
endAdornment?: import("react").ReactNode;
|
|
9
9
|
multiline?: boolean | undefined;
|
|
10
|
+
focused?: boolean | undefined;
|
|
11
|
+
editable?: boolean | undefined;
|
|
10
12
|
} & Omit<import("react").InputHTMLAttributes<any>, "size"> & import("react").RefAttributes<unknown>>;
|
|
11
13
|
export default Password;
|
|
@@ -5,7 +5,7 @@ import { forwardRef, useRef, useState } from 'react';
|
|
|
5
5
|
import ButtonIcon from "../../ButtonIcon";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
|
-
const Password = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
|
+
export const Password = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9
9
|
let {
|
|
10
10
|
onChange,
|
|
11
11
|
...restProps
|
package/ui/Form/Select/Select.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import TextField from "../TextField/TextField";
|
|
4
4
|
import { forwardRef, useRef, useState } from 'react';
|
|
5
|
-
import Index from "../../ButtonIcon";
|
|
6
5
|
import clsx from 'clsx';
|
|
7
6
|
import ListItem from "../../List/ListItem";
|
|
8
7
|
import useClickOutside from "../../../lib/hooks/useClickOutside";
|
|
9
8
|
import css from "./Select.module.scss";
|
|
9
|
+
import ButtonIcon from "../../ButtonIcon";
|
|
10
|
+
import Adornment from "../../Adornment";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -26,10 +27,14 @@ function Select(props) {
|
|
|
26
27
|
value,
|
|
27
28
|
defaultValue,
|
|
28
29
|
onChange,
|
|
30
|
+
search,
|
|
31
|
+
open,
|
|
29
32
|
...inputProps
|
|
30
33
|
} = props;
|
|
31
34
|
let [active, setActive] = useState(false);
|
|
32
35
|
let [selected, setSelected] = useState(defaultValue || (multiple ? [] : ''));
|
|
36
|
+
let [focused, setFocused] = useState(false);
|
|
37
|
+
let [q, setQ] = useState('');
|
|
33
38
|
let selectRef = useRef(null);
|
|
34
39
|
let optRef = useClickOutside(() => setActive(false));
|
|
35
40
|
const handleActive = flag => {
|
|
@@ -42,12 +47,25 @@ function Select(props) {
|
|
|
42
47
|
let newValueM = mSelected.includes(v) ? mSelected.filter(item => item !== v) : mSelected.concat(v);
|
|
43
48
|
setSelected(multiple ? newValueM : newValueS);
|
|
44
49
|
if (onChange) onChange(multiple ? newValueM : newValueS);
|
|
50
|
+
if (search && !multiple) {
|
|
51
|
+
setQ(options.find(item => getOptionValue(item) === newValueS).text);
|
|
52
|
+
}
|
|
45
53
|
if (!multiple) setActive(false);
|
|
46
54
|
|
|
47
55
|
// if(selectRef.current)
|
|
48
56
|
// selectRef.current.dispatchEvent(new Event('change', { bubbles: true }))
|
|
49
57
|
};
|
|
50
58
|
|
|
59
|
+
const handleSearch = e => {
|
|
60
|
+
setQ(e.target.value);
|
|
61
|
+
};
|
|
62
|
+
const handleFocus = search ? () => {
|
|
63
|
+
setFocused(true);
|
|
64
|
+
} : undefined;
|
|
65
|
+
const handleBlur = !!search ? () => {
|
|
66
|
+
setFocused(false);
|
|
67
|
+
} : undefined;
|
|
68
|
+
|
|
51
69
|
// const handleChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
|
52
70
|
// let option = options.find(item => getOptionValue(item) === e.target.value)
|
|
53
71
|
// if( option )
|
|
@@ -60,7 +78,9 @@ function Select(props) {
|
|
|
60
78
|
// }
|
|
61
79
|
|
|
62
80
|
let selectEndAdornment = /*#__PURE__*/_jsxs(_Fragment, {
|
|
63
|
-
children: [
|
|
81
|
+
children: [/*#__PURE__*/_jsx(Adornment, {
|
|
82
|
+
children: endAdornment
|
|
83
|
+
}), /*#__PURE__*/_jsx(ButtonIcon, {
|
|
64
84
|
onClick: () => handleActive,
|
|
65
85
|
size: 'small',
|
|
66
86
|
variant: 'transparent',
|
|
@@ -76,12 +96,16 @@ function Select(props) {
|
|
|
76
96
|
// }
|
|
77
97
|
|
|
78
98
|
let realValue = value !== undefined ? value : selected;
|
|
99
|
+
let realActive = open !== undefined ? open : active;
|
|
79
100
|
let selectedText = multiple ? options.filter(item => realValue == null ? void 0 : realValue.includes(getOptionValue(item))).map(item => item.text).join(', ') : ((_options$find = options.find(item => getOptionValue(item) === realValue)) == null ? void 0 : _options$find.text) || '';
|
|
101
|
+
if (!!search) options = options.filter(item => item.text.toLowerCase().includes(q.toLowerCase()));
|
|
80
102
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
81
103
|
children: /*#__PURE__*/_jsxs("div", {
|
|
82
104
|
className: css.select,
|
|
105
|
+
ref: optRef,
|
|
83
106
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
84
107
|
className: css.select__input_wrapper,
|
|
108
|
+
onClick: () => setActive(true),
|
|
85
109
|
children: [/*#__PURE__*/_jsx("select", {
|
|
86
110
|
multiple: multiple,
|
|
87
111
|
ref: selectRef,
|
|
@@ -94,13 +118,19 @@ function Select(props) {
|
|
|
94
118
|
}, item.text))
|
|
95
119
|
}), /*#__PURE__*/_jsx(TextField, {
|
|
96
120
|
...inputProps,
|
|
97
|
-
|
|
98
|
-
|
|
121
|
+
onChange: handleSearch,
|
|
122
|
+
focused: focused,
|
|
123
|
+
onFocus: handleFocus,
|
|
124
|
+
onBlur: handleBlur,
|
|
125
|
+
value: !search ? selectedText : q,
|
|
99
126
|
className: clsx(css.select__input, className),
|
|
100
|
-
endAdornment: selectEndAdornment
|
|
127
|
+
endAdornment: selectEndAdornment,
|
|
128
|
+
style: {
|
|
129
|
+
pointerEvents: 'none'
|
|
130
|
+
},
|
|
131
|
+
editable: !!search
|
|
101
132
|
})]
|
|
102
|
-
}),
|
|
103
|
-
ref: optRef,
|
|
133
|
+
}), realActive && /*#__PURE__*/_jsx(SelectOptions, {
|
|
104
134
|
options: options,
|
|
105
135
|
multiple: multiple,
|
|
106
136
|
value: realValue,
|
|
@@ -9,8 +9,10 @@ export type TextFieldProps = {
|
|
|
9
9
|
helperText?: string;
|
|
10
10
|
endAdornment?: string | ReactNode;
|
|
11
11
|
multiline?: boolean;
|
|
12
|
+
focused?: boolean;
|
|
13
|
+
editable?: boolean;
|
|
12
14
|
} & Omit<InputHTMLAttributes<any>, 'size'>;
|
|
13
|
-
declare const TextField: import("react").ForwardRefExoticComponent<{
|
|
15
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<{
|
|
14
16
|
label?: string | undefined;
|
|
15
17
|
size?: "large" | "small" | undefined;
|
|
16
18
|
variant?: VariantType | undefined;
|
|
@@ -19,6 +21,8 @@ declare const TextField: import("react").ForwardRefExoticComponent<{
|
|
|
19
21
|
helperText?: string | undefined;
|
|
20
22
|
endAdornment?: string | ReactNode;
|
|
21
23
|
multiline?: boolean | undefined;
|
|
24
|
+
focused?: boolean | undefined;
|
|
25
|
+
editable?: boolean | undefined;
|
|
22
26
|
} & Omit<InputHTMLAttributes<any>, "size"> & import("react").RefAttributes<unknown>>;
|
|
23
27
|
type ContainerPropsType = {
|
|
24
28
|
focused?: boolean;
|
|
@@ -4,6 +4,7 @@ import { forwardRef, useRef, useState } from 'react';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import HelperText from "../../HelperText/HelperText";
|
|
6
6
|
import css from "./TextField.module.scss";
|
|
7
|
+
import Adornment, { AdornmentContainer } from "../../Adornment";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -11,7 +12,7 @@ const CssClasses = ['textfield__container_outlined', 'textfield__container', 'te
|
|
|
11
12
|
|
|
12
13
|
// const css = getCssPrefix(CssClasses)
|
|
13
14
|
|
|
14
|
-
const TextField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
15
|
+
export const TextField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
15
16
|
let {
|
|
16
17
|
error,
|
|
17
18
|
success,
|
|
@@ -22,6 +23,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22
23
|
endAdornment,
|
|
23
24
|
className,
|
|
24
25
|
multiline = false,
|
|
26
|
+
editable = true,
|
|
25
27
|
...inputProps
|
|
26
28
|
} = props;
|
|
27
29
|
let [value, setValue] = useState('');
|
|
@@ -35,31 +37,29 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
35
37
|
setFocused(false);
|
|
36
38
|
if (inputProps.onBlur) inputProps.onBlur(e);
|
|
37
39
|
};
|
|
38
|
-
let endContent = /*#__PURE__*/_jsxs(
|
|
40
|
+
let endContent = /*#__PURE__*/_jsxs(AdornmentContainer, {
|
|
39
41
|
className: css.textfield__adornment,
|
|
40
|
-
children: [/*#__PURE__*/_jsx(
|
|
41
|
-
className:
|
|
42
|
-
children: endAdornment
|
|
43
|
-
}), error && /*#__PURE__*/_jsx("div", {
|
|
44
|
-
className: clsx('material_icon', 'text_error', css.textfield__icon),
|
|
42
|
+
children: [endAdornment, error && /*#__PURE__*/_jsx(Adornment, {
|
|
43
|
+
className: clsx('material_icon', 'text_error'),
|
|
45
44
|
children: "error_outline"
|
|
46
|
-
}), success && /*#__PURE__*/_jsx(
|
|
47
|
-
className: clsx('material_icon', 'text_success'
|
|
45
|
+
}), success && /*#__PURE__*/_jsx(Adornment, {
|
|
46
|
+
className: clsx('material_icon', 'text_success'),
|
|
48
47
|
children: "done"
|
|
49
48
|
})]
|
|
50
49
|
});
|
|
51
50
|
let endContentExists = endAdornment || error || success;
|
|
52
51
|
let Component = multiline ? 'textarea' : 'input';
|
|
53
52
|
let realRef = ref || inputRef;
|
|
53
|
+
let realFocused = props.focused !== undefined ? props.focused : focused;
|
|
54
54
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
55
|
children: [/*#__PURE__*/_jsxs(TextFieldContainer, {
|
|
56
56
|
size: size,
|
|
57
57
|
variant: variant,
|
|
58
58
|
disabled: inputProps.disabled,
|
|
59
|
-
focused:
|
|
59
|
+
focused: realFocused,
|
|
60
60
|
onClick: () => {
|
|
61
61
|
var _realRef$current;
|
|
62
|
-
return (_realRef$current = realRef.current) == null ? void 0 : _realRef$current.focus();
|
|
62
|
+
return editable ? (_realRef$current = realRef.current) == null ? void 0 : _realRef$current.focus() : null;
|
|
63
63
|
},
|
|
64
64
|
className: className,
|
|
65
65
|
error: error,
|
|
@@ -71,7 +71,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
71
71
|
size: size,
|
|
72
72
|
variant: variant,
|
|
73
73
|
label: label,
|
|
74
|
-
focused:
|
|
74
|
+
focused: realFocused,
|
|
75
75
|
error: error,
|
|
76
76
|
multiline: multiline,
|
|
77
77
|
onFocus: handleFocus,
|