armtek-uikit-react 1.0.100 → 1.0.101
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/Form/Select/Select.js +25 -5
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.101","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","react-transition-group":"^4.4.5"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
package/ui/Form/Select/Select.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import TextField from "../TextField/TextField";
|
|
4
|
-
import { forwardRef, useState } from 'react';
|
|
4
|
+
import { forwardRef, useRef, useState } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import ListItem from "../../List/ListItem";
|
|
7
7
|
import useClickOutside from "../../../lib/hooks/useClickOutside";
|
|
@@ -46,12 +46,14 @@ function Select(props) {
|
|
|
46
46
|
let [selected, setSelected] = useState(defaultValue || (multiple ? [] : ''));
|
|
47
47
|
let [focused, setFocused] = useState(false);
|
|
48
48
|
let [q, setQ] = useState('');
|
|
49
|
-
const [anchorEl, setAnchorEl] = useState(null)
|
|
49
|
+
// const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null)
|
|
50
|
+
const anchorEl = useRef(null);
|
|
50
51
|
const inlineOptRef = useClickOutside(handleClose);
|
|
51
52
|
const handleOpen = e => {
|
|
52
53
|
if (!inputProps.disabled) {
|
|
53
54
|
setActive(true);
|
|
54
|
-
if
|
|
55
|
+
// if( e.target instanceof HTMLDivElement )
|
|
56
|
+
// setAnchorEl(e.currentTarget)
|
|
55
57
|
}
|
|
56
58
|
};
|
|
57
59
|
const handleSelect = (e, option) => {
|
|
@@ -120,6 +122,8 @@ function Select(props) {
|
|
|
120
122
|
function handleClose() {
|
|
121
123
|
if (onClose) onClose();else setActive(false);
|
|
122
124
|
}
|
|
125
|
+
console.log(realActive);
|
|
126
|
+
console.log(anchorEl);
|
|
123
127
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
124
128
|
children: /*#__PURE__*/_jsxs("div", {
|
|
125
129
|
className: className,
|
|
@@ -128,6 +132,7 @@ function Select(props) {
|
|
|
128
132
|
children: [/*#__PURE__*/_jsx("div", {
|
|
129
133
|
className: css.select__input_wrapper,
|
|
130
134
|
onClick: handleOpen,
|
|
135
|
+
ref: anchorEl,
|
|
131
136
|
children: /*#__PURE__*/_jsx(TextField, {
|
|
132
137
|
...inputProps,
|
|
133
138
|
onChange: handleSearch,
|
|
@@ -147,9 +152,9 @@ function Select(props) {
|
|
|
147
152
|
disabled: inputProps.disabled,
|
|
148
153
|
onDelete: handleSelect
|
|
149
154
|
})]
|
|
150
|
-
}), realActive &&
|
|
155
|
+
}), realActive && (!inline && anchorEl.current ? /*#__PURE__*/_jsx(Popover, {
|
|
151
156
|
matchWidth: true,
|
|
152
|
-
anchorEl: anchorEl,
|
|
157
|
+
anchorEl: anchorEl.current,
|
|
153
158
|
open: realActive,
|
|
154
159
|
onClose: handleClose,
|
|
155
160
|
placement: 'bottom-start',
|
|
@@ -224,4 +229,19 @@ const SelectOptions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
224
229
|
})
|
|
225
230
|
});
|
|
226
231
|
});
|
|
232
|
+
|
|
233
|
+
// export const SelectTest = (props: SelectProps) => {
|
|
234
|
+
// return <Select inline={true} listStyle={'checkbox'} defaultValue={['1', '12312']} multiple={true} label={'TEST '} disabled={true} open={true} options={[{
|
|
235
|
+
// text: '1'
|
|
236
|
+
// },{
|
|
237
|
+
// text: 'aasdasdasdasd'
|
|
238
|
+
// },{
|
|
239
|
+
// text: '12312'
|
|
240
|
+
// },{
|
|
241
|
+
// text: 'gadadsasd'
|
|
242
|
+
// },{
|
|
243
|
+
// text: '123123123'
|
|
244
|
+
// },]} />
|
|
245
|
+
// }
|
|
246
|
+
|
|
227
247
|
export default Select;
|