@economic/taco 2.30.0 → 2.30.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +4 -5
  2. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  3. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +9 -7
  4. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
  5. package/dist/esm/packages/taco/src/components/Select2/Select2.js +3 -1
  6. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  7. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +2 -2
  8. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  9. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +1 -1
  10. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  11. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +1 -1
  12. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  13. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +1 -1
  14. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  15. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +5 -4
  16. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  17. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  18. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +45 -12
  19. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  20. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +5 -5
  21. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  22. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +7 -3
  23. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  24. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +1 -2
  25. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  27. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  28. package/dist/esm/packages/taco/src/utils/dom.js +4 -1
  29. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  30. package/dist/primitives/Table/types.d.ts +6 -7
  31. package/dist/primitives/Table/useTableDataLoader.d.ts +5 -4
  32. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +2 -1
  33. package/dist/taco.cjs.development.js +85 -44
  34. package/dist/taco.cjs.development.js.map +1 -1
  35. package/dist/taco.cjs.production.min.js +1 -1
  36. package/dist/taco.cjs.production.min.js.map +1 -1
  37. package/dist/utils/dom.d.ts +1 -0
  38. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  import { useRef, useState, useMemo, useEffect } from 'react';
2
2
  import { useMergedRef } from '../../hooks/useMergedRef.js';
3
+ import { isElementInsideTable3OrReport } from '../../utils/dom.js';
3
4
  import { v4 } from 'uuid';
4
5
  import debounce from 'lodash-es/debounce';
5
6
  import { getId } from '../Listbox/ScrollableList.js';
@@ -131,9 +132,7 @@ const useCombobox = ({
131
132
  }
132
133
  };
