@umodeapporg/ui 0.11.0 → 0.12.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.
@@ -27,6 +27,14 @@ interface IDataTableProps<T extends IDataTableRow, C extends IDataTableRow = IDa
27
27
  /** Client mode: reports page/pageSize changes and keeps the page across in-place row updates. */
28
28
  onClientPaginationChange?: (pagination: IDataTableClientPaginationState) => void;
29
29
  toolbarSlot?: JSX.Element;
30
+ /**
31
+ * Extra controls rendered in the footer's left group, right after the table's
32
+ * own buttons (columns, edit mode, bulk edit). For an action that belongs to
33
+ * the list itself rather than to the page header, so it sits beside the
34
+ * controls it relates to instead of competing with the page actions. The
35
+ * footer row renders for this slot alone when the table has no other control.
36
+ */
37
+ footerActionsSlot?: ReactNode;
30
38
  /**
31
39
  * Applied filter values. Passing them (together with `config.filters`) makes
32
40
  * the table render the always-visible active-filter chips above the toolbar,
@@ -96,5 +104,5 @@ interface IDataTableProps<T extends IDataTableRow, C extends IDataTableRow = IDa
96
104
  */
97
105
  commitStatuses?: ReadonlyMap<string, string>;
98
106
  }
99
- declare const DataTable: <T extends IDataTableRow, C extends IDataTableRow = IDataTableRow>({ config: configProp, rows, loading, error, errorCause, onRetry, emptyMessage, searchLabel, onSearch, initialSearch, onSearchTermChange, searchDisabled, searchDebounceTime, searchMinLength, searchAtStart, sort, onSortChange, pagination, initialClientPagination, onClientPaginationChange, toolbarSlot, filterValues, onFilterValuesChange, toolbarStartSlot, bodyTopRow, onFilteredCountChange, viewMode: controlledViewMode, onViewModeChange, columnTogglePlacement, cardsInfiniteScroll, hideViewToggle, layout, dense: denseProp, spacious, commitStatuses, }: IDataTableProps<T, C>) => JSX.Element;
107
+ declare const DataTable: <T extends IDataTableRow, C extends IDataTableRow = IDataTableRow>({ config: configProp, rows, loading, error, errorCause, onRetry, emptyMessage, searchLabel, onSearch, initialSearch, onSearchTermChange, searchDisabled, searchDebounceTime, searchMinLength, searchAtStart, sort, onSortChange, pagination, initialClientPagination, onClientPaginationChange, toolbarSlot, footerActionsSlot, filterValues, onFilterValuesChange, toolbarStartSlot, bodyTopRow, onFilteredCountChange, viewMode: controlledViewMode, onViewModeChange, columnTogglePlacement, cardsInfiniteScroll, hideViewToggle, layout, dense: denseProp, spacious, commitStatuses, }: IDataTableProps<T, C>) => JSX.Element;
100
108
  export default DataTable;
