@grafana/ui
Version:
Grafana Components Library
1 lines • 3.17 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../../src/components/InteractiveTable/Expander/index.tsx"],"sourcesContent":["import { css } from '@emotion/css';\nimport { CellProps, HeaderProps } from 'react-table';\n\nimport { t } from '@grafana/i18n';\n\nimport { IconButton } from '../../IconButton/IconButton';\n\nconst expanderContainerStyles = css({\n display: 'flex',\n alignItems: 'center',\n height: '100%',\n});\n\nexport function ExpanderCell<K extends object>({ row, __rowID }: CellProps<K, void>) {\n return (\n <div className={expanderContainerStyles}>\n <IconButton\n tooltip={t('grafana-ui.interactive-table.expand-row-tooltip', 'Toggle row expanded')}\n aria-controls={__rowID}\n // @ts-expect-error react-table doesn't ship with useExpanded types and we can't use declaration merging without affecting the table viz\n name={row.isExpanded ? 'angle-down' : 'angle-right'}\n // @ts-expect-error same as the line above\n aria-expanded={row.isExpanded}\n // @ts-expect-error same as the line above\n {...row.getToggleRowExpandedProps()}\n size=\"lg\"\n />\n </div>\n );\n}\n\nexport function ExpanderHeader<K extends object>({ isAllRowsExpanded, toggleAllRowsExpanded }: HeaderProps<K>) {\n return (\n <div className={expanderContainerStyles}>\n <IconButton\n aria-label={\n !isAllRowsExpanded\n ? t('grafana-ui.interactive-table.aria-label-expand-all', 'Expand all rows')\n : t('grafana-ui.interactive-table.aria-label-collapse-all', 'Collapse all rows')\n }\n name={!isAllRowsExpanded ? 'table-expand-all' : 'table-collapse-all'}\n onClick={() => toggleAllRowsExpanded()}\n size={'lg'}\n tooltip={\n !isAllRowsExpanded\n ? t('grafana-ui.interactive-table.tooltip-expand-all', 'Expand all rows')\n : t('grafana-ui.interactive-table.tooltip-collapse-all', 'Collapse all rows')\n }\n variant={'secondary'}\n />\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,0BAA0B,GAAA,CAAI;AAAA,EAClC,OAAA,EAAS,MAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA,EACZ,MAAA,EAAQ;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