@economic/taco 2.14.2 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/components/Icon/components/AiChatSolid.d.ts +3 -0
  2. package/dist/components/Icon/components/AiStars.d.ts +3 -0
  3. package/dist/components/Icon/components/EnvelopeSolid.d.ts +3 -0
  4. package/dist/components/Icon/components/PhoneSolid.d.ts +3 -0
  5. package/dist/components/Icon/components/QuestionMarkBold.d.ts +3 -0
  6. package/dist/components/Icon/components/index.d.ts +1 -1
  7. package/dist/components/Input/Input.d.ts +1 -1
  8. package/dist/components/Menu/components/Item.d.ts +1 -1
  9. package/dist/components/Menu/components/Link.d.ts +1 -1
  10. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  11. package/dist/components/Select2/components/Option.d.ts +2 -2
  12. package/dist/components/Select2/components/Search.d.ts +1 -1
  13. package/dist/components/Tag/Tag.d.ts +1 -1
  14. package/dist/components/Tooltip/Tooltip.d.ts +4 -0
  15. package/dist/esm/index.css +4 -0
  16. package/dist/esm/packages/taco/src/components/Field/Field.js +19 -3
  17. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Icon/components/AiChatSolid.js +19 -0
  19. package/dist/esm/packages/taco/src/components/Icon/components/AiChatSolid.js.map +1 -0
  20. package/dist/esm/packages/taco/src/components/Icon/components/AiStars.js +30 -0
  21. package/dist/esm/packages/taco/src/components/Icon/components/AiStars.js.map +1 -0
  22. package/dist/esm/packages/taco/src/components/Icon/components/EnvelopeSolid.js +19 -0
  23. package/dist/esm/packages/taco/src/components/Icon/components/EnvelopeSolid.js.map +1 -0
  24. package/dist/esm/packages/taco/src/components/Icon/components/PhoneSolid.js +17 -0
  25. package/dist/esm/packages/taco/src/components/Icon/components/PhoneSolid.js.map +1 -0
  26. package/dist/esm/packages/taco/src/components/Icon/components/QuestionMarkBold.js +17 -0
  27. package/dist/esm/packages/taco/src/components/Icon/components/QuestionMarkBold.js.map +1 -0
  28. package/dist/esm/packages/taco/src/components/Icon/components/index.js +10 -0
  29. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table3/Table3.js +21 -3
  31. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +6 -5
  33. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +2 -2
  35. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +3 -1
  37. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js +2 -1
  39. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js +1 -1
  43. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +4 -0
  45. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  46. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +20 -0
  47. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -0
  48. package/dist/index.css +4 -0
  49. package/dist/taco.cjs.development.js +160 -17
  50. package/dist/taco.cjs.development.js.map +1 -1
  51. package/dist/taco.cjs.production.min.js +1 -1
  52. package/dist/taco.cjs.production.min.js.map +1 -1
  53. package/package.json +2 -2
  54. package/types.json +20265 -10463
@@ -1 +1 @@
1
- {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { FONT_SIZE } from './components/toolbar/FontSize';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\ntype FixedForwardRef = <T, P = {}>(\n render: (props: P, ref: React.Ref<T>) => JSX.Element\n) => (props: P & React.RefAttributes<T>) => JSX.Element;\n\n// Cast the old forwardRef to the new one\nexport const fixedForwardRef = React.forwardRef as FixedForwardRef;\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const { emptyState: EmptyState, customSettings, toolbarLeft, toolbarRight } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (eventOriginatedFromCombobox || (dialog && !dialog?.contains(internalRef.current))) {\n return;\n }\n\n tableMeta.hoverState.handleKeyDown(event);\n tableMeta.currentRow.handleKeyDown(\n event,\n table.getRowModel().rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing,\n internalRef\n );\n tableMeta.rowClick.handleKeyDown(event, table);\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.currentRow.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n // mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row\n const handleMouseCapture =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.MouseEvent) => {\n tableMeta.currentRow.handleMouseCapture(event, table.getRowModel().rows.length);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FONT_SIZE.small,\n 'text-sm': tableMeta.fontSize.size === FONT_SIZE.medium,\n 'text-base': tableMeta.fontSize.size === FONT_SIZE.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.isPrinting,\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle ? <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style> : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.hoverState.isPaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div\n onMouseDownCapture={handleMouseCapture}\n className=\"group/body contents\"\n data-taco=\"table2-body\"\n role=\"rowgroup\"\n ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div className=\"border-grey-300 col-span-full translate-y-px border-t\" />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {table.getFooterGroups().map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))}\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3FontSize,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","fixedForwardRef","React","forwardRef","Table","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","handleKeyDown","event","target","dialog","closest","eventOriginatedFromCombobox","contains","hoverState","currentRow","getRowModel","rows","editing","isEditing","rowClick","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","undefined","handleFocus","currentRowIndex","handleMouseCapture","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FONT_SIZE","small","medium","large","style","cssGridStyle","useCssGrid","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","horizontallyScrolled","isPaused","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","onMouseDownCapture","enableFooter","getFooterGroups","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAMjC;MACaE,eAAe,GAAGC,cAAK,CAACC;AAErC,MAAMC,KAAK,gBAAGH,eAAe,CAAC,SAASI,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EAC/G,MAAM;IAAEC,UAAU,EAAEC,UAAU;IAAEC,cAAc;IAAEC,WAAW;IAAEC;GAAc,GAAGN,KAAK;EACnF,MAAMO,WAAW,GAAGC,YAAY,CAAYP,GAAG,CAAC;EAEhD,MAAM;IAAEQ,KAAK;IAAEC;GAAQ,GAAGC,QAAQ,CAAQX,KAAK,CAAC;EAChDY,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AM;IAAEA,MAAM,EAAEA,MAAM;IAAED,KAAK,EAAEA;IAAS,GACzF,IAAI,CACN,GACN,IAAI,CACT,gBAEHb;IAAK8D,SAAS,EAAC;KAA0CvD,UAAU,gBAAGP,6BAACO,UAAU,OAAG,GAAG,IAAI,CAC9F,CACC,CACP;AAEX,CAAC,CAAC;MAOWJ,MAAM,gBAAGJ,eAAe,CAAC,SAASI,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EACvH,MAAMyH,mBAAmB,GAAGC,MAAM,CAAC3H,KAAK,CAAC4H,QAAQ,CAAC;;;EAGlD,MAAMvB,GAAG,GAAGzG,cAAK,CAACiI,OAAO,CAAC,MAAMF,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAO9H,6BAACE,KAAK,oBAAYE,KAAK;IAAEqG,GAAG,EAAEA,GAAG;IAAEpG,GAAG,EAAEA;KAAO;AAC1D,CAAC;AACDF,MAAM,CAACR,MAAM,GAAGA,MAAM;AACtBQ,MAAM,CAACL,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { FONT_SIZE } from './components/toolbar/FontSize';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\ntype FixedForwardRef = <T, P = {}>(\n render: (props: P, ref: React.Ref<T>) => JSX.Element\n) => (props: P & React.RefAttributes<T>) => JSX.Element;\n\n// Cast the old forwardRef to the new one\nexport const fixedForwardRef = React.forwardRef as FixedForwardRef;\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const { emptyState: EmptyState, customSettings, toolbarLeft, toolbarRight, defaultCurrentRowIndex } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(() => {\n // On a very first render, the tanstack table rendered without any rows,\n // so we delaying default row scrolling logic with using of requestAnimation frame\n const animationFrameId = requestAnimationFrame(() => {\n if (defaultCurrentRowIndex) {\n scrollToIndex(defaultCurrentRowIndex, { align: 'center' });\n }\n });\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, []);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (eventOriginatedFromCombobox || (dialog && !dialog?.contains(internalRef.current))) {\n return;\n }\n\n tableMeta.hoverState.handleKeyDown(event);\n tableMeta.currentRow.handleKeyDown(\n event,\n table.getRowModel().rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing,\n internalRef\n );\n tableMeta.rowClick.handleKeyDown(event, table);\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.currentRow.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n // mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row\n const handleMouseCapture =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.MouseEvent) => {\n tableMeta.currentRow.handleMouseCapture(event, table.getRowModel().rows.length);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FONT_SIZE.small,\n 'text-sm': tableMeta.fontSize.size === FONT_SIZE.medium,\n 'text-base': tableMeta.fontSize.size === FONT_SIZE.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.isPrinting,\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n const isPrinting = tableMeta.isPrinting;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle && !isPrinting ? (\n <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style>\n ) : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.hoverState.isPaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div\n onMouseDownCapture={handleMouseCapture}\n className=\"group/body contents\"\n data-taco=\"table2-body\"\n role=\"rowgroup\"\n ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div className=\"border-grey-300 col-span-full translate-y-px border-t\" />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {\n // Render the footer cell only for individual columns, excluding column groups.\n table\n .getFooterGroups()\n .slice(0, 1)\n .map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))\n }\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3FontSize,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","fixedForwardRef","React","forwardRef","Table","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","defaultCurrentRowIndex","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","animationFrameId","requestAnimationFrame","align","cancelAnimationFrame","handleKeyDown","event","target","dialog","closest","eventOriginatedFromCombobox","contains","hoverState","currentRow","getRowModel","rows","editing","isEditing","rowClick","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","undefined","handleFocus","currentRowIndex","handleMouseCapture","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FONT_SIZE","small","medium","large","style","cssGridStyle","useCssGrid","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","horizontallyScrolled","isPaused","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","onMouseDownCapture","enableFooter","getFooterGroups","slice","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAMjC;MACaE,eAAe,GAAGC,cAAK,CAACC;AAErC,MAAMC,KAAK,gBAAGH,eAAe,CAAC,SAASI,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EAC/G,MAAM;IAAEC,UAAU,EAAEC,UAAU;IAAEC,cAAc;IAAEC,WAAW;IAAEC,YAAY;IAAEC;GAAwB,GAAGP,KAAK;EAC3G,MAAMQ,WAAW,GAAGC,YAAY,CAAYR,GAAG,CAAC;EAEhD,MAAM;IAAES,KAAK;IAAEC;GAAQ,GAAGC,QAAQ,CAAQZ,KAAK,CAAC;EAChDa,wBAAwB,CAACH,KAAK,EAAEF,WAAW,CAAC;EAE5CZ,cAAK,CAACkB,SAAS,CAAC;IACZ,IAAId,KAAK,CAACe,SAAS,EAAE;MAAA,IAAAC,o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ACR,GAAG,EAAEmB,MAAM,CAACzC;KACvB+B,UAAU,CAACU,MAAM,CAACT,MAAM,CAACC,SAAS,CAACQ,MAAM,EAAEA,MAAM,CAACP,UAAU,EAAE,CAAC,CAEvE,CAAC,CAET,CAAC,EAET3G,MAAM,gBACHf,6BAACkI,OAAO;IAACC,aAAa,EAAErH,KAAK,CAACgC,WAAW,EAAE,CAACC,IAAI,CAAChC,MAAM;IAAEA,MAAM,EAAEA,MAAM;IAAED,KAAK,EAAEA;IAAS,GACzF,IAAI,CACN,GACN,IAAI,CACT,gBAEHd;IAAKmE,SAAS,EAAC;KAA0C5D,UAAU,gBAAGP,6BAACO,UAAU,OAAG,GAAG,IAAI,CAC9F,CACC,CACP;AAEX,CAAC,CAAC;MAOWJ,MAAM,gBAAGJ,eAAe,CAAC,SAASI,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EACvH,MAAM+H,mBAAmB,GAAGC,MAAM,CAACjI,KAAK,CAACkI,QAAQ,CAAC;;;EAGlD,MAAMxB,GAAG,GAAG9G,cAAK,CAACuI,OAAO,CAAC,MAAMF,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAOpI,6BAACE,KAAK,oBAAYE,KAAK;IAAE0G,GAAG,EAAEA,GAAG;IAAEzG,GAAG,EAAEA;KAAO;AAC1D,CAAC;AACDF,MAAM,CAACR,MAAM,GAAGA,MAAM;AACtBQ,MAAM,CAACL,KAAK,GAAGA,KAAK;;;;"}
@@ -39,11 +39,11 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
39
39
  meta,
40
40
  table
41
41
  } = props;
