linear-react-components-ui 1.1.25-beta.7 → 1.1.25-beta.9

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.
Files changed (73) hide show
  1. package/lib/{BaseMask-0c14ef51.d.ts → BaseMask-78847f45.d.ts} +1 -1
  2. package/lib/{Cnpj-53bfd6ab.d.ts → Cnpj-8366781f.d.ts} +1 -2
  3. package/lib/{Cpf-019b21e0.d.ts → Cpf-3dfd54eb.d.ts} +1 -2
  4. package/lib/{Phone-2bb0b397.d.ts → Phone-1962c0f2.d.ts} +1 -1
  5. package/lib/{ZipCode-09460e18.d.ts → ZipCode-be9c5b3b.d.ts} +1 -1
  6. package/lib/assets/styles/radio.scss +44 -32
  7. package/lib/assets/styles/split.scss +1 -1
  8. package/lib/form2/index.d.ts +1 -1
  9. package/lib/{index-3b70931d.d.ts → index-02a27c19.d.ts} +2 -20
  10. package/lib/index-053f615b.d.ts +26 -0
  11. package/lib/{index-7dfa8924.d.ts → index-25b80f32.d.ts} +1 -1
  12. package/lib/{index-9e576346.d.ts → index-6f5c772d.d.ts} +1 -1
  13. package/lib/{index-208e7f62.d.ts → index-6fcf446c.d.ts} +2 -20
  14. package/lib/index-7159df18.d.ts +21 -0
  15. package/lib/index-c41f4a15.d.ts +15 -0
  16. package/lib/inputs2/checkboxfield/base.d.ts +29 -0
  17. package/lib/inputs2/checkboxfield/base.js +134 -0
  18. package/lib/inputs2/checkboxfield/index.d.ts +3 -2
  19. package/lib/inputs2/checkboxfield/index.js +32 -125
  20. package/lib/inputs2/colorfield/index.d.ts +6 -5
  21. package/lib/inputs2/date/datefield/base.d.ts +13 -0
  22. package/lib/inputs2/date/datefield/base.js +330 -0
  23. package/lib/inputs2/date/datefield/calendarbox.d.ts +1 -1
  24. package/lib/inputs2/date/datefield/index.js +34 -322
  25. package/lib/inputs2/date/datefield/types.d.ts +5 -3
  26. package/lib/inputs2/date/dateperiodfield/base.d.ts +13 -0
  27. package/lib/inputs2/date/dateperiodfield/base.js +595 -0
  28. package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +1 -1
  29. package/lib/inputs2/date/dateperiodfield/index.js +34 -587
  30. package/lib/inputs2/date/dateperiodfield/types.d.ts +5 -3
  31. package/lib/inputs2/filefield/index.d.ts +6 -5
  32. package/lib/inputs2/index.d.ts +18 -15
  33. package/lib/inputs2/mask/BaseMask.d.ts +6 -5
  34. package/lib/inputs2/mask/Cnpj.d.ts +7 -6
  35. package/lib/inputs2/mask/Cnpj.js +18 -21
  36. package/lib/inputs2/mask/Cpf.d.ts +7 -6
  37. package/lib/inputs2/mask/Cpf.js +12 -19
  38. package/lib/inputs2/mask/Phone.d.ts +7 -6
  39. package/lib/inputs2/mask/ZipCode.d.ts +7 -6
  40. package/lib/inputs2/numberfield/currency.d.ts +5 -4
  41. package/lib/inputs2/numberfield/decimal.d.ts +5 -4
  42. package/lib/inputs2/numberfield/index.d.ts +5 -4
  43. package/lib/inputs2/numberfield/types.d.ts +5 -4
  44. package/lib/inputs2/radiofield/base.d.ts +12 -0
  45. package/lib/inputs2/radiofield/base.js +156 -0
  46. package/lib/inputs2/radiofield/index.d.ts +1 -1
  47. package/lib/inputs2/radiofield/index.js +25 -126
  48. package/lib/inputs2/radiofield/types.d.ts +6 -4
  49. package/lib/inputs2/selectfield/base.d.ts +11 -0
  50. package/lib/inputs2/selectfield/base.js +513 -0
  51. package/lib/inputs2/selectfield/index.d.ts +1 -1
  52. package/lib/inputs2/selectfield/index.js +35 -502
  53. package/lib/inputs2/selectfield/item.d.ts +1 -1
  54. package/lib/inputs2/selectfield/listbox.d.ts +1 -1
  55. package/lib/inputs2/selectfield/options.d.ts +1 -1
  56. package/lib/inputs2/selectfield/search.d.ts +1 -1
  57. package/lib/inputs2/selectfield/selections.d.ts +1 -1
  58. package/lib/inputs2/selectfield/types.d.ts +8 -6
  59. package/lib/inputs2/slot/index.d.ts +2 -2
  60. package/lib/inputs2/textareafield/base.d.ts +26 -0
  61. package/lib/inputs2/textareafield/base.js +166 -0
  62. package/lib/inputs2/textareafield/index.d.ts +4 -3
  63. package/lib/inputs2/textareafield/index.js +30 -154
  64. package/lib/inputs2/textfield/base.d.ts +26 -0
  65. package/lib/inputs2/textfield/base.js +131 -0
  66. package/lib/inputs2/textfield/index.d.ts +5 -4
  67. package/lib/inputs2/textfield/index.js +30 -120
  68. package/lib/radio/index.js +3 -4
  69. package/lib/tooltip/useTooltip.d.ts +1 -1
  70. package/package.json +1 -1
  71. package/lib/index-19761a50.d.ts +0 -26
  72. package/lib/index-4bda404f.d.ts +0 -42
  73. package/lib/index-afb7b5a9.d.ts +0 -15