@@ -73,6 +73,7 @@ const DataTable = ({
73
73
  initialClientPagination,
74
74
  onClientPaginationChange,
75
75
  toolbarSlot,
76
+ footerActionsSlot,
76
77
  filterValues,
77
78
  onFilterValuesChange,
78
79
  toolbarStartSlot,
@@ -466,6 +467,7 @@ const DataTable = ({
466
467
  const showFooterColumnToggle = columnTogglePlacement === "footer" && showTableControls;
467
468
  const showFooterEditToggle = showEditModeToggle && showTableControls;
468
469
  const showBulkEdit = hasEditableColumns && !!spreadsheet?.fill?.onFillCells && !isDelegatedView && !showSkeleton && !error && hasRows;
470
+ const showFooterControls = showFooterColumnToggle || showFooterEditToggle || showBulkEdit || !!footerActionsSlot;
469
471
  const bulkEditRows = useMemo(
470
472
  () => visibleRows.filter((row) => row.depth === 0).map((row) => row.original),
471
473
  [visibleRows]
@@ -529,8 +531,8 @@ const DataTable = ({
529
531
  ]
530
532
  }
531
533
  ) }),
532
- (showFooterColumnToggle || showFooterEditToggle || showBulkEdit || showPagination) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
533
- (showFooterColumnToggle || showFooterEditToggle || showBulkEdit) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 pb-3", children: [
534
+ (showFooterControls || showPagination) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
535
+ showFooterControls && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 pb-3", children: [
534
536
  showFooterColumnToggle && /* @__PURE__ */ jsx(
535
537
  DataTableColumnToggle,
536
538
  {
@@ -544,7 +546,8 @@ const DataTable = ({
544
546
  }
545
547
  ),
546
548
  showFooterEditToggle && /* @__PURE__ */ jsx(DataTableEditModeButton, { active: isEditMode, onToggle: handleEditModeToggle }),
547
- showBulkEdit && /* @__PURE__ */ jsx(DataTableBulkEditButton, { onClick: () => setIsBulkEditOpen(true) })
549
+ showBulkEdit && /* @__PURE__ */ jsx(DataTableBulkEditButton, { onClick: () => setIsBulkEditOpen(true) }),
550
+ footerActionsSlot
548
551
  ] }),
549
552
  showPagination && /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
550
553
  DataTablePagination,
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","sources":["../../../../src/components/UI/DataTable/DataTable.tsx"],"sourcesContent":["import { Fragment, JSX, KeyboardEvent, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\nimport ControlledButton from '@/components/Form/ControlledButton';\nimport { ActiveFiltersBar, buildEmptyFilterValues, emptyValueForKind } from '@/components/Search/filters';\nimport LoadingSpinner from '@/components/UI/LoadingSpinner';\nimport { MaterialSymbol } from '@/components/UI/MaterialSymbol';\nimport { useBreakpoint } from '@/hooks/useBreakpoint';\n\nimport GridProvider from './grid/GridProvider';\nimport { type IGridCellCoord } from './grid/gridTypes';\nimport { useGridFillApply } from './grid/useGridFillApply';\nimport { useGridEditMode, useGridInstance, useGridMatrixSync } from './grid/useGridInstance';\nimport { useGridKeyboard } from './grid/useGridKeyboard';\nimport DataTableAutoCard from './DataTableAutoCard';\nimport DataTableBody from './DataTableBody';\nimport DataTableBulkEditButton from './DataTableBulkEditButton';\nimport DataTableBulkEditDialog from './DataTableBulkEditDialog';\nimport { isBadgeColumnType } from './dataTableClasses';\nimport DataTableColumnToggle from './DataTableColumnToggle';\nimport { type IDataTableDetailColumnsState } from './DataTableDetailTable';\nimport DataTableEditModeButton from './DataTableEditModeButton';\nimport DataTableHead from './DataTableHead';\nimport DataTablePaginationBar, { DATA_TABLE_MIN_PAGE_SIZE } from './DataTablePagination';\nimport {\n DataTableCardsSkeletonState,\n DataTableEmptyState,\n DataTableErrorState,\n DataTableSkeletonState,\n} from './DataTableStates';\nimport DataTableToolbar from './DataTableToolbar';\nimport {\n DATA_TABLE_REMOVE_COLUMN_ID,\n type IDataTableColumnConfig,\n type IDataTableConfig,\n type IDataTableRow,\n type IDataTableSortState,\n type IDataTableSpreadsheetConfig,\n isDataTableDetailTableExpansion,\n type TDataTableFilterValues,\n type TDataTableViewMode,\n} from './types';\nimport DataTableCellEditingProvider from './useCellEditingState';\nimport { useColumnOrder, useDetailColumnOrder } from './useColumnOrder';\nimport { useColumnSizing } from './useColumnSizing';\nimport { useColumnVisibility, useDetailColumnVisibility } from './useColumnVisibility';\nimport {\n type IDataTableClientPaginationState,\n type IDataTablePagination,\n useDataTableInstance,\n} from './useDataTableInstance';\nimport { useDataTableUndoHistory } from './useDataTableUndoHistory';\n\ninterface IDataTableProps<T extends IDataTableRow, C extends IDataTableRow = IDataTableRow> {\n config: IDataTableConfig<T, C>;\n rows: Array<T>;\n loading?: boolean;\n error?: boolean;\n /** Cause behind `error`, so the empty state can name a denial instead of a system failure. */\n errorCause?: unknown;\n onRetry?: () => void;\n emptyMessage?: string;\n searchLabel?: string;\n onSearch?: (value: string) => void;\n initialSearch?: string;\n onSearchTermChange?: (value: string) => void;\n searchDisabled?: boolean;\n searchDebounceTime?: number;\n searchMinLength?: number;\n /** Renders the search input in the toolbar's start (left) group instead of the end. */\n searchAtStart?: boolean;\n sort?: IDataTableSortState | null;\n onSortChange?: (sort: IDataTableSortState | null) => void;\n pagination?: IDataTablePagination;\n /** Client mode: seeds page/pageSize (1-based page), e.g. from the URL. */\n initialClientPagination?: IDataTableClientPaginationState;\n /** Client mode: reports page/pageSize changes and keeps the page across in-place row updates. */\n onClientPaginationChange?: (pagination: IDataTableClientPaginationState) => void;\n toolbarSlot?: JSX.Element;\n /**\n * Applied filter values. Passing them (together with `config.filters`) makes\n * the table render the always-visible active-filter chips above the toolbar,\n * so the user never has to hover the button to see what is filtering.\n */\n filterValues?: TDataTableFilterValues;\n onFilterValuesChange?: (values: TDataTableFilterValues) => void;\n /** Rendered at the start (left) of the toolbar, before tabs and view toggle. */\n toolbarStartSlot?: JSX.Element;\n /**\n * Full-width band rendered as the first row of the list body, spanning every\n * column (below the header, above the data rows). Opt-in: omit for a normal\n * table. When set, the empty state is skipped so the band stays visible even\n * with zero data rows (e.g. an inline \"create the first record\" editor).\n */\n bodyTopRow?: ReactNode;\n /** Client mode: reports the filtered (post-search) row count on every change. */\n onFilteredCountChange?: (count: number) => void;\n /**\n * Controlled view mode. When provided, the host owns the state (e.g. to persist\n * it) and must update it via `onViewModeChange`; omit for internal state.\n */\n viewMode?: TDataTableViewMode;\n /**\n * Fired on every view-toggle click, including re-selecting the active mode\n * (hosts use it e.g. to reopen the grouping dialog).\n */\n onViewModeChange?: (mode: TDataTableViewMode) => void;\n /**\n * Where the \"Columns\" toggle renders: `header` (default, inside the table\n * header), `toolbar` (next to the view toggle) or `footer` (bottom-left,\n * on the same row as the pagination).\n */\n columnTogglePlacement?: 'header' | 'toolbar' | 'footer';\n /**\n * Enables infinite scroll in the Cards view: the table observes a bottom\n * sentinel and calls `loadMore` while `hasMore`. Pass `source.cardsInfinite`\n * from `useDataTableSource`. The Lista view keeps its pagination bar.\n */\n cardsInfiniteScroll?: {\n hasMore: boolean;\n loadingMore: boolean;\n loadMore: () => void;\n };\n /**\n * Hides the built-in segmented view toggle. Use when the host renders its own\n * Cards/Lista switcher (e.g. a page-level `ControlledTabs`) and drives `viewMode`\n * itself. Other consumers keep the default toggle.\n */\n hideViewToggle?: boolean;\n /**\n * Layout mode. `page` (default): the table owns a bounded, vertically-scrolling\n * region (`flex-1 min-h-0`) for full-page lists. `fit`: the table sizes to its\n * content and scrolls only horizontally — for embedding inside a dialog / card /\n * editor grid where the host container owns vertical scroll. In `fit` mode the\n * empty state is compact (no full illustration) so surrounding controls such as\n * the add-row button stay visible.\n */\n layout?: 'page' | 'fit';\n /** Reduces cell vertical padding for more visible rows per viewport. */\n dense?: boolean;\n /** Roomier cell padding and type scale, for tables that need to read bigger. */\n spacious?: boolean;\n /**\n * Per-cell persistence state (`statuses` from `useDataTableCommitQueue`), painted\n * on the cells so the user sees what is saving and what failed.\n */\n commitStatuses?: ReadonlyMap<string, string>;\n}\n\nconst DataTable = <T extends IDataTableRow, C extends IDataTableRow = IDataTableRow>({\n config: configProp,\n rows,\n loading = false,\n error = false,\n errorCause,\n onRetry,\n emptyMessage,\n searchLabel,\n onSearch,\n initialSearch = '',\n onSearchTermChange,\n searchDisabled = false,\n searchDebounceTime = 400,\n searchMinLength = 1,\n searchAtStart = false,\n sort,\n onSortChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n toolbarSlot,\n filterValues,\n onFilterValuesChange,\n toolbarStartSlot,\n bodyTopRow,\n onFilteredCountChange,\n viewMode: controlledViewMode,\n onViewModeChange,\n columnTogglePlacement = 'header',\n cardsInfiniteScroll,\n hideViewToggle = false,\n layout = 'page',\n dense: denseProp = false,\n spacious = false,\n commitStatuses,\n}: IDataTableProps<T, C>) => {\n const { t } = useTranslation('ui');\n\n const isFit = layout === 'fit';\n const dense = !spacious && (isFit || denseProp);\n const editingRows = configProp.editing?.rows;\n const showAddRow = !!editingRows?.canAdd && !!editingRows.onAddRow;\n\n const hostFillCells = configProp.spreadsheet ? configProp.spreadsheet.fill?.onFillCells : undefined;\n const isUndoEnabled = !!configProp.editing?.onCellChange && configProp.editing.undo !== false;\n const { recordedOnCellChange, recordedOnFillCells, handleUndoShortcut } = useDataTableUndoHistory<T>({\n enabled: isUndoEnabled,\n rows,\n columns: configProp.columns,\n onCellChange: configProp.editing?.onCellChange,\n onFillCells: hostFillCells,\n });\n\n const configWithUndo = useMemo<IDataTableConfig<T, C>>(() => {\n if (!isUndoEnabled || !configProp.editing) return configProp;\n\n const spreadsheetConfig = configProp.spreadsheet;\n return {\n ...configProp,\n editing: { ...configProp.editing, onCellChange: recordedOnCellChange },\n spreadsheet:\n spreadsheetConfig && spreadsheetConfig.fill?.onFillCells\n ? { ...spreadsheetConfig, fill: { ...spreadsheetConfig.fill, onFillCells: recordedOnFillCells } }\n : spreadsheetConfig,\n };\n }, [configProp, isUndoEnabled, recordedOnCellChange, recordedOnFillCells]);\n\n // When `editing.rows.onRemoveRow` is set, append a synthetic trailing actions\n // column carrying a per-row delete control. It is a real `actions` column, so\n // it flows through the existing sizing / sticky-right / flex-exclusion / order\n // paths unchanged (see useColumnOrder: actions columns are pinned to the end).\n const config = useMemo<IDataTableConfig<T, C>>(() => {\n if (!editingRows?.onRemoveRow) return configWithUndo;\n\n const removeColumn: IDataTableColumnConfig<T> = {\n id: DATA_TABLE_REMOVE_COLUMN_ID,\n header: '',\n type: 'actions',\n hideable: false,\n resizable: false,\n actions: [\n {\n key: 'remove',\n label: t('dataTable.removeRow'),\n icon: 'delete',\n danger: true,\n hidden: (row) => (editingRows.canRemove ? !editingRows.canRemove(row) : false),\n onClick: (row) => editingRows.onRemoveRow?.(row),\n },\n ],\n };\n\n return { ...configWithUndo, columns: [...configWithUndo.columns, removeColumn] };\n }, [configWithUndo, editingRows, t]);\n\n const { columnVisibility, onColumnVisibilityChange } = useColumnVisibility(config);\n const { columnOrder, onColumnOrderChange, resetColumnOrder } = useColumnOrder(config);\n const { columnSizing, onColumnSizingChange, resetColumnSizing } = useColumnSizing(config);\n\n // Every table restores the persisted column order back to the config default\n // on mount (equivalent to firing \"Restaurar ordem padrão\" from the columns\n // menu), so a stale/incompatible persisted order never sticks. Does not touch\n // column widths or visibility, and does not affect the Cards view.\n useEffect(() => {\n resetColumnOrder();\n }, []);\n\n const detailExpansionColumns =\n config.expansion && isDataTableDetailTableExpansion(config.expansion) && Array.isArray(config.expansion.columns)\n ? config.expansion.columns\n : null;\n const { detailColumnVisibility, toggleDetailColumn } = useDetailColumnVisibility(\n config.entityKey,\n detailExpansionColumns,\n );\n const { detailColumnOrder, onDetailColumnOrderChange, resetDetailColumnOrder } = useDetailColumnOrder(\n config.entityKey,\n detailExpansionColumns,\n );\n\n const detailColumnsState: IDataTableDetailColumnsState | undefined = detailExpansionColumns\n ? {\n visibility: detailColumnVisibility,\n toggleVisibility: toggleDetailColumn,\n order: detailColumnOrder,\n onOrderChange: onDetailColumnOrderChange,\n resetOrder: resetDetailColumnOrder,\n }\n : undefined;\n\n const { isMobile } = useBreakpoint();\n\n const hasCardView = !!config.renderCard;\n const hasGroupedView = !!config.renderGroupedBody;\n const hasKanbanView = !!config.renderKanbanBody;\n // Fixed behaviour: card-capable tables always open on Cards (first), Lista second.\n // The toggle switches within the session and resets to Cards on remount, unless\n // the host controls the mode via the `viewMode` prop (e.g. persisted preference).\n const [internalViewMode, setInternalViewMode] = useState<TDataTableViewMode>('cards');\n const viewMode = controlledViewMode ?? internalViewMode;\n\n const [isBulkEditOpen, setIsBulkEditOpen] = useState(false);\n\n const handleViewModeChange = (mode: TDataTableViewMode) => {\n if (controlledViewMode === undefined) setInternalViewMode(mode);\n onViewModeChange?.(mode);\n };\n\n const {\n table,\n isClientMode,\n columnContentWidths,\n registerRow,\n beginRowsExit,\n visibleRows,\n activeTab,\n tabs,\n handleTabChange,\n handleSearchInput,\n handleHeaderSortClick,\n resolveSortDirection,\n clientPaginationProps,\n showUpdatingBar,\n contentOpacityStyle,\n dataTableOpacityTransitionClass,\n showSkeleton,\n hasRows,\n clientSearchDebounceMs,\n } = useDataTableInstance({\n config,\n rows,\n loading,\n sort,\n onSortChange,\n onSearch,\n initialSearch,\n onSearchTermChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n columnSizing,\n onColumnSizingChange,\n onFilteredCountChange,\n });\n\n const columnConfigById = useMemo(\n () => new Map(config.columns.map((columnConfig) => [columnConfig.id, columnConfig])),\n [config.columns],\n );\n\n // Under `table-fixed` one column absorbs leftover horizontal space. The last\n // visible non-actions, non-badge, non-first column is the flex column.\n const visibleLeafColumns = table.getVisibleLeafColumns();\n const flexColumnId = useMemo(() => {\n if (config.flexColumnId && visibleLeafColumns.some((leafColumn) => leafColumn.id === config.flexColumnId)) {\n return config.flexColumnId;\n }\n\n const candidates = visibleLeafColumns.filter((leafColumn, index) => {\n if (index === 0) return false;\n const type = columnConfigById.get(leafColumn.id)?.type;\n return type !== 'actions' && !isBadgeColumnType(type);\n });\n return candidates[candidates.length - 1]?.id ?? null;\n }, [visibleLeafColumns, columnConfigById, config.flexColumnId]);\n\n // `table-fixed` sizes columns from the table width, so the table must be at\n // least the sum of ALL column widths (including the absorber's seed) for their\n // widths to be honored; below that the browser shrinks them proportionally.\n // `min-w-full` still lets the table stretch to fill the container, and the\n // auto-width absorber soaks the surplus (never shrinking below its own seed,\n // because its seed is part of this total).\n const totalTableWidth = useMemo(\n () => visibleLeafColumns.reduce((sum, leafColumn) => sum + leafColumn.getSize(), 0),\n [visibleLeafColumns, columnSizing],\n );\n\n // ----- Spreadsheet layer -----\n // Toda tabela com coluna editável ganha a camada de planilha sem configuração.\n // O que muda por tabela é QUANDO ela fica ativa: onde o clique na linha já\n // significa \"abrir o registro\", selecionar célula e navegar seriam o mesmo\n // gesto, então o usuário liga o modo no toolbar antes de editar.\n const spreadsheet = useMemo<IDataTableSpreadsheetConfig<T> | undefined>(() => {\n if (config.spreadsheet === false) return undefined;\n return config.spreadsheet ?? { selection: 'range', fill: {} };\n }, [config.spreadsheet]);\n\n const hasEditableColumns = useMemo(\n () => !!config.editing?.onCellChange && config.columns.some((columnConfig) => !!columnConfig.editable),\n [config.editing, config.columns],\n );\n\n const editModeBehavior = spreadsheet?.mode ?? (config.onRowClick ? 'toggle' : 'always');\n const gridEnabled = !!spreadsheet && (hasEditableColumns || !!config.spreadsheet);\n\n const gridStore = useGridInstance({\n spreadsheet,\n enabled: gridEnabled,\n startsInEditMode: editModeBehavior === 'always',\n });\n\n const isEditMode = useGridEditMode(gridStore);\n const showEditModeToggle = gridEnabled && editModeBehavior === 'toggle';\n\n // Below the tablet edge a real table is unreadable: even the narrowest column\n // set overflows and the user reads it through a horizontal scrollbar. Cards are\n // the readable shape there, so the narrow viewport takes over the choice.\n // Excluded: `fit` layouts without a bespoke card (their cell geometry IS the\n // feature) and the spreadsheet grid while it is ACTIVE. Merely being able to edit\n // is not enough: a table whose edit mode is a toggle stays a reading surface\n // until the user turns it on. A `fit` table that ships `renderCard` opted into a\n // narrow shape, so it takes over as well.\n const forceCardsOnMobile = isMobile && (!isFit || hasCardView) && !isEditMode;\n\n const isGroupedView = hasGroupedView && viewMode === 'grouped';\n const isKanbanView = hasKanbanView && viewMode === 'kanban';\n // Grouped and kanban both hand the whole body to the host, so everything the\n // table draws around a real row list is off in either of them.\n const isDelegatedView = isGroupedView || isKanbanView;\n const isCardsView = hasCardView && (viewMode === 'cards' || (forceCardsOnMobile && !isDelegatedView));\n const useAutoCards = forceCardsOnMobile && !hasCardView && !isDelegatedView;\n\n useEffect(() => {\n if (!gridStore || !commitStatuses) return;\n gridStore.getState().setCellStatuses(commitStatuses);\n }, [gridStore, commitStatuses]);\n\n const navigableColumnIds = useMemo(\n () =>\n visibleLeafColumns\n .filter((leafColumn) => columnConfigById.get(leafColumn.id)?.type !== 'actions')\n .map((leafColumn) => leafColumn.id),\n [visibleLeafColumns, columnConfigById],\n );\n const gridRowIds = useMemo(() => visibleRows.map((row) => row.id), [visibleRows]);\n\n useGridMatrixSync(gridStore, gridRowIds, navigableColumnIds);\n\n // Read through a ref so the callback stays stable while the rows change on\n // every edit: an unstable handler would re-bind the grid keyboard each render.\n const visibleRowsRef = useRef(visibleRows);\n visibleRowsRef.current = visibleRows;\n\n const canEditCell = useCallback(\n ({ rowId, columnId }: IGridCellCoord) => {\n if (!config.editing?.onCellChange) return false;\n\n const editable = columnConfigById.get(columnId)?.editable;\n if (!editable) return false;\n\n const row = visibleRowsRef.current.find((candidate) => candidate.id === rowId);\n if (!row) return false;\n\n return !(editable.disabled?.(row.original) ?? false);\n },\n [config.editing, columnConfigById],\n );\n\n const handleGridKeyDown = useGridKeyboard({\n store: gridStore,\n canEditCell,\n onSave: spreadsheet?.onSave,\n });\n\n const handleFillCommit = useGridFillApply<T>({\n visibleRows,\n columnConfigById,\n spreadsheet,\n onCellChange: config.editing?.onCellChange,\n });\n\n // After an undo in the spreadsheet grid the restored cell becomes the active one, so\n // the user sees which cell changed, even when it sits on another row of the page.\n const handleTableKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const restoredCell = handleUndoShortcut(event);\n if (!restoredCell || !gridStore || !gridStore.getState().isEditMode) return;\n\n const restoredGridRow = visibleRowsRef.current.find((candidate) => candidate.original.id === restoredCell.row.id);\n if (!restoredGridRow) return;\n gridStore.getState().setActiveCell({ rowId: restoredGridRow.id, columnId: restoredCell.columnId });\n },\n [handleUndoShortcut, gridStore],\n );\n\n const handleEditModeToggle = useCallback(() => {\n const store = gridStore;\n if (!store) return;\n store.getState().setEditMode(!store.getState().isEditMode);\n }, [gridStore]);\n\n const cardsScrollRef = useRef<HTMLDivElement | null>(null);\n const cardsSentinelRef = useRef<HTMLDivElement | null>(null);\n const cardsLoadMore = cardsInfiniteScroll?.loadMore;\n const cardsHasMore = cardsInfiniteScroll?.hasMore ?? false;\n\n // Cards infinite scroll: load the next page when the bottom sentinel enters the\n // cards scroll container. `loadMore` is stable and self-guards while a page is\n // in flight; re-running on row count keeps the observer bound after each append.\n useEffect(() => {\n if (!isCardsView || !cardsHasMore || !cardsLoadMore) return;\n\n const root = cardsScrollRef.current;\n const sentinel = cardsSentinelRef.current;\n if (!root || !sentinel) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) cardsLoadMore();\n },\n { root, rootMargin: '300px' },\n );\n observer.observe(sentinel);\n\n return () => observer.disconnect();\n }, [isCardsView, cardsHasMore, cardsLoadMore, visibleRows.length]);\n\n const listScrollRef = useRef<HTMLDivElement | null>(null);\n const [detailSlotWidth, setDetailSlotWidth] = useState<number | undefined>(undefined);\n const [parentHasHorizontalOverflow, setParentHasHorizontalOverflow] = useState(false);\n\n // Track the list scrollport: its clientWidth sizes the detail panel to the\n // visible area (detailTable expansion), and its horizontal overflow toggles the\n // frozen actions-column shadow (shown only while columns scroll under it, so\n // there is no always-on divider line otherwise). Observing the inner table too\n // keeps both in sync when columns are toggled or the layout reflows. The\n // branch-state deps re-bind when the scroller remounts (view/skeleton/error/\n // empty transitions swap the rendered subtree).\n useEffect(() => {\n const scroller = listScrollRef.current;\n if (!scroller) return undefined;\n\n const measure = () => {\n setDetailSlotWidth(scroller.clientWidth || undefined);\n setParentHasHorizontalOverflow(scroller.scrollWidth > scroller.clientWidth + 1);\n };\n measure();\n\n const observer = new ResizeObserver(measure);\n observer.observe(scroller);\n const parentTable = scroller.querySelector('table');\n if (parentTable) observer.observe(parentTable);\n\n return () => observer.disconnect();\n }, [isCardsView, isDelegatedView, showSkeleton, error, hasRows]);\n\n const renderBody = () => {\n // Grouped view delegates the whole body to the host (it owns fetching,\n // accordions, loading and empty states for each group).\n if (isGroupedView && config.renderGroupedBody) return config.renderGroupedBody();\n if (isKanbanView && config.renderKanbanBody) return config.renderKanbanBody();\n\n if (showSkeleton)\n return isCardsView ? (\n <DataTableCardsSkeletonState cardClassName={config.cardSkeletonClassName} />\n ) : (\n <DataTableSkeletonState rows={config.skeletonRows} />\n );\n\n if (error) return <DataTableErrorState onRetry={onRetry} errorCause={errorCause} />;\n\n // A `bodyTopRow` (e.g. an inline create editor) must stay visible even with\n // zero data rows, so it takes precedence over the empty state.\n if (!hasRows && !bodyTopRow) {\n if (isFit) {\n // Embedded/editor context: skip the full illustration so surrounding\n // controls (e.g. the add-row button) stay visible in a compact dialog.\n return emptyMessage ? (\n <div className=\"py-6 text-center text-sm text-foreground-faint\">{emptyMessage}</div>\n ) : null;\n }\n return <DataTableEmptyState emptyMessage={emptyMessage} />;\n }\n\n if (isCardsView && config.renderCard) {\n // Cards render from the SAME visible rows the table uses (already searched,\n // filtered, sorted and paginated), so both views share one source. No grid:\n // flex-wrap keeps the layout responsive per the project's no-CSS-grid rule.\n return (\n <div ref={cardsScrollRef} className=\"relative min-h-0 flex-1 overflow-y-auto @container\">\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n {/* Cards têm largura fixa, então uma faixa estreita demais para duas colunas\n deixa a sobra toda de um lado. Abaixo disso eles se centram; a partir de\n duas colunas o alinhamento à esquerda volta a ser o que lê melhor. */}\n <div\n className={classNames(\n 'flex flex-wrap justify-center gap-4 @md:justify-start',\n dataTableOpacityTransitionClass,\n config.cardGridClassName,\n )}\n style={contentOpacityStyle}\n >\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <Fragment key={row.id}>{config.renderCard?.(row.original)}</Fragment>\n ))}\n </div>\n\n {cardsInfiniteScroll?.loadingMore && (\n <div className=\"flex justify-center py-4\">\n <LoadingSpinner size={6} />\n </div>\n )}\n\n {cardsHasMore && <div ref={cardsSentinelRef} className=\"h-px w-full\" aria-hidden />}\n </div>\n );\n }\n\n // Narrow viewport with no bespoke card renderer: stack each row into a card\n // derived from the same columns, so the list stays readable without the host\n // authoring a second renderer.\n if (useAutoCards) {\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\">\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <DataTableAutoCard key={row.id} row={row} columnConfigById={columnConfigById} />\n ))}\n </div>\n );\n }\n\n // The table scrolls inside this bounded region (flex-1 + min-h-0). The sticky\n // header pins to the top of the data area; the region also scrolls horizontally\n // so columns keep a minimum readable width instead of being crushed. The first\n // column and the actions column are frozen (sticky left/right) so navigation\n // anchors stay visible while the middle columns scroll past.\n return (\n <div\n ref={listScrollRef}\n onKeyDown={gridStore ? handleGridKeyDown : undefined}\n className={classNames(\n 'relative [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border-emphasis hover:[&::-webkit-scrollbar-thumb]:bg-foreground-faint [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:h-2.5 [&::-webkit-scrollbar]:w-2.5',\n // The rows scroll inside this bounded region (flex-1 + min-h-0), so the\n // host provides the height (a full page, or a bounded flex parent like a\n // fixed-size dialog) and the add-row/footer below stay pinned outside it.\n 'min-h-0 flex-1 overflow-auto',\n )}\n >\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n <table\n role={gridStore ? 'grid' : undefined}\n aria-multiselectable={gridStore && spreadsheet?.selection === 'range' ? true : undefined}\n className={classNames(\n // `table-fixed`: column widths come exclusively from the colgroup so\n // user resizes are honored exactly (under `table-auto` the browser\n // ignores explicit col widths and sizes by content). The slack\n // absorber (auto-width col) still soaks any leftover space.\n 'min-w-full table-fixed border-separate border-spacing-0 rounded-md border-y border-border-subtle',\n dataTableOpacityTransitionClass,\n )}\n style={{ ...contentOpacityStyle, width: totalTableWidth || undefined }}\n >\n <DataTableHead\n table={table}\n columns={config.columns}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n onHeaderSortClick={handleHeaderSortClick}\n resolveSortDirection={resolveSortDirection}\n hideColumnToggle={columnTogglePlacement !== 'header'}\n flexColumnId={flexColumnId}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n />\n\n <DataTableBody\n config={config}\n visibleRows={visibleRows}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n registerRow={registerRow}\n onCollapseStart={beginRowsExit}\n detailColumnsState={detailColumnsState}\n detailSlotWidth={detailSlotWidth}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n fillEnabled={!!spreadsheet?.fill}\n editMode={isEditMode}\n bodyTopRow={bodyTopRow}\n bodyTopRowColSpan={table.getVisibleLeafColumns().length}\n />\n </table>\n </div>\n );\n };\n\n // Cards normally page themselves through infinite scroll, so the pager is\n // hidden. When the narrow viewport takes the choice over, the host is still in\n // list mode and its `cardsInfiniteScroll` is not wired: without the pager the\n // user would be stranded on the first page.\n const isMobileCardsTakeover = isCardsView && viewMode !== 'cards' && !cardsInfiniteScroll;\n\n const showPagination =\n (!isCardsView || isMobileCardsTakeover) &&\n !isDelegatedView &&\n !!clientPaginationProps &&\n !showSkeleton &&\n !error &&\n hasRows &&\n clientPaginationProps.numberOfPages > 0 &&\n !(clientPaginationProps.numberOfPages === 1 && clientPaginationProps.pageSize <= DATA_TABLE_MIN_PAGE_SIZE);\n\n // The toolbar only skeletons on the very first load: a refetch (tab switch,\n // filter, search) keeps the real controls mounted, so the search term and the\n // focus survive and the row never changes height.\n const [hasLoadedOnce, setHasLoadedOnce] = useState(!loading);\n\n useEffect(() => {\n if (!loading) setHasLoadedOnce(true);\n }, [loading]);\n\n const showSearch = (!!onSearch || isClientMode) && config.searchable !== false;\n const showToolbar =\n (tabs?.length ?? 0) > 0 ||\n hasCardView ||\n showSearch ||\n !!toolbarSlot ||\n !!toolbarStartSlot ||\n columnTogglePlacement === 'toolbar';\n\n const columnToggleSlot =\n columnTogglePlacement === 'toolbar' ? (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n />\n ) : undefined;\n\n // O rodapé é o lugar dos controles da própria tabela (colunas e modo de edição),\n // ao lado da paginação. Ambos só existem sobre uma lista real.\n const showTableControls = !isCardsView && !isDelegatedView && !showSkeleton && !error && hasRows;\n const showFooterColumnToggle = columnTogglePlacement === 'footer' && showTableControls;\n const showFooterEditToggle = showEditModeToggle && showTableControls;\n\n // A edição em massa não depende do modo de exibição: em cards ela é a única\n // forma de editar, já que não existe célula para clicar.\n const showBulkEdit =\n hasEditableColumns && !!spreadsheet?.fill?.onFillCells && !isDelegatedView && !showSkeleton && !error && hasRows;\n const bulkEditRows = useMemo(\n () => visibleRows.filter((row) => row.depth === 0).map((row) => row.original),\n [visibleRows],\n );\n\n const activeFiltersBar =\n config.filters && filterValues && onFilterValuesChange ? (\n <ActiveFiltersBar\n fields={config.filters.fields ?? []}\n values={filterValues}\n onRemove={(key) =>\n onFilterValuesChange({\n ...filterValues,\n [key]: emptyValueForKind((config.filters?.fields ?? []).find((field) => field.key === key)?.kind ?? 'text'),\n })\n }\n onClearAll={() => onFilterValuesChange(buildEmptyFilterValues(config.filters?.fields ?? []))}\n />\n ) : null;\n\n const content = (\n <div\n className=\"flex min-h-0 w-full flex-1 flex-col gap-4\"\n onKeyDown={isUndoEnabled ? handleTableKeyDown : undefined}\n >\n {activeFiltersBar}\n {showToolbar && (\n <DataTableToolbar\n tabs={tabs}\n activeTab={activeTab}\n onTabChange={handleTabChange}\n showViewToggle={hasCardView && !hideViewToggle && !forceCardsOnMobile}\n showGroupedView={hasGroupedView}\n showKanbanView={hasKanbanView}\n viewMode={viewMode}\n onViewModeChange={handleViewModeChange}\n showSearch={showSearch}\n searchLabel={searchLabel}\n initialSearch={initialSearch}\n searchDisabled={searchDisabled}\n searchDebounceTime={isClientMode ? clientSearchDebounceMs : searchDebounceTime}\n searchMinLength={searchMinLength}\n searchAtStart={searchAtStart}\n onSearchInput={handleSearchInput}\n toolbarSlot={toolbarSlot}\n toolbarStartSlot={toolbarStartSlot}\n columnToggleSlot={columnToggleSlot}\n showSkeleton={loading && !hasLoadedOnce}\n />\n )}\n\n <div key={viewMode} className=\"flex min-h-0 flex-1 animate-fade-in flex-col\">\n {renderBody()}\n </div>\n\n {showAddRow && (\n // Sibling of the scrolling rows region, so it stays pinned below the grid\n // (outside its scroll) — the rows scroll, this control does not move.\n <div className=\"flex\">\n <ControlledButton\n variant=\"outlined\"\n className=\"flex items-center gap-1.5\"\n onClick={() => editingRows?.onAddRow?.()}\n >\n <MaterialSymbol icon=\"add\" size={16} />\n {t('dataTable.addRow')}\n </ControlledButton>\n </div>\n )}\n\n {(showFooterColumnToggle || showFooterEditToggle || showBulkEdit || showPagination) && (\n <div className=\"flex items-center justify-between gap-4\">\n {(showFooterColumnToggle || showFooterEditToggle || showBulkEdit) && (\n <div className=\"flex flex-wrap items-center gap-2 pb-3\">\n {showFooterColumnToggle && (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n />\n )}\n {showFooterEditToggle && <DataTableEditModeButton active={isEditMode} onToggle={handleEditModeToggle} />}\n {showBulkEdit && <DataTableBulkEditButton onClick={() => setIsBulkEditOpen(true)} />}\n </div>\n )}\n\n {showPagination && (\n <div className=\"flex-1\">\n <DataTablePaginationBar\n pageSize={clientPaginationProps.pageSize}\n numberOfPages={clientPaginationProps.numberOfPages}\n currentPage={clientPaginationProps.currentPage}\n setCurrentPage={clientPaginationProps.setCurrentPage}\n onPageSizeChange={clientPaginationProps.onPageSizeChange}\n totalItems={clientPaginationProps.totalItems}\n />\n </div>\n )}\n </div>\n )}\n\n {showBulkEdit && (\n <DataTableBulkEditDialog\n open={isBulkEditOpen}\n onClose={() => setIsBulkEditOpen(false)}\n columns={config.columns}\n rows={bulkEditRows}\n getRowLabel={config.getRowLabel}\n onApply={(changes) => spreadsheet?.fill?.onFillCells?.(changes)}\n />\n )}\n </div>\n );\n\n // Os providers ficam por fora do conteúdo já montado: abrir ou fechar uma célula re-renderiza\n // apenas as células editáveis, não a tabela inteira.\n const editableContent = config.editing?.clickToEdit ? (\n <DataTableCellEditingProvider>{content}</DataTableCellEditingProvider>\n ) : (\n content\n );\n\n if (!gridStore) return editableContent;\n\n return (\n <GridProvider store={gridStore} onFillCommit={handleFillCommit}>\n {editableContent}\n </GridProvider>\n );\n};\n\nex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B,oBAAC,yBAAA,EAAwB,SAAS,MAAM,kBAAkB,IAAI,EAAA,CAAG;AAAA,UAAA,GACpF;AAAA,UAGD,kBACC,oBAAC,OAAA,EAAI,WAAU,UACb,UAAA;AAAA,YAACA;AAAAA,YAAA;AAAA,cACC,UAAU,sBAAsB;AAAA,cAChC,eAAe,sBAAsB;AAAA,cACrC,aAAa,sBAAsB;AAAA,cACnC,gBAAgB,sBAAsB;AAAA,cACtC,kBAAkB,sBAAsB;AAAA,cACxC,YAAY,sBAAsB;AAAA,YAAA;AAAA,UAAA,EACpC,CACF;AAAA,QAAA,GAEJ;AAAA,QAGD,gBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAM;AAAA,YACN,SAAS,MAAM,kBAAkB,KAAK;AAAA,YACtC,SAAS,OAAO;AAAA,YAChB,MAAM;AAAA,YACN,aAAa,OAAO;AAAA,YACpB,SAAS,CAAC,YAAY,aAAa,MAAM,cAAc,OAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAChE;AAAA,IAAA;AAAA,EAAA;AAON,QAAM,kBAAkB,OAAO,SAAS,cACtC,oBAAC,8BAAA,EAA8B,mBAAQ,IAEvC;AAGF,MAAI,CAAC,UAAW,QAAO;AAEvB,6BACG,cAAA,EAAa,OAAO,WAAW,cAAc,kBAC3C,UAAA,iBACH;AAEJ;"}
1
+ {"version":3,"file":"DataTable.js","sources":["../../../../src/components/UI/DataTable/DataTable.tsx"],"sourcesContent":["import { Fragment, JSX, KeyboardEvent, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\nimport ControlledButton from '@/components/Form/ControlledButton';\nimport { ActiveFiltersBar, buildEmptyFilterValues, emptyValueForKind } from '@/components/Search/filters';\nimport LoadingSpinner from '@/components/UI/LoadingSpinner';\nimport { MaterialSymbol } from '@/components/UI/MaterialSymbol';\nimport { useBreakpoint } from '@/hooks/useBreakpoint';\n\nimport GridProvider from './grid/GridProvider';\nimport { type IGridCellCoord } from './grid/gridTypes';\nimport { useGridFillApply } from './grid/useGridFillApply';\nimport { useGridEditMode, useGridInstance, useGridMatrixSync } from './grid/useGridInstance';\nimport { useGridKeyboard } from './grid/useGridKeyboard';\nimport DataTableAutoCard from './DataTableAutoCard';\nimport DataTableBody from './DataTableBody';\nimport DataTableBulkEditButton from './DataTableBulkEditButton';\nimport DataTableBulkEditDialog from './DataTableBulkEditDialog';\nimport { isBadgeColumnType } from './dataTableClasses';\nimport DataTableColumnToggle from './DataTableColumnToggle';\nimport { type IDataTableDetailColumnsState } from './DataTableDetailTable';\nimport DataTableEditModeButton from './DataTableEditModeButton';\nimport DataTableHead from './DataTableHead';\nimport DataTablePaginationBar, { DATA_TABLE_MIN_PAGE_SIZE } from './DataTablePagination';\nimport {\n DataTableCardsSkeletonState,\n DataTableEmptyState,\n DataTableErrorState,\n DataTableSkeletonState,\n} from './DataTableStates';\nimport DataTableToolbar from './DataTableToolbar';\nimport {\n DATA_TABLE_REMOVE_COLUMN_ID,\n type IDataTableColumnConfig,\n type IDataTableConfig,\n type IDataTableRow,\n type IDataTableSortState,\n type IDataTableSpreadsheetConfig,\n isDataTableDetailTableExpansion,\n type TDataTableFilterValues,\n type TDataTableViewMode,\n} from './types';\nimport DataTableCellEditingProvider from './useCellEditingState';\nimport { useColumnOrder, useDetailColumnOrder } from './useColumnOrder';\nimport { useColumnSizing } from './useColumnSizing';\nimport { useColumnVisibility, useDetailColumnVisibility } from './useColumnVisibility';\nimport {\n type IDataTableClientPaginationState,\n type IDataTablePagination,\n useDataTableInstance,\n} from './useDataTableInstance';\nimport { useDataTableUndoHistory } from './useDataTableUndoHistory';\n\ninterface IDataTableProps<T extends IDataTableRow, C extends IDataTableRow = IDataTableRow> {\n config: IDataTableConfig<T, C>;\n rows: Array<T>;\n loading?: boolean;\n error?: boolean;\n /** Cause behind `error`, so the empty state can name a denial instead of a system failure. */\n errorCause?: unknown;\n onRetry?: () => void;\n emptyMessage?: string;\n searchLabel?: string;\n onSearch?: (value: string) => void;\n initialSearch?: string;\n onSearchTermChange?: (value: string) => void;\n searchDisabled?: boolean;\n searchDebounceTime?: number;\n searchMinLength?: number;\n /** Renders the search input in the toolbar's start (left) group instead of the end. */\n searchAtStart?: boolean;\n sort?: IDataTableSortState | null;\n onSortChange?: (sort: IDataTableSortState | null) => void;\n pagination?: IDataTablePagination;\n /** Client mode: seeds page/pageSize (1-based page), e.g. from the URL. */\n initialClientPagination?: IDataTableClientPaginationState;\n /** Client mode: reports page/pageSize changes and keeps the page across in-place row updates. */\n onClientPaginationChange?: (pagination: IDataTableClientPaginationState) => void;\n toolbarSlot?: JSX.Element;\n /**\n * Extra controls rendered in the footer's left group, right after the table's\n * own buttons (columns, edit mode, bulk edit). For an action that belongs to\n * the list itself rather than to the page header, so it sits beside the\n * controls it relates to instead of competing with the page actions. The\n * footer row renders for this slot alone when the table has no other control.\n */\n footerActionsSlot?: ReactNode;\n /**\n * Applied filter values. Passing them (together with `config.filters`) makes\n * the table render the always-visible active-filter chips above the toolbar,\n * so the user never has to hover the button to see what is filtering.\n */\n filterValues?: TDataTableFilterValues;\n onFilterValuesChange?: (values: TDataTableFilterValues) => void;\n /** Rendered at the start (left) of the toolbar, before tabs and view toggle. */\n toolbarStartSlot?: JSX.Element;\n /**\n * Full-width band rendered as the first row of the list body, spanning every\n * column (below the header, above the data rows). Opt-in: omit for a normal\n * table. When set, the empty state is skipped so the band stays visible even\n * with zero data rows (e.g. an inline \"create the first record\" editor).\n */\n bodyTopRow?: ReactNode;\n /** Client mode: reports the filtered (post-search) row count on every change. */\n onFilteredCountChange?: (count: number) => void;\n /**\n * Controlled view mode. When provided, the host owns the state (e.g. to persist\n * it) and must update it via `onViewModeChange`; omit for internal state.\n */\n viewMode?: TDataTableViewMode;\n /**\n * Fired on every view-toggle click, including re-selecting the active mode\n * (hosts use it e.g. to reopen the grouping dialog).\n */\n onViewModeChange?: (mode: TDataTableViewMode) => void;\n /**\n * Where the \"Columns\" toggle renders: `header` (default, inside the table\n * header), `toolbar` (next to the view toggle) or `footer` (bottom-left,\n * on the same row as the pagination).\n */\n columnTogglePlacement?: 'header' | 'toolbar' | 'footer';\n /**\n * Enables infinite scroll in the Cards view: the table observes a bottom\n * sentinel and calls `loadMore` while `hasMore`. Pass `source.cardsInfinite`\n * from `useDataTableSource`. The Lista view keeps its pagination bar.\n */\n cardsInfiniteScroll?: {\n hasMore: boolean;\n loadingMore: boolean;\n loadMore: () => void;\n };\n /**\n * Hides the built-in segmented view toggle. Use when the host renders its own\n * Cards/Lista switcher (e.g. a page-level `ControlledTabs`) and drives `viewMode`\n * itself. Other consumers keep the default toggle.\n */\n hideViewToggle?: boolean;\n /**\n * Layout mode. `page` (default): the table owns a bounded, vertically-scrolling\n * region (`flex-1 min-h-0`) for full-page lists. `fit`: the table sizes to its\n * content and scrolls only horizontally — for embedding inside a dialog / card /\n * editor grid where the host container owns vertical scroll. In `fit` mode the\n * empty state is compact (no full illustration) so surrounding controls such as\n * the add-row button stay visible.\n */\n layout?: 'page' | 'fit';\n /** Reduces cell vertical padding for more visible rows per viewport. */\n dense?: boolean;\n /** Roomier cell padding and type scale, for tables that need to read bigger. */\n spacious?: boolean;\n /**\n * Per-cell persistence state (`statuses` from `useDataTableCommitQueue`), painted\n * on the cells so the user sees what is saving and what failed.\n */\n commitStatuses?: ReadonlyMap<string, string>;\n}\n\nconst DataTable = <T extends IDataTableRow, C extends IDataTableRow = IDataTableRow>({\n config: configProp,\n rows,\n loading = false,\n error = false,\n errorCause,\n onRetry,\n emptyMessage,\n searchLabel,\n onSearch,\n initialSearch = '',\n onSearchTermChange,\n searchDisabled = false,\n searchDebounceTime = 400,\n searchMinLength = 1,\n searchAtStart = false,\n sort,\n onSortChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n toolbarSlot,\n footerActionsSlot,\n filterValues,\n onFilterValuesChange,\n toolbarStartSlot,\n bodyTopRow,\n onFilteredCountChange,\n viewMode: controlledViewMode,\n onViewModeChange,\n columnTogglePlacement = 'header',\n cardsInfiniteScroll,\n hideViewToggle = false,\n layout = 'page',\n dense: denseProp = false,\n spacious = false,\n commitStatuses,\n}: IDataTableProps<T, C>) => {\n const { t } = useTranslation('ui');\n\n const isFit = layout === 'fit';\n const dense = !spacious && (isFit || denseProp);\n const editingRows = configProp.editing?.rows;\n const showAddRow = !!editingRows?.canAdd && !!editingRows.onAddRow;\n\n const hostFillCells = configProp.spreadsheet ? configProp.spreadsheet.fill?.onFillCells : undefined;\n const isUndoEnabled = !!configProp.editing?.onCellChange && configProp.editing.undo !== false;\n const { recordedOnCellChange, recordedOnFillCells, handleUndoShortcut } = useDataTableUndoHistory<T>({\n enabled: isUndoEnabled,\n rows,\n columns: configProp.columns,\n onCellChange: configProp.editing?.onCellChange,\n onFillCells: hostFillCells,\n });\n\n const configWithUndo = useMemo<IDataTableConfig<T, C>>(() => {\n if (!isUndoEnabled || !configProp.editing) return configProp;\n\n const spreadsheetConfig = configProp.spreadsheet;\n return {\n ...configProp,\n editing: { ...configProp.editing, onCellChange: recordedOnCellChange },\n spreadsheet:\n spreadsheetConfig && spreadsheetConfig.fill?.onFillCells\n ? { ...spreadsheetConfig, fill: { ...spreadsheetConfig.fill, onFillCells: recordedOnFillCells } }\n : spreadsheetConfig,\n };\n }, [configProp, isUndoEnabled, recordedOnCellChange, recordedOnFillCells]);\n\n // When `editing.rows.onRemoveRow` is set, append a synthetic trailing actions\n // column carrying a per-row delete control. It is a real `actions` column, so\n // it flows through the existing sizing / sticky-right / flex-exclusion / order\n // paths unchanged (see useColumnOrder: actions columns are pinned to the end).\n const config = useMemo<IDataTableConfig<T, C>>(() => {\n if (!editingRows?.onRemoveRow) return configWithUndo;\n\n const removeColumn: IDataTableColumnConfig<T> = {\n id: DATA_TABLE_REMOVE_COLUMN_ID,\n header: '',\n type: 'actions',\n hideable: false,\n resizable: false,\n actions: [\n {\n key: 'remove',\n label: t('dataTable.removeRow'),\n icon: 'delete',\n danger: true,\n hidden: (row) => (editingRows.canRemove ? !editingRows.canRemove(row) : false),\n onClick: (row) => editingRows.onRemoveRow?.(row),\n },\n ],\n };\n\n return { ...configWithUndo, columns: [...configWithUndo.columns, removeColumn] };\n }, [configWithUndo, editingRows, t]);\n\n const { columnVisibility, onColumnVisibilityChange } = useColumnVisibility(config);\n const { columnOrder, onColumnOrderChange, resetColumnOrder } = useColumnOrder(config);\n const { columnSizing, onColumnSizingChange, resetColumnSizing } = useColumnSizing(config);\n\n // Every table restores the persisted column order back to the config default\n // on mount (equivalent to firing \"Restaurar ordem padrão\" from the columns\n // menu), so a stale/incompatible persisted order never sticks. Does not touch\n // column widths or visibility, and does not affect the Cards view.\n useEffect(() => {\n resetColumnOrder();\n }, []);\n\n const detailExpansionColumns =\n config.expansion && isDataTableDetailTableExpansion(config.expansion) && Array.isArray(config.expansion.columns)\n ? config.expansion.columns\n : null;\n const { detailColumnVisibility, toggleDetailColumn } = useDetailColumnVisibility(\n config.entityKey,\n detailExpansionColumns,\n );\n const { detailColumnOrder, onDetailColumnOrderChange, resetDetailColumnOrder } = useDetailColumnOrder(\n config.entityKey,\n detailExpansionColumns,\n );\n\n const detailColumnsState: IDataTableDetailColumnsState | undefined = detailExpansionColumns\n ? {\n visibility: detailColumnVisibility,\n toggleVisibility: toggleDetailColumn,\n order: detailColumnOrder,\n onOrderChange: onDetailColumnOrderChange,\n resetOrder: resetDetailColumnOrder,\n }\n : undefined;\n\n const { isMobile } = useBreakpoint();\n\n const hasCardView = !!config.renderCard;\n const hasGroupedView = !!config.renderGroupedBody;\n const hasKanbanView = !!config.renderKanbanBody;\n // Fixed behaviour: card-capable tables always open on Cards (first), Lista second.\n // The toggle switches within the session and resets to Cards on remount, unless\n // the host controls the mode via the `viewMode` prop (e.g. persisted preference).\n const [internalViewMode, setInternalViewMode] = useState<TDataTableViewMode>('cards');\n const viewMode = controlledViewMode ?? internalViewMode;\n\n const [isBulkEditOpen, setIsBulkEditOpen] = useState(false);\n\n const handleViewModeChange = (mode: TDataTableViewMode) => {\n if (controlledViewMode === undefined) setInternalViewMode(mode);\n onViewModeChange?.(mode);\n };\n\n const {\n table,\n isClientMode,\n columnContentWidths,\n registerRow,\n beginRowsExit,\n visibleRows,\n activeTab,\n tabs,\n handleTabChange,\n handleSearchInput,\n handleHeaderSortClick,\n resolveSortDirection,\n clientPaginationProps,\n showUpdatingBar,\n contentOpacityStyle,\n dataTableOpacityTransitionClass,\n showSkeleton,\n hasRows,\n clientSearchDebounceMs,\n } = useDataTableInstance({\n config,\n rows,\n loading,\n sort,\n onSortChange,\n onSearch,\n initialSearch,\n onSearchTermChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n columnSizing,\n onColumnSizingChange,\n onFilteredCountChange,\n });\n\n const columnConfigById = useMemo(\n () => new Map(config.columns.map((columnConfig) => [columnConfig.id, columnConfig])),\n [config.columns],\n );\n\n // Under `table-fixed` one column absorbs leftover horizontal space. The last\n // visible non-actions, non-badge, non-first column is the flex column.\n const visibleLeafColumns = table.getVisibleLeafColumns();\n const flexColumnId = useMemo(() => {\n if (config.flexColumnId && visibleLeafColumns.some((leafColumn) => leafColumn.id === config.flexColumnId)) {\n return config.flexColumnId;\n }\n\n const candidates = visibleLeafColumns.filter((leafColumn, index) => {\n if (index === 0) return false;\n const type = columnConfigById.get(leafColumn.id)?.type;\n return type !== 'actions' && !isBadgeColumnType(type);\n });\n return candidates[candidates.length - 1]?.id ?? null;\n }, [visibleLeafColumns, columnConfigById, config.flexColumnId]);\n\n // `table-fixed` sizes columns from the table width, so the table must be at\n // least the sum of ALL column widths (including the absorber's seed) for their\n // widths to be honored; below that the browser shrinks them proportionally.\n // `min-w-full` still lets the table stretch to fill the container, and the\n // auto-width absorber soaks the surplus (never shrinking below its own seed,\n // because its seed is part of this total).\n const totalTableWidth = useMemo(\n () => visibleLeafColumns.reduce((sum, leafColumn) => sum + leafColumn.getSize(), 0),\n [visibleLeafColumns, columnSizing],\n );\n\n // ----- Spreadsheet layer -----\n // Toda tabela com coluna editável ganha a camada de planilha sem configuração.\n // O que muda por tabela é QUANDO ela fica ativa: onde o clique na linha já\n // significa \"abrir o registro\", selecionar célula e navegar seriam o mesmo\n // gesto, então o usuário liga o modo no toolbar antes de editar.\n const spreadsheet = useMemo<IDataTableSpreadsheetConfig<T> | undefined>(() => {\n if (config.spreadsheet === false) return undefined;\n return config.spreadsheet ?? { selection: 'range', fill: {} };\n }, [config.spreadsheet]);\n\n const hasEditableColumns = useMemo(\n () => !!config.editing?.onCellChange && config.columns.some((columnConfig) => !!columnConfig.editable),\n [config.editing, config.columns],\n );\n\n const editModeBehavior = spreadsheet?.mode ?? (config.onRowClick ? 'toggle' : 'always');\n const gridEnabled = !!spreadsheet && (hasEditableColumns || !!config.spreadsheet);\n\n const gridStore = useGridInstance({\n spreadsheet,\n enabled: gridEnabled,\n startsInEditMode: editModeBehavior === 'always',\n });\n\n const isEditMode = useGridEditMode(gridStore);\n const showEditModeToggle = gridEnabled && editModeBehavior === 'toggle';\n\n // Below the tablet edge a real table is unreadable: even the narrowest column\n // set overflows and the user reads it through a horizontal scrollbar. Cards are\n // the readable shape there, so the narrow viewport takes over the choice.\n // Excluded: `fit` layouts without a bespoke card (their cell geometry IS the\n // feature) and the spreadsheet grid while it is ACTIVE. Merely being able to edit\n // is not enough: a table whose edit mode is a toggle stays a reading surface\n // until the user turns it on. A `fit` table that ships `renderCard` opted into a\n // narrow shape, so it takes over as well.\n const forceCardsOnMobile = isMobile && (!isFit || hasCardView) && !isEditMode;\n\n const isGroupedView = hasGroupedView && viewMode === 'grouped';\n const isKanbanView = hasKanbanView && viewMode === 'kanban';\n // Grouped and kanban both hand the whole body to the host, so everything the\n // table draws around a real row list is off in either of them.\n const isDelegatedView = isGroupedView || isKanbanView;\n const isCardsView = hasCardView && (viewMode === 'cards' || (forceCardsOnMobile && !isDelegatedView));\n const useAutoCards = forceCardsOnMobile && !hasCardView && !isDelegatedView;\n\n useEffect(() => {\n if (!gridStore || !commitStatuses) return;\n gridStore.getState().setCellStatuses(commitStatuses);\n }, [gridStore, commitStatuses]);\n\n const navigableColumnIds = useMemo(\n () =>\n visibleLeafColumns\n .filter((leafColumn) => columnConfigById.get(leafColumn.id)?.type !== 'actions')\n .map((leafColumn) => leafColumn.id),\n [visibleLeafColumns, columnConfigById],\n );\n const gridRowIds = useMemo(() => visibleRows.map((row) => row.id), [visibleRows]);\n\n useGridMatrixSync(gridStore, gridRowIds, navigableColumnIds);\n\n // Read through a ref so the callback stays stable while the rows change on\n // every edit: an unstable handler would re-bind the grid keyboard each render.\n const visibleRowsRef = useRef(visibleRows);\n visibleRowsRef.current = visibleRows;\n\n const canEditCell = useCallback(\n ({ rowId, columnId }: IGridCellCoord) => {\n if (!config.editing?.onCellChange) return false;\n\n const editable = columnConfigById.get(columnId)?.editable;\n if (!editable) return false;\n\n const row = visibleRowsRef.current.find((candidate) => candidate.id === rowId);\n if (!row) return false;\n\n return !(editable.disabled?.(row.original) ?? false);\n },\n [config.editing, columnConfigById],\n );\n\n const handleGridKeyDown = useGridKeyboard({\n store: gridStore,\n canEditCell,\n onSave: spreadsheet?.onSave,\n });\n\n const handleFillCommit = useGridFillApply<T>({\n visibleRows,\n columnConfigById,\n spreadsheet,\n onCellChange: config.editing?.onCellChange,\n });\n\n // After an undo in the spreadsheet grid the restored cell becomes the active one, so\n // the user sees which cell changed, even when it sits on another row of the page.\n const handleTableKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const restoredCell = handleUndoShortcut(event);\n if (!restoredCell || !gridStore || !gridStore.getState().isEditMode) return;\n\n const restoredGridRow = visibleRowsRef.current.find((candidate) => candidate.original.id === restoredCell.row.id);\n if (!restoredGridRow) return;\n gridStore.getState().setActiveCell({ rowId: restoredGridRow.id, columnId: restoredCell.columnId });\n },\n [handleUndoShortcut, gridStore],\n );\n\n const handleEditModeToggle = useCallback(() => {\n const store = gridStore;\n if (!store) return;\n store.getState().setEditMode(!store.getState().isEditMode);\n }, [gridStore]);\n\n const cardsScrollRef = useRef<HTMLDivElement | null>(null);\n const cardsSentinelRef = useRef<HTMLDivElement | null>(null);\n const cardsLoadMore = cardsInfiniteScroll?.loadMore;\n const cardsHasMore = cardsInfiniteScroll?.hasMore ?? false;\n\n // Cards infinite scroll: load the next page when the bottom sentinel enters the\n // cards scroll container. `loadMore` is stable and self-guards while a page is\n // in flight; re-running on row count keeps the observer bound after each append.\n useEffect(() => {\n if (!isCardsView || !cardsHasMore || !cardsLoadMore) return;\n\n const root = cardsScrollRef.current;\n const sentinel = cardsSentinelRef.current;\n if (!root || !sentinel) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) cardsLoadMore();\n },\n { root, rootMargin: '300px' },\n );\n observer.observe(sentinel);\n\n return () => observer.disconnect();\n }, [isCardsView, cardsHasMore, cardsLoadMore, visibleRows.length]);\n\n const listScrollRef = useRef<HTMLDivElement | null>(null);\n const [detailSlotWidth, setDetailSlotWidth] = useState<number | undefined>(undefined);\n const [parentHasHorizontalOverflow, setParentHasHorizontalOverflow] = useState(false);\n\n // Track the list scrollport: its clientWidth sizes the detail panel to the\n // visible area (detailTable expansion), and its horizontal overflow toggles the\n // frozen actions-column shadow (shown only while columns scroll under it, so\n // there is no always-on divider line otherwise). Observing the inner table too\n // keeps both in sync when columns are toggled or the layout reflows. The\n // branch-state deps re-bind when the scroller remounts (view/skeleton/error/\n // empty transitions swap the rendered subtree).\n useEffect(() => {\n const scroller = listScrollRef.current;\n if (!scroller) return undefined;\n\n const measure = () => {\n setDetailSlotWidth(scroller.clientWidth || undefined);\n setParentHasHorizontalOverflow(scroller.scrollWidth > scroller.clientWidth + 1);\n };\n measure();\n\n const observer = new ResizeObserver(measure);\n observer.observe(scroller);\n const parentTable = scroller.querySelector('table');\n if (parentTable) observer.observe(parentTable);\n\n return () => observer.disconnect();\n }, [isCardsView, isDelegatedView, showSkeleton, error, hasRows]);\n\n const renderBody = () => {\n // Grouped view delegates the whole body to the host (it owns fetching,\n // accordions, loading and empty states for each group).\n if (isGroupedView && config.renderGroupedBody) return config.renderGroupedBody();\n if (isKanbanView && config.renderKanbanBody) return config.renderKanbanBody();\n\n if (showSkeleton)\n return isCardsView ? (\n <DataTableCardsSkeletonState cardClassName={config.cardSkeletonClassName} />\n ) : (\n <DataTableSkeletonState rows={config.skeletonRows} />\n );\n\n if (error) return <DataTableErrorState onRetry={onRetry} errorCause={errorCause} />;\n\n // A `bodyTopRow` (e.g. an inline create editor) must stay visible even with\n // zero data rows, so it takes precedence over the empty state.\n if (!hasRows && !bodyTopRow) {\n if (isFit) {\n // Embedded/editor context: skip the full illustration so surrounding\n // controls (e.g. the add-row button) stay visible in a compact dialog.\n return emptyMessage ? (\n <div className=\"py-6 text-center text-sm text-foreground-faint\">{emptyMessage}</div>\n ) : null;\n }\n return <DataTableEmptyState emptyMessage={emptyMessage} />;\n }\n\n if (isCardsView && config.renderCard) {\n // Cards render from the SAME visible rows the table uses (already searched,\n // filtered, sorted and paginated), so both views share one source. No grid:\n // flex-wrap keeps the layout responsive per the project's no-CSS-grid rule.\n return (\n <div ref={cardsScrollRef} className=\"relative min-h-0 flex-1 overflow-y-auto @container\">\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n {/* Cards têm largura fixa, então uma faixa estreita demais para duas colunas\n deixa a sobra toda de um lado. Abaixo disso eles se centram; a partir de\n duas colunas o alinhamento à esquerda volta a ser o que lê melhor. */}\n <div\n className={classNames(\n 'flex flex-wrap justify-center gap-4 @md:justify-start',\n dataTableOpacityTransitionClass,\n config.cardGridClassName,\n )}\n style={contentOpacityStyle}\n >\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <Fragment key={row.id}>{config.renderCard?.(row.original)}</Fragment>\n ))}\n </div>\n\n {cardsInfiniteScroll?.loadingMore && (\n <div className=\"flex justify-center py-4\">\n <LoadingSpinner size={6} />\n </div>\n )}\n\n {cardsHasMore && <div ref={cardsSentinelRef} className=\"h-px w-full\" aria-hidden />}\n </div>\n );\n }\n\n // Narrow viewport with no bespoke card renderer: stack each row into a card\n // derived from the same columns, so the list stays readable without the host\n // authoring a second renderer.\n if (useAutoCards) {\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\">\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <DataTableAutoCard key={row.id} row={row} columnConfigById={columnConfigById} />\n ))}\n </div>\n );\n }\n\n // The table scrolls inside this bounded region (flex-1 + min-h-0). The sticky\n // header pins to the top of the data area; the region also scrolls horizontally\n // so columns keep a minimum readable width instead of being crushed. The first\n // column and the actions column are frozen (sticky left/right) so navigation\n // anchors stay visible while the middle columns scroll past.\n return (\n <div\n ref={listScrollRef}\n onKeyDown={gridStore ? handleGridKeyDown : undefined}\n className={classNames(\n 'relative [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border-emphasis hover:[&::-webkit-scrollbar-thumb]:bg-foreground-faint [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:h-2.5 [&::-webkit-scrollbar]:w-2.5',\n // The rows scroll inside this bounded region (flex-1 + min-h-0), so the\n // host provides the height (a full page, or a bounded flex parent like a\n // fixed-size dialog) and the add-row/footer below stay pinned outside it.\n 'min-h-0 flex-1 overflow-auto',\n )}\n >\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n <table\n role={gridStore ? 'grid' : undefined}\n aria-multiselectable={gridStore && spreadsheet?.selection === 'range' ? true : undefined}\n className={classNames(\n // `table-fixed`: column widths come exclusively from the colgroup so\n // user resizes are honored exactly (under `table-auto` the browser\n // ignores explicit col widths and sizes by content). The slack\n // absorber (auto-width col) still soaks any leftover space.\n 'min-w-full table-fixed border-separate border-spacing-0 rounded-md border-y border-border-subtle',\n dataTableOpacityTransitionClass,\n )}\n style={{ ...contentOpacityStyle, width: totalTableWidth || undefined }}\n >\n <DataTableHead\n table={table}\n columns={config.columns}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n onHeaderSortClick={handleHeaderSortClick}\n resolveSortDirection={resolveSortDirection}\n hideColumnToggle={columnTogglePlacement !== 'header'}\n flexColumnId={flexColumnId}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n />\n\n <DataTableBody\n config={config}\n visibleRows={visibleRows}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n registerRow={registerRow}\n onCollapseStart={beginRowsExit}\n detailColumnsState={detailColumnsState}\n detailSlotWidth={detailSlotWidth}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n fillEnabled={!!spreadsheet?.fill}\n editMode={isEditMode}\n bodyTopRow={bodyTopRow}\n bodyTopRowColSpan={table.getVisibleLeafColumns().length}\n />\n </table>\n </div>\n );\n };\n\n // Cards normally page themselves through infinite scroll, so the pager is\n // hidden. When the narrow viewport takes the choice over, the host is still in\n // list mode and its `cardsInfiniteScroll` is not wired: without the pager the\n // user would be stranded on the first page.\n const isMobileCardsTakeover = isCardsView && viewMode !== 'cards' && !cardsInfiniteScroll;\n\n const showPagination =\n (!isCardsView || isMobileCardsTakeover) &&\n !isDelegatedView &&\n !!clientPaginationProps &&\n !showSkeleton &&\n !error &&\n hasRows &&\n clientPaginationProps.numberOfPages > 0 &&\n !(clientPaginationProps.numberOfPages === 1 && clientPaginationProps.pageSize <= DATA_TABLE_MIN_PAGE_SIZE);\n\n // The toolbar only skeletons on the very first load: a refetch (tab switch,\n // filter, search) keeps the real controls mounted, so the search term and the\n // focus survive and the row never changes height.\n const [hasLoadedOnce, setHasLoadedOnce] = useState(!loading);\n\n useEffect(() => {\n if (!loading) setHasLoadedOnce(true);\n }, [loading]);\n\n const showSearch = (!!onSearch || isClientMode) && config.searchable !== false;\n const showToolbar =\n (tabs?.length ?? 0) > 0 ||\n hasCardView ||\n showSearch ||\n !!toolbarSlot ||\n !!toolbarStartSlot ||\n columnTogglePlacement === 'toolbar';\n\n const columnToggleSlot =\n columnTogglePlacement === 'toolbar' ? (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n />\n ) : undefined;\n\n // O rodapé é o lugar dos controles da própria tabela (colunas e modo de edição),\n // ao lado da paginação. Ambos só existem sobre uma lista real.\n const showTableControls = !isCardsView && !isDelegatedView && !showSkeleton && !error && hasRows;\n const showFooterColumnToggle = columnTogglePlacement === 'footer' && showTableControls;\n const showFooterEditToggle = showEditModeToggle && showTableControls;\n\n // A edição em massa não depende do modo de exibição: em cards ela é a única\n // forma de editar, já que não existe célula para clicar.\n const showBulkEdit =\n hasEditableColumns && !!spreadsheet?.fill?.onFillCells && !isDelegatedView && !showSkeleton && !error && hasRows;\n\n const showFooterControls = showFooterColumnToggle || showFooterEditToggle || showBulkEdit || !!footerActionsSlot;\n const bulkEditRows = useMemo(\n () => visibleRows.filter((row) => row.depth === 0).map((row) => row.original),\n [visibleRows],\n );\n\n const activeFiltersBar =\n config.filters && filterValues && onFilterValuesChange ? (\n <ActiveFiltersBar\n fields={config.filters.fields ?? []}\n values={filterValues}\n onRemove={(key) =>\n onFilterValuesChange({\n ...filterValues,\n [key]: emptyValueForKind((config.filters?.fields ?? []).find((field) => field.key === key)?.kind ?? 'text'),\n })\n }\n onClearAll={() => onFilterValuesChange(buildEmptyFilterValues(config.filters?.fields ?? []))}\n />\n ) : null;\n\n const content = (\n <div\n className=\"flex min-h-0 w-full flex-1 flex-col gap-4\"\n onKeyDown={isUndoEnabled ? handleTableKeyDown : undefined}\n >\n {activeFiltersBar}\n {showToolbar && (\n <DataTableToolbar\n tabs={tabs}\n activeTab={activeTab}\n onTabChange={handleTabChange}\n showViewToggle={hasCardView && !hideViewToggle && !forceCardsOnMobile}\n showGroupedView={hasGroupedView}\n showKanbanView={hasKanbanView}\n viewMode={viewMode}\n onViewModeChange={handleViewModeChange}\n showSearch={showSearch}\n searchLabel={searchLabel}\n initialSearch={initialSearch}\n searchDisabled={searchDisabled}\n searchDebounceTime={isClientMode ? clientSearchDebounceMs : searchDebounceTime}\n searchMinLength={searchMinLength}\n searchAtStart={searchAtStart}\n onSearchInput={handleSearchInput}\n toolbarSlot={toolbarSlot}\n toolbarStartSlot={toolbarStartSlot}\n columnToggleSlot={columnToggleSlot}\n showSkeleton={loading && !hasLoadedOnce}\n />\n )}\n\n <div key={viewMode} className=\"flex min-h-0 flex-1 animate-fade-in flex-col\">\n {renderBody()}\n </div>\n\n {showAddRow && (\n // Sibling of the scrolling rows region, so it stays pinned below the grid\n // (outside its scroll) — the rows scroll, this control does not move.\n <div className=\"flex\">\n <ControlledButton\n variant=\"outlined\"\n className=\"flex items-center gap-1.5\"\n onClick={() => editingRows?.onAddRow?.()}\n >\n <MaterialSymbol icon=\"add\" size={16} />\n {t('dataTable.addRow')}\n </ControlledButton>\n </div>\n )}\n\n {(showFooterControls || showPagination) && (\n <div className=\"flex items-center justify-between gap-4\">\n {showFooterControls && (\n <div className=\"flex flex-wrap items-center gap-2 pb-3\">\n {showFooterColumnToggle && (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n />\n )}\n {showFooterEditToggle && <DataTableEditModeButton active={isEditMode} onToggle={handleEditModeToggle} />}\n {showBulkEdit && <DataTableBulkEditButton onClick={() => setIsBulkEditOpen(true)} />}\n {footerActionsSlot}\n </div>\n )}\n\n {showPagination && (\n <div className=\"flex-1\">\n <DataTablePaginationBar\n pageSize={clientPaginationProps.pageSize}\n numberOfPages={clientPaginationProps.numberOfPages}\n currentPage={clientPaginationProps.currentPage}\n setCurrentPage={clientPaginationProps.setCurrentPage}\n onPageSizeChange={clientPaginationProps.onPageSizeChange}\n totalItems={clientPaginationProps.totalItems}\n />\n </div>\n )}\n </div>\n )}\n\n {showBulkEdit && (\n <DataTableBulkEditDialog\n open={isBulkEditOpen}\n onClose={() => setIsBulkEditOpen(false)}\n columns={config.columns}\n rows={bulkEditRows}\n getRowLabel={config.getRowLabel}\n onApply={(changes) => spreadsheet?.fill?.onFillCells?.(changes)}\n />\n )}\n </div>\n );\n\n // Os providers ficam por fora do conteúdo já montado: abrir ou fechar uma célula re-renderiza\n // apenas as células editáveis, não a tabela inteira.\n const editableContent = config.editing?.clickToEdit ? (\n <DataTableCellEditingProvider>{content}</DataTableCellEditingProvider>\n ) : (\n content\n );\n\n if (!gridStore) return editableContent;\n\n return (\n <GridProvider store={gridStore} onFillCommit={handleFillCommit}>\n {editableContent}\n </GridProvider>\n );\n};\n\nexport default DataTable;\n"],"names":["DataTablePaginationBar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8JA,MAAM,YAAY,CAAmE;AAAA,EACnF,QAAQ;AAAA,EACR;AAAA,EACA,UAAU;AAAA,EACV,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,wBAAwB;AAAA,EACxB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,MAAM;AAAA,YACN,aAAa,OAAO;AAAA,YACpB,SAAS,CAAC,YAAY,aAAa,MAAM,cAAc,OAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAChE;AAAA,IAAA;AAAA,EAAA;AAON,QAAM,kBAAkB,OAAO,SAAS,cACtC,oBAAC,8BAAA,EAA8B,mBAAQ,IAEvC;AAGF,MAAI,CAAC,UAAW,QAAO;AAEvB,6BACG,cAAA,EAAa,OAAO,WAAW,cAAc,kBAC3C,UAAA,iBACH;AAEJ;"}
@@ -0,0 +1,9 @@
1
+ export type TIconFontState = 'loading' | 'ready' | 'unavailable';
2
+ export declare const ICON_FONT_FAMILY = "Material Symbols Outlined";
3
+ /**
4
+ * Starts the icon font download at boot and mirrors its state on `<html data-icon-font>`.
5
+ * base.css hides the ligature text while the state is `loading` or `unavailable`, so a
6
+ * blocked or failed font leaves empty glyph boxes instead of icon names spread over the
7
+ * layout. Resolves to null when there is no DOM or the host registered no icon face.
8
+ */
9
+ export declare const watchIconFont: () => Promise<TIconFontState | null>;
@@ -0,0 +1,37 @@
1
+ import { uiLogger } from "./uiLogger.js";
2
+ const ICON_FONT_FAMILY = "Material Symbols Outlined";
3
+ const ICON_FONT_STATE_ATTRIBUTE = "data-icon-font";
4
+ const normalizeFontFamily = (family) => family.replace(/["']/g, "").trim();
5
+ const findIconFontFaces = () => {
6
+ const iconFontFaces = [];
7
+ document.fonts.forEach((fontFace) => {
8
+ if (normalizeFontFamily(fontFace.family) === ICON_FONT_FAMILY) iconFontFaces.push(fontFace);
9
+ });
10
+ return iconFontFaces;
11
+ };
12
+ const watchIconFont = async () => {
13
+ if (typeof document === "undefined" || !document.fonts) return null;
14
+ const iconFontFaces = findIconFontFaces();
15
+ if (iconFontFaces.length === 0) return null;
16
+ const rootElement = document.documentElement;
17
+ const isAlreadyLoaded = iconFontFaces.every((fontFace) => fontFace.status === "loaded");
18
+ if (isAlreadyLoaded) {
19
+ rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, "ready");
20
+ return "ready";
21
+ }
22
+ rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, "loading");
23
+ try {
24
+ await Promise.all(iconFontFaces.map((fontFace) => fontFace.load()));
25
+ rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, "ready");
26
+ return "ready";
27
+ } catch (error) {
28
+ rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, "unavailable");
29
+ uiLogger.warn(`[iconFont] ${ICON_FONT_FAMILY} could not be loaded; icons are hidden`, error);
30
+ return "unavailable";
31
+ }
32
+ };
33
+ export {
34
+ ICON_FONT_FAMILY,
35
+ watchIconFont
36
+ };
37
+ //# sourceMappingURL=iconFont.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconFont.js","sources":["../../src/helpers/iconFont.ts"],"sourcesContent":["import { uiLogger } from './uiLogger';\n\nexport type TIconFontState = 'loading' | 'ready' | 'unavailable';\n\nexport const ICON_FONT_FAMILY = 'Material Symbols Outlined';\n\nconst ICON_FONT_STATE_ATTRIBUTE = 'data-icon-font';\n\nconst normalizeFontFamily = (family: string): string => family.replace(/[\"']/g, '').trim();\n\nconst findIconFontFaces = (): Array<FontFace> => {\n const iconFontFaces: Array<FontFace> = [];\n document.fonts.forEach((fontFace) => {\n if (normalizeFontFamily(fontFace.family) === ICON_FONT_FAMILY) iconFontFaces.push(fontFace);\n });\n return iconFontFaces;\n};\n\n/**\n * Starts the icon font download at boot and mirrors its state on `<html data-icon-font>`.\n * base.css hides the ligature text while the state is `loading` or `unavailable`, so a\n * blocked or failed font leaves empty glyph boxes instead of icon names spread over the\n * layout. Resolves to null when there is no DOM or the host registered no icon face.\n */\nexport const watchIconFont = async (): Promise<TIconFontState | null> => {\n if (typeof document === 'undefined' || !document.fonts) return null;\n\n const iconFontFaces = findIconFontFaces();\n if (iconFontFaces.length === 0) return null;\n\n const rootElement = document.documentElement;\n const isAlreadyLoaded = iconFontFaces.every((fontFace) => fontFace.status === 'loaded');\n if (isAlreadyLoaded) {\n rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, 'ready');\n return 'ready';\n }\n\n rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, 'loading');\n try {\n await Promise.all(iconFontFaces.map((fontFace) => fontFace.load()));\n rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, 'ready');\n return 'ready';\n } catch (error) {\n rootElement.setAttribute(ICON_FONT_STATE_ATTRIBUTE, 'unavailable');\n uiLogger.warn(`[iconFont] ${ICON_FONT_FAMILY} could not be loaded; icons are hidden`, error);\n return 'unavailable';\n }\n};\n"],"names":[],"mappings":";AAIO,MAAM,mBAAmB;AAEhC,MAAM,4BAA4B;AAElC,MAAM,sBAAsB,CAAC,WAA2B,OAAO,QAAQ,SAAS,EAAE,EAAE,KAAA;AAEpF,MAAM,oBAAoB,MAAuB;AAC/C,QAAM,gBAAiC,CAAA;AACvC,WAAS,MAAM,QAAQ,CAAC,aAAa;AACnC,QAAI,oBAAoB,SAAS,MAAM,MAAM,iBAAkB,eAAc,KAAK,QAAQ;AAAA,EAC5F,CAAC;AACD,SAAO;AACT;AAQO,MAAM,gBAAgB,YAA4C;AACvE,MAAI,OAAO,aAAa,eAAe,CAAC,SAAS,MAAO,QAAO;AAE/D,QAAM,gBAAgB,kBAAA;AACtB,MAAI,cAAc,WAAW,EAAG,QAAO;AAEvC,QAAM,cAAc,SAAS;AAC7B,QAAM,kBAAkB,cAAc,MAAM,CAAC,aAAa,SAAS,WAAW,QAAQ;AACtF,MAAI,iBAAiB;AACnB,gBAAY,aAAa,2BAA2B,OAAO;AAC3D,WAAO;AAAA,EACT;AAEA,cAAY,aAAa,2BAA2B,SAAS;AAC7D,MAAI;AACF,UAAM,QAAQ,IAAI,cAAc,IAAI,CAAC,aAAa,SAAS,KAAA,CAAM,CAAC;AAClE,gBAAY,aAAa,2BAA2B,OAAO;AAC3D,WAAO;AAAA,EACT,SAAS,OAAO;AACd,gBAAY,aAAa,2BAA2B,aAAa;AACjE,aAAS,KAAK,cAAc,gBAAgB,0CAA0C,KAAK;AAC3F,WAAO;AAAA,EACT;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umodeapporg/ui",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "src/assets/styles",
12
+ "src/assets/fonts",
12
13
  "tailwind.preset.js",
13
14
  "tailwind-plugins"
14
15
  ],
@@ -0,0 +1,92 @@
1
+ Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+ -----------------------------------------------------------
8
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9
+ -----------------------------------------------------------
10
+
11
+ PREAMBLE
12
+ The goals of the Open Font License (OFL) are to stimulate worldwide
13
+ development of collaborative font projects, to support the font creation
14
+ efforts of academic and linguistic communities, and to provide a free and
15
+ open framework in which fonts may be shared and improved in partnership
16
+ with others.
17
+
18
+ The OFL allows the licensed fonts to be used, studied, modified and
19
+ redistributed freely as long as they are not sold by themselves. The
20
+ fonts, including any derivative works, can be bundled, embedded,
21
+ redistributed and/or sold with any software provided that any reserved
22
+ names are not used by derivative works. The fonts and derivatives,
23
+ however, cannot be released under any other type of license. The
24
+ requirement for fonts to remain under this license does not apply
25
+ to any document created using the fonts or their derivatives.
26
+
27
+ DEFINITIONS
28
+ "Font Software" refers to the set of files released by the Copyright
29
+ Holder(s) under this license and clearly marked as such. This may
30
+ include source files, build scripts and documentation.
31
+
32
+ "Reserved Font Name" refers to any names specified as such after the
33
+ copyright statement(s).
34
+
35
+ "Original Version" refers to the collection of Font Software components as
36
+ distributed by the Copyright Holder(s).
37
+
38
+ "Modified Version" refers to any derivative made by adding to, deleting,
39
+ or substituting -- in part or in whole -- any of the components of the
40
+ Original Version, by changing formats or by porting the Font Software to a
41
+ new environment.
42
+
43
+ "Author" refers to any designer, engineer, programmer, technical
44
+ writer or other person who contributed to the Font Software.
45
+
46
+ PERMISSION AND CONDITIONS
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
49
+ redistribute, and sell modified and unmodified copies of the Font
50
+ Software, subject to the following conditions:
51
+
52
+ 1) Neither the Font Software nor any of its individual components,
53
+ in Original or Modified Versions, may be sold by itself.
54
+
55
+ 2) Original or Modified Versions of the Font Software may be bundled,
56
+ redistributed and/or sold with any software, provided that each copy
57
+ contains the above copyright notice and this license. These can be
58
+ included either as stand-alone text files, human-readable headers or
59
+ in the appropriate machine-readable metadata fields within text or
60
+ binary files as long as those fields can be easily viewed by the user.
61
+
62
+ 3) No Modified Version of the Font Software may use the Reserved Font
63
+ Name(s) unless explicit written permission is granted by the corresponding
64
+ Copyright Holder. This restriction only applies to the primary font name as
65
+ presented to the users.
66
+
67
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68
+ Software shall not be used to promote, endorse or advertise any
69
+ Modified Version, except to acknowledge the contribution(s) of the
70
+ Copyright Holder(s) and the Author(s) or with their explicit written
71
+ permission.
72
+
73
+ 5) The Font Software, modified or unmodified, in part or in whole,
74
+ must be distributed entirely under this license, and must not be
75
+ distributed under any other license. The requirement for fonts to
76
+ remain under this license does not apply to any document created
77
+ using the Font Software.
78
+
79
+ TERMINATION
80
+ This license becomes null and void if any of the above conditions are
81
+ not met.
82
+
83
+ DISCLAIMER
84
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -1,5 +1,38 @@
1
1
  @import './theme.css';