42
- const containerClassName = cn('sticky px-2 mb-[2px]', {
43
- 'h-10': !isPrinting
44
- }, colSpan > 1 ? `col-span-${colSpan}` : '');
42
+ const containerClassName = cn('px-2 z-10 hover:z-20', colSpan > 1 ? `col-span-${colSpan}` : '', {
43
+ sticky: !isPrinting
44
+ });
45
45
  const innerClassName = cn('font-bold box-content group/column relative', 'px-[var(--table3-cell-padding-x)]', {
46
- 'h-full items-center': !isPrinting,
46
+ 'h-10 items-center': !isPrinting,
47
47
  'pb-2': isPrinting,
48
48
  'border-b-2': !!children
49
49
  }, meta.headerClassName);
@@ -53,7 +53,8 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
53
53
  return /*#__PURE__*/React__default.createElement("div", {
54
54
  className: containerClassName,
55
55
  "data-taco": "table3-column-group",
56
- "data-align": align
56
+ "data-align": align,
57
+ role: "columnheader"
57
58
  }, /*#__PURE__*/React__default.createElement("div", {
58
59
  className: innerClassName
59
60
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
@@ -1 +1 @@
1
- {"version":3,"file":"Group.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nimport { HeaderProps, HeaderSeparator } from './Header';\nimport { ColumnMeta, TableMeta } from '@tanstack/react-table';\nimport { Table3ColumnAlignment } from '../../../types';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport function Group<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, table, hasSeparator } = props;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const memoedProps = {\n align: 'center' as Table3ColumnAlignment,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasSeparator,\n id: header.id,\n index: header.index,\n isPrinting: tableMeta.isPrinting,\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n table,\n };\n\n return <MemoedGroup<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedGroupProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n colSpan: number;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isPrinting: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedGroup = React.memo(function MemoedGroup<TType = unknown>(props: MemoedGroupProps<TType>) {\n const { align, children, colSpan, hasSeparator, id, isPrinting, meta, table } = props;\n\n const containerClassName = cn(\n 'sticky px-2 mb-[2px]',\n {\n 'h-10': !isPrinting,\n },\n colSpan > 1 ? `col-span-${colSpan}` : ''\n );\n\n const innerClassName = cn(\n 'font-bold box-content group/column relative',\n 'px-[var(--table3-cell-padding-x)]',\n {\n 'h-full items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'border-b-2': !!children,\n },\n meta.headerClassName\n );\n\n if (table.options.debugAll) {\n console.log('header group render', id);\n }\n\n return (\n <div className={containerClassName} data-taco=\"table3-column-group\" data-align={align}>\n <div className={innerClassName}>\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n {hasSeparator ? <HeaderSeparator /> : null}\n </div>\n </div>\n );\n}) as <TType = unknown>(props: MemoedGroupProps<TType>) => JSX.Element;\n"],"names":["Group","props","children","column","header","table","hasSeparator","columnMeta","React","useMemo","columnDef","meta","tableMeta","options","memoedProps","align","colSpan","id","index","isPrinting","length","getRowModel","rows","MemoedGroup","memo","containerClassName","cn","innerClassName","headerClassName","debugAll","console","log","className","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","HeaderSeparator"],"mappings":";;;;;SAQgBA,KAAKA,CAAkBC,KAAyB;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;GAAc,GAAGL,KAAK;EAC/D,MAAMM,UAAU,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAMN,MAAM,CAACO,SAAS,CAACC,IAAI,EAAE,EAAE,CAA+B;EAC/F,MAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACF,IAAwB;EAExD,MAAMG,WAAW,GAAG;IAChBC,KAAK,EAAE,QAAiC;IACxCb,QAAQ,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I,aAAJA,IAAI,uBAAJA,IAAI,CAAE0B,OAAO,cAAAD,aAAA,cAAAA,aAAA,GAAIlC,QAAQ,CAAC;IAAEoC,SAAS,EAAC;kBACzD9B;IAAMwB,SAAS,EAAEN,EAAE,CAAC;MAAEa,QAAQ,EAAE,CAACpB;KAAY;KAAIjB,QAAQ,CAAQ,CAC3D,EACTI,YAAY,gBAAGE,6BAACgC,eAAe,OAAG,GAAG,IAAI,CACxC,CACJ;AAEd,CAAC,CAAqE;;;;"}
1
+ {"version":3,"file":"Group.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nimport { HeaderProps, HeaderSeparator } from './Header';\nimport { ColumnMeta, TableMeta } from '@tanstack/react-table';\nimport { Table3ColumnAlignment } from '../../../types';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport function Group<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, table, hasSeparator } = props;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const memoedProps = {\n align: 'center' as Table3ColumnAlignment,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasSeparator,\n id: header.id,\n index: header.index,\n isPrinting: tableMeta.isPrinting,\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n table,\n };\n\n return <MemoedGroup<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedGroupProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n colSpan: number;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isPrinting: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedGroup = React.memo(function MemoedGroup<TType = unknown>(props: MemoedGroupProps<TType>) {\n const { align, children, colSpan, hasSeparator, id, isPrinting, meta, table } = props;\n\n const containerClassName = cn('px-2 z-10 hover:z-20', colSpan > 1 ? `col-span-${colSpan}` : '', { sticky: !isPrinting });\n\n const innerClassName = cn(\n 'font-bold box-content group/column relative',\n 'px-[var(--table3-cell-padding-x)]',\n {\n 'h-10 items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'border-b-2': !!children,\n },\n meta.headerClassName\n );\n\n if (table.options.debugAll) {\n console.log('header group render', id);\n }\n\n return (\n <div className={containerClassName} data-taco=\"table3-column-group\" data-align={align} role=\"columnheader\">\n <div className={innerClassName}>\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n {hasSeparator ? <HeaderSeparator /> : null}\n </div>\n </div>\n );\n}) as <TType = unknown>(props: MemoedGroupProps<TType>) => JSX.Element;\n"],"names":["Group","props","children","column","header","table","hasSeparator","columnMeta","React","useMemo","columnDef","meta","tableMeta","options","memoedProps","align","colSpan","id","index","isPrinting","length","getRowModel","rows","MemoedGroup","memo","containerClassName","cn","sticky","innerClassName","headerClassName","debugAll","console","log","className","role","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","HeaderSeparator"],"mappings":";;;;;SAQgBA,KAAKA,CAAkBC,KAAyB;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;GAAc,GAAGL,KAAK;EAC/D,MAAMM,UAAU,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAMN,MAAM,CAACO,SAAS,CAACC,IAAI,EAAE,EAAE,CAA+B;EAC/F,MAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACF,IAAwB;EAExD,MAAMG,WAAW,GAAG;IAChBC,KAAK,EAAE,QAAiC;IACxCb,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIK,UAAU,CAACH,MAAM;IACvCY,OAAO,EAAEZ,MAAM,CAACY,OAAO;IACvBV,YAAY;IACZW,EAAE,EAAEb,MAAM,C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BACzDhC;IAAMyB,SAAS,EAAEP,EAAE,CAAC;MAAEe,QAAQ,EAAE,CAACtB;KAAY;KAAIjB,QAAQ,CAAQ,CAC3D,EACTI,YAAY,gBAAGE,6BAACkC,eAAe,OAAG,GAAG,IAAI,CACxC,CACJ;AAEd,CAAC,CAAqE;;;;"}
@@ -102,9 +102,9 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
102
102
  sortDirection,
103
103
  table
104
104
  } = props;
