@economic/taco 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -180,7 +180,9 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
180
180
  setFocused(false);
181
181
  };
182
182
  return /*#__PURE__*/React__default.createElement("div", {
183
- className: "relative [&_[data-taco='input-container']]:z-20",
183
+ className: cn('relative', {
184
+ "[&_[data-taco='input-container']]:z-20": focused
185
+ }),
184
186
  onBlur: handleSettingsBlur,
185
187
  ref: settingsRef
186
188
  }, input, focused ? /*#__PURE__*/React__default.createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n onSearch: (value: string) => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n onSearch: handleSearch,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const settingsRef = React.useRef<HTMLDivElement>(null);\n const [internalValue, setInternalValue] = React.useState(value ?? '');\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const isSynced = internalValue === value;\n const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleSubmit = () => {\n handleSearch(internalValue);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // trigger searches when leaving the field\n handleSubmit();\n\n if (\n settingsRef.current &&\n (settingsRef.current === event.relatedTarget || settingsRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleChange = event => {\n setInternalValue(event.target.value);\n\n if (!event.target.value) {\n handleClear();\n }\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.focus());\n setInternalValue('');\n handleSearch('');\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n attributes.onFocus?.(event);\n setFocused(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive && isSynced) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n } else {\n handleSearch(internalValue);\n }\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (internalValue || focused)) {\n if (internalValue) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2\">\n {findCurrent ?? 0}/{findTotal ?? 0}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !internalValue) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n 'peer !pl-7',\n hasFind\n ? {\n '!w-48': !internalValue && !focused,\n '!w-72': internalValue || focused,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={\n <IconButton\n aria-label={texts.searchInput.button}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n disabled={attributes.disabled || attributes.readOnly}\n icon=\"search\"\n onMouseDown={handleSubmit}\n tabIndex={-1}\n tooltip={\n focused && !isSynced ? (\n <>\n {texts.searchInput.button} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.button\n )\n }\n />\n }\n postfix={postfix}\n ref={internalRef}\n value={internalValue}\n />\n );\n\n if (settingsContent) {\n const handleSettingsBlur = event => {\n if (event.currentTarget.contains(event.relatedTarget)) {\n return;\n }\n setFocused(false);\n };\n\n return (\n <div className=\"relative [&_[data-taco='input-container']]:z-20\" onBlur={handleSettingsBlur} ref={settingsRef}>\n {input}\n {focused ? (\n <div\n className=\"border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow\"\n onClickCapture={() => internalRef.current?.focus()}\n tabIndex={-1}>\n {settingsContent}\n </div>\n ) : null}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","onSearch","handleSearch","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","settingsRef","useRef","internalValue","setInternalValue","useState","focused","setFocused","texts","useLocalization","isActive","length","isSynced","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","preventDefault","focus","handleSubmit","handleBlur","relatedTarget","contains","onBlur","handleChange","target","handleClear","requestAnimationFrame","handleFocus","onFocus","handleKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","findPrevious","shift","findNext","onClickCapture","cn","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O6D,KAAK;AAChB,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n onSearch: (value: string) => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n onSearch: handleSearch,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const settingsRef = React.useRef<HTMLDivElement>(null);\n const [internalValue, setInternalValue] = React.useState(value ?? '');\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const isSynced = internalValue === value;\n const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleSubmit = () => {\n handleSearch(internalValue);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // trigger searches when leaving the field\n handleSubmit();\n\n if (\n settingsRef.current &&\n (settingsRef.current === event.relatedTarget || settingsRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleChange = event => {\n setInternalValue(event.target.value);\n\n if (!event.target.value) {\n handleClear();\n }\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.focus());\n setInternalValue('');\n handleSearch('');\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n attributes.onFocus?.(event);\n setFocused(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive && isSynced) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n } else {\n handleSearch(internalValue);\n }\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (internalValue || focused)) {\n if (internalValue) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2\">\n {findCurrent ?? 0}/{findTotal ?? 0}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !internalValue) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n 'peer !pl-7',\n hasFind\n ? {\n '!w-48': !internalValue && !focused,\n '!w-72': internalValue || focused,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={\n <IconButton\n aria-label={texts.searchInput.button}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n disabled={attributes.disabled || attributes.readOnly}\n icon=\"search\"\n onMouseDown={handleSubmit}\n tabIndex={-1}\n tooltip={\n focused && !isSynced ? (\n <>\n {texts.searchInput.button} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.button\n )\n }\n />\n }\n postfix={postfix}\n ref={internalRef}\n value={internalValue}\n />\n );\n\n if (settingsContent) {\n const handleSettingsBlur = event => {\n if (event.currentTarget.contains(event.relatedTarget)) {\n return;\n }\n setFocused(false);\n };\n\n return (\n <div\n className={cn('relative', { \"[&_[data-taco='input-container']]:z-20\": focused })}\n onBlur={handleSettingsBlur}\n ref={settingsRef}>\n {input}\n {focused ? (\n <div\n className=\"border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow\"\n onClickCapture={() => internalRef.current?.focus()}\n tabIndex={-1}>\n {settingsContent}\n </div>\n ) : null}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","onSearch","handleSearch","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","settingsRef","useRef","internalValue","setInternalValue","useState","focused","setFocused","texts","useLocalization","isActive","length","isSynced","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","preventDefault","focus","handleSubmit","handleBlur","relatedTarget","contains","onBlur","handleChange","target","handleClear","requestAnimationFrame","handleFocus","onFocus","handleKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","findPrevious","shift","findNext","onClickCapture","cn","input","Input","placeholder","onChange","prefix","button","handleSettingsBlur","currentTarget"],"mappings":";;;;;;;;;MAkCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAY,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,QAAQ,EAAEC,YAAY;IACtBC,eAAe;IACfC,QAAQ;IACRC,KAAK;IACL,GAAGC;GACN,GAAGb,KAAK;EACT,MAAMc,WAAW,GAAGC,YA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AI,EAAC,QAAQ;MACbC,WAAW,EAAExB,YAAY;MACzByB,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EACH1C,OAAO,IAAI,CAACM,QAAQ,gBAChB7B,4DACKyB,KAAK,CAACkC,WAAW,CAACmB,MAAM,oBAAE9E,6BAACkE,QAAQ;QAACC,IAAI,EAAC;QAAU,CACrD,GAEH1C,KAAK,CAACkC,WAAW,CAACmB;MAG5B;IAENvB,OAAO,EAAEA,OAAO;IAChBpD,GAAG,EAAEa,WAAW;IAChBF,KAAK,EAAEM;KAEd;EAED,IAAIR,eAAe,EAAE;IACjB,MAAMmE,kBAAkB,GAAG9C,KAAK;MAC5B,IAAIA,KAAK,CAAC+C,aAAa,CAACtC,QAAQ,CAACT,KAAK,CAACQ,aAAa,CAAC,EAAE;QACnD;;MAEJjB,UAAU,CAAC,KAAK,CAAC;KACpB;IAED,oBACIxB;MACI6D,SAAS,EAAEW,EAAE,CAAC,UAAU,EAAE;QAAE,wCAAwC,EAAEjD;OAAS,CAAC;MAChFoB,MAAM,EAAEoC,kBAAkB;MAC1B5E,GAAG,EAAEe;OACJuD,KAAK,EACLlD,OAAO,gBACJvB;MACI6D,SAAS,EAAC,6HAA6H;MACvIU,cAAc,EAAE;QAAA;QAAA,gCAAMvD,WAAW,CAACoB,OAAO,0DAAnB,sBAAqBE,KAAK,EAAE;;MAClD0B,QAAQ,EAAE,CAAC;OACVpD,eAAe,CACd,GACN,IAAI,CACN;;EAId,OAAO6D,KAAK;AAChB,CAAC;;;;"}
@@ -199,7 +199,8 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
199
199
  if (typeof onClickCapture === 'function') {
200
200
  onClickCapture(event);
201
201
  }
202
- tableMeta.currentRow.setCurrentRowIndex(index);
202
+ // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable
203
+ requestAnimationFrame(() => tableMeta.currentRow.setCurrentRowIndex(index));
203
204
  };
204
205
  const handleClick = event => {
205
206
  if (typeof onClick === 'function') {
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/rows/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { Row as RTRow, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { RowContext, useRowContext } from './RowContext';\nimport { useDropTarget } from '../../../../utils/hooks/useDropTarget';\nimport { Table3RowClickHandler, Table3RowDropHandler } from '../../types';\nimport { useFocusManager } from '@react-aria/focus';\nimport { focusableSelector } from '../../util/editing';\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n onClick?: Table3RowClickHandler<TType>;\n onDrop?: Table3RowDropHandler<TType>;\n row: RTRow<TType>;\n table: RTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const isCurrentRow = tableMeta.currentRow.currentRowIndex === props.index;\n const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];\n // we use non-css hovered state to determine whether to render actions or not, for performance\n const [isHovered, setIsHovered] = React.useState(false);\n\n // rows are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the row\n const memoedProps = {\n // aria-grabbed is being deprecated but there is no current alternative api, we use it until there is\n 'aria-grabbed': isDraggingRow ? true : tableMeta.rowDrag.isEnabled ? false : undefined,\n 'data-current': isCurrentRow,\n 'data-selected': props.row.getIsSelected(),\n draggable: tableMeta.rowDrag.isEnabled,\n index: props.index,\n onClick: tableMeta.rowClick.handleClick,\n onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined,\n };\n\n let output = <MemoedRow<TType> {...props} {...memoedProps} />;\n\n if (tableMeta.editing.isEditing && (isCurrentRow || (isHovered && !tableMeta.hoverState.isPaused))) {\n output = (\n <EditingRow\n {...props}\n {...memoedProps}\n isLastRow={props.isLastRow}\n setCurrentRowIndex={tableMeta.currentRow.setCurrentRowIndex}\n />\n );\n }\n\n // we store the row index in context because in a virtualised table the row index and the\n // react table row index do not match when, for example, sorting is applied\n const contextValue = React.useMemo(() => ({ isHovered, setIsHovered, rowIndex: props.index }), [isHovered, props.index]);\n\n return <RowContext.Provider value={contextValue}>{output}</RowContext.Provider>;\n}\n\n// turns out we might need some kind of \"state\" for the focused column, but it doesn't need to be react state that re-renders\nlet lastIndex;\n\nfunction getColumnIndex(focusedElement: Element) {\n if (focusedElement) {\n return focusedElement.closest('[role=cell]')?.getAttribute('data-column-index');\n }\n\n return null;\n}\n\n// This code is needed to avoid multiple rows being hovered at the same time (it happens since we use non-css hovering)\nlet previouslyHoveredIndex: number | undefined;\nconst unhoverPreviousRow = (tableRef: React.RefObject<HTMLDivElement>) => {\n if (previouslyHoveredIndex !== undefined) {\n const mouseoutEvent = new MouseEvent('mouseout', { view: window, bubbles: true, cancelable: true });\n const previouslyHovered = tableRef?.current?.querySelector(`[data-row-index=\"${previouslyHoveredIndex}\"]`);\n previouslyHovered?.dispatchEvent(mouseoutEvent);\n }\n};\n\nfunction EditingRow(props) {\n const { isLastRow, setCurrentRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\n const focusManagerOptions = { tabbable: true };\n const tableMeta = props.table.options.meta as TableMeta<unknown>;\n\n const handleClickCapture = (event: React.FocusEvent) => {\n lastIndex = getColumnIndex(event.target);\n };\n\n const handleArrowLeftKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowLeft' || (event.key === 'Tab' && event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowLeft\" or \"META + ArrowLeft\" should focus first focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus previous focusable element, if there is one\n focusedElement = focusManager.focusPrevious(focusManagerOptions);\n\n // Should move to prevoius row and select last focusable element in that row,\n // if there is no previous focusable element in current row\n if (props.index !== 0 && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index - 1);\n setTimeout(() => {\n focusedElement = focusManager.focusLast(focusManagerOptions);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n const handleArrowRightKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowRight' || (event.key === 'Tab' && !event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowRight\" or \"META + ArrowRight\" should focus last focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusLast(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus next focusable element, if there is one\n focusedElement = focusManager.focusNext(focusManagerOptions);\n\n // Should move to next row and select first focusable element in that row,\n // if there is no next focusable element in current row\n if (!isLastRow && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index + 1);\n setTimeout(() => {\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n // Need to update lastIndex when row got changed and first element got selected.\n\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n React.useEffect(() => {\n // if some row stuck in hovered state, we heed to unhover it when hover state is paused\n if (tableMeta.hoverState.isPaused) {\n unhoverPreviousRow(props.tableRef);\n }\n }, [tableMeta.hoverState.isPaused]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped() || tableMeta.editing.detailModeEditing) {\n return;\n }\n\n handleArrowLeftKey(event);\n handleArrowRightKey(event);\n };\n\n // this ensures we focus either on a field or on the same column when keyboard navigating up/down\n React.useEffect(() => {\n if (tableMeta.currentRow.currentRowIndex === props.index) {\n if (lastIndex !== undefined) {\n const lastIndexCell = props.tableRef.current?.querySelector(\n `[role=\"row\"][data-current=\"true\"] [data-column-index=\"${lastIndex}\"]`\n );\n lastIndexCell?.querySelector(focusableSelector)?.focus();\n } else {\n focusManager.focusFirst(focusManagerOptions);\n }\n }\n // Need to subscribe to current row index and check is it a current row,\n // for a situation where hovered row is the next row after current row...\n // In this case row will not be re-rendered if user switch to next row, because hovered row also renders EditingRow.\n }, [tableMeta.currentRow.currentRowIndex]);\n\n return <MemoedRow {...attributes} onClickCapture={handleClickCapture} onKeyDown={handleKeyDown} />;\n}\n\n// Memoization\n\nexport type MemoedRowProps<TType = unknown> = RowProps<TType> & {\n 'aria-grabbed'?: boolean;\n 'data-current': boolean;\n 'data-selected': boolean;\n draggable: boolean;\n index: number;\n};\n\nconst clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];\n\nconst MemoedRow = React.memo(function MemoedRow<TType = unknown>(props: MemoedRowProps<TType>) {\n const { index, isLastRow: _1, onClick, onClickCapture, onDrop, row, table, tableRef, ...attributes } = props;\n const ref = React.useRef<HTMLDivElement | null>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { setIsHovered } = useRowContext();\n\n // we use capture because it also picks up clicks on e.g. select checkboxes\n const handleClickCapture = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (typeof onClickCapture === 'function') {\n onClickCapture(event);\n }\n\n tableMeta.currentRow.setCurrentRowIndex(index);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (typeof onClick === 'function') {\n const clickedElement = event.target as HTMLElement;\n\n if (\n !ref.current?.contains(event.target as HTMLElement) ||\n clickableElements.includes(clickedElement.tagName.toLowerCase()) ||\n clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))\n ) {\n return;\n }\n\n onClick(row.original);\n }\n };\n\n const handleMouseEnter = () => {\n // When user moving mouse to fast, then some of the rows are getting stuck in hover state,\n // because mouseleave event never got triggered, to avoid this to happen we're saving the index of last hovered row,\n // so that we can unhover it when new row got hovered, and saving it in a variable outside of react to save in performance,\n // since it would be very performance heavy to use state which is bound to mouse events.\n if (previouslyHoveredIndex !== undefined) {\n if (previouslyHoveredIndex !== index) {\n unhoverPreviousRow(tableRef);\n previouslyHoveredIndex = index;\n }\n } else {\n previouslyHoveredIndex = index;\n }\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n if (previouslyHoveredIndex === index) {\n previouslyHoveredIndex = undefined;\n }\n setIsHovered(false);\n };\n\n const [, dropTargetProps] = useDropTarget(event => onDrop?.(event, row.original));\n\n const className = cn(\n 'group/row contents',\n // resizing column requires dragging, which means the mouse might (on rare occasions) move over rows and trigger hover state\n // that in turn triggers rendering of e.g. row actions, which could cause janky ui - so don't allow mouse interaction when resizing\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n {\n 'hover:cursor-pointer': typeof onClick === 'function',\n }\n );\n\n return (\n <div\n {...attributes}\n {...(onDrop ? dropTargetProps : undefined)}\n className={className}\n data-row-index={index}\n onClick={handleClick}\n onClickCapture={handleClickCapture}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"row\"\n ref={ref}\n />\n );\n}) as <TType = unknown>(props: MemoedRowProps<TType>) => JSX.Element;\n"],"names":["Row","props","tableMeta","table","options","meta","isCurrentRow","currentRow","currentRowIndex","index","isDraggingRow","rowDrag","dragging","row","id","isHovered","setIsHovered","React","useState","memoedProps","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","output","MemoedRow","editing","isEditing","hoverState","isPaused","EditingRow","isLastRow","setCurrentRowIndex","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastIndex","getColumnIndex","focusedElement","closest","getAttribute","previouslyHoveredIndex","unhoverPreviousRow","tableRef","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","focusManager","useFocusManager","focusManagerOptions","tabbable","handleClickCapture","event","target","handleArrowLeftKey","key","shiftKey","stopPropagation","preventDefault","ctrlKey","metaKey","blur","focusFirst","focusPrevious","currentTarget","contains","pause","setTimeout","focusLast","handleArrowRightKey","focusNext","useEffect","handleKeyDown","isDefaultPrevented","isPropagationStopped","detailModeEditing","lastIndexCell","focusableSelector","focus","onClickCapture","onKeyDown","clickableElements","memo","_1","ref","useRef","useRowContext","clickedElement","includes","tagName","toLowerCase","map","tag","join","original","handleMouseEnter","handleMouseLeave","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;SAmBgBA,GAAG,CAAkBC,KAAsB;EACvD,MAAMC,SAAS,GAAGD,KAAK,CAACE,KAAK,CAACC,OAAO,CAACC,IAAwB;EAC9D,MAAMC,YAAY,GAAGJ,SAAS,CAACK,UAAU,CAACC,eAAe,KAAKP,KAAK,CAACQ,KAAK;EACzE,MAAMC,aAAa,GAAGR,SAAS,CAACS,OAAO,CAACC,QAAQ,CAACX,KAAK,CAACY,GAAG,CAACC,EAAE,CAAC;;EAE9D,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;;EAIvD,MAAMC,WAAW,GAAG;;IAEhB,cAAc,EAAET,aAAa,GAAG,IAAI,GAAGR,SAAS,CAACS,OAAO,CAACS,SAAS,GAAG,KAAK,GAAGC,SAAS;IACtF,cAAc,EAAEf,YAAY;IAC5B,eAAe,EAAEL,KAAK,CAACY,GAAG,CAACS,aAAa,EAAE;IAC1CC,SAAS,E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CAACU,GAAG,CAACC,GAAG,kBAAkBA,KAAK,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC,EACrF;QACE;;MAGJvF,OAAO,CAACX,GAAG,CAACmG,QAAQ,CAAC;;GAE5B;EAED,MAAMC,gBAAgB,GAAG;;;;;IAKrB,IAAI/D,sBAAsB,KAAK7B,SAAS,EAAE;MACtC,IAAI6B,sBAAsB,KAAKzC,KAAK,EAAE;QAClC0C,kBAAkB,CAACC,QAAQ,CAAC;QAC5BF,sBAAsB,GAAGzC,KAAK;;KAErC,MAAM;MACHyC,sBAAsB,GAAGzC,KAAK;;IAElCO,YAAY,CAAC,IAAI,CAAC;GACrB;EACD,MAAMkG,gBAAgB,GAAG;IACrB,IAAIhE,sBAAsB,KAAKzC,KAAK,EAAE;MAClCyC,sBAAsB,GAAG7B,SAAS;;IAEtCL,YAAY,CAAC,KAAK,CAAC;GACtB;EAED,MAAM,GAAGmG,eAAe,CAAC,GAAGC,aAAa,CAAC9C,KAAK,IAAI3C,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAG2C,KAAK,EAAEzD,GAAG,CAACmG,QAAQ,CAAC,CAAC;EAEjF,MAAMK,SAAS,GAAGC,EAAE,CAChB,oBAAoB;;;EAGpB,8DAA8D,EAC9D;IACI,sBAAsB,EAAE,OAAO9F,OAAO,KAAK;GAC9C,CACJ;EAED,oBACIP,sDACQ+C,UAAU,EACTrC,MAAM,GAAGwF,eAAe,GAAG9F,SAAS;IACzCgG,SAAS,EAAEA,SAAS;sBACJ5G,KAAK;IACrBe,OAAO,EAAEE,WAAW;IACpBuE,cAAc,EAAE5B,kBAAkB;IAClCkD,YAAY,EAAEN,gBAAgB;IAC9BO,YAAY,EAAEN,gBAAgB;IAC9BO,IAAI,EAAC,KAAK;IACVnB,GAAG,EAAEA;KACP;AAEV,CAAC,CAAmE;;;;"}
1
+ {"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/rows/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { Row as RTRow, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { RowContext, useRowContext } from './RowContext';\nimport { useDropTarget } from '../../../../utils/hooks/useDropTarget';\nimport { Table3RowClickHandler, Table3RowDropHandler } from '../../types';\nimport { useFocusManager } from '@react-aria/focus';\nimport { focusableSelector } from '../../util/editing';\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n onClick?: Table3RowClickHandler<TType>;\n onDrop?: Table3RowDropHandler<TType>;\n row: RTRow<TType>;\n table: RTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const isCurrentRow = tableMeta.currentRow.currentRowIndex === props.index;\n const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];\n // we use non-css hovered state to determine whether to render actions or not, for performance\n const [isHovered, setIsHovered] = React.useState(false);\n\n // rows are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the row\n const memoedProps = {\n // aria-grabbed is being deprecated but there is no current alternative api, we use it until there is\n 'aria-grabbed': isDraggingRow ? true : tableMeta.rowDrag.isEnabled ? false : undefined,\n 'data-current': isCurrentRow,\n 'data-selected': props.row.getIsSelected(),\n draggable: tableMeta.rowDrag.isEnabled,\n index: props.index,\n onClick: tableMeta.rowClick.handleClick,\n onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined,\n };\n\n let output = <MemoedRow<TType> {...props} {...memoedProps} />;\n\n if (tableMeta.editing.isEditing && (isCurrentRow || (isHovered && !tableMeta.hoverState.isPaused))) {\n output = (\n <EditingRow\n {...props}\n {...memoedProps}\n isLastRow={props.isLastRow}\n setCurrentRowIndex={tableMeta.currentRow.setCurrentRowIndex}\n />\n );\n }\n\n // we store the row index in context because in a virtualised table the row index and the\n // react table row index do not match when, for example, sorting is applied\n const contextValue = React.useMemo(() => ({ isHovered, setIsHovered, rowIndex: props.index }), [isHovered, props.index]);\n\n return <RowContext.Provider value={contextValue}>{output}</RowContext.Provider>;\n}\n\n// turns out we might need some kind of \"state\" for the focused column, but it doesn't need to be react state that re-renders\nlet lastIndex;\n\nfunction getColumnIndex(focusedElement: Element) {\n if (focusedElement) {\n return focusedElement.closest('[role=cell]')?.getAttribute('data-column-index');\n }\n\n return null;\n}\n\n// This code is needed to avoid multiple rows being hovered at the same time (it happens since we use non-css hovering)\nlet previouslyHoveredIndex: number | undefined;\nconst unhoverPreviousRow = (tableRef: React.RefObject<HTMLDivElement>) => {\n if (previouslyHoveredIndex !== undefined) {\n const mouseoutEvent = new MouseEvent('mouseout', { view: window, bubbles: true, cancelable: true });\n const previouslyHovered = tableRef?.current?.querySelector(`[data-row-index=\"${previouslyHoveredIndex}\"]`);\n previouslyHovered?.dispatchEvent(mouseoutEvent);\n }\n};\n\nfunction EditingRow(props) {\n const { isLastRow, setCurrentRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\n const focusManagerOptions = { tabbable: true };\n const tableMeta = props.table.options.meta as TableMeta<unknown>;\n\n const handleClickCapture = (event: React.FocusEvent) => {\n lastIndex = getColumnIndex(event.target);\n };\n\n const handleArrowLeftKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowLeft' || (event.key === 'Tab' && event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowLeft\" or \"META + ArrowLeft\" should focus first focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus previous focusable element, if there is one\n focusedElement = focusManager.focusPrevious(focusManagerOptions);\n\n // Should move to prevoius row and select last focusable element in that row,\n // if there is no previous focusable element in current row\n if (props.index !== 0 && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index - 1);\n setTimeout(() => {\n focusedElement = focusManager.focusLast(focusManagerOptions);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n const handleArrowRightKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowRight' || (event.key === 'Tab' && !event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowRight\" or \"META + ArrowRight\" should focus last focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusLast(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus next focusable element, if there is one\n focusedElement = focusManager.focusNext(focusManagerOptions);\n\n // Should move to next row and select first focusable element in that row,\n // if there is no next focusable element in current row\n if (!isLastRow && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index + 1);\n setTimeout(() => {\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n // Need to update lastIndex when row got changed and first element got selected.\n\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n React.useEffect(() => {\n // if some row stuck in hovered state, we heed to unhover it when hover state is paused\n if (tableMeta.hoverState.isPaused) {\n unhoverPreviousRow(props.tableRef);\n }\n }, [tableMeta.hoverState.isPaused]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped() || tableMeta.editing.detailModeEditing) {\n return;\n }\n\n handleArrowLeftKey(event);\n handleArrowRightKey(event);\n };\n\n // this ensures we focus either on a field or on the same column when keyboard navigating up/down\n React.useEffect(() => {\n if (tableMeta.currentRow.currentRowIndex === props.index) {\n if (lastIndex !== undefined) {\n const lastIndexCell = props.tableRef.current?.querySelector(\n `[role=\"row\"][data-current=\"true\"] [data-column-index=\"${lastIndex}\"]`\n );\n lastIndexCell?.querySelector(focusableSelector)?.focus();\n } else {\n focusManager.focusFirst(focusManagerOptions);\n }\n }\n // Need to subscribe to current row index and check is it a current row,\n // for a situation where hovered row is the next row after current row...\n // In this case row will not be re-rendered if user switch to next row, because hovered row also renders EditingRow.\n }, [tableMeta.currentRow.currentRowIndex]);\n\n return <MemoedRow {...attributes} onClickCapture={handleClickCapture} onKeyDown={handleKeyDown} />;\n}\n\n// Memoization\n\nexport type MemoedRowProps<TType = unknown> = RowProps<TType> & {\n 'aria-grabbed'?: boolean;\n 'data-current': boolean;\n 'data-selected': boolean;\n draggable: boolean;\n index: number;\n};\n\nconst clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];\n\nconst MemoedRow = React.memo(function MemoedRow<TType = unknown>(props: MemoedRowProps<TType>) {\n const { index, isLastRow: _1, onClick, onClickCapture, onDrop, row, table, tableRef, ...attributes } = props;\n const ref = React.useRef<HTMLDivElement | null>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { setIsHovered } = useRowContext();\n\n // we use capture because it also picks up clicks on e.g. select checkboxes\n const handleClickCapture = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (typeof onClickCapture === 'function') {\n onClickCapture(event);\n }\n\n // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable\n requestAnimationFrame(() => tableMeta.currentRow.setCurrentRowIndex(index));\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (typeof onClick === 'function') {\n const clickedElement = event.target as HTMLElement;\n\n if (\n !ref.current?.contains(event.target as HTMLElement) ||\n clickableElements.includes(clickedElement.tagName.toLowerCase()) ||\n clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))\n ) {\n return;\n }\n\n onClick(row.original);\n }\n };\n\n const handleMouseEnter = () => {\n // When user moving mouse to fast, then some of the rows are getting stuck in hover state,\n // because mouseleave event never got triggered, to avoid this to happen we're saving the index of last hovered row,\n // so that we can unhover it when new row got hovered, and saving it in a variable outside of react to save in performance,\n // since it would be very performance heavy to use state which is bound to mouse events.\n if (previouslyHoveredIndex !== undefined) {\n if (previouslyHoveredIndex !== index) {\n unhoverPreviousRow(tableRef);\n previouslyHoveredIndex = index;\n }\n } else {\n previouslyHoveredIndex = index;\n }\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n if (previouslyHoveredIndex === index) {\n previouslyHoveredIndex = undefined;\n }\n setIsHovered(false);\n };\n\n const [, dropTargetProps] = useDropTarget(event => onDrop?.(event, row.original));\n\n const className = cn(\n 'group/row contents',\n // resizing column requires dragging, which means the mouse might (on rare occasions) move over rows and trigger hover state\n // that in turn triggers rendering of e.g. row actions, which could cause janky ui - so don't allow mouse interaction when resizing\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n {\n 'hover:cursor-pointer': typeof onClick === 'function',\n }\n );\n\n return (\n <div\n {...attributes}\n {...(onDrop ? dropTargetProps : undefined)}\n className={className}\n data-row-index={index}\n onClick={handleClick}\n onClickCapture={handleClickCapture}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"row\"\n ref={ref}\n />\n );\n}) as <TType = unknown>(props: MemoedRowProps<TType>) => JSX.Element;\n"],"names":["Row","props","tableMeta","table","options","meta","isCurrentRow","currentRow","currentRowIndex","index","isDraggingRow","rowDrag","dragging","row","id","isHovered","setIsHovered","React","useState","memoedProps","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","output","MemoedRow","editing","isEditing","hoverState","isPaused","EditingRow","isLastRow","setCurrentRowIndex","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastIndex","getColumnIndex","focusedElement","closest","getAttribute","previouslyHoveredIndex","unhoverPreviousRow","tableRef","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","focusManager","useFocusManager","focusManagerOptions","tabbable","handleClickCapture","event","target","handleArrowLeftKey","key","shiftKey","stopPropagation","preventDefault","ctrlKey","metaKey","blur","focusFirst","focusPrevious","currentTarget","contains","pause","setTimeout","focusLast","handleArrowRightKey","focusNext","useEffect","handleKeyDown","isDefaultPrevented","isPropagationStopped","detailModeEditing","lastIndexCell","focusableSelector","focus","onClickCapture","onKeyDown","clickableElements","memo","_1","ref","useRef","useRowContext","requestAnimationFrame","clickedElement","includes","tagName","toLowerCase","map","tag","join","original","handleMouseEnter","handleMouseLeave","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;SAmBgBA,GAAG,CAAkBC,KAAsB;EACvD,MAAMC,SAAS,GAAGD,KAAK,CAACE,KAAK,CAACC,OAAO,CAACC,IAAwB;EAC9D,MAAMC,YAAY,GAAGJ,SAAS,CAACK,UAAU,CAACC,eAAe,KAAKP,KAAK,CAACQ,KAAK;EACzE,MAAMC,aAAa,GAAGR,SAAS,CAACS,OAAO,CAACC,QAAQ,CAACX,KAAK,CAACY,GAAG,CAACC,EAAE,CAAC;;EAE9D,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;;EAIvD,MAAMC,WAAW,GAAG;;IAEhB,cAAc,EAAET,aAAa,GAAG,IAAI,GAAGR,SAAS,CAACS,OAAO,CAACS,SAAS,GAAG,KAAK,GAAGC,SAAS;IACtF,cAAc,EAAEf,YAAY;IAC5B,eAAe,EAAEL,KAAK,CAACY,GAAG,CAACS,aAAa,EAAE;IAC1CC,SAAS,EAAErB,SAAS,CAACS,OAAO,CAACS,SAAS;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
8957
  };
8958
8958
  return /*#__PURE__*/React__default.createElement("div", {
8959
- className: "relative [&_[data-taco='input-container']]:z-20",
8959
+ className: cn('relative', {
8960
+ "[&_[data-taco='input-container']]:z-20": focused
8961
+ }),
8960
8962
  onBlur: handleSettingsBlur,
8961
8963
  ref: settingsRef
8962
8964
  }, input, focused ? /*#__PURE__*/React__default.createElement("div", {
@@ -18442,7 +18444,8 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
18442
18444
  if (typeof onClickCapture === 'function') {
18443
18445
  onClickCapture(event);
18444
18446
  }
18445
- tableMeta.currentRow.setCurrentRowIndex(index);
18447
+ // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable
18448
+ requestAnimationFrame(() => tableMeta.currentRow.setCurrentRowIndex(index));
18446
18449
  };
18447
18450
  const handleClick = event => {
18448
18451
  if (typeof onClick === 'function') {