@economic/taco 2.14.1 → 2.14.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -860,7 +860,7 @@
860
860
  }
861
861
 
862
862
  [data-font-size='small'] [role='cell'][data-editable] {
863
- @apply px-[calc(var(--table3-cell-padding-x)_-_7px)];
863
+ @apply px-[calc(var(--table3-cell-padding-x)_-_6px)];
864
864
  }
865
865
 
866
866
  [data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox'],
@@ -890,7 +890,7 @@
890
890
  }
891
891
 
892
892
  [data-font-size='medium'] [role='cell'][data-editable] {
893
- @apply px-[calc(var(--table3-cell-padding-x)_-_9px)];
893
+ @apply px-[calc(var(--table3-cell-padding-x)_-_8px)];
894
894
  }
895
895
 
896
896
  [data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox'],
@@ -934,7 +934,7 @@
934
934
  }
935
935
 
936
936
  [data-font-size='large'] [role='cell'][data-editable] {
937
- @apply px-[calc(var(--table3-cell-padding-x)_-_11px)];
937
+ @apply px-[calc(var(--table3-cell-padding-x)_-_10px)];
938
938
  }
939
939
 
940
940
  [data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox'],
@@ -943,3 +943,9 @@
943
943
  [data-font-size='large'] [role='cell'][data-editable] [data-taco='switch-container'] {
944
944
  @apply !mx-[calc(var(--table3-cell-padding-x)_-_5px)] !mt-px;
945
945
  }
946
+
947
+ /* Icon inside column header button uses em values therefore text-sm is required to prevent icon
948
+ from overflowing button's boundaries */
949
+ [data-font-size='large'] [role='columnheader'] button {
950
+ @apply !text-sm;
951
+ }
@@ -5,7 +5,6 @@ import { useLocalization } from '../../../../Provider/Localization.js';
5
5
  import { Menu as Menu$1 } from '../../../../Menu/Menu.js';
6
6
  import { _finallyRethrows, _catch } from '../../../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
7
7
  import { GotoPopover } from './Goto.js';
8
- import { FONT_SIZE } from '../../toolbar/FontSize.js';
9
8
  import { SORT_DIRECTION } from './Header.js';
10
9
  import { isInternalColumn } from '../../../util/columns.js';
11
10
 
@@ -44,7 +43,6 @@ function Menu(props) {
44
43
  } = useLocalization();
45
44
  const [popover, setPopover] = React__default.useState(undefined);
46
45
  const [sortDirectionState, setSortDirectionState] = React__default.useState(sortDirection);
47
- const isFontSizeLarge = tableMeta.fontSize.size === FONT_SIZE.large;
48
46
  const handleSortMenuRadioGroupChange = newSortDirection => {
49
47
  setSortDirectionState(newSortDirection);
50
48
  handleSortToggle(newSortDirection);
@@ -87,10 +85,7 @@ function Menu(props) {
87
85
  }
88
86
  }
89
87
  const className = cn('-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden', 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto', 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto', 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto', {
90
- '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,
91
- // Icon inside button uses em values therefore text-sm is required to prevent icon from overflowing
92
- // button's boundaries
93
- '!text-sm': isFontSizeLarge
88
+ '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement
94
89
  }, props.className);