105
- const className = cn('sticky font-bold border-b-2 box-content group/column relative', '[[role="table"][data-resizing="true"]_&]:pointer-events-none', 'px-[var(--table3-cell-padding-x)]', {
105
+ const className = cn('font-bold border-b-2 box-content group/column relative', '[[role="table"][data-resizing="true"]_&]:pointer-events-none', 'px-[var(--table3-cell-padding-x)]', {
106
106
  '!border-white': isPlaceholder,
107
- 'h-10 items-center': !isPrinting,
107
+ 'h-10 items-center sticky': !isPrinting,
108
108
  'pb-2': isPrinting,
109
109
  'cursor-pointer select-none': canSort,
110
110
  'hover:bg-grey-100': !isPlaceholder && (canSort || canResize || hasMenu),
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { ColumnMeta, HeaderContext, TableMeta } from '@tanstack/react-table';\nimport { Menu, isMenuAvailable, isGotoAvailable } from './Menu';\nimport { Resizer } from './Resizer';\nimport { Table3ColumnAlignment, Table3SortDirection, TableStrategy } from '../../../types';\nimport { getSortAttributes, SortIndicator } from './SortIndicator';\nimport { isFrozenColumn, isInternalColumn } from '../../../util/columns';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport const SORT_DIRECTION: Record<string, Table3SortDirection> = {\n ASC: 'asc',\n DESC: 'desc',\n};\n\nexport type HeaderSortDirection = Table3SortDirection | false;\nexport type SortToggleHandler = (sortDirection: HeaderSortDirection) => void;\n\nexport type HeaderProps<TType = unknown> = HeaderContext<TType, unknown> & {\n children?: string | JSX.Element;\n hasSeparator?: boolean;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, hasSeparator, scrollToIndex, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const canSort = column.getCanSort();\n const hasGoto = isGotoAvailable(table, header);\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const handleHide = React.useMemo(() => header.column.getToggleVisibilityHandler(), []);\n const handleResize = React.useMemo(() => header.getResizeHandler(), []);\n const handleSort = React.useMemo(() => header.column.getToggleSortingHandler(), []);\n const handleSortToggle = React.useCallback((sortDirection: HeaderSortDirection) => {\n // When sorting is not applied, sortDirection is false.\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === SORT_DIRECTION.DESC);\n }\n }, []);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n const handleGoto = React.useMemo(() => {\n if (hasGoto) {\n return ((query: string) => tableMeta.rowGoto.handleGoto(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n return undefined;\n }, [hasGoto, JSON.stringify(sorting), JSON.stringify(filters), search]);\n\n const memoedProps = {\n align: columnMeta.align,\n canFreeze: tableMeta.columnFreezing.isEnabled,\n canHide: column.getCanHide(),\n canResize: column.getCanResize(),\n canSort,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasMenu: isMenuAvailable<TType>(table, header),\n hasSeparator,\n id: header.id,\n index: header.index,\n isFrozen: isFrozenColumn(header, table),\n isPlaceholder: header.isPlaceholder,\n isPrinting: tableMeta.isPrinting,\n isResizing: column.getIsResizing(),\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort as (event: unknown) => void,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection: column.getIsSorted(),\n table,\n };\n\n return <MemoedHeader<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedHeaderProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header'> & {\n align?: Table3ColumnAlignment;\n canFreeze: boolean;\n canHide: boolean;\n canResize: boolean;\n canSort: boolean;\n colSpan: number;\n hasMenu: boolean;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isFrozen: boolean;\n isPlaceholder: boolean;\n isPrinting: boolean;\n isResizing: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onResize: (event: unknown) => void;\n onSort: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader<TType = unknown>(props: MemoedHeaderProps<TType>) {\n const {\n align,\n children,\n canFreeze,\n canHide,\n canResize,\n canSort,\n colSpan,\n hasMenu,\n hasSeparator,\n id,\n index,\n isFrozen,\n isPlaceholder,\n isPrinting,\n isResizing,\n length,\n meta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n\n const className = cn(\n 'sticky font-bold border-b-2 box-content group/column relative',\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n 'px-[var(--table3-cell-padding-x)]',\n {\n '!border-white': isPlaceholder,\n 'h-10 items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'cursor-pointer select-none': canSort,\n 'hover:bg-grey-100': !isPlaceholder && (canSort || canResize || hasMenu),\n 'focus-within:bg-grey-100': hasMenu,\n '!pointer-events-all !bg-grey-100': !isPlaceholder && isResizing,\n // z-indexes\n 'z-10 hover:z-20': !isFrozen && !isResizing,\n 'z-20': !isFrozen && isResizing,\n // when column is frozen, we need to increase it's z-index when it's hovered,\n // so that resize handler appears on top of next frozen cell, and didn't get cut by it.\n '!z-30 hover:!z-40': isFrozen,\n '!z-40': isFrozen && isResizing,\n },\n colSpan > 1 ? `col-span-${colSpan}` : '',\n meta.headerClassName\n );\n\n const [internalRef, setInternalRef] = React.useState<HTMLDivElement | null>(null);\n\n React.useLayoutEffect(() => {\n if (internalRef && length) {\n // the actions column size gets set by the column itself\n if (isInternalColumn(id)) {\n return;\n }\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [id]: internalRef.getBoundingClientRect().width,\n }));\n }\n }, [internalRef, length]);\n\n if (table.options.debugAll) {\n console.log('header render', id);\n }\n return (\n <div\n {...(canSort ? getSortAttributes(handleSort, sortDirection) : undefined)}\n className={className}\n data-align={align}\n data-column-index={index}\n role=\"columnheader\"\n ref={setInternalRef}>\n {isPlaceholder ? null : (\n <>\n {isInternalColumn(id) ? (\n children\n ) : (\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n )}\n {canSort ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <Menu\n canFreeze={canFreeze}\n canHide={canHide}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-2': align === 'right',\n })}\n index={index}\n menu={meta.menu}\n onGoto={handleGoto}\n onHide={handleHide}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n sortDirection={sortDirection}\n table={table}\n />\n ) : null}\n </>\n )}\n {/* Header separator need to go before Resizer to prevent it's overlapping */}\n {hasSeparator ? <HeaderSeparator /> : null}\n {!isPlaceholder && canResize ? <Resizer isResizing={isResizing} onResize={handleResize} /> : null}\n </div>\n );\n}) as <TType = unknown>(props: MemoedHeaderProps<TType>) => JSX.Element;\n\nexport function HeaderSeparator() {\n return (\n <div\n data-taco=\"header-separator\"\n className={cn(\n 'invisible absolute right-[0.5px] top-0 flex h-full w-2 touch-none select-none justify-center py-2 group-hover/header:visible'\n )}>\n <div className={cn('bg-grey-300 h-full w-[1px]')} />\n </div>\n );\n}\n"],"names":["SORT_DIRECTION","ASC","DESC","Header","props","children","column","header","hasSeparator","scrollToIndex","table","tableMeta","options","meta","columnMeta","React","useMemo","columnDef","canSort","getCanSort","hasGoto","isGotoAvailable","handleHide","getToggleVisibilityHandler","handleResize","getResizeHandler","handleSort","getToggleSortingHandler","handleSortToggle","useCallback","sortDirection","clearSorting","toggleSorting","sorting","getState","filters","columnFilters","search","globalFilter","handleGoto","query","rowGoto","id","undefined","JSON","stringify","memoedProps","align","canFreeze","columnFreezing","isEnabled","canHide","getCanHide","canResize","getCanResize","colSpan","hasMenu","isMenuAvailable","index","isFrozen","isFrozenColumn","isPlaceholder","isPrinting","isResizing","getIsResizing","length","getRowModel","rows","onGoto","onHide","onResize","onSort","onSortToggle","getIsSorted","MemoedHeader","memo","className","cn","headerClassName","internalRef","setInternalRef","useState","useLayoutEffect","isInternalColumn","setColumnSizing","sizes","getBoundingClientRect","width","debugAll","console","log","getSortAttributes","role","ref","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","SortIndicator","direction","Menu","menu","HeaderSeparator","Resizer"],"mappings":";;;;;;;;MAUaA,cAAc,GAAwC;EAC/DC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE;;SAWMC,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,MAAM;IAAEC,YAAY;IAAEC,aAAa;IAAEC;GAAO,GAAGN,KAAK;EAC9E,MAAMO,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAAwB;EACxD,MAAMC,UAAU,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAMV,MAAM,CAACW,SAAS,CAACJ,IAAI,EAAE,EAAE,CAA+B;EAC/F,MAAMK,OAAO,GAAGZ,MAAM,CAACa,UAAU,EAAE;EACnC,MAAMC,OAAO,GAAGC,eAAe,CAACX,KAAK,EAAEH,MAAM,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AM,EAAE/C,UAAU;IAClBkD,YAAY,EAAE5C,gBAAgB;IAC9BnB,aAAa,EAAEA,aAAa;IAC5BqB,aAAa,EAAEA,aAAa;IAC5BpB,KAAK,EAAEA;IACT,GACF,IAAI,CAEf,EAEAF,YAAY,gBAAGO,6BAAC0F,eAAe,OAAG,GAAG,IAAI,EACzC,CAAC5C,aAAa,IAAIR,SAAS,gBAAGtC,6BAAC2F,OAAO;IAAC3C,UAAU,EAAEA,UAAU;IAAEO,QAAQ,EAAE9C;IAAgB,GAAG,IAAI,CAC/F;AAEd,CAAC,CAAsE;SAEvDiF,eAAeA;EAC3B,oBACI1F;iBACc,kBAAkB;IAC5B6D,SAAS,EAAEC,EAAE,CACT,8HAA8H;kBAElI9D;IAAK6D,SAAS,EAAEC,EAAE,CAAC,4BAA4B;IAAK,CAClD;AAEd;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { ColumnMeta, HeaderContext, TableMeta } from '@tanstack/react-table';\nimport { Menu, isMenuAvailable, isGotoAvailable } from './Menu';\nimport { Resizer } from './Resizer';\nimport { Table3ColumnAlignment, Table3SortDirection, TableStrategy } from '../../../types';\nimport { getSortAttributes, SortIndicator } from './SortIndicator';\nimport { isFrozenColumn, isInternalColumn } from '../../../util/columns';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport const SORT_DIRECTION: Record<string, Table3SortDirection> = {\n ASC: 'asc',\n DESC: 'desc',\n};\n\nexport type HeaderSortDirection = Table3SortDirection | false;\nexport type SortToggleHandler = (sortDirection: HeaderSortDirection) => void;\n\nexport type HeaderProps<TType = unknown> = HeaderContext<TType, unknown> & {\n children?: string | JSX.Element;\n hasSeparator?: boolean;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, hasSeparator, scrollToIndex, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const canSort = column.getCanSort();\n const hasGoto = isGotoAvailable(table, header);\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const handleHide = React.useMemo(() => header.column.getToggleVisibilityHandler(), []);\n const handleResize = React.useMemo(() => header.getResizeHandler(), []);\n const handleSort = React.useMemo(() => header.column.getToggleSortingHandler(), []);\n const handleSortToggle = React.useCallback((sortDirection: HeaderSortDirection) => {\n // When sorting is not applied, sortDirection is false.\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === SORT_DIRECTION.DESC);\n }\n }, []);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n const handleGoto = React.useMemo(() => {\n if (hasGoto) {\n return ((query: string) => tableMeta.rowGoto.handleGoto(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n return undefined;\n }, [hasGoto, JSON.stringify(sorting), JSON.stringify(filters), search]);\n\n const memoedProps = {\n align: columnMeta.align,\n canFreeze: tableMeta.columnFreezing.isEnabled,\n canHide: column.getCanHide(),\n canResize: column.getCanResize(),\n canSort,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasMenu: isMenuAvailable<TType>(table, header),\n hasSeparator,\n id: header.id,\n index: header.index,\n isFrozen: isFrozenColumn(header, table),\n isPlaceholder: header.isPlaceholder,\n isPrinting: tableMeta.isPrinting,\n isResizing: column.getIsResizing(),\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort as (event: unknown) => void,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection: column.getIsSorted(),\n table,\n };\n\n return <MemoedHeader<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedHeaderProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header'> & {\n align?: Table3ColumnAlignment;\n canFreeze: boolean;\n canHide: boolean;\n canResize: boolean;\n canSort: boolean;\n colSpan: number;\n hasMenu: boolean;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isFrozen: boolean;\n isPlaceholder: boolean;\n isPrinting: boolean;\n isResizing: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onResize: (event: unknown) => void;\n onSort: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader<TType = unknown>(props: MemoedHeaderProps<TType>) {\n const {\n align,\n children,\n canFreeze,\n canHide,\n canResize,\n canSort,\n colSpan,\n hasMenu,\n hasSeparator,\n id,\n index,\n isFrozen,\n isPlaceholder,\n isPrinting,\n isResizing,\n length,\n meta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n\n const className = cn(\n 'font-bold border-b-2 box-content group/column relative',\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n 'px-[var(--table3-cell-padding-x)]',\n {\n '!border-white': isPlaceholder,\n 'h-10 items-center sticky': !isPrinting,\n 'pb-2': isPrinting,\n 'cursor-pointer select-none': canSort,\n 'hover:bg-grey-100': !isPlaceholder && (canSort || canResize || hasMenu),\n 'focus-within:bg-grey-100': hasMenu,\n '!pointer-events-all !bg-grey-100': !isPlaceholder && isResizing,\n // z-indexes\n 'z-10 hover:z-20': !isFrozen && !isResizing,\n 'z-20': !isFrozen && isResizing,\n // when column is frozen, we need to increase it's z-index when it's hovered,\n // so that resize handler appears on top of next frozen cell, and didn't get cut by it.\n '!z-30 hover:!z-40': isFrozen,\n '!z-40': isFrozen && isResizing,\n },\n colSpan > 1 ? `col-span-${colSpan}` : '',\n meta.headerClassName\n );\n\n const [internalRef, setInternalRef] = React.useState<HTMLDivElement | null>(null);\n\n React.useLayoutEffect(() => {\n if (internalRef && length) {\n // the actions column size gets set by the column itself\n if (isInternalColumn(id)) {\n return;\n }\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [id]: internalRef.getBoundingClientRect().width,\n }));\n }\n }, [internalRef, length]);\n\n if (table.options.debugAll) {\n console.log('header render', id);\n }\n return (\n <div\n {...(canSort ? getSortAttributes(handleSort, sortDirection) : undefined)}\n className={className}\n data-align={align}\n data-column-index={index}\n role=\"columnheader\"\n ref={setInternalRef}>\n {isPlaceholder ? null : (\n <>\n {isInternalColumn(id) ? (\n children\n ) : (\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n )}\n {canSort ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <Menu\n canFreeze={canFreeze}\n canHide={canHide}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-2': align === 'right',\n })}\n index={index}\n menu={meta.menu}\n onGoto={handleGoto}\n onHide={handleHide}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n sortDirection={sortDirection}\n table={table}\n />\n ) : null}\n </>\n )}\n {/* Header separator need to go before Resizer to prevent it's overlapping */}\n {hasSeparator ? <HeaderSeparator /> : null}\n {!isPlaceholder && canResize ? <Resizer isResizing={isResizing} onResize={handleResize} /> : null}\n </div>\n );\n}) as <TType = unknown>(props: MemoedHeaderProps<TType>) => JSX.Element;\n\nexport function HeaderSeparator() {\n return (\n <div\n data-taco=\"header-separator\"\n className={cn(\n 'invisible absolute right-[0.5px] top-0 flex h-full w-2 touch-none select-none justify-center py-2 group-hover/header:visible'\n )}>\n <div className={cn('bg-grey-300 h-full w-[1px]')} />\n </div>\n );\n}\n"],"names":["SORT_DIRECTION","ASC","DESC","Header","props","children","column","header","hasSeparator","scrollToIndex","table","tableMeta","options","meta","columnMeta","React","useMemo","columnDef","canSort","getCanSort","hasGoto","isGotoAvailable","handleHide","getToggleVisibilityHandler","handleResize","getResizeHandler","handleSort","getToggleSortingHandler","handleSortToggle","useCallback","sortDirection","clearSorting","toggleSorting","sorting","getState","filters","columnFilters","search","globalFilter","handleGoto","query","rowGoto","id","undefined","JSON","stringify","memoedProps","align","canFreeze","columnFreezing","isEnabled","canHide","getCanHide","canResize","getCanResize","colSpan","hasMenu","isMenuAvailable","index","isFrozen","isFrozenColumn","isPlaceholder","isPrinting","isResizing","getIsResizing","length","getRowModel","rows","onGoto","onHide","onResize","onSort","onSortToggle","getIsSorted","MemoedHeader","memo","className","cn","headerClassName","internalRef","setInternalRef","useState","useLayoutEffect","isInternalColumn","setColumnSizing","sizes","getBoundingClientRect","width","debugAll","console","log","getSortAttributes","role","ref","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","SortIndicator","direction","Menu","menu","HeaderSeparator","Resizer"],"mappings":";;;;;;;;MAUaA,cAAc,GAAwC;EAC/DC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE;;SAWMC,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,MAAM;IAAEC,YAAY;IAAEC,aAAa;IAAEC;GAAO,GAAGN,KAAK;EAC9E,MAAMO,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAAwB;EACxD,MAAMC,UAAU,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAMV,MAAM,CAACW,SAAS,CAACJ,IAAI,EAAE,EAAE,CAA+B;EAC/F,MAAMK,OAAO,GAAGZ,MAAM,CAACa,UAAU,EAAE;EACnC,MAAMC,OAAO,GAAGC,eAAe,CAACX,KAAK,EAAEH,MAAM,CAAC;;EAG9C,MAAMe,UAAU,GAAGP,cAAK,CAACC,OAAO,CAAC,MAAMT,MAAM,CAACD,MAAM,CAACiB,0BAA0B,EAAE,EAAE,EAAE,CAAC;EACtF,MAAMC,YAAY,GAAGT,cAAK,C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YAAY,gBAAGO,6BAAC0F,eAAe,OAAG,GAAG,IAAI,EACzC,CAAC5C,aAAa,IAAIR,SAAS,gBAAGtC,6BAAC2F,OAAO;IAAC3C,UAAU,EAAEA,UAAU;IAAEO,QAAQ,EAAE9C;IAAgB,GAAG,IAAI,CAC/F;AAEd,CAAC,CAAsE;SAEvDiF,eAAeA;EAC3B,oBACI1F;iBACc,kBAAkB;IAC5B6D,SAAS,EAAEC,EAAE,CACT,8HAA8H;kBAElI9D;IAAK6D,SAAS,EAAEC,EAAE,CAAC,4BAA4B;IAAK,CAClD;AAEd;;;;"}
@@ -6,7 +6,9 @@ import { RowContext, useRowContext } from './RowContext.js';
6
6
  import { focusableSelector } from '../../util/editing.js';
7
7
 
8
8
  const FOCUS_MANAGER_OPTIONS = {
9
- tabbable: true
9
+ tabbable: true,
10
+ // Filter out all focusable elelemnts which are not in current row
11
+ accept: element => !!element.closest('[role="row"][data-current="true"]')
10
12
  };
11
13
  function Row(props) {
12
14
  const focusManager = useFocusManager();
@@ -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\nconst FOCUS_MANAGER_OPTIONS = { tabbable: true };\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n measureRef: (el: HTMLElement | null) => void;\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 focusManager = useFocusManager();\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 const isFirstRow = props.index === 0;\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 // tab behaviour is consistent across normal mode and edit mode, handle it here\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (event.key === 'Tab') {\n tableMeta.hoverState.pause(true);\n let focusedElement: Element;\n\n if (event.shiftKey) {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no previous elements to focus, go up a row or go outside the table\n if (!isFirstRow) {\n event.preventDefault();\n tableMeta.currentRow.setCurrentRowIndex(props.index - 1);\n setTimeout(() => focusManager.focusLast(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow) {\n event.preventDefault();\n tableMeta.currentRow.setCurrentRowIndex(props.index + 1);\n setTimeout(() => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n }\n }\n };\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 onKeyDown: handleKeyDown,\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 isFirstRow={isFirstRow}\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 { isFirstRow, isLastRow, onKeyDown, setCurrentRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\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\n if (event.key === 'ArrowLeft') {\n // We 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(FOCUS_MANAGER_OPTIONS);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // there are no previous elements to focus, go up a row (if there are rows above)\n if (!isFirstRow) {\n event.preventDefault();\n tableMeta.hoverState.pause(true);\n tableMeta.currentRow.setCurrentRowIndex(props.index - 1);\n setTimeout(() => {\n focusManager.focusLast(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n }\n }\n }\n }\n };\n\n const handleArrowRightKey = event => {\n let focusedElement: Element;\n\n if (event.key === 'ArrowRight') {\n // We 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(FOCUS_MANAGER_OPTIONS);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow) {\n event.preventDefault();\n tableMeta.hoverState.pause(true);\n tableMeta.currentRow.setCurrentRowIndex(props.index + 1);\n setTimeout(() => {\n focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n }\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 onKeyDown(event); // handles tab behaviour\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(FOCUS_MANAGER_OPTIONS);\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, measureRef, 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 measure the first cell (since the row has display: contents) so that the virtualiser height is correct\n React.useEffect(() => {\n const firstCell = ref.current?.querySelector('[role=cell]:first-child');\n\n if (firstCell) {\n measureRef(firstCell as HTMLElement);\n }\n }, [ref.current]);\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 [isDraggedOver, 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 data-dragged-over={isDraggedOver}\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":["FOCUS_MANAGER_OPTIONS","tabbable","Row","props","focusManager","useFocusManager","tableMeta","table","options","meta","isCurrentRow","currentRow","currentRowIndex","index","isDraggingRow","rowDrag","dragging","row","id","isFirstRow","isHovered","setIsHovered","React","useState","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","key","hoverState","pause","focusedElement","shiftKey","focusPrevious","preventDefault","setCurrentRowIndex","setTimeout","focusLast","focusNext","isLastRow","focusFirst","memoedProps","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","onKeyDown","output","MemoedRow","editing","isEditing","isPaused","EditingRow","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastIndex","getColumnIndex","_focusedElement$close","closest","getAttribute","previouslyHoveredIndex","unhoverPreviousRow","tableRef","_tableRef$current","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","handleClickCapture","target","handleArrowLeftKey","stopPropagation","ctrlKey","metaKey","blur","handleArrowRightKey","useEffect","detailModeEditing","_props$tableRef$curre","_lastIndexCell$queryS","lastIndexCell","focusableSelector","focus","onClickCapture","clickableElements","memo","_1","measureRef","ref","useRef","useRowContext","firstCell","_ref$current","requestAnimationFrame","_ref$current2","clickedElement","contains","includes","tagName","toLowerCase","map","tag","join","original","handleMouseEnter","handleMouseLeave","isDraggedOver","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;AASA,MAAMA,qBAAqB,GAAG;EAAEC,QAAQ,EAAE;CAAM;SAahCC,GAAGA,CAAkBC,KAAsB;EACvD,MAAMC,YAAY,GAAGC,eAAe,EAAE;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AACC,QAAQ,CAAC;QAC5BF,sBAAsB,GAAGzD,KAAK;;KAErC,MAAM;MACHyD,sBAAsB,GAAGzD,KAAK;;IAElCQ,YAAY,CAAC,IAAI,CAAC;GACrB;EACD,MAAMsG,gBAAgB,GAAGA;IACrB,IAAIrD,sBAAsB,KAAKzD,KAAK,EAAE;MAClCyD,sBAAsB,GAAG3B,SAAS;;IAEtCtB,YAAY,CAAC,KAAK,CAAC;GACtB;EAED,MAAM,CAACuG,aAAa,EAAEC,eAAe,CAAC,GAAGC,aAAa,CAACrG,KAAK,IAAIwB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAGxB,KAAK,EAAER,GAAG,CAACwG,QAAQ,CAAC,CAAC;EAE9F,MAAMM,SAAS,GAAGC,EAAE,CAChB,oBAAoB;;;EAGpB,8DAA8D,EAC9D;IACI,sBAAsB,EAAE,OAAOlF,OAAO,KAAK;GAC9C,CACJ;EAED,oBACIxB,sDACQ+D,UAAU,EACTpC,MAAM,GAAG4E,eAAe,GAAGlF,SAAS;IACzCoF,SAAS,EAAEA,SAAS;sBACJlH,KAAK;yBACF+G,aAAa;IAChC9E,OAAO,EAAEE,WAAW;IACpBqD,cAAc,EAAEf,kBAAkB;IAClC2C,YAAY,EAAEP,gBAAgB;IAC9BQ,YAAY,EAAEP,gBAAgB;IAC9BQ,IAAI,EAAC,KAAK;IACVzB,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\nconst FOCUS_MANAGER_OPTIONS = {\n tabbable: true,\n // Filter out all focusable elelemnts which are not in current row\n accept: (element: Element) => !!element.closest('[role=\"row\"][data-current=\"true\"]'),\n};\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n measureRef: (el: HTMLElement | null) => void;\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 focusManager = useFocusManager();\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 const isFirstRow = props.index === 0;\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 // tab behaviour is consistent across normal mode and edit mode, handle it here\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (event.key === 'Tab') {\n tableMeta.hoverState.pause(true);\n let focusedElement: Element;\n\n if (event.shiftKey) {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no previous elements to focus, go up a row or go outside the table\n if (!isFirstRow) {\n event.preventDefault();\n tableMeta.currentRow.setCurrentRowIndex(props.index - 1);\n setTimeout(() => focusManager.focusLast(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow) {\n event.preventDefault();\n tableMeta.currentRow.setCurrentRowIndex(props.index + 1);\n setTimeout(() => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n }\n }\n };\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 onKeyDown: handleKeyDown,\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 isFirstRow={isFirstRow}\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 { isFirstRow, isLastRow, onKeyDown, setCurrentRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\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\n if (event.key === 'ArrowLeft') {\n // We 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(FOCUS_MANAGER_OPTIONS);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // there are no previous elements to focus, go up a row (if there are rows above)\n if (!isFirstRow) {\n event.preventDefault();\n tableMeta.hoverState.pause(true);\n tableMeta.currentRow.setCurrentRowIndex(props.index - 1);\n setTimeout(() => {\n focusManager.focusLast(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n }\n }\n }\n }\n };\n\n const handleArrowRightKey = event => {\n let focusedElement: Element;\n\n if (event.key === 'ArrowRight') {\n // We 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(FOCUS_MANAGER_OPTIONS);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow) {\n event.preventDefault();\n tableMeta.hoverState.pause(true);\n tableMeta.currentRow.setCurrentRowIndex(props.index + 1);\n setTimeout(() => {\n focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n }\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 onKeyDown(event); // handles tab behaviour\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(FOCUS_MANAGER_OPTIONS);\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, measureRef, 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 measure the first cell (since the row has display: contents) so that the virtualiser height is correct\n React.useEffect(() => {\n const firstCell = ref.current?.querySelector('[role=cell]:first-child');\n\n if (firstCell) {\n measureRef(firstCell as HTMLElement);\n }\n }, [ref.current]);\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 [isDraggedOver, 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 data-dragged-over={isDraggedOver}\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":["FOCUS_MANAGER_OPTIONS","tabbable","accept","element","closest","Row","props","focusManager","useFocusManager","tableMeta","table","options","meta","isCurrentRow","currentRow","currentRowIndex","index","isDraggingRow","rowDrag","dragging","row","id","isFirstRow","isHovered","setIsHovered","React","useState","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","key","hoverState","pause","focusedElement","shiftKey","focusPrevious","preventDefault","setCurrentRowIndex","setTimeout","focusLast","focusNext","isLastRow","focusFirst","memoedProps","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","onKeyDown","output","MemoedRow","editing","isEditing","isPaused","EditingRow","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastIndex","getColumnIndex","_focusedElement$close","getAttribute","previouslyHoveredIndex","unhoverPreviousRow","tableRef","_tableRef$current","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","handleClickCapture","target","handleArrowLeftKey","stopPropagation","ctrlKey","metaKey","blur","handleArrowRightKey","useEffect","detailModeEditing","_props$tableRef$curre","_lastIndexCell$queryS","lastIndexCell","focusableSelector","focus","onClickCapture","clickableElements","memo","_1","measureRef","ref","useRef","useRowContext","firstCell","_ref$current","requestAnimationFrame","_ref$current2","clickedElement","contains","includes","tagName","toLowerCase","map","tag","join","original","handleMouseEnter","handleMouseLeave","isDraggedOver","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;AASA,MAAMA,qBAAqB,GAAG;EAC1BC,QAAQ,EAAE,IAAI;;EAEdC,MAAM,EAAGC,OAAgB,IAAK,CAAC,CAACA,OAAO,CAACC,OAAO,CAAC,mCAAmC;CACtF;SAaeC,GAAGA,CAAkBC,KAAsB;EACvD,MAAMC,YAAY,GAAGC,eAAe,EAAE;EACtC,MAAMC,SAAS,GAAGH,KAAK,CAACI,KAAK,CAACC,OAAO,CAACC,IAAwB;EAC9D,MAAMC,YAAY,GAAGJ,SAAS,CAACK,UAAU,CAACC,eAAe,KAAKT,KAAK,CAACU,KAAK;EACzE,MAAMC,aAAa,GAAGR,SAAS,CAACS,OAAO,CAACC,QAAQ,CAACb,KAAK,CAACc,GAAG,CAACC,EAAE,CAAC;EAC9D,MAAMC,UAAU,GAAGhB,KAAK,CAACU,KAAK,KAAK,CAAC;;EAEpC,MAAM,CAACO,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGvD,MAAMC,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAID,KAAK,CAACE,oBAAoB,EAAE,EAAE;MAC5D;;IAGJ,IAAIF,KAAK,CAACG,GAAG,KAAK,KAAK,EAAE;MACrBtB,SAAS,CAACuB,UAAU,CAACC,KAAK,CAAC,IAAI,CAAC;MAChC,IAAIC,cAAuB;MAE3B,IAAIN,KAAK,CAACO,QAAQ,EAAE;;QAEhBD,cAAc,GAAG3B,YAAY,CAAC6B,aAAa,CAACpC,qBAAqB,CAAC;QAElE,IAAIkC,cAAc,EAAE;;UAEhBN,KAAK,CAACS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AAEP,gBAAgB;IAC9BQ,IAAI,EAAC,KAAK;IACVzB,GAAG,EAAEA;KACP;AAEV,CAAC,CAAmE;;;;"}
@@ -24,7 +24,8 @@ const PRINT_STYLES = `
24
24
  overflow-y: hidden !important;
25
25
  }
26
26
 
27
- [role="table"] [role="columnheader"] {
27
+ // all column headers except column group column header
28
+ [role="table"] [role="columnheader"]:not([data-taco='table3-column-group']) {
28
29
  border-bottom-width: 1px !important;
29
30
  }
30
31
 
@@ -1 +1 @@
1
- {"version":3,"file":"useParentStylesheets.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.ts"],"sourcesContent":["import React from 'react';\n\nconst PRINT_STYLES = `\n@page {\n margin: 16px;\n}\n\n@media print {\n html, body, #root {\n // hides horizontal scrollbar\n overflow-x: none !important;\n overflow-y: auto !important;\n height: auto !important;\n width: auto !important;\n }\n\n #root {\n /* chrome sometimes crops the bottom content of page and this padding will make sure that we see the whole content*/\n padding-bottom: 20px;\n }\n\n [role=\"table\"] {\n border-width: 0 !important;\n overflow-y: hidden !important;\n }\n\n [role=\"table\"] [role=\"columnheader\"] {\n border-bottom-width: 1px !important;\n }\n\n /*\n * Summary row cells\n */\n [role=\"table\"] [role=\"rowgroup\"]:last-child [role=\"cell\"] {\n border-width: 0 !important;\n }\n\n [role=\"table\"] a {\n color: rgb(28 28 28);\n }\n\n [data-taco=\"alert\"],\n [data-taco=\"banner\"],\n [data-taco=\"hanger\"],\n [data-taco=\"toast\"],\n [data-taco=\"table3-toolbar\"],\n [data-taco=\"tooltip\"],\n /*\n * Tour components\n */\n [id^=\"react-joyride\"]\n {\n display: none !important;\n }\n}\n`;\n\nexport function useParentStylesheets(iframeWindow: Window | null | undefined) {\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (!iframeWindow) {\n return;\n }\n\n const parentDocument = iframeWindow.parent.document;\n const iframeDocument = iframeWindow.document;\n\n // add our custom print styles\n const customPrintStyles = iframeDocument.createElement('style');\n\n if (customPrintStyles) {\n customPrintStyles.innerHTML = PRINT_STYLES;\n iframeDocument.head.appendChild(customPrintStyles);\n }\n\n // Get style tags from the parent\n const parentStylesheets = Array.from(\n parentDocument.querySelectorAll('style:not([data-taco=\"table3-column-freezing-styles\"])')\n );\n // Get linked stylesheets from the parent\n const linkStylesheets = Array.from(parentDocument.querySelectorAll('[rel=\"stylesheet\"]'));\n\n // We want to add tailwind styles specifically but there is no guarenteed way to know which style tag has\n // tailwind styles, so we add all the styles present in the parent frame\n parentStylesheets.forEach(parentStyle => {\n const styleTag = iframeDocument.createElement('style');\n\n styleTag.innerHTML = parentStyle.innerHTML;\n iframeDocument.head.appendChild(styleTag);\n });\n\n // Add all link tags that are stylesheets, to the iframe head, so that we include the taco and client styles\n linkStylesheets.forEach(linkStylesheet => {\n const linkTag = iframeDocument.createElement('link');\n\n linkTag.setAttribute('rel', 'stylesheet');\n linkTag.setAttribute('href', linkStylesheet.getAttribute('href') ?? '');\n\n iframeDocument.head.appendChild(linkTag);\n });\n\n setReady(true);\n }, [iframeWindow]);\n\n return ready;\n}\n"],"names":["PRINT_STYLES","useParentStylesheets","iframeWindow","ready","setReady","React","useState","useEffect","parentDocument","parent","document","iframeDocument","customPrintStyles","createElement","innerHTML","head","appendChild","parentStylesheets","Array","from","querySelectorAll","linkStylesheets","forEach","parentStyle","styleTag","linkStylesheet","linkTag","setAttribute","_linkStylesheet$getAt","getAttribute"],"mappings":";;AAEA,MAAMA,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDjB;SAEeC,oBAAoBA,CAACC,YAAuC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAE/CD,cAAK,CAACE,SAAS,CAAC;IACZ,IAAI,CAACL,YAAY,EAAE;MACf;;IAGJ,MAAMM,cAAc,GAAGN,YAAY,CAACO,MAAM,CAACC,QAAQ;IACnD,MAAMC,cAAc,GAAGT,YAAY,CAACQ,QAAQ;;IAG5C,MAAME,iBAAiB,GAAGD,cAAc,CAACE,aAAa,CAAC,OAAO,CAAC;IAE/D,IAAID,iBAAiB,EAAE;MACnBA,iBAAiB,CAACE,SAAS,GAAGd,YAAY;MAC1CW,cAAc,CAACI,IAAI,CAACC,WAAW,CAACJ,iBAAiB,CAAC;;;IAItD,MAAMK,iBAAiB,GAAGC,KAAK,CAACC,IAAI,CAChCX,cAAc,CAACY,gBAAgB,CAAC,wDAAwD,CAAC,CAC5F;;IAED,MAAMC,eAAe,GAAGH,KAAK,CAACC,IAAI,CAACX,cAAc,CAACY,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;;;IAIzFH,iBAAiB,CAACK,OAAO,CAACC,WAAW;MACjC,MAAMC,QAAQ,GAAGb,cAAc,CAACE,aAAa,CAAC,OAAO,CAAC;MAEtDW,QAAQ,CAACV,SAAS,GAAGS,WAAW,CAACT,SAAS;MAC1CH,cAAc,CAACI,IAAI,CAACC,WAAW,CAACQ,QAAQ,CAAC;KAC5C,CAAC;;IAGFH,eAAe,CAACC,OAAO,CAACG,cAAc;;MAClC,MAAMC,OAAO,GAAGf,cAAc,CAACE,aAAa,CAAC,MAAM,CAAC;MAEpDa,OAAO,CAACC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC;MACzCD,OAAO,CAACC,YAAY,CAAC,MAAM,GAAAC,qBAAA,GAAEH,cAAc,CAACI,YAAY,CAAC,MAAM,CAAC,cAAAD,qBAAA,cAAAA,qBAAA,GAAI,EAAE,CAAC;MAEvEjB,cAAc,CAACI,IAAI,CAACC,WAAW,CAACU,OAAO,CAAC;KAC3C,CAAC;IAEFtB,QAAQ,CAAC,IAAI,CAAC;GACjB,EAAE,CAACF,YAAY,CAAC,CAAC;EAElB,OAAOC,KAAK;AAChB;;;;"}
1
+ {"version":3,"file":"useParentStylesheets.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.ts"],"sourcesContent":["import React from 'react';\n\nconst PRINT_STYLES = `\n@page {\n margin: 16px;\n}\n\n@media print {\n html, body, #root {\n // hides horizontal scrollbar\n overflow-x: none !important;\n overflow-y: auto !important;\n height: auto !important;\n width: auto !important;\n }\n\n #root {\n /* chrome sometimes crops the bottom content of page and this padding will make sure that we see the whole content*/\n padding-bottom: 20px;\n }\n\n [role=\"table\"] {\n border-width: 0 !important;\n overflow-y: hidden !important;\n }\n\n // all column headers except column group column header\n [role=\"table\"] [role=\"columnheader\"]:not([data-taco='table3-column-group']) {\n border-bottom-width: 1px !important;\n }\n\n /*\n * Summary row cells\n */\n [role=\"table\"] [role=\"rowgroup\"]:last-child [role=\"cell\"] {\n border-width: 0 !important;\n }\n\n [role=\"table\"] a {\n color: rgb(28 28 28);\n }\n\n [data-taco=\"alert\"],\n [data-taco=\"banner\"],\n [data-taco=\"hanger\"],\n [data-taco=\"toast\"],\n [data-taco=\"table3-toolbar\"],\n [data-taco=\"tooltip\"],\n /*\n * Tour components\n */\n [id^=\"react-joyride\"]\n {\n display: none !important;\n }\n}\n`;\n\nexport function useParentStylesheets(iframeWindow: Window | null | undefined) {\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (!iframeWindow) {\n return;\n }\n\n const parentDocument = iframeWindow.parent.document;\n const iframeDocument = iframeWindow.document;\n\n // add our custom print styles\n const customPrintStyles = iframeDocument.createElement('style');\n\n if (customPrintStyles) {\n customPrintStyles.innerHTML = PRINT_STYLES;\n iframeDocument.head.appendChild(customPrintStyles);\n }\n\n // Get style tags from the parent\n const parentStylesheets = Array.from(\n parentDocument.querySelectorAll('style:not([data-taco=\"table3-column-freezing-styles\"])')\n );\n // Get linked stylesheets from the parent\n const linkStylesheets = Array.from(parentDocument.querySelectorAll('[rel=\"stylesheet\"]'));\n\n // We want to add tailwind styles specifically but there is no guarenteed way to know which style tag has\n // tailwind styles, so we add all the styles present in the parent frame\n parentStylesheets.forEach(parentStyle => {\n const styleTag = iframeDocument.createElement('style');\n\n styleTag.innerHTML = parentStyle.innerHTML;\n iframeDocument.head.appendChild(styleTag);\n });\n\n // Add all link tags that are stylesheets, to the iframe head, so that we include the taco and client styles\n linkStylesheets.forEach(linkStylesheet => {\n const linkTag = iframeDocument.createElement('link');\n\n linkTag.setAttribute('rel', 'stylesheet');\n linkTag.setAttribute('href', linkStylesheet.getAttribute('href') ?? '');\n\n iframeDocument.head.appendChild(linkTag);\n });\n\n setReady(true);\n }, [iframeWindow]);\n\n return ready;\n}\n"],"names":["PRINT_STYLES","useParentStylesheets","iframeWindow","ready","setReady","React","useState","useEffect","parentDocument","parent","document","iframeDocument","customPrintStyles","createElement","innerHTML","head","appendChild","parentStylesheets","Array","from","querySelectorAll","linkStylesheets","forEach","parentStyle","styleTag","linkStylesheet","linkTag","setAttribute","_linkStylesheet$getAt","getAttribute"],"mappings":";;AAEA,MAAMA,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDjB;SAEeC,oBAAoBA,CAACC,YAAuC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAE/CD,cAAK,CAACE,SAAS,CAAC;IACZ,IAAI,CAACL,YAAY,EAAE;MACf;;IAGJ,MAAMM,cAAc,GAAGN,YAAY,CAACO,MAAM,CAACC,QAAQ;IACnD,MAAMC,cAAc,GAAGT,YAAY,CAACQ,QAAQ;;IAG5C,MAAME,iBAAiB,GAAGD,cAAc,CAACE,aAAa,CAAC,OAAO,CAAC;IAE/D,IAAID,iBAAiB,EAAE;MACnBA,iBAAiB,CAACE,SAAS,GAAGd,YAAY;MAC1CW,cAAc,CAACI,IAAI,CAACC,WAAW,CAACJ,iBAAiB,CAAC;;;IAItD,MAAMK,iBAAiB,GAAGC,KAAK,CAACC,IAAI,CAChCX,cAAc,CAACY,gBAAgB,CAAC,wDAAwD,CAAC,CAC5F;;IAED,MAAMC,eAAe,GAAGH,KAAK,CAACC,IAAI,CAACX,cAAc,CAACY,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;;;IAIzFH,iBAAiB,CAACK,OAAO,CAACC,WAAW;MACjC,MAAMC,QAAQ,GAAGb,cAAc,CAACE,aAAa,CAAC,OAAO,CAAC;MAEtDW,QAAQ,CAACV,SAAS,GAAGS,WAAW,CAACT,SAAS;MAC1CH,cAAc,CAACI,IAAI,CAACC,WAAW,CAACQ,QAAQ,CAAC;KAC5C,CAAC;;IAGFH,eAAe,CAACC,OAAO,CAACG,cAAc;;MAClC,MAAMC,OAAO,GAAGf,cAAc,CAACE,aAAa,CAAC,MAAM,CAAC;MAEpDa,OAAO,CAACC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC;MACzCD,OAAO,CAACC,YAAY,CAAC,MAAM,GAAAC,qBAAA,GAAEH,cAAc,CAACI,YAAY,CAAC,MAAM,CAAC,cAAAD,qBAAA,cAAAA,qBAAA,GAAI,EAAE,CAAC;MAEvEjB,cAAc,CAACI,IAAI,CAACC,WAAW,CAACU,OAAO,CAAC;KAC3C,CAAC;IAEFtB,QAAQ,CAAC,IAAI,CAAC;GACjB,EAAE,CAACF,YAAY,CAAC,CAAC;EAElB,OAAOC,KAAK;AAChB;;;;"}
@@ -38,10 +38,10 @@ function SettingsButton(props) {
38
38
  icon: "sliders",
39
39
  menu: popoverElement ? undefined : menuProps => /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, {
40
40
  align: "end"
41
- }, table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Menu.Item, {
41
+ }, table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Item, {
42
42
  icon: "columns",
43
43
  onClick: () => setPopover('columnSettings')
44
- }, texts.table3.columnSettings.button), /*#__PURE__*/React__default.createElement(Menu.Separator, null)) : null, tableMeta.rowHeight.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Item, {
44
+ }, texts.table3.columnSettings.button) : null, tableMeta.rowHeight.isEnabled || tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Separator, null) : null, tableMeta.rowHeight.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Item, {
45
45
  icon: `height-${tableMeta.rowHeight.height}`,
46
46
  subMenu: () => /*#__PURE__*/React__default.createElement(RowHeight, {
47
47
  table: table
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Settings.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { RowHeight } from './RowHeight';\nimport { ColumnSettingsPopover } from './ColumnSettings';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { IconName } from '../../../Icon/Icon';\nimport { FontSize } from './FontSize';\nimport { Table3CustomSettingRenderer } from '../../types';\n\nexport type SettingsButtonProps<TType = unknown> = {\n customSettings?: Table3CustomSettingRenderer[];\n table: RTable<TType>;\n};\nexport function SettingsButton<TType = unknown>(props: SettingsButtonProps<TType>) {\n const { customSettings, table } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const hasColumnSettings = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'columnSettings': {\n if (hasColumnSettings) {\n popoverElement = props => (\n <ColumnSettingsPopover {...props} open onChange={handleClosePopover} table={table} />\n );\n }\n }\n }\n }\n\n return (\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"sliders\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? (\n <>\n <Menu.Item icon=\"columns\" onClick={() => setPopover('columnSettings')}>\n {texts.table3.columnSettings.button}\n </Menu.Item>\n <Menu.Separator />\n </>\n ) : null}\n {tableMeta.rowHeight.isEnabled ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeight table={table} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {tableMeta.fontSize.isEnabled ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSize table={table} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n {customSettings ? (\n <>\n <Menu.Separator />\n {customSettings.map(customSetting => {\n const props = tableMeta.getSettings();\n return customSetting(props);\n })}\n </>\n ) : null}\n </Menu.Content>\n </Menu>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n tooltip={texts.table3.otherOptions.tooltip}\n />\n );\n}\n"],"names":["SettingsButton","props","customSettings","table","texts","useLocalization","popover","setPopover","React","useState","undefined","tableMeta","options","meta","hasColumnSettings","enableHiding","columnOrdering","isEnabled","popoverElement","handleClosePopover","ColumnSettingsPopover","open","onChange","IconButton","table3","otherOptions","tooltip","icon","menu","menuProps","Menu","Content","align","Item","onClick","columnSettings","button","Separator","rowHeight","height","subMenu","RowHeight","fontSize","FontSize","map","customSetting","getSettings","onClickCapture","event","preventDefault"],"mappings":";;;;;;;;SAegBA,cAAcA,CAAkBC,KAAiC;EAC7E,MAAM;IAAEC,cAAc;IAAEC;GAAO,GAAGF,KAAK;EACvC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBC,SAAS,CAAC;EAC3E,MAAMC,SAAS,GAAGR,KAAK,CAACS,OAAO,CAACC,IAAwB;EAExD,MAA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AI,EACPf,SAAS,CAAC+B,QAAQ,CAACzB,SAAS,gBACzBT,6BAACsB,IAAI,CAACG,IAAI;MAACN,IAAI,EAAC,WAAW;MAACa,OAAO,EAAEA,mBAAMhC,6BAACmC,QAAQ;QAACxC,KAAK,EAAEA;;OACvDC,KAAK,CAACoB,MAAM,CAACkB,QAAQ,CAAChB,OAAO,CACtB,GACZ,IAAI,EACPxB,cAAc,gBACXM,yEACIA,6BAACsB,IAAI,CAACO,SAAS,OAAG,EACjBnC,cAAc,CAAC0C,GAAG,CAACC,aAAa;MAC7B,MAAM5C,KAAK,GAAGU,SAAS,CAACmC,WAAW,EAAE;MACrC,OAAOD,aAAa,CAAC5C,KAAK,CAAC;KAC9B,CAAC,CACH,GACH,IAAI,CACG,CAEtB;IAEXK,OAAO,EAAEY,cAAc;IACvB6B,cAAc,EAAEC,KAAK,IAAIA,KAAK,CAACC,cAAc,EAAE;IAC/CvB,OAAO,EAAEtB,KAAK,CAACoB,MAAM,CAACC,YAAY,CAACC;IACrC;AAEV;;;;"}
1
+ {"version":3,"file":"Settings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Settings.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { RowHeight } from './RowHeight';\nimport { ColumnSettingsPopover } from './ColumnSettings';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { IconName } from '../../../Icon/Icon';\nimport { FontSize } from './FontSize';\nimport { Table3CustomSettingRenderer } from '../../types';\n\nexport type SettingsButtonProps<TType = unknown> = {\n customSettings?: Table3CustomSettingRenderer[];\n table: RTable<TType>;\n};\nexport function SettingsButton<TType = unknown>(props: SettingsButtonProps<TType>) {\n const { customSettings, table } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const hasColumnSettings = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'columnSettings': {\n if (hasColumnSettings) {\n popoverElement = props => (\n <ColumnSettingsPopover {...props} open onChange={handleClosePopover} table={table} />\n );\n }\n }\n }\n }\n\n return (\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"sliders\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? (\n <Menu.Item icon=\"columns\" onClick={() => setPopover('columnSettings')}>\n {texts.table3.columnSettings.button}\n </Menu.Item>\n ) : null}\n {tableMeta.rowHeight.isEnabled || tableMeta.fontSize.isEnabled ? <Menu.Separator /> : null}\n {tableMeta.rowHeight.isEnabled ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeight table={table} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {tableMeta.fontSize.isEnabled ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSize table={table} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n {customSettings ? (\n <>\n <Menu.Separator />\n {customSettings.map(customSetting => {\n const props = tableMeta.getSettings();\n return customSetting(props);\n })}\n </>\n ) : null}\n </Menu.Content>\n </Menu>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n tooltip={texts.table3.otherOptions.tooltip}\n />\n );\n}\n"],"names":["SettingsButton","props","customSettings","table","texts","useLocalization","popover","setPopover","React","useState","undefined","tableMeta","options","meta","hasColumnSettings","enableHiding","columnOrdering","isEnabled","popoverElement","handleClosePopover","ColumnSettingsPopover","open","onChange","IconButton","table3","otherOptions","tooltip","icon","menu","menuProps","Menu","Content","align","Item","onClick","columnSettings","button","rowHeight","fontSize","Separator","height","subMenu","RowHeight","FontSize","map","custom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3B,GACZ,IAAI,EACPzB,SAAS,CAAC0B,SAAS,CAACpB,SAAS,IAAIN,SAAS,CAAC2B,QAAQ,CAACrB,SAAS,gBAAGT,6BAACsB,IAAI,CAACS,SAAS,OAAG,GAAG,IAAI,EACzF5B,SAAS,CAAC0B,SAAS,CAACpB,SAAS,gBAC1BT,6BAACsB,IAAI,CAACG,IAAI;MACNN,IAAI,YAAYhB,SAAS,CAAC0B,SAAS,CAACG,QAAoB;MACxDC,OAAO,EAAEA,mBAAMjC,6BAACkC,SAAS;QAACvC,KAAK,EAAEA;;OAChCC,KAAK,CAACoB,MAAM,CAACa,SAAS,CAACX,OAAO,CACvB,GACZ,IAAI,EACPf,SAAS,CAAC2B,QAAQ,CAACrB,SAAS,gBACzBT,6BAACsB,IAAI,CAACG,IAAI;MAACN,IAAI,EAAC,WAAW;MAACc,OAAO,EAAEA,mBAAMjC,6BAACmC,QAAQ;QAACxC,KAAK,EAAEA;;OACvDC,KAAK,CAACoB,MAAM,CAACc,QAAQ,CAACZ,OAAO,CACtB,GACZ,IAAI,EACPxB,cAAc,gBACXM,yEACIA,6BAACsB,IAAI,CAACS,SAAS,OAAG,EACjBrC,cAAc,CAAC0C,GAAG,CAACC,aAAa;MAC7B,MAAM5C,KAAK,GAAGU,SAAS,CAACmC,WAAW,EAAE;MACrC,OAAOD,aAAa,CAAC5C,KAAK,CAAC;KAC9B,CAAC,CACH,GACH,IAAI,CACG,CAEtB;IAEXK,OAAO,EAAEY,cAAc;IACvB6B,cAAc,EAAEC,KAAK,IAAIA,KAAK,CAACC,cAAc,EAAE;IAC/CvB,OAAO,EAAEtB,KAAK,CAACoB,MAAM,CAACC,YAAY,CAACC;IACrC;AAEV;;;;"}
@@ -46,7 +46,7 @@ function isSettingsVisible(props) {
46
46
  table
47
47
  } = props;
48
48
  const tableMeta = table.options.meta;
49
- return tableMeta.fontSize.isEnabled || tableMeta.rowHeight.isEnabled;
49
+ return tableMeta.fontSize.isEnabled || tableMeta.rowHeight.isEnabled || tableMeta.columnOrdering.isEnabled;
50
50
  }
51
51
  function isToolbarVisible(props) {
52
52
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Search } from './Search';\nimport { Group } from '../../../Group/Group';\nimport { FiltersButton } from './Filter/filters/Filters';\nimport { EditButton } from './EditButton';\nimport { PrintButton } from './PrintButton/PrintButton';\nimport { Table3CustomSettingRenderer, Table3Props } from '../../types';\nimport { SettingsButton } from './Settings';\n\nexport type ToolbarProps<TType = unknown> = {\n customSettings?: Table3CustomSettingRenderer[];\n left?: JSX.Element;\n right?: JSX.Element;\n scrollToIndex: any;\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n total: number;\n};\nexport function Toolbar<TType = unknown>(props: ToolbarProps<TType>) {\n const { customSettings, left, right, scrollToIndex, table, tableProps, total } = props;\n\n if (!isToolbarVisible(props)) {\n return null;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n <div className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2\" data-taco=\"table3-toolbar\">\n {left}\n <Group className=\"ml-auto flex-shrink-0 print:hidden\">\n {tableMeta.editing.isEnabled ? <EditButton table={table} /> : null}\n {table.options.enableColumnFilters ? <FiltersButton table={table} total={total} /> : null}\n {right}\n {tableMeta.printing.isEnabled ? <PrintButton table={table} tableProps={tableProps} /> : null}\n {isSettingsVisible(props) ? <SettingsButton table={table} customSettings={customSettings} /> : null}\n {tableMeta.search.isEnabled ? <Search scrollToIndex={scrollToIndex} table={table} /> : null}\n </Group>\n </div>\n );\n}\n\nfunction isSettingsVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return tableMeta.fontSize.isEnabled || tableMeta.rowHeight.isEnabled;\n}\n\nfunction isToolbarVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { left, right, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const enableSettingsButton = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n const hasInternalToolbar =\n enableSettingsButton ||\n tableMeta.editing.isEnabled ||\n tableMeta.printing.isEnabled ||\n table.options.enableColumnFilters ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n tableMeta.search.isEnabled;\n\n return hasInternalToolbar || !!left || !!right;\n}\n"],"names":["Toolbar","props","customSettings","left","right","scrollToIndex","table","tableProps","total","isToolbarVisible","tableMeta","options","meta","React","className","Group","editing","isEnabled","EditButton","enableColumnFilters","FiltersButton","printing","PrintButton","isSettingsVisible","SettingsButton","search","Search","fontSize","rowHeight","enableSettingsButton","enableHiding","columnOrdering","hasInternalToolbar"],"mappings":";;;;;;;;SAmBgBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,cAAc;IAAEC,IAAI;IAAEC,KAAK;IAAEC,aAAa;IAAEC,KAAK;IAAEC,UAAU;IAAEC;GAAO,GAAGP,KAAK;EAEtF,IAAI,CAACQ,gBAAgB,CAACR,KAAK,CAAC,EAAE;IAC1B,OAAO,IAAI;;EAGf,MAAMS,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,oBACIC;IAAKC,SAAS,EAAC,mDAAmD;iBAAW;KACxEX,IAAI,eACLU,6BAACE,KAAK;IAACD,SAAS,EAAC;KACZJ,SAAS,CAACM,OAAO,CAACC,SAAS,gBAAGJ,6BAACK,UAAU;IAACZ,KAAK,EAAEA;IAAS,GAAG,IAAI,EACjEA,KAAK,CAACK,OAAO,CAACQ,mBAAmB,gBAAGN,6BAACO,aAAa;IAACd,KAAK,EAAEA,KAAK;IAAEE,KAAK,EAAEA;IAAS,GAAG,IAAI,EACxFJ,KAAK,EACLM,SAAS,CAACW,QAAQ,CAACJ,SAAS,gBAAGJ,6BAACS,WAAW;IAAChB,KA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components/toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Search } from './Search';\nimport { Group } from '../../../Group/Group';\nimport { FiltersButton } from './Filter/filters/Filters';\nimport { EditButton } from './EditButton';\nimport { PrintButton } from './PrintButton/PrintButton';\nimport { Table3CustomSettingRenderer, Table3Props } from '../../types';\nimport { SettingsButton } from './Settings';\n\nexport type ToolbarProps<TType = unknown> = {\n customSettings?: Table3CustomSettingRenderer[];\n left?: JSX.Element;\n right?: JSX.Element;\n scrollToIndex: any;\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n total: number;\n};\nexport function Toolbar<TType = unknown>(props: ToolbarProps<TType>) {\n const { customSettings, left, right, scrollToIndex, table, tableProps, total } = props;\n\n if (!isToolbarVisible(props)) {\n return null;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n <div className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2\" data-taco=\"table3-toolbar\">\n {left}\n <Group className=\"ml-auto flex-shrink-0 print:hidden\">\n {tableMeta.editing.isEnabled ? <EditButton table={table} /> : null}\n {table.options.enableColumnFilters ? <FiltersButton table={table} total={total} /> : null}\n {right}\n {tableMeta.printing.isEnabled ? <PrintButton table={table} tableProps={tableProps} /> : null}\n {isSettingsVisible(props) ? <SettingsButton table={table} customSettings={customSettings} /> : null}\n {tableMeta.search.isEnabled ? <Search scrollToIndex={scrollToIndex} table={table} /> : null}\n </Group>\n </div>\n );\n}\n\nfunction isSettingsVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return tableMeta.fontSize.isEnabled || tableMeta.rowHeight.isEnabled || tableMeta.columnOrdering.isEnabled;\n}\n\nfunction isToolbarVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { left, right, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const enableSettingsButton = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n const hasInternalToolbar =\n enableSettingsButton ||\n tableMeta.editing.isEnabled ||\n tableMeta.printing.isEnabled ||\n table.options.enableColumnFilters ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n tableMeta.search.isEnabled;\n\n return hasInternalToolbar || !!left || !!right;\n}\n"],"names":["Toolbar","props","customSettings","left","right","scrollToIndex","table","tableProps","total","isToolbarVisible","tableMeta","options","meta","React","className","Group","editing","isEnabled","EditButton","enableColumnFilters","FiltersButton","printing","PrintButton","isSettingsVisible","SettingsButton","search","Search","fontSize","rowHeight","columnOrdering","enableSettingsButton","enableHiding","hasInternalToolbar"],"mappings":";;;;;;;;SAmBgBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,cAAc;IAAEC,IAAI;IAAEC,KAAK;IAAEC,aAAa;IAAEC,KAAK;IAAEC,UAAU;IAAEC;GAAO,GAAGP,KAAK;EAEtF,IAAI,CAACQ,gBAAgB,CAACR,KAAK,CAAC,EAAE;IAC1B,OAAO,IAAI;;EAGf,MAAMS,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,oBACIC;IAAKC,SAAS,EAAC,mDAAmD;iBAAW;KACxEX,IAAI,eACLU,6BAACE,KAAK;IAACD,SAAS,EAAC;KACZJ,SAAS,CAACM,OAAO,CAACC,SAAS,gBAAGJ,6BAACK,UAAU;IAACZ,KAAK,EAAEA;IAAS,GAAG,IAAI,EACjEA,KAAK,CAACK,OAAO,CAACQ,mBAAmB,gBAAGN,6BAACO,aAAa;IAACd,KAAK,EAAEA,KAAK;IAAEE,KAAK,EAAEA;IAAS,GAAG,IAAI,EACxFJ,KAAK,EACLM,SAAS,CAACW,QAAQ,CAACJ,SAAS,gBAAGJ,6BAACS,WAAW;IAAChB,KAAK,EAAEA,KAAK;IAAEC,UAAU,EAAEA;IAAc,GAAG,IAAI,EAC3FgB,iBAAiB,CAACtB,KAAK,CAAC,gBAAGY,6BAACW,cAAc;IAAClB,KAAK,EAAEA,KAAK;IAAEJ,cAAc,EAAEA;IAAkB,GAAG,IAAI,EAClGQ,SAAS,CAACe,MAAM,CAACR,SAAS,gBAAGJ,6BAACa,MAAM;IAACrB,aAAa,EAAEA,aAAa;IAAEC,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF,CACN;AAEd;AAEA,SAASiB,iBAAiBA,CAAkBtB,KAA0B;EAClE,MAAM;IAAEK;GAAO,GAAGL,KAAK;EACvB,MAAMS,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OAAOF,SAAS,CAACiB,QAAQ,CAACV,SAAS,IAAIP,SAAS,CAACkB,SAAS,CAACX,SAAS,IAAIP,SAAS,CAACmB,cAAc,CAACZ,SAAS;AAC9G;AAEA,SAASR,gBAAgBA,CAAkBR,KAA0B;EACjE,MAAM;IAAEE,IAAI;IAAEC,KAAK;IAAEE;GAAO,GAAGL,KAAK;EACpC,MAAMS,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,MAAMkB,oBAAoB,GAAGxB,KAAK,CAACK,OAAO,CAACoB,YAAY,IAAIrB,SAAS,CAACmB,cAAc,CAACZ,SAAS;EAC7F,MAAMe,kBAAkB,GACpBF,oBAAoB,IACpBpB,SAAS,CAACM,OAAO,CAACC,SAAS,IAC3BP,SAAS,CAACW,QAAQ,CAACJ,SAAS,IAC5BX,KAAK,CAACK,OAAO,CAACQ,mBAAmB,IACjCT,SAAS,CAACiB,QAAQ,CAACV,SAAS,IAC5BP,SAAS,CAACkB,SAAS,CAACX,SAAS,IAC7BP,SAAS,CAACe,MAAM,CAACR,SAAS;EAE9B,OAAOe,kBAAkB,IAAI,CAAC,CAAC7B,IAAI,IAAI,CAAC,CAACC,KAAK;AAClD;;;;"}
@@ -7,9 +7,13 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7
7
  title,
8
8
  children,
9
9
  placement,
10
+ hide = false,
10
11
  ...otherProps
11
12
  } = props;
12
13
  const className = cn(otherProps.className);
14
+ if (hide) {
15
+ return children;
16
+ }
13
17
  return /*#__PURE__*/createElement(Root, {
14
18
  delayDuration: 250
15
19
  }, /*#__PURE__*/createElement(Trigger, {