linear-react-components-ui 2.2.0-beta.10 → 2.2.0-beta.11
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/lib/assets/styles/datepicker2.css +11 -81
- package/lib/inputs/select/Dropdown.js +1 -11
- package/lib/inputs/select/Dropdown.js.map +1 -1
- package/lib/inputs/select/multiple/index.js +2 -5
- package/lib/inputs/select/multiple/index.js.map +1 -1
- package/lib/inputs/select/simple/index.js +2 -5
- package/lib/inputs/select/simple/index.js.map +1 -1
- package/lib/inputs/select/types.d.ts +2 -3
- package/lib/inputs/types.d.ts +1 -2
- package/lib/inputs2/date/{hooks/useCalendarPosition.d.ts → base/constants.d.ts} +1 -1
- package/lib/inputs2/date/base/constants.js +69 -0
- package/lib/inputs2/date/base/constants.js.map +1 -0
- package/lib/inputs2/date/datefield/base.js +214 -691
- package/lib/inputs2/date/datefield/base.js.map +1 -1
- package/lib/inputs2/date/datefield/calendarbox.d.ts +6 -0
- package/lib/inputs2/date/datefield/calendarbox.js +228 -0
- package/lib/inputs2/date/datefield/calendarbox.js.map +1 -0
- package/lib/inputs2/date/datefield/triggers.js +4 -4
- package/lib/inputs2/date/datefield/triggers.js.map +1 -1
- package/lib/inputs2/date/datefield/types.d.ts +12 -5
- package/lib/inputs2/date/dateperiodfield/base.js +809 -694
- package/lib/inputs2/date/dateperiodfield/base.js.map +1 -1
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +6 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +282 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/triggers.js +9 -21
- package/lib/inputs2/date/dateperiodfield/triggers.js.map +1 -1
- package/lib/inputs2/date/dateperiodfield/types.d.ts +23 -13
- package/lib/inputs2/date/helpers.d.ts +4 -44
- package/lib/inputs2/date/helpers.js +4 -200
- package/lib/inputs2/date/helpers.js.map +1 -1
- package/lib/inputs2/date/types.d.ts +1 -22
- package/lib/inputs2/date/types.js.map +1 -1
- package/lib/inputs2/selectfield/base.js +33 -16
- package/lib/inputs2/selectfield/base.js.map +1 -1
- package/lib/inputs2/selectfield/context.d.ts +1 -0
- package/lib/inputs2/selectfield/context.js.map +1 -1
- package/lib/inputs2/selectfield/item.js +52 -50
- package/lib/inputs2/selectfield/item.js.map +1 -1
- package/lib/inputs2/selectfield/listbox.d.ts +1 -2
- package/lib/inputs2/selectfield/listbox.js +0 -10
- package/lib/inputs2/selectfield/listbox.js.map +1 -1
- package/lib/inputs2/selectfield/types.d.ts +3 -5
- package/lib/inputs2/selectfield/types.js.map +1 -1
- package/lib/node_modules/lodash/lodash.js +2 -2
- package/lib/node_modules/lodash/lodash.js.map +1 -1
- package/lib/panel/Content.js +82 -28
- package/lib/panel/Content.js.map +1 -1
- package/lib/panel/Default.d.ts +1 -1
- package/lib/panel/Default.js +54 -60
- package/lib/panel/Default.js.map +1 -1
- package/lib/panel/helpers.js +16 -1
- package/lib/panel/helpers.js.map +1 -1
- package/lib/panel/types.d.ts +6 -3
- package/package.json +1 -1
- package/lib/hooks/useScrollEndReached/index.d.ts +0 -8
- package/lib/hooks/useScrollEndReached/index.js +0 -69
- package/lib/hooks/useScrollEndReached/index.js.map +0 -1
- package/lib/hooks/useScrollEndReached/types.d.ts +0 -7
- package/lib/inputs2/date/calendarbox.d.ts +0 -23
- package/lib/inputs2/date/calendarbox.js +0 -254
- package/lib/inputs2/date/calendarbox.js.map +0 -1
- package/lib/inputs2/date/hooks/useCalendarPosition.js +0 -93
- package/lib/inputs2/date/hooks/useCalendarPosition.js.map +0 -1
- package/lib/inputs2/date/hooks/useDateCalendarState.d.ts +0 -14
- package/lib/inputs2/date/hooks/useDateCalendarState.js +0 -250
- package/lib/inputs2/date/hooks/useDateCalendarState.js.map +0 -1
- package/lib/inputs2/date/hooks/useDateMask.d.ts +0 -22
- package/lib/inputs2/date/hooks/useDateMask.js +0 -143
- package/lib/inputs2/date/hooks/useDateMask.js.map +0 -1
- package/lib/inputs2/date/timeselector.d.ts +0 -17
- package/lib/inputs2/date/timeselector.js +0 -226
- package/lib/inputs2/date/timeselector.js.map +0 -1
- package/lib/node_modules/moment/dist/locale/pt-br.js +0 -54
- package/lib/node_modules/moment/dist/locale/pt-br.js.map +0 -1
|
@@ -17,6 +17,7 @@ import { Item } from "./item.js";
|
|
|
17
17
|
import { MultipleVariantEnum, Keys } from "./types.js";
|
|
18
18
|
import { scrollListBoxToElement, isTypingKey, NAVIGATION_KEYS } from "./helpers.js";
|
|
19
19
|
import PopoverText from "../../popover/PopoverText.js";
|
|
20
|
+
const REMOTE_SEARCH_DEBOUNCE_MS = 300;
|
|
20
21
|
const InputBase = forwardRef((props, ref) => {
|
|
21
22
|
const {
|
|
22
23
|
name,
|
|
@@ -33,12 +34,10 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
33
34
|
skeletonize = false,
|
|
34
35
|
striped = false,
|
|
35
36
|
undigitable = false,
|
|
36
|
-
externalSearch = false,
|
|
37
37
|
openDropdownOnFocus = true,
|
|
38
38
|
showClearButton = true,
|
|
39
39
|
textAlign = "left",
|
|
40
40
|
searchOnDropdown = false,
|
|
41
|
-
onSearch = void 0,
|
|
42
41
|
customClass = "",
|
|
43
42
|
customClassLabel = "",
|
|
44
43
|
customClassWrapper = "",
|
|
@@ -51,9 +50,7 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
51
50
|
dropdownMaxWidth = void 0,
|
|
52
51
|
disabled,
|
|
53
52
|
readOnly,
|
|
54
|
-
|
|
55
|
-
onEndReachedThreshold,
|
|
56
|
-
itemsCount,
|
|
53
|
+
onRemoteSearch = void 0,
|
|
57
54
|
...rest
|
|
58
55
|
} = props;
|
|
59
56
|
const SELECT_FIELD_CONTROLS_ID = useId();
|
|
@@ -70,6 +67,9 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
70
67
|
const selectListBoxRef = useRef(null);
|
|
71
68
|
const selectContainerRef = useRef(null);
|
|
72
69
|
const selectSearchInputRef = useRef(null);
|
|
70
|
+
const remoteSearchTimeoutRef = useRef(null);
|
|
71
|
+
const hasFocusRef = useRef(false);
|
|
72
|
+
const hasRemoteSearch = Boolean(onRemoteSearch);
|
|
73
73
|
const listOptionsMap = useMemo(() => {
|
|
74
74
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
75
75
|
Children.forEach(children, (child) => {
|
|
@@ -113,9 +113,15 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
113
113
|
}, [listBoxOpen]);
|
|
114
114
|
useEffect(() => {
|
|
115
115
|
if (props?.value && !isMultipleSelect) setActiveDescendant(props?.value);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const isSearchingRemotely = hasRemoteSearch && (filterValue !== "" || hasFocusRef.current);
|
|
117
|
+
if (!isMultipleWithCheckboxes && !isSearchingRemotely) {
|
|
118
|
+
if (!props?.value) {
|
|
119
|
+
setInputValue("");
|
|
120
|
+
} else {
|
|
121
|
+
const lazyInputValue = listOptionsMap.get(rest.value);
|
|
122
|
+
setInputValue(lazyInputValue ?? "");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
119
125
|
if (isMultipleWithCheckboxes) {
|
|
120
126
|
const firstSelectionLabel = listOptionsMap.get(props?.value[0]);
|
|
121
127
|
switch (_.size(props?.value)) {
|
|
@@ -128,6 +134,9 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
128
134
|
}
|
|
129
135
|
}
|
|
130
136
|
}, [props?.value, listOptionsMap]);
|
|
137
|
+
useEffect(() => () => {
|
|
138
|
+
if (remoteSearchTimeoutRef.current) clearTimeout(remoteSearchTimeoutRef.current);
|
|
139
|
+
}, []);
|
|
131
140
|
const hasLabel = !_.isEmpty(props?.label);
|
|
132
141
|
const hasHintMessages = Boolean(props.hint?.length);
|
|
133
142
|
const hasValidationErrors = Boolean(errors?.length);
|
|
@@ -265,6 +274,7 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
265
274
|
}
|
|
266
275
|
};
|
|
267
276
|
const handleOnBlur = (event) => {
|
|
277
|
+
hasFocusRef.current = false;
|
|
268
278
|
props?.onBlur?.(event);
|
|
269
279
|
if (!event.relatedTarget || event.relatedTarget !== selectSearchInputRef.current) {
|
|
270
280
|
setListBoxOpen(false);
|
|
@@ -272,15 +282,24 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
272
282
|
setFilterValue("");
|
|
273
283
|
};
|
|
274
284
|
const handleOnFocus = (event_0) => {
|
|
285
|
+
hasFocusRef.current = true;
|
|
275
286
|
props?.onFocus?.(event_0);
|
|
276
287
|
if (openDropdownOnFocus) {
|
|
277
288
|
setListBoxOpen(true);
|
|
278
289
|
handleOpenListBox();
|
|
279
290
|
}
|
|
280
291
|
};
|
|
292
|
+
const handleRemoteSearch = (value_3) => {
|
|
293
|
+
if (!onRemoteSearch) return;
|
|
294
|
+
if (remoteSearchTimeoutRef.current) clearTimeout(remoteSearchTimeoutRef.current);
|
|
295
|
+
remoteSearchTimeoutRef.current = setTimeout(() => {
|
|
296
|
+
onRemoteSearch(value_3);
|
|
297
|
+
}, REMOTE_SEARCH_DEBOUNCE_MS);
|
|
298
|
+
};
|
|
281
299
|
const handleOnChangeInput = (event_1) => {
|
|
282
300
|
setFilterValue(event_1.target.value);
|
|
283
301
|
setInputValue(event_1.target.value);
|
|
302
|
+
handleRemoteSearch(event_1.target.value);
|
|
284
303
|
};
|
|
285
304
|
const handleOnPaste = (event_2) => {
|
|
286
305
|
if (undigitable || isMultipleWithCheckboxes) {
|
|
@@ -308,11 +327,8 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
308
327
|
}
|
|
309
328
|
};
|
|
310
329
|
const handleOnSearch = (event_5) => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
} else {
|
|
314
|
-
setFilterValue(event_5.target.value);
|
|
315
|
-
}
|
|
330
|
+
setFilterValue(event_5.target.value);
|
|
331
|
+
handleRemoteSearch(event_5.target.value);
|
|
316
332
|
};
|
|
317
333
|
const handleOnKeyDown = (event_6) => {
|
|
318
334
|
props?.onKeyDown?.(event_6);
|
|
@@ -330,7 +346,7 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
330
346
|
const ulListElement = selectListBoxRef.current?.querySelector('ul[role="listbox"]');
|
|
331
347
|
const liElementsFiltered = ulListElement?.querySelectorAll('li[data-state-filtered="true"]') ?? [];
|
|
332
348
|
if (!listBoxOpen && event_6.key === Keys.arrowDown) {
|
|
333
|
-
const currentValue_1 = !isMultipleSelect ? props?.value : _.orderBy([...props.value], (
|
|
349
|
+
const currentValue_1 = !isMultipleSelect ? props?.value : _.orderBy([...props.value], (value_4) => _.toNumber(value_4), ["asc"])[0];
|
|
334
350
|
setActiveDescendant(_.toString(currentValue_1) ?? void 0);
|
|
335
351
|
} else {
|
|
336
352
|
setActiveDescendant(liElementsFiltered[0]?.id ?? void 0);
|
|
@@ -415,7 +431,8 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
415
431
|
handleClearValue,
|
|
416
432
|
handleCheckMultiple,
|
|
417
433
|
handleChangeListBoxState,
|
|
418
|
-
optionItens
|
|
434
|
+
optionItens,
|
|
435
|
+
hasRemoteSearch
|
|
419
436
|
};
|
|
420
437
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
421
438
|
/* @__PURE__ */ jsx(SelectFieldContext.Provider, { value: contextValues, children: /* @__PURE__ */ jsxs("div", { ref: selectFieldRoot, "data-testid": "test-select-field-root", className: `select-field-root ${customClassWrapper}`, "data-state-error": hasValidationErrors, "data-state-hint-position": hintPosition, children: [
|
|
@@ -431,7 +448,7 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
431
448
|
] }),
|
|
432
449
|
hasRightSlotElements && !skeletonize && rightSlotElements,
|
|
433
450
|
/* @__PURE__ */ jsx("div", { className: "triggers", "data-state-disabled": disabled, "data-state-read-only": readOnly, "data-state-skeletonize": skeletonize, children: /* @__PURE__ */ jsx(Triggers, {}) }),
|
|
434
|
-
listBoxOpen && createPortal(/* @__PURE__ */ jsx(ListBox, { ref: selectListBoxRef, dropdownMaxWidth,
|
|
451
|
+
listBoxOpen && createPortal(/* @__PURE__ */ jsx(ListBox, { ref: selectListBoxRef, dropdownMaxWidth, children: childrenItems }), document.body)
|
|
435
452
|
] }),
|
|
436
453
|
hintPosition === "below" && /* @__PURE__ */ jsx(Hint, { customClass: "hint", skeletonize, description: props.hint, disabled, visible: hasHintMessages }),
|
|
437
454
|
hasValidationErrors && /* @__PURE__ */ jsx("span", { "data-testid": "test-select-field-list-errors", className: "error", "data-state-skeletonize": skeletonize, "aria-describedby": String(name).concat("-errors"), children: errors?.map((error, index_2) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../src/lib/inputs2/selectfield/base.tsx"],"sourcesContent":["import '../../assets/styles/selectfield.scss';\n\nimport {\n Children, cloneElement, forwardRef, Fragment, isValidElement, useEffect,\n useId, useMemo, useRef, useState, type ChangeEvent, type ClipboardEvent,\n type FocusEvent, type InputEvent, type KeyboardEvent, type ReactNode,\n type MouseEvent, \n} from 'react';\nimport _ from 'lodash';\nimport { createPortal } from 'react-dom';\nimport Hint from '../../hint';\nimport Popover, { PopoverText } from '../../popover';\nimport { Tooltip } from '../../tooltip';\nimport { mergeRefs } from '../../form2/helpers';\nimport { LeftSlot, RightSlot, type SlotProps } from '../slot';\nimport { ListBox } from './listbox';\nimport { Triggers } from './triggers';\nimport { Selections } from './selections';\nimport { SelectFieldContext } from './context';\nimport { Options, type OptionsProps } from './options';\nimport { Item, type SelectFieldItemProps } from './item';\nimport { Keys, MultipleVariantEnum, SelectFieldInputBaseProps } from './types';\nimport { isTypingKey, NAVIGATION_KEYS, scrollListBoxToElement } from './helpers';\n\nexport const InputBase = forwardRef<HTMLInputElement, SelectFieldInputBaseProps>(\n (props, ref) => {\n const {\n name, label, errors, children, onChange, tooltip, tooltipPosition, tooltipWidth, hintPosition = 'below',\n themePopover = 'light', popoverAlign = 'left', skeletonize = false, striped = false, undigitable = false, externalSearch = false,\n openDropdownOnFocus = true, showClearButton = true, textAlign = 'left', searchOnDropdown = false, onSearch = undefined,\n customClass = '', customClassLabel = '', customClassWrapper = '', customClassInputContainer = '',\n notFoundFilterLabel = 'Nenhuma opção encontrada.', multipleInputLabelEmpty = 'Nenhum registro selecionado',\n multipleInputLabelManySelection = 'Múltiplos registros selecionados', searchInputPlaceholder = 'Pesquisar registros',\n dropdownAlignButton = 'left', dropdownMaxWidth = undefined, disabled, readOnly, onEndReached,\n onEndReachedThreshold, itemsCount, ...rest\n } = props;\n const SELECT_FIELD_CONTROLS_ID = useId();\n const [inputValue, setInputValue] = useState('');\n const [filterValue, setFilterValue] = useState('');\n const [listBoxOpen, setListBoxOpen] = useState(false);\n const [activeDescendant, setActiveDescendant] = useState<string | undefined>(undefined);\n const isMultipleDefault = _.isEqual(props?.multiple, MultipleVariantEnum.default);\n const isMultipleWithCheckboxes = _.isEqual(props?.multiple, MultipleVariantEnum.checkboxes);\n const isMultipleSelect = isMultipleDefault || isMultipleWithCheckboxes;\n const liSelectedRef = useRef<HTMLLIElement | null>(null);\n const selectFieldRoot = useRef<HTMLDivElement | null>(null);\n const selectInputRef = useRef<HTMLInputElement | null>(null);\n const selectListBoxRef = useRef<HTMLDivElement | null>(null);\n const selectContainerRef = useRef<HTMLDivElement | null>(null);\n const selectSearchInputRef = useRef<HTMLInputElement | null>(null);\n\n const listOptionsMap = useMemo(() => {\n const optionsMap = new Map<string, string>();\n Children.forEach(children, (child) => {\n if (isValidElement<SelectFieldItemProps>(child)) {\n optionsMap.set(child.props.value, child.props.label);\n }\n });\n return optionsMap;\n }, [children]);\n\n useEffect(() => {\n if (isMultipleWithCheckboxes) {\n setInputValue(multipleInputLabelEmpty);\n }\n }, []);\n\n useEffect(() => {\n if (openDropdownOnFocus && listBoxOpen) {\n if (isMultipleWithCheckboxes) {\n setTimeout(() => { selectSearchInputRef.current?.focus?.(); }, 10);\n }\n }\n\n if (listBoxOpen) {\n /**\n * Scroll automático para o item selecionado na abertura do listbox.\n *\n * Usa requestAnimationFrame para aguardar que o DOM esteja renderizado e que o container\n * tenha dimensões estáveis (clientHeight > 0), já que a animação CSS \"revealelement\"\n * inicia com height: 0%, o que invalida o cálculo de scroll se executado antes.\n *\n * O scroll é feito via scrollListBoxToElement (helpers.ts) que manipula diretamente\n * o scrollTop do <ul>, sem usar scrollIntoView(), evitando propagação indesejada\n * de scroll para containers ancestrais(ex: body).\n */\n let retries = 0;\n const maxRetries = 20;\n const scrollToViewSelectedElement = () => {\n const listBox = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n const currentValue = !isMultipleSelect ?\n props?.value\n : _.orderBy([...props.value], value => _.toNumber(value), ['asc'])[0];\n const currentLiElement = listBox?.querySelector(`li[id=\"${\n _.toString(currentValue)}\"]`) as HTMLLIElement | null;\n if (currentLiElement && listBox) {\n if (listBox.clientHeight > 0) {\n scrollListBoxToElement(listBox, currentLiElement, 'center');\n } else if (retries < maxRetries) {\n retries++;\n requestAnimationFrame(scrollToViewSelectedElement);\n }\n }\n };\n requestAnimationFrame(scrollToViewSelectedElement);\n }\n }, [listBoxOpen]);\n\n useEffect(() => {\n if (props?.value && !isMultipleSelect) setActiveDescendant(props?.value);\n if (!isMultipleWithCheckboxes && !props?.value) setInputValue('');\n const lazyInputValue = listOptionsMap.get(rest.value);\n if (!isMultipleWithCheckboxes) setInputValue(lazyInputValue ?? '');\n if (isMultipleWithCheckboxes) {\n const firstSelectionLabel = listOptionsMap.get(props?.value[0]);\n switch (_.size(props?.value)) {\n case 0:\n return setInputValue(multipleInputLabelEmpty);\n case 1:\n return setInputValue(firstSelectionLabel ?? '');\n default:\n return setInputValue(multipleInputLabelManySelection);\n }\n }\n }, [props?.value, listOptionsMap]);\n\n const hasLabel = !_.isEmpty(props?.label);\n const hasHintMessages = Boolean(props.hint?.length);\n const hasValidationErrors = Boolean(errors?.length);\n\n const { childrenItems } = useMemo(() => {\n const itens: ReactNode[] = [];\n\n Children.map(children, (childElement, index) => {\n if (isValidElement<SelectFieldItemProps>(childElement)) {\n const clonedChild = cloneElement(childElement, {\n key: childElement.key ?? `child-item-${index + 1}`,\n });\n if (childElement.type === Item) itens.push(clonedChild);\n }\n });\n\n return { childrenItems: itens };\n }, [children, disabled]);\n\n const { leftSlotElements, rightSlotElements } = useMemo(() => {\n const left: ReactNode[] = [];\n const right: ReactNode[] = [];\n\n Children.map(children, (childElement, index) => {\n if (isValidElement<SlotProps>(childElement)) {\n const clonedChild = cloneElement(childElement, {\n key: childElement.key ?? `slot-${index}`,\n disabled: disabled,\n 'aria-disabled': disabled,\n });\n if (childElement.type === LeftSlot) left.push(clonedChild);\n if (childElement.type === RightSlot) right.push(clonedChild);\n }\n });\n\n return { leftSlotElements: left, rightSlotElements: right };\n }, [children, disabled]);\n\n const { optionItens } = useMemo(() => {\n const itens: ReactNode[] = [];\n\n Children.map(children, (childElement, index) => {\n if (isValidElement<OptionsProps>(childElement)) {\n const clonedChildItem = cloneElement(childElement, {\n key: childElement.key ?? `option-list-${index}`,\n disabled: disabled,\n });\n if (childElement.type === Options) itens.push(clonedChildItem);\n }\n });\n\n return { optionItens: itens };\n }, [children, disabled]);\n\n const hasLeftSlotElements = Boolean(leftSlotElements?.length);\n const hasRightSlotElements = Boolean(rightSlotElements?.length);\n\n const handleCloseListBox = () => {\n setListBoxOpen(false);\n setFilterValue('');\n };\n\n const handleOpenListBox = () => {\n const currentValue = !isMultipleSelect ?\n props?.value\n : _.orderBy([...props.value], value => _.toNumber(value), ['asc'])[0];\n setActiveDescendant(_.toString(currentValue) ?? undefined);\n };\n\n const handleChangeListBoxState = () => {\n setListBoxOpen((prevState) => {\n if (prevState) {\n setFilterValue('');\n }\n if (selectInputRef.current !== document.activeElement) {\n selectInputRef?.current?.focus?.();\n }\n handleOpenListBox();\n return !prevState;\n });\n };\n\n const handleChangeLiSelected = (liElement: HTMLLIElement | null) => {\n liSelectedRef.current = liElement;\n };\n\n const handleOnChange = (value?: any, inputLabel?: string, addOrRemove?: boolean) => {\n let multipleValue = props?.value;\n if (!addOrRemove) multipleValue = _.union(props.value, [value]);\n if (addOrRemove) multipleValue = _.without(props.value, value);\n const changedValue = !isMultipleSelect ?\n value\n : _.orderBy(multipleValue, multiValue => _.toNumber(multiValue), ['asc']);\n const syntheticEvent = {\n target: {\n name,\n value: changedValue as any,\n },\n } as ChangeEvent<HTMLInputElement>;\n onChange?.(syntheticEvent);\n if (!isMultipleSelect) {\n setListBoxOpen(false);\n setFilterValue('');\n setInputValue(inputLabel ?? '');\n if (document.activeElement === selectSearchInputRef.current) {\n selectInputRef?.current?.focus?.();\n setListBoxOpen(false);\n }\n }\n };\n\n const handleCheckMultiple = (checkOrUncheckAll?: boolean) => {\n const checkAll = Boolean(checkOrUncheckAll);\n const allValues: any[] = [];\n listOptionsMap.forEach((__, key) => allValues.push(key));\n const value: any = checkAll ? allValues : [];\n const syntheticEvent = {\n target: {\n name,\n value,\n },\n } as ChangeEvent<HTMLInputElement>;\n onChange?.(syntheticEvent);\n };\n\n const handleClearValue = () => {\n const resetValue = !isMultipleSelect ? '' : [];\n const syntheticEvent = {\n target: {\n name,\n value: resetValue as any,\n },\n } as ChangeEvent<HTMLInputElement>;\n onChange?.(syntheticEvent);\n setListBoxOpen(false);\n if (!isMultipleSelect) {\n setFilterValue('');\n setInputValue('');\n }\n if (isMultipleWithCheckboxes) {\n setInputValue(multipleInputLabelEmpty);\n }\n };\n\n const handleOnBlur = (event: FocusEvent<HTMLInputElement>) => {\n props?.onBlur?.(event);\n if (!event.relatedTarget || event.relatedTarget !== selectSearchInputRef.current) {\n setListBoxOpen(false);\n }\n setFilterValue('');\n };\n\n const handleOnFocus = (event: FocusEvent<HTMLInputElement>) => {\n props?.onFocus?.(event);\n if (openDropdownOnFocus) {\n setListBoxOpen(true);\n handleOpenListBox();\n }\n };\n\n const handleOnChangeInput = (event: ChangeEvent<HTMLInputElement>) => {\n setFilterValue(event.target.value);\n setInputValue(event.target.value);\n };\n\n const handleOnPaste = (event: ClipboardEvent<HTMLInputElement>) => {\n if (undigitable || isMultipleWithCheckboxes) {\n event.preventDefault();\n } else {\n props.onPaste?.(event);\n }\n };\n\n const handleOnBeforeInput = (event: InputEvent<HTMLInputElement>) => {\n if (undigitable || isMultipleWithCheckboxes) {\n event.preventDefault();\n } else {\n props.onBeforeInput?.(event);\n }\n };\n\n const handleOnMouseDown = (event: MouseEvent<HTMLInputElement>) => {\n if (undigitable) {\n event.preventDefault();\n } else {\n props.onMouseDown?.(event);\n if (openDropdownOnFocus && !listBoxOpen) {\n setListBoxOpen(true);\n handleOpenListBox();\n }\n }\n };\n\n const handleOnSearch = (event: ChangeEvent<HTMLInputElement>) => {\n if (externalSearch) {\n onSearch?.(event);\n } else {\n setFilterValue(event.target.value);\n }\n };\n\n const handleOnKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n props?.onKeyDown?.(event);\n const notUndigitableKeys: string[] = [Keys.backspace, Keys.delete];\n if ((undigitable) && notUndigitableKeys.includes(event.key)) {\n event.preventDefault();\n return;\n }\n const shouldOpenByTyping = isTypingKey(event) || event.key === Keys.arrowDown;\n if (shouldOpenByTyping && selectInputRef.current === document.activeElement) {\n if (event.key === Keys.arrowDown) {\n event.preventDefault();\n }\n requestAnimationFrame(() => {\n const ulListElement = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n const liElementsFiltered = (ulListElement?.querySelectorAll(\n 'li[data-state-filtered=\"true\"]',\n ) ?? []) as HTMLLIElement[];\n if (!listBoxOpen && event.key === Keys.arrowDown) {\n const currentValue = !isMultipleSelect ?\n props?.value\n : _.orderBy([...props.value], value => _.toNumber(value), ['asc'])[0];\n setActiveDescendant(_.toString(currentValue) ?? undefined);\n } else {\n setActiveDescendant(liElementsFiltered[0]?.id ?? undefined);\n }\n });\n if (!listBoxOpen) {\n setListBoxOpen(true);\n handleOpenListBox();\n }\n }\n if (listBoxOpen && NAVIGATION_KEYS.includes(event.key)) {\n event.preventDefault();\n }\n requestAnimationFrame(() => {\n const ulListElement = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n const liElementsFiltered = (ulListElement?.querySelectorAll(\n 'li[data-state-filtered=\"true\"]',\n ) ?? []) as HTMLLIElement[];\n const currentElementIndex = Array.from(liElementsFiltered).findIndex(\n liElement => liElement.id === activeDescendant,\n );\n let nextElementIndex = currentElementIndex;\n if (listBoxOpen) {\n if (NAVIGATION_KEYS.includes(event.key)) {\n switch (event.key) {\n case Keys.escape:\n setListBoxOpen(false);\n setFilterValue('');\n selectInputRef.current?.focus();\n if (event.target === selectSearchInputRef.current) {\n setListBoxOpen(false);\n }\n break;\n case Keys.arrowDown:\n nextElementIndex = Math.min(currentElementIndex + 1, liElementsFiltered.length - 1);\n break;\n case Keys.arrowUp:\n nextElementIndex = Math.max(currentElementIndex - 1, 0);\n break;\n case Keys.enter:\n if (activeDescendant) {\n const selectedLIOption = liElementsFiltered[nextElementIndex];\n if (selectedLIOption) {\n selectedLIOption.click();\n }\n }\n break;\n default:\n break;\n }\n const nextLIOption = liElementsFiltered[nextElementIndex];\n if (nextLIOption) {\n setActiveDescendant(nextLIOption?.id ?? '');\n const ulListBox = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n scrollListBoxToElement(ulListBox, nextLIOption, 'nearest');\n }\n }\n } else return null;\n });\n };\n\n const contextValues = ({\n selectFieldId: SELECT_FIELD_CONTROLS_ID, label: props.label, striped, listBoxOpen,\n filterValue, disabled, liSelectedRef, selectInputRef, selectSearchInputRef, handleOnSearch,\n searchOnDropdown, nameSelect: String(props.name), valueSelect: props?.value,\n activeDescendant, handleOnChange, handleOnKeyDown, selectContainerRef, handleCloseListBox,\n notFoundFilterLabel, handleChangeLiSelected, isMultipleSelect, isMultipleDefault,\n isMultipleWithCheckboxes, searchInputPlaceholder, showClearButton, dropdownAlignButton,\n handleClearValue, handleCheckMultiple, handleChangeListBoxState, optionItens,\n });\n\n return (\n <Fragment>\n <SelectFieldContext.Provider value={contextValues}>\n <div\n ref={selectFieldRoot}\n data-testid=\"test-select-field-root\"\n className={`select-field-root ${customClassWrapper}`}\n data-state-error={hasValidationErrors}\n data-state-hint-position={hintPosition}>\n {hasLabel && (\n <span\n className={`root-label ${customClassLabel}`}\n data-state-skeletonize={skeletonize}>\n <label\n data-testid=\"test-select-field-label\"\n className=\"label\"\n title={label}\n htmlFor={name}\n aria-disabled={disabled}\n aria-readonly={readOnly}\n data-state-input-required={props.required}>\n {label}\n </label>\n {hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && (\n <Popover\n customClass=\"label-popover\"\n theme={themePopover}\n align={popoverAlign}\n iconColor=\"#03bde2\">\n <PopoverText text={props?.hint ?? ''} />\n </Popover>\n )}\n </span>\n )}\n <div\n ref={selectContainerRef}\n className={`container ${customClassInputContainer}`}\n aria-expanded={listBoxOpen}\n data-state-skeletonize={skeletonize}>\n {(hasLeftSlotElements && !skeletonize) && leftSlotElements}\n <div className=\"input-root\">\n <input\n {...rest}\n ref={mergeRefs(ref, selectInputRef)}\n readOnly={props.readOnly || undigitable}\n className={`input ${customClass}`}\n placeholder={rest.placeholder}\n data-state-error={hasValidationErrors}\n data-state-multiple={isMultipleSelect}\n data-state-read-only={readOnly}\n data-state-text-align={textAlign}\n data-state-undigitable={undigitable}\n data-state-skeletonize={skeletonize}\n data-state-multiple-with-checkboxes={isMultipleWithCheckboxes}\n id={name}\n type=\"text\"\n role=\"combobox\"\n multiple={false}\n disabled={disabled}\n data-testid=\"test-select-field-input\"\n aria-autocomplete=\"list\"\n aria-expanded={listBoxOpen}\n aria-controls={SELECT_FIELD_CONTROLS_ID}\n aria-activedescendant={activeDescendant}\n tabIndex={(!readOnly && !skeletonize) ? 0 : -1}\n value={inputValue}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n onKeyDown={handleOnKeyDown}\n onChange={handleOnChangeInput}\n onPaste={handleOnPaste}\n onMouseDown={handleOnMouseDown}\n onBeforeInput={handleOnBeforeInput} />\n {isMultipleDefault && (\n <Selections\n disabled={Boolean(disabled)}\n isReadOnly={Boolean(readOnly)}\n listOfOptionsToSelect={listOptionsMap} />\n )}\n </div>\n {(hasRightSlotElements && !skeletonize) && rightSlotElements}\n <div\n className=\"triggers\"\n data-state-disabled={disabled}\n data-state-read-only={readOnly}\n data-state-skeletonize={skeletonize}>\n <Triggers />\n </div>\n {listBoxOpen && createPortal(\n <ListBox\n ref={selectListBoxRef}\n dropdownMaxWidth={dropdownMaxWidth}\n onEndReached={onEndReached}\n onEndReachedThreshold={onEndReachedThreshold}\n itemsCount={itemsCount}>\n {childrenItems}\n </ListBox>,\n document.body,\n )}\n </div>\n {hintPosition === 'below' && (\n <Hint\n customClass=\"hint\"\n skeletonize={skeletonize}\n description={props.hint}\n disabled={disabled}\n visible={hasHintMessages} />\n )}\n {hasValidationErrors && (\n <span\n data-testid=\"test-select-field-list-errors\"\n className=\"error\"\n data-state-skeletonize={skeletonize}\n aria-describedby={String(name).concat('-errors')}>\n {errors?.map((error, index) => (\n <Fragment key={`${index + 1}-${error}`}>\n {error}\n {' '}\n </Fragment>\n ))}\n </span>\n )}\n </div>\n </SelectFieldContext.Provider>\n <Tooltip\n targetRef={selectInputRef}\n text={tooltip}\n position={tooltipPosition}\n width={tooltipWidth}\n space={tooltipPosition === 'right' ? 64 : undefined} />\n </Fragment>\n );\n },\n);\n\nInputBase.displayName = 'SelectFieldInputBase';\n"],"names":["InputBase","forwardRef","props","ref","name","label","errors","children","onChange","tooltip","tooltipPosition","tooltipWidth","hintPosition","themePopover","popoverAlign","skeletonize","striped","undigitable","externalSearch","openDropdownOnFocus","showClearButton","textAlign","searchOnDropdown","onSearch","undefined","customClass","customClassLabel","customClassWrapper","customClassInputContainer","notFoundFilterLabel","multipleInputLabelEmpty","multipleInputLabelManySelection","searchInputPlaceholder","dropdownAlignButton","dropdownMaxWidth","disabled","readOnly","onEndReached","onEndReachedThreshold","itemsCount","rest","SELECT_FIELD_CONTROLS_ID","useId","inputValue","setInputValue","useState","filterValue","setFilterValue","listBoxOpen","setListBoxOpen","activeDescendant","setActiveDescendant","isMultipleDefault","_","isEqual","multiple","MultipleVariantEnum","default","isMultipleWithCheckboxes","checkboxes","isMultipleSelect","liSelectedRef","useRef","selectFieldRoot","selectInputRef","selectListBoxRef","selectContainerRef","selectSearchInputRef","listOptionsMap","useMemo","optionsMap","Map","Children","forEach","child","isValidElement","set","value","useEffect","setTimeout","current","focus","retries","maxRetries","scrollToViewSelectedElement","listBox","querySelector","currentValue","orderBy","toNumber","currentLiElement","toString","clientHeight","scrollListBoxToElement","requestAnimationFrame","lazyInputValue","get","firstSelectionLabel","size","hasLabel","isEmpty","hasHintMessages","Boolean","hint","length","hasValidationErrors","childrenItems","itens","map","childElement","index","clonedChild","cloneElement","key","type","Item","push","leftSlotElements","rightSlotElements","left","right","LeftSlot","RightSlot","optionItens","clonedChildItem","Options","hasLeftSlotElements","hasRightSlotElements","handleCloseListBox","handleOpenListBox","handleChangeListBoxState","prevState","document","activeElement","handleChangeLiSelected","liElement","handleOnChange","inputLabel","addOrRemove","multipleValue","union","without","changedValue","multiValue","syntheticEvent","target","handleCheckMultiple","checkOrUncheckAll","checkAll","allValues","__","handleClearValue","resetValue","handleOnBlur","event","onBlur","relatedTarget","handleOnFocus","onFocus","handleOnChangeInput","handleOnPaste","preventDefault","onPaste","handleOnBeforeInput","onBeforeInput","handleOnMouseDown","onMouseDown","handleOnSearch","handleOnKeyDown","onKeyDown","notUndigitableKeys","Keys","backspace","delete","includes","shouldOpenByTyping","isTypingKey","arrowDown","ulListElement","liElementsFiltered","querySelectorAll","id","NAVIGATION_KEYS","currentElementIndex","Array","from","findIndex","nextElementIndex","escape","Math","min","arrowUp","max","enter","selectedLIOption","click","nextLIOption","ulListBox","contextValues","selectFieldId","nameSelect","String","valueSelect","required","mergeRefs","placeholder","createPortal","body","concat","error","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBO,MAAMA,YAAYC,WACvB,CAACC,OAAOC,QAAQ;AACd,QAAM;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EAAA,GAFY,GAAGnG,UAAQ,CAAC,IAAImG,KAAK,EAGpC,CACD,EAAA,CACH;AAAA,IAAA,EAAA,CAEJ,EAAA,CACF;AAAA,IACA,oBAAC,SAAA,EACC,WAAWjJ,gBACX,MAAMvD,SACN,UAAUC,iBACV,OAAOC,cACP,OAAOD,oBAAoB,UAAU,KAAKc,OAAAA,CAAU;AAAA,EAAA,GACxD;AAEJ,CACF;AAEAxB,UAAUkN,cAAc;"}
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../src/lib/inputs2/selectfield/base.tsx"],"sourcesContent":["import '../../assets/styles/selectfield.scss';\n\nimport {\n Children, cloneElement, forwardRef, Fragment, isValidElement, useEffect,\n useId, useMemo, useRef, useState, type ChangeEvent, type ClipboardEvent,\n type FocusEvent, type InputEvent, type KeyboardEvent, type ReactNode,\n type MouseEvent,\n} from 'react';\nimport _ from 'lodash';\nimport { createPortal } from 'react-dom';\nimport Hint from '../../hint';\nimport Popover, { PopoverText } from '../../popover';\nimport { Tooltip } from '../../tooltip';\nimport { mergeRefs } from '../../form2/helpers';\nimport { LeftSlot, RightSlot, type SlotProps } from '../slot';\nimport { ListBox } from './listbox';\nimport { Triggers } from './triggers';\nimport { Selections } from './selections';\nimport { SelectFieldContext } from './context';\nimport { Options, type OptionsProps } from './options';\nimport { Item, type SelectFieldItemProps } from './item';\nimport { Keys, MultipleVariantEnum, SelectFieldInputBaseProps } from './types';\nimport { isTypingKey, NAVIGATION_KEYS, scrollListBoxToElement } from './helpers';\n\nconst REMOTE_SEARCH_DEBOUNCE_MS = 300;\nexport const InputBase = forwardRef<HTMLInputElement, SelectFieldInputBaseProps>(\n (props, ref) => {\n const {\n name, label, errors, children, onChange, tooltip, tooltipPosition, tooltipWidth, hintPosition = 'below',\n themePopover = 'light', popoverAlign = 'left', skeletonize = false, striped = false, undigitable = false,\n openDropdownOnFocus = true, showClearButton = true, textAlign = 'left', searchOnDropdown = false,\n customClass = '', customClassLabel = '', customClassWrapper = '', customClassInputContainer = '',\n notFoundFilterLabel = 'Nenhuma opção encontrada.', multipleInputLabelEmpty = 'Nenhum registro selecionado',\n multipleInputLabelManySelection = 'Múltiplos registros selecionados', searchInputPlaceholder = 'Pesquisar registros',\n dropdownAlignButton = 'left', dropdownMaxWidth = undefined, disabled, readOnly, onRemoteSearch = undefined, ...rest\n } = props;\n const SELECT_FIELD_CONTROLS_ID = useId();\n const [inputValue, setInputValue] = useState('');\n const [filterValue, setFilterValue] = useState('');\n const [listBoxOpen, setListBoxOpen] = useState(false);\n const [activeDescendant, setActiveDescendant] = useState<string | undefined>(undefined);\n const isMultipleDefault = _.isEqual(props?.multiple, MultipleVariantEnum.default);\n const isMultipleWithCheckboxes = _.isEqual(props?.multiple, MultipleVariantEnum.checkboxes);\n const isMultipleSelect = isMultipleDefault || isMultipleWithCheckboxes;\n const liSelectedRef = useRef<HTMLLIElement | null>(null);\n const selectFieldRoot = useRef<HTMLDivElement | null>(null);\n const selectInputRef = useRef<HTMLInputElement | null>(null);\n const selectListBoxRef = useRef<HTMLDivElement | null>(null);\n const selectContainerRef = useRef<HTMLDivElement | null>(null);\n const selectSearchInputRef = useRef<HTMLInputElement | null>(null);\n const remoteSearchTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hasFocusRef = useRef(false);\n const hasRemoteSearch = Boolean(onRemoteSearch);\n\n const listOptionsMap = useMemo(() => {\n const optionsMap = new Map<string, string>();\n Children.forEach(children, (child) => {\n if (isValidElement<SelectFieldItemProps>(child)) {\n optionsMap.set(child.props.value, child.props.label);\n }\n });\n return optionsMap;\n }, [children]);\n\n useEffect(() => {\n if (isMultipleWithCheckboxes) {\n setInputValue(multipleInputLabelEmpty);\n }\n }, []);\n\n useEffect(() => {\n if (openDropdownOnFocus && listBoxOpen) {\n if (isMultipleWithCheckboxes) {\n setTimeout(() => { selectSearchInputRef.current?.focus?.(); }, 10);\n }\n }\n\n if (listBoxOpen) {\n /**\n * Scroll automático para o item selecionado na abertura do listbox.\n *\n * Usa requestAnimationFrame para aguardar que o DOM esteja renderizado e que o container\n * tenha dimensões estáveis (clientHeight > 0), já que a animação CSS \"revealelement\"\n * inicia com height: 0%, o que invalida o cálculo de scroll se executado antes.\n *\n * O scroll é feito via scrollListBoxToElement (helpers.ts) que manipula diretamente\n * o scrollTop do <ul>, sem usar scrollIntoView(), evitando propagação indesejada\n * de scroll para containers ancestrais(ex: body).\n */\n let retries = 0;\n const maxRetries = 20;\n const scrollToViewSelectedElement = () => {\n const listBox = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n const currentValue = !isMultipleSelect ?\n props?.value\n : _.orderBy([...props.value], value => _.toNumber(value), ['asc'])[0];\n const currentLiElement = listBox?.querySelector(`li[id=\"${_.toString(currentValue)}\"]`) as HTMLLIElement | null;\n if (currentLiElement && listBox) {\n if (listBox.clientHeight > 0) {\n scrollListBoxToElement(listBox, currentLiElement, 'center');\n } else if (retries < maxRetries) {\n retries++;\n requestAnimationFrame(scrollToViewSelectedElement);\n }\n }\n };\n requestAnimationFrame(scrollToViewSelectedElement);\n }\n }, [listBoxOpen]);\n\n useEffect(() => {\n if (props?.value && !isMultipleSelect) setActiveDescendant(props?.value);\n /**\n * Com busca remota, cada tecla digitada dispara uma nova pesquisa que atualiza\n * `children`/`listOptionsMap` de forma assíncrona (debounce). Enquanto o usuário está\n * digitando (ou o input ainda está em foco após limpar o texto) esse resync não deve\n * sobrescrever o que foi digitado com o label do valor selecionado — senão o campo\n * \"salta\" para o valor antigo (ou para vazio) a cada busca, em vez de apagar letra por\n * letra normalmente.\n */\n const isSearchingRemotely = hasRemoteSearch && (filterValue !== '' || hasFocusRef.current);\n if (!isMultipleWithCheckboxes && !isSearchingRemotely) {\n if (!props?.value) {\n setInputValue('');\n } else {\n const lazyInputValue = listOptionsMap.get(rest.value);\n setInputValue(lazyInputValue ?? '');\n }\n }\n if (isMultipleWithCheckboxes) {\n const firstSelectionLabel = listOptionsMap.get(props?.value[0]);\n switch (_.size(props?.value)) {\n case 0:\n return setInputValue(multipleInputLabelEmpty);\n case 1:\n return setInputValue(firstSelectionLabel ?? '');\n default:\n return setInputValue(multipleInputLabelManySelection);\n }\n }\n }, [props?.value, listOptionsMap]);\n\n useEffect(() => () => {\n if (remoteSearchTimeoutRef.current) clearTimeout(remoteSearchTimeoutRef.current);\n }, []);\n\n const hasLabel = !_.isEmpty(props?.label);\n const hasHintMessages = Boolean(props.hint?.length);\n const hasValidationErrors = Boolean(errors?.length);\n\n const { childrenItems } = useMemo(() => {\n const itens: ReactNode[] = [];\n\n Children.map(children, (childElement, index) => {\n if (isValidElement<SelectFieldItemProps>(childElement)) {\n const clonedChild = cloneElement(childElement, {\n key: childElement.key ?? `child-item-${index + 1}`,\n });\n if (childElement.type === Item) itens.push(clonedChild);\n }\n });\n\n return { childrenItems: itens };\n }, [children, disabled]);\n\n const { leftSlotElements, rightSlotElements } = useMemo(() => {\n const left: ReactNode[] = [];\n const right: ReactNode[] = [];\n\n Children.map(children, (childElement, index) => {\n if (isValidElement<SlotProps>(childElement)) {\n const clonedChild = cloneElement(childElement, {\n key: childElement.key ?? `slot-${index}`,\n disabled: disabled,\n 'aria-disabled': disabled,\n });\n if (childElement.type === LeftSlot) left.push(clonedChild);\n if (childElement.type === RightSlot) right.push(clonedChild);\n }\n });\n\n return { leftSlotElements: left, rightSlotElements: right };\n }, [children, disabled]);\n\n const { optionItens } = useMemo(() => {\n const itens: ReactNode[] = [];\n\n Children.map(children, (childElement, index) => {\n if (isValidElement<OptionsProps>(childElement)) {\n const clonedChildItem = cloneElement(childElement, {\n key: childElement.key ?? `option-list-${index}`,\n disabled: disabled,\n });\n if (childElement.type === Options) itens.push(clonedChildItem);\n }\n });\n\n return { optionItens: itens };\n }, [children, disabled]);\n\n const hasLeftSlotElements = Boolean(leftSlotElements?.length);\n const hasRightSlotElements = Boolean(rightSlotElements?.length);\n\n const handleCloseListBox = () => {\n setListBoxOpen(false);\n setFilterValue('');\n };\n\n const handleOpenListBox = () => {\n const currentValue = !isMultipleSelect ?\n props?.value\n : _.orderBy([...props.value], value => _.toNumber(value), ['asc'])[0];\n setActiveDescendant(_.toString(currentValue) ?? undefined);\n };\n\n const handleChangeListBoxState = () => {\n setListBoxOpen((prevState) => {\n if (prevState) {\n setFilterValue('');\n }\n if (selectInputRef.current !== document.activeElement) {\n selectInputRef?.current?.focus?.();\n }\n handleOpenListBox();\n return !prevState;\n });\n };\n\n const handleChangeLiSelected = (liElement: HTMLLIElement | null) => {\n liSelectedRef.current = liElement;\n };\n\n const handleOnChange = (value?: any, inputLabel?: string, addOrRemove?: boolean) => {\n let multipleValue = props?.value;\n if (!addOrRemove) multipleValue = _.union(props.value, [value]);\n if (addOrRemove) multipleValue = _.without(props.value, value);\n const changedValue = !isMultipleSelect ?\n value\n : _.orderBy(multipleValue, multiValue => _.toNumber(multiValue), ['asc']);\n const syntheticEvent = {\n target: {\n name,\n value: changedValue as any,\n },\n } as ChangeEvent<HTMLInputElement>;\n onChange?.(syntheticEvent);\n if (!isMultipleSelect) {\n setListBoxOpen(false);\n setFilterValue('');\n setInputValue(inputLabel ?? '');\n if (document.activeElement === selectSearchInputRef.current) {\n selectInputRef?.current?.focus?.();\n setListBoxOpen(false);\n }\n }\n };\n\n const handleCheckMultiple = (checkOrUncheckAll?: boolean) => {\n const checkAll = Boolean(checkOrUncheckAll);\n const allValues: any[] = [];\n listOptionsMap.forEach((__, key) => allValues.push(key));\n const value: any = checkAll ? allValues : [];\n const syntheticEvent = {\n target: {\n name,\n value,\n },\n } as ChangeEvent<HTMLInputElement>;\n onChange?.(syntheticEvent);\n };\n\n const handleClearValue = () => {\n const resetValue = !isMultipleSelect ? '' : [];\n const syntheticEvent = {\n target: {\n name,\n value: resetValue as any,\n },\n } as ChangeEvent<HTMLInputElement>;\n onChange?.(syntheticEvent);\n setListBoxOpen(false);\n if (!isMultipleSelect) {\n setFilterValue('');\n setInputValue('');\n }\n if (isMultipleWithCheckboxes) {\n setInputValue(multipleInputLabelEmpty);\n }\n };\n\n const handleOnBlur = (event: FocusEvent<HTMLInputElement>) => {\n hasFocusRef.current = false;\n props?.onBlur?.(event);\n if (!event.relatedTarget || event.relatedTarget !== selectSearchInputRef.current) {\n setListBoxOpen(false);\n }\n setFilterValue('');\n };\n\n const handleOnFocus = (event: FocusEvent<HTMLInputElement>) => {\n hasFocusRef.current = true;\n props?.onFocus?.(event);\n if (openDropdownOnFocus) {\n setListBoxOpen(true);\n handleOpenListBox();\n }\n };\n\n const handleRemoteSearch = (value: string) => {\n if (!onRemoteSearch) return;\n if (remoteSearchTimeoutRef.current) clearTimeout(remoteSearchTimeoutRef.current);\n remoteSearchTimeoutRef.current = setTimeout(() => {\n onRemoteSearch(value);\n }, REMOTE_SEARCH_DEBOUNCE_MS);\n };\n\n const handleOnChangeInput = (event: ChangeEvent<HTMLInputElement>) => {\n setFilterValue(event.target.value);\n setInputValue(event.target.value);\n handleRemoteSearch(event.target.value);\n };\n\n const handleOnPaste = (event: ClipboardEvent<HTMLInputElement>) => {\n if (undigitable || isMultipleWithCheckboxes) {\n event.preventDefault();\n } else {\n props.onPaste?.(event);\n }\n };\n\n const handleOnBeforeInput = (event: InputEvent<HTMLInputElement>) => {\n if (undigitable || isMultipleWithCheckboxes) {\n event.preventDefault();\n } else {\n props.onBeforeInput?.(event);\n }\n };\n\n const handleOnMouseDown = (event: MouseEvent<HTMLInputElement>) => {\n if (undigitable) {\n event.preventDefault();\n } else {\n props.onMouseDown?.(event);\n if (openDropdownOnFocus && !listBoxOpen) {\n setListBoxOpen(true);\n handleOpenListBox();\n }\n }\n };\n\n const handleOnSearch = (event: ChangeEvent<HTMLInputElement>) => {\n setFilterValue(event.target.value);\n handleRemoteSearch(event.target.value);\n };\n\n const handleOnKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n props?.onKeyDown?.(event);\n const notUndigitableKeys: string[] = [Keys.backspace, Keys.delete];\n if ((undigitable) && notUndigitableKeys.includes(event.key)) {\n event.preventDefault();\n return;\n }\n const shouldOpenByTyping = isTypingKey(event) || event.key === Keys.arrowDown;\n if (shouldOpenByTyping && selectInputRef.current === document.activeElement) {\n if (event.key === Keys.arrowDown) {\n event.preventDefault();\n }\n requestAnimationFrame(() => {\n const ulListElement = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n const liElementsFiltered = (ulListElement?.querySelectorAll(\n 'li[data-state-filtered=\"true\"]',\n ) ?? []) as HTMLLIElement[];\n if (!listBoxOpen && event.key === Keys.arrowDown) {\n const currentValue = !isMultipleSelect ?\n props?.value\n : _.orderBy([...props.value], value => _.toNumber(value), ['asc'])[0];\n setActiveDescendant(_.toString(currentValue) ?? undefined);\n } else {\n setActiveDescendant(liElementsFiltered[0]?.id ?? undefined);\n }\n });\n if (!listBoxOpen) {\n setListBoxOpen(true);\n handleOpenListBox();\n }\n }\n if (listBoxOpen && NAVIGATION_KEYS.includes(event.key)) {\n event.preventDefault();\n }\n requestAnimationFrame(() => {\n const ulListElement = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n const liElementsFiltered = (ulListElement?.querySelectorAll(\n 'li[data-state-filtered=\"true\"]',\n ) ?? []) as HTMLLIElement[];\n const currentElementIndex = Array.from(liElementsFiltered).findIndex(\n liElement => liElement.id === activeDescendant,\n );\n let nextElementIndex = currentElementIndex;\n if (listBoxOpen) {\n if (NAVIGATION_KEYS.includes(event.key)) {\n switch (event.key) {\n case Keys.escape:\n setListBoxOpen(false);\n setFilterValue('');\n selectInputRef.current?.focus();\n if (event.target === selectSearchInputRef.current) {\n setListBoxOpen(false);\n }\n break;\n case Keys.arrowDown:\n nextElementIndex = Math.min(currentElementIndex + 1, liElementsFiltered.length - 1);\n break;\n case Keys.arrowUp:\n nextElementIndex = Math.max(currentElementIndex - 1, 0);\n break;\n case Keys.enter:\n if (activeDescendant) {\n const selectedLIOption = liElementsFiltered[nextElementIndex];\n if (selectedLIOption) {\n selectedLIOption.click();\n }\n }\n break;\n default:\n break;\n }\n const nextLIOption = liElementsFiltered[nextElementIndex];\n if (nextLIOption) {\n setActiveDescendant(nextLIOption?.id ?? '');\n const ulListBox = selectListBoxRef.current?.querySelector('ul[role=\"listbox\"]');\n scrollListBoxToElement(ulListBox, nextLIOption, 'nearest');\n }\n }\n } else return null;\n });\n };\n\n const contextValues = ({\n selectFieldId: SELECT_FIELD_CONTROLS_ID, label: props.label, striped, listBoxOpen,\n filterValue, disabled, liSelectedRef, selectInputRef, selectSearchInputRef, handleOnSearch,\n searchOnDropdown, nameSelect: String(props.name), valueSelect: props?.value,\n activeDescendant, handleOnChange, handleOnKeyDown, selectContainerRef, handleCloseListBox,\n notFoundFilterLabel, handleChangeLiSelected, isMultipleSelect, isMultipleDefault,\n isMultipleWithCheckboxes, searchInputPlaceholder, showClearButton, dropdownAlignButton,\n handleClearValue, handleCheckMultiple, handleChangeListBoxState, optionItens, hasRemoteSearch,\n });\n\n return (\n <Fragment>\n <SelectFieldContext.Provider value={contextValues}>\n <div\n ref={selectFieldRoot}\n data-testid=\"test-select-field-root\"\n className={`select-field-root ${customClassWrapper}`}\n data-state-error={hasValidationErrors}\n data-state-hint-position={hintPosition}>\n {hasLabel && (\n <span\n className={`root-label ${customClassLabel}`}\n data-state-skeletonize={skeletonize}>\n <label\n data-testid=\"test-select-field-label\"\n className=\"label\"\n title={label}\n htmlFor={name}\n aria-disabled={disabled}\n aria-readonly={readOnly}\n data-state-input-required={props.required}>\n {label}\n </label>\n {hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && (\n <Popover\n customClass=\"label-popover\"\n theme={themePopover}\n align={popoverAlign}\n iconColor=\"#03bde2\">\n <PopoverText text={props?.hint ?? ''} />\n </Popover>\n )}\n </span>\n )}\n <div\n ref={selectContainerRef}\n className={`container ${customClassInputContainer}`}\n aria-expanded={listBoxOpen}\n data-state-skeletonize={skeletonize}>\n {(hasLeftSlotElements && !skeletonize) && leftSlotElements}\n <div className=\"input-root\">\n <input\n {...rest}\n ref={mergeRefs(ref, selectInputRef)}\n readOnly={props.readOnly || undigitable}\n className={`input ${customClass}`}\n placeholder={rest.placeholder}\n data-state-error={hasValidationErrors}\n data-state-multiple={isMultipleSelect}\n data-state-read-only={readOnly}\n data-state-text-align={textAlign}\n data-state-undigitable={undigitable}\n data-state-skeletonize={skeletonize}\n data-state-multiple-with-checkboxes={isMultipleWithCheckboxes}\n id={name}\n type=\"text\"\n role=\"combobox\"\n multiple={false}\n disabled={disabled}\n data-testid=\"test-select-field-input\"\n aria-autocomplete=\"list\"\n aria-expanded={listBoxOpen}\n aria-controls={SELECT_FIELD_CONTROLS_ID}\n aria-activedescendant={activeDescendant}\n tabIndex={(!readOnly && !skeletonize) ? 0 : -1}\n value={inputValue}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n onKeyDown={handleOnKeyDown}\n onChange={handleOnChangeInput}\n onPaste={handleOnPaste}\n onMouseDown={handleOnMouseDown}\n onBeforeInput={handleOnBeforeInput} />\n {isMultipleDefault && (\n <Selections\n disabled={Boolean(disabled)}\n isReadOnly={Boolean(readOnly)}\n listOfOptionsToSelect={listOptionsMap} />\n )}\n </div>\n {(hasRightSlotElements && !skeletonize) && rightSlotElements}\n <div\n className=\"triggers\"\n data-state-disabled={disabled}\n data-state-read-only={readOnly}\n data-state-skeletonize={skeletonize}>\n <Triggers />\n </div>\n {listBoxOpen && createPortal(\n <ListBox\n ref={selectListBoxRef}\n dropdownMaxWidth={dropdownMaxWidth}>\n {childrenItems}\n </ListBox>,\n document.body,\n )}\n </div>\n {hintPosition === 'below' && (\n <Hint\n customClass=\"hint\"\n skeletonize={skeletonize}\n description={props.hint}\n disabled={disabled}\n visible={hasHintMessages} />\n )}\n {hasValidationErrors && (\n <span\n data-testid=\"test-select-field-list-errors\"\n className=\"error\"\n data-state-skeletonize={skeletonize}\n aria-describedby={String(name).concat('-errors')}>\n {errors?.map((error, index) => (\n <Fragment key={`${index + 1}-${error}`}>\n {error}\n {' '}\n </Fragment>\n ))}\n </span>\n )}\n </div>\n </SelectFieldContext.Provider>\n <Tooltip\n targetRef={selectInputRef}\n text={tooltip}\n position={tooltipPosition}\n width={tooltipWidth}\n space={tooltipPosition === 'right' ? 64 : undefined} />\n </Fragment>\n );\n },\n);\n\nInputBase.displayName = 'SelectFieldInputBase';\n"],"names":["REMOTE_SEARCH_DEBOUNCE_MS","InputBase","forwardRef","props","ref","name","label","errors","children","onChange","tooltip","tooltipPosition","tooltipWidth","hintPosition","themePopover","popoverAlign","skeletonize","striped","undigitable","openDropdownOnFocus","showClearButton","textAlign","searchOnDropdown","customClass","customClassLabel","customClassWrapper","customClassInputContainer","notFoundFilterLabel","multipleInputLabelEmpty","multipleInputLabelManySelection","searchInputPlaceholder","dropdownAlignButton","dropdownMaxWidth","undefined","disabled","readOnly","onRemoteSearch","rest","SELECT_FIELD_CONTROLS_ID","useId","inputValue","setInputValue","useState","filterValue","setFilterValue","listBoxOpen","setListBoxOpen","activeDescendant","setActiveDescendant","isMultipleDefault","_","isEqual","multiple","MultipleVariantEnum","default","isMultipleWithCheckboxes","checkboxes","isMultipleSelect","liSelectedRef","useRef","selectFieldRoot","selectInputRef","selectListBoxRef","selectContainerRef","selectSearchInputRef","remoteSearchTimeoutRef","hasFocusRef","hasRemoteSearch","Boolean","listOptionsMap","useMemo","optionsMap","Map","Children","forEach","child","isValidElement","set","value","useEffect","setTimeout","current","focus","retries","maxRetries","scrollToViewSelectedElement","listBox","querySelector","currentValue","orderBy","toNumber","currentLiElement","toString","clientHeight","scrollListBoxToElement","requestAnimationFrame","isSearchingRemotely","lazyInputValue","get","firstSelectionLabel","size","clearTimeout","hasLabel","isEmpty","hasHintMessages","hint","length","hasValidationErrors","childrenItems","itens","map","childElement","index","clonedChild","cloneElement","key","type","Item","push","leftSlotElements","rightSlotElements","left","right","LeftSlot","RightSlot","optionItens","clonedChildItem","Options","hasLeftSlotElements","hasRightSlotElements","handleCloseListBox","handleOpenListBox","handleChangeListBoxState","prevState","document","activeElement","handleChangeLiSelected","liElement","handleOnChange","inputLabel","addOrRemove","multipleValue","union","without","changedValue","multiValue","syntheticEvent","target","handleCheckMultiple","checkOrUncheckAll","checkAll","allValues","__","handleClearValue","resetValue","handleOnBlur","event","onBlur","relatedTarget","handleOnFocus","onFocus","handleRemoteSearch","handleOnChangeInput","handleOnPaste","preventDefault","onPaste","handleOnBeforeInput","onBeforeInput","handleOnMouseDown","onMouseDown","handleOnSearch","handleOnKeyDown","onKeyDown","notUndigitableKeys","Keys","backspace","delete","includes","shouldOpenByTyping","isTypingKey","arrowDown","ulListElement","liElementsFiltered","querySelectorAll","id","NAVIGATION_KEYS","currentElementIndex","Array","from","findIndex","nextElementIndex","escape","Math","min","arrowUp","max","enter","selectedLIOption","click","nextLIOption","ulListBox","contextValues","selectFieldId","nameSelect","String","valueSelect","required","mergeRefs","placeholder","createPortal","body","concat","error","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,MAAMA,4BAA4B;AAC3B,MAAMC,YAAYC,WACvB,CAACC,OAAOC,QAAQ;AACd,QAAM;AAAA,IACJC;AAAAA,IAAMC;AAAAA,IAAOC;AAAAA,IAAQC;AAAAA,IAAUC;AAAAA,IAAUC;AAAAA,IAASC;AAAAA,IAAiBC;AAAAA,IAAcC,eAAe;AAAA,IAChGC,eAAe;AAAA,IAASC,eAAe;AAAA,IAAQC,cAAc;AAAA,IAAOC,UAAU;AAAA,IAAOC,cAAc;AAAA,IACnGC,sBAAsB;AAAA,IAAMC,kBAAkB;AAAA,IAAMC,YAAY;AAAA,IAAQC,mBAAmB;AAAA,IAC3FC,cAAc;AAAA,IAAIC,mBAAmB;AAAA,IAAIC,qBAAqB;AAAA,IAAIC,4BAA4B;AAAA,IAC9FC,sBAAsB;AAAA,IAA6BC,0BAA0B;AAAA,IAC7EC,kCAAkC;AAAA,IAAoCC,yBAAyB;AAAA,IAC/FC,sBAAsB;AAAA,IAAQC,mBAAmBC;AAAAA,IAAWC;AAAAA,IAAUC;AAAAA,IAAUC,iBAAiBH;AAAAA,IAAW,GAAGI;AAAAA,EAAAA,IAC7G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AA,CACH;AAAA,IAAA,EAAA,CAEJ,EAAA,CACF;AAAA,IACA,oBAAC,SAAA,EACC,WAAWvJ,gBACX,MAAMnD,SACN,UAAUC,iBACV,OAAOC,cACP,OAAOD,oBAAoB,UAAU,KAAKsB,OAAAA,CAAU;AAAA,EAAA,GACxD;AAEJ,CACF;AAEAhC,UAAUoN,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../src/lib/inputs2/selectfield/context.tsx"],"sourcesContent":["import { createContext, ChangeEvent, ReactNode, RefObject, useContext, KeyboardEventHandler } from 'react';\nimport type { Position } from '../../@types/Position';\n\ninterface SelectFieldContextProps {\n striped?: boolean;\n listBoxOpen: boolean;\n disabled?: boolean;\n showClearButton?: boolean;\n searchOnDropdown?: boolean;\n isMultipleSelect?: boolean;\n isMultipleDefault?: boolean;\n isMultipleWithCheckboxes?: boolean;\n label?: string;\n filterValue?: string;\n nameSelect?: string;\n valueSelect?: any;\n selectFieldId: string;\n activeDescendant?: string;\n notFoundFilterLabel: string;\n searchInputPlaceholder: string;\n optionItens: ReactNode[] | undefined | null;\n dropdownAlignButton?: Extract<Position, 'left' | 'right'>;\n liSelectedRef: RefObject<HTMLLIElement | null>;\n selectInputRef: RefObject<HTMLInputElement | null>;\n selectContainerRef: RefObject<HTMLDivElement | null>;\n selectSearchInputRef: RefObject<HTMLInputElement | null>;\n handleOnSearch?: (event: ChangeEvent<HTMLInputElement>) => void;\n handleOnChange?: (value?: string, label?: string, addOrRemove?: boolean) => void;\n handleOnKeyDown?: KeyboardEventHandler;\n handleClearValue?: () => void;\n handleCloseListBox: () => void;\n handleCheckMultiple: (checkOrUncheckAll?: boolean) => void;\n handleChangeLiSelected: (liElement: HTMLLIElement | null) => void;\n handleChangeListBoxState: () => void;\n}\n\nconst SelectFieldContext = createContext({} as SelectFieldContextProps);\n\nconst useSelectFieldContext = () => {\n const context = useContext(SelectFieldContext);\n\n if (context === undefined)\n throw new Error('useSelectFieldContext must be used within a SelectFieldProvider');\n\n return context;\n};\n\nexport { SelectFieldContext, useSelectFieldContext };\nexport type { SelectFieldContextProps };\n"],"names":["SelectFieldContext","createContext","useSelectFieldContext","context","useContext","undefined","Error"],"mappings":";
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../src/lib/inputs2/selectfield/context.tsx"],"sourcesContent":["import { createContext, ChangeEvent, ReactNode, RefObject, useContext, KeyboardEventHandler } from 'react';\nimport type { Position } from '../../@types/Position';\n\ninterface SelectFieldContextProps {\n striped?: boolean;\n listBoxOpen: boolean;\n disabled?: boolean;\n showClearButton?: boolean;\n searchOnDropdown?: boolean;\n hasRemoteSearch?: boolean;\n isMultipleSelect?: boolean;\n isMultipleDefault?: boolean;\n isMultipleWithCheckboxes?: boolean;\n label?: string;\n filterValue?: string;\n nameSelect?: string;\n valueSelect?: any;\n selectFieldId: string;\n activeDescendant?: string;\n notFoundFilterLabel: string;\n searchInputPlaceholder: string;\n optionItens: ReactNode[] | undefined | null;\n dropdownAlignButton?: Extract<Position, 'left' | 'right'>;\n liSelectedRef: RefObject<HTMLLIElement | null>;\n selectInputRef: RefObject<HTMLInputElement | null>;\n selectContainerRef: RefObject<HTMLDivElement | null>;\n selectSearchInputRef: RefObject<HTMLInputElement | null>;\n handleOnSearch?: (event: ChangeEvent<HTMLInputElement>) => void;\n handleOnChange?: (value?: string, label?: string, addOrRemove?: boolean) => void;\n handleOnKeyDown?: KeyboardEventHandler;\n handleClearValue?: () => void;\n handleCloseListBox: () => void;\n handleCheckMultiple: (checkOrUncheckAll?: boolean) => void;\n handleChangeLiSelected: (liElement: HTMLLIElement | null) => void;\n handleChangeListBoxState: () => void;\n}\n\nconst SelectFieldContext = createContext({} as SelectFieldContextProps);\n\nconst useSelectFieldContext = () => {\n const context = useContext(SelectFieldContext);\n\n if (context === undefined)\n throw new Error('useSelectFieldContext must be used within a SelectFieldProvider');\n\n return context;\n};\n\nexport { SelectFieldContext, useSelectFieldContext };\nexport type { SelectFieldContextProps };\n"],"names":["SelectFieldContext","createContext","useSelectFieldContext","context","useContext","undefined","Error"],"mappings":";AAqCA,MAAMA,qBAAqBC,cAAc,CAAA,CAA6B;AAEtE,MAAMC,wBAAwBA,MAAA;AAC5B,QAAAC,UAAgBC,WAAWJ,kBAAkB;AAE7C,MAAIG,YAAYE,QAAS;AACvB,UAAM,IAAIC,MAAM,iEAAiE;AAAA,EAAE;AAAA,SAE9EH;AAAO;"}
|
|
@@ -5,7 +5,7 @@ import { forwardRef } from "react";
|
|
|
5
5
|
import { Input } from "../checkboxfield/index.js";
|
|
6
6
|
import { useSelectFieldContext } from "./context.js";
|
|
7
7
|
const Item = forwardRef((props, ref) => {
|
|
8
|
-
const $ = compilerRuntimeExports.c(
|
|
8
|
+
const $ = compilerRuntimeExports.c(44);
|
|
9
9
|
const {
|
|
10
10
|
disabled,
|
|
11
11
|
readOnly,
|
|
@@ -20,7 +20,8 @@ const Item = forwardRef((props, ref) => {
|
|
|
20
20
|
handleChangeLiSelected,
|
|
21
21
|
isMultipleSelect,
|
|
22
22
|
isMultipleDefault,
|
|
23
|
-
isMultipleWithCheckboxes
|
|
23
|
+
isMultipleWithCheckboxes,
|
|
24
|
+
hasRemoteSearch
|
|
24
25
|
} = useSelectFieldContext();
|
|
25
26
|
let t0;
|
|
26
27
|
if ($[0] !== props.value) {
|
|
@@ -45,17 +46,18 @@ const Item = forwardRef((props, ref) => {
|
|
|
45
46
|
const ariaSelected = t1;
|
|
46
47
|
const addOrRemove = !isMultipleSelect ? void 0 : ariaSelected;
|
|
47
48
|
let t2;
|
|
48
|
-
if ($[6] !== filterValue || $[7] !== props.label) {
|
|
49
|
-
t2 = String(props.label).toLowerCase().includes(filterValue?.toString().toLowerCase() ?? "");
|
|
49
|
+
if ($[6] !== filterValue || $[7] !== hasRemoteSearch || $[8] !== props.label) {
|
|
50
|
+
t2 = hasRemoteSearch || Boolean(String(props.label).toLowerCase().includes(filterValue?.toString().toLowerCase() ?? ""));
|
|
50
51
|
$[6] = filterValue;
|
|
51
|
-
$[7] =
|
|
52
|
-
$[8] =
|
|
52
|
+
$[7] = hasRemoteSearch;
|
|
53
|
+
$[8] = props.label;
|
|
54
|
+
$[9] = t2;
|
|
53
55
|
} else {
|
|
54
|
-
t2 = $[
|
|
56
|
+
t2 = $[9];
|
|
55
57
|
}
|
|
56
|
-
const hasPartOfFilter =
|
|
58
|
+
const hasPartOfFilter = t2;
|
|
57
59
|
let t3;
|
|
58
|
-
if ($[
|
|
60
|
+
if ($[10] !== addOrRemove || $[11] !== ariaSelected || $[12] !== handleOnChange || $[13] !== isMultipleDefault || $[14] !== props.label || $[15] !== props.value) {
|
|
59
61
|
t3 = (event) => {
|
|
60
62
|
if (isMultipleDefault && ariaSelected) {
|
|
61
63
|
event.preventDefault();
|
|
@@ -63,19 +65,19 @@ const Item = forwardRef((props, ref) => {
|
|
|
63
65
|
handleOnChange?.(props.value, props.label, addOrRemove);
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
68
|
+
$[10] = addOrRemove;
|
|
69
|
+
$[11] = ariaSelected;
|
|
70
|
+
$[12] = handleOnChange;
|
|
71
|
+
$[13] = isMultipleDefault;
|
|
72
|
+
$[14] = props.label;
|
|
73
|
+
$[15] = props.value;
|
|
74
|
+
$[16] = t3;
|
|
73
75
|
} else {
|
|
74
|
-
t3 = $[
|
|
76
|
+
t3 = $[16];
|
|
75
77
|
}
|
|
76
78
|
const handleOnClickItem = t3;
|
|
77
79
|
let t4;
|
|
78
|
-
if ($[
|
|
80
|
+
if ($[17] !== ariaSelected || $[18] !== handleChangeLiSelected || $[19] !== ref) {
|
|
79
81
|
t4 = (el) => {
|
|
80
82
|
if (el) {
|
|
81
83
|
if (ariaSelected) {
|
|
@@ -90,52 +92,52 @@ const Item = forwardRef((props, ref) => {
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
95
|
+
$[17] = ariaSelected;
|
|
96
|
+
$[18] = handleChangeLiSelected;
|
|
97
|
+
$[19] = ref;
|
|
98
|
+
$[20] = t4;
|
|
97
99
|
} else {
|
|
98
|
-
t4 = $[
|
|
100
|
+
t4 = $[20];
|
|
99
101
|
}
|
|
100
102
|
const t5 = props.hidden || !hasPartOfFilter;
|
|
101
103
|
const t6 = props["aria-hidden"] || !hasPartOfFilter;
|
|
102
104
|
let t7;
|
|
103
|
-
if ($[
|
|
105
|
+
if ($[21] !== ariaSelected || $[22] !== disabled || $[23] !== hasFocus || $[24] !== isMultipleWithCheckboxes || $[25] !== props.label || $[26] !== props.value || $[27] !== readOnly) {
|
|
104
106
|
t7 = isMultipleWithCheckboxes && /* @__PURE__ */ jsx(Input, { rounded: true, disabled, readOnly, checked: ariaSelected, size: "default", variant: "secondary", "data-state-in-focus-select-field": hasFocus, name: String(props.label).concat("-").concat(props.value) });
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
107
|
+
$[21] = ariaSelected;
|
|
108
|
+
$[22] = disabled;
|
|
109
|
+
$[23] = hasFocus;
|
|
110
|
+
$[24] = isMultipleWithCheckboxes;
|
|
111
|
+
$[25] = props.label;
|
|
112
|
+
$[26] = props.value;
|
|
113
|
+
$[27] = readOnly;
|
|
114
|
+
$[28] = t7;
|
|
113
115
|
} else {
|
|
114
|
-
t7 = $[
|
|
116
|
+
t7 = $[28];
|
|
115
117
|
}
|
|
116
118
|
let t8;
|
|
117
|
-
if ($[
|
|
119
|
+
if ($[29] !== ariaSelected || $[30] !== children || $[31] !== disabled || $[32] !== handleOnClickItem || $[33] !== hasFocus || $[34] !== hasPartOfFilter || $[35] !== isMultipleDefault || $[36] !== isMultipleWithCheckboxes || $[37] !== props || $[38] !== striped || $[39] !== t4 || $[40] !== t5 || $[41] !== t6 || $[42] !== t7) {
|
|
118
120
|
t8 = /* @__PURE__ */ jsxs("li", { ref: t4, id: props.value, hidden: t5, tabIndex: -1, title: props.label, "aria-label": props.label, "aria-selected": ariaSelected, "aria-hidden": t6, "aria-disabled": disabled, "data-content-value": props.value, "data-content-label": props.label, "data-state-striped": striped, "data-state-in-focus": hasFocus, "data-state-filtered": hasPartOfFilter, "data-state-multiple-with-default": isMultipleDefault, "data-state-multiple-with-checkboxes": isMultipleWithCheckboxes, "data-testid": "test-select-field-listbox-item", role: "option", onClick: handleOnClickItem, onMouseDown: _temp, ...props, children: [
|
|
119
121
|
t7,
|
|
120
122
|
children
|
|
121
123
|
] }, props.value);
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
124
|
+
$[29] = ariaSelected;
|
|
125
|
+
$[30] = children;
|
|
126
|
+
$[31] = disabled;
|
|
127
|
+
$[32] = handleOnClickItem;
|
|
128
|
+
$[33] = hasFocus;
|
|
129
|
+
$[34] = hasPartOfFilter;
|
|
130
|
+
$[35] = isMultipleDefault;
|
|
131
|
+
$[36] = isMultipleWithCheckboxes;
|
|
132
|
+
$[37] = props;
|
|
133
|
+
$[38] = striped;
|
|
134
|
+
$[39] = t4;
|
|
135
|
+
$[40] = t5;
|
|
136
|
+
$[41] = t6;
|
|
137
|
+
$[42] = t7;
|
|
138
|
+
$[43] = t8;
|
|
137
139
|
} else {
|
|
138
|
-
t8 = $[
|
|
140
|
+
t8 = $[43];
|
|
139
141
|
}
|
|
140
142
|
return t8;
|
|
141
143
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sources":["../../../src/lib/inputs2/selectfield/item.tsx"],"sourcesContent":["import _ from 'lodash';\nimport { ComponentProps, forwardRef, MouseEvent, ReactNode } from 'react';\nimport * as Checkbox from '../checkboxfield';\nimport { useSelectFieldContext } from './context';\n\ninterface SelectFieldItemProps extends ComponentProps<'li'> {\n value: any;\n label: string;\n disabled?: boolean;\n readOnly?: boolean;\n children: ReactNode;\n}\n\nconst Item = forwardRef<HTMLLIElement, SelectFieldItemProps>(\n (props, ref) => {\n const { disabled, readOnly, children } = props;\n const {\n striped, filterValue, valueSelect, activeDescendant, handleOnChange, handleChangeLiSelected,\n isMultipleSelect, isMultipleDefault, isMultipleWithCheckboxes,\n } = useSelectFieldContext();\n\n const valueToString = _.toString(props.value);\n const hasFocus = Boolean(activeDescendant === valueToString);\n const ariaSelected = !isMultipleSelect
|
|
1
|
+
{"version":3,"file":"item.js","sources":["../../../src/lib/inputs2/selectfield/item.tsx"],"sourcesContent":["import _ from 'lodash';\nimport { ComponentProps, forwardRef, MouseEvent, ReactNode } from 'react';\nimport * as Checkbox from '../checkboxfield';\nimport { useSelectFieldContext } from './context';\n\ninterface SelectFieldItemProps extends ComponentProps<'li'> {\n value: any;\n label: string;\n disabled?: boolean;\n readOnly?: boolean;\n children: ReactNode;\n}\n\nconst Item = forwardRef<HTMLLIElement, SelectFieldItemProps>(\n (props, ref) => {\n const { disabled, readOnly, children } = props;\n const {\n striped, filterValue, valueSelect, activeDescendant, handleOnChange, handleChangeLiSelected,\n isMultipleSelect, isMultipleDefault, isMultipleWithCheckboxes, hasRemoteSearch,\n } = useSelectFieldContext();\n\n const valueToString = _.toString(props.value);\n const hasFocus = Boolean(activeDescendant === valueToString);\n const ariaSelected = !isMultipleSelect\n ? Boolean(props.value === valueSelect)\n : [...valueSelect].includes(props.value);\n const addOrRemove = !isMultipleSelect ? undefined : ariaSelected;\n const hasPartOfFilter = hasRemoteSearch || Boolean(\n String(props.label)\n .toLowerCase()\n .includes(filterValue?.toString().toLowerCase() ?? ''),\n );\n\n const handleOnClickItem = (event: MouseEvent<HTMLLIElement>) => {\n if (isMultipleDefault && ariaSelected) event.preventDefault();\n else { handleOnChange?.(props.value, props.label, addOrRemove); }\n };\n\n return (\n <li\n ref={(el) => {\n if (el) {\n if (ariaSelected) { handleChangeLiSelected(el); }\n if (typeof ref === 'function') {\n ref(el);\n } else if (ref) {\n ref.current = el;\n }\n }\n }}\n key={props.value}\n id={props.value}\n hidden={props.hidden || !hasPartOfFilter}\n tabIndex={-1}\n title={props.label}\n aria-label={props.label}\n aria-selected={ariaSelected}\n aria-hidden={props['aria-hidden'] || !hasPartOfFilter}\n aria-disabled={disabled}\n data-content-value={props.value}\n data-content-label={props.label}\n data-state-striped={striped}\n data-state-in-focus={hasFocus}\n data-state-filtered={hasPartOfFilter}\n data-state-multiple-with-default={isMultipleDefault}\n data-state-multiple-with-checkboxes={isMultipleWithCheckboxes}\n data-testid=\"test-select-field-listbox-item\"\n role=\"option\"\n onClick={handleOnClickItem}\n onMouseDown={(event) => { event.preventDefault(); }}\n {...props}>\n {isMultipleWithCheckboxes && (\n <Checkbox.Input\n rounded\n disabled={disabled}\n readOnly={readOnly}\n checked={ariaSelected}\n size=\"default\"\n variant=\"secondary\"\n data-state-in-focus-select-field={hasFocus}\n name={String(props.label).concat('-').concat(props.value)} />\n )}\n {children}\n </li>\n );\n },\n);\n\nItem.displayName = 'SelectFieldItem';\nexport { Item };\nexport type { SelectFieldItemProps };\n"],"names":["Item","forwardRef","props","ref","$","_c","disabled","readOnly","children","striped","filterValue","valueSelect","activeDescendant","handleOnChange","handleChangeLiSelected","isMultipleSelect","isMultipleDefault","isMultipleWithCheckboxes","hasRemoteSearch","useSelectFieldContext","t0","value","_","toString","valueToString","hasFocus","Boolean","t1","includes","ariaSelected","addOrRemove","undefined","t2","label","String","toLowerCase","hasPartOfFilter","t3","event","preventDefault","handleOnClickItem","t4","el","current","t5","hidden","t6","t7","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AAAL,UAAAqC,MAAArC,EAAA,EAAA,MAAAwC,MAAAxC,EAAA,EAAA,MAAA0C,MAAA1C,EAAA,EAAA,MAAA2C,IAAA;AA1CHG,SAAA,qBAAA,QACO,KAAAT,IAWD,IAAAvC,MAAKmB,OACD,QAAAuB,IACE,UAAA,IACH,OAAA1C,MAAK+B,OACA,cAAA/B,MAAK+B,OACFJ,iBAAAA,cACF,eAAAiB,IACExC,2BACK,sBAAAJ,MAAKmB,OACL,sBAAAnB,MAAK+B,OACLxB,sBAAAA,SACCgB,iCACAW,uBAAAA,iBACapB,oCAAAA,mBACGC,uCAAAA,0BACzB,eAAA,kCACP,MAAA,UACIuB,SAAAA,mBACI,aAAAW,OAAsC,GAC/CjD,OACH6C,UAAAA;AAAAA,MAAAA;AAAAA,MAWAvC;AAAAA,IAAAA,EAAAA,GAhCIN,MAAKmB,KAiCZ;AAAKjB,YAAAyB;AAAAzB,YAAAI;AAAAJ,YAAAE;AAAAF,YAAAoC;AAAApC,YAAAqB;AAAArB,YAAAgC;AAAAhC,YAAAY;AAAAZ,YAAAa;AAAAb,YAAAF;AAAAE,YAAAK;AAAAL,YAAAqC;AAAArC,YAAAwC;AAAAxC,YAAA0C;AAAA1C,YAAA2C;AAAA3C,YAAA8C;AAAAA,EAAA,OAAA;AAAAA,SAAA9C,EAAA,EAAA;AAAA,EAAA;AAAA,SA5CL8C;AA4CK,CAGX;AAEAlD,KAAKoD,cAAc;AA1EjB,SAAAD,MAAAE,SAAA;AAuDgCf,UAAKC,eAAAA;AAAiB;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
-
|
|
3
|
-
interface SelectFieldListBoxProps extends ComponentProps<'div'>, UseScrollEndReachedParams {
|
|
2
|
+
interface SelectFieldListBoxProps extends ComponentProps<'div'> {
|
|
4
3
|
dropdownMaxWidth?: number;
|
|
5
4
|
}
|
|
6
5
|
declare const ListBox: import('react').ForwardRefExoticComponent<Omit<SelectFieldListBoxProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import _ from "../../_virtual/lodash.js";
|
|
3
3
|
import { forwardRef, useState, useRef, useEffect } from "react";
|
|
4
|
-
import { useScrollEndReached } from "../../hooks/useScrollEndReached/index.js";
|
|
5
4
|
import { Search } from "./search.js";
|
|
6
5
|
import { useSelectFieldContext } from "./context.js";
|
|
7
6
|
const MAX_HEIGHT = 27 * 15 + 1;
|
|
@@ -9,9 +8,6 @@ const ListBox = forwardRef((props, ref) => {
|
|
|
9
8
|
const {
|
|
10
9
|
children,
|
|
11
10
|
dropdownMaxWidth,
|
|
12
|
-
onEndReached,
|
|
13
|
-
onEndReachedThreshold,
|
|
14
|
-
itemsCount,
|
|
15
11
|
...rest
|
|
16
12
|
} = props;
|
|
17
13
|
const {
|
|
@@ -70,12 +66,6 @@ const ListBox = forwardRef((props, ref) => {
|
|
|
70
66
|
window.removeEventListener("scroll", updatePosition, true);
|
|
71
67
|
};
|
|
72
68
|
}, [listBoxOpen, valueSelect, selectContainerRef]);
|
|
73
|
-
useScrollEndReached({
|
|
74
|
-
elementRef: listBoxRef,
|
|
75
|
-
onEndReached,
|
|
76
|
-
onEndReachedThreshold,
|
|
77
|
-
itemsCount
|
|
78
|
-
});
|
|
79
69
|
return /* @__PURE__ */ jsxs("div", { ref, style: listBoxStyles, "aria-expanded": listBoxOpen, className: "select-field-listbox", "data-testid": "test-select-field-listbox", "data-dropdown-max-width": dropdownMaxWidth, ...rest, children: [
|
|
80
70
|
shouldBeShowSearchInput && /* @__PURE__ */ jsx(Search, {}),
|
|
81
71
|
/* @__PURE__ */ jsxs("ul", { id: selectFieldId, role: "listbox", ref: listBoxRef, children: [
|