@@ -0,0 +1,513 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.InputBase = void 0;
7
+ require("../../assets/styles/selectfield.scss");
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _lodash = _interopRequireDefault(require("lodash"));
10
+ var _uuid = require("uuid");
11
+ var _reactDom = require("react-dom");
12
+ var _hint = _interopRequireDefault(require("../../hint"));
13
+ var _popover = _interopRequireWildcard(require("../../popover"));
14
+ var _tooltip = require("../../tooltip");
15
+ var _helpers = require("../../form2/helpers");
16
+ var _slot = require("../slot");
17
+ var _listbox = require("./listbox");
18
+ var _triggers = require("./triggers");
19
+ var _selections = require("./selections");
20
+ var _context = require("./context");
21
+ var _options = require("./options");
22
+ var _item = require("./item");
23
+ var _types = require("./types");
24
+ var _helpers2 = require("./helpers");
25
+ const _excluded = ["name", "label", "errors", "children", "onChange", "tooltip", "tooltipPosition", "tooltipWidth", "hintPosition", "themePopover", "popoverAlign", "skeletonize", "striped", "undigitable", "externalSearch", "openDropdownOnFocus", "showClearButton", "textAlign", "searchOnDropdown", "onSearch", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "notFoundFilterLabel", "multipleInputLabelEmpty", "multipleInputLabelManySelection", "searchInputPlaceholder", "dropdownAlignButton", "disabled", "readOnly"];
26
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
28
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
29
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
30
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
31
+ const SELECT_FIELD_CONTROLS_ID = "select-field-controls-".concat((0, _uuid.v1)());
32
+ const InputBase = exports.InputBase = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
33
+ var _props$hint, _props$hint2;
34
+ const {
35
+ name,
36
+ label,
37
+ errors,
38
+ children,
39
+ onChange,
40
+ tooltip,
41
+ tooltipPosition,
42
+ tooltipWidth,
43
+ hintPosition = 'below',
44
+ themePopover = 'light',
45
+ popoverAlign = 'left',
46
+ skeletonize = false,
47
+ striped = false,
48
+ undigitable = false,
49
+ externalSearch = false,
50
+ openDropdownOnFocus = true,
51
+ showClearButton = true,
52
+ textAlign = 'left',
53
+ searchOnDropdown = false,
54
+ onSearch = undefined,
55
+ customClass = '',
56
+ customClassLabel = '',
57
+ customClassWrapper = '',
58
+ customClassInputContainer = '',
59
+ notFoundFilterLabel = 'Nenhuma opção encontrada.',
60
+ multipleInputLabelEmpty = 'Nenhum registro selecionado',
61
+ multipleInputLabelManySelection = 'Múltiplos registros selecionados',
62
+ searchInputPlaceholder = 'Pesquisar registros',
63
+ dropdownAlignButton = 'left',
64
+ disabled,
65
+ readOnly
66
+ } = props,
67
+ rest = _objectWithoutProperties(props, _excluded);
68
+ const [inputValue, setInputValue] = _react.default.useState('');
69
+ const [filterValue, setFilterValue] = _react.default.useState('');
70
+ const [listBoxOpen, setListBoxOpen] = _react.default.useState(false);
71
+ const [activeDescendant, setActiveDescendant] = _react.default.useState(undefined);
72
+ const isMultipleDefault = _lodash.default.isEqual(props === null || props === void 0 ? void 0 : props.multiple, _types.MultipleVariantEnum.default);
73
+ const isMultipleWithCheckboxes = _lodash.default.isEqual(props === null || props === void 0 ? void 0 : props.multiple, _types.MultipleVariantEnum.checkboxes);
74
+ const isMultipleSelect = isMultipleDefault || isMultipleWithCheckboxes;
75
+ const liSelectedRef = _react.default.useRef(null);
76
+ const selectFieldRoot = _react.default.useRef(null);
77
+ const selectInputRef = _react.default.useRef(null);
78
+ const selectListBoxRef = _react.default.useRef(null);
79
+ const selectContainerRef = _react.default.useRef(null);
80
+ const selectSearchInputRef = _react.default.useRef(null);
81
+ const listOptionsMap = _react.default.useMemo(() => {
82
+ const optionsMap = new Map();
83
+ _react.default.Children.forEach(children, child => {
84
+ if (/*#__PURE__*/_react.default.isValidElement(child)) {
85
+ optionsMap.set(child.props.value, child.props.label);
86
+ }
87
+ });
88
+ return optionsMap;
89
+ }, [children]);
90
+ _react.default.useEffect(() => {
91
+ if (isMultipleWithCheckboxes) {
92
+ setInputValue(multipleInputLabelEmpty);
93
+ }
94
+ }, []);
95
+ _react.default.useEffect(() => {
96
+ if (openDropdownOnFocus && listBoxOpen) {
97
+ requestAnimationFrame(() => {
98
+ if (isMultipleWithCheckboxes) {
99
+ var _selectSearchInputRef, _selectSearchInputRef2;
100
+ (_selectSearchInputRef = selectSearchInputRef.current) === null || _selectSearchInputRef === void 0 ? void 0 : (_selectSearchInputRef2 = _selectSearchInputRef.focus) === null || _selectSearchInputRef2 === void 0 ? void 0 : _selectSearchInputRef2.call(_selectSearchInputRef);
101
+ }
102
+ });
103
+ }
104
+ }, [listBoxOpen]);
105
+ _react.default.useEffect(() => {
106
+ if (!isMultipleWithCheckboxes && !(props !== null && props !== void 0 && props.value)) setInputValue('');
107
+ if (!(props !== null && props !== void 0 && props.value) || document.activeElement === selectInputRef.current) return;
108
+ const lazyInputValue = listOptionsMap.get(rest.value);
109
+ if (!isMultipleWithCheckboxes) setInputValue(lazyInputValue !== null && lazyInputValue !== void 0 ? lazyInputValue : '');
110
+ if (isMultipleWithCheckboxes) {
111
+ const firstSelectionLabel = listOptionsMap.get(props === null || props === void 0 ? void 0 : props.value[0]);
112
+ switch (_lodash.default.size(props === null || props === void 0 ? void 0 : props.value)) {
113
+ case 0:
114
+ return setInputValue(multipleInputLabelEmpty);
115
+ case 1:
116
+ return setInputValue(firstSelectionLabel !== null && firstSelectionLabel !== void 0 ? firstSelectionLabel : '');
117
+ default:
118
+ return setInputValue(multipleInputLabelManySelection);
119
+ }
120
+ }
121
+ }, [props === null || props === void 0 ? void 0 : props.value, listOptionsMap]);
122
+ const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
123
+ const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
124
+ const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
125
+ const {
126
+ childrenItems
127
+ } = _react.default.useMemo(() => {
128
+ const itens = [];
129
+ _react.default.Children.map(children, (childElement, index) => {
130
+ if (/*#__PURE__*/_react.default.isValidElement(childElement)) {
131
+ var _childElement$key;
132
+ const clonedChild = /*#__PURE__*/_react.default.cloneElement(childElement, {
133
+ key: (_childElement$key = childElement.key) !== null && _childElement$key !== void 0 ? _childElement$key : "child-item-".concat(index + 1)
134
+ });
135
+ if (childElement.type === _item.Item) itens.push(clonedChild);
136
+ }
137
+ });
138
+ return {
139
+ childrenItems: itens
140
+ };
141
+ }, [children, disabled]);
142
+ const {
143
+ leftSlotElements,
144
+ rightSlotElements
145
+ } = _react.default.useMemo(() => {
146
+ const left = [];
147
+ const right = [];
148
+ _react.default.Children.map(children, (childElement, index) => {
149
+ if (/*#__PURE__*/_react.default.isValidElement(childElement)) {
150
+ var _childElement$key2;
151
+ const clonedChild = /*#__PURE__*/_react.default.cloneElement(childElement, {
152
+ key: (_childElement$key2 = childElement.key) !== null && _childElement$key2 !== void 0 ? _childElement$key2 : "slot-".concat(index),
153
+ disabled: disabled,
154
+ 'aria-disabled': disabled
155
+ });
156
+ if (childElement.type === _slot.LeftSlot) left.push(clonedChild);
157
+ if (childElement.type === _slot.RightSlot) right.push(clonedChild);
158
+ }
159
+ });
160
+ return {
161
+ leftSlotElements: left,
162
+ rightSlotElements: right
163
+ };
164
+ }, [children, disabled]);
165
+ const {
166
+ optionItens
167
+ } = _react.default.useMemo(() => {
168
+ const itens = [];
169
+ _react.default.Children.map(children, (childElement, index) => {
170
+ if (/*#__PURE__*/_react.default.isValidElement(childElement)) {
171
+ var _childElement$key3;
172
+ const clonedChildItem = /*#__PURE__*/_react.default.cloneElement(childElement, {
173
+ key: (_childElement$key3 = childElement.key) !== null && _childElement$key3 !== void 0 ? _childElement$key3 : "option-list-".concat(index),
174
+ disabled: disabled
175
+ });
176
+ if (childElement.type === _options.Options) itens.push(clonedChildItem);
177
+ }
178
+ });
179
+ return {
180
+ optionItens: itens
181
+ };
182
+ }, [children, disabled]);
183
+ const hasLeftSlotElements = Boolean(leftSlotElements === null || leftSlotElements === void 0 ? void 0 : leftSlotElements.length);
184
+ const hasRightSlotElements = Boolean(rightSlotElements === null || rightSlotElements === void 0 ? void 0 : rightSlotElements.length);
185
+ const handleCloseListBox = () => {
186
+ setListBoxOpen(false);
187
+ setFilterValue('');
188
+ };
189
+ const handleOpenListBox = () => {
190
+ var _$toString;
191
+ const currentValue = !isMultipleSelect ? props === null || props === void 0 ? void 0 : props.value : _lodash.default.orderBy([...props.value], value => _lodash.default.toNumber(value), ['asc'])[0];
192
+ setActiveDescendant((_$toString = _lodash.default.toString(currentValue)) !== null && _$toString !== void 0 ? _$toString : undefined);
193
+ };
194
+ const handleChangeListBoxState = () => {
195
+ setListBoxOpen(prevState => {
196
+ if (prevState) {
197
+ setFilterValue('');
198
+ }
199
+ if (selectInputRef.current !== document.activeElement) {
200
+ var _selectInputRef$curre, _selectInputRef$curre2;
201
+ selectInputRef === null || selectInputRef === void 0 ? void 0 : (_selectInputRef$curre = selectInputRef.current) === null || _selectInputRef$curre === void 0 ? void 0 : (_selectInputRef$curre2 = _selectInputRef$curre.focus) === null || _selectInputRef$curre2 === void 0 ? void 0 : _selectInputRef$curre2.call(_selectInputRef$curre);
202
+ }
203
+ return !prevState;
204
+ });
205
+ };
206
+ const handleChangeLiSelected = liElement => {
207
+ liSelectedRef.current = liElement;
208
+ };
209
+ const handleOnChange = (value, inputLabel, addOrRemove) => {
210
+ let multipleValue = props === null || props === void 0 ? void 0 : props.value;
211
+ if (!addOrRemove) multipleValue = _lodash.default.union(props.value, [value]);
212
+ if (addOrRemove) multipleValue = _lodash.default.without(props.value, value);
213
+ const changedValue = !isMultipleSelect ? value : _lodash.default.orderBy(multipleValue, multiValue => _lodash.default.toNumber(multiValue), ['asc']);
214
+ const syntheticEvent = {
215
+ target: {
216
+ name,
217
+ value: changedValue
218
+ }
219
+ };
220
+ onChange === null || onChange === void 0 ? void 0 : onChange(syntheticEvent);
221
+ if (!isMultipleSelect) {
222
+ setListBoxOpen(false);
223
+ setFilterValue('');
224
+ setInputValue(inputLabel !== null && inputLabel !== void 0 ? inputLabel : '');
225
+ if (document.activeElement === selectSearchInputRef.current) {
226
+ var _selectInputRef$curre3, _selectInputRef$curre4;
227
+ selectInputRef === null || selectInputRef === void 0 ? void 0 : (_selectInputRef$curre3 = selectInputRef.current) === null || _selectInputRef$curre3 === void 0 ? void 0 : (_selectInputRef$curre4 = _selectInputRef$curre3.focus) === null || _selectInputRef$curre4 === void 0 ? void 0 : _selectInputRef$curre4.call(_selectInputRef$curre3);
228
+ setListBoxOpen(false);
229
+ }
230
+ }
231
+ };
232
+ const handleCheckMultiple = checkOrUncheckAll => {
233
+ const checkAll = Boolean(checkOrUncheckAll);
234
+ let allValues = [];
235
+ listOptionsMap.forEach((__, key) => allValues.push(key));
236
+ const value = checkAll ? allValues : [];
237
+ const syntheticEvent = {
238
+ target: {
239
+ name,
240
+ value
241
+ }
242
+ };
243
+ onChange === null || onChange === void 0 ? void 0 : onChange(syntheticEvent);
244
+ };
245
+ const handleClearValue = () => {
246
+ const resetValue = !isMultipleSelect ? '' : [];
247
+ const syntheticEvent = {
248
+ target: {
249
+ name,
250
+ value: resetValue
251
+ }
252
+ };
253
+ onChange === null || onChange === void 0 ? void 0 : onChange(syntheticEvent);
254
+ setListBoxOpen(false);
255
+ if (!isMultipleSelect) {
256
+ setFilterValue('');
257
+ setInputValue('');
258
+ }
259
+ if (isMultipleWithCheckboxes) {
260
+ setInputValue(multipleInputLabelEmpty);
261
+ }
262
+ };
263
+ const handleOnBlur = event => {
264
+ var _props$onBlur;
265
+ props === null || props === void 0 ? void 0 : (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, event);
266
+ if (!event.relatedTarget || event.relatedTarget !== selectSearchInputRef.current) {
267
+ setListBoxOpen(false);
268
+ }
269
+ setFilterValue('');
270
+ };
271
+ const handleOnFocus = event => {
272
+ var _props$onFocus;
273
+ props === null || props === void 0 ? void 0 : (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
274
+ if (openDropdownOnFocus) {
275
+ setListBoxOpen(true);
276
+ handleOpenListBox();
277
+ }
278
+ };
279
+ const handleOnChangeInput = event => {
280
+ setFilterValue(event.target.value);
281
+ setInputValue(event.target.value);
282
+ };
283
+ const handleOnPaste = event => {
284
+ if (undigitable || isMultipleWithCheckboxes) {
285
+ event.preventDefault();
286
+ } else {
287
+ var _props$onPaste;
288
+ (_props$onPaste = props.onPaste) === null || _props$onPaste === void 0 ? void 0 : _props$onPaste.call(props, event);
289
+ }
290
+ };
291
+ const handleOnBeforeInput = event => {
292
+ if (undigitable || isMultipleWithCheckboxes) {
293
+ event.preventDefault();
294
+ } else {
295
+ var _props$onBeforeInput;
296
+ (_props$onBeforeInput = props.onBeforeInput) === null || _props$onBeforeInput === void 0 ? void 0 : _props$onBeforeInput.call(props, event);
297
+ }
298
+ };
299
+ const handleOnSearch = event => {
300
+ if (externalSearch) {
301
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(event);
302
+ } else {
303
+ setFilterValue(event.target.value);
304
+ }
305
+ };
306
+ const handleOnKeyDown = event => {
307
+ var _props$onKeyDown;
308
+ props === null || props === void 0 ? void 0 : (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
309
+ const notUndigitableKeys = [_types.Keys.backspace, _types.Keys.delete];
310
+ if (undigitable && notUndigitableKeys.includes(event.key)) {
311
+ event.preventDefault();
312
+ return;
313
+ }
314
+ const shouldOpenByTyping = (0, _helpers2.isTypingKey)(event) || event.key === _types.Keys.arrowDown;
315
+ if (shouldOpenByTyping && selectInputRef.current === document.activeElement) {
316
+ if (event.key === _types.Keys.arrowDown) {
317
+ event.preventDefault();
318
+ }
319
+ requestAnimationFrame(() => {
320
+ var _selectListBoxRef$cur, _ulListElement$queryS;
321
+ const ulListElement = (_selectListBoxRef$cur = selectListBoxRef.current) === null || _selectListBoxRef$cur === void 0 ? void 0 : _selectListBoxRef$cur.querySelector('ul[role="listbox"]');
322
+ const liElementsFiltered = (_ulListElement$queryS = ulListElement === null || ulListElement === void 0 ? void 0 : ulListElement.querySelectorAll('li[data-state-filtered="true"]')) !== null && _ulListElement$queryS !== void 0 ? _ulListElement$queryS : [];
323
+ if (!listBoxOpen && event.key === _types.Keys.arrowDown) {
324
+ var _$toString2;
325
+ const currentValue = !isMultipleSelect ? props === null || props === void 0 ? void 0 : props.value : _lodash.default.orderBy([...props.value], value => _lodash.default.toNumber(value), ['asc'])[0];
326
+ setActiveDescendant((_$toString2 = _lodash.default.toString(currentValue)) !== null && _$toString2 !== void 0 ? _$toString2 : undefined);
327
+ } else {
328
+ var _liElementsFiltered$, _liElementsFiltered$2;
329
+ setActiveDescendant((_liElementsFiltered$ = (_liElementsFiltered$2 = liElementsFiltered[0]) === null || _liElementsFiltered$2 === void 0 ? void 0 : _liElementsFiltered$2.id) !== null && _liElementsFiltered$ !== void 0 ? _liElementsFiltered$ : undefined);
330
+ }
331
+ });
332
+ if (!listBoxOpen) {
333
+ setListBoxOpen(true);
334
+ handleOpenListBox();
335
+ }
336
+ }
337
+ if (listBoxOpen && _helpers2.NAVIGATION_KEYS.includes(event.key)) {
338
+ event.preventDefault();
339
+ }
340
+ requestAnimationFrame(() => {
341
+ var _selectListBoxRef$cur2, _ulListElement$queryS2, _selectInputRef$curre5;
342
+ const ulListElement = (_selectListBoxRef$cur2 = selectListBoxRef.current) === null || _selectListBoxRef$cur2 === void 0 ? void 0 : _selectListBoxRef$cur2.querySelector('ul[role="listbox"]');
343
+ const liElementsFiltered = (_ulListElement$queryS2 = ulListElement === null || ulListElement === void 0 ? void 0 : ulListElement.querySelectorAll('li[data-state-filtered="true"]')) !== null && _ulListElement$queryS2 !== void 0 ? _ulListElement$queryS2 : [];
344
+ const currentElementIndex = Array.from(liElementsFiltered).findIndex(liElement => liElement.id === activeDescendant);
345
+ let nextElementIndex = currentElementIndex;
346
+ if (listBoxOpen) {
347
+ if (_helpers2.NAVIGATION_KEYS.includes(event.key)) {
348
+ switch (event.key) {
349
+ case _types.Keys.escape:
350
+ setListBoxOpen(false);
351
+ setFilterValue('');
352
+ (_selectInputRef$curre5 = selectInputRef.current) === null || _selectInputRef$curre5 === void 0 ? void 0 : _selectInputRef$curre5.focus();
353
+ if (event.target === selectSearchInputRef.current) {
354
+ setListBoxOpen(false);
355
+ }
356
+ break;
357
+ case _types.Keys.arrowDown:
358
+ nextElementIndex = Math.min(currentElementIndex + 1, liElementsFiltered.length - 1);
359
+ break;
360
+ case _types.Keys.arrowUp:
361
+ nextElementIndex = Math.max(currentElementIndex - 1, 0);
362
+ break;
363
+ case _types.Keys.enter:
364
+ if (activeDescendant) {
365
+ const selectedLIOption = liElementsFiltered[nextElementIndex];
366
+ if (selectedLIOption) {
367
+ selectedLIOption.click();
368
+ }
369
+ }
370
+ break;
371
+ default:
372
+ break;
373
+ }
374
+ const nextLIOption = liElementsFiltered[nextElementIndex];
375
+ if (nextLIOption) {
376
+ var _nextLIOption$id;
377
+ setActiveDescendant((_nextLIOption$id = nextLIOption === null || nextLIOption === void 0 ? void 0 : nextLIOption.id) !== null && _nextLIOption$id !== void 0 ? _nextLIOption$id : '');
378
+ nextLIOption.scrollIntoView({
379
+ block: 'nearest'
380
+ });
381
+ }
382
+ }
383
+ } else return null;
384
+ });
385
+ };
386
+ const contextValues = _react.default.useMemo(() => ({
387
+ selectFieldId: SELECT_FIELD_CONTROLS_ID,
388
+ label: props.label,
389
+ striped,
390
+ listBoxOpen,
391
+ filterValue,
392
+ disabled,
393
+ liSelectedRef,
394
+ selectInputRef,
395
+ selectSearchInputRef,
396
+ handleOnSearch,
397
+ searchOnDropdown,
398
+ nameSelect: String(props.name),
399
+ valueSelect: props === null || props === void 0 ? void 0 : props.value,
400
+ activeDescendant,
401
+ handleOnChange,
402
+ handleOnKeyDown,
403
+ selectContainerRef,
404
+ handleCloseListBox,
405
+ notFoundFilterLabel,
406
+ handleChangeLiSelected,
407
+ isMultipleSelect,
408
+ isMultipleDefault,
409
+ isMultipleWithCheckboxes,
410
+ searchInputPlaceholder,
411
+ showClearButton,
412
+ dropdownAlignButton,
413
+ handleClearValue,
414
+ handleCheckMultiple,
415
+ handleChangeListBoxState,
416
+ optionItens
417
+ }), [striped, listBoxOpen, disabled, filterValue, props === null || props === void 0 ? void 0 : props.name, props === null || props === void 0 ? void 0 : props.value, activeDescendant, notFoundFilterLabel, searchOnDropdown, isMultipleSelect, showClearButton, isMultipleDefault, isMultipleWithCheckboxes, searchInputPlaceholder, dropdownAlignButton, optionItens]);
418
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_context.SelectFieldContext.Provider, {
419
+ value: contextValues
420
+ }, /*#__PURE__*/_react.default.createElement("div", {
421
+ ref: selectFieldRoot,
422
+ "data-testid": "test-select-field-root",
423
+ className: "select-field-root ".concat(customClassWrapper),
424
+ "data-state-error": hasValidationErrors,
425
+ "data-state-hint-position": hintPosition
426
+ }, hasLabel && /*#__PURE__*/_react.default.createElement("span", {
427
+ className: "root-label ".concat(customClassLabel),
428
+ "data-state-skeletonize": skeletonize
429
+ }, /*#__PURE__*/_react.default.createElement("label", {
430
+ "data-testid": "test-select-field-label",
431
+ className: "label",
432
+ title: label,
433
+ htmlFor: name,
434
+ "aria-disabled": disabled,
435
+ "aria-readonly": readOnly,
436
+ "data-state-input-required": props.required
437
+ }, label), hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
438
+ customClass: "label-popover",
439
+ theme: themePopover,
440
+ align: popoverAlign,
441
+ iconColor: "#03bde2"
442
+ }, /*#__PURE__*/_react.default.createElement(_popover.PopoverText, {
443
+ text: (_props$hint2 = props === null || props === void 0 ? void 0 : props.hint) !== null && _props$hint2 !== void 0 ? _props$hint2 : ''
444
+ }))), /*#__PURE__*/_react.default.createElement("div", {
445
+ ref: selectContainerRef,
446
+ className: "container ".concat(customClassInputContainer),
447
+ "aria-expanded": listBoxOpen,
448
+ "data-state-skeletonize": skeletonize
449
+ }, hasLeftSlotElements && !skeletonize && leftSlotElements, /*#__PURE__*/_react.default.createElement("div", {
450
+ className: "input-root"
451
+ }, /*#__PURE__*/_react.default.createElement("input", _extends({}, rest, {
452
+ ref: (0, _helpers.mergeRefs)(ref, selectInputRef),
453
+ readOnly: props.readOnly || undigitable,
454
+ className: "input ".concat(customClass),
455
+ placeholder: rest.placeholder,
456
+ "data-state-error": hasValidationErrors,
457
+ "data-state-multiple": isMultipleSelect,
458
+ "data-state-read-only": readOnly,
459
+ "data-state-text-align": textAlign,
460
+ "data-state-undigitable": undigitable,
461
+ "data-state-skeletonize": skeletonize,
462
+ "data-state-multiple-with-checkboxes": isMultipleWithCheckboxes,
463
+ id: name,
464
+ type: "text",
465
+ role: "combobox",
466
+ multiple: false,
467
+ disabled: disabled,
468
+ "data-testid": "test-select-field-input",
469
+ "aria-autocomplete": "list",
470
+ "aria-expanded": listBoxOpen,
471
+ "aria-controls": SELECT_FIELD_CONTROLS_ID,
472
+ "aria-activedescendant": activeDescendant,
473
+ tabIndex: !readOnly && !skeletonize ? 0 : -1,
474
+ value: inputValue,
475
+ onBlur: handleOnBlur,
476
+ onFocus: handleOnFocus,
477
+ onKeyDown: handleOnKeyDown,
478
+ onChange: handleOnChangeInput,
479
+ onPaste: handleOnPaste,
480
+ onBeforeInput: handleOnBeforeInput
481
+ })), isMultipleDefault && /*#__PURE__*/_react.default.createElement(_selections.Selections, {
482
+ isDisabled: Boolean(disabled),
483
+ isReadOnly: Boolean(readOnly),
484
+ listOfOptionsToSelect: listOptionsMap
485
+ })), hasRightSlotElements && !skeletonize && rightSlotElements, /*#__PURE__*/_react.default.createElement("div", {
486
+ className: "triggers",
487
+ "data-state-disabled": disabled,
488
+ "data-state-read-only": readOnly,
489
+ "data-state-skeletonize": skeletonize
490
+ }, /*#__PURE__*/_react.default.createElement(_triggers.Triggers, null)), listBoxOpen && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement(_listbox.ListBox, {
491
+ ref: selectListBoxRef
492
+ }, childrenItems), document.body)), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
493
+ customClass: "hint",
494
+ skeletonize: skeletonize,
495
+ description: props.hint,
496
+ disabled: disabled,
497
+ visible: hasHintMessages
498
+ }), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
499
+ "data-testid": "test-select-field-list-errors",
500
+ className: "error",
501
+ "data-state-skeletonize": skeletonize,
502
+ "aria-describedby": String(name).concat('-errors')
503
+ }, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
504
+ key: "".concat(index + 1, "-").concat(error)
505
+ }, error, "\xA0"))))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
506
+ targetRef: selectInputRef,
507
+ text: tooltip,
508
+ position: tooltipPosition,
509
+ width: tooltipWidth,
510
+ space: tooltipPosition === 'right' ? 64 : undefined
511
+ }));
512
+ });
513
+ InputBase.displayName = 'SelectFieldInputBase';
@@ -3,7 +3,7 @@ export { LeftSlot, RightSlot } from '../slot/index.js';
3
3
  export { Options } from './options.js';
4
4
  export { Item } from './item.js';
5
5
  export { SelectFieldInputProps } from './types.js';
6
- export { I as Input } from '../../index-19761a50.js';
6
+ export { I as Input } from '../../index-053f615b.js';
7
7
  import '../../@types/Align.js';
8
8
  import '../../@types/ColorStyles.js';
9
9
  import '../../tooltip/types.js';