133
134
  const handleInputKeyDown = event => {
134
- var _inputRef$current;
135
135
  event.persist();
136
- const insideTheTable = !!((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.closest('table, [role="rowgroup"]'));
137
136
  if (!event.ctrlKey && !event.metaKey) {
138
137
  switch (event.key) {
139
138
  case 'Backspace':
@@ -155,7 +154,7 @@ const useCombobox = ({
155
154
  }
156
155
  case 'Enter':
157
156
  {
158
- if (insideTheTable) {
157
+ if (isElementInsideTable3OrReport(event.currentTarget)) {
159
158
  event.preventDefault();
160
159
  if (inline && !open) {
161
160
  setOpen(true);
@@ -173,7 +172,7 @@ const useCombobox = ({
173
172
  if (open) {
174
173
  event.preventDefault();
175
174
  } else {
176
- if (!inline && buttonRef.current && !insideTheTable) {
175
+ if (!inline && buttonRef.current && !isElementInsideTable3OrReport(event.currentTarget)) {
177
176
  buttonRef.current.click();
178
177
  }
179
178
  }
@@ -193,7 +192,7 @@ const useCombobox = ({
193
192
  listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
194
193
  }
195
194
  if (inline && !open) {
196
- if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !insideTheTable) {
195
+ if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !isElementInsideTable3OrReport(event.currentTarget)) {
197
196
  event.preventDefault();
198
197
  const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;
199
198
  setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
@@ -1 +1 @@
1
- {"version":3,"file":"useCombobox.js","sources":["../../../../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport debounce from 'lodash/debounce';\nimport { ComboboxProps } from './Combobox';\nimport {\n setInputValueByRef,\n getIndexFromValue,\n findByValue,\n useFlattenedData,\n sanitizeItem,\n getOptionParents,\n filterData,\n} from '../Listbox/util';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\nimport { InputProps } from '../Input/Input';\n\nconst debouncer = debounce(f => f(), 200);\n\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\n\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\n combobox: React.HTMLAttributes<HTMLSpanElement>;\n input: Omit<InputProps, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\n list: ScrollableListPropsWithRef;\n button: { ref: any };\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n};\n\nexport const useCombobox = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data: unfilteredData = [],\n defaultValue,\n disabled,\n id: nativeId,\n inline,\n loading: __,\n onChange,\n onClick,\n onKeyDown,\n onSearch,\n readOnly,\n value,\n ...props\n }: Omit<ComboboxProps, 'dialog'>,\n ref: React.Ref<HTMLInputElement>\n): useCombobox => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const [open, setOpen] = React.useState(false);\n const listId = React.useMemo(() => uuid(), []);\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\n const flattenedData = useFlattenedData(unfilteredData);\n const data = React.useMemo(\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\n [shouldFilterData, inputValue, flattenedData]\n );\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\n );\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value, 'focusout');\n }\n }\n };\n\n const setCurrentValue = (index: number | undefined) => {\n if (index === undefined) {\n return;\n }\n\n const option = data[index];\n\n // if the selected option is not already selected, trigger blur event\n if (option.value !== value) {\n setInputValueByIndex(index);\n } else {\n // if the selected option is already selected, refill input with its value\n setInputValue(convertToInputValue(value));\n }\n };\n\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\n React.useEffect(() => {\n if (defaultValue && !value) {\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\n }\n }, [data]);\n\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\n React.useEffect(() => {\n if (value !== undefined && value !== inputValue) {\n setInputValue(convertToInputValue(value));\n }\n }, [value]);\n\n React.useEffect(() => {\n if (onSearch) {\n debouncer(() => {\n onSearch(inputValue);\n });\n }\n }, [inputValue]);\n\n // show listbox based on input value\n React.useEffect(() => {\n // don't show the popover if the internal (input) value already is the current value\n // this prevents the popover showing after selecting a value or pressing escape\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\n\n if (inputValue && data.length && !isCurrentValue) {\n setCurrentIndex(0);\n\n if (!open) {\n setOpen(true);\n }\n } else {\n setOpen(false);\n }\n }, [inputValue, data]);\n\n React.useEffect(() => {\n if (open) {\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\n } else {\n setCurrentIndex(undefined);\n }\n }, [open]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (listRef.current && event.relatedTarget === listRef.current) {\n event.preventDefault();\n return;\n }\n\n // event.target.value is always a string so it is important to cast value to a string before checking the equality\n if (onChange && event.target.value !== String(value)) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const parents = getOptionParents(flattenedData, item?.path);\n\n if (parents !== null && parents.length > 0) {\n (event as any).detail.parents = parents;\n }\n\n onChange(event);\n }\n\n if (props.onBlur) {\n props.onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInputValue(event.target.value);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n if (inline || (!open && inputValue && data.length)) {\n setOpen(true);\n }\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n event.persist();\n const insideTheTable = !!inputRef.current?.closest('table, [role=\"rowgroup\"]');\n\n if (!event.ctrlKey && !event.metaKey) {\n switch (event.key) {\n case 'Backspace': {\n return;\n }\n\n case 'Escape': {\n event.preventDefault();\n setInputValue(convertToInputValue(value));\n setOpen(false);\n return;\n }\n\n case 'Tab': {\n setCurrentValue(currentIndex);\n setOpen(false);\n return;\n }\n\n case 'Enter': {\n if (insideTheTable) {\n event.preventDefault();\n if (inline && !open) {\n setOpen(true);\n } else if (buttonRef.current && !open) {\n buttonRef.current.click();\n }\n }\n\n if (open) {\n setCurrentValue(currentIndex);\n setOpen(false);\n }\n\n return;\n }\n\n case 'ArrowDown':\n if (open) {\n event.preventDefault();\n } else {\n if (!inline && buttonRef.current && !insideTheTable) {\n buttonRef.current.click();\n }\n }\n break;\n\n case 'ArrowUp':\n case 'Home':\n case 'End': {\n if (open) {\n event.preventDefault();\n }\n break;\n }\n\n default:\n }\n\n // we aren't focused on the list, so manually forward the keydown event to it\n if (listRef.current) {\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\n }\n\n if (inline && !open) {\n if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !insideTheTable) {\n event.preventDefault();\n const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\n setOpen(true);\n }\n }\n }\n\n if (!event.isDefaultPrevented() && onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setCurrentIndex(index);\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\n event.preventDefault();\n setCurrentValue(index);\n setOpen(false);\n };\n\n const combobox = {\n 'aria-expanded': open,\n 'aria-owns': listId,\n 'aria-haspopup': 'listbox' as const,\n role: 'combobox',\n };\n\n const input = {\n ...props,\n 'aria-controls': listId,\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\n // are related to the string that is present in the textbox\n 'aria-autocomplete': 'list' as const,\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\n 'aria-activedescendant':\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\n 'aria-labelledby': ariaLabelledBy,\n disabled,\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\n readOnly,\n ref: inputRef,\n type: 'text',\n value: inputValue ?? '',\n };\n\n const list: ScrollableListPropsWithRef = {\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n id: listId,\n onChange: handleListboxChange,\n onClick: handleListboxClick,\n ref: listRef,\n scrollOnFocus: false,\n tabIndex: -1,\n value: currentIndex,\n };\n\n const button = {\n ref: buttonRef,\n };\n\n return {\n combobox,\n input,\n list,\n button,\n popover: {\n open,\n onOpenChange: setOpen,\n //visible: !data.length ? false : open,\n },\n };\n};\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useMergedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","insideTheTable","_inputRef$current","closest","ctrlKey","metaKey","key","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;AAkBA,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AAE,MAAM;IACZlF,KAAK,EAAE8B,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI;GACxB;EAED,MAAMqD,IAAI,GAA+B;IACrC,iBAAiB,EAAE/E,cAAc;IACjCC,IAAI;IACJG,QAAQ;IACRC,EAAE,EAAEmB,MAAM;IACVd,QAAQ,EAAE8D,mBAAmB;IAC7B7D,OAAO,EAAE8D,kBAAkB;IAC3BzD,GAAG,EAAEK,OAAO;IACZ2D,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,CAAC,CAAC;IACZrF,KAAK,EAAEoC;GACV;EAED,MAAMkD,MAAM,GAAG;IACXlE,GAAG,EAAEG;GACR;EAED,OAAO;IACHuD,QAAQ;IACRE,KAAK;IACLG,IAAI;IACJG,MAAM;IACNC,OAAO,EAAE;MACL7D,IAAI;MACJ8D,YAAY,EAAE7D;;GAGrB;AACL;;;;"}
1
+ {"version":3,"file":"useCombobox.js","sources":["../../../../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport debounce from 'lodash/debounce';\nimport { ComboboxProps } from './Combobox';\nimport {\n setInputValueByRef,\n getIndexFromValue,\n findByValue,\n useFlattenedData,\n sanitizeItem,\n getOptionParents,\n filterData,\n} from '../Listbox/util';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\nimport { InputProps } from '../Input/Input';\nimport { isElementInsideTable3OrReport } from '../../utils/dom';\n\nconst debouncer = debounce(f => f(), 200);\n\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\n\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\n combobox: React.HTMLAttributes<HTMLSpanElement>;\n input: Omit<InputProps, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\n list: ScrollableListPropsWithRef;\n button: { ref: any };\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n};\n\nexport const useCombobox = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data: unfilteredData = [],\n defaultValue,\n disabled,\n id: nativeId,\n inline,\n loading: __,\n onChange,\n onClick,\n onKeyDown,\n onSearch,\n readOnly,\n value,\n ...props\n }: Omit<ComboboxProps, 'dialog'>,\n ref: React.Ref<HTMLInputElement>\n): useCombobox => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const [open, setOpen] = React.useState(false);\n const listId = React.useMemo(() => uuid(), []);\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\n const flattenedData = useFlattenedData(unfilteredData);\n const data = React.useMemo(\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\n [shouldFilterData, inputValue, flattenedData]\n );\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\n );\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value, 'focusout');\n }\n }\n };\n\n const setCurrentValue = (index: number | undefined) => {\n if (index === undefined) {\n return;\n }\n\n const option = data[index];\n\n // if the selected option is not already selected, trigger blur event\n if (option.value !== value) {\n setInputValueByIndex(index);\n } else {\n // if the selected option is already selected, refill input with its value\n setInputValue(convertToInputValue(value));\n }\n };\n\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\n React.useEffect(() => {\n if (defaultValue && !value) {\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\n }\n }, [data]);\n\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\n React.useEffect(() => {\n if (value !== undefined && value !== inputValue) {\n setInputValue(convertToInputValue(value));\n }\n }, [value]);\n\n React.useEffect(() => {\n if (onSearch) {\n debouncer(() => {\n onSearch(inputValue);\n });\n }\n }, [inputValue]);\n\n // show listbox based on input value\n React.useEffect(() => {\n // don't show the popover if the internal (input) value already is the current value\n // this prevents the popover showing after selecting a value or pressing escape\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\n\n if (inputValue && data.length && !isCurrentValue) {\n setCurrentIndex(0);\n\n if (!open) {\n setOpen(true);\n }\n } else {\n setOpen(false);\n }\n }, [inputValue, data]);\n\n React.useEffect(() => {\n if (open) {\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\n } else {\n setCurrentIndex(undefined);\n }\n }, [open]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (listRef.current && event.relatedTarget === listRef.current) {\n event.preventDefault();\n return;\n }\n\n // event.target.value is always a string so it is important to cast value to a string before checking the equality\n if (onChange && event.target.value !== String(value)) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const parents = getOptionParents(flattenedData, item?.path);\n\n if (parents !== null && parents.length > 0) {\n (event as any).detail.parents = parents;\n }\n\n onChange(event);\n }\n\n if (props.onBlur) {\n props.onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInputValue(event.target.value);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n if (inline || (!open && inputValue && data.length)) {\n setOpen(true);\n }\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (!event.ctrlKey && !event.metaKey) {\n switch (event.key) {\n case 'Backspace': {\n return;\n }\n\n case 'Escape': {\n event.preventDefault();\n setInputValue(convertToInputValue(value));\n setOpen(false);\n return;\n }\n\n case 'Tab': {\n setCurrentValue(currentIndex);\n setOpen(false);\n return;\n }\n\n case 'Enter': {\n if (isElementInsideTable3OrReport(event.currentTarget)) {\n event.preventDefault();\n\n if (inline && !open) {\n setOpen(true);\n } else if (buttonRef.current && !open) {\n buttonRef.current.click();\n }\n }\n\n if (open) {\n setCurrentValue(currentIndex);\n setOpen(false);\n }\n\n return;\n }\n\n case 'ArrowDown':\n if (open) {\n event.preventDefault();\n } else {\n if (!inline && buttonRef.current && !isElementInsideTable3OrReport(event.currentTarget)) {\n buttonRef.current.click();\n }\n }\n break;\n\n case 'ArrowUp':\n case 'Home':\n case 'End': {\n if (open) {\n event.preventDefault();\n }\n break;\n }\n\n default:\n }\n\n // we aren't focused on the list, so manually forward the keydown event to it\n if (listRef.current) {\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\n }\n\n if (inline && !open) {\n if (\n (event.key === 'ArrowUp' || event.key === 'ArrowDown') &&\n !isElementInsideTable3OrReport(event.currentTarget)\n ) {\n event.preventDefault();\n const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\n setOpen(true);\n }\n }\n }\n\n if (!event.isDefaultPrevented() && onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setCurrentIndex(index);\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\n event.preventDefault();\n setCurrentValue(index);\n setOpen(false);\n };\n\n const combobox = {\n 'aria-expanded': open,\n 'aria-owns': listId,\n 'aria-haspopup': 'listbox' as const,\n role: 'combobox',\n };\n\n const input = {\n ...props,\n 'aria-controls': listId,\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\n // are related to the string that is present in the textbox\n 'aria-autocomplete': 'list' as const,\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\n 'aria-activedescendant':\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\n 'aria-labelledby': ariaLabelledBy,\n disabled,\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\n readOnly,\n ref: inputRef,\n type: 'text',\n value: inputValue ?? '',\n };\n\n const list: ScrollableListPropsWithRef = {\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n id: listId,\n onChange: handleListboxChange,\n onClick: handleListboxClick,\n ref: listRef,\n scrollOnFocus: false,\n tabIndex: -1,\n value: currentIndex,\n };\n\n const button = {\n ref: buttonRef,\n };\n\n return {\n combobox,\n input,\n list,\n button,\n popover: {\n open,\n onOpenChange: setOpen,\n //visible: !data.length ? false : open,\n },\n };\n};\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useMergedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","ctrlKey","metaKey","key","isElementInsideTable3OrReport","currentTarget","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;;AAmBA,MAAMA,SAAS,gBAAGC,QAAQ,CAACC,CAAC,IAAIA,CAAC,EAAE,EAAE,GAAG,CAAC;AAEzC,MAAMC,mBAAmB,GAA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IACJG,QAAQ;IACRC,EAAE,EAAEmB,MAAM;IACVd,QAAQ,EAAE6D,mBAAmB;IAC7B5D,OAAO,EAAE6D,kBAAkB;IAC3BxD,GAAG,EAAEK,OAAO;IACZ0D,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,CAAC,CAAC;IACZpF,KAAK,EAAEoC;GACV;EAED,MAAMiD,MAAM,GAAG;IACXjE,GAAG,EAAEG;GACR;EAED,OAAO;IACHsD,QAAQ;IACRE,KAAK;IACLG,IAAI;IACJG,MAAM;IACNC,OAAO,EAAE;MACL5D,IAAI;MACJ6D,YAAY,EAAE5D;;GAGrB;AACL;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { forwardRef, useEffect, createElement } from 'react';
2
2
  import { useMergedRef } from '../../../hooks/useMergedRef.js';
3
+ import { isElementInsideTable3OrReport } from '../../../utils/dom.js';
3
4
  import { createCustomKeyboardEvent } from '../../../utils/input.js';
4
5
  import { useCurrentMenu } from '../Context.js';
5
6
  import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
@@ -7,12 +8,13 @@ import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
7
8
  const Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
8
9
  const menu = useCurrentMenu();
9
10
  const internalRef = useMergedRef(ref);
10
- const preventArrowDownShortcut = event => {
11
- var _internalRef$current;
12
- const isRenderedInTable = !!((_internalRef$current = internalRef.current) !== null && _internalRef$current !== void 0 && _internalRef$current.closest('tbody'));
13
- if (isRenderedInTable && event.key === 'ArrowDown') {
14
- var _internalRef$current2, _internalRef$current3;
15
- internalRef === null || internalRef === void 0 ? void 0 : (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : (_internalRef$current3 = _internalRef$current2.parentNode) === null || _internalRef$current3 === void 0 ? void 0 : _internalRef$current3.dispatchEvent(createCustomKeyboardEvent(event));
11
+ const handleKeyDown = event => {
12
+ if (event.key === 'ArrowDown') {
13
+ if (isElementInsideTable3OrReport(event.currentTarget)) {
14
+ var _event$currentTarget$;
15
+ event.preventDefault();
16
+ (_event$currentTarget$ = event.currentTarget.parentNode) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.dispatchEvent(createCustomKeyboardEvent(event));
17
+ }
16
18
  }
17
19
  };
18
20
  useEffect(() => {
@@ -23,7 +25,7 @@ const Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
23
25
  return /*#__PURE__*/createElement(Trigger$1, Object.assign({}, props, {
24
26
  asChild: true,
25
27
  ref: internalRef,
26
- onKeyDown: preventArrowDownShortcut
28
+ onKeyDown: handleKeyDown
27
29
  }));
28
30
  });
29
31
 
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useCurrentMenu } from '../Context';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\n\nexport type MenuTriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children: React.ReactElement;\n};\n\nexport const Trigger = React.forwardRef(function MenuTrigger(props: MenuTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const menu = useCurrentMenu();\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n\n const preventArrowDownShortcut = (event: React.KeyboardEvent) => {\n const isRenderedInTable = !!internalRef.current?.closest('tbody');\n\n if (isRenderedInTable && event.key === 'ArrowDown') {\n internalRef?.current?.parentNode?.dispatchEvent(\n createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>)\n );\n }\n };\n\n React.useEffect(() => {\n if (internalRef.current) {\n menu?.setMinWidth(internalRef.current.getBoundingClientRect().width);\n }\n }, [internalRef]);\n\n return <DropdownMenuPrimitive.Trigger {...props} asChild ref={internalRef} onKeyDown={preventArrowDownShortcut} />;\n});\n"],"names":["Trigger","React","MenuTrigger","props","ref","menu","useCurrentMenu","internalRef","useMergedRef","preventArrowDownShortcut","event","isRenderedInTable","_internalRef$current","current","closest","key","_internalRef$current2","_internalRef$current3","parentNode","dispatchEvent","createCustomKeyboardEvent","setMinWidth","getBoundingClientRect","width","DropdownMenuPrimitive","asChild","onKeyDown"],"mappings":";;;;;;MAUaA,OAAO,gBAAGC,UAAgB,CAAC,SAASC,WAAWA,CAACC,KAAuB,EAAEC,GAAiC;EACnH,MAAMC,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAMC,WAAW,GAAGC,YAAY,CAAoBJ,GAAG,CAAC;EAExD,MAAMK,wBAAwB,GAAIC,KAA0B;;IACxD,MAAMC,iBAAiB,GAAG,CAAC,GAAAC,oBAAA,GAACL,WAAW,CAACM,OAAO,cAAAD,oBAAA,eAAnBA,oBAAA,CAAqBE,OAAO,CAAC,OAAO,CAAC;IAEjE,IAAIH,iBAAiB,IAAID,KAAK,CAACK,GAAG,KAAK,WAAW,EAAE;MAAA,IAAAC,qBAAA,EAAAC,qBAAA;MAChDV,WAAW,aAAXA,WAAW,wBAAAS,qBAAA,GAAXT,WAAW,CAAEM,OAAO,cAAAG,qBAAA,wBAAAC,qBAAA,GAApBD,qBAAA,CAAsBE,UAAU,cAAAD,qBAAA,uBAAhCA,qBAAA,CAAkCE,aAAa,CAC3CC,yBAAyB,CAACV,KAA8C,CAAC,CAC5E;;GAER;EAEDT,SAAe,CAAC;IACZ,IAAIM,WAAW,CAACM,OAAO,EAAE;MACrBR,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEgB,WAAW,CAACd,WAAW,CAACM,OAAO,CAACS,qBAAqB,EAAE,CAACC,KAAK,CAAC;;GAE3E,EAAE,CAAChB,WAAW,CAAC,CAAC;EAEjB,oBAAON,cAACuB,SAA6B,oBAAKrB,KAAK;IAAEsB,OAAO;IAACrB,GAAG,EAAEG,WAAW;IAAEmB,SAAS,EAAEjB;KAA4B;AACtH,CAAC;;;;"}
1
+ {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useCurrentMenu } from '../Context';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\nimport { isElementInsideTable3OrReport } from '../../../utils/dom';\n\nexport type MenuTriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children: React.ReactElement;\n};\n\nexport const Trigger = React.forwardRef(function MenuTrigger(props: MenuTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const menu = useCurrentMenu();\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n if (isElementInsideTable3OrReport(event.currentTarget)) {\n event.preventDefault();\n event.currentTarget.parentNode?.dispatchEvent(\n createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>)\n );\n }\n }\n };\n\n React.useEffect(() => {\n if (internalRef.current) {\n menu?.setMinWidth(internalRef.current.getBoundingClientRect().width);\n }\n }, [internalRef]);\n\n return <DropdownMenuPrimitive.Trigger {...props} asChild ref={internalRef} onKeyDown={handleKeyDown} />;\n});\n"],"names":["Trigger","React","MenuTrigger","props","ref","menu","useCurrentMenu","internalRef","useMergedRef","handleKeyDown","event","key","isElementInsideTable3OrReport","currentTarget","_event$currentTarget$","preventDefault","parentNode","dispatchEvent","createCustomKeyboardEvent","current","setMinWidth","getBoundingClientRect","width","DropdownMenuPrimitive","asChild","onKeyDown"],"mappings":";;;;;;;MAWaA,OAAO,gBAAGC,UAAgB,CAAC,SAASC,WAAWA,CAACC,KAAuB,EAAEC,GAAiC;EACnH,MAAMC,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAMC,WAAW,GAAGC,YAAY,CAAoBJ,GAAG,CAAC;EAExD,MAAMK,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,GAAG,KAAK,WAAW,EAAE;MAC3B,IAAIC,6BAA6B,CAACF,KAAK,CAACG,aAAa,CAAC,EAAE;QAAA,IAAAC,qBAAA;QACpDJ,KAAK,CAACK,cAAc,EAAE;QACtB,CAAAD,qBAAA,GAAAJ,KAAK,CAACG,aAAa,CAACG,UAAU,cAAAF,qBAAA,uBAA9BA,qBAAA,CAAgCG,aAAa,CACzCC,yBAAyB,CAACR,KAA8C,CAAC,CAC5E;;;GAGZ;EAEDT,SAAe,CAAC;IACZ,IAAIM,WAAW,CAACY,OAAO,EAAE;MACrBd,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEe,WAAW,CAACb,WAAW,CAACY,OAAO,CAACE,qBAAqB,EAAE,CAACC,KAAK,CAAC;;GAE3E,EAAE,CAACf,WAAW,CAAC,CAAC;EAEjB,oBAAON,cAACsB,SAA6B,oBAAKpB,KAAK;IAAEqB,OAAO;IAACpB,GAAG,EAAEG,WAAW;IAAEkB,SAAS,EAAEhB;KAAiB;AAC3G,CAAC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import React__default from 'react';
2
2
  import cn from 'clsx';
3
3
  import { useMergedRef } from '../../hooks/useMergedRef.js';
4
- import { getNextFocussableElement } from '../../utils/dom.js';
4
+ import { isElementInsideTable3OrReport, getNextFocussableElement } from '../../utils/dom.js';
5
5
  import { useLocalization } from '../Provider/Localization.js';
6
6
  import { Button } from '../Button/Button.js';
7
7
  import { Spinner } from '../Spinner/Spinner.js';
@@ -134,6 +134,8 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
134
134
  var _listboxRef$current;
135
135
  if (open) {
136
136
  event.preventDefault();
137
+ } else if (isElementInsideTable3OrReport(event.currentTarget)) {
138
+ return;
137
139
  } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {
138
140
  setOpen(true);
139
141
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName, getFontSize } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { isGroup, useChildren } from './hooks/useChildren';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement } from '../../utils/dom';\nimport { FontSize, FontSizes } from '../../types';\nimport { Button } from '../Button/Button';\nimport { Spinner } from '../Spinner/Spinner';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n selectAll: string;\n selectAllResults: string;\n deselectAll: string;\n deselectAllResults: string;\n};\n\ntype Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n /** Autofocus Select2 when loaded **/\n autoFocus?: boolean;\n /** Array of options in Select2 */\n children: Select2Children;\n /** Initial value of the input in Select2 */\n defaultValue?: Select2Value;\n /** Set what value should have an empty option in Select2 */\n emptyValue?: Select2OptionValue;\n /** Whether the Select2 is in a disabled state **/\n disabled?: boolean;\n /** Font size of text in Select2 **/\n fontSize?: FontSize;\n /** Draws attention to the Select2 by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Whether the Select2 is in an invalid state **/\n invalid?: boolean;\n /** Whether the Select2 is loading the data **/\n loading?: boolean;\n /** Whether the Select2 allows selecting multiple values **/\n multiple?: boolean;\n /** Whether the Select2 is in an invalid state **/\n name?: string;\n /** Handler called when user chooses an option from the provided options **/\n onChange?: (value: Select2Value) => void;\n /** Handler called when user creates a new option **/\n onCreate?: Select2CreateHandler;\n /** Handler called when user deletes an option **/\n onDelete?: Select2DeleteHandler;\n /** Handler called when user edits an option **/\n onEdit?: Select2EditHandler;\n /** Placeholder showed when nothing is selected **/\n placeholder?: string;\n /** Whether the Select2 is in a readonly state **/\n readOnly?: boolean;\n required?: boolean;\n /** Renders select options as tags **/\n tags?: boolean;\n /** Value of the input in select2 */\n value?: Select2Value;\n};\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n fontSize,\n highlighted = false,\n invalid = false,\n loading,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n placeholder,\n readOnly = false,\n tags = false,\n value: prop,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\n\n const { flattenedChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n shouldPauseHoverState,\n setShouldPauseHoverState,\n tags,\n fontSize,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\n }\n };\n\n const selectOptions =\n searchQuery === ''\n ? flattenedChildren.map(child => child.props.value)\n : filteredChildren\n .map(child =>\n isGroup(child)\n ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value)\n : child.props.value\n )\n .flatMap(c => c) || [];\n\n const areAllSelected = Array.isArray(value) && selectOptions.every(option => value.includes(option as string));\n\n const selectAllText = React.useMemo(() => {\n if (searchQuery === '') {\n if (areAllSelected) {\n return texts.select2.deselectAll;\n } else {\n return texts.select2.selectAll;\n }\n } else if (areAllSelected) {\n return texts.select2.deselectAllResults;\n } else {\n return texts.select2.selectAllResults;\n }\n }, [areAllSelected, searchQuery]);\n\n const selectAll = () => {\n if (!Array.isArray(value) || value.length === 0) {\n setValue(selectOptions);\n } else {\n // array of all available options which are not selected\n const preselectedValues = selectOptions.filter(option => !value.includes(option));\n setValue([...value, ...preselectedValues]);\n }\n };\n\n const deselectAll = () => {\n if (searchQuery === '') {\n setValue([]);\n } else {\n const nextValue = Array.isArray(value) && value.filter(subValue => !selectOptions.includes(subValue as string));\n setValue(nextValue);\n }\n };\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none\"', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={flattenedChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n ref={internalRef}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <>\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\n />\n {multiple && selectOptions.length > 1 && (\n <>\n <Button\n className=\"!justify-start\"\n appearance=\"discrete\"\n onClick={areAllSelected ? deselectAll : selectAll}>\n {selectAllText}\n </Button>\n <div className=\"border-grey-300 mx-3 rounded border-t\" />\n </>\n )}\n </>\n ) : null}\n {loading ? (\n <span className={cn('text-grey-700 flex items-center italic', fontSize && getFontSize(fontSize))}>\n <span>\n <Spinner\n delay={0}\n className={cn('ml-3 mr-2 mt-1.5 h-5 w-5', {\n '!mt-1 !h-3.5 !w-3.5': fontSize === FontSizes.small,\n '!h-4 !w-4': fontSize === FontSizes.medium,\n '!h-5 !w-5': fontSize === FontSizes.large,\n })}\n />\n </span>\n <span>{texts.listbox.loading}</span>\n </span>\n ) : flattenedChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\n {onCreate ? <Create onCreate={onCreate} options={flattenedChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","fontSize","highlighted","invalid","loading","multiple","name","onChange","onCreate","onDelete","onEdit","placeholder","readOnly","tags","value","prop","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","currentTarget","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","selectOptions","map","child","isGroup","Array","isArray","subChild","flatMap","c","areAllSelected","every","option","includes","selectAllText","select2","deselectAll","selectAll","deselectAllResults","selectAllResults","length","preselectedValues","filter","nextValue","subValue","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","Search","searchOrCreate","search","onTabKeyPress","Button","appearance","onClick","getFontSize","Spinner","delay","FontSizes","small","medium","large","listbox","role","customSelector","Collection","Create","Group","Title","isFormControl","useIsFormControl","bubbleValue","String","BubbleSelect","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqGMA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAkC,SAASF,OAAOA,CAACG,KAAK,EAAEC,GA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MAAM;MAAK,CACzD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACDxG,OAAO,CAACoK,WAAW,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName, getFontSize } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { isGroup, useChildren } from './hooks/useChildren';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement, isElementInsideTable3OrReport } from '../../utils/dom';\nimport { FontSize, FontSizes } from '../../types';\nimport { Button } from '../Button/Button';\nimport { Spinner } from '../Spinner/Spinner';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n selectAll: string;\n selectAllResults: string;\n deselectAll: string;\n deselectAllResults: string;\n};\n\ntype Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n /** Autofocus Select2 when loaded **/\n autoFocus?: boolean;\n /** Array of options in Select2 */\n children: Select2Children;\n /** Initial value of the input in Select2 */\n defaultValue?: Select2Value;\n /** Set what value should have an empty option in Select2 */\n emptyValue?: Select2OptionValue;\n /** Whether the Select2 is in a disabled state **/\n disabled?: boolean;\n /** Font size of text in Select2 **/\n fontSize?: FontSize;\n /** Draws attention to the Select2 by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Whether the Select2 is in an invalid state **/\n invalid?: boolean;\n /** Whether the Select2 is loading the data **/\n loading?: boolean;\n /** Whether the Select2 allows selecting multiple values **/\n multiple?: boolean;\n /** Whether the Select2 is in an invalid state **/\n name?: string;\n /** Handler called when user chooses an option from the provided options **/\n onChange?: (value: Select2Value) => void;\n /** Handler called when user creates a new option **/\n onCreate?: Select2CreateHandler;\n /** Handler called when user deletes an option **/\n onDelete?: Select2DeleteHandler;\n /** Handler called when user edits an option **/\n onEdit?: Select2EditHandler;\n /** Placeholder showed when nothing is selected **/\n placeholder?: string;\n /** Whether the Select2 is in a readonly state **/\n readOnly?: boolean;\n required?: boolean;\n /** Renders select options as tags **/\n tags?: boolean;\n /** Value of the input in select2 */\n value?: Select2Value;\n};\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n fontSize,\n highlighted = false,\n invalid = false,\n loading,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n placeholder,\n readOnly = false,\n tags = false,\n value: prop,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\n\n const { flattenedChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n shouldPauseHoverState,\n setShouldPauseHoverState,\n tags,\n fontSize,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (isElementInsideTable3OrReport(event.currentTarget)) {\n return;\n } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\n }\n };\n\n const selectOptions =\n searchQuery === ''\n ? flattenedChildren.map(child => child.props.value)\n : filteredChildren\n .map(child =>\n isGroup(child)\n ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value)\n : child.props.value\n )\n .flatMap(c => c) || [];\n\n const areAllSelected = Array.isArray(value) && selectOptions.every(option => value.includes(option as string));\n\n const selectAllText = React.useMemo(() => {\n if (searchQuery === '') {\n if (areAllSelected) {\n return texts.select2.deselectAll;\n } else {\n return texts.select2.selectAll;\n }\n } else if (areAllSelected) {\n return texts.select2.deselectAllResults;\n } else {\n return texts.select2.selectAllResults;\n }\n }, [areAllSelected, searchQuery]);\n\n const selectAll = () => {\n if (!Array.isArray(value) || value.length === 0) {\n setValue(selectOptions);\n } else {\n // array of all available options which are not selected\n const preselectedValues = selectOptions.filter(option => !value.includes(option));\n setValue([...value, ...preselectedValues]);\n }\n };\n\n const deselectAll = () => {\n if (searchQuery === '') {\n setValue([]);\n } else {\n const nextValue = Array.isArray(value) && value.filter(subValue => !selectOptions.includes(subValue as string));\n setValue(nextValue);\n }\n };\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none\"', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={flattenedChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n ref={internalRef}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <>\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\n />\n {multiple && selectOptions.length > 1 && (\n <>\n <Button\n className=\"!justify-start\"\n appearance=\"discrete\"\n onClick={areAllSelected ? deselectAll : selectAll}>\n {selectAllText}\n </Button>\n <div className=\"border-grey-300 mx-3 rounded border-t\" />\n </>\n )}\n </>\n ) : null}\n {loading ? (\n <span className={cn('text-grey-700 flex items-center italic', fontSize && getFontSize(fontSize))}>\n <span>\n <Spinner\n delay={0}\n className={cn('ml-3 mr-2 mt-1.5 h-5 w-5', {\n '!mt-1 !h-3.5 !w-3.5': fontSize === FontSizes.small,\n '!h-4 !w-4': fontSize === FontSizes.medium,\n '!h-5 !w-5': fontSize === FontSizes.large,\n })}\n />\n </span>\n <span>{texts.listbox.loading}</span>\n </span>\n ) : flattenedChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\n {onCreate ? <Create onCreate={onCreate} options={flattenedChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","fontSize","highlighted","invalid","loading","multiple","name","onChange","onCreate","onDelete","onEdit","placeholder","readOnly","tags","value","prop","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","isElementInsideTable3OrReport","currentTarget","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","selectOptions","map","child","isGroup","Array","isArray","subChild","flatMap","c","areAllSelected","every","option","includes","selectAllText","select2","deselectAll","selectAll","deselectAllResults","selectAllResults","length","preselectedValues","filter","nextValue","subValue","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","Search","searchOrCreate","search","onTabKeyPress","Button","appearance","onClick","getFontSize","Spinner","delay","FontSizes","small","medium","large","listbox","role","customSelector","Collection","Create","Group","Title","isFormControl","useIsFormControl","bubbleValue","String","BubbleSelect","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqGMA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAkC,SAASF,OAAOA,CAACG,KAAK,EAAEC,GAAG;EACzF,MAAM;IACFC,QAAQ,EAAEC,YAAY;IACtBC,YAAY,EAAEC,WAAW;IACzBC,QAAQ,GAAG,KAAK;IAChBC,UAAU,GAAGC,SAAS;IACtBC,QAAQ;IACRC,WAAW,GAAG,KAAK;IACnBC,OAAO,GAAG,KAAK;IACfC,OAAO;IACPC,QAAQ,GAAG,KAAK;IAChBC,IAAI;IACJC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,MAAM;IACNC,WAAW;IACXC,QAAQ,GAAG,KAAK;IAChBC,IAAI,GAAG,KAAK;IACZC,KAAK,EAAEC,IAAI;IACX,GAAGC;GACN,GAAGxB,KAAK;EAET,MAAMyB,WAAW,GAAuD3B,cAAK,CAAC4B,OAAO,CAAC;IAClF,IAAInB,UAAU,KAAKC,SAAS,IAAI,CAACK,QAAQ,EAAE;;MAEvC,oBAAOf,6BAAC6B,MAAM;QAACC,GAAG,EAAC,SAAS;QAAC1B,QAAQ,EAAC,EAAE;QAACoB,KAAK,EAAEf,UAAU;QAAEsB,SAAS,EAAC;QAAQ;;IAElF;GACH,EAAE,CAACtB,UAAU,EAAEM,QAAQ,CAAC,CAAC;EAE1B,MAAMiB,eAAe,GAAGhC,cAAK,CAAC4B,OAAO,CAAC;IAClC,IAAID,WAAW,EAAE;MACb,OAAO,CAACA,WAAW,EAAE,GAAGtB,YAAY,CAAoB;;IAE5D,OAAOA,YAAY;GACtB,EAAE,CAACsB,WAAW,EAAEtB,YAAY,CAAC,CAAC;;EAG/B,MAAM4B,WAAW,GAAGC,YAAY,CAAoB/B,GAAG,CAAC;EACxD,MAAMgC,UAAU,GAAGnC,cAAK,CAACoC,MAAM,CAAgB,IAAI,C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AAQ;MAAEC,IAAI,EAAEA,IAAI;MAAEQ,KAAK,EAAEyI;OACtFxJ,UAAU,KAAKC,SAAS,gBAAGV;MAAQwB,KAAK,EAAEf;MAAc,GAAG,IAAI,EAC/DmH,OAAO,CAAC9B,GAAG,CAACU,MAAM,mBACfxG;MAAQ8B,GAAG,EAAEoI,MAAM,CAAC1D,MAAM,CAAC;MAAEhF,KAAK,EAAE0I,MAAM,CAAC1D,MAAM;MAAK,CACzD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACDzG,OAAO,CAACqK,WAAW,GAAG,SAAS;;;;"}
@@ -28,7 +28,7 @@ function Header(context) {
28
28
  const _temp = function () {
29
29
  if (tableMeta.server.loadAllIfNeeded) {
30
30
  // don't pass the search query because we need all data - not filtered data
31
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
31
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
32
32
  }
33
33
  }();
34
34
  // load all data if that is possible
@@ -102,7 +102,7 @@ function Cell(context) {
102
102
  const _temp3 = function () {
103
103
  if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
104
104
  // don't pass the search query because we need all data - not filtered data
105
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
105
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
106
106
  }
107
107
  }();
108
108
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
@@ -1 +1 @@
1
- {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../../../../components/RadioGroup/util';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button className={className} aria-checked={isSelected} onClick={handleClick} role=\"radio\" type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","undefined","then","_temp2","e","reject","React","Tooltip","Checkbox","className","key","String","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","_temp7","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;;;AAiBA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIH,KAAK,CAACE,OAAO,CAACE,uBAAuB,EAAE;IACvC,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,oBAAoB,EAAE;IACtD,MAAMC,kBAAkB,GAAGP,KAAK,CAACQ,qBAAqB,EAAE;IACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGP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;IACVI,eAAe,EAAE;;;;;;"}
1
+ {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../../../../components/RadioGroup/util';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button className={className} aria-checked={isSelected} onClick={handleClick} role=\"radio\" type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","then","_temp2","e","reject","React","Tooltip","Checkbox","className","key","String","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","undefined","_temp7","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;;;AAiBA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,I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M,EAAErG,MAAM;EACdoG,QAAQ,EAAElD,IAAI;EACdoD,IAAI,EAAE,EAAE;EACR/F,IAAI,EAAE;IACFgG,KAAK,EAAE,QAAQ;IACfnE,SAAS,EAAE,OAAO;;IAElBoE,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
@@ -37,7 +37,7 @@ function RowWithServerLoading(props) {
37
37
  React__default.useEffect(() => {
38
38
  if (inView) {
39
39
  var _tableMeta$server$loa, _tableMeta$server;
40
- (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters, table.getState().globalFilter);
40
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters);
41
41
  }
42
42
  }, [inView]);
43
43
  const groupedCellCount = (_table$getState$group = (_table$getState = table.getState()) === null || _table$getState === void 0 ? void 0 : _table$getState.grouping.length) !== null && _table$getState$group !== void 0 ? _table$getState$group : 0;
@@ -1 +1 @@
1
- {"version":3,"file":"SkeletonRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport { useInView } from 'react-intersection-observer';\n\nexport type RowProps<TType = unknown> = {\n index: number;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\nexport function SkeletonRow<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (tableMeta.server.isEnabled) {\n return <RowWithServerLoading {...props} index={index} />;\n }\n\n return <Skeleton cellsCount={row.getVisibleCells().length} />;\n}\n\nfunction RowWithServerLoading<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const pageIndex = (Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize) / tableMeta.server.pageSize;\n\n const { ref, inView } = useInView({\n threshold: 0,\n triggerOnce: true,\n initialInView: pageIndex === 0,\n });\n\n React.useEffect(() => {\n if (inView) {\n tableMeta.server.loadPage?.(\n pageIndex,\n table.getState().sorting,\n table.getState().columnFilters,\n table.getState().globalFilter\n );\n }\n }, [inView]);\n\n const groupedCellCount = table.getState()?.grouping.length ?? 0;\n const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;\n\n return <Skeleton cellsCount={ungroupedCellCount} ref={ref} />;\n}\n\nconst Skeleton = React.forwardRef(function Skeleton(props: { cellsCount: number }, ref: React.Ref<HTMLTableRowElement>) {\n const { cellsCount } = props;\n\n return (\n <tr ref={ref}>\n {Array(cellsCount)\n .fill(null)\n .map((_, index) => (\n <td key={index}>\n <span className=\"bg-grey-100 text-grey-700 h-4 w-full text-center text-xs\" />\n </td>\n ))}\n </tr>\n );\n});\n"],"names":["SkeletonRow","props","index","row","table","tableMeta","options","meta","server","isEnabled","React","RowWithServerLoading","Skeleton","cellsCount","getVisibleCells","length","pageIndex","Math","floor","pageSize","ref","inView","useInView","threshold","triggerOnce","initialInView","useEffect","_tableMeta$server$loa","_tableMeta$server","loadPage","call","getState","sorting","columnFilters","globalFilter","groupedCellCount","_table$getState$group","_table$getState","grouping","ungroupedCellCount","forwardRef","Array","fill","map","_","key","className"],"mappings":";;;SAUgBA,WAAWA,CAAkBC,KAAsB;EAC/D,MAAM;IAAEC,KAAK;IAAEC,GAAG;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIF,SAAS,CAACG,MAAM,CAACC,SAAS,EAAE;IAC5B,oBAAOC,6BAACC,oBAA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A,GAAI,CAAC;EAC/D,MAAMG,kBAAkB,GAAGpC,GAAG,CAACW,eAAe,EAAE,CAACC,MAAM,GAAGoB,gBAAgB;EAE1E,oBAAOzB,6BAACE,QAAQ;IAACC,UAAU,EAAE0B,kBAAkB;IAAEnB,GAAG,EAAEA;IAAO;AACjE;AAEA,MAAMR,QAAQ,gBAAGF,cAAK,CAAC8B,UAAU,CAAC,SAAS5B,QAAQA,CAACX,KAA6B,EAAEmB,GAAmC;EAClH,MAAM;IAAEP;GAAY,GAAGZ,KAAK;EAE5B,oBACIS;IAAIU,GAAG,EAAEA;KACJqB,KAAK,CAAC5B,UAAU,CAAC,CACb6B,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,CAACC,CAAC,EAAE1C,KAAK,oBACVQ;IAAImC,GAAG,EAAE3C;kBACLQ;IAAMoC,SAAS,EAAC;IAA6D,CAC5E,CACR,CAAC,CACL;AAEb,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"SkeletonRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport { useInView } from 'react-intersection-observer';\n\nexport type RowProps<TType = unknown> = {\n index: number;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\nexport function SkeletonRow<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (tableMeta.server.isEnabled) {\n return <RowWithServerLoading {...props} index={index} />;\n }\n\n return <Skeleton cellsCount={row.getVisibleCells().length} />;\n}\n\nfunction RowWithServerLoading<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const pageIndex = (Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize) / tableMeta.server.pageSize;\n\n const { ref, inView } = useInView({\n threshold: 0,\n triggerOnce: true,\n initialInView: pageIndex === 0,\n });\n\n React.useEffect(() => {\n if (inView) {\n tableMeta.server.loadPage?.(pageIndex, table.getState().sorting, table.getState().columnFilters);\n }\n }, [inView]);\n\n const groupedCellCount = table.getState()?.grouping.length ?? 0;\n const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;\n\n return <Skeleton cellsCount={ungroupedCellCount} ref={ref} />;\n}\n\nconst Skeleton = React.forwardRef(function Skeleton(props: { cellsCount: number }, ref: React.Ref<HTMLTableRowElement>) {\n const { cellsCount } = props;\n\n return (\n <tr ref={ref}>\n {Array(cellsCount)\n .fill(null)\n .map((_, index) => (\n <td key={index}>\n <span className=\"bg-grey-100 text-grey-700 h-4 w-full text-center text-xs\" />\n </td>\n ))}\n </tr>\n );\n});\n"],"names":["SkeletonRow","props","index","row","table","tableMeta","options","meta","server","isEnabled","React","RowWithServerLoading","Skeleton","cellsCount","getVisibleCells","length","pageIndex","Math","floor","pageSize","ref","inView","useInView","threshold","triggerOnce","initialInView","useEffect","_tableMeta$server$loa","_tableMeta$server","loadPage","call","getState","sorting","columnFilters","groupedCellCount","_table$getState$group","_table$getState","grouping","ungroupedCellCount","forwardRef","Array","fill","map","_","key","className"],"mappings":";;;SAUgBA,WAAWA,CAAkBC,KAAsB;EAC/D,MAAM;IAAEC,KAAK;IAAEC,GAAG;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIF,SAAS,CAACG,MAAM,CAACC,SAAS,EAAE;IAC5B,oBAAOC,6BAACC,oBAAoB,oBAAKV,KAAK;MAAEC,KAAK,EAAEA;OAAS;;EAG5D,oBAAOQ,6BAACE,QAAQ;IAACC,UAAU,EAAEV,GAAG,CAACW,eAAe,EAAE,CAACC;IAAU;AACjE;AAEA,SAASJ,oBAAoBA,CAAkBV,KAAsB;;EACjE,MAAM;IAAEC,KAAK;IAAEC,GAAG;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QA,CAACX,KAA6B,EAAEmB,GAAmC;EAClH,MAAM;IAAEP;GAAY,GAAGZ,KAAK;EAE5B,oBACIS;IAAIU,GAAG,EAAEA;KACJoB,KAAK,CAAC3B,UAAU,CAAC,CACb4B,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,CAACC,CAAC,EAAEzC,KAAK,oBACVQ;IAAIkC,GAAG,EAAE1C;kBACLQ;IAAMmC,SAAS,EAAC;IAA6D,CAC5E,CACR,CAAC,CACL;AAEb,CAAC,CAAC;;;;"}
@@ -77,7 +77,7 @@ function Print(props) {
77
77
  const _temp2 = function () {
78
78
  if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
79
79
  const _temp = _catch(function () {
80
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
80
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
81
81
  }, function (error) {
82
82
  const errorMessage = `${texts.table.print.error}: ${error}`;
83
83
  console.error(errorMessage);
@@ -1 +1 @@
1
- {"version":3,"file":"Print.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Print/Print.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../../components/IconButton/IconButton';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { useToast } from '../../../../../../../components/Toast/Toaster';\nimport { TableRef } from '../../../../../types';\nimport { PrintDialog } from './PrintDialog';\nimport { Shortcut } from '../../../../../../../components/Shortcut/Shortcut';\n\nexport type PrintProps<TType = unknown> = {\n table: ReactTable<TType>;\n tableId: string;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Print<TType = unknown>(props: PrintProps<TType>) {\n const { table, tableId, tableRef } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const lastScrollTopRef = React.useRef<number>();\n const toast = useToast();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const { allRows, orientation, size, splitGroups } = tableMeta.printing.settings;\n\n const togglePrinting = React.useCallback(\n enabled => {\n tableMeta.printing.setIsPrinting(enabled);\n\n if (tableRef.current) {\n if (enabled) {\n lastScrollTopRef.current = tableRef.current.scrollTop;\n } else if (lastScrollTopRef.current !== undefined) {\n tableRef.current.scrollTop = lastScrollTopRef.current;\n lastScrollTopRef.current = undefined;\n }\n }\n },\n [tableRef.current]\n );\n\n React.useEffect(() => {\n const afterPrint = () => {\n togglePrinting(false);\n };\n\n window.addEventListener('afterprint', afterPrint);\n\n return () => {\n window.removeEventListener('afterprint', afterPrint);\n };\n }, []);\n\n const print = async () => {\n const toastRef = toast.loading(texts.table.print.loading);\n\n if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {\n try {\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n } catch (error) {\n const errorMessage = `${texts.table.print.error}: ${error}`;\n console.error(errorMessage);\n toastRef.error(errorMessage);\n }\n }\n\n // this might close immediately if the dataset is small - this is okay\n toastRef.close();\n\n // use a timeout to let the toast close, otherwise it freezes mid animation when the print dialog opens\n setTimeout(() => {\n // do this here because Safari doesn't support the beforeprint event\n togglePrinting(true);\n\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n if (isSafari) {\n try {\n // Try using document.execCommand for printing in Safari\n document.execCommand('print', false, undefined);\n } catch (error) {\n // If document.execCommand fails or throws an error, fallback to window.print()\n window.print();\n }\n } else {\n // Execute window.print() for all other browsers\n window.print();\n }\n });\n });\n }, 150);\n };\n\n const printStyle = [`@page { size: ${size} ${orientation}; }`];\n\n if (!allRows) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr:not([data-row-selected=\"true\"]) { display: none; }`);\n }\n\n if (splitGroups) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr[data-row-group]:not(:first-child) { break-before: page; }`);\n }\n\n const shortcut = { key: 'p', meta: true, shift: false };\n const tooltip = (\n <>\n {texts.table.print.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n );\n\n return (\n <>\n <style media=\"print\">{printStyle.join('\\n')}</style>\n <IconButton\n icon=\"print\"\n aria-label={texts.table.print.tooltip}\n dialog={dialogProps => (\n <PrintDialog\n {...dialogProps}\n table={table}\n onAccept={print}\n orientation={orientation}\n setOrientation={value => tableMeta.printing.setSetting('orientation', value)}\n size={size}\n setSize={value => tableMeta.printing.setSetting('size', value)}\n allRows={allRows}\n setAllRows={value => tableMeta.printing.setSetting('allRows', value)}\n splitGroups={splitGroups}\n setSplitGroups={value => tableMeta.printing.setSetting('splitGroups', value)}\n />\n )}\n ref={ref}\n shortcut={shortcut}\n tooltip={tooltip}\n />\n </>\n );\n}\n"],"names":["Print","props","table","tableId","tableRef","texts","useLocalization","ref","React","useRef","lastScrollTopRef","toast","useToast","tableMeta","options","meta","allRows","orientation","size","splitGroups","printing","settings","togglePrinting","useCallback","enabled","setIsPrinting","current","scrollTop","undefined","useEffect","afterPrint","window","addEventListener","removeEventListener","print","toastRef","close","setTimeout","requestAnimationFrame","isSafari","test","navigator","userAgent","document","execCommand","error","loading","_temp2","server","isEnabled","loadAllIfNeeded","_temp","_catch","Promise","resolve","getState","sorting","columnFilters","then","errorMessage","console","_temp3","e","reject","printStyle","push","shortcut","key","shift","tooltip","Shortcut","className","keys","media","join","IconButton","icon","dialog","dialogProps","PrintDialog","onAccept","setOrientation","value","setSetting","setSize","setAllRows","setSplitGroups"],"mappings":";;;;;;;;SAegBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAU,GAAGH,KAAK;EAC1C,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAA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,QAAQ,CAAC+D,UAAU,CAAC,aAAa,EAAED,KAAK;OAC7E,CACL;IACD3E,GAAG,EAAEA,GAAG;IACR2D,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;IACX,CACH;AAEX;;;;"}
1
+ {"version":3,"file":"Print.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Print/Print.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../../components/IconButton/IconButton';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { useToast } from '../../../../../../../components/Toast/Toaster';\nimport { TableRef } from '../../../../../types';\nimport { PrintDialog } from './PrintDialog';\nimport { Shortcut } from '../../../../../../../components/Shortcut/Shortcut';\n\nexport type PrintProps<TType = unknown> = {\n table: ReactTable<TType>;\n tableId: string;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Print<TType = unknown>(props: PrintProps<TType>) {\n const { table, tableId, tableRef } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const lastScrollTopRef = React.useRef<number>();\n const toast = useToast();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const { allRows, orientation, size, splitGroups } = tableMeta.printing.settings;\n\n const togglePrinting = React.useCallback(\n enabled => {\n tableMeta.printing.setIsPrinting(enabled);\n\n if (tableRef.current) {\n if (enabled) {\n lastScrollTopRef.current = tableRef.current.scrollTop;\n } else if (lastScrollTopRef.current !== undefined) {\n tableRef.current.scrollTop = lastScrollTopRef.current;\n lastScrollTopRef.current = undefined;\n }\n }\n },\n [tableRef.current]\n );\n\n React.useEffect(() => {\n const afterPrint = () => {\n togglePrinting(false);\n };\n\n window.addEventListener('afterprint', afterPrint);\n\n return () => {\n window.removeEventListener('afterprint', afterPrint);\n };\n }, []);\n\n const print = async () => {\n const toastRef = toast.loading(texts.table.print.loading);\n\n if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {\n try {\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n } catch (error) {\n const errorMessage = `${texts.table.print.error}: ${error}`;\n console.error(errorMessage);\n toastRef.error(errorMessage);\n }\n }\n\n // this might close immediately if the dataset is small - this is okay\n toastRef.close();\n\n // use a timeout to let the toast close, otherwise it freezes mid animation when the print dialog opens\n setTimeout(() => {\n // do this here because Safari doesn't support the beforeprint event\n togglePrinting(true);\n\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n if (isSafari) {\n try {\n // Try using document.execCommand for printing in Safari\n document.execCommand('print', false, undefined);\n } catch (error) {\n // If document.execCommand fails or throws an error, fallback to window.print()\n window.print();\n }\n } else {\n // Execute window.print() for all other browsers\n window.print();\n }\n });\n });\n }, 150);\n };\n\n const printStyle = [`@page { size: ${size} ${orientation}; }`];\n\n if (!allRows) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr:not([data-row-selected=\"true\"]) { display: none; }`);\n }\n\n if (splitGroups) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr[data-row-group]:not(:first-child) { break-before: page; }`);\n }\n\n const shortcut = { key: 'p', meta: true, shift: false };\n const tooltip = (\n <>\n {texts.table.print.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n );\n\n return (\n <>\n <style media=\"print\">{printStyle.join('\\n')}</style>\n <IconButton\n icon=\"print\"\n aria-label={texts.table.print.tooltip}\n dialog={dialogProps => (\n <PrintDialog\n {...dialogProps}\n table={table}\n onAccept={print}\n orientation={orientation}\n setOrientation={value => tableMeta.printing.setSetting('orientation', value)}\n size={size}\n setSize={value => tableMeta.printing.setSetting('size', value)}\n allRows={allRows}\n setAllRows={value => tableMeta.printing.setSetting('allRows', value)}\n splitGroups={splitGroups}\n setSplitGroups={value => tableMeta.printing.setSetting('splitGroups', value)}\n />\n )}\n ref={ref}\n shortcut={shortcut}\n tooltip={tooltip}\n />\n </>\n );\n}\n"],"names":["Print","props","table","tableId","tableRef","texts","useLocalization","ref","React","useRef","lastScrollTopRef","toast","useToast","tableMeta","options","meta","allRows","orientation","size","splitGroups","printing","settings","togglePrinting","useCallback","enabled","setIsPrinting","current","scrollTop","undefined","useEffect","afterPrint","window","addEventListener","removeEventListener","print","toastRef","close","setTimeout","requestAnimationFrame","isSafari","test","navigator","userAgent","document","execCommand","error","loading","_temp2","server","isEnabled","loadAllIfNeeded","_temp","_catch","Promise","resolve","getState","sorting","columnFilters","then","errorMessage","console","_temp3","e","reject","printStyle","push","shortcut","key","shift","tooltip","Shortcut","className","keys","media","join","IconButton","icon","dialog","dialogProps","PrintDialog","onAccept","setOrientation","value","setSetting","setSize","setAllRows","setSplitGroups"],"mappings":";;;;;;;;SAegBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAU,GAAGH,KAAK;EAC1C,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,gBAAgB,GAAGF,cAAK,CAACC,MAAM,EAAU;EAC/C,MAAME,KAAK,GAAGC,QAAQ,EAAE;EACxB,MAAMC,SAAS,GAAGX,KAAK,CAACY,OAAO,CAACC,IAA6B;EAC7D,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,IAAI;IAAEC;GAAa,GAAGN,SAAS,CAACO,QAAQ,CAACC,QAAQ;EAE/E,MAAMC,cAAc,GAAGd,cAAK,CAACe,WAAW,CACpCC,OAAO;IACHX,SAAS,CAACO,QAAQ,CAACK,aAAa,CAACD,OAAO,CAAC;IAEzC,IAAIpB,QAAQ,CAACsB,OAAO,EAAE;MAClB,IAAIF,OAAO,EAAE;QACTd,gBAAgB,CAACgB,OAAO,GAAGtB,QAAQ,CAACsB,OAAO,CAACC,SAAS;OACxD,MAAM,IAAIjB,gBA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AAS,eACpDlE,6BAACmE,UAAU;IACPC,IAAI,EAAC,OAAO;kBACAvE,KAAK,CAACH,KAAK,CAACgC,KAAK,CAACmC,OAAO;IACrCQ,MAAM,EAAEC,WAAW,mBACftE,6BAACuE,WAAW,oBACJD,WAAW;MACf5E,KAAK,EAAEA,KAAK;MACZ8E,QAAQ,EAAE9C,KAAK;MACfjB,WAAW,EAAEA,WAAW;MACxBgE,cAAc,EAAEC,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,aAAa,EAAED,KAAK,CAAC;MAC5EhE,IAAI,EAAEA,IAAI;MACVkE,OAAO,EAAEF,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,MAAM,EAAED,KAAK,CAAC;MAC9DlE,OAAO,EAAEA,OAAO;MAChBqE,UAAU,EAAEH,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,SAAS,EAAED,KAAK,CAAC;MACpE/D,WAAW,EAAEA,WAAW;MACxBmE,cAAc,EAAEJ,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,aAAa,EAAED,KAAK;OAC7E,CACL;IACD3E,GAAG,EAAEA,GAAG;IACR2D,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;IACX,CACH;AAEX;;;;"}
@@ -30,7 +30,7 @@ function Search(props) {
30
30
  const _temp = function () {
31
31
  if (tableMeta.server.loadAllIfNeeded) {
32
32
  // don't pass the search query because we need all data - not filtered data
33
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
33
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
34
34
  }
35
35
  }();
36
36
  // load all data if that is possible