95
90
  const memoedMenuItems = React__default.useMemo(() => {
96
91
  const menuItems = [];
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\nimport { FONT_SIZE } from '../../toolbar/FontSize';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n\n const isFontSizeLarge = tableMeta.fontSize.size === FONT_SIZE.large;\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.currentRow.setCurrentRowIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n // Icon inside button uses em values therefore text-sm is required to prevent icon from overflowing\n // button's boundaries\n '!text-sm': isFontSizeLarge,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","isFontSizeLarge","fontSize","size","FONT_SIZE","large","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","currentRow","setCurrentRowIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","frozenInternalColumnCount","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","frozenColumnIndex","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;;;;SAagBA,eAAeA,CAAkBC,KAAoB,EAAEC,MAAgC;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IA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AACC,OAAO,CAAClE,IAAI,CAAC0F,eAAe,CACzB,CACxB;;;IAIT,IAAI1F,IAAI,EAAE;MACN,MAAM2F,UAAU,GAAG3F,IAAI,CAAC;QAAE4F,OAAO,EAAEpE;OAAW,CAAC;MAC/C,MAAMqE,WAAW,GAAGvE,cAAK,CAACwE,QAAQ,CAACC,OAAO,CAACJ,UAAU,CAACtF,KAAK,CAAC2F,QAAQ,CAAC3F,KAAK,CAAC2F,QAAQ,CAAkB;MAErG,IAAIH,WAAW,CAACI,MAAM,EAAE;QACpB,IAAIzC,SAAS,CAACyC,MAAM,EAAE;UAClBzC,SAAS,CAACI,IAAI,eAACtC,6BAACuC,MAAa,CAACqC,SAAS,OAAG,CAAC;;QAG/C1C,SAAS,CAACI,IAAI,CAAC,GAAGiC,WAAW,CAAC;;;IAItC,OAAOrC,SAAS,CAAC2C,GAAG,CAAC,CAACC,IAAI,EAAEC,GAAG,kBAAK/E,cAAK,CAACgF,YAAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CACCrG,IAAI,EACJS,KAAK,EACLH,SAAS,EACTC,OAAO,EACPC,OAAO,EACPG,UAAU,EACVI,gBAAgB,EAChBE,aAAa,EACb5B,SAAS,CAACY,cAAc,CAACwF,iBAAiB,CAC7C,CAAC;EAEF,oBACInE,6BAACiF,UAAU;IACPnD,SAAS,EAAEA,SAAS;IACpBW,IAAI,EAAC,MAAM;IACX/D,IAAI,EACAkC,cAAc,GACRV,SAAS,GACTgF,SAAS,iBACLlF,6BAACuC,MAAa,oBAAK2C,SAAS,gBACxBlF,6BAACuC,MAAa,CAAC4C,OAAO,QAAEnD,eAAe,CAAyB,CAEvE;IAEXlC,OAAO,EAAEc,cAAc;IACvBwE,cAAc,EAAEhD,KAAK,IAAIA,KAAK,CAACiD,cAAc;IAC/C;AAEV;;;;"}
1
+ {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.currentRow.setCurrentRowIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","currentRow","setCurrentRowIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","frozenInternalColumnCount","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","frozenColumnIndex","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;;;SAYgBA,eAAeA,CAAkB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qF,eAAe,CACzB,CACxB;;;IAIT,IAAIrF,IAAI,EAAE;MACN,MAAMsF,UAAU,GAAGtF,IAAI,CAAC;QAAEuF,OAAO,EAAE/D;OAAW,CAAC;MAC/C,MAAMgE,WAAW,GAAGlE,cAAK,CAACmE,QAAQ,CAACC,OAAO,CAACJ,UAAU,CAACjF,KAAK,CAACsF,QAAQ,CAACtF,KAAK,CAACsF,QAAQ,CAAkB;MAErG,IAAIH,WAAW,CAACI,MAAM,EAAE;QACpB,IAAIzC,SAAS,CAACyC,MAAM,EAAE;UAClBzC,SAAS,CAACI,IAAI,eAACjC,6BAACkC,MAAa,CAACqC,SAAS,OAAG,CAAC;;QAG/C1C,SAAS,CAACI,IAAI,CAAC,GAAGiC,WAAW,CAAC;;;IAItC,OAAOrC,SAAS,CAAC2C,GAAG,CAAC,CAACC,IAAI,EAAEC,GAAG,kBAAK1E,cAAK,CAAC2E,YAAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CACChG,IAAI,EACJS,KAAK,EACLH,SAAS,EACTC,OAAO,EACPC,OAAO,EACPG,UAAU,EACVI,gBAAgB,EAChBE,aAAa,EACb5B,SAAS,CAACY,cAAc,CAACmF,iBAAiB,CAC7C,CAAC;EAEF,oBACI9D,6BAAC4E,UAAU;IACPnD,SAAS,EAAEA,SAAS;IACpBW,IAAI,EAAC,MAAM;IACX1D,IAAI,EACA6B,cAAc,GACRL,SAAS,GACT2E,SAAS,iBACL7E,6BAACkC,MAAa,oBAAK2C,SAAS,gBACxB7E,6BAACkC,MAAa,CAAC4C,OAAO,QAAEnD,eAAe,CAAyB,CAEvE;IAEX7B,OAAO,EAAES,cAAc;IACvBwE,cAAc,EAAEhD,KAAK,IAAIA,KAAK,CAACiD,cAAc;IAC/C;AAEV;;;;"}
@@ -4,11 +4,11 @@ import { IconButton } from '../../../../IconButton/IconButton.js';
4
4
  import { useLocalization } from '../../../../Provider/Localization.js';
5
5
  import { Shortcut } from '../../../../Shortcut/Shortcut.js';
6
6
  import { Menu } from '../../../../Menu/Menu.js';
7
- import { FONT_SIZE } from '../../toolbar/FontSize.js';
8
7
  import { Header } from '../header/Header.js';
9
8
  import { RowContext } from '../../rows/RowContext.js';
10
9
  import { DisplayCell } from '../cell/DisplayCell.js';
11
10
  import { Footer } from '../footer/Footer.js';
11
+ import { FONT_SIZE } from '../../toolbar/FontSize.js';
12
12
 
13
13
  const COLUMN_ID = '__actions';
14
14
  const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
package/dist/index.css CHANGED
@@ -860,7 +860,7 @@
860
860
  }
861
861
 
862
862
  [data-font-size='small'] [role='cell'][data-editable] {
863
- @apply px-[calc(var(--table3-cell-padding-x)_-_7px)];
863
+ @apply px-[calc(var(--table3-cell-padding-x)_-_6px)];
864
864
  }
865
865
 
866
866
  [data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox'],
@@ -890,7 +890,7 @@
890
890
  }
891
891
 
892
892
  [data-font-size='medium'] [role='cell'][data-editable] {
893
- @apply px-[calc(var(--table3-cell-padding-x)_-_9px)];
893
+ @apply px-[calc(var(--table3-cell-padding-x)_-_8px)];
894
894
  }
895
895
 
896
896
  [data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox'],
@@ -934,7 +934,7 @@
934
934
  }
935
935
 
936
936
  [data-font-size='large'] [role='cell'][data-editable] {
937
- @apply px-[calc(var(--table3-cell-padding-x)_-_11px)];
937
+ @apply px-[calc(var(--table3-cell-padding-x)_-_10px)];
938
938
  }
939
939
 
940
940
  [data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox'],
@@ -943,3 +943,9 @@
943
943
  [data-font-size='large'] [role='cell'][data-editable] [data-taco='switch-container'] {
944
944
  @apply !mx-[calc(var(--table3-cell-padding-x)_-_5px)] !mt-px;
945
945
  }
946
+
947
+ /* Icon inside column header button uses em values therefore text-sm is required to prevent icon
948
+ from overflowing button's boundaries */
949
+ [data-font-size='large'] [role='columnheader'] button {
950
+ @apply !text-sm;
951
+ }
@@ -12197,30 +12197,6 @@ function GotoPopover(props) {
12197
12197
  })));
