@metropolle/design-system 1.0.0-beta.2025.10.1.1541.d0d0b36 → 1.0.0-beta.2025.10.2.27.2a6f231

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.
Files changed (25) hide show
  1. package/dist/css/components.css +194 -0
  2. package/dist/react/components/react/DataTable/DataTable.d.ts +4 -0
  3. package/dist/react/components/react/DataTable/DataTable.d.ts.map +1 -0
  4. package/dist/react/components/react/DataTable/TableHeader.d.ts +4 -0
  5. package/dist/react/components/react/DataTable/TableHeader.d.ts.map +1 -0
  6. package/dist/react/components/react/DataTable/TableRow.d.ts +4 -0
  7. package/dist/react/components/react/DataTable/TableRow.d.ts.map +1 -0
  8. package/dist/react/components/react/DataTable/examples.d.ts +28 -0
  9. package/dist/react/components/react/DataTable/examples.d.ts.map +1 -0
  10. package/dist/react/components/react/DataTable/index.d.ts +7 -0
  11. package/dist/react/components/react/DataTable/index.d.ts.map +1 -0
  12. package/dist/react/components/react/DataTable/migration-example.d.ts +46 -0
  13. package/dist/react/components/react/DataTable/migration-example.d.ts.map +1 -0
  14. package/dist/react/components/react/DataTable/renderers.d.ts +24 -0
  15. package/dist/react/components/react/DataTable/renderers.d.ts.map +1 -0
  16. package/dist/react/components/react/DataTable/types.d.ts +57 -0
  17. package/dist/react/components/react/DataTable/types.d.ts.map +1 -0
  18. package/dist/react/components/react/index.d.ts +2 -0
  19. package/dist/react/components/react/index.d.ts.map +1 -1
  20. package/dist/react/index.d.ts +2 -0
  21. package/dist/react/index.esm.js +605 -2
  22. package/dist/react/index.esm.js.map +1 -1
  23. package/dist/react/index.js +615 -0
  24. package/dist/react/index.js.map +1 -1
  25. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import require$$0, { forwardRef, useState, useEffect, useRef } from 'react';