2
2
 
3
+ /* Self-hosted on purpose: served from the host's own origin, the fonts survive networks,
4
+ DNS filters and extensions that block the Google Fonts domains. Without the icon face
5
+ every MaterialSymbol renders its ligature name as plain text. */
6
+ @font-face {
7
+ font-family: 'Material Symbols Outlined';
8
+ font-style: normal;
9
+ font-weight: 100 700;
10
+ font-display: block;
11
+ src: url('../fonts/material-symbols-outlined.woff2') format('woff2');
12
+ }
13
+
14
+ @font-face {
15
+ font-family: 'Inter';
16
+ font-style: normal;
17
+ font-weight: 100 900;
18
+ font-display: swap;
19
+ src: url('../fonts/inter-latin-ext.woff2') format('woff2');
20
+ unicode-range:
21
+ U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
22
+ U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
23
+ }
24
+
25
+ @font-face {
26
+ font-family: 'Inter';
27
+ font-style: normal;
28
+ font-weight: 100 900;
29
+ font-display: swap;
30
+ src: url('../fonts/inter-latin.woff2') format('woff2');
31
+ unicode-range:
32
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
33
+ U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
34
+ }
35
+
3
36
  @tailwind base;
4
37
  @tailwind components;
5
38
  @tailwind utilities;
@@ -399,6 +432,20 @@ button:disabled,
399
432
  font-feature-settings: 'liga';
400
433
  }
401
434
 
435
+ /* Set by `watchIconFont` while the icon face is not usable: the glyph box keeps its size,
436
+ and the ligature name never shows up as text in the layout. */
437
+ :root[data-icon-font='loading'] .material-symbols,
438
+ :root[data-icon-font='unavailable'] .material-symbols {
439
+ width: 1em;
440
+ overflow: hidden;
441
+ color: transparent !important;
442
+ }
443
+
444
+ :root[data-icon-font='loading'] .rt-file::before,
445
+ :root[data-icon-font='unavailable'] .rt-file::before {
446
+ content: none;
447
+ }
448
+
402
449
  .wf-loading,
403
450
  .wf-materialicons-n4-inactive {
404
451
  .material-icons {
@@ -1,2 +1 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
2
1
  @import './base.css';