12198
12198
  }
12199
12199
 
12200
- const FONT_SIZE = {
12201
- small: 'small',
12202
- medium: 'medium',
12203
- large: 'large'
12204
- };
12205
- function FontSize$1(props) {
12206
- const {
12207
- texts
12208
- } = useLocalization();
12209
- const meta = props.table.options.meta;
12210
- const handleChange = value => meta.fontSize.setSize(value);
12211
- return /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
12212
- onChange: handleChange,
12213
- value: meta.fontSize.size
12214
- }, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
12215
- value: FONT_SIZE.small
12216
- }, texts.table3.fontSize.sizes.small), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
12217
- value: FONT_SIZE.medium
12218
- }, texts.table3.fontSize.sizes.medium), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
12219
- disabled: meta.rowHeight.height === 'short',
12220
- value: FONT_SIZE.large
12221
- }, texts.table3.fontSize.sizes.large)));
12222
- }
12223
-
12224
12200
  function isGotoAvailable(table, header) {
12225
12201
  if (isInternalColumn(header.id)) {
12226
12202
  return false;
@@ -12256,7 +12232,6 @@ function Menu$3(props) {
12256
12232
  } = useLocalization();
12257
12233
  const [popover, setPopover] = React__default.useState(undefined);
12258
12234
  const [sortDirectionState, setSortDirectionState] = React__default.useState(sortDirection);
12259
- const isFontSizeLarge = tableMeta.fontSize.size === FONT_SIZE.large;
12260
12235
  const handleSortMenuRadioGroupChange = newSortDirection => {
12261
12236
  setSortDirectionState(newSortDirection);
12262
12237
  handleSortToggle(newSortDirection);
@@ -12299,10 +12274,7 @@ function Menu$3(props) {
12299
12274
  }
12300
12275
  }
12301
12276
  const className = cn('-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden', 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto', 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto', 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto', {
12302
- '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,
12303
- // Icon inside button uses em values therefore text-sm is required to prevent icon from overflowing
12304
- // button's boundaries
12305
- '!text-sm': isFontSizeLarge
12277
+ '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement
12306
12278
  }, props.className);
12307
12279
  const memoedMenuItems = React__default.useMemo(() => {
12308
12280
  const menuItems = [];
@@ -12797,6 +12769,30 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
12797
12769
  }, meta.footer(table.getRowModel().rows.map(row => row.original[id]))) : null);
12798
12770
  });
12799
12771
 
12772
+ const FONT_SIZE = {
12773
+ small: 'small',
12774
+ medium: 'medium',
12775
+ large: 'large'
12776
+ };
12777
+ function FontSize$1(props) {
12778
+ const {
12779
+ texts
12780
+ } = useLocalization();
12781
+ const meta = props.table.options.meta;
12782
+ const handleChange = value => meta.fontSize.setSize(value);
12783
+ return /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
12784
+ onChange: handleChange,
12785
+ value: meta.fontSize.size
12786
+ }, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
12787
+ value: FONT_SIZE.small
12788
+ }, texts.table3.fontSize.sizes.small), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
12789
+ value: FONT_SIZE.medium
12790
+ }, texts.table3.fontSize.sizes.medium), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
12791
+ disabled: meta.rowHeight.height === 'short',
12792
+ value: FONT_SIZE.large
12793
+ }, texts.table3.fontSize.sizes.large)));
12794
+ }
12795
+
12800
12796
  const COLUMN_ID = '__actions';
12801
12797
  const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
12802
12798
  const {