@entur/table 4.8.11 → 4.8.12-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -304,26 +304,38 @@ function useSortableData(tableData, externalSortConfig) {
304
304
  order: 'none'
305
305
  });
306
306
  };
307
- var tableSortedAscending = [].concat(tableData).sort(function (a, b) {
308
- var _get$toString, _get, _get$toString2, _get2;
309
- var valueOfA = (_get$toString = (_get = get(a, sortConfig.key, a)) == null ? void 0 : _get.toString()) != null ? _get$toString : '';
310
- var valueOfB = (_get$toString2 = (_get2 = get(b, sortConfig.key, b)) == null ? void 0 : _get2.toString()) != null ? _get$toString2 : '';
311
- var stringComparator = new Intl.Collator(['no', 'en'], {
312
- numeric: true,
313
- sensitivity: 'base'
307
+ var tableSortedAscending = React.useMemo(function () {
308
+ return [].concat(tableData).sort(function (a, b) {
309
+ var _get$toString, _get, _get$toString2, _get2;
310
+ var valueOfA = (_get$toString = (_get = get(a, sortConfig.key, a)) == null ? void 0 : _get.toString()) != null ? _get$toString : '';
311
+ var valueOfB = (_get$toString2 = (_get2 = get(b, sortConfig.key, b)) == null ? void 0 : _get2.toString()) != null ? _get$toString2 : '';
312
+ var stringComparator = new Intl.Collator(['no', 'en'], {
313
+ numeric: true,
314
+ sensitivity: 'base'
315
+ });
316
+ return stringComparator.compare(valueOfA, valueOfB);
314
317
  });
315
- return stringComparator.compare(valueOfA, valueOfB);
316
- });
317
- var getSortedData = function getSortedData() {
318
- if (sortConfig.order === 'none') {
319
- return tableData;
320
- }
321
- if (sortConfig.order === 'descending') {
322
- return [].concat(tableSortedAscending).reverse();
318
+ }, [tableData, sortConfig.key]);
319
+ var sortedData = React.useMemo(function () {
320
+ switch (sortConfig.order) {
321
+ case 'ascending':
322
+ {
323
+ return tableSortedAscending;
324
+ }
325
+ case 'descending':
326
+ {
327
+ return [].concat(tableSortedAscending).reverse();
328
+ }
329
+ case 'none':
330
+ {
331
+ return tableData;
332
+ }
333
+ default:
334
+ {
335
+ return tableData;
336
+ }
323
337
  }
324
- return tableSortedAscending;
325
- };
326
- var sortedData = getSortedData();
338
+ }, [sortConfig.order, tableData, tableSortedAscending]);
327
339
  var getSortableHeaderProps = function getSortableHeaderProps(_ref) {
328
340
  var name = _ref.name,
329
341
  _ref$sortable = _ref.sortable,
@@ -1 +1 @@
1
- {"version":3,"file":"table.cjs.development.js","sources":["../src/Table.tsx","../src/TableHead.tsx","../src/TableBody.tsx","../src/TableFooter.tsx","../src/TableRow.tsx","../src/DataCell.tsx","../src/HeaderCell.tsx","../src/useSortableTable.ts","../src/EditableCell.tsx","../src/ExpandableRow.tsx","../src/ExpandRowButton.tsx","../src/useTableKeyboardNavigation.ts","../src/index.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { useRandomId, mergeRefs } from '@entur/utils';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type TableProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Setter tettheten mellom rader og kolonner. Bruk gjerne middle og small for for sider med høy informasjonstetthet\n * @default \"default\"\n */\n spacing?: 'default' | 'middle' | 'small';\n /** Setter kolonne-layout til å være uavhengig av innhold\n * @default false\n */\n fixed?: boolean;\n /** Om header-raden skal bli værende på skjermen når man skroller tabellen\n * @default false\n */\n stickyHeader?: boolean;\n /** Innholdet i tabellen */\n children: React.ReactNode;\n [key: string]: any;\n};\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n (\n {\n className,\n fixed = false,\n spacing = 'default',\n sortable = false,\n changeSortDescription = 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,',\n stickyHeader = false,\n ...rest\n },\n ref,\n ) => {\n const sortableHeaderId = useRandomId('sortable-header');\n\n const tableRef = useRef<HTMLTableElement>(null);\n\n useEffect(() => {\n if (stickyHeader) {\n /* We check when an inserted div above the header \n is outside our scrolling container to determine when\n the table header becomes sticky. This is necessary\n to conditionally add our box-shadow when the \n header is overlapping table rows */\n const tableElement = tableRef.current;\n const observerElement = document.createElement('div');\n observerElement.classList.add('sticky-observer');\n\n tableElement?.parentNode?.insertBefore(observerElement, tableElement);\n\n const observer = new IntersectionObserver(\n entries => {\n tableElement?.classList.toggle(\n 'eds-table--sticky-header--active',\n !entries[0].isIntersecting,\n );\n },\n { threshold: [0, 1] },\n );\n\n observer.observe(observerElement);\n\n return () => {\n observer.unobserve(observerElement);\n observerElement.remove();\n };\n }\n }, [stickyHeader]);\n\n return (\n <>\n <table\n className={classNames(\n 'eds-table',\n { 'eds-table--fixed': fixed },\n { 'eds-table--middle': spacing === 'middle' },\n { 'eds-table--small': spacing === 'small' },\n { 'eds-table--sortable': sortable },\n { 'eds-table--sticky-header': stickyHeader },\n className,\n )}\n ref={mergeRefs(ref, tableRef)}\n aria-describedby={sortable ? sortableHeaderId : undefined}\n {...rest}\n />\n {sortable && (\n <VisuallyHidden id={sortableHeaderId}>\n {changeSortDescription}\n </VisuallyHidden>\n )}\n </>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableHeadProps = {\n /** Kolonneoverskrifter */\n children: React.ReactNode;\n /** Esktra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableHead = React.forwardRef<\n HTMLTableSectionElement,\n TableHeadProps\n>(({ className, ...props }, ref) => (\n <thead\n className={classNames('eds-table__head', className)}\n ref={ref}\n {...props}\n />\n));\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableBodyProps = {\n /** Tabellrader */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n ref?: React.Ref<HTMLTableSectionElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, ...rest }, ref) => (\n <tbody\n className={classNames('eds-table__body', className)}\n ref={ref}\n {...rest}\n />\n));\n","import React from 'react';\n\nexport type TableFooterProps = {\n /** Tabellrader */\n children: React.ReactNode;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n TableFooterProps\n>(({ ...props }, ref) => <tfoot ref={ref} {...props} />);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableRowProps = {\n /** Tabellceller */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /**Hvis satt, så vil tabellraden endre fargen ved hover\n * @default false\n */\n hover?: boolean;\n /** Om raden er klikkbar, så vil raden endre farge, og musepekeren vil symbolisere interaktivitet\n * @default false\n */\n active?: boolean;\n /**Signalisere om at det er en feil i tabellraden\n * @default false\n */\n error?: boolean;\n ref?: React.Ref<HTMLTableRowElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableRowElement>,\n HTMLTableRowElement\n>;\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { className, hover = false, active = false, error = false, ...rest },\n ref: React.Ref<HTMLTableRowElement>,\n ) => (\n <tr\n className={classNames('eds-table__row', className, {\n 'eds-table__row--hover': hover,\n 'eds-table__row--active': active,\n 'eds-table__row--error': error,\n })}\n ref={ref}\n {...rest}\n />\n ),\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nimport { BulletBadge } from '@entur/layout';\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst danger = 'danger';\n\nexport type DataCellProps = {\n /** Innholdet i tabellcellen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for DataCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n /** @deprecated bruk variant */\n status?: 'positive' | 'negative' | 'neutral';\n /** Hvilken type status man vil vise */\n variant?: 'primary' | 'neutral' | VariantType | typeof danger | typeof info;\n} & React.DetailedHTMLProps<\n React.TdHTMLAttributes<HTMLTableDataCellElement>,\n HTMLTableDataCellElement\n>;\n\nfunction mapStatusToVariant(\n status: 'positive' | 'negative' | 'neutral',\n): DataCellProps['variant'] {\n switch (status) {\n case 'positive':\n return 'success';\n case 'negative':\n return 'negative';\n case 'neutral':\n return 'neutral';\n default:\n return 'neutral';\n }\n}\n\nexport const DataCell = React.forwardRef<\n HTMLTableDataCellElement,\n DataCellProps\n>(\n (\n { className, padding = 'default', status, variant, children, ...rest },\n ref: React.Ref<HTMLTableDataCellElement>,\n ) => {\n // If variant is undefined and status is defined, map status to variant\n if (!variant && status) {\n variant = mapStatusToVariant(status);\n }\n return (\n <td\n ref={ref}\n className={classNames('eds-table__data-cell', className, {\n 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__data-cell--padding-radio': padding === 'radio',\n 'eds-table__data-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n {...rest}\n >\n {variant ? (\n <BulletBadge variant={variant}>{children}</BulletBadge>\n ) : (\n children\n )}\n </td>\n );\n },\n);\n","import React, { useEffect, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { DownArrowIcon, UpArrowIcon, UnsortedIcon } from '@entur/icons';\n\nimport { ExternalSortConfig } from '.';\n\nimport './HeaderCell.scss';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type HeaderCellProps = {\n /** Kolonneoverskrift */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for HeaderCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n\n /** Ekstra props som kan sendes til sorteringsknappelementet. Benyttes via useSortableTable */\n sortableButtonProps?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n\n /** Om komponenten brukes til sortering. Benytt via useSortableTable\n * @default false\n */\n sortable?: boolean;\n /** Konfigurering og rekkefølgen på sortering. Benyttes via useSortableTable */\n sortConfig?: ExternalSortConfig;\n /** Navnet det skal sorteres på. Benyttes via useSortableTable */\n name?: string;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n} & React.DetailedHTMLProps<\n React.ThHTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>;\n\nexport const HeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HeaderCellProps\n>(\n (\n {\n className,\n children,\n name,\n sortable = false,\n sortConfig,\n padding = 'default',\n sortableButtonProps,\n sortedAscendingAriaLabel = ', sortert stigende',\n sortedDescendingAriaLabel = ', sortert synkende',\n ...rest\n },\n ref,\n ) => {\n const [isCurrentlySorted, setIsCurrentlySorted] =\n React.useState<boolean>(false);\n React.useEffect(() => {\n sortConfig &&\n name &&\n setIsCurrentlySorted(sortConfig && name === sortConfig.key);\n }, [sortConfig, name]);\n const ariaSort = isCurrentlySorted\n ? sortConfig && sortConfig.order\n : undefined;\n\n return (\n <th\n className={classNames('eds-table__header-cell', className, {\n 'eds-table__header-cell--sortable': sortable,\n 'eds-table__header-cell--padding-radio': padding === 'radio',\n 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__header-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n aria-sort={ariaSort}\n ref={ref}\n {...rest}\n >\n {sortable && sortConfig && sortableButtonProps ? (\n <SortableHeaderCellButton\n sortableButtonProps={sortableButtonProps}\n sortConfig={sortConfig}\n isCurrentlySorted={isCurrentlySorted}\n ariaSort={ariaSort}\n sortedAscendingAriaLabel={sortedAscendingAriaLabel}\n sortedDescendingAriaLabel={sortedDescendingAriaLabel}\n >\n {children}\n </SortableHeaderCellButton>\n ) : (\n children\n )}\n </th>\n );\n },\n);\n\ntype SortableHeaderCellButtonProps = {\n sortConfig: ExternalSortConfig;\n isCurrentlySorted: boolean;\n sortableButtonProps: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n ariaSort?: 'none' | 'ascending' | 'descending' | 'other' | undefined;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n};\n\nconst SortableHeaderCellButton: React.FC<SortableHeaderCellButtonProps> = ({\n sortConfig,\n sortableButtonProps,\n isCurrentlySorted,\n children,\n ariaSort,\n sortedAscendingAriaLabel,\n sortedDescendingAriaLabel,\n}) => {\n const [sortedAriaInfo, setSortedAriaInfo] = useState<string | undefined>('');\n\n const { className, ...rest } = sortableButtonProps;\n\n const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\n useEffect(() => {\n const DISMISS_SORT_INFO_TIME = 3000;\n if (sortConfig.order == 'ascending') {\n setSortedAriaInfo(sortedAscendingAriaLabel);\n } else if (sortConfig.order == 'descending') {\n setSortedAriaInfo(sortedDescendingAriaLabel);\n }\n const dismissAriaTimer = setTimeout(() => {\n setSortedAriaInfo('');\n if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);\n }, DISMISS_SORT_INFO_TIME);\n\n return () => clearTimeout(dismissAriaTimer);\n }, [sortConfig.order]);\n\n return (\n <button\n className={classNames('eds-table__header-cell-button', className)}\n type=\"button\"\n aria-sort={ariaSort}\n {...rest}\n >\n {children}\n {(!isCurrentlySorted || sortConfig.order === 'none') && (\n <UnsortedIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'ascending' && (\n <UpArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'descending' && (\n <DownArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n <VisuallyHidden>{isCurrentlySorted && sortedAriaInfo}</VisuallyHidden>\n </button>\n );\n};\n","import { useState, DetailedHTMLProps, ButtonHTMLAttributes } from 'react';\nimport get from 'lodash.get';\n\nexport type ExternalSortConfig = {\n /**\n * @default \"\"\n */\n key: string;\n /** @default \"none\" */\n order: 'ascending' | 'descending' | 'none';\n};\n\nexport function useSortableData<T>(\n tableData: T[],\n externalSortConfig: ExternalSortConfig = { key: '', order: 'none' },\n): {\n sortedData: T[];\n getSortableHeaderProps: (\n args: SortableHeaderProps,\n ) => SortableHeaderReturnProps;\n getSortableTableProps: (\n args?: SortableTableProps,\n ) => SortableTableReturnProps;\n} {\n const [sortConfig, setSortConfig] = useState(externalSortConfig);\n\n const onSortRequested = (key: string) => {\n const sortingNewColumn = key !== sortConfig.key;\n if (sortingNewColumn || sortConfig.order === 'none')\n return setSortConfig({ key, order: 'ascending' });\n if (sortConfig.order === 'ascending')\n return setSortConfig({ key, order: 'descending' });\n if (sortConfig.order === 'descending')\n return setSortConfig({ key, order: 'none' });\n };\n\n const tableSortedAscending = [...tableData].sort((a: any, b: any) => {\n const valueOfA: string = get(a, sortConfig.key, a)?.toString() ?? '';\n const valueOfB: string = get(b, sortConfig.key, b)?.toString() ?? '';\n\n const stringComparator = new Intl.Collator(['no', 'en'], {\n numeric: true,\n sensitivity: 'base',\n });\n\n return stringComparator.compare(valueOfA, valueOfB);\n });\n\n const getSortedData: () => T[] = () => {\n if (sortConfig.order === 'none') {\n return tableData;\n }\n if (sortConfig.order === 'descending') {\n return [...tableSortedAscending].reverse();\n }\n return tableSortedAscending;\n };\n\n const sortedData = getSortedData();\n\n const getSortableHeaderProps = ({\n name,\n sortable = true,\n buttonProps,\n ...props\n }: SortableHeaderProps): SortableHeaderReturnProps => {\n return {\n name,\n sortable,\n sortConfig: sortConfig,\n sortableButtonProps: {\n onClick: () => onSortRequested(name),\n ...buttonProps,\n },\n ...props,\n };\n };\n\n const getSortableTableProps = ({\n sortable = true,\n ...props\n }: SortableTableProps = {}): SortableTableReturnProps => {\n return {\n sortable,\n sortConfig: sortConfig,\n ...props,\n };\n };\n\n return { sortedData, getSortableHeaderProps, getSortableTableProps };\n}\n\nexport type SortableHeaderProps = {\n /** Navnet headeren skal se etter i forhold til sortering av items */\n name: string;\n /** Om headeren skal være sorterbar eller ikke\n * @default true */\n sortable?: boolean;\n /** Props som sendes til knapp-elementet */\n buttonProps?: Omit<\n DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >,\n 'type' | 'onClick'\n >;\n [key: string]: any;\n};\n\nexport type SortableHeaderReturnProps = {\n name: string;\n sortable: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n\nexport type SortableTableProps = {\n /** @default true */\n sortable?: boolean;\n [key: string]: any;\n};\n\nexport type SortableTableReturnProps = {\n /** @default true */\n sortable?: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n","import classNames from 'classnames';\nimport React from 'react';\nimport { DataCell } from './DataCell';\n\nimport { VariantProvider } from '@entur/form';\nimport { VariantType } from '@entur/utils';\nimport { Tooltip } from '@entur/tooltip';\n\nimport './EditableCell.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype EditableCellProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Inputelementet som skal være i tabellcellen */\n children: React.ReactElement;\n /** Valideringsvariant for EditableCell */\n variant?: VariantType | typeof error | typeof info;\n /** Varselmelding, som vil komme som en Tooltip under EditableCell */\n feedback?: string;\n /** Om cellen skal vise omriss til enhver tid\n * @default false\n */\n outlined?: boolean;\n [key: string]: any;\n};\n\nexport const EditableCell: React.FC<EditableCellProps> = ({\n children,\n className,\n feedback,\n variant,\n outlined = false,\n ...rest\n}) => {\n return (\n <VariantProvider variant={variant}>\n <DataCell\n className={classNames(\n 'eds-editable-cell',\n {\n 'eds-editable-cell--outlined': outlined,\n },\n className,\n )}\n {...rest}\n >\n <Tooltip\n disableHoverListener={!feedback}\n disableFocusListener={!feedback}\n placement=\"bottom\"\n content={feedback || undefined}\n variant={feedback ? 'negative' : undefined}\n >\n {children}\n </Tooltip>\n </DataCell>\n </VariantProvider>\n );\n};\n","import React from 'react';\nimport { BaseExpand } from '@entur/expand';\n\nexport type ExpandableRowProps = {\n /** Antall kolonner tabellraden er */\n colSpan: number;\n /** Innholdet til ExpandableRow */\n children: React.ReactNode;\n /** Om ExpandableRow er åpen\n * @default false\n */\n open?: boolean;\n};\n\nexport const ExpandableRow: React.FC<ExpandableRowProps> = ({\n open = false,\n children,\n colSpan,\n}) => {\n return (\n <tr>\n <td colSpan={colSpan}>\n <BaseExpand open={open}>{children}</BaseExpand>\n </td>\n </tr>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DownArrowIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './ExpandRowButton.scss';\n\nexport type ExpandRowButtonProps = {\n open: boolean;\n onClick: (e: React.MouseEvent) => void;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ExpandRowButton: React.FC<ExpandRowButtonProps> = ({\n open,\n onClick,\n ...rest\n}) => {\n return (\n <IconButton\n className={classNames('eds-expand-row-button', {\n 'eds-expand-row-button--open': open,\n })}\n onClick={onClick}\n aria-label={open ? 'Lukk tabellrad' : 'Utvid tabellrad'}\n type=\"button\"\n {...rest}\n >\n <DownArrowIcon aria-hidden className=\"eds-expand-row-button__icon\" />\n </IconButton>\n );\n};\n","import { useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport { TableBodyProps, TableRowProps } from './index';\n\nfunction onTableKeypress(\n event: KeyboardEvent,\n currentRow: number,\n maxRow: number,\n allowWrap?: boolean,\n) {\n const keyPress = event.key;\n switch (keyPress) {\n case 'ArrowUp':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === 0 ? maxRow - 1 : currentRow - 1;\n } else {\n return currentRow > 0 ? currentRow - 1 : 0;\n }\n case 'ArrowDown':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === maxRow - 1 ? 0 : currentRow + 1;\n } else {\n return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;\n }\n default:\n return currentRow;\n }\n}\n\nexport type useTableKeyboardNavigationProps = (\n /** Antall rader i tabellen */\n numberOfRows: number,\n /** Tillate at man kan navigere sirkulært\n * @default false\n */\n allowWrap?: boolean,\n) => {\n getTableRowNavigationProps: (\n /** Raden i tabellen (0-indeksert) */\n row: number,\n ) => Partial<TableRowProps>;\n getTableBodyNavigationProps: () => Partial<TableBodyProps>;\n};\n\nexport const useTableKeyboardNavigation: useTableKeyboardNavigationProps = (\n numberOfRows = 0,\n allowWrap = true,\n) => {\n const [currentRow, setCurrentRow] = useState(numberOfRows);\n const [maxRow, setMaxRow] = useState(0);\n\n const tableBodyRef = useRef<HTMLTableSectionElement>(null);\n const tableHasFocus = tableBodyRef?.current?.contains(document.activeElement);\n\n useEffect(() => {\n tableBodyRef &&\n tableBodyRef.current &&\n tableHasFocus &&\n tableBodyRef.current.childNodes[\n currentRow\n ].childNodes[0].parentElement?.focus();\n }, [currentRow, tableHasFocus]);\n\n function getTableBodyNavigationProps(...rest: any): Partial<TableBodyProps> {\n return {\n ref: tableBodyRef,\n ...rest,\n };\n }\n\n const tableRowRef = useRef<HTMLTableRowElement>(null);\n function getTableRowNavigationProps(\n row: number,\n ...rest: any\n ): Partial<TableRowProps> {\n if (row >= maxRow) {\n setMaxRow(row + 1);\n }\n const tabIndex = currentRow ? 0 : -1;\n return {\n tabIndex,\n ref: tableRowRef,\n onClick: () => setCurrentRow(row),\n onKeyDown: (e: KeyboardEvent) => {\n const newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);\n setCurrentRow(newCell);\n },\n ...rest,\n };\n }\n return { getTableRowNavigationProps, getTableBodyNavigationProps };\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('table');\n\nexport * from './Table';\nexport * from './TableHead';\nexport * from './TableBody';\nexport * from './TableFooter';\nexport * from './TableRow';\nexport * from './DataCell';\nexport * from './HeaderCell';\nexport * from './useSortableTable';\nexport * from './EditableCell';\nexport * from './ExpandableRow';\nexport * from './ExpandRowButton';\nexport * from './useTableKeyboardNavigation';\n"],"names":["Table","React","forwardRef","ref","className","fixed","spacing","sortable","changeSortDescription","stickyHeader","rest","_excluded","sortableHeaderId","useRandomId","tableRef","useRef","useEffect","tableElement","current","observerElement","document","createElement","classList","add","parentNode","insertBefore","observer","IntersectionObserver","entries","toggle","isIntersecting","threshold","observe","unobserve","remove","Fragment","classNames","mergeRefs","undefined","VisuallyHidden","id","TableHead","props","TableBody","TableFooter","TableRow","hover","active","error","mapStatusToVariant","status","DataCell","padding","variant","children","BulletBadge","HeaderCell","name","sortConfig","sortableButtonProps","sortedAscendingAriaLabel","sortedDescendingAriaLabel","useState","isCurrentlySorted","setIsCurrentlySorted","key","ariaSort","order","SortableHeaderCellButton","sortedAriaInfo","setSortedAriaInfo","_excluded2","isFirefox","navigator","userAgent","toLowerCase","indexOf","DISMISS_SORT_INFO_TIME","dismissAriaTimer","setTimeout","clearTimeout","type","UnsortedIcon","size","UpArrowIcon","DownArrowIcon","useSortableData","tableData","externalSortConfig","setSortConfig","onSortRequested","sortingNewColumn","tableSortedAscending","sort","a","b","valueOfA","get","toString","valueOfB","stringComparator","Intl","Collator","numeric","sensitivity","compare","getSortedData","reverse","sortedData","getSortableHeaderProps","buttonProps","onClick","getSortableTableProps","EditableCell","feedback","outlined","VariantProvider","Tooltip","disableHoverListener","disableFocusListener","placement","content","ExpandableRow","open","colSpan","BaseExpand","ExpandRowButton","IconButton","onTableKeypress","event","currentRow","maxRow","allowWrap","keyPress","preventDefault","useTableKeyboardNavigation","numberOfRows","setCurrentRow","setMaxRow","tableBodyRef","tableHasFocus","contains","activeElement","childNodes","parentElement","focus","getTableBodyNavigationProps","tableRowRef","getTableRowNavigationProps","row","tabIndex","onKeyDown","e","newCell","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,IAAMA,KAAK,g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AC,CAAC,CAAA;AACnB,KAAA;AACD,IAAA,IAAMC,QAAQ,GAAGpB,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAAC,IAAA,KAAA,IAAA,KAAA,GAAA,SAAA,CAAA,MAAA,EALlCxH,IAAS,GAAA,IAAA,KAAA,CAAA,KAAA,GAAA,CAAA,GAAA,KAAA,GAAA,CAAA,GAAA,CAAA,CAAA,EAAA,KAAA,GAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA;MAATA,IAAS,CAAA,KAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,KAAA,CAAA,CAAA;AAAA,KAAA;AAMZ,IAAA,OAAA,QAAA,CAAA;AACE4I,MAAAA,QAAQ,EAARA,QAAQ;AACRnJ,MAAAA,GAAG,EAAEgJ,WAAW;AAChBpC,MAAAA,OAAO,EAAE,SAAA,OAAA,GAAA;QAAA,OAAM0B,aAAa,CAACY,GAAG,CAAC,CAAA;AAAA,OAAA;MACjCE,SAAS,EAAE,SAACC,SAAAA,CAAAA,CAAgB,EAAI;QAC9B,IAAMC,OAAO,GAAGzB,eAAe,CAACwB,CAAC,EAAEtB,UAAU,EAAEM,YAAY,EAAEJ,SAAS,CAAC,CAAA;QACvEK,aAAa,CAACgB,OAAO,CAAC,CAAA;AACxB,OAAA;AAAC,KAAA,EACE/I,IAAI,CAAA,CAAA;AAEX,GAAA;EACA,OAAO;AAAE0I,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAAEF,IAAAA,2BAA2B,EAA3BA,2BAAAA;GAA6B,CAAA;AACpE;;ACzFAQ,4BAAsB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"table.cjs.development.js","sources":["../src/Table.tsx","../src/TableHead.tsx","../src/TableBody.tsx","../src/TableFooter.tsx","../src/TableRow.tsx","../src/DataCell.tsx","../src/HeaderCell.tsx","../src/useSortableTable.ts","../src/EditableCell.tsx","../src/ExpandableRow.tsx","../src/ExpandRowButton.tsx","../src/useTableKeyboardNavigation.ts","../src/index.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { useRandomId, mergeRefs } from '@entur/utils';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type TableProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Setter tettheten mellom rader og kolonner. Bruk gjerne middle og small for for sider med høy informasjonstetthet\n * @default \"default\"\n */\n spacing?: 'default' | 'middle' | 'small';\n /** Setter kolonne-layout til å være uavhengig av innhold\n * @default false\n */\n fixed?: boolean;\n /** Om header-raden skal bli værende på skjermen når man skroller tabellen\n * @default false\n */\n stickyHeader?: boolean;\n /** Innholdet i tabellen */\n children: React.ReactNode;\n [key: string]: any;\n};\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n (\n {\n className,\n fixed = false,\n spacing = 'default',\n sortable = false,\n changeSortDescription = 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,',\n stickyHeader = false,\n ...rest\n },\n ref,\n ) => {\n const sortableHeaderId = useRandomId('sortable-header');\n\n const tableRef = useRef<HTMLTableElement>(null);\n\n useEffect(() => {\n if (stickyHeader) {\n /* We check when an inserted div above the header \n is outside our scrolling container to determine when\n the table header becomes sticky. This is necessary\n to conditionally add our box-shadow when the \n header is overlapping table rows */\n const tableElement = tableRef.current;\n const observerElement = document.createElement('div');\n observerElement.classList.add('sticky-observer');\n\n tableElement?.parentNode?.insertBefore(observerElement, tableElement);\n\n const observer = new IntersectionObserver(\n entries => {\n tableElement?.classList.toggle(\n 'eds-table--sticky-header--active',\n !entries[0].isIntersecting,\n );\n },\n { threshold: [0, 1] },\n );\n\n observer.observe(observerElement);\n\n return () => {\n observer.unobserve(observerElement);\n observerElement.remove();\n };\n }\n }, [stickyHeader]);\n\n return (\n <>\n <table\n className={classNames(\n 'eds-table',\n { 'eds-table--fixed': fixed },\n { 'eds-table--middle': spacing === 'middle' },\n { 'eds-table--small': spacing === 'small' },\n { 'eds-table--sortable': sortable },\n { 'eds-table--sticky-header': stickyHeader },\n className,\n )}\n ref={mergeRefs(ref, tableRef)}\n aria-describedby={sortable ? sortableHeaderId : undefined}\n {...rest}\n />\n {sortable && (\n <VisuallyHidden id={sortableHeaderId}>\n {changeSortDescription}\n </VisuallyHidden>\n )}\n </>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableHeadProps = {\n /** Kolonneoverskrifter */\n children: React.ReactNode;\n /** Esktra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableHead = React.forwardRef<\n HTMLTableSectionElement,\n TableHeadProps\n>(({ className, ...props }, ref) => (\n <thead\n className={classNames('eds-table__head', className)}\n ref={ref}\n {...props}\n />\n));\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableBodyProps = {\n /** Tabellrader */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n ref?: React.Ref<HTMLTableSectionElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, ...rest }, ref) => (\n <tbody\n className={classNames('eds-table__body', className)}\n ref={ref}\n {...rest}\n />\n));\n","import React from 'react';\n\nexport type TableFooterProps = {\n /** Tabellrader */\n children: React.ReactNode;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n TableFooterProps\n>(({ ...props }, ref) => <tfoot ref={ref} {...props} />);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableRowProps = {\n /** Tabellceller */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /**Hvis satt, så vil tabellraden endre fargen ved hover\n * @default false\n */\n hover?: boolean;\n /** Om raden er klikkbar, så vil raden endre farge, og musepekeren vil symbolisere interaktivitet\n * @default false\n */\n active?: boolean;\n /**Signalisere om at det er en feil i tabellraden\n * @default false\n */\n error?: boolean;\n ref?: React.Ref<HTMLTableRowElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableRowElement>,\n HTMLTableRowElement\n>;\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { className, hover = false, active = false, error = false, ...rest },\n ref: React.Ref<HTMLTableRowElement>,\n ) => (\n <tr\n className={classNames('eds-table__row', className, {\n 'eds-table__row--hover': hover,\n 'eds-table__row--active': active,\n 'eds-table__row--error': error,\n })}\n ref={ref}\n {...rest}\n />\n ),\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nimport { BulletBadge } from '@entur/layout';\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst danger = 'danger';\n\nexport type DataCellProps = {\n /** Innholdet i tabellcellen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for DataCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n /** @deprecated bruk variant */\n status?: 'positive' | 'negative' | 'neutral';\n /** Hvilken type status man vil vise */\n variant?: 'primary' | 'neutral' | VariantType | typeof danger | typeof info;\n} & React.DetailedHTMLProps<\n React.TdHTMLAttributes<HTMLTableDataCellElement>,\n HTMLTableDataCellElement\n>;\n\nfunction mapStatusToVariant(\n status: 'positive' | 'negative' | 'neutral',\n): DataCellProps['variant'] {\n switch (status) {\n case 'positive':\n return 'success';\n case 'negative':\n return 'negative';\n case 'neutral':\n return 'neutral';\n default:\n return 'neutral';\n }\n}\n\nexport const DataCell = React.forwardRef<\n HTMLTableDataCellElement,\n DataCellProps\n>(\n (\n { className, padding = 'default', status, variant, children, ...rest },\n ref: React.Ref<HTMLTableDataCellElement>,\n ) => {\n // If variant is undefined and status is defined, map status to variant\n if (!variant && status) {\n variant = mapStatusToVariant(status);\n }\n return (\n <td\n ref={ref}\n className={classNames('eds-table__data-cell', className, {\n 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__data-cell--padding-radio': padding === 'radio',\n 'eds-table__data-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n {...rest}\n >\n {variant ? (\n <BulletBadge variant={variant}>{children}</BulletBadge>\n ) : (\n children\n )}\n </td>\n );\n },\n);\n","import React, { useEffect, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { DownArrowIcon, UpArrowIcon, UnsortedIcon } from '@entur/icons';\n\nimport { ExternalSortConfig } from '.';\n\nimport './HeaderCell.scss';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type HeaderCellProps = {\n /** Kolonneoverskrift */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for HeaderCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n\n /** Ekstra props som kan sendes til sorteringsknappelementet. Benyttes via useSortableTable */\n sortableButtonProps?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n\n /** Om komponenten brukes til sortering. Benytt via useSortableTable\n * @default false\n */\n sortable?: boolean;\n /** Konfigurering og rekkefølgen på sortering. Benyttes via useSortableTable */\n sortConfig?: ExternalSortConfig;\n /** Navnet det skal sorteres på. Benyttes via useSortableTable */\n name?: string;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n} & React.DetailedHTMLProps<\n React.ThHTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>;\n\nexport const HeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HeaderCellProps\n>(\n (\n {\n className,\n children,\n name,\n sortable = false,\n sortConfig,\n padding = 'default',\n sortableButtonProps,\n sortedAscendingAriaLabel = ', sortert stigende',\n sortedDescendingAriaLabel = ', sortert synkende',\n ...rest\n },\n ref,\n ) => {\n const [isCurrentlySorted, setIsCurrentlySorted] =\n React.useState<boolean>(false);\n React.useEffect(() => {\n sortConfig &&\n name &&\n setIsCurrentlySorted(sortConfig && name === sortConfig.key);\n }, [sortConfig, name]);\n const ariaSort = isCurrentlySorted\n ? sortConfig && sortConfig.order\n : undefined;\n\n return (\n <th\n className={classNames('eds-table__header-cell', className, {\n 'eds-table__header-cell--sortable': sortable,\n 'eds-table__header-cell--padding-radio': padding === 'radio',\n 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__header-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n aria-sort={ariaSort}\n ref={ref}\n {...rest}\n >\n {sortable && sortConfig && sortableButtonProps ? (\n <SortableHeaderCellButton\n sortableButtonProps={sortableButtonProps}\n sortConfig={sortConfig}\n isCurrentlySorted={isCurrentlySorted}\n ariaSort={ariaSort}\n sortedAscendingAriaLabel={sortedAscendingAriaLabel}\n sortedDescendingAriaLabel={sortedDescendingAriaLabel}\n >\n {children}\n </SortableHeaderCellButton>\n ) : (\n children\n )}\n </th>\n );\n },\n);\n\ntype SortableHeaderCellButtonProps = {\n sortConfig: ExternalSortConfig;\n isCurrentlySorted: boolean;\n sortableButtonProps: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n ariaSort?: 'none' | 'ascending' | 'descending' | 'other' | undefined;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n};\n\nconst SortableHeaderCellButton: React.FC<SortableHeaderCellButtonProps> = ({\n sortConfig,\n sortableButtonProps,\n isCurrentlySorted,\n children,\n ariaSort,\n sortedAscendingAriaLabel,\n sortedDescendingAriaLabel,\n}) => {\n const [sortedAriaInfo, setSortedAriaInfo] = useState<string | undefined>('');\n\n const { className, ...rest } = sortableButtonProps;\n\n const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\n useEffect(() => {\n const DISMISS_SORT_INFO_TIME = 3000;\n if (sortConfig.order == 'ascending') {\n setSortedAriaInfo(sortedAscendingAriaLabel);\n } else if (sortConfig.order == 'descending') {\n setSortedAriaInfo(sortedDescendingAriaLabel);\n }\n const dismissAriaTimer = setTimeout(() => {\n setSortedAriaInfo('');\n if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);\n }, DISMISS_SORT_INFO_TIME);\n\n return () => clearTimeout(dismissAriaTimer);\n }, [sortConfig.order]);\n\n return (\n <button\n className={classNames('eds-table__header-cell-button', className)}\n type=\"button\"\n aria-sort={ariaSort}\n {...rest}\n >\n {children}\n {(!isCurrentlySorted || sortConfig.order === 'none') && (\n <UnsortedIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'ascending' && (\n <UpArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'descending' && (\n <DownArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n <VisuallyHidden>{isCurrentlySorted && sortedAriaInfo}</VisuallyHidden>\n </button>\n );\n};\n","import {\n ButtonHTMLAttributes,\n DetailedHTMLProps,\n useMemo,\n useState,\n} from 'react';\nimport get from 'lodash.get';\n\nexport type ExternalSortConfig = {\n /**\n * @default \"\"\n */\n key: string;\n /** @default \"none\" */\n order: 'ascending' | 'descending' | 'none';\n};\n\nexport function useSortableData<T>(\n tableData: T[],\n externalSortConfig: ExternalSortConfig = { key: '', order: 'none' },\n): {\n sortedData: T[];\n getSortableHeaderProps: (\n args: SortableHeaderProps,\n ) => SortableHeaderReturnProps;\n getSortableTableProps: (\n args?: SortableTableProps,\n ) => SortableTableReturnProps;\n} {\n const [sortConfig, setSortConfig] = useState(externalSortConfig);\n\n const onSortRequested = (key: string) => {\n const sortingNewColumn = key !== sortConfig.key;\n if (sortingNewColumn || sortConfig.order === 'none')\n return setSortConfig({ key, order: 'ascending' });\n if (sortConfig.order === 'ascending')\n return setSortConfig({ key, order: 'descending' });\n if (sortConfig.order === 'descending')\n return setSortConfig({ key, order: 'none' });\n };\n\n const tableSortedAscending = useMemo(\n () =>\n [...tableData].sort((a: any, b: any) => {\n const valueOfA: string = get(a, sortConfig.key, a)?.toString() ?? '';\n const valueOfB: string = get(b, sortConfig.key, b)?.toString() ?? '';\n\n const stringComparator = new Intl.Collator(['no', 'en'], {\n numeric: true,\n sensitivity: 'base',\n });\n\n return stringComparator.compare(valueOfA, valueOfB);\n }),\n [tableData, sortConfig.key],\n );\n\n const sortedData = useMemo(() => {\n switch (sortConfig.order) {\n case 'ascending': {\n return tableSortedAscending;\n }\n case 'descending': {\n return [...tableSortedAscending].reverse();\n }\n case 'none': {\n return tableData;\n }\n default: {\n return tableData;\n }\n }\n }, [sortConfig.order, tableData, tableSortedAscending]);\n\n const getSortableHeaderProps = ({\n name,\n sortable = true,\n buttonProps,\n ...props\n }: SortableHeaderProps): SortableHeaderReturnProps => {\n return {\n name,\n sortable,\n sortConfig: sortConfig,\n sortableButtonProps: {\n onClick: () => onSortRequested(name),\n ...buttonProps,\n },\n ...props,\n };\n };\n\n const getSortableTableProps = ({\n sortable = true,\n ...props\n }: SortableTableProps = {}): SortableTableReturnProps => {\n return {\n sortable,\n sortConfig: sortConfig,\n ...props,\n };\n };\n\n return { sortedData, getSortableHeaderProps, getSortableTableProps };\n}\n\nexport type SortableHeaderProps = {\n /** Navnet headeren skal se etter i forhold til sortering av items */\n name: string;\n /** Om headeren skal være sorterbar eller ikke\n * @default true */\n sortable?: boolean;\n /** Props som sendes til knapp-elementet */\n buttonProps?: Omit<\n DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >,\n 'type' | 'onClick'\n >;\n [key: string]: any;\n};\n\nexport type SortableHeaderReturnProps = {\n name: string;\n sortable: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n\nexport type SortableTableProps = {\n /** @default true */\n sortable?: boolean;\n [key: string]: any;\n};\n\nexport type SortableTableReturnProps = {\n /** @default true */\n sortable?: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n","import classNames from 'classnames';\nimport React from 'react';\nimport { DataCell } from './DataCell';\n\nimport { VariantProvider } from '@entur/form';\nimport { VariantType } from '@entur/utils';\nimport { Tooltip } from '@entur/tooltip';\n\nimport './EditableCell.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype EditableCellProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Inputelementet som skal være i tabellcellen */\n children: React.ReactElement;\n /** Valideringsvariant for EditableCell */\n variant?: VariantType | typeof error | typeof info;\n /** Varselmelding, som vil komme som en Tooltip under EditableCell */\n feedback?: string;\n /** Om cellen skal vise omriss til enhver tid\n * @default false\n */\n outlined?: boolean;\n [key: string]: any;\n};\n\nexport const EditableCell: React.FC<EditableCellProps> = ({\n children,\n className,\n feedback,\n variant,\n outlined = false,\n ...rest\n}) => {\n return (\n <VariantProvider variant={variant}>\n <DataCell\n className={classNames(\n 'eds-editable-cell',\n {\n 'eds-editable-cell--outlined': outlined,\n },\n className,\n )}\n {...rest}\n >\n <Tooltip\n disableHoverListener={!feedback}\n disableFocusListener={!feedback}\n placement=\"bottom\"\n content={feedback || undefined}\n variant={feedback ? 'negative' : undefined}\n >\n {children}\n </Tooltip>\n </DataCell>\n </VariantProvider>\n );\n};\n","import React from 'react';\nimport { BaseExpand } from '@entur/expand';\n\nexport type ExpandableRowProps = {\n /** Antall kolonner tabellraden er */\n colSpan: number;\n /** Innholdet til ExpandableRow */\n children: React.ReactNode;\n /** Om ExpandableRow er åpen\n * @default false\n */\n open?: boolean;\n};\n\nexport const ExpandableRow: React.FC<ExpandableRowProps> = ({\n open = false,\n children,\n colSpan,\n}) => {\n return (\n <tr>\n <td colSpan={colSpan}>\n <BaseExpand open={open}>{children}</BaseExpand>\n </td>\n </tr>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DownArrowIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './ExpandRowButton.scss';\n\nexport type ExpandRowButtonProps = {\n open: boolean;\n onClick: (e: React.MouseEvent) => void;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ExpandRowButton: React.FC<ExpandRowButtonProps> = ({\n open,\n onClick,\n ...rest\n}) => {\n return (\n <IconButton\n className={classNames('eds-expand-row-button', {\n 'eds-expand-row-button--open': open,\n })}\n onClick={onClick}\n aria-label={open ? 'Lukk tabellrad' : 'Utvid tabellrad'}\n type=\"button\"\n {...rest}\n >\n <DownArrowIcon aria-hidden className=\"eds-expand-row-button__icon\" />\n </IconButton>\n );\n};\n","import { useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport { TableBodyProps, TableRowProps } from './index';\n\nfunction onTableKeypress(\n event: KeyboardEvent,\n currentRow: number,\n maxRow: number,\n allowWrap?: boolean,\n) {\n const keyPress = event.key;\n switch (keyPress) {\n case 'ArrowUp':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === 0 ? maxRow - 1 : currentRow - 1;\n } else {\n return currentRow > 0 ? currentRow - 1 : 0;\n }\n case 'ArrowDown':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === maxRow - 1 ? 0 : currentRow + 1;\n } else {\n return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;\n }\n default:\n return currentRow;\n }\n}\n\nexport type useTableKeyboardNavigationProps = (\n /** Antall rader i tabellen */\n numberOfRows: number,\n /** Tillate at man kan navigere sirkulært\n * @default false\n */\n allowWrap?: boolean,\n) => {\n getTableRowNavigationProps: (\n /** Raden i tabellen (0-indeksert) */\n row: number,\n ) => Partial<TableRowProps>;\n getTableBodyNavigationProps: () => Partial<TableBodyProps>;\n};\n\nexport const useTableKeyboardNavigation: useTableKeyboardNavigationProps = (\n numberOfRows = 0,\n allowWrap = true,\n) => {\n const [currentRow, setCurrentRow] = useState(numberOfRows);\n const [maxRow, setMaxRow] = useState(0);\n\n const tableBodyRef = useRef<HTMLTableSectionElement>(null);\n const tableHasFocus = tableBodyRef?.current?.contains(document.activeElement);\n\n useEffect(() => {\n tableBodyRef &&\n tableBodyRef.current &&\n tableHasFocus &&\n tableBodyRef.current.childNodes[\n currentRow\n ].childNodes[0].parentElement?.focus();\n }, [currentRow, tableHasFocus]);\n\n function getTableBodyNavigationProps(...rest: any): Partial<TableBodyProps> {\n return {\n ref: tableBodyRef,\n ...rest,\n };\n }\n\n const tableRowRef = useRef<HTMLTableRowElement>(null);\n function getTableRowNavigationProps(\n row: number,\n ...rest: any\n ): Partial<TableRowProps> {\n if (row >= maxRow) {\n setMaxRow(row + 1);\n }\n const tabIndex = currentRow ? 0 : -1;\n return {\n tabIndex,\n ref: tableRowRef,\n onClick: () => setCurrentRow(row),\n onKeyDown: (e: KeyboardEvent) => {\n const newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);\n setCurrentRow(newCell);\n },\n ...rest,\n };\n }\n return { getTableRowNavigationProps, getTableBodyNavigationProps };\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('table');\n\nexport * from './Table';\nexport * from './TableHead';\nexport * from './TableBody';\nexport * from './TableFooter';\nexport * from './TableRow';\nexport * from './DataCell';\nexport * from './HeaderCell';\nexport * from './useSortableTable';\nexport * from './EditableCell';\nexport * from './ExpandableRow';\nexport * from './ExpandRowButton';\nexport * from './useTableKeyboardNavigation';\n"],"names":["Table","React","forwardRef","ref","className","fixed","spacing","sortable","changeSortDescription","stickyHeader","rest","_excluded","sortableHeaderId","useRandomId","tableRef","useRef","useEffect","tableElement","current","observerElement","document","createElement","classList","add","parentNode","insertBefore","observer","IntersectionObserver","entries","toggle","isIntersecting","threshold","observe","unobserve","remove","Fragment","classNames","mergeRefs","undefined","VisuallyHidden","id","TableHead","props","TableBody","TableFooter","TableRow","hover","active","error","mapStatusToVariant","status","DataCell","padding","variant","children","BulletBadge","HeaderCell","name","sortConfig","sortableButtonProps","sortedAscendingAriaLabel","sortedDescendingAriaLabel","useState","isCurrentlySorted","setIsCurrentlySorted","key","ariaSort","order","SortableHeaderCellButton","sortedAriaInfo","setSortedAriaInfo","_excluded2","isFirefox","navigator","userAgent","toLowerCase","indexOf","DISMISS_SORT_INFO_TIME","dismissAriaTimer","setTimeout","clearTimeout","type","UnsortedIcon","size","UpArrowIcon","DownArrowIcon","useSortableData","tableData","externalSortConfig","setSortConfig","onSortRequested","sortingNewColumn","tableSortedAscending","useMemo","sort","a","b","valueOfA","get","toString","valueOfB","stringComparator","Intl","Collator","numeric","sensitivity","compare","sortedData","reverse","getSortableHeaderProps","buttonProps","onClick","getSortableTableProps","EditableCell","feedback","outlined","VariantProvider","Tooltip","disableHoverListener","disableFocusListener","placement","content","ExpandableRow","open","colSpan","BaseExpand","ExpandRowButton","IconButton","onTableKeypress","event","currentRow","maxRow","allowWrap","keyPress","preventDefault","useTableKeyboardNavigation","numberOfRows","setCurrentRow","setMaxRow","tableBodyRef","tableHasFocus","contains","activeElement","childNodes","parentElement","focus","getTableBodyNavigationProps","tableRowRef","getTableRowNavigationProps","row","tabIndex","onKeyDown","e","newCell","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,IAAMA,KAAK,gBAAGC,KAAK,CAACC,UAAU,CACnC,UAUEC,IAAAA,EAAAA,GAAG,EACD;EAAA,IATAC,SAAS,QAATA,SAAS;AAAA,IAAA,UAAA,GAAA,IAAA,CACTC,KAAK;AAALA,IAAAA,KAAK,2BAAG,KAAK,GAAA,UAAA;AAAA,IAAA,YAAA,GAAA,IAAA,CACbC,OAAO;AAAPA,IAAAA,OAAO,6BAAG,SAAS,GAAA,YAAA;AAAA,IAAA,aAAA,GAAA,IAAA,CACnBC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Q,GAAGpB,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAAC,IAAA,KAAA,IAAA,KAAA,GAAA,SAAA,CAAA,MAAA,EALlCxH,IAAS,GAAA,IAAA,KAAA,CAAA,KAAA,GAAA,CAAA,GAAA,KAAA,GAAA,CAAA,GAAA,CAAA,CAAA,EAAA,KAAA,GAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA;MAATA,IAAS,CAAA,KAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,KAAA,CAAA,CAAA;AAAA,KAAA;AAMZ,IAAA,OAAA,QAAA,CAAA;AACE4I,MAAAA,QAAQ,EAARA,QAAQ;AACRnJ,MAAAA,GAAG,EAAEgJ,WAAW;AAChBpC,MAAAA,OAAO,EAAE,SAAA,OAAA,GAAA;QAAA,OAAM0B,aAAa,CAACY,GAAG,CAAC,CAAA;AAAA,OAAA;MACjCE,SAAS,EAAE,SAACC,SAAAA,CAAAA,CAAgB,EAAI;QAC9B,IAAMC,OAAO,GAAGzB,eAAe,CAACwB,CAAC,EAAEtB,UAAU,EAAEM,YAAY,EAAEJ,SAAS,CAAC,CAAA;QACvEK,aAAa,CAACgB,OAAO,CAAC,CAAA;AACxB,OAAA;AAAC,KAAA,EACE/I,IAAI,CAAA,CAAA;AAEX,GAAA;EACA,OAAO;AAAE0I,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAAEF,IAAAA,2BAA2B,EAA3BA,2BAAAA;GAA6B,CAAA;AACpE;;ACzFAQ,4BAAsB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),r=require("react"),t=require("classnames"),a=require("@entur/a11y"),n=require("@entur/layout"),o=require("@entur/icons"),l=require("lodash.get"),s=require("@entur/form"),i=require("@entur/tooltip"),d=require("@entur/expand"),c=require("@entur/button");function u(){return u=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},u.apply(this,arguments)}function b(e,r){if(null==e)return{};var t,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)r.indexOf(t=o[a])>=0||(n[t]=e[t]);return n}var f=["className","fixed","spacing","sortable","changeSortDescription","stickyHeader"],v=r.forwardRef((function(n,o){var l=n.className,s=n.fixed,i=void 0!==s&&s,d=n.spacing,c=void 0===d?"default":d,v=n.sortable,m=void 0!==v&&v,p=n.changeSortDescription,g=void 0===p?"Tabelloverskrifter med knapper kan trykkes på for å endre sortering,":p,h=n.stickyHeader,w=void 0!==h&&h,_=b(n,f),y=e.useRandomId("sortable-header"),E=r.useRef(null);return r.useEffect((function(){if(w){var e,r=E.current,t=document.createElement("div");t.classList.add("sticky-observer"),null==r||null==(e=r.parentNode)||e.insertBefore(t,r);var a=new IntersectionObserver((function(e){null==r||r.classList.toggle("eds-table--sticky-header--active",!e[0].isIntersecting)}),{threshold:[0,1]});return a.observe(t),function(){a.unobserve(t),t.remove()}}}),[w]),r.createElement(r.Fragment,null,r.createElement("table",u({className:t("eds-table",{"eds-table--fixed":i},{"eds-table--middle":"middle"===c},{"eds-table--small":"small"===c},{"eds-table--sortable":m},{"eds-table--sticky-header":w},l),ref:e.mergeRefs(o,E),"aria-describedby":m?y:void 0},_)),m&&r.createElement(a.VisuallyHidden,{id:y},g))})),m=["className"],p=r.forwardRef((function(e,a){var n=e.className,o=b(e,m);return r.createElement("thead",u({className:t("eds-table__head",n),ref:a},o))})),g=["className"],h=r.forwardRef((function(e,a){var n=e.className,o=b(e,g);return r.createElement("tbody",u({className:t("eds-table__body",n),ref:a},o))})),w=r.forwardRef((function(e,t){var a=u({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));return r.createElement("tfoot",u({ref:t},a))})),_=["className","hover","active","error"],y=r.forwardRef((function(e,a){var n=e.className,o=e.hover,l=void 0!==o&&o,s=e.active,i=void 0!==s&&s,d=e.error,c=void 0!==d&&d,f=b(e,_);return r.createElement("tr",u({className:t("eds-table__row",n,{"eds-table__row--hover":l,"eds-table__row--active":i,"eds-table__row--error":c}),ref:a},f))})),E=["className","padding","status","variant","children"],N=r.forwardRef((function(e,a){var o=e.className,l=e.padding,s=void 0===l?"default":l,i=e.status,d=e.variant,c=e.children,f=b(e,E);return!d&&i&&(d=function(e){switch(e){case"positive":return"success";case"negative":return"negative";default:return"neutral"}}(i)),r.createElement("td",u({ref:a,className:t("eds-table__data-cell",o,{"eds-table__data-cell--padding-checkbox":"checkbox"===s,"eds-table__data-cell--padding-radio":"radio"===s,"eds-table__data-cell--padding-overflow-menu":"overflow-menu"===s})},f),d?r.createElement(n.BulletBadge,{variant:d},c):c)})),k=["className","children","name","sortable","sortConfig","padding","sortableButtonProps","sortedAscendingAriaLabel","sortedDescendingAriaLabel"],x=["className"],A=r.forwardRef((function(e,a){var n=e.className,o=e.children,l=e.name,s=e.sortable,i=void 0!==s&&s,d=e.sortConfig,c=e.padding,f=void 0===c?"default":c,v=e.sortableButtonProps,m=e.sortedAscendingAriaLabel,p=void 0===m?", sortert stigende":m,g=e.sortedDescendingAriaLabel,h=void 0===g?", sortert synkende":g,w=b(e,k),_=r.useState(!1),y=_[0],E=_[1];r.useEffect((function(){d&&l&&E(d&&l===d.key)}),[d,l]);var N=y?d&&d.order:void 0;return r.createElement("th",u({className:t("eds-table__header-cell",n,{"eds-table__header-cell--sortable":i,"eds-table__header-cell--padding-radio":"radio"===f,"eds-table__header-cell--padding-checkbox":"checkbox"===f,"eds-table__header-cell--padding-overflow-menu":"overflow-menu"===f}),"aria-sort":N,ref:a},w),i&&d&&v?r.createElement(C,{sortableButtonProps:v,sortConfig:d,isCurrentlySorted:y,ariaSort:N,sortedAscendingAriaLabel:p,sortedDescendingAriaLabel:h},o):o)})),C=function(e){var n=e.sortConfig,l=e.sortableButtonProps,s=e.isCurrentlySorted,i=e.children,d=e.ariaSort,c=e.sortedAscendingAriaLabel,f=e.sortedDescendingAriaLabel,v=r.useState(""),m=v[0],p=v[1],g=l.className,h=b(l,x),w=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;return r.useEffect((function(){"ascending"==n.order?p(c):"descending"==n.order&&p(f);var e=setTimeout((function(){p(""),w&&p(", sort "+n.order)}),3e3);return function(){return clearTimeout(e)}}),[n.order]),r.createElement("button",u({className:t("eds-table__header-cell-button",g),type:"button","aria-sort":d},h),i,(!s||"none"===n.order)&&r.createElement(o.UnsortedIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),s&&"ascending"===n.order&&r.createElement(o.UpArrowIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),s&&"descending"===n.order&&r.createElement(o.DownArrowIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),r.createElement(a.VisuallyHidden,null,s&&m))},S=["name","sortable","buttonProps"],R=["sortable"],D=["children","className","feedback","variant","outlined"],L=["open","onClick"];e.warnAboutMissingStyles("table"),exports.DataCell=N,exports.EditableCell=function(e){var a=e.children,n=e.className,o=e.feedback,l=e.variant,d=e.outlined,c=void 0!==d&&d,f=b(e,D);return r.createElement(s.VariantProvider,{variant:l},r.createElement(N,u({className:t("eds-editable-cell",{"eds-editable-cell--outlined":c},n)},f),r.createElement(i.Tooltip,{disableHoverListener:!o,disableFocusListener:!o,placement:"bottom",content:o||void 0,variant:o?"negative":void 0},a)))},exports.ExpandRowButton=function(e){var a=e.open,n=e.onClick,l=b(e,L);return r.createElement(c.IconButton,u({className:t("eds-expand-row-button",{"eds-expand-row-button--open":a}),onClick:n,"aria-label":a?"Lukk tabellrad":"Utvid tabellrad",type:"button"},l),r.createElement(o.DownArrowIcon,{"aria-hidden":!0,className:"eds-expand-row-button__icon"}))},exports.ExpandableRow=function(e){var t=e.open;return r.createElement("tr",null,r.createElement("td",{colSpan:e.colSpan},r.createElement(d.BaseExpand,{open:void 0!==t&&t},e.children)))},exports.HeaderCell=A,exports.Table=v,exports.TableBody=h,exports.TableFooter=w,exports.TableHead=p,exports.TableRow=y,exports.useSortableData=function(e,t){void 0===t&&(t={key:"",order:"none"});var a=r.useState(t),n=a[0],o=a[1],s=[].concat(e).sort((function(e,r){var t,a,o,s,i=null!=(t=null==(a=l(e,n.key,e))?void 0:a.toString())?t:"",d=null!=(o=null==(s=l(r,n.key,r))?void 0:s.toString())?o:"";return new Intl.Collator(["no","en"],{numeric:!0,sensitivity:"base"}).compare(i,d)}));return{sortedData:"none"===n.order?e:"descending"===n.order?[].concat(s).reverse():s,getSortableHeaderProps:function(e){var r=e.name,t=e.sortable,a=void 0===t||t,l=e.buttonProps,s=b(e,S);return u({name:r,sortable:a,sortConfig:n,sortableButtonProps:u({onClick:function(){return(e=r)!==n.key||"none"===n.order?o({key:e,order:"ascending"}):"ascending"===n.order?o({key:e,order:"descending"}):"descending"===n.order?o({key:e,order:"none"}):void 0;var e}},l)},s)},getSortableTableProps:function(e){var r=void 0===e?{}:e,t=r.sortable,a=void 0===t||t,o=b(r,R);return u({sortable:a,sortConfig:n},o)}}},exports.useTableKeyboardNavigation=function(e,t){var a;void 0===e&&(e=0),void 0===t&&(t=!0);var n=r.useState(e),o=n[0],l=n[1],s=r.useState(0),i=s[0],d=s[1],c=r.useRef(null),b=null==c||null==(a=c.current)?void 0:a.contains(document.activeElement);r.useEffect((function(){var e;c&&c.current&&b&&(null==(e=c.current.childNodes[o].childNodes[0].parentElement)||e.focus())}),[o,b]);var f=r.useRef(null);return{getTableRowNavigationProps:function(r){r>=i&&d(r+1);for(var a=o?0:-1,n=arguments.length,s=new Array(n>1?n-1:0),c=1;c<n;c++)s[c-1]=arguments[c];return u({tabIndex:a,ref:f,onClick:function(){return l(r)},onKeyDown:function(r){var a=function(e,r,t,a){switch(e.key){case"ArrowUp":return e.preventDefault(),a?0===r?t-1:r-1:r>0?r-1:0;case"ArrowDown":return e.preventDefault(),a?r===t-1?0:r+1:r<t-1?r+1:r;default:return r}}(r,o,e,t);l(a)}},s)},getTableBodyNavigationProps:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return u({ref:c},r)}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),r=require("react"),t=require("classnames"),a=require("@entur/a11y"),n=require("@entur/layout"),o=require("@entur/icons"),s=require("lodash.get"),l=require("@entur/form"),i=require("@entur/tooltip"),d=require("@entur/expand"),c=require("@entur/button");function u(){return u=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},u.apply(this,arguments)}function b(e,r){if(null==e)return{};var t,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)r.indexOf(t=o[a])>=0||(n[t]=e[t]);return n}var f=["className","fixed","spacing","sortable","changeSortDescription","stickyHeader"],v=r.forwardRef((function(n,o){var s=n.className,l=n.fixed,i=void 0!==l&&l,d=n.spacing,c=void 0===d?"default":d,v=n.sortable,m=void 0!==v&&v,p=n.changeSortDescription,g=void 0===p?"Tabelloverskrifter med knapper kan trykkes på for å endre sortering,":p,h=n.stickyHeader,w=void 0!==h&&h,y=b(n,f),_=e.useRandomId("sortable-header"),E=r.useRef(null);return r.useEffect((function(){if(w){var e,r=E.current,t=document.createElement("div");t.classList.add("sticky-observer"),null==r||null==(e=r.parentNode)||e.insertBefore(t,r);var a=new IntersectionObserver((function(e){null==r||r.classList.toggle("eds-table--sticky-header--active",!e[0].isIntersecting)}),{threshold:[0,1]});return a.observe(t),function(){a.unobserve(t),t.remove()}}}),[w]),r.createElement(r.Fragment,null,r.createElement("table",u({className:t("eds-table",{"eds-table--fixed":i},{"eds-table--middle":"middle"===c},{"eds-table--small":"small"===c},{"eds-table--sortable":m},{"eds-table--sticky-header":w},s),ref:e.mergeRefs(o,E),"aria-describedby":m?_:void 0},y)),m&&r.createElement(a.VisuallyHidden,{id:_},g))})),m=["className"],p=r.forwardRef((function(e,a){var n=e.className,o=b(e,m);return r.createElement("thead",u({className:t("eds-table__head",n),ref:a},o))})),g=["className"],h=r.forwardRef((function(e,a){var n=e.className,o=b(e,g);return r.createElement("tbody",u({className:t("eds-table__body",n),ref:a},o))})),w=r.forwardRef((function(e,t){var a=u({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));return r.createElement("tfoot",u({ref:t},a))})),y=["className","hover","active","error"],_=r.forwardRef((function(e,a){var n=e.className,o=e.hover,s=void 0!==o&&o,l=e.active,i=void 0!==l&&l,d=e.error,c=void 0!==d&&d,f=b(e,y);return r.createElement("tr",u({className:t("eds-table__row",n,{"eds-table__row--hover":s,"eds-table__row--active":i,"eds-table__row--error":c}),ref:a},f))})),E=["className","padding","status","variant","children"],k=r.forwardRef((function(e,a){var o=e.className,s=e.padding,l=void 0===s?"default":s,i=e.status,d=e.variant,c=e.children,f=b(e,E);return!d&&i&&(d=function(e){switch(e){case"positive":return"success";case"negative":return"negative";default:return"neutral"}}(i)),r.createElement("td",u({ref:a,className:t("eds-table__data-cell",o,{"eds-table__data-cell--padding-checkbox":"checkbox"===l,"eds-table__data-cell--padding-radio":"radio"===l,"eds-table__data-cell--padding-overflow-menu":"overflow-menu"===l})},f),d?r.createElement(n.BulletBadge,{variant:d},c):c)})),N=["className","children","name","sortable","sortConfig","padding","sortableButtonProps","sortedAscendingAriaLabel","sortedDescendingAriaLabel"],x=["className"],A=r.forwardRef((function(e,a){var n=e.className,o=e.children,s=e.name,l=e.sortable,i=void 0!==l&&l,d=e.sortConfig,c=e.padding,f=void 0===c?"default":c,v=e.sortableButtonProps,m=e.sortedAscendingAriaLabel,p=void 0===m?", sortert stigende":m,g=e.sortedDescendingAriaLabel,h=void 0===g?", sortert synkende":g,w=b(e,N),y=r.useState(!1),_=y[0],E=y[1];r.useEffect((function(){d&&s&&E(d&&s===d.key)}),[d,s]);var k=_?d&&d.order:void 0;return r.createElement("th",u({className:t("eds-table__header-cell",n,{"eds-table__header-cell--sortable":i,"eds-table__header-cell--padding-radio":"radio"===f,"eds-table__header-cell--padding-checkbox":"checkbox"===f,"eds-table__header-cell--padding-overflow-menu":"overflow-menu"===f}),"aria-sort":k,ref:a},w),i&&d&&v?r.createElement(C,{sortableButtonProps:v,sortConfig:d,isCurrentlySorted:_,ariaSort:k,sortedAscendingAriaLabel:p,sortedDescendingAriaLabel:h},o):o)})),C=function(e){var n=e.sortConfig,s=e.sortableButtonProps,l=e.isCurrentlySorted,i=e.children,d=e.ariaSort,c=e.sortedAscendingAriaLabel,f=e.sortedDescendingAriaLabel,v=r.useState(""),m=v[0],p=v[1],g=s.className,h=b(s,x),w=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;return r.useEffect((function(){"ascending"==n.order?p(c):"descending"==n.order&&p(f);var e=setTimeout((function(){p(""),w&&p(", sort "+n.order)}),3e3);return function(){return clearTimeout(e)}}),[n.order]),r.createElement("button",u({className:t("eds-table__header-cell-button",g),type:"button","aria-sort":d},h),i,(!l||"none"===n.order)&&r.createElement(o.UnsortedIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),l&&"ascending"===n.order&&r.createElement(o.UpArrowIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),l&&"descending"===n.order&&r.createElement(o.DownArrowIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),r.createElement(a.VisuallyHidden,null,l&&m))},S=["name","sortable","buttonProps"],R=["sortable"],D=["children","className","feedback","variant","outlined"],L=["open","onClick"];e.warnAboutMissingStyles("table"),exports.DataCell=k,exports.EditableCell=function(e){var a=e.children,n=e.className,o=e.feedback,s=e.variant,d=e.outlined,c=void 0!==d&&d,f=b(e,D);return r.createElement(l.VariantProvider,{variant:s},r.createElement(k,u({className:t("eds-editable-cell",{"eds-editable-cell--outlined":c},n)},f),r.createElement(i.Tooltip,{disableHoverListener:!o,disableFocusListener:!o,placement:"bottom",content:o||void 0,variant:o?"negative":void 0},a)))},exports.ExpandRowButton=function(e){var a=e.open,n=e.onClick,s=b(e,L);return r.createElement(c.IconButton,u({className:t("eds-expand-row-button",{"eds-expand-row-button--open":a}),onClick:n,"aria-label":a?"Lukk tabellrad":"Utvid tabellrad",type:"button"},s),r.createElement(o.DownArrowIcon,{"aria-hidden":!0,className:"eds-expand-row-button__icon"}))},exports.ExpandableRow=function(e){var t=e.open;return r.createElement("tr",null,r.createElement("td",{colSpan:e.colSpan},r.createElement(d.BaseExpand,{open:void 0!==t&&t},e.children)))},exports.HeaderCell=A,exports.Table=v,exports.TableBody=h,exports.TableFooter=w,exports.TableHead=p,exports.TableRow=_,exports.useSortableData=function(e,t){void 0===t&&(t={key:"",order:"none"});var a=r.useState(t),n=a[0],o=a[1],l=r.useMemo((function(){return[].concat(e).sort((function(e,r){var t,a,o,l,i=null!=(t=null==(a=s(e,n.key,e))?void 0:a.toString())?t:"",d=null!=(o=null==(l=s(r,n.key,r))?void 0:l.toString())?o:"";return new Intl.Collator(["no","en"],{numeric:!0,sensitivity:"base"}).compare(i,d)}))}),[e,n.key]);return{sortedData:r.useMemo((function(){switch(n.order){case"ascending":return l;case"descending":return[].concat(l).reverse();default:return e}}),[n.order,e,l]),getSortableHeaderProps:function(e){var r=e.name,t=e.sortable,a=void 0===t||t,s=e.buttonProps,l=b(e,S);return u({name:r,sortable:a,sortConfig:n,sortableButtonProps:u({onClick:function(){return(e=r)!==n.key||"none"===n.order?o({key:e,order:"ascending"}):"ascending"===n.order?o({key:e,order:"descending"}):"descending"===n.order?o({key:e,order:"none"}):void 0;var e}},s)},l)},getSortableTableProps:function(e){var r=void 0===e?{}:e,t=r.sortable,a=void 0===t||t,o=b(r,R);return u({sortable:a,sortConfig:n},o)}}},exports.useTableKeyboardNavigation=function(e,t){var a;void 0===e&&(e=0),void 0===t&&(t=!0);var n=r.useState(e),o=n[0],s=n[1],l=r.useState(0),i=l[0],d=l[1],c=r.useRef(null),b=null==c||null==(a=c.current)?void 0:a.contains(document.activeElement);r.useEffect((function(){var e;c&&c.current&&b&&(null==(e=c.current.childNodes[o].childNodes[0].parentElement)||e.focus())}),[o,b]);var f=r.useRef(null);return{getTableRowNavigationProps:function(r){r>=i&&d(r+1);for(var a=o?0:-1,n=arguments.length,l=new Array(n>1?n-1:0),c=1;c<n;c++)l[c-1]=arguments[c];return u({tabIndex:a,ref:f,onClick:function(){return s(r)},onKeyDown:function(r){var a=function(e,r,t,a){switch(e.key){case"ArrowUp":return e.preventDefault(),a?0===r?t-1:r-1:r>0?r-1:0;case"ArrowDown":return e.preventDefault(),a?r===t-1?0:r+1:r<t-1?r+1:r;default:return r}}(r,o,e,t);s(a)}},l)},getTableBodyNavigationProps:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return u({ref:c},r)}}};
2
2
  //# sourceMappingURL=table.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.cjs.production.min.js","sources":["../src/Table.tsx","../src/TableHead.tsx","../src/TableBody.tsx","../src/TableFooter.tsx","../src/TableRow.tsx","../src/DataCell.tsx","../src/HeaderCell.tsx","../src/index.tsx","../src/EditableCell.tsx","../src/ExpandRowButton.tsx","../src/ExpandableRow.tsx","../src/useSortableTable.ts","../src/useTableKeyboardNavigation.ts"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { useRandomId, mergeRefs } from '@entur/utils';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type TableProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Setter tettheten mellom rader og kolonner. Bruk gjerne middle og small for for sider med høy informasjonstetthet\n * @default \"default\"\n */\n spacing?: 'default' | 'middle' | 'small';\n /** Setter kolonne-layout til å være uavhengig av innhold\n * @default false\n */\n fixed?: boolean;\n /** Om header-raden skal bli værende på skjermen når man skroller tabellen\n * @default false\n */\n stickyHeader?: boolean;\n /** Innholdet i tabellen */\n children: React.ReactNode;\n [key: string]: any;\n};\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n (\n {\n className,\n fixed = false,\n spacing = 'default',\n sortable = false,\n changeSortDescription = 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,',\n stickyHeader = false,\n ...rest\n },\n ref,\n ) => {\n const sortableHeaderId = useRandomId('sortable-header');\n\n const tableRef = useRef<HTMLTableElement>(null);\n\n useEffect(() => {\n if (stickyHeader) {\n /* We check when an inserted div above the header \n is outside our scrolling container to determine when\n the table header becomes sticky. This is necessary\n to conditionally add our box-shadow when the \n header is overlapping table rows */\n const tableElement = tableRef.current;\n const observerElement = document.createElement('div');\n observerElement.classList.add('sticky-observer');\n\n tableElement?.parentNode?.insertBefore(observerElement, tableElement);\n\n const observer = new IntersectionObserver(\n entries => {\n tableElement?.classList.toggle(\n 'eds-table--sticky-header--active',\n !entries[0].isIntersecting,\n );\n },\n { threshold: [0, 1] },\n );\n\n observer.observe(observerElement);\n\n return () => {\n observer.unobserve(observerElement);\n observerElement.remove();\n };\n }\n }, [stickyHeader]);\n\n return (\n <>\n <table\n className={classNames(\n 'eds-table',\n { 'eds-table--fixed': fixed },\n { 'eds-table--middle': spacing === 'middle' },\n { 'eds-table--small': spacing === 'small' },\n { 'eds-table--sortable': sortable },\n { 'eds-table--sticky-header': stickyHeader },\n className,\n )}\n ref={mergeRefs(ref, tableRef)}\n aria-describedby={sortable ? sortableHeaderId : undefined}\n {...rest}\n />\n {sortable && (\n <VisuallyHidden id={sortableHeaderId}>\n {changeSortDescription}\n </VisuallyHidden>\n )}\n </>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableHeadProps = {\n /** Kolonneoverskrifter */\n children: React.ReactNode;\n /** Esktra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableHead = React.forwardRef<\n HTMLTableSectionElement,\n TableHeadProps\n>(({ className, ...props }, ref) => (\n <thead\n className={classNames('eds-table__head', className)}\n ref={ref}\n {...props}\n />\n));\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableBodyProps = {\n /** Tabellrader */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n ref?: React.Ref<HTMLTableSectionElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, ...rest }, ref) => (\n <tbody\n className={classNames('eds-table__body', className)}\n ref={ref}\n {...rest}\n />\n));\n","import React from 'react';\n\nexport type TableFooterProps = {\n /** Tabellrader */\n children: React.ReactNode;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n TableFooterProps\n>(({ ...props }, ref) => <tfoot ref={ref} {...props} />);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableRowProps = {\n /** Tabellceller */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /**Hvis satt, så vil tabellraden endre fargen ved hover\n * @default false\n */\n hover?: boolean;\n /** Om raden er klikkbar, så vil raden endre farge, og musepekeren vil symbolisere interaktivitet\n * @default false\n */\n active?: boolean;\n /**Signalisere om at det er en feil i tabellraden\n * @default false\n */\n error?: boolean;\n ref?: React.Ref<HTMLTableRowElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableRowElement>,\n HTMLTableRowElement\n>;\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { className, hover = false, active = false, error = false, ...rest },\n ref: React.Ref<HTMLTableRowElement>,\n ) => (\n <tr\n className={classNames('eds-table__row', className, {\n 'eds-table__row--hover': hover,\n 'eds-table__row--active': active,\n 'eds-table__row--error': error,\n })}\n ref={ref}\n {...rest}\n />\n ),\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nimport { BulletBadge } from '@entur/layout';\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst danger = 'danger';\n\nexport type DataCellProps = {\n /** Innholdet i tabellcellen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for DataCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n /** @deprecated bruk variant */\n status?: 'positive' | 'negative' | 'neutral';\n /** Hvilken type status man vil vise */\n variant?: 'primary' | 'neutral' | VariantType | typeof danger | typeof info;\n} & React.DetailedHTMLProps<\n React.TdHTMLAttributes<HTMLTableDataCellElement>,\n HTMLTableDataCellElement\n>;\n\nfunction mapStatusToVariant(\n status: 'positive' | 'negative' | 'neutral',\n): DataCellProps['variant'] {\n switch (status) {\n case 'positive':\n return 'success';\n case 'negative':\n return 'negative';\n case 'neutral':\n return 'neutral';\n default:\n return 'neutral';\n }\n}\n\nexport const DataCell = React.forwardRef<\n HTMLTableDataCellElement,\n DataCellProps\n>(\n (\n { className, padding = 'default', status, variant, children, ...rest },\n ref: React.Ref<HTMLTableDataCellElement>,\n ) => {\n // If variant is undefined and status is defined, map status to variant\n if (!variant && status) {\n variant = mapStatusToVariant(status);\n }\n return (\n <td\n ref={ref}\n className={classNames('eds-table__data-cell', className, {\n 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__data-cell--padding-radio': padding === 'radio',\n 'eds-table__data-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n {...rest}\n >\n {variant ? (\n <BulletBadge variant={variant}>{children}</BulletBadge>\n ) : (\n children\n )}\n </td>\n );\n },\n);\n","import React, { useEffect, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { DownArrowIcon, UpArrowIcon, UnsortedIcon } from '@entur/icons';\n\nimport { ExternalSortConfig } from '.';\n\nimport './HeaderCell.scss';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type HeaderCellProps = {\n /** Kolonneoverskrift */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for HeaderCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n\n /** Ekstra props som kan sendes til sorteringsknappelementet. Benyttes via useSortableTable */\n sortableButtonProps?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n\n /** Om komponenten brukes til sortering. Benytt via useSortableTable\n * @default false\n */\n sortable?: boolean;\n /** Konfigurering og rekkefølgen på sortering. Benyttes via useSortableTable */\n sortConfig?: ExternalSortConfig;\n /** Navnet det skal sorteres på. Benyttes via useSortableTable */\n name?: string;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n} & React.DetailedHTMLProps<\n React.ThHTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>;\n\nexport const HeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HeaderCellProps\n>(\n (\n {\n className,\n children,\n name,\n sortable = false,\n sortConfig,\n padding = 'default',\n sortableButtonProps,\n sortedAscendingAriaLabel = ', sortert stigende',\n sortedDescendingAriaLabel = ', sortert synkende',\n ...rest\n },\n ref,\n ) => {\n const [isCurrentlySorted, setIsCurrentlySorted] =\n React.useState<boolean>(false);\n React.useEffect(() => {\n sortConfig &&\n name &&\n setIsCurrentlySorted(sortConfig && name === sortConfig.key);\n }, [sortConfig, name]);\n const ariaSort = isCurrentlySorted\n ? sortConfig && sortConfig.order\n : undefined;\n\n return (\n <th\n className={classNames('eds-table__header-cell', className, {\n 'eds-table__header-cell--sortable': sortable,\n 'eds-table__header-cell--padding-radio': padding === 'radio',\n 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__header-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n aria-sort={ariaSort}\n ref={ref}\n {...rest}\n >\n {sortable && sortConfig && sortableButtonProps ? (\n <SortableHeaderCellButton\n sortableButtonProps={sortableButtonProps}\n sortConfig={sortConfig}\n isCurrentlySorted={isCurrentlySorted}\n ariaSort={ariaSort}\n sortedAscendingAriaLabel={sortedAscendingAriaLabel}\n sortedDescendingAriaLabel={sortedDescendingAriaLabel}\n >\n {children}\n </SortableHeaderCellButton>\n ) : (\n children\n )}\n </th>\n );\n },\n);\n\ntype SortableHeaderCellButtonProps = {\n sortConfig: ExternalSortConfig;\n isCurrentlySorted: boolean;\n sortableButtonProps: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n ariaSort?: 'none' | 'ascending' | 'descending' | 'other' | undefined;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n};\n\nconst SortableHeaderCellButton: React.FC<SortableHeaderCellButtonProps> = ({\n sortConfig,\n sortableButtonProps,\n isCurrentlySorted,\n children,\n ariaSort,\n sortedAscendingAriaLabel,\n sortedDescendingAriaLabel,\n}) => {\n const [sortedAriaInfo, setSortedAriaInfo] = useState<string | undefined>('');\n\n const { className, ...rest } = sortableButtonProps;\n\n const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\n useEffect(() => {\n const DISMISS_SORT_INFO_TIME = 3000;\n if (sortConfig.order == 'ascending') {\n setSortedAriaInfo(sortedAscendingAriaLabel);\n } else if (sortConfig.order == 'descending') {\n setSortedAriaInfo(sortedDescendingAriaLabel);\n }\n const dismissAriaTimer = setTimeout(() => {\n setSortedAriaInfo('');\n if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);\n }, DISMISS_SORT_INFO_TIME);\n\n return () => clearTimeout(dismissAriaTimer);\n }, [sortConfig.order]);\n\n return (\n <button\n className={classNames('eds-table__header-cell-button', className)}\n type=\"button\"\n aria-sort={ariaSort}\n {...rest}\n >\n {children}\n {(!isCurrentlySorted || sortConfig.order === 'none') && (\n <UnsortedIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'ascending' && (\n <UpArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'descending' && (\n <DownArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n <VisuallyHidden>{isCurrentlySorted && sortedAriaInfo}</VisuallyHidden>\n </button>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('table');\n\nexport * from './Table';\nexport * from './TableHead';\nexport * from './TableBody';\nexport * from './TableFooter';\nexport * from './TableRow';\nexport * from './DataCell';\nexport * from './HeaderCell';\nexport * from './useSortableTable';\nexport * from './EditableCell';\nexport * from './ExpandableRow';\nexport * from './ExpandRowButton';\nexport * from './useTableKeyboardNavigation';\n","import classNames from 'classnames';\nimport React from 'react';\nimport { DataCell } from './DataCell';\n\nimport { VariantProvider } from '@entur/form';\nimport { VariantType } from '@entur/utils';\nimport { Tooltip } from '@entur/tooltip';\n\nimport './EditableCell.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype EditableCellProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Inputelementet som skal være i tabellcellen */\n children: React.ReactElement;\n /** Valideringsvariant for EditableCell */\n variant?: VariantType | typeof error | typeof info;\n /** Varselmelding, som vil komme som en Tooltip under EditableCell */\n feedback?: string;\n /** Om cellen skal vise omriss til enhver tid\n * @default false\n */\n outlined?: boolean;\n [key: string]: any;\n};\n\nexport const EditableCell: React.FC<EditableCellProps> = ({\n children,\n className,\n feedback,\n variant,\n outlined = false,\n ...rest\n}) => {\n return (\n <VariantProvider variant={variant}>\n <DataCell\n className={classNames(\n 'eds-editable-cell',\n {\n 'eds-editable-cell--outlined': outlined,\n },\n className,\n )}\n {...rest}\n >\n <Tooltip\n disableHoverListener={!feedback}\n disableFocusListener={!feedback}\n placement=\"bottom\"\n content={feedback || undefined}\n variant={feedback ? 'negative' : undefined}\n >\n {children}\n </Tooltip>\n </DataCell>\n </VariantProvider>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DownArrowIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './ExpandRowButton.scss';\n\nexport type ExpandRowButtonProps = {\n open: boolean;\n onClick: (e: React.MouseEvent) => void;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ExpandRowButton: React.FC<ExpandRowButtonProps> = ({\n open,\n onClick,\n ...rest\n}) => {\n return (\n <IconButton\n className={classNames('eds-expand-row-button', {\n 'eds-expand-row-button--open': open,\n })}\n onClick={onClick}\n aria-label={open ? 'Lukk tabellrad' : 'Utvid tabellrad'}\n type=\"button\"\n {...rest}\n >\n <DownArrowIcon aria-hidden className=\"eds-expand-row-button__icon\" />\n </IconButton>\n );\n};\n","import React from 'react';\nimport { BaseExpand } from '@entur/expand';\n\nexport type ExpandableRowProps = {\n /** Antall kolonner tabellraden er */\n colSpan: number;\n /** Innholdet til ExpandableRow */\n children: React.ReactNode;\n /** Om ExpandableRow er åpen\n * @default false\n */\n open?: boolean;\n};\n\nexport const ExpandableRow: React.FC<ExpandableRowProps> = ({\n open = false,\n children,\n colSpan,\n}) => {\n return (\n <tr>\n <td colSpan={colSpan}>\n <BaseExpand open={open}>{children}</BaseExpand>\n </td>\n </tr>\n );\n};\n","import { useState, DetailedHTMLProps, ButtonHTMLAttributes } from 'react';\nimport get from 'lodash.get';\n\nexport type ExternalSortConfig = {\n /**\n * @default \"\"\n */\n key: string;\n /** @default \"none\" */\n order: 'ascending' | 'descending' | 'none';\n};\n\nexport function useSortableData<T>(\n tableData: T[],\n externalSortConfig: ExternalSortConfig = { key: '', order: 'none' },\n): {\n sortedData: T[];\n getSortableHeaderProps: (\n args: SortableHeaderProps,\n ) => SortableHeaderReturnProps;\n getSortableTableProps: (\n args?: SortableTableProps,\n ) => SortableTableReturnProps;\n} {\n const [sortConfig, setSortConfig] = useState(externalSortConfig);\n\n const onSortRequested = (key: string) => {\n const sortingNewColumn = key !== sortConfig.key;\n if (sortingNewColumn || sortConfig.order === 'none')\n return setSortConfig({ key, order: 'ascending' });\n if (sortConfig.order === 'ascending')\n return setSortConfig({ key, order: 'descending' });\n if (sortConfig.order === 'descending')\n return setSortConfig({ key, order: 'none' });\n };\n\n const tableSortedAscending = [...tableData].sort((a: any, b: any) => {\n const valueOfA: string = get(a, sortConfig.key, a)?.toString() ?? '';\n const valueOfB: string = get(b, sortConfig.key, b)?.toString() ?? '';\n\n const stringComparator = new Intl.Collator(['no', 'en'], {\n numeric: true,\n sensitivity: 'base',\n });\n\n return stringComparator.compare(valueOfA, valueOfB);\n });\n\n const getSortedData: () => T[] = () => {\n if (sortConfig.order === 'none') {\n return tableData;\n }\n if (sortConfig.order === 'descending') {\n return [...tableSortedAscending].reverse();\n }\n return tableSortedAscending;\n };\n\n const sortedData = getSortedData();\n\n const getSortableHeaderProps = ({\n name,\n sortable = true,\n buttonProps,\n ...props\n }: SortableHeaderProps): SortableHeaderReturnProps => {\n return {\n name,\n sortable,\n sortConfig: sortConfig,\n sortableButtonProps: {\n onClick: () => onSortRequested(name),\n ...buttonProps,\n },\n ...props,\n };\n };\n\n const getSortableTableProps = ({\n sortable = true,\n ...props\n }: SortableTableProps = {}): SortableTableReturnProps => {\n return {\n sortable,\n sortConfig: sortConfig,\n ...props,\n };\n };\n\n return { sortedData, getSortableHeaderProps, getSortableTableProps };\n}\n\nexport type SortableHeaderProps = {\n /** Navnet headeren skal se etter i forhold til sortering av items */\n name: string;\n /** Om headeren skal være sorterbar eller ikke\n * @default true */\n sortable?: boolean;\n /** Props som sendes til knapp-elementet */\n buttonProps?: Omit<\n DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >,\n 'type' | 'onClick'\n >;\n [key: string]: any;\n};\n\nexport type SortableHeaderReturnProps = {\n name: string;\n sortable: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n\nexport type SortableTableProps = {\n /** @default true */\n sortable?: boolean;\n [key: string]: any;\n};\n\nexport type SortableTableReturnProps = {\n /** @default true */\n sortable?: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n","import { useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport { TableBodyProps, TableRowProps } from './index';\n\nfunction onTableKeypress(\n event: KeyboardEvent,\n currentRow: number,\n maxRow: number,\n allowWrap?: boolean,\n) {\n const keyPress = event.key;\n switch (keyPress) {\n case 'ArrowUp':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === 0 ? maxRow - 1 : currentRow - 1;\n } else {\n return currentRow > 0 ? currentRow - 1 : 0;\n }\n case 'ArrowDown':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === maxRow - 1 ? 0 : currentRow + 1;\n } else {\n return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;\n }\n default:\n return currentRow;\n }\n}\n\nexport type useTableKeyboardNavigationProps = (\n /** Antall rader i tabellen */\n numberOfRows: number,\n /** Tillate at man kan navigere sirkulært\n * @default false\n */\n allowWrap?: boolean,\n) => {\n getTableRowNavigationProps: (\n /** Raden i tabellen (0-indeksert) */\n row: number,\n ) => Partial<TableRowProps>;\n getTableBodyNavigationProps: () => Partial<TableBodyProps>;\n};\n\nexport const useTableKeyboardNavigation: useTableKeyboardNavigationProps = (\n numberOfRows = 0,\n allowWrap = true,\n) => {\n const [currentRow, setCurrentRow] = useState(numberOfRows);\n const [maxRow, setMaxRow] = useState(0);\n\n const tableBodyRef = useRef<HTMLTableSectionElement>(null);\n const tableHasFocus = tableBodyRef?.current?.contains(document.activeElement);\n\n useEffect(() => {\n tableBodyRef &&\n tableBodyRef.current &&\n tableHasFocus &&\n tableBodyRef.current.childNodes[\n currentRow\n ].childNodes[0].parentElement?.focus();\n }, [currentRow, tableHasFocus]);\n\n function getTableBodyNavigationProps(...rest: any): Partial<TableBodyProps> {\n return {\n ref: tableBodyRef,\n ...rest,\n };\n }\n\n const tableRowRef = useRef<HTMLTableRowElement>(null);\n function getTableRowNavigationProps(\n row: number,\n ...rest: any\n ): Partial<TableRowProps> {\n if (row >= maxRow) {\n setMaxRow(row + 1);\n }\n const tabIndex = currentRow ? 0 : -1;\n return {\n tabIndex,\n ref: tableRowRef,\n onClick: () => setCurrentRow(row),\n onKeyDown: (e: KeyboardEvent) => {\n const newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);\n setCurrentRow(newCell);\n },\n ...rest,\n };\n }\n return { getTableRowNavigationProps, getTableBodyNavigationProps };\n};\n"],"names":["Table","React","forwardRef","ref","className","_ref$fixed","_ref","fixed","_ref$spacing","spacing","_ref$sortable","sortable","_ref$changeSortDescri","changeSortDescription","_ref$stickyHeader","stickyHeader","rest","_objectWithoutPropertiesLoose","_excluded","sortableHeaderId","useRandomId","tableRef","useRef","useEffect","_tableElement$parentN","tableElement","current","observerElement","document","createElement","classList","add","parentNode","insertBefore","observer","IntersectionObserver","entries","toggle","isIntersecting","threshold","observe","unobserve","remove","Fragment","_extends","classNames","mergeRefs","undefined","VisuallyHidden","id","TableHead","props","TableBody","TableFooter","_objectDestructuringEmpty","TableRow","_ref$hover","hover","_ref$active","active","_ref$error","error","DataCell","_ref$padding","padding","status","variant","children","mapStatusToVariant","BulletBadge","HeaderCell","name","sortConfig","sortableButtonProps","_ref$sortedAscendingA","sortedAscendingAriaLabel","_ref$sortedDescending","sortedDescendingAriaLabel","_React$useState","useState","isCurrentlySorted","setIsCurrentlySorted","key","ariaSort","order","SortableHeaderCellButton","_ref2","sortedAriaInfo","_useState","setSortedAriaInfo","_excluded2","isFirefox","navigator","userAgent","toLowerCase","indexOf","dismissAriaTimer","setTimeout","clearTimeout","type","UnsortedIcon","size","UpArrowIcon","DownArrowIcon","warnAboutMissingStyles","feedback","_ref$outlined","outlined","VariantProvider","Tooltip","disableHoverListener","disableFocusListener","placement","content","open","onClick","IconButton","_ref$open","colSpan","BaseExpand","tableData","externalSortConfig","setSortConfig","tableSortedAscending","concat","sort","a","b","_get$toString","_get","_get$toString2","_get2","valueOfA","get","toString","valueOfB","Intl","Collator","numeric","sensitivity","compare","sortedData","reverse","getSortableHeaderProps","buttonProps","getSortableTableProps","_temp","_ref2$sortable","numberOfRows","allowWrap","_tableBodyRef$current","currentRow","setCurrentRow","maxRow","_useState2","setMaxRow","tableBodyRef","tableHasFocus","contains","activeElement","_tableBodyRef$current2","childNodes","parentElement","focus","tableRowRef","getTableRowNavigationProps","row","tabIndex","_len2","arguments","length","Array","_key2","onKeyDown","e","newCell","event","preventDefault","onTableKeypress","getTableBodyNavigationProps","_len","_key"],"mappings":"8xBAwBaA,EAAQC,EAAMC,YACzB,SAUEC,EAAAA,GACE,IATAC,IAAAA,UAASC,EAAAC,EACTC,MAAAA,cAAaF,EAAAG,EAAAF,EACbG,QAAAA,aAAU,UAASD,EAAAE,EAAAJ,EACnBK,SAAAA,cAAgBD,EAAAE,EAAAN,EAChBO,sBAAAA,aAAwB,uEAAsED,EAAAE,EAAAR,EAC9FS,aAAAA,cAAoBD,EACjBE,EAAIC,EAAAX,EAAAY,GAIHC,EAAmBC,cAAY,mBAE/BC,EAAWC,SAAyB,MAkC1C,OAhCAC,EAAAA,WAAU,WACR,GAAIR,EAAc,CAAA,IAAAS,EAMVC,EAAeJ,EAASK,QACxBC,EAAkBC,SAASC,cAAc,OAC/CF,EAAgBG,UAAUC,IAAI,mBAElB,MAAZN,GAAwB,OAAZD,EAAZC,EAAcO,aAAdR,EAA0BS,aAAaN,EAAiBF,GAExD,IAAMS,EAAW,IAAIC,sBACnB,SAAAC,SACEX,GAAAA,EAAcK,UAAUO,OACtB,oCACCD,EAAQ,GAAGE,eAEhB,GACA,CAAEC,UAAW,CAAC,EAAG,KAKnB,OAFAL,EAASM,QAAQb,GAEV,WACLO,EAASO,UAAUd,GACnBA,EAAgBe,SAEnB,CACH,GA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C7DG,EAAcuB,EAChB,GACG/J,EAEP,EACqCmK,4BA3BrC,WAAiD,IAAA,IAAAC,EAAAX,UAAAC,OAAT1J,EAAS,IAAA2J,MAAAS,GAAAC,EAAA,EAAAA,EAAAD,EAAAC,IAATrK,EAASqK,GAAAZ,UAAAY,GAC/C,OAAAzI,EAAA,CACEzC,IAAKyJ,GACF5I,EAEP,EAuBF"}
1
+ {"version":3,"file":"table.cjs.production.min.js","sources":["../src/Table.tsx","../src/TableHead.tsx","../src/TableBody.tsx","../src/TableFooter.tsx","../src/TableRow.tsx","../src/DataCell.tsx","../src/HeaderCell.tsx","../src/index.tsx","../src/EditableCell.tsx","../src/ExpandRowButton.tsx","../src/ExpandableRow.tsx","../src/useSortableTable.ts","../src/useTableKeyboardNavigation.ts"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { useRandomId, mergeRefs } from '@entur/utils';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type TableProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Setter tettheten mellom rader og kolonner. Bruk gjerne middle og small for for sider med høy informasjonstetthet\n * @default \"default\"\n */\n spacing?: 'default' | 'middle' | 'small';\n /** Setter kolonne-layout til å være uavhengig av innhold\n * @default false\n */\n fixed?: boolean;\n /** Om header-raden skal bli værende på skjermen når man skroller tabellen\n * @default false\n */\n stickyHeader?: boolean;\n /** Innholdet i tabellen */\n children: React.ReactNode;\n [key: string]: any;\n};\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n (\n {\n className,\n fixed = false,\n spacing = 'default',\n sortable = false,\n changeSortDescription = 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,',\n stickyHeader = false,\n ...rest\n },\n ref,\n ) => {\n const sortableHeaderId = useRandomId('sortable-header');\n\n const tableRef = useRef<HTMLTableElement>(null);\n\n useEffect(() => {\n if (stickyHeader) {\n /* We check when an inserted div above the header \n is outside our scrolling container to determine when\n the table header becomes sticky. This is necessary\n to conditionally add our box-shadow when the \n header is overlapping table rows */\n const tableElement = tableRef.current;\n const observerElement = document.createElement('div');\n observerElement.classList.add('sticky-observer');\n\n tableElement?.parentNode?.insertBefore(observerElement, tableElement);\n\n const observer = new IntersectionObserver(\n entries => {\n tableElement?.classList.toggle(\n 'eds-table--sticky-header--active',\n !entries[0].isIntersecting,\n );\n },\n { threshold: [0, 1] },\n );\n\n observer.observe(observerElement);\n\n return () => {\n observer.unobserve(observerElement);\n observerElement.remove();\n };\n }\n }, [stickyHeader]);\n\n return (\n <>\n <table\n className={classNames(\n 'eds-table',\n { 'eds-table--fixed': fixed },\n { 'eds-table--middle': spacing === 'middle' },\n { 'eds-table--small': spacing === 'small' },\n { 'eds-table--sortable': sortable },\n { 'eds-table--sticky-header': stickyHeader },\n className,\n )}\n ref={mergeRefs(ref, tableRef)}\n aria-describedby={sortable ? sortableHeaderId : undefined}\n {...rest}\n />\n {sortable && (\n <VisuallyHidden id={sortableHeaderId}>\n {changeSortDescription}\n </VisuallyHidden>\n )}\n </>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableHeadProps = {\n /** Kolonneoverskrifter */\n children: React.ReactNode;\n /** Esktra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableHead = React.forwardRef<\n HTMLTableSectionElement,\n TableHeadProps\n>(({ className, ...props }, ref) => (\n <thead\n className={classNames('eds-table__head', className)}\n ref={ref}\n {...props}\n />\n));\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableBodyProps = {\n /** Tabellrader */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n ref?: React.Ref<HTMLTableSectionElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, ...rest }, ref) => (\n <tbody\n className={classNames('eds-table__body', className)}\n ref={ref}\n {...rest}\n />\n));\n","import React from 'react';\n\nexport type TableFooterProps = {\n /** Tabellrader */\n children: React.ReactNode;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n TableFooterProps\n>(({ ...props }, ref) => <tfoot ref={ref} {...props} />);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableRowProps = {\n /** Tabellceller */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /**Hvis satt, så vil tabellraden endre fargen ved hover\n * @default false\n */\n hover?: boolean;\n /** Om raden er klikkbar, så vil raden endre farge, og musepekeren vil symbolisere interaktivitet\n * @default false\n */\n active?: boolean;\n /**Signalisere om at det er en feil i tabellraden\n * @default false\n */\n error?: boolean;\n ref?: React.Ref<HTMLTableRowElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableRowElement>,\n HTMLTableRowElement\n>;\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { className, hover = false, active = false, error = false, ...rest },\n ref: React.Ref<HTMLTableRowElement>,\n ) => (\n <tr\n className={classNames('eds-table__row', className, {\n 'eds-table__row--hover': hover,\n 'eds-table__row--active': active,\n 'eds-table__row--error': error,\n })}\n ref={ref}\n {...rest}\n />\n ),\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nimport { BulletBadge } from '@entur/layout';\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst danger = 'danger';\n\nexport type DataCellProps = {\n /** Innholdet i tabellcellen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for DataCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n /** @deprecated bruk variant */\n status?: 'positive' | 'negative' | 'neutral';\n /** Hvilken type status man vil vise */\n variant?: 'primary' | 'neutral' | VariantType | typeof danger | typeof info;\n} & React.DetailedHTMLProps<\n React.TdHTMLAttributes<HTMLTableDataCellElement>,\n HTMLTableDataCellElement\n>;\n\nfunction mapStatusToVariant(\n status: 'positive' | 'negative' | 'neutral',\n): DataCellProps['variant'] {\n switch (status) {\n case 'positive':\n return 'success';\n case 'negative':\n return 'negative';\n case 'neutral':\n return 'neutral';\n default:\n return 'neutral';\n }\n}\n\nexport const DataCell = React.forwardRef<\n HTMLTableDataCellElement,\n DataCellProps\n>(\n (\n { className, padding = 'default', status, variant, children, ...rest },\n ref: React.Ref<HTMLTableDataCellElement>,\n ) => {\n // If variant is undefined and status is defined, map status to variant\n if (!variant && status) {\n variant = mapStatusToVariant(status);\n }\n return (\n <td\n ref={ref}\n className={classNames('eds-table__data-cell', className, {\n 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__data-cell--padding-radio': padding === 'radio',\n 'eds-table__data-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n {...rest}\n >\n {variant ? (\n <BulletBadge variant={variant}>{children}</BulletBadge>\n ) : (\n children\n )}\n </td>\n );\n },\n);\n","import React, { useEffect, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { DownArrowIcon, UpArrowIcon, UnsortedIcon } from '@entur/icons';\n\nimport { ExternalSortConfig } from '.';\n\nimport './HeaderCell.scss';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type HeaderCellProps = {\n /** Kolonneoverskrift */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for HeaderCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n\n /** Ekstra props som kan sendes til sorteringsknappelementet. Benyttes via useSortableTable */\n sortableButtonProps?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n\n /** Om komponenten brukes til sortering. Benytt via useSortableTable\n * @default false\n */\n sortable?: boolean;\n /** Konfigurering og rekkefølgen på sortering. Benyttes via useSortableTable */\n sortConfig?: ExternalSortConfig;\n /** Navnet det skal sorteres på. Benyttes via useSortableTable */\n name?: string;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n} & React.DetailedHTMLProps<\n React.ThHTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>;\n\nexport const HeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HeaderCellProps\n>(\n (\n {\n className,\n children,\n name,\n sortable = false,\n sortConfig,\n padding = 'default',\n sortableButtonProps,\n sortedAscendingAriaLabel = ', sortert stigende',\n sortedDescendingAriaLabel = ', sortert synkende',\n ...rest\n },\n ref,\n ) => {\n const [isCurrentlySorted, setIsCurrentlySorted] =\n React.useState<boolean>(false);\n React.useEffect(() => {\n sortConfig &&\n name &&\n setIsCurrentlySorted(sortConfig && name === sortConfig.key);\n }, [sortConfig, name]);\n const ariaSort = isCurrentlySorted\n ? sortConfig && sortConfig.order\n : undefined;\n\n return (\n <th\n className={classNames('eds-table__header-cell', className, {\n 'eds-table__header-cell--sortable': sortable,\n 'eds-table__header-cell--padding-radio': padding === 'radio',\n 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__header-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n aria-sort={ariaSort}\n ref={ref}\n {...rest}\n >\n {sortable && sortConfig && sortableButtonProps ? (\n <SortableHeaderCellButton\n sortableButtonProps={sortableButtonProps}\n sortConfig={sortConfig}\n isCurrentlySorted={isCurrentlySorted}\n ariaSort={ariaSort}\n sortedAscendingAriaLabel={sortedAscendingAriaLabel}\n sortedDescendingAriaLabel={sortedDescendingAriaLabel}\n >\n {children}\n </SortableHeaderCellButton>\n ) : (\n children\n )}\n </th>\n );\n },\n);\n\ntype SortableHeaderCellButtonProps = {\n sortConfig: ExternalSortConfig;\n isCurrentlySorted: boolean;\n sortableButtonProps: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n ariaSort?: 'none' | 'ascending' | 'descending' | 'other' | undefined;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n};\n\nconst SortableHeaderCellButton: React.FC<SortableHeaderCellButtonProps> = ({\n sortConfig,\n sortableButtonProps,\n isCurrentlySorted,\n children,\n ariaSort,\n sortedAscendingAriaLabel,\n sortedDescendingAriaLabel,\n}) => {\n const [sortedAriaInfo, setSortedAriaInfo] = useState<string | undefined>('');\n\n const { className, ...rest } = sortableButtonProps;\n\n const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\n useEffect(() => {\n const DISMISS_SORT_INFO_TIME = 3000;\n if (sortConfig.order == 'ascending') {\n setSortedAriaInfo(sortedAscendingAriaLabel);\n } else if (sortConfig.order == 'descending') {\n setSortedAriaInfo(sortedDescendingAriaLabel);\n }\n const dismissAriaTimer = setTimeout(() => {\n setSortedAriaInfo('');\n if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);\n }, DISMISS_SORT_INFO_TIME);\n\n return () => clearTimeout(dismissAriaTimer);\n }, [sortConfig.order]);\n\n return (\n <button\n className={classNames('eds-table__header-cell-button', className)}\n type=\"button\"\n aria-sort={ariaSort}\n {...rest}\n >\n {children}\n {(!isCurrentlySorted || sortConfig.order === 'none') && (\n <UnsortedIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'ascending' && (\n <UpArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'descending' && (\n <DownArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n <VisuallyHidden>{isCurrentlySorted && sortedAriaInfo}</VisuallyHidden>\n </button>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('table');\n\nexport * from './Table';\nexport * from './TableHead';\nexport * from './TableBody';\nexport * from './TableFooter';\nexport * from './TableRow';\nexport * from './DataCell';\nexport * from './HeaderCell';\nexport * from './useSortableTable';\nexport * from './EditableCell';\nexport * from './ExpandableRow';\nexport * from './ExpandRowButton';\nexport * from './useTableKeyboardNavigation';\n","import classNames from 'classnames';\nimport React from 'react';\nimport { DataCell } from './DataCell';\n\nimport { VariantProvider } from '@entur/form';\nimport { VariantType } from '@entur/utils';\nimport { Tooltip } from '@entur/tooltip';\n\nimport './EditableCell.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype EditableCellProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Inputelementet som skal være i tabellcellen */\n children: React.ReactElement;\n /** Valideringsvariant for EditableCell */\n variant?: VariantType | typeof error | typeof info;\n /** Varselmelding, som vil komme som en Tooltip under EditableCell */\n feedback?: string;\n /** Om cellen skal vise omriss til enhver tid\n * @default false\n */\n outlined?: boolean;\n [key: string]: any;\n};\n\nexport const EditableCell: React.FC<EditableCellProps> = ({\n children,\n className,\n feedback,\n variant,\n outlined = false,\n ...rest\n}) => {\n return (\n <VariantProvider variant={variant}>\n <DataCell\n className={classNames(\n 'eds-editable-cell',\n {\n 'eds-editable-cell--outlined': outlined,\n },\n className,\n )}\n {...rest}\n >\n <Tooltip\n disableHoverListener={!feedback}\n disableFocusListener={!feedback}\n placement=\"bottom\"\n content={feedback || undefined}\n variant={feedback ? 'negative' : undefined}\n >\n {children}\n </Tooltip>\n </DataCell>\n </VariantProvider>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DownArrowIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './ExpandRowButton.scss';\n\nexport type ExpandRowButtonProps = {\n open: boolean;\n onClick: (e: React.MouseEvent) => void;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ExpandRowButton: React.FC<ExpandRowButtonProps> = ({\n open,\n onClick,\n ...rest\n}) => {\n return (\n <IconButton\n className={classNames('eds-expand-row-button', {\n 'eds-expand-row-button--open': open,\n })}\n onClick={onClick}\n aria-label={open ? 'Lukk tabellrad' : 'Utvid tabellrad'}\n type=\"button\"\n {...rest}\n >\n <DownArrowIcon aria-hidden className=\"eds-expand-row-button__icon\" />\n </IconButton>\n );\n};\n","import React from 'react';\nimport { BaseExpand } from '@entur/expand';\n\nexport type ExpandableRowProps = {\n /** Antall kolonner tabellraden er */\n colSpan: number;\n /** Innholdet til ExpandableRow */\n children: React.ReactNode;\n /** Om ExpandableRow er åpen\n * @default false\n */\n open?: boolean;\n};\n\nexport const ExpandableRow: React.FC<ExpandableRowProps> = ({\n open = false,\n children,\n colSpan,\n}) => {\n return (\n <tr>\n <td colSpan={colSpan}>\n <BaseExpand open={open}>{children}</BaseExpand>\n </td>\n </tr>\n );\n};\n","import {\n ButtonHTMLAttributes,\n DetailedHTMLProps,\n useMemo,\n useState,\n} from 'react';\nimport get from 'lodash.get';\n\nexport type ExternalSortConfig = {\n /**\n * @default \"\"\n */\n key: string;\n /** @default \"none\" */\n order: 'ascending' | 'descending' | 'none';\n};\n\nexport function useSortableData<T>(\n tableData: T[],\n externalSortConfig: ExternalSortConfig = { key: '', order: 'none' },\n): {\n sortedData: T[];\n getSortableHeaderProps: (\n args: SortableHeaderProps,\n ) => SortableHeaderReturnProps;\n getSortableTableProps: (\n args?: SortableTableProps,\n ) => SortableTableReturnProps;\n} {\n const [sortConfig, setSortConfig] = useState(externalSortConfig);\n\n const onSortRequested = (key: string) => {\n const sortingNewColumn = key !== sortConfig.key;\n if (sortingNewColumn || sortConfig.order === 'none')\n return setSortConfig({ key, order: 'ascending' });\n if (sortConfig.order === 'ascending')\n return setSortConfig({ key, order: 'descending' });\n if (sortConfig.order === 'descending')\n return setSortConfig({ key, order: 'none' });\n };\n\n const tableSortedAscending = useMemo(\n () =>\n [...tableData].sort((a: any, b: any) => {\n const valueOfA: string = get(a, sortConfig.key, a)?.toString() ?? '';\n const valueOfB: string = get(b, sortConfig.key, b)?.toString() ?? '';\n\n const stringComparator = new Intl.Collator(['no', 'en'], {\n numeric: true,\n sensitivity: 'base',\n });\n\n return stringComparator.compare(valueOfA, valueOfB);\n }),\n [tableData, sortConfig.key],\n );\n\n const sortedData = useMemo(() => {\n switch (sortConfig.order) {\n case 'ascending': {\n return tableSortedAscending;\n }\n case 'descending': {\n return [...tableSortedAscending].reverse();\n }\n case 'none': {\n return tableData;\n }\n default: {\n return tableData;\n }\n }\n }, [sortConfig.order, tableData, tableSortedAscending]);\n\n const getSortableHeaderProps = ({\n name,\n sortable = true,\n buttonProps,\n ...props\n }: SortableHeaderProps): SortableHeaderReturnProps => {\n return {\n name,\n sortable,\n sortConfig: sortConfig,\n sortableButtonProps: {\n onClick: () => onSortRequested(name),\n ...buttonProps,\n },\n ...props,\n };\n };\n\n const getSortableTableProps = ({\n sortable = true,\n ...props\n }: SortableTableProps = {}): SortableTableReturnProps => {\n return {\n sortable,\n sortConfig: sortConfig,\n ...props,\n };\n };\n\n return { sortedData, getSortableHeaderProps, getSortableTableProps };\n}\n\nexport type SortableHeaderProps = {\n /** Navnet headeren skal se etter i forhold til sortering av items */\n name: string;\n /** Om headeren skal være sorterbar eller ikke\n * @default true */\n sortable?: boolean;\n /** Props som sendes til knapp-elementet */\n buttonProps?: Omit<\n DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >,\n 'type' | 'onClick'\n >;\n [key: string]: any;\n};\n\nexport type SortableHeaderReturnProps = {\n name: string;\n sortable: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n\nexport type SortableTableProps = {\n /** @default true */\n sortable?: boolean;\n [key: string]: any;\n};\n\nexport type SortableTableReturnProps = {\n /** @default true */\n sortable?: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n","import { useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport { TableBodyProps, TableRowProps } from './index';\n\nfunction onTableKeypress(\n event: KeyboardEvent,\n currentRow: number,\n maxRow: number,\n allowWrap?: boolean,\n) {\n const keyPress = event.key;\n switch (keyPress) {\n case 'ArrowUp':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === 0 ? maxRow - 1 : currentRow - 1;\n } else {\n return currentRow > 0 ? currentRow - 1 : 0;\n }\n case 'ArrowDown':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === maxRow - 1 ? 0 : currentRow + 1;\n } else {\n return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;\n }\n default:\n return currentRow;\n }\n}\n\nexport type useTableKeyboardNavigationProps = (\n /** Antall rader i tabellen */\n numberOfRows: number,\n /** Tillate at man kan navigere sirkulært\n * @default false\n */\n allowWrap?: boolean,\n) => {\n getTableRowNavigationProps: (\n /** Raden i tabellen (0-indeksert) */\n row: number,\n ) => Partial<TableRowProps>;\n getTableBodyNavigationProps: () => Partial<TableBodyProps>;\n};\n\nexport const useTableKeyboardNavigation: useTableKeyboardNavigationProps = (\n numberOfRows = 0,\n allowWrap = true,\n) => {\n const [currentRow, setCurrentRow] = useState(numberOfRows);\n const [maxRow, setMaxRow] = useState(0);\n\n const tableBodyRef = useRef<HTMLTableSectionElement>(null);\n const tableHasFocus = tableBodyRef?.current?.contains(document.activeElement);\n\n useEffect(() => {\n tableBodyRef &&\n tableBodyRef.current &&\n tableHasFocus &&\n tableBodyRef.current.childNodes[\n currentRow\n ].childNodes[0].parentElement?.focus();\n }, [currentRow, tableHasFocus]);\n\n function getTableBodyNavigationProps(...rest: any): Partial<TableBodyProps> {\n return {\n ref: tableBodyRef,\n ...rest,\n };\n }\n\n const tableRowRef = useRef<HTMLTableRowElement>(null);\n function getTableRowNavigationProps(\n row: number,\n ...rest: any\n ): Partial<TableRowProps> {\n if (row >= maxRow) {\n setMaxRow(row + 1);\n }\n const tabIndex = currentRow ? 0 : -1;\n return {\n tabIndex,\n ref: tableRowRef,\n onClick: () => setCurrentRow(row),\n onKeyDown: (e: KeyboardEvent) => {\n const newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);\n setCurrentRow(newCell);\n },\n ...rest,\n };\n }\n return { getTableRowNavigationProps, getTableBodyNavigationProps };\n};\n"],"names":["Table","React","forwardRef","ref","className","_ref$fixed","_ref","fixed","_ref$spacing","spacing","_ref$sortable","sortable","_ref$changeSortDescri","changeSortDescription","_ref$stickyHeader","stickyHeader","rest","_objectWithoutPropertiesLoose","_excluded","sortableHeaderId","useRandomId","tableRef","useRef","useEffect","_tableElement$parentN","tableElement","current","observerElement","document","createElement","classList","add","parentNode","insertBefore","observer","IntersectionObserver","entries","toggle","isIntersecting","threshold","observe","unobserve","remove","Fragment","_extends","classNames","mergeRefs","undefined","VisuallyHidden","id","TableHead","props","TableBody","TableFooter","_objectDestructuringEmpty","TableRow","_ref$hover","hover","_ref$active","active","_ref$error","error","DataCell","_ref$padding","padding","status","variant","children","mapStatusToVariant","BulletBadge","HeaderCell","name","sortConfig","sortableButtonProps","_ref$sortedAscendingA","sortedAscendingAriaLabel","_ref$sortedDescending","sortedDescendingAriaLabel","_React$useState","useState","isCurrentlySorted","setIsCurrentlySorted","key","ariaSort","order","SortableHeaderCellButton","_ref2","sortedAriaInfo","_useState","setSortedAriaInfo","_excluded2","isFirefox","navigator","userAgent","toLowerCase","indexOf","dismissAriaTimer","setTimeout","clearTimeout","type","UnsortedIcon","size","UpArrowIcon","DownArrowIcon","warnAboutMissingStyles","feedback","_ref$outlined","outlined","VariantProvider","Tooltip","disableHoverListener","disableFocusListener","placement","content","open","onClick","IconButton","_ref$open","colSpan","BaseExpand","tableData","externalSortConfig","setSortConfig","tableSortedAscending","useMemo","concat","sort","a","b","_get$toString","_get","_get$toString2","_get2","valueOfA","get","toString","valueOfB","Intl","Collator","numeric","sensitivity","compare","sortedData","reverse","getSortableHeaderProps","buttonProps","getSortableTableProps","_temp","_ref2$sortable","numberOfRows","allowWrap","_tableBodyRef$current","currentRow","setCurrentRow","maxRow","_useState2","setMaxRow","tableBodyRef","tableHasFocus","contains","activeElement","_tableBodyRef$current2","childNodes","parentElement","focus","tableRowRef","getTableRowNavigationProps","row","tabIndex","_len2","arguments","length","Array","_key2","onKeyDown","e","newCell","event","preventDefault","onTableKeypress","getTableBodyNavigationProps","_len","_key"],"mappings":"8xBAwBaA,EAAQC,EAAMC,YACzB,SAUEC,EAAAA,GACE,IATAC,IAAAA,UAASC,EAAAC,EACTC,MAAAA,cAAaF,EAAAG,EAAAF,EACbG,QAAAA,aAAU,UAASD,EAAAE,EAAAJ,EACnBK,SAAAA,cAAgBD,EAAAE,EAAAN,EAChBO,sBAAAA,aAAwB,uEAAsED,EAAAE,EAAAR,EAC9FS,aAAAA,cAAoBD,EACjBE,EAAIC,EAAAX,EAAAY,GAIHC,EAAmBC,cAAY,mBAE/BC,EAAWC,SAAyB,MAkC1C,OAhCAC,EAAAA,WAAU,WACR,GAAIR,EAAc,CAAA,IAAAS,EAMVC,EAAeJ,EAASK,QACxBC,EAAkBC,SAASC,cAAc,OAC/CF,EAAgBG,UAAUC,IAAI,mBAElB,MAAZN,GAAwB,OAAZD,EAAZC,EAAcO,aAAdR,EAA0BS,aAAaN,EAAiBF,GAExD,IAAMS,EAAW,IAAIC,sBACnB,SAAAC,SACEX,GAAAA,EAAcK,UAAUO,OACtB,oCACCD,EAAQ,GAAGE,eAEhB,GACA,CAAEC,UAAW,CAAC,EAAG,KAKnB,OAFAL,EAASM,QAAQb,GAEV,WACLO,EAASO,UAAUd,GACnBA,EAAgBe,SAEnB,CACH,GAAG,CAAC3B,IAGFd,EAAA4B,cAAA5B,EAAA0C,SAAA,KACE1C,EAAA4B,cAAA,QAAAe,EAAA,CACExC,UAAWyC,EACT,YACA,CAAE,mBAAoBtC,GACtB,CAAE,oBAAiC,WAAZE,GACvB,CAAE,mBAAgC,UAAZA,GACtB,CAAE,sBAAuBE,GACzB,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IAAA,IAAAC,EAAAX,UAAAC,OAAT3J,EAAS,IAAA4J,MAAAS,GAAAC,EAAA,EAAAA,EAAAD,EAAAC,IAATtK,EAASsK,GAAAZ,UAAAY,GAC/C,OAAA1I,EAAA,CACEzC,IAAK0J,GACF7I,EAEP,EAuBF"}
package/dist/table.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useRandomId, mergeRefs, warnAboutMissingStyles } from '@entur/utils';
2
- import React, { useRef, useEffect, useState } from 'react';
2
+ import React, { useRef, useEffect, useState, useMemo } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { VisuallyHidden } from '@entur/a11y';
5
5
  import { BulletBadge } from '@entur/layout';
@@ -300,26 +300,38 @@ function useSortableData(tableData, externalSortConfig) {
300
300
  order: 'none'
301
301
  });
302
302
  };
303
- var tableSortedAscending = [].concat(tableData).sort(function (a, b) {
304
- var _get$toString, _get, _get$toString2, _get2;
305
- var valueOfA = (_get$toString = (_get = get(a, sortConfig.key, a)) == null ? void 0 : _get.toString()) != null ? _get$toString : '';
306
- var valueOfB = (_get$toString2 = (_get2 = get(b, sortConfig.key, b)) == null ? void 0 : _get2.toString()) != null ? _get$toString2 : '';
307
- var stringComparator = new Intl.Collator(['no', 'en'], {
308
- numeric: true,
309
- sensitivity: 'base'
303
+ var tableSortedAscending = useMemo(function () {
304
+ return [].concat(tableData).sort(function (a, b) {
305
+ var _get$toString, _get, _get$toString2, _get2;
306
+ var valueOfA = (_get$toString = (_get = get(a, sortConfig.key, a)) == null ? void 0 : _get.toString()) != null ? _get$toString : '';
307
+ var valueOfB = (_get$toString2 = (_get2 = get(b, sortConfig.key, b)) == null ? void 0 : _get2.toString()) != null ? _get$toString2 : '';
308
+ var stringComparator = new Intl.Collator(['no', 'en'], {
309
+ numeric: true,
310
+ sensitivity: 'base'
311
+ });
312
+ return stringComparator.compare(valueOfA, valueOfB);
310
313
  });
311
- return stringComparator.compare(valueOfA, valueOfB);
312
- });
313
- var getSortedData = function getSortedData() {
314
- if (sortConfig.order === 'none') {
315
- return tableData;
316
- }
317
- if (sortConfig.order === 'descending') {
318
- return [].concat(tableSortedAscending).reverse();
314
+ }, [tableData, sortConfig.key]);
315
+ var sortedData = useMemo(function () {
316
+ switch (sortConfig.order) {
317
+ case 'ascending':
318
+ {
319
+ return tableSortedAscending;
320
+ }
321
+ case 'descending':
322
+ {
323
+ return [].concat(tableSortedAscending).reverse();
324
+ }
325
+ case 'none':
326
+ {
327
+ return tableData;
328
+ }
329
+ default:
330
+ {
331
+ return tableData;
332
+ }
319
333
  }
320
- return tableSortedAscending;
321
- };
322
- var sortedData = getSortedData();
334
+ }, [sortConfig.order, tableData, tableSortedAscending]);
323
335
  var getSortableHeaderProps = function getSortableHeaderProps(_ref) {
324
336
  var name = _ref.name,
325
337
  _ref$sortable = _ref.sortable,
@@ -1 +1 @@
1
- {"version":3,"file":"table.esm.js","sources":["../src/Table.tsx","../src/TableHead.tsx","../src/TableBody.tsx","../src/TableFooter.tsx","../src/TableRow.tsx","../src/DataCell.tsx","../src/HeaderCell.tsx","../src/useSortableTable.ts","../src/EditableCell.tsx","../src/ExpandableRow.tsx","../src/ExpandRowButton.tsx","../src/useTableKeyboardNavigation.ts","../src/index.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { useRandomId, mergeRefs } from '@entur/utils';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type TableProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Setter tettheten mellom rader og kolonner. Bruk gjerne middle og small for for sider med høy informasjonstetthet\n * @default \"default\"\n */\n spacing?: 'default' | 'middle' | 'small';\n /** Setter kolonne-layout til å være uavhengig av innhold\n * @default false\n */\n fixed?: boolean;\n /** Om header-raden skal bli værende på skjermen når man skroller tabellen\n * @default false\n */\n stickyHeader?: boolean;\n /** Innholdet i tabellen */\n children: React.ReactNode;\n [key: string]: any;\n};\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n (\n {\n className,\n fixed = false,\n spacing = 'default',\n sortable = false,\n changeSortDescription = 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,',\n stickyHeader = false,\n ...rest\n },\n ref,\n ) => {\n const sortableHeaderId = useRandomId('sortable-header');\n\n const tableRef = useRef<HTMLTableElement>(null);\n\n useEffect(() => {\n if (stickyHeader) {\n /* We check when an inserted div above the header \n is outside our scrolling container to determine when\n the table header becomes sticky. This is necessary\n to conditionally add our box-shadow when the \n header is overlapping table rows */\n const tableElement = tableRef.current;\n const observerElement = document.createElement('div');\n observerElement.classList.add('sticky-observer');\n\n tableElement?.parentNode?.insertBefore(observerElement, tableElement);\n\n const observer = new IntersectionObserver(\n entries => {\n tableElement?.classList.toggle(\n 'eds-table--sticky-header--active',\n !entries[0].isIntersecting,\n );\n },\n { threshold: [0, 1] },\n );\n\n observer.observe(observerElement);\n\n return () => {\n observer.unobserve(observerElement);\n observerElement.remove();\n };\n }\n }, [stickyHeader]);\n\n return (\n <>\n <table\n className={classNames(\n 'eds-table',\n { 'eds-table--fixed': fixed },\n { 'eds-table--middle': spacing === 'middle' },\n { 'eds-table--small': spacing === 'small' },\n { 'eds-table--sortable': sortable },\n { 'eds-table--sticky-header': stickyHeader },\n className,\n )}\n ref={mergeRefs(ref, tableRef)}\n aria-describedby={sortable ? sortableHeaderId : undefined}\n {...rest}\n />\n {sortable && (\n <VisuallyHidden id={sortableHeaderId}>\n {changeSortDescription}\n </VisuallyHidden>\n )}\n </>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableHeadProps = {\n /** Kolonneoverskrifter */\n children: React.ReactNode;\n /** Esktra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableHead = React.forwardRef<\n HTMLTableSectionElement,\n TableHeadProps\n>(({ className, ...props }, ref) => (\n <thead\n className={classNames('eds-table__head', className)}\n ref={ref}\n {...props}\n />\n));\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableBodyProps = {\n /** Tabellrader */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n ref?: React.Ref<HTMLTableSectionElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, ...rest }, ref) => (\n <tbody\n className={classNames('eds-table__body', className)}\n ref={ref}\n {...rest}\n />\n));\n","import React from 'react';\n\nexport type TableFooterProps = {\n /** Tabellrader */\n children: React.ReactNode;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n TableFooterProps\n>(({ ...props }, ref) => <tfoot ref={ref} {...props} />);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableRowProps = {\n /** Tabellceller */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /**Hvis satt, så vil tabellraden endre fargen ved hover\n * @default false\n */\n hover?: boolean;\n /** Om raden er klikkbar, så vil raden endre farge, og musepekeren vil symbolisere interaktivitet\n * @default false\n */\n active?: boolean;\n /**Signalisere om at det er en feil i tabellraden\n * @default false\n */\n error?: boolean;\n ref?: React.Ref<HTMLTableRowElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableRowElement>,\n HTMLTableRowElement\n>;\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { className, hover = false, active = false, error = false, ...rest },\n ref: React.Ref<HTMLTableRowElement>,\n ) => (\n <tr\n className={classNames('eds-table__row', className, {\n 'eds-table__row--hover': hover,\n 'eds-table__row--active': active,\n 'eds-table__row--error': error,\n })}\n ref={ref}\n {...rest}\n />\n ),\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nimport { BulletBadge } from '@entur/layout';\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst danger = 'danger';\n\nexport type DataCellProps = {\n /** Innholdet i tabellcellen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for DataCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n /** @deprecated bruk variant */\n status?: 'positive' | 'negative' | 'neutral';\n /** Hvilken type status man vil vise */\n variant?: 'primary' | 'neutral' | VariantType | typeof danger | typeof info;\n} & React.DetailedHTMLProps<\n React.TdHTMLAttributes<HTMLTableDataCellElement>,\n HTMLTableDataCellElement\n>;\n\nfunction mapStatusToVariant(\n status: 'positive' | 'negative' | 'neutral',\n): DataCellProps['variant'] {\n switch (status) {\n case 'positive':\n return 'success';\n case 'negative':\n return 'negative';\n case 'neutral':\n return 'neutral';\n default:\n return 'neutral';\n }\n}\n\nexport const DataCell = React.forwardRef<\n HTMLTableDataCellElement,\n DataCellProps\n>(\n (\n { className, padding = 'default', status, variant, children, ...rest },\n ref: React.Ref<HTMLTableDataCellElement>,\n ) => {\n // If variant is undefined and status is defined, map status to variant\n if (!variant && status) {\n variant = mapStatusToVariant(status);\n }\n return (\n <td\n ref={ref}\n className={classNames('eds-table__data-cell', className, {\n 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__data-cell--padding-radio': padding === 'radio',\n 'eds-table__data-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n {...rest}\n >\n {variant ? (\n <BulletBadge variant={variant}>{children}</BulletBadge>\n ) : (\n children\n )}\n </td>\n );\n },\n);\n","import React, { useEffect, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { DownArrowIcon, UpArrowIcon, UnsortedIcon } from '@entur/icons';\n\nimport { ExternalSortConfig } from '.';\n\nimport './HeaderCell.scss';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type HeaderCellProps = {\n /** Kolonneoverskrift */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for HeaderCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n\n /** Ekstra props som kan sendes til sorteringsknappelementet. Benyttes via useSortableTable */\n sortableButtonProps?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n\n /** Om komponenten brukes til sortering. Benytt via useSortableTable\n * @default false\n */\n sortable?: boolean;\n /** Konfigurering og rekkefølgen på sortering. Benyttes via useSortableTable */\n sortConfig?: ExternalSortConfig;\n /** Navnet det skal sorteres på. Benyttes via useSortableTable */\n name?: string;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n} & React.DetailedHTMLProps<\n React.ThHTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>;\n\nexport const HeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HeaderCellProps\n>(\n (\n {\n className,\n children,\n name,\n sortable = false,\n sortConfig,\n padding = 'default',\n sortableButtonProps,\n sortedAscendingAriaLabel = ', sortert stigende',\n sortedDescendingAriaLabel = ', sortert synkende',\n ...rest\n },\n ref,\n ) => {\n const [isCurrentlySorted, setIsCurrentlySorted] =\n React.useState<boolean>(false);\n React.useEffect(() => {\n sortConfig &&\n name &&\n setIsCurrentlySorted(sortConfig && name === sortConfig.key);\n }, [sortConfig, name]);\n const ariaSort = isCurrentlySorted\n ? sortConfig && sortConfig.order\n : undefined;\n\n return (\n <th\n className={classNames('eds-table__header-cell', className, {\n 'eds-table__header-cell--sortable': sortable,\n 'eds-table__header-cell--padding-radio': padding === 'radio',\n 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__header-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n aria-sort={ariaSort}\n ref={ref}\n {...rest}\n >\n {sortable && sortConfig && sortableButtonProps ? (\n <SortableHeaderCellButton\n sortableButtonProps={sortableButtonProps}\n sortConfig={sortConfig}\n isCurrentlySorted={isCurrentlySorted}\n ariaSort={ariaSort}\n sortedAscendingAriaLabel={sortedAscendingAriaLabel}\n sortedDescendingAriaLabel={sortedDescendingAriaLabel}\n >\n {children}\n </SortableHeaderCellButton>\n ) : (\n children\n )}\n </th>\n );\n },\n);\n\ntype SortableHeaderCellButtonProps = {\n sortConfig: ExternalSortConfig;\n isCurrentlySorted: boolean;\n sortableButtonProps: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n ariaSort?: 'none' | 'ascending' | 'descending' | 'other' | undefined;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n};\n\nconst SortableHeaderCellButton: React.FC<SortableHeaderCellButtonProps> = ({\n sortConfig,\n sortableButtonProps,\n isCurrentlySorted,\n children,\n ariaSort,\n sortedAscendingAriaLabel,\n sortedDescendingAriaLabel,\n}) => {\n const [sortedAriaInfo, setSortedAriaInfo] = useState<string | undefined>('');\n\n const { className, ...rest } = sortableButtonProps;\n\n const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\n useEffect(() => {\n const DISMISS_SORT_INFO_TIME = 3000;\n if (sortConfig.order == 'ascending') {\n setSortedAriaInfo(sortedAscendingAriaLabel);\n } else if (sortConfig.order == 'descending') {\n setSortedAriaInfo(sortedDescendingAriaLabel);\n }\n const dismissAriaTimer = setTimeout(() => {\n setSortedAriaInfo('');\n if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);\n }, DISMISS_SORT_INFO_TIME);\n\n return () => clearTimeout(dismissAriaTimer);\n }, [sortConfig.order]);\n\n return (\n <button\n className={classNames('eds-table__header-cell-button', className)}\n type=\"button\"\n aria-sort={ariaSort}\n {...rest}\n >\n {children}\n {(!isCurrentlySorted || sortConfig.order === 'none') && (\n <UnsortedIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'ascending' && (\n <UpArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'descending' && (\n <DownArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n <VisuallyHidden>{isCurrentlySorted && sortedAriaInfo}</VisuallyHidden>\n </button>\n );\n};\n","import { useState, DetailedHTMLProps, ButtonHTMLAttributes } from 'react';\nimport get from 'lodash.get';\n\nexport type ExternalSortConfig = {\n /**\n * @default \"\"\n */\n key: string;\n /** @default \"none\" */\n order: 'ascending' | 'descending' | 'none';\n};\n\nexport function useSortableData<T>(\n tableData: T[],\n externalSortConfig: ExternalSortConfig = { key: '', order: 'none' },\n): {\n sortedData: T[];\n getSortableHeaderProps: (\n args: SortableHeaderProps,\n ) => SortableHeaderReturnProps;\n getSortableTableProps: (\n args?: SortableTableProps,\n ) => SortableTableReturnProps;\n} {\n const [sortConfig, setSortConfig] = useState(externalSortConfig);\n\n const onSortRequested = (key: string) => {\n const sortingNewColumn = key !== sortConfig.key;\n if (sortingNewColumn || sortConfig.order === 'none')\n return setSortConfig({ key, order: 'ascending' });\n if (sortConfig.order === 'ascending')\n return setSortConfig({ key, order: 'descending' });\n if (sortConfig.order === 'descending')\n return setSortConfig({ key, order: 'none' });\n };\n\n const tableSortedAscending = [...tableData].sort((a: any, b: any) => {\n const valueOfA: string = get(a, sortConfig.key, a)?.toString() ?? '';\n const valueOfB: string = get(b, sortConfig.key, b)?.toString() ?? '';\n\n const stringComparator = new Intl.Collator(['no', 'en'], {\n numeric: true,\n sensitivity: 'base',\n });\n\n return stringComparator.compare(valueOfA, valueOfB);\n });\n\n const getSortedData: () => T[] = () => {\n if (sortConfig.order === 'none') {\n return tableData;\n }\n if (sortConfig.order === 'descending') {\n return [...tableSortedAscending].reverse();\n }\n return tableSortedAscending;\n };\n\n const sortedData = getSortedData();\n\n const getSortableHeaderProps = ({\n name,\n sortable = true,\n buttonProps,\n ...props\n }: SortableHeaderProps): SortableHeaderReturnProps => {\n return {\n name,\n sortable,\n sortConfig: sortConfig,\n sortableButtonProps: {\n onClick: () => onSortRequested(name),\n ...buttonProps,\n },\n ...props,\n };\n };\n\n const getSortableTableProps = ({\n sortable = true,\n ...props\n }: SortableTableProps = {}): SortableTableReturnProps => {\n return {\n sortable,\n sortConfig: sortConfig,\n ...props,\n };\n };\n\n return { sortedData, getSortableHeaderProps, getSortableTableProps };\n}\n\nexport type SortableHeaderProps = {\n /** Navnet headeren skal se etter i forhold til sortering av items */\n name: string;\n /** Om headeren skal være sorterbar eller ikke\n * @default true */\n sortable?: boolean;\n /** Props som sendes til knapp-elementet */\n buttonProps?: Omit<\n DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >,\n 'type' | 'onClick'\n >;\n [key: string]: any;\n};\n\nexport type SortableHeaderReturnProps = {\n name: string;\n sortable: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n\nexport type SortableTableProps = {\n /** @default true */\n sortable?: boolean;\n [key: string]: any;\n};\n\nexport type SortableTableReturnProps = {\n /** @default true */\n sortable?: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n","import classNames from 'classnames';\nimport React from 'react';\nimport { DataCell } from './DataCell';\n\nimport { VariantProvider } from '@entur/form';\nimport { VariantType } from '@entur/utils';\nimport { Tooltip } from '@entur/tooltip';\n\nimport './EditableCell.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype EditableCellProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Inputelementet som skal være i tabellcellen */\n children: React.ReactElement;\n /** Valideringsvariant for EditableCell */\n variant?: VariantType | typeof error | typeof info;\n /** Varselmelding, som vil komme som en Tooltip under EditableCell */\n feedback?: string;\n /** Om cellen skal vise omriss til enhver tid\n * @default false\n */\n outlined?: boolean;\n [key: string]: any;\n};\n\nexport const EditableCell: React.FC<EditableCellProps> = ({\n children,\n className,\n feedback,\n variant,\n outlined = false,\n ...rest\n}) => {\n return (\n <VariantProvider variant={variant}>\n <DataCell\n className={classNames(\n 'eds-editable-cell',\n {\n 'eds-editable-cell--outlined': outlined,\n },\n className,\n )}\n {...rest}\n >\n <Tooltip\n disableHoverListener={!feedback}\n disableFocusListener={!feedback}\n placement=\"bottom\"\n content={feedback || undefined}\n variant={feedback ? 'negative' : undefined}\n >\n {children}\n </Tooltip>\n </DataCell>\n </VariantProvider>\n );\n};\n","import React from 'react';\nimport { BaseExpand } from '@entur/expand';\n\nexport type ExpandableRowProps = {\n /** Antall kolonner tabellraden er */\n colSpan: number;\n /** Innholdet til ExpandableRow */\n children: React.ReactNode;\n /** Om ExpandableRow er åpen\n * @default false\n */\n open?: boolean;\n};\n\nexport const ExpandableRow: React.FC<ExpandableRowProps> = ({\n open = false,\n children,\n colSpan,\n}) => {\n return (\n <tr>\n <td colSpan={colSpan}>\n <BaseExpand open={open}>{children}</BaseExpand>\n </td>\n </tr>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DownArrowIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './ExpandRowButton.scss';\n\nexport type ExpandRowButtonProps = {\n open: boolean;\n onClick: (e: React.MouseEvent) => void;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ExpandRowButton: React.FC<ExpandRowButtonProps> = ({\n open,\n onClick,\n ...rest\n}) => {\n return (\n <IconButton\n className={classNames('eds-expand-row-button', {\n 'eds-expand-row-button--open': open,\n })}\n onClick={onClick}\n aria-label={open ? 'Lukk tabellrad' : 'Utvid tabellrad'}\n type=\"button\"\n {...rest}\n >\n <DownArrowIcon aria-hidden className=\"eds-expand-row-button__icon\" />\n </IconButton>\n );\n};\n","import { useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport { TableBodyProps, TableRowProps } from './index';\n\nfunction onTableKeypress(\n event: KeyboardEvent,\n currentRow: number,\n maxRow: number,\n allowWrap?: boolean,\n) {\n const keyPress = event.key;\n switch (keyPress) {\n case 'ArrowUp':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === 0 ? maxRow - 1 : currentRow - 1;\n } else {\n return currentRow > 0 ? currentRow - 1 : 0;\n }\n case 'ArrowDown':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === maxRow - 1 ? 0 : currentRow + 1;\n } else {\n return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;\n }\n default:\n return currentRow;\n }\n}\n\nexport type useTableKeyboardNavigationProps = (\n /** Antall rader i tabellen */\n numberOfRows: number,\n /** Tillate at man kan navigere sirkulært\n * @default false\n */\n allowWrap?: boolean,\n) => {\n getTableRowNavigationProps: (\n /** Raden i tabellen (0-indeksert) */\n row: number,\n ) => Partial<TableRowProps>;\n getTableBodyNavigationProps: () => Partial<TableBodyProps>;\n};\n\nexport const useTableKeyboardNavigation: useTableKeyboardNavigationProps = (\n numberOfRows = 0,\n allowWrap = true,\n) => {\n const [currentRow, setCurrentRow] = useState(numberOfRows);\n const [maxRow, setMaxRow] = useState(0);\n\n const tableBodyRef = useRef<HTMLTableSectionElement>(null);\n const tableHasFocus = tableBodyRef?.current?.contains(document.activeElement);\n\n useEffect(() => {\n tableBodyRef &&\n tableBodyRef.current &&\n tableHasFocus &&\n tableBodyRef.current.childNodes[\n currentRow\n ].childNodes[0].parentElement?.focus();\n }, [currentRow, tableHasFocus]);\n\n function getTableBodyNavigationProps(...rest: any): Partial<TableBodyProps> {\n return {\n ref: tableBodyRef,\n ...rest,\n };\n }\n\n const tableRowRef = useRef<HTMLTableRowElement>(null);\n function getTableRowNavigationProps(\n row: number,\n ...rest: any\n ): Partial<TableRowProps> {\n if (row >= maxRow) {\n setMaxRow(row + 1);\n }\n const tabIndex = currentRow ? 0 : -1;\n return {\n tabIndex,\n ref: tableRowRef,\n onClick: () => setCurrentRow(row),\n onKeyDown: (e: KeyboardEvent) => {\n const newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);\n setCurrentRow(newCell);\n },\n ...rest,\n };\n }\n return { getTableRowNavigationProps, getTableBodyNavigationProps };\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('table');\n\nexport * from './Table';\nexport * from './TableHead';\nexport * from './TableBody';\nexport * from './TableFooter';\nexport * from './TableRow';\nexport * from './DataCell';\nexport * from './HeaderCell';\nexport * from './useSortableTable';\nexport * from './EditableCell';\nexport * from './ExpandableRow';\nexport * from './ExpandRowButton';\nexport * from './useTableKeyboardNavigation';\n"],"names":["Table","React","forwardRef","ref","className","fixed","spacing","sortable","changeSortDescription","stickyHeader","rest","_excluded","sortableHeaderId","useRandomId","tableRef","useRef","useEffect","tableElement","current","observerElement","document","createElement","classList","add","parentNode","insertBefore","observer","IntersectionObserver","entries","toggle","isIntersecting","threshold","observe","unobserve","remove","Fragment","classNames","mergeRefs","undefined","VisuallyHidden","id","TableHead","props","TableBody","TableFooter","TableRow","hover","active","error","mapStatusToVariant","status","DataCell","padding","variant","children","BulletBadge","HeaderCell","name","sortConfig","sortableButtonProps","sortedAscendingAriaLabel","sortedDescendingAriaLabel","useState","isCurrentlySorted","setIsCurrentlySorted","key","ariaSort","order","SortableHeaderCellButton","sortedAriaInfo","setSortedAriaInfo","_excluded2","isFirefox","navigator","userAgent","toLowerCase","indexOf","DISMISS_SORT_INFO_TIME","dismissAriaTimer","setTimeout","clearTimeout","type","UnsortedIcon","size","UpArrowIcon","DownArrowIcon","useSortableData","tableData","externalSortConfig","setSortConfig","onSortRequested","sortingNewColumn","tableSortedAscending","sort","a","b","valueOfA","get","toString","valueOfB","stringComparator","Intl","Collator","numeric","sensitivity","compare","getSortedData","reverse","sortedData","getSortableHeaderProps","buttonProps","onClick","getSortableTableProps","EditableCell","feedback","outlined","VariantProvider","Tooltip","disableHoverListener","disableFocusListener","placement","content","ExpandableRow","open","colSpan","BaseExpand","ExpandRowButton","IconButton","onTableKeypress","event","currentRow","maxRow","allowWrap","keyPress","preventDefault","useTableKeyboardNavigation","numberOfRows","setCurrentRow","setMaxRow","tableBodyRef","tableHasFocus","contains","activeElement","childNodes","parentElement","focus","getTableBodyNavigationProps","tableRowRef","getTableRowNavigationProps","row","tabIndex","onKeyDown","e","newCell","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,IAAMA,KAAK,gBAAGC,KAAK,CAACC,UAAU,CACnC,UAUEC,IAAAA,EAAAA,GAAG,EACD;EAAA,IATAC,SAAS,QAATA,SAAS;AAAA,IAAA,UAAA,GAAA,IAAA,CACTC,KAAK;AAALA,IAAAA,KAAK,2BAAG,KAAK,GAAA,UAAA;AAAA,IAAA,YAAA,GAAA,IAAA,CACbC,OAAO;AAAPA,IAAAA,OAAO,6BAAG,SAAS,GAAA,YAAA;AAAA,IAAA,aAAA,GAAA,IAAA,CACnBC,QAAQ;AAARA,IAAAA,QAAQ,8BAAG,KAAK,GAAA,aAAA;AAAA,IAAA,qBAAA,GAAA,IAAA,CAChBC,qBAAqB;AAArBA,IAAAA,qBAAqB,sCAAG,sEAAsE,GAAA,qBAAA;AAAA,IAAA,iBAAA,GAAA,IAAA,CAC9FC,YAAY;AAAZA,IAAAA,YAAY,kCAAG,KAAK,GAAA,iBAAA;IACjBC,IAAI,GAAA,6BAAA,CAAA,IAAA,EAAAC,WAAA,CAAA,CAAA;AAIT,EAAA,IAAMC,gBAAgB,GAAGC,WAAW,CAAC,iBAAiB,CAAC,CAAA;AAEvD,EAAA,IAAMC,QAAQ,GAAGC,MAAM,CAAmB,IAAI,CAAC,CAAA;AAE/CC,EAAAA,SAAS,CAAC,YAAK;AACb,IAAA,IAAIP,YAAY,EAAE;AAAA,MAAA,IAAA,qBAAA,CAAA;AAChB;;;;AAIqC;AACrC,MAAA,IAAMQ,YAAY,GAAGH,QAAQ,CAACI,OAAO,CAAA;AACrC,MAAA,IAAMC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A2B,EAA3BA,2BAAAA;GAA6B,CAAA;AACpE;;ACzFAQ,sBAAsB,CAAC,OAAO,CAAC;;;;"}
1
+ {"version":3,"file":"table.esm.js","sources":["../src/Table.tsx","../src/TableHead.tsx","../src/TableBody.tsx","../src/TableFooter.tsx","../src/TableRow.tsx","../src/DataCell.tsx","../src/HeaderCell.tsx","../src/useSortableTable.ts","../src/EditableCell.tsx","../src/ExpandableRow.tsx","../src/ExpandRowButton.tsx","../src/useTableKeyboardNavigation.ts","../src/index.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { useRandomId, mergeRefs } from '@entur/utils';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type TableProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Setter tettheten mellom rader og kolonner. Bruk gjerne middle og small for for sider med høy informasjonstetthet\n * @default \"default\"\n */\n spacing?: 'default' | 'middle' | 'small';\n /** Setter kolonne-layout til å være uavhengig av innhold\n * @default false\n */\n fixed?: boolean;\n /** Om header-raden skal bli værende på skjermen når man skroller tabellen\n * @default false\n */\n stickyHeader?: boolean;\n /** Innholdet i tabellen */\n children: React.ReactNode;\n [key: string]: any;\n};\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n (\n {\n className,\n fixed = false,\n spacing = 'default',\n sortable = false,\n changeSortDescription = 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,',\n stickyHeader = false,\n ...rest\n },\n ref,\n ) => {\n const sortableHeaderId = useRandomId('sortable-header');\n\n const tableRef = useRef<HTMLTableElement>(null);\n\n useEffect(() => {\n if (stickyHeader) {\n /* We check when an inserted div above the header \n is outside our scrolling container to determine when\n the table header becomes sticky. This is necessary\n to conditionally add our box-shadow when the \n header is overlapping table rows */\n const tableElement = tableRef.current;\n const observerElement = document.createElement('div');\n observerElement.classList.add('sticky-observer');\n\n tableElement?.parentNode?.insertBefore(observerElement, tableElement);\n\n const observer = new IntersectionObserver(\n entries => {\n tableElement?.classList.toggle(\n 'eds-table--sticky-header--active',\n !entries[0].isIntersecting,\n );\n },\n { threshold: [0, 1] },\n );\n\n observer.observe(observerElement);\n\n return () => {\n observer.unobserve(observerElement);\n observerElement.remove();\n };\n }\n }, [stickyHeader]);\n\n return (\n <>\n <table\n className={classNames(\n 'eds-table',\n { 'eds-table--fixed': fixed },\n { 'eds-table--middle': spacing === 'middle' },\n { 'eds-table--small': spacing === 'small' },\n { 'eds-table--sortable': sortable },\n { 'eds-table--sticky-header': stickyHeader },\n className,\n )}\n ref={mergeRefs(ref, tableRef)}\n aria-describedby={sortable ? sortableHeaderId : undefined}\n {...rest}\n />\n {sortable && (\n <VisuallyHidden id={sortableHeaderId}>\n {changeSortDescription}\n </VisuallyHidden>\n )}\n </>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableHeadProps = {\n /** Kolonneoverskrifter */\n children: React.ReactNode;\n /** Esktra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableHead = React.forwardRef<\n HTMLTableSectionElement,\n TableHeadProps\n>(({ className, ...props }, ref) => (\n <thead\n className={classNames('eds-table__head', className)}\n ref={ref}\n {...props}\n />\n));\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableBodyProps = {\n /** Tabellrader */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n ref?: React.Ref<HTMLTableSectionElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, ...rest }, ref) => (\n <tbody\n className={classNames('eds-table__body', className)}\n ref={ref}\n {...rest}\n />\n));\n","import React from 'react';\n\nexport type TableFooterProps = {\n /** Tabellrader */\n children: React.ReactNode;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n TableFooterProps\n>(({ ...props }, ref) => <tfoot ref={ref} {...props} />);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableRowProps = {\n /** Tabellceller */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /**Hvis satt, så vil tabellraden endre fargen ved hover\n * @default false\n */\n hover?: boolean;\n /** Om raden er klikkbar, så vil raden endre farge, og musepekeren vil symbolisere interaktivitet\n * @default false\n */\n active?: boolean;\n /**Signalisere om at det er en feil i tabellraden\n * @default false\n */\n error?: boolean;\n ref?: React.Ref<HTMLTableRowElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableRowElement>,\n HTMLTableRowElement\n>;\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { className, hover = false, active = false, error = false, ...rest },\n ref: React.Ref<HTMLTableRowElement>,\n ) => (\n <tr\n className={classNames('eds-table__row', className, {\n 'eds-table__row--hover': hover,\n 'eds-table__row--active': active,\n 'eds-table__row--error': error,\n })}\n ref={ref}\n {...rest}\n />\n ),\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nimport { BulletBadge } from '@entur/layout';\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst danger = 'danger';\n\nexport type DataCellProps = {\n /** Innholdet i tabellcellen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for DataCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n /** @deprecated bruk variant */\n status?: 'positive' | 'negative' | 'neutral';\n /** Hvilken type status man vil vise */\n variant?: 'primary' | 'neutral' | VariantType | typeof danger | typeof info;\n} & React.DetailedHTMLProps<\n React.TdHTMLAttributes<HTMLTableDataCellElement>,\n HTMLTableDataCellElement\n>;\n\nfunction mapStatusToVariant(\n status: 'positive' | 'negative' | 'neutral',\n): DataCellProps['variant'] {\n switch (status) {\n case 'positive':\n return 'success';\n case 'negative':\n return 'negative';\n case 'neutral':\n return 'neutral';\n default:\n return 'neutral';\n }\n}\n\nexport const DataCell = React.forwardRef<\n HTMLTableDataCellElement,\n DataCellProps\n>(\n (\n { className, padding = 'default', status, variant, children, ...rest },\n ref: React.Ref<HTMLTableDataCellElement>,\n ) => {\n // If variant is undefined and status is defined, map status to variant\n if (!variant && status) {\n variant = mapStatusToVariant(status);\n }\n return (\n <td\n ref={ref}\n className={classNames('eds-table__data-cell', className, {\n 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__data-cell--padding-radio': padding === 'radio',\n 'eds-table__data-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n {...rest}\n >\n {variant ? (\n <BulletBadge variant={variant}>{children}</BulletBadge>\n ) : (\n children\n )}\n </td>\n );\n },\n);\n","import React, { useEffect, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { DownArrowIcon, UpArrowIcon, UnsortedIcon } from '@entur/icons';\n\nimport { ExternalSortConfig } from '.';\n\nimport './HeaderCell.scss';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type HeaderCellProps = {\n /** Kolonneoverskrift */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for HeaderCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n\n /** Ekstra props som kan sendes til sorteringsknappelementet. Benyttes via useSortableTable */\n sortableButtonProps?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n\n /** Om komponenten brukes til sortering. Benytt via useSortableTable\n * @default false\n */\n sortable?: boolean;\n /** Konfigurering og rekkefølgen på sortering. Benyttes via useSortableTable */\n sortConfig?: ExternalSortConfig;\n /** Navnet det skal sorteres på. Benyttes via useSortableTable */\n name?: string;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n} & React.DetailedHTMLProps<\n React.ThHTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>;\n\nexport const HeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HeaderCellProps\n>(\n (\n {\n className,\n children,\n name,\n sortable = false,\n sortConfig,\n padding = 'default',\n sortableButtonProps,\n sortedAscendingAriaLabel = ', sortert stigende',\n sortedDescendingAriaLabel = ', sortert synkende',\n ...rest\n },\n ref,\n ) => {\n const [isCurrentlySorted, setIsCurrentlySorted] =\n React.useState<boolean>(false);\n React.useEffect(() => {\n sortConfig &&\n name &&\n setIsCurrentlySorted(sortConfig && name === sortConfig.key);\n }, [sortConfig, name]);\n const ariaSort = isCurrentlySorted\n ? sortConfig && sortConfig.order\n : undefined;\n\n return (\n <th\n className={classNames('eds-table__header-cell', className, {\n 'eds-table__header-cell--sortable': sortable,\n 'eds-table__header-cell--padding-radio': padding === 'radio',\n 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__header-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n aria-sort={ariaSort}\n ref={ref}\n {...rest}\n >\n {sortable && sortConfig && sortableButtonProps ? (\n <SortableHeaderCellButton\n sortableButtonProps={sortableButtonProps}\n sortConfig={sortConfig}\n isCurrentlySorted={isCurrentlySorted}\n ariaSort={ariaSort}\n sortedAscendingAriaLabel={sortedAscendingAriaLabel}\n sortedDescendingAriaLabel={sortedDescendingAriaLabel}\n >\n {children}\n </SortableHeaderCellButton>\n ) : (\n children\n )}\n </th>\n );\n },\n);\n\ntype SortableHeaderCellButtonProps = {\n sortConfig: ExternalSortConfig;\n isCurrentlySorted: boolean;\n sortableButtonProps: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n ariaSort?: 'none' | 'ascending' | 'descending' | 'other' | undefined;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n};\n\nconst SortableHeaderCellButton: React.FC<SortableHeaderCellButtonProps> = ({\n sortConfig,\n sortableButtonProps,\n isCurrentlySorted,\n children,\n ariaSort,\n sortedAscendingAriaLabel,\n sortedDescendingAriaLabel,\n}) => {\n const [sortedAriaInfo, setSortedAriaInfo] = useState<string | undefined>('');\n\n const { className, ...rest } = sortableButtonProps;\n\n const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\n useEffect(() => {\n const DISMISS_SORT_INFO_TIME = 3000;\n if (sortConfig.order == 'ascending') {\n setSortedAriaInfo(sortedAscendingAriaLabel);\n } else if (sortConfig.order == 'descending') {\n setSortedAriaInfo(sortedDescendingAriaLabel);\n }\n const dismissAriaTimer = setTimeout(() => {\n setSortedAriaInfo('');\n if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);\n }, DISMISS_SORT_INFO_TIME);\n\n return () => clearTimeout(dismissAriaTimer);\n }, [sortConfig.order]);\n\n return (\n <button\n className={classNames('eds-table__header-cell-button', className)}\n type=\"button\"\n aria-sort={ariaSort}\n {...rest}\n >\n {children}\n {(!isCurrentlySorted || sortConfig.order === 'none') && (\n <UnsortedIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'ascending' && (\n <UpArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'descending' && (\n <DownArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n <VisuallyHidden>{isCurrentlySorted && sortedAriaInfo}</VisuallyHidden>\n </button>\n );\n};\n","import {\n ButtonHTMLAttributes,\n DetailedHTMLProps,\n useMemo,\n useState,\n} from 'react';\nimport get from 'lodash.get';\n\nexport type ExternalSortConfig = {\n /**\n * @default \"\"\n */\n key: string;\n /** @default \"none\" */\n order: 'ascending' | 'descending' | 'none';\n};\n\nexport function useSortableData<T>(\n tableData: T[],\n externalSortConfig: ExternalSortConfig = { key: '', order: 'none' },\n): {\n sortedData: T[];\n getSortableHeaderProps: (\n args: SortableHeaderProps,\n ) => SortableHeaderReturnProps;\n getSortableTableProps: (\n args?: SortableTableProps,\n ) => SortableTableReturnProps;\n} {\n const [sortConfig, setSortConfig] = useState(externalSortConfig);\n\n const onSortRequested = (key: string) => {\n const sortingNewColumn = key !== sortConfig.key;\n if (sortingNewColumn || sortConfig.order === 'none')\n return setSortConfig({ key, order: 'ascending' });\n if (sortConfig.order === 'ascending')\n return setSortConfig({ key, order: 'descending' });\n if (sortConfig.order === 'descending')\n return setSortConfig({ key, order: 'none' });\n };\n\n const tableSortedAscending = useMemo(\n () =>\n [...tableData].sort((a: any, b: any) => {\n const valueOfA: string = get(a, sortConfig.key, a)?.toString() ?? '';\n const valueOfB: string = get(b, sortConfig.key, b)?.toString() ?? '';\n\n const stringComparator = new Intl.Collator(['no', 'en'], {\n numeric: true,\n sensitivity: 'base',\n });\n\n return stringComparator.compare(valueOfA, valueOfB);\n }),\n [tableData, sortConfig.key],\n );\n\n const sortedData = useMemo(() => {\n switch (sortConfig.order) {\n case 'ascending': {\n return tableSortedAscending;\n }\n case 'descending': {\n return [...tableSortedAscending].reverse();\n }\n case 'none': {\n return tableData;\n }\n default: {\n return tableData;\n }\n }\n }, [sortConfig.order, tableData, tableSortedAscending]);\n\n const getSortableHeaderProps = ({\n name,\n sortable = true,\n buttonProps,\n ...props\n }: SortableHeaderProps): SortableHeaderReturnProps => {\n return {\n name,\n sortable,\n sortConfig: sortConfig,\n sortableButtonProps: {\n onClick: () => onSortRequested(name),\n ...buttonProps,\n },\n ...props,\n };\n };\n\n const getSortableTableProps = ({\n sortable = true,\n ...props\n }: SortableTableProps = {}): SortableTableReturnProps => {\n return {\n sortable,\n sortConfig: sortConfig,\n ...props,\n };\n };\n\n return { sortedData, getSortableHeaderProps, getSortableTableProps };\n}\n\nexport type SortableHeaderProps = {\n /** Navnet headeren skal se etter i forhold til sortering av items */\n name: string;\n /** Om headeren skal være sorterbar eller ikke\n * @default true */\n sortable?: boolean;\n /** Props som sendes til knapp-elementet */\n buttonProps?: Omit<\n DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >,\n 'type' | 'onClick'\n >;\n [key: string]: any;\n};\n\nexport type SortableHeaderReturnProps = {\n name: string;\n sortable: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n\nexport type SortableTableProps = {\n /** @default true */\n sortable?: boolean;\n [key: string]: any;\n};\n\nexport type SortableTableReturnProps = {\n /** @default true */\n sortable?: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n","import classNames from 'classnames';\nimport React from 'react';\nimport { DataCell } from './DataCell';\n\nimport { VariantProvider } from '@entur/form';\nimport { VariantType } from '@entur/utils';\nimport { Tooltip } from '@entur/tooltip';\n\nimport './EditableCell.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype EditableCellProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Inputelementet som skal være i tabellcellen */\n children: React.ReactElement;\n /** Valideringsvariant for EditableCell */\n variant?: VariantType | typeof error | typeof info;\n /** Varselmelding, som vil komme som en Tooltip under EditableCell */\n feedback?: string;\n /** Om cellen skal vise omriss til enhver tid\n * @default false\n */\n outlined?: boolean;\n [key: string]: any;\n};\n\nexport const EditableCell: React.FC<EditableCellProps> = ({\n children,\n className,\n feedback,\n variant,\n outlined = false,\n ...rest\n}) => {\n return (\n <VariantProvider variant={variant}>\n <DataCell\n className={classNames(\n 'eds-editable-cell',\n {\n 'eds-editable-cell--outlined': outlined,\n },\n className,\n )}\n {...rest}\n >\n <Tooltip\n disableHoverListener={!feedback}\n disableFocusListener={!feedback}\n placement=\"bottom\"\n content={feedback || undefined}\n variant={feedback ? 'negative' : undefined}\n >\n {children}\n </Tooltip>\n </DataCell>\n </VariantProvider>\n );\n};\n","import React from 'react';\nimport { BaseExpand } from '@entur/expand';\n\nexport type ExpandableRowProps = {\n /** Antall kolonner tabellraden er */\n colSpan: number;\n /** Innholdet til ExpandableRow */\n children: React.ReactNode;\n /** Om ExpandableRow er åpen\n * @default false\n */\n open?: boolean;\n};\n\nexport const ExpandableRow: React.FC<ExpandableRowProps> = ({\n open = false,\n children,\n colSpan,\n}) => {\n return (\n <tr>\n <td colSpan={colSpan}>\n <BaseExpand open={open}>{children}</BaseExpand>\n </td>\n </tr>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DownArrowIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './ExpandRowButton.scss';\n\nexport type ExpandRowButtonProps = {\n open: boolean;\n onClick: (e: React.MouseEvent) => void;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ExpandRowButton: React.FC<ExpandRowButtonProps> = ({\n open,\n onClick,\n ...rest\n}) => {\n return (\n <IconButton\n className={classNames('eds-expand-row-button', {\n 'eds-expand-row-button--open': open,\n })}\n onClick={onClick}\n aria-label={open ? 'Lukk tabellrad' : 'Utvid tabellrad'}\n type=\"button\"\n {...rest}\n >\n <DownArrowIcon aria-hidden className=\"eds-expand-row-button__icon\" />\n </IconButton>\n );\n};\n","import { useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport { TableBodyProps, TableRowProps } from './index';\n\nfunction onTableKeypress(\n event: KeyboardEvent,\n currentRow: number,\n maxRow: number,\n allowWrap?: boolean,\n) {\n const keyPress = event.key;\n switch (keyPress) {\n case 'ArrowUp':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === 0 ? maxRow - 1 : currentRow - 1;\n } else {\n return currentRow > 0 ? currentRow - 1 : 0;\n }\n case 'ArrowDown':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === maxRow - 1 ? 0 : currentRow + 1;\n } else {\n return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;\n }\n default:\n return currentRow;\n }\n}\n\nexport type useTableKeyboardNavigationProps = (\n /** Antall rader i tabellen */\n numberOfRows: number,\n /** Tillate at man kan navigere sirkulært\n * @default false\n */\n allowWrap?: boolean,\n) => {\n getTableRowNavigationProps: (\n /** Raden i tabellen (0-indeksert) */\n row: number,\n ) => Partial<TableRowProps>;\n getTableBodyNavigationProps: () => Partial<TableBodyProps>;\n};\n\nexport const useTableKeyboardNavigation: useTableKeyboardNavigationProps = (\n numberOfRows = 0,\n allowWrap = true,\n) => {\n const [currentRow, setCurrentRow] = useState(numberOfRows);\n const [maxRow, setMaxRow] = useState(0);\n\n const tableBodyRef = useRef<HTMLTableSectionElement>(null);\n const tableHasFocus = tableBodyRef?.current?.contains(document.activeElement);\n\n useEffect(() => {\n tableBodyRef &&\n tableBodyRef.current &&\n tableHasFocus &&\n tableBodyRef.current.childNodes[\n currentRow\n ].childNodes[0].parentElement?.focus();\n }, [currentRow, tableHasFocus]);\n\n function getTableBodyNavigationProps(...rest: any): Partial<TableBodyProps> {\n return {\n ref: tableBodyRef,\n ...rest,\n };\n }\n\n const tableRowRef = useRef<HTMLTableRowElement>(null);\n function getTableRowNavigationProps(\n row: number,\n ...rest: any\n ): Partial<TableRowProps> {\n if (row >= maxRow) {\n setMaxRow(row + 1);\n }\n const tabIndex = currentRow ? 0 : -1;\n return {\n tabIndex,\n ref: tableRowRef,\n onClick: () => setCurrentRow(row),\n onKeyDown: (e: KeyboardEvent) => {\n const newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);\n setCurrentRow(newCell);\n },\n ...rest,\n };\n }\n return { getTableRowNavigationProps, getTableBodyNavigationProps };\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('table');\n\nexport * from './Table';\nexport * from './TableHead';\nexport * from './TableBody';\nexport * from './TableFooter';\nexport * from './TableRow';\nexport * from './DataCell';\nexport * from './HeaderCell';\nexport * from './useSortableTable';\nexport * from './EditableCell';\nexport * from './ExpandableRow';\nexport * from './ExpandRowButton';\nexport * from './useTableKeyboardNavigation';\n"],"names":["Table","React","forwardRef","ref","className","fixed","spacing","sortable","changeSortDescription","stickyHeader","rest","_excluded","sortableHeaderId","useRandomId","tableRef","useRef","useEffect","tableElement","current","observerElement","document","createElement","classList","add","parentNode","insertBefore","observer","IntersectionObserver","entries","toggle","isIntersecting","threshold","observe","unobserve","remove","Fragment","classNames","mergeRefs","undefined","VisuallyHidden","id","TableHead","props","TableBody","TableFooter","TableRow","hover","active","error","mapStatusToVariant","status","DataCell","padding","variant","children","BulletBadge","HeaderCell","name","sortConfig","sortableButtonProps","sortedAscendingAriaLabel","sortedDescendingAriaLabel","useState","isCurrentlySorted","setIsCurrentlySorted","key","ariaSort","order","SortableHeaderCellButton","sortedAriaInfo","setSortedAriaInfo","_excluded2","isFirefox","navigator","userAgent","toLowerCase","indexOf","DISMISS_SORT_INFO_TIME","dismissAriaTimer","setTimeout","clearTimeout","type","UnsortedIcon","size","UpArrowIcon","DownArrowIcon","useSortableData","tableData","externalSortConfig","setSortConfig","onSortRequested","sortingNewColumn","tableSortedAscending","useMemo","sort","a","b","valueOfA","get","toString","valueOfB","stringComparator","Intl","Collator","numeric","sensitivity","compare","sortedData","reverse","getSortableHeaderProps","buttonProps","onClick","getSortableTableProps","EditableCell","feedback","outlined","VariantProvider","Tooltip","disableHoverListener","disableFocusListener","placement","content","ExpandableRow","open","colSpan","BaseExpand","ExpandRowButton","IconButton","onTableKeypress","event","currentRow","maxRow","allowWrap","keyPress","preventDefault","useTableKeyboardNavigation","numberOfRows","setCurrentRow","setMaxRow","tableBodyRef","tableHasFocus","contains","activeElement","childNodes","parentElement","focus","getTableBodyNavigationProps","tableRowRef","getTableRowNavigationProps","row","tabIndex","onKeyDown","e","newCell","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,IAAMA,KAAK,gBAAGC,KAAK,CAACC,UAAU,CACnC,UAUEC,IAAA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
@@ -1,4 +1,4 @@
1
- import { DetailedHTMLProps, ButtonHTMLAttributes } from 'react';
1
+ import { ButtonHTMLAttributes, DetailedHTMLProps } from 'react';
2
2
  export type ExternalSortConfig = {
3
3
  /**
4
4
  * @default ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur/table",
3
- "version": "4.8.11",
3
+ "version": "4.8.12-beta.0",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/table.esm.js",
@@ -40,5 +40,5 @@
40
40
  "classnames": "^2.3.1",
41
41
  "lodash.get": "^4.4.2"
42
42
  },
43
- "gitHead": "59263b656c7de882e8ecf50bdb49f7ddfd283026"
43
+ "gitHead": "3b1758ee9d6e702c09655df3cfa943eef16a9c6f"
44
44
  }