1
+ import require$$0, { forwardRef, useState, useEffect, useMemo, useRef } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  var jsxRuntime = {exports: {}};
@@ -1581,6 +1581,609 @@ function ThemeToggle({ size = 'md', className = '', disabled = false, onChange,
1581
1581
  return (jsxRuntimeExports.jsx("button", { onClick: toggleTheme, className: buttonClasses, disabled: disabled, type: "button", "aria-pressed": isDark, "aria-label": `Switch to ${isDark ? 'light' : 'dark'} mode`, title: `Switch to ${isDark ? 'light' : 'dark'} mode`, "data-theme": isDark ? 'dark' : 'light', style: buttonStyle }));
1582
1582
  }
1583
1583
 
1584
+ const TableHeader = ({ columns, gridTemplate, onSort, sortColumn, sortDirection }) => {
1585
+ return (jsxRuntimeExports.jsx("div", { role: "rowgroup", style: {
1586
+ display: 'grid',
1587
+ gridTemplateColumns: gridTemplate,
1588
+ gap: '16px',
1589
+ padding: '16px 20px',
1590
+ borderBottom: '1px solid var(--border-color)',
1591
+ backgroundColor: 'rgba(255, 255, 255, 0.05)'
1592
+ }, children: columns.map((column) => (jsxRuntimeExports.jsxs("div", { role: "columnheader", style: {
1593
+ color: 'var(--text-primary)',
1594
+ fontWeight: '500',
1595
+ fontSize: '14px',
1596
+ display: 'flex',
1597
+ alignItems: 'center',
1598
+ justifyContent: column.align === 'center' ? 'center' :
1599
+ column.align === 'right' ? 'flex-end' : 'flex-start',
1600
+ cursor: column.sortable && onSort ? 'pointer' : 'default',
1601
+ gap: '4px',
1602
+ transition: 'color 0.2s ease'
1603
+ }, onClick: () => column.sortable && onSort && onSort(column.key), onMouseEnter: (e) => {
1604
+ if (column.sortable && onSort) {
1605
+ e.currentTarget.style.color = '#ffffff';
1606
+ }
1607
+ }, onMouseLeave: (e) => {
1608
+ e.currentTarget.style.color = 'var(--text-primary)';
1609
+ }, children: [column.label, column.sortable && onSort && (jsxRuntimeExports.jsx("span", { style: {
1610
+ fontSize: '12px',
1611
+ opacity: sortColumn === column.key ? 1 : 0.5
1612
+ }, children: sortColumn === column.key ?
1613
+ (sortDirection === 'asc' ? '↑' : '↓') : '↕' }))] }, column.key))) }));
1614
+ };
1615
+
1616
+ const TableRow = ({ item, index, columns, actions = [], gridTemplate, isLast, variant, onActionClick }) => {
1617
+ return (jsxRuntimeExports.jsxs("div", { role: "row", style: {
1618
+ display: 'grid',
1619
+ gridTemplateColumns: gridTemplate,
1620
+ gap: '16px',
1621
+ padding: variant === 'compact' ? '12px 20px' : '16px 20px',
1622
+ borderBottom: isLast ? 'none' : '1px solid var(--border-color)',
1623
+ backgroundColor: 'transparent',
1624
+ transition: 'background-color 0.2s ease'
1625
+ }, onMouseEnter: (e) => {
1626
+ e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.05)';
1627
+ }, onMouseLeave: (e) => {
1628
+ e.currentTarget.style.backgroundColor = 'transparent';
1629
+ }, children: [columns.map((column) => (jsxRuntimeExports.jsx("div", { role: "cell", style: {
1630
+ display: 'flex',
1631
+ flexDirection: 'column',
1632
+ gap: '4px',
1633
+ justifyContent: 'center',
1634
+ alignItems: column.align === 'center' ? 'center' :
1635
+ column.align === 'right' ? 'flex-end' : 'flex-start'
1636
+ }, children: column.render ?
1637
+ column.render(item[column.key], item, index) :
1638
+ jsxRuntimeExports.jsx("div", { style: {
1639
+ color: 'var(--text-primary)',
1640
+ fontSize: '14px'
1641
+ }, children: item[column.key] }) }, column.key))), actions.length > 0 && (jsxRuntimeExports.jsx("div", { role: "cell", style: {
1642
+ display: 'flex',
1643
+ gap: '8px',
1644
+ justifyContent: 'center',
1645
+ alignItems: 'center'
1646
+ }, children: actions.map((action) => {
1647
+ const isDisabled = action.disabled?.(item) || false;
1648
+ const isLoading = action.loading?.(item) || false;
1649
+ return (jsxRuntimeExports.jsxs("button", { onClick: () => !isDisabled && !isLoading && onActionClick(action, item), disabled: isDisabled || isLoading, style: {
1650
+ background: 'none',
1651
+ border: action.variant === 'danger' ? '1px solid rgba(239, 68, 68, 0.3)' :
1652
+ '1px solid var(--border-color)',
1653
+ borderRadius: '6px',
1654
+ padding: '6px 12px',
1655
+ color: action.variant === 'danger' ? '#f87171' : 'var(--text-primary)',
1656
+ fontSize: '12px',
1657
+ cursor: isDisabled || isLoading ? 'not-allowed' : 'pointer',
1658
+ display: 'flex',
1659
+ alignItems: 'center',
1660
+ gap: '4px',
1661
+ transition: 'all 0.2s ease',
1662
+ opacity: isDisabled || isLoading ? 0.5 : 1,
1663
+ whiteSpace: 'nowrap'
1664
+ }, onMouseEnter: (e) => {
1665
+ if (!isDisabled && !isLoading) {
1666
+ if (action.variant === 'danger') {
1667
+ e.currentTarget.style.backgroundColor = 'rgba(239, 68, 68, 0.1)';
1668
+ e.currentTarget.style.borderColor = 'rgba(239, 68, 68, 0.5)';
1669
+ }
1670
+ else {
1671
+ e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
1672
+ e.currentTarget.style.borderColor = 'var(--text-primary)';
1673
+ }
1674
+ }
1675
+ }, onMouseLeave: (e) => {
1676
+ if (!isDisabled && !isLoading) {
1677
+ e.currentTarget.style.backgroundColor = 'transparent';
1678
+ e.currentTarget.style.borderColor = action.variant === 'danger' ?
1679
+ 'rgba(239, 68, 68, 0.3)' : 'var(--border-color)';
1680
+ }
1681
+ }, children: [action.icon && action.icon, action.label] }, action.key));
1682
+ }) }))] }));
1683
+ };
1684
+
1685
+ const DataTable = ({ data, columns, loading = false, searchTerm = '', actions = [], variant = 'default', responsive = 'stack', onSort, emptyMessage = 'Nenhum item encontrado', loadingMessage = 'Carregando...', className, style, maxHeight = '600px', showSearchCount = true, rowHover = true, striped = false }) => {
1686
+ const [sortColumn, setSortColumn] = useState('');
1687
+ const [sortDirection, setSortDirection] = useState('asc');
1688
+ // Filter data based on search term
1689
+ const filteredData = useMemo(() => {
1690
+ if (!searchTerm)
1691
+ return data;
1692
+ return data.filter(item => {
1693
+ return columns.some(column => {
1694
+ const value = item[column.key];
1695
+ if (value === null || value === undefined)
1696
+ return false;
1697
+ return String(value).toLowerCase().includes(searchTerm.toLowerCase());
1698
+ });
1699
+ });
1700
+ }, [data, searchTerm, columns]);
1701
+ // Generate grid template based on columns and actions
1702
+ const gridTemplate = useMemo(() => {
1703
+ const columnWidths = columns.map(col => col.width || '1fr').join(' ');
1704
+ const actionsWidth = actions.length > 0 ? ' 120px' : '';
1705
+ return columnWidths + actionsWidth;
1706
+ }, [columns, actions]);
1707
+ // Handle sort
1708
+ const handleSort = (columnKey) => {
1709
+ let direction = 'asc';
1710
+ if (sortColumn === columnKey && sortDirection === 'asc') {
1711
+ direction = 'desc';
1712
+ }
1713
+ setSortColumn(columnKey);
1714
+ setSortDirection(direction);
1715
+ if (onSort) {
1716
+ onSort(columnKey, direction);
1717
+ }
1718
+ };
1719
+ // Handle action click
1720
+ const handleActionClick = (action, item) => {
1721
+ action.onClick(item);
1722
+ };
1723
+ // Loading state
1724
+ if (loading) {
1725
+ return (jsxRuntimeExports.jsx("div", { className: className, style: {
1726
+ position: 'relative',
1727
+ borderRadius: '24px',
1728
+ backdropFilter: 'blur(24px)',
1729
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
1730
+ border: '1px solid rgba(255, 255, 255, 0.3)',
1731
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
1732
+ padding: '32px',
1733
+ ...style
1734
+ }, children: jsxRuntimeExports.jsxs("div", { style: {
1735
+ display: 'flex',
1736
+ alignItems: 'center',
1737
+ justifyContent: 'center',
1738
+ gap: '12px'
1739
+ }, children: [jsxRuntimeExports.jsx("div", { style: {
1740
+ width: '32px',
1741
+ height: '32px',
1742
+ border: '2px solid transparent',
1743
+ borderTop: '2px solid white',
1744
+ borderRadius: '50%',
1745
+ animation: 'spin 1s linear infinite'
1746
+ } }), jsxRuntimeExports.jsx("span", { style: { color: 'var(--text-primary)' }, children: loadingMessage })] }) }));
1747
+ }
1748
+ // Empty state
1749
+ if (filteredData.length === 0) {
1750
+ return (jsxRuntimeExports.jsx("div", { className: className, style: {
1751
+ position: 'relative',
1752
+ borderRadius: '24px',
1753
+ backdropFilter: 'blur(24px)',
1754
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
1755
+ border: '1px solid rgba(255, 255, 255, 0.3)',
1756
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
1757
+ padding: '40px',
1758
+ textAlign: 'center',
1759
+ ...style
1760
+ }, children: jsxRuntimeExports.jsx("div", { style: {
1761
+ color: 'var(--text-secondary)',
1762
+ fontSize: '16px'
1763
+ }, children: emptyMessage }) }));
1764
+ }
1765
+ return (jsxRuntimeExports.jsxs("div", { className: className, style: {
1766
+ position: 'relative',
1767
+ borderRadius: '24px',
1768
+ backdropFilter: 'blur(24px)',
1769
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
1770
+ border: '1px solid rgba(255, 255, 255, 0.3)',
1771
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
1772
+ overflow: 'hidden',
1773
+ ...style
1774
+ }, role: "table", "aria-label": "Tabela de dados", children: [showSearchCount && searchTerm && (jsxRuntimeExports.jsxs("div", { style: {
1775
+ padding: '16px',
1776
+ color: 'var(--text-secondary)',
1777
+ fontSize: '14px',
1778
+ borderBottom: '1px solid var(--border-color)'
1779
+ }, children: ["Mostrando", ' ', jsxRuntimeExports.jsx("span", { style: { fontWeight: '500', color: 'var(--text-primary)' }, children: filteredData.length }), ' ', "de", ' ', jsxRuntimeExports.jsx("span", { style: { fontWeight: '500', color: 'var(--text-primary)' }, children: data.length }), ' ', "itens"] })), jsxRuntimeExports.jsx(TableHeader, { columns: columns, gridTemplate: gridTemplate, onSort: onSort ? handleSort : undefined, sortColumn: sortColumn, sortDirection: sortDirection }), jsxRuntimeExports.jsx("div", { role: "rowgroup", style: {
1780
+ maxHeight,
1781
+ overflowY: 'auto'
1782
+ }, children: filteredData.map((item, index) => (jsxRuntimeExports.jsx(TableRow, { item: item, index: index, columns: columns, actions: actions, gridTemplate: gridTemplate, isLast: index === filteredData.length - 1, variant: variant, onActionClick: handleActionClick }, item.id || index))) })] }));
1783
+ };
1784
+
1785
+ const CellRenderers = {
1786
+ // ID cell - monospace background
1787
+ id: (value) => (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
1788
+ color: 'var(--text-secondary)',
1789
+ fontSize: '12px',
1790
+ backgroundColor: 'rgba(255, 255, 255, 0.05)',
1791
+ padding: '2px 8px',
1792
+ borderRadius: '4px',
1793
+ textAlign: 'center',
1794
+ fontFamily: 'monospace'
1795
+ }, children: value })),
1796
+ // Name cell - primary text with background
1797
+ name: (value) => (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
1798
+ color: 'var(--text-primary)',
1799
+ fontSize: '14px',
1800
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
1801
+ padding: '4px 12px',
1802
+ borderRadius: '8px',
1803
+ fontFamily: 'monospace'
1804
+ }, children: value })),
1805
+ // Parameter value - masked if secure
1806
+ parameterValue: (value, item) => {
1807
+ const displayValue = item.type === 'SecureString' ? '••••••••' :
1808
+ (value?.length > 50 ? `${value.substring(0, 50)}...` : value);
1809
+ return (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
1810
+ color: 'var(--text-primary)',
1811
+ fontSize: '14px',
1812
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
1813
+ borderRadius: '8px',
1814
+ maxWidth: '300px',
1815
+ wordBreak: 'break-all',
1816
+ padding: '4px 12px',
1817
+ fontFamily: 'monospace'
1818
+ }, children: displayValue }));
1819
+ },
1820
+ // Badge renderer for types/statuses
1821
+ badge: (value, variant = 'primary') => (jsxRuntimeExports.jsx("span", { className: `data-table-badge ${variant}`, children: value })),
1822
+ // Parameter type badge
1823
+ parameterType: (value) => {
1824
+ const variant = value === 'SecureString' ? 'danger' :
1825
+ value === 'StringList' ? 'success' : 'primary';
1826
+ return CellRenderers.badge(value, variant);
1827
+ },
1828
+ // Environment badge
1829
+ environment: (value, item) => {
1830
+ const env = item.name?.includes('/prod/') ? 'PROD' : 'DEV';
1831
+ const variant = env === 'PROD' ? 'info' : 'warning';
1832
+ return CellRenderers.badge(env, variant);
1833
+ },
1834
+ // Action type badge for audit logs
1835
+ actionType: (value) => {
1836
+ const variant = value === 'CREATE' ? 'success' :
1837
+ value === 'UPDATE' ? 'primary' : 'danger';
1838
+ return CellRenderers.badge(value, variant);
1839
+ },
1840
+ // Date formatter
1841
+ date: (value) => (jsxRuntimeExports.jsx("div", { style: {
1842
+ color: 'var(--text-primary)',
1843
+ fontSize: '14px'
1844
+ }, children: value ? new Date(value).toLocaleString('pt-BR') : '-' })),
1845
+ // Description/secondary text
1846
+ description: (value) => (jsxRuntimeExports.jsx("div", { style: {
1847
+ color: 'var(--text-secondary)',
1848
+ fontSize: '12px',
1849
+ maxWidth: '300px',
1850
+ overflow: 'hidden',
1851
+ textOverflow: 'ellipsis',
1852
+ whiteSpace: 'nowrap'
1853
+ }, children: value })),
1854
+ // JSON preview for audit changes
1855
+ jsonPreview: (value) => {
1856
+ const jsonString = JSON.stringify(value);
1857
+ const preview = jsonString.length > 30 ? jsonString.substring(0, 30) + '...' : jsonString;
1858
+ return (jsxRuntimeExports.jsx("div", { style: {
1859
+ color: 'var(--text-secondary)',
1860
+ fontSize: '12px',
1861
+ fontFamily: 'monospace',
1862
+ maxWidth: '150px',
1863
+ overflow: 'hidden',
1864
+ textOverflow: 'ellipsis',
1865
+ whiteSpace: 'nowrap'
1866
+ }, children: preview }));
1867
+ },
1868
+ // Combined cell with main value and description
1869
+ combined: (mainValue, description) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [CellRenderers.name(mainValue), description && CellRenderers.description(description)] })),
1870
+ // Combined with badges
1871
+ combinedWithBadges: (mainValue, badges) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [CellRenderers.name(mainValue), jsxRuntimeExports.jsx("div", { style: { display: 'flex', gap: '8px', flexWrap: 'wrap' }, children: badges.map((badge, index) => (jsxRuntimeExports.jsx("span", { className: `data-table-badge ${badge.variant || 'primary'}`, children: badge.value }, index))) })] }))
1872
+ };
1873
+ // Common action icons
1874
+ const ActionIcons = {
1875
+ edit: (jsxRuntimeExports.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: jsxRuntimeExports.jsx("path", { d: "M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" }) })),
1876
+ delete: (jsxRuntimeExports.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: jsxRuntimeExports.jsx("path", { d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }) })),
1877
+ view: (jsxRuntimeExports.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: jsxRuntimeExports.jsx("path", { d: "M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" }) })),
1878
+ loading: (jsxRuntimeExports.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", className: "data-table-spinner", children: jsxRuntimeExports.jsx("path", { d: "M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z" }) }))
1879
+ };
1880
+
1881
+ // Configuração para ParametersTable (Settings)
1882
+ const parametersTableConfig = {
1883
+ columns: [
1884
+ {
1885
+ key: 'name',
1886
+ label: 'Parâmetro',
1887
+ width: '1fr',
1888
+ render: (value, item) => CellRenderers.combinedWithBadges(value, [
1889
+ { value: item.type, variant: item.type === 'SecureString' ? 'danger' :
1890
+ item.type === 'StringList' ? 'success' : 'primary' },
1891
+ { value: item.name.includes('/prod/') ? 'PROD' : 'DEV',
1892
+ variant: item.name.includes('/prod/') ? 'info' : 'warning' }
1893
+ ])
1894
+ },
1895
+ {
1896
+ key: 'value',
1897
+ label: 'Valor',
1898
+ width: '2fr',
1899
+ render: (value, item) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [CellRenderers.parameterValue(value, item), CellRenderers.description(item.description)] }))
1900
+ }
1901
+ ],
1902
+ actions: [
1903
+ {
1904
+ key: 'edit',
1905
+ label: '✏️',
1906
+ variant: 'secondary',
1907
+ onClick: (item) => console.log('Edit', item),
1908
+ disabled: (item) => false
1909
+ },
1910
+ {
1911
+ key: 'delete',
1912
+ label: '🗑️',
1913
+ variant: 'danger',
1914
+ onClick: (item) => console.log('Delete', item),
1915
+ disabled: (item) => false,
1916
+ loading: (item) => item.deleting || false
1917
+ }
1918
+ ]
1919
+ };
1920
+ // Configuração para GeographyTable - Regions
1921
+ const regionsTableConfig = {
1922
+ columns: [
1923
+ {
1924
+ key: 'region_id',
1925
+ label: 'ID',
1926
+ width: '80px',
1927
+ render: CellRenderers.id
1928
+ },
1929
+ {
1930
+ key: 'name',
1931
+ label: 'Nome',
1932
+ width: '1fr',
1933
+ render: CellRenderers.name
1934
+ },
1935
+ {
1936
+ key: 'code',
1937
+ label: 'Código',
1938
+ width: '120px',
1939
+ render: CellRenderers.name
1940
+ },
1941
+ {
1942
+ key: 'created_at',
1943
+ label: 'Criado em',
1944
+ width: '140px',
1945
+ render: CellRenderers.date
1946
+ },
1947
+ {
1948
+ key: 'created_by',
1949
+ label: 'Criado por',
1950
+ width: '140px',
1951
+ render: (value) => CellRenderers.name(value)
1952
+ }
1953
+ ],
1954
+ actions: [
1955
+ {
1956
+ key: 'edit',
1957
+ label: '✏️',
1958
+ variant: 'secondary',
1959
+ onClick: (item) => console.log('Edit region', item)
1960
+ },
1961
+ {
1962
+ key: 'delete',
1963
+ label: '🗑️',
1964
+ variant: 'danger',
1965
+ onClick: (item) => console.log('Delete region', item),
1966
+ loading: (item) => item.deleting || false
1967
+ }
1968
+ ]
1969
+ };
1970
+ // Configuração para GeographyTable - Countries
1971
+ const countriesTableConfig = {
1972
+ columns: [
1973
+ {
1974
+ key: 'country_id',
1975
+ label: 'ID',
1976
+ width: '80px',
1977
+ render: CellRenderers.id
1978
+ },
1979
+ {
1980
+ key: 'name',
1981
+ label: 'Nome',
1982
+ width: '1fr',
1983
+ render: CellRenderers.name
1984
+ },
1985
+ {
1986
+ key: 'iso2',
1987
+ label: 'Código',
1988
+ width: '120px',
1989
+ render: (value, item) => CellRenderers.combinedWithBadges(value, [
1990
+ { value: item.iso3, variant: 'primary' }
1991
+ ])
1992
+ },
1993
+ {
1994
+ key: 'capital',
1995
+ label: 'Capital',
1996
+ width: '140px',
1997
+ render: CellRenderers.name
1998
+ },
1999
+ {
2000
+ key: 'region',
2001
+ label: 'Região',
2002
+ width: '120px',
2003
+ render: (value) => CellRenderers.badge(value, 'info')
2004
+ }
2005
+ ],
2006
+ actions: [
2007
+ {
2008
+ key: 'edit',
2009
+ label: '✏️',
2010
+ variant: 'secondary',
2011
+ onClick: (item) => console.log('Edit country', item)
2012
+ },
2013
+ {
2014
+ key: 'delete',
2015
+ label: '🗑️',
2016
+ variant: 'danger',
2017
+ onClick: (item) => console.log('Delete country', item)
2018
+ }
2019
+ ]
2020
+ };
2021
+ // Configuração para Audit Log
2022
+ const auditLogTableConfig = {
2023
+ columns: [
2024
+ {
2025
+ key: 'timestamp',
2026
+ label: 'Data/Hora',
2027
+ width: '140px',
2028
+ render: CellRenderers.date
2029
+ },
2030
+ {
2031
+ key: 'user_email',
2032
+ label: 'Usuário',
2033
+ width: '180px',
2034
+ render: CellRenderers.name
2035
+ },
2036
+ {
2037
+ key: 'action',
2038
+ label: 'Ação',
2039
+ width: '100px',
2040
+ render: CellRenderers.actionType
2041
+ },
2042
+ {
2043
+ key: 'entity_type',
2044
+ label: 'Tipo',
2045
+ width: '120px',
2046
+ render: (value) => CellRenderers.badge(value, 'primary')
2047
+ },
2048
+ {
2049
+ key: 'entity_id',
2050
+ label: 'ID',
2051
+ width: '120px',
2052
+ render: CellRenderers.description
2053
+ },
2054
+ {
2055
+ key: 'changes',
2056
+ label: 'Alterações',
2057
+ width: '1fr',
2058
+ render: (value, item) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' }, children: [CellRenderers.jsonPreview(value), jsxRuntimeExports.jsxs("button", { onClick: () => console.log('View details', item), style: {
2059
+ background: 'none',
2060
+ border: '1px solid var(--border-color)',
2061
+ borderRadius: '4px',
2062
+ padding: '4px 8px',
2063
+ color: 'var(--text-primary)',
2064
+ fontSize: '12px',
2065
+ cursor: 'pointer',
2066
+ display: 'flex',
2067
+ alignItems: 'center',
2068
+ gap: '4px',
2069
+ transition: 'all 0.2s ease',
2070
+ whiteSpace: 'nowrap'
2071
+ }, children: [ActionIcons.view, "Ver Detalhes"] })] }))
2072
+ }
2073
+ ]
2074
+ };
2075
+ // Configuração para States
2076
+ const statesTableConfig = {
2077
+ columns: [
2078
+ {
2079
+ key: 'state_id',
2080
+ label: 'ID',
2081
+ width: '80px',
2082
+ render: CellRenderers.id
2083
+ },
2084
+ {
2085
+ key: 'name',
2086
+ label: 'Nome',
2087
+ width: '1fr',
2088
+ render: CellRenderers.name
2089
+ },
2090
+ {
2091
+ key: 'code',
2092
+ label: 'Código',
2093
+ width: '120px',
2094
+ render: CellRenderers.name
2095
+ },
2096
+ {
2097
+ key: 'country_name',
2098
+ label: 'País',
2099
+ width: '140px',
2100
+ render: (value) => CellRenderers.badge(value, 'info')
2101
+ }
2102
+ ],
2103
+ actions: [
2104
+ {
2105
+ key: 'edit',
2106
+ label: '✏️',
2107
+ variant: 'secondary',
2108
+ onClick: (item) => console.log('Edit state', item)
2109
+ },
2110
+ {
2111
+ key: 'delete',
2112
+ label: '🗑️',
2113
+ variant: 'danger',
2114
+ onClick: (item) => console.log('Delete state', item)
2115
+ }
2116
+ ]
2117
+ };
2118
+ // Configuração para Cities
2119
+ const citiesTableConfig = {
2120
+ columns: [
2121
+ {
2122
+ key: 'city_id',
2123
+ label: 'ID',
2124
+ width: '80px',
2125
+ render: CellRenderers.id
2126
+ },
2127
+ {
2128
+ key: 'name',
2129
+ label: 'Nome',
2130
+ width: '1fr',
2131
+ render: CellRenderers.name
2132
+ },
2133
+ {
2134
+ key: 'population',
2135
+ label: 'População',
2136
+ width: '120px',
2137
+ render: (value) => (jsxRuntimeExports.jsx("div", { style: { color: 'var(--text-primary)', fontSize: '14px' }, children: value ? value.toLocaleString('pt-BR') : '-' }))
2138
+ },
2139
+ {
2140
+ key: 'state_name',
2141
+ label: 'Estado',
2142
+ width: '140px',
2143
+ render: (value) => CellRenderers.badge(value, 'success')
2144
+ },
2145
+ {
2146
+ key: 'country_name',
2147
+ label: 'País',
2148
+ width: '120px',
2149
+ render: (value) => CellRenderers.badge(value, 'info')
2150
+ }
2151
+ ],
2152
+ actions: [
2153
+ {
2154
+ key: 'edit',
2155
+ label: '✏️',
2156
+ variant: 'secondary',
2157
+ onClick: (item) => console.log('Edit city', item)
2158
+ },
2159
+ {
2160
+ key: 'delete',
2161
+ label: '🗑️',
2162
+ variant: 'danger',
2163
+ onClick: (item) => console.log('Delete city', item)
2164
+ }
2165
+ ]
2166
+ };
2167
+ // Função helper para aplicar configuração baseada no tipo
2168
+ const getTableConfig = (type) => {
2169
+ switch (type) {
2170
+ case 'parameters':
2171
+ return parametersTableConfig;
2172
+ case 'regions':
2173
+ return regionsTableConfig;
2174
+ case 'countries':
2175
+ return countriesTableConfig;
2176
+ case 'states':
2177
+ return statesTableConfig;
2178
+ case 'cities':
2179
+ return citiesTableConfig;
2180
+ case 'audit':
2181
+ return auditLogTableConfig;
2182
+ default:
2183
+ return parametersTableConfig;
2184
+ }
2185
+ };
2186
+
1584
2187
  function Modal({ open, onClose, closeOnOverlay = true, children, className, style }) {
1585
2188
  const [mounted, setMounted] = useState(false);
1586
2189
  const [visible, setVisible] = useState(false);
@@ -1708,5 +2311,5 @@ function ConfirmDialog({ open, onClose, title, description, confirmText = 'Confi
1708
2311
  return (jsxRuntimeExports.jsx(Modal, { open: open, onClose: onClose, closeOnOverlay: !disableOverlayClose, children: jsxRuntimeExports.jsxs("div", { className: "mds-modal-card", style: { maxWidth: 480, width: '100%' }, children: [jsxRuntimeExports.jsx(ModalHeader, { title: title, icon: icon ?? toneIcon[tone], onClose: onClose, align: "center" }), description && (jsxRuntimeExports.jsx("div", { style: { padding: '0 24px 16px 24px' }, children: description })), jsxRuntimeExports.jsxs("div", { style: { display: 'flex', gap: 12, justifyContent: 'flex-end', borderTop: '1px solid var(--border-color)', padding: '16px 24px', marginTop: 8 }, children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, className: "mds-button mds-button--secondary", children: cancelText }), jsxRuntimeExports.jsx("button", { type: "button", onClick: onConfirm, disabled: loading, className: "mds-button mds-button--primary", children: loading ? 'Processando...' : confirmText })] })] }) }));
1709
2312
  }
1710
2313
 
1711
- export { BrandLogo, Button, ConfirmDialog, GlassCard, Modal, ModalBody, ModalFooter, ModalHeader, Select, ThemeToggle, Typography, cn };
2314
+ export { ActionIcons, BrandLogo, Button, CellRenderers, ConfirmDialog, DataTable, GlassCard, Modal, ModalBody, ModalFooter, ModalHeader, Select, TableHeader, TableRow, ThemeToggle, Typography, auditLogTableConfig, citiesTableConfig, cn, countriesTableConfig, getTableConfig, parametersTableConfig, regionsTableConfig, statesTableConfig };
1712
2315
  //# sourceMappingURL=index.esm.js.map