@bbl-digital/snorre 2.2.109 → 2.2.113
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/dist/bundle.js
CHANGED
@@ -31466,7 +31466,6 @@
|
|
31466
31466
|
css,
|
31467
31467
|
...props
|
31468
31468
|
}, ref) => {
|
31469
|
-
const customInputReferance = React.useRef(null);
|
31470
31469
|
const {
|
31471
31470
|
optionsHeight,
|
31472
31471
|
optionsRef
|
@@ -31481,15 +31480,8 @@
|
|
31481
31480
|
const onInputChange = e => {
|
31482
31481
|
setInputDirty(true);
|
31483
31482
|
setValueChanged(e.target.value);
|
31484
|
-
|
31485
|
-
if (props.
|
31486
|
-
// Maybe?
|
31487
|
-
setHighlightedIndex(0);
|
31488
|
-
}
|
31489
|
-
|
31490
|
-
if (props.onChange) {
|
31491
|
-
props.onChange(e);
|
31492
|
-
}
|
31483
|
+
if (props.values) setHighlightedIndex(0);
|
31484
|
+
if (props.onChange) props.onChange(e);
|
31493
31485
|
};
|
31494
31486
|
|
31495
31487
|
const handleOnInputClick = () => {
|
@@ -31563,21 +31555,24 @@
|
|
31563
31555
|
setHighlightedIndex(newHighlightIndex);
|
31564
31556
|
};
|
31565
31557
|
|
31566
|
-
const handleCustomValueInputBlur = e => {
|
31567
|
-
if (props.onBlur) {
|
31568
|
-
props.onBlur(e);
|
31569
|
-
}
|
31570
|
-
|
31571
|
-
if (!customInputReferance.current?.contains(e.target || e.relatedTarget)) {
|
31572
|
-
setShowValues(false);
|
31573
|
-
}
|
31574
|
-
};
|
31575
|
-
|
31576
31558
|
const handleEscape = () => {
|
31577
31559
|
setShowValues(false);
|
31578
31560
|
setHighlightedIndex(null);
|
31579
31561
|
};
|
31580
31562
|
|
31563
|
+
const handleCustomOnKeyDown = e => {
|
31564
|
+
const {
|
31565
|
+
key
|
31566
|
+
} = e;
|
31567
|
+
|
31568
|
+
if (key === 'Escape') {
|
31569
|
+
handleEscape();
|
31570
|
+
return;
|
31571
|
+
}
|
31572
|
+
|
31573
|
+
props.onKeyDown?.(e);
|
31574
|
+
};
|
31575
|
+
|
31581
31576
|
const handleOnKeyDown = e => {
|
31582
31577
|
const {
|
31583
31578
|
key
|
@@ -31670,7 +31665,7 @@
|
|
31670
31665
|
onBlur: props.onBlur,
|
31671
31666
|
onFocus: props.onFocus,
|
31672
31667
|
onChange: onInputChange,
|
31673
|
-
onKeyDown: props.onKeyDown ?
|
31668
|
+
onKeyDown: props.onKeyDown ? handleCustomOnKeyDown : handleOnKeyDown,
|
31674
31669
|
onClick: handleOnInputClick,
|
31675
31670
|
ref: ref,
|
31676
31671
|
name: props.name,
|
@@ -31708,8 +31703,6 @@
|
|
31708
31703
|
children: props.labelFromValues ? item[props.labelFromValues] : item.label
|
31709
31704
|
}, props.keyFromValues ? item[props.keyFromValues] : item.key))
|
31710
31705
|
}), props.renderCustomValueInput && jsxRuntime$1.jsx("div", {
|
31711
|
-
ref: customInputReferance,
|
31712
|
-
onBlur: handleCustomValueInputBlur,
|
31713
31706
|
children: props.renderCustomValueInput
|
31714
31707
|
})]
|
31715
31708
|
})]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
2
|
-
import React, { createRef,
|
2
|
+
import React, { createRef, useState } from 'react';
|
3
3
|
import { styles, ErrorMessage } from './styles';
|
4
4
|
import { useEffect } from 'react';
|
5
5
|
import { useDebounce } from '../utils/debounce';
|
@@ -17,7 +17,6 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
17
17
|
css,
|
18
18
|
...props
|
19
19
|
}, ref) => {
|
20
|
-
const customInputReferance = useRef(null);
|
21
20
|
const {
|
22
21
|
optionsHeight,
|
23
22
|
optionsRef
|
@@ -32,15 +31,8 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
32
31
|
const onInputChange = e => {
|
33
32
|
setInputDirty(true);
|
34
33
|
setValueChanged(e.target.value);
|
35
|
-
|
36
|
-
if (props.
|
37
|
-
// Maybe?
|
38
|
-
setHighlightedIndex(0);
|
39
|
-
}
|
40
|
-
|
41
|
-
if (props.onChange) {
|
42
|
-
props.onChange(e);
|
43
|
-
}
|
34
|
+
if (props.values) setHighlightedIndex(0);
|
35
|
+
if (props.onChange) props.onChange(e);
|
44
36
|
};
|
45
37
|
|
46
38
|
const handleOnInputClick = () => {
|
@@ -114,21 +106,24 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
114
106
|
setHighlightedIndex(newHighlightIndex);
|
115
107
|
};
|
116
108
|
|
117
|
-
const handleCustomValueInputBlur = e => {
|
118
|
-
if (props.onBlur) {
|
119
|
-
props.onBlur(e);
|
120
|
-
}
|
121
|
-
|
122
|
-
if (!customInputReferance.current?.contains(e.target || e.relatedTarget)) {
|
123
|
-
setShowValues(false);
|
124
|
-
}
|
125
|
-
};
|
126
|
-
|
127
109
|
const handleEscape = () => {
|
128
110
|
setShowValues(false);
|
129
111
|
setHighlightedIndex(null);
|
130
112
|
};
|
131
113
|
|
114
|
+
const handleCustomOnKeyDown = e => {
|
115
|
+
const {
|
116
|
+
key
|
117
|
+
} = e;
|
118
|
+
|
119
|
+
if (key === 'Escape') {
|
120
|
+
handleEscape();
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
|
124
|
+
props.onKeyDown?.(e);
|
125
|
+
};
|
126
|
+
|
132
127
|
const handleOnKeyDown = e => {
|
133
128
|
const {
|
134
129
|
key
|
@@ -224,7 +219,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
224
219
|
onBlur: props.onBlur,
|
225
220
|
onFocus: props.onFocus,
|
226
221
|
onChange: onInputChange,
|
227
|
-
onKeyDown: props.onKeyDown ?
|
222
|
+
onKeyDown: props.onKeyDown ? handleCustomOnKeyDown : handleOnKeyDown,
|
228
223
|
onClick: handleOnInputClick,
|
229
224
|
ref: ref,
|
230
225
|
name: props.name,
|
@@ -262,8 +257,6 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
262
257
|
children: props.labelFromValues ? item[props.labelFromValues] : item.label
|
263
258
|
}, props.keyFromValues ? item[props.keyFromValues] : item.key))
|
264
259
|
}), props.renderCustomValueInput && _jsx("div", {
|
265
|
-
ref: customInputReferance,
|
266
|
-
onBlur: handleCustomValueInputBlur,
|
267
260
|
children: props.renderCustomValueInput
|
268
261
|
})]
|
269
262
|
})]
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Autocomplete/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Autocomplete/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,YAAY,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAK3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAKjD,UAAU,MAAM;IACd,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gCAAgC;IAChC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IACxD,iCAAiC;IACjC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IACzD,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAA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,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,oCAAoC;IACpC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,oBAAY,GAAG,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAA;AAEhD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAmSjC,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
2
|
-
import React, { createRef,
|
2
|
+
import React, { createRef, useState } from 'react';
|
3
3
|
import { styles, ErrorMessage } from './styles';
|
4
4
|
import { useEffect } from 'react';
|
5
5
|
import { useDebounce } from '../utils/debounce';
|
@@ -17,7 +17,6 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
17
17
|
css,
|
18
18
|
...props
|
19
19
|
}, ref) => {
|
20
|
-
const customInputReferance = useRef(null);
|
21
20
|
const {
|
22
21
|
optionsHeight,
|
23
22
|
optionsRef
|
@@ -32,15 +31,8 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
32
31
|
const onInputChange = e => {
|
33
32
|
setInputDirty(true);
|
34
33
|
setValueChanged(e.target.value);
|
35
|
-
|
36
|
-
if (props.
|
37
|
-
// Maybe?
|
38
|
-
setHighlightedIndex(0);
|
39
|
-
}
|
40
|
-
|
41
|
-
if (props.onChange) {
|
42
|
-
props.onChange(e);
|
43
|
-
}
|
34
|
+
if (props.values) setHighlightedIndex(0);
|
35
|
+
if (props.onChange) props.onChange(e);
|
44
36
|
};
|
45
37
|
|
46
38
|
const handleOnInputClick = () => {
|
@@ -114,21 +106,24 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
114
106
|
setHighlightedIndex(newHighlightIndex);
|
115
107
|
};
|
116
108
|
|
117
|
-
const handleCustomValueInputBlur = e => {
|
118
|
-
if (props.onBlur) {
|
119
|
-
props.onBlur(e);
|
120
|
-
}
|
121
|
-
|
122
|
-
if (!customInputReferance.current?.contains(e.target || e.relatedTarget)) {
|
123
|
-
setShowValues(false);
|
124
|
-
}
|
125
|
-
};
|
126
|
-
|
127
109
|
const handleEscape = () => {
|
128
110
|
setShowValues(false);
|
129
111
|
setHighlightedIndex(null);
|
130
112
|
};
|
131
113
|
|
114
|
+
const handleCustomOnKeyDown = e => {
|
115
|
+
const {
|
116
|
+
key
|
117
|
+
} = e;
|
118
|
+
|
119
|
+
if (key === 'Escape') {
|
120
|
+
handleEscape();
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
|
124
|
+
props.onKeyDown?.(e);
|
125
|
+
};
|
126
|
+
|
132
127
|
const handleOnKeyDown = e => {
|
133
128
|
const {
|
134
129
|
key
|
@@ -224,7 +219,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
224
219
|
onBlur: props.onBlur,
|
225
220
|
onFocus: props.onFocus,
|
226
221
|
onChange: onInputChange,
|
227
|
-
onKeyDown: props.onKeyDown ?
|
222
|
+
onKeyDown: props.onKeyDown ? handleCustomOnKeyDown : handleOnKeyDown,
|
228
223
|
onClick: handleOnInputClick,
|
229
224
|
ref: ref,
|
230
225
|
name: props.name,
|
@@ -262,8 +257,6 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(({
|
|
262
257
|
children: props.labelFromValues ? item[props.labelFromValues] : item.label
|
263
258
|
}, props.keyFromValues ? item[props.keyFromValues] : item.key))
|
264
259
|
}), props.renderCustomValueInput && _jsx("div", {
|
265
|
-
ref: customInputReferance,
|
266
|
-
onBlur: handleCustomValueInputBlur,
|
267
260
|
children: props.renderCustomValueInput
|
268
261
|
})]
|
269
262
|
})]
|