@metropolle/design-system 1.0.0-beta.20250821024300.dfbe136 → 1.0.0-beta.2026.1.1.1723.0f6bc6d

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 (57) hide show
  1. package/README.md +1 -0
  2. package/dist/css/compat/back.css +466 -0
  3. package/dist/css/components.css +1476 -8
  4. package/dist/css/liquid-glass.css +468 -0
  5. package/dist/css/mermaid.css +163 -0
  6. package/dist/css/tokens.css +67 -0
  7. package/dist/react/components/react/DataTable/DataTable.d.ts +4 -0
  8. package/dist/react/components/react/DataTable/DataTable.d.ts.map +1 -0
  9. package/dist/react/components/react/DataTable/TableHeader.d.ts +4 -0
  10. package/dist/react/components/react/DataTable/TableHeader.d.ts.map +1 -0
  11. package/dist/react/components/react/DataTable/TableRow.d.ts +4 -0
  12. package/dist/react/components/react/DataTable/TableRow.d.ts.map +1 -0
  13. package/dist/react/components/react/DataTable/examples.d.ts +28 -0
  14. package/dist/react/components/react/DataTable/examples.d.ts.map +1 -0
  15. package/dist/react/components/react/DataTable/index.d.ts +7 -0
  16. package/dist/react/components/react/DataTable/index.d.ts.map +1 -0
  17. package/dist/react/components/react/DataTable/migration-example.d.ts +46 -0
  18. package/dist/react/components/react/DataTable/migration-example.d.ts.map +1 -0
  19. package/dist/react/components/react/DataTable/renderers.d.ts +24 -0
  20. package/dist/react/components/react/DataTable/renderers.d.ts.map +1 -0
  21. package/dist/react/components/react/DataTable/types.d.ts +57 -0
  22. package/dist/react/components/react/DataTable/types.d.ts.map +1 -0
  23. package/dist/react/components/react/GlassCard/GlassCard.d.ts +46 -6
  24. package/dist/react/components/react/GlassCard/GlassCard.d.ts.map +1 -1
  25. package/dist/react/components/react/Modal/ConfirmDialog.d.ts +17 -0
  26. package/dist/react/components/react/Modal/ConfirmDialog.d.ts.map +1 -0
  27. package/dist/react/components/react/Modal/Modal.d.ts +12 -0
  28. package/dist/react/components/react/Modal/Modal.d.ts.map +1 -0
  29. package/dist/react/components/react/Modal/ModalBody.d.ts +9 -0
  30. package/dist/react/components/react/Modal/ModalBody.d.ts.map +1 -0
  31. package/dist/react/components/react/Modal/ModalFooter.d.ts +8 -0
  32. package/dist/react/components/react/Modal/ModalFooter.d.ts.map +1 -0
  33. package/dist/react/components/react/Modal/ModalHeader.d.ts +11 -0
  34. package/dist/react/components/react/Modal/ModalHeader.d.ts.map +1 -0
  35. package/dist/react/components/react/Modal/index.d.ts +6 -0
  36. package/dist/react/components/react/Modal/index.d.ts.map +1 -0
  37. package/dist/react/components/react/Select/Select.d.ts +71 -0
  38. package/dist/react/components/react/Select/Select.d.ts.map +1 -0
  39. package/dist/react/components/react/Select/index.d.ts +2 -0
  40. package/dist/react/components/react/Select/index.d.ts.map +1 -0
  41. package/dist/react/components/react/ThemeToggle/ThemeToggle.d.ts +28 -0
  42. package/dist/react/components/react/ThemeToggle/ThemeToggle.d.ts.map +1 -0
  43. package/dist/react/components/react/ThemeToggle/index.d.ts +3 -0
  44. package/dist/react/components/react/ThemeToggle/index.d.ts.map +1 -0
  45. package/dist/react/components/react/Typography/Typography.d.ts.map +1 -1
  46. package/dist/react/components/react/index.d.ts +11 -0
  47. package/dist/react/components/react/index.d.ts.map +1 -1
  48. package/dist/react/index.d.ts +11 -0
  49. package/dist/react/index.esm.js +1147 -14
  50. package/dist/react/index.esm.js.map +1 -1
  51. package/dist/react/index.js +1164 -12
  52. package/dist/react/index.js.map +1 -1
  53. package/dist/tokens/colors.json +100 -18
  54. package/dist/tokens/index.d.ts +19 -24
  55. package/dist/tokens/index.js +69 -2
  56. package/dist/tokens/index.json +100 -18
  57. package/package.json +23 -13
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('react');
4
+ var reactDom = require('react-dom');
4
5
 
5
6
  var jsxRuntime = {exports: {}};
6
7
 
@@ -1371,12 +1372,35 @@ function cn(...classes) {
1371
1372
  /**
1372
1373
  * Glass Card Component
1373
1374
  *
1374
- * Componente de cartão com efeito glassmorphism baseado na identidade Metropolle.
1375
- * Migrado dos componentes Angular existentes com melhorias.
1375
+ * Componente de cartão com efeito glassmorphism ou Liquid Glass (iOS 26 style).
1376
+ *
1377
+ * @example
1378
+ * ```tsx
1379
+ * // Liquid Glass (novo padrão)
1380
+ * <GlassCard glassStyle="liquid" intensity="md">
1381
+ * Content here
1382
+ * </GlassCard>
1383
+ *
1384
+ * // Glassmorphism tradicional (retrocompatível)
1385
+ * <GlassCard glassStyle="glass" variant="dark">
1386
+ * Content here
1387
+ * </GlassCard>
1388
+ * ```
1376
1389
  */
1377
- const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity, children, className, enableHover = true, style, ...props }, ref) => {
1390
+ const GlassCard = require$$0.forwardRef(({ glassStyle = 'liquid', intensity = 'md', theme, variant = 'light', blur, opacity, children, className, enableHover = true, style, ...props }, ref) => {
1391
+ // Resolve theme from new prop or deprecated variant
1392
+ const resolvedTheme = theme ?? variant;
1393
+ // =====================
1394
+ // LIQUID GLASS MODE
1395
+ // =====================
1396
+ if (glassStyle === 'liquid') {
1397
+ return (jsxRuntimeExports.jsx("div", { ref: ref, className: cn('mds-liquid-glass', `mds-liquid-glass--${intensity}`, !enableHover && 'mds-liquid-glass--no-hover', className), style: style, ...props, children: children }));
1398
+ }
1399
+ // =====================
1400
+ // GLASS MODE (legacy)
1401
+ // =====================
1378
1402
  // Default opacities baseadas no design existente
1379
- const defaultOpacity = variant === 'light' ? 0.15 : 0.8;
1403
+ const defaultOpacity = resolvedTheme === 'light' ? 0.15 : 0.8;
1380
1404
  const finalOpacity = opacity ?? defaultOpacity;
1381
1405
  // Use CSS classes for base styles to avoid hydration mismatches
1382
1406
  const baseStyles = {
@@ -1384,12 +1408,16 @@ const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity
1384
1408
  };
1385
1409
  // Only apply custom styles for non-default values
1386
1410
  const customStyles = {};
1387
- if (blur !== 20) {
1388
- customStyles.backdropFilter = `blur(${blur}px)`;
1389
- customStyles.WebkitBackdropFilter = `blur(${blur}px)`;
1411
+ // Support legacy blur prop or convert from intensity
1412
+ const resolvedBlur = blur ?? (intensity ? {
1413
+ xs: 2, sm: 4, md: 6, lg: 8, xl: 12
1414
+ }[intensity] : 20);
1415
+ if (resolvedBlur !== 20) {
1416
+ customStyles.backdropFilter = `blur(${resolvedBlur}px)`;
1417
+ customStyles.WebkitBackdropFilter = `blur(${resolvedBlur}px)`;
1390
1418
  }
1391
1419
  if (opacity !== undefined) {
1392
- customStyles.background = variant === 'light'
1420
+ customStyles.background = resolvedTheme === 'light'
1393
1421
  ? `rgba(255, 255, 255, ${finalOpacity})`
1394
1422
  : `rgba(60, 60, 60, ${finalOpacity})`;
1395
1423
  }
@@ -1404,7 +1432,7 @@ const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity
1404
1432
  borderColor: 'rgba(255, 255, 255, 0.2)',
1405
1433
  background: opacity !== undefined ? `rgba(70, 70, 70, ${finalOpacity})` : undefined,
1406
1434
  }
1407
- }[variant] : {};
1435
+ }[resolvedTheme] : {};
1408
1436
  const handleMouseEnter = (e) => {
1409
1437
  if (!enableHover)
1410
1438
  return;
@@ -1422,7 +1450,7 @@ const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity
1422
1450
  });
1423
1451
  props.onMouseLeave?.(e);
1424
1452
  };
1425
- return (jsxRuntimeExports.jsx("div", { ref: ref, className: cn('mds-glass-card', `mds-glass-card--${variant}`, !enableHover && 'mds-glass-card--no-hover', className), style: {
1453
+ return (jsxRuntimeExports.jsx("div", { ref: ref, className: cn('mds-glass-card', `mds-glass-card--${resolvedTheme}`, !enableHover && 'mds-glass-card--no-hover', className), style: {
1426
1454
  ...baseStyles,
1427
1455
  ...customStyles,
1428
1456
  ...style
@@ -1460,13 +1488,14 @@ const Typography = require$$0.forwardRef(({ variant = 'body', size, as, children
1460
1488
  return (jsxRuntimeExports.jsx(Component, { ref: ref, className: cn('mds-text', `mds-text--${variant}`, `mds-text--size-${finalSize}`, `mds-text--color-${color}`, `mds-text--weight-${weight}`, className), ...props, children: children }));
1461
1489
  });
1462
1490
  Typography.displayName = 'Typography';
1463
- const BrandLogo = require$$0.forwardRef(({ size = 'md', className, children = 'Metropolle', ...props }, ref) => {
1491
+ const BrandLogo = require$$0.forwardRef(({ size = 'md', weight = 'bold', // Peso bold por padrão para a marca
1492
+ className, children = 'Metropolle', ...props }, ref) => {
1464
1493
  const sizeMap = {
1465
1494
  sm: '2xl',
1466
1495
  md: '4xl',
1467
1496
  lg: '4xl', // Same as md but with different mobile behavior
1468
1497
  };
1469
- return (jsxRuntimeExports.jsx(Typography, { ref: ref, variant: "brand", size: sizeMap[size], className: cn('mds-brand-logo', `mds-brand-logo--${size}`, className), ...props, children: children }));
1498
+ return (jsxRuntimeExports.jsx(Typography, { ref: ref, variant: "brand", size: sizeMap[size], weight: weight, className: cn('mds-brand-logo', `mds-brand-logo--${size}`, className), ...props, children: children }));
1470
1499
  });
1471
1500
  BrandLogo.displayName = 'BrandLogo';
1472
1501
 
@@ -1490,9 +1519,1132 @@ Button.displayName = 'Button';
1490
1519
  */
1491
1520
  const LoadingSpinner = () => (jsxRuntimeExports.jsxs("svg", { className: "mds-spinner", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [jsxRuntimeExports.jsx("circle", { className: "mds-spinner__track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2", fill: "none", opacity: "0.25" }), jsxRuntimeExports.jsx("circle", { className: "mds-spinner__path", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2", fill: "none", strokeDasharray: "40 20", strokeLinecap: "round" })] }));
1492
1521
 
1522
+ /**
1523
+ * Select Component (Design System)
1524
+ *
1525
+ * Custom dropdown select that renders consistently across all browsers.
1526
+ * Unlike native <select>, this component renders the dropdown via JavaScript,
1527
+ * ensuring proper theming support on Edge/Chrome Windows.
1528
+ *
1529
+ * @example
1530
+ * ```tsx
1531
+ * <Select
1532
+ * options={[
1533
+ * { label: 'Option 1', value: '1' },
1534
+ * { label: 'Option 2', value: '2' },
1535
+ * ]}
1536
+ * value={selectedValue}
1537
+ * onChange={setSelectedValue}
1538
+ * placeholder="Select an option..."
1539
+ * />
1540
+ * ```
1541
+ */
1542
+ const Select = require$$0.forwardRef(({ options, value, onChange, placeholder = 'Select...', variant = 'themed', size = 'md', disabled = false, loading = false, error = false, className, dropdownClassName, id, name, 'aria-label': ariaLabel, fullWidth = false, searchable = false, searchPlaceholder = 'Search...', maxHeight = 300, zIndex = 1050, }, ref) => {
1543
+ const [isOpen, setIsOpen] = require$$0.useState(false);
1544
+ const [searchTerm, setSearchTerm] = require$$0.useState('');
1545
+ const [highlightedIndex, setHighlightedIndex] = require$$0.useState(-1);
1546
+ const [mounted, setMounted] = require$$0.useState(false);
1547
+ const triggerRef = require$$0.useRef(null);
1548
+ const dropdownRef = require$$0.useRef(null);
1549
+ const searchInputRef = require$$0.useRef(null);
1550
+ const listRef = require$$0.useRef(null);
1551
+ // Combine refs
1552
+ const combinedRef = (el) => {
1553
+ triggerRef.current = el;
1554
+ if (typeof ref === 'function') {
1555
+ ref(el);
1556
+ }
1557
+ else if (ref) {
1558
+ ref.current = el;
1559
+ }
1560
+ };
1561
+ // Client-side only
1562
+ require$$0.useEffect(() => {
1563
+ setMounted(true);
1564
+ }, []);
1565
+ // Filter options based on search
1566
+ const filteredOptions = require$$0.useMemo(() => {
1567
+ if (!searchTerm)
1568
+ return options;
1569
+ const term = searchTerm.toLowerCase();
1570
+ return options.filter(opt => {
1571
+ const label = typeof opt.label === 'string' ? opt.label : String(opt.value);
1572
+ return label.toLowerCase().includes(term);
1573
+ });
1574
+ }, [options, searchTerm]);
1575
+ // Get selected option label
1576
+ const selectedOption = require$$0.useMemo(() => {
1577
+ return options.find(opt => opt.value === value);
1578
+ }, [options, value]);
1579
+ // Handle dropdown positioning
1580
+ const [dropdownPosition, setDropdownPosition] = require$$0.useState({ top: 0, left: 0, width: 0 });
1581
+ const updateDropdownPosition = require$$0.useCallback(() => {
1582
+ if (!triggerRef.current)
1583
+ return;
1584
+ const rect = triggerRef.current.getBoundingClientRect();
1585
+ const viewportHeight = window.innerHeight;
1586
+ const spaceBelow = viewportHeight - rect.bottom;
1587
+ const spaceAbove = rect.top;
1588
+ // Determine if dropdown should open above or below
1589
+ const dropdownHeight = Math.min(maxHeight, filteredOptions.length * 40 + (searchable ? 48 : 0));
1590
+ const openAbove = spaceBelow < dropdownHeight && spaceAbove > spaceBelow;
1591
+ setDropdownPosition({
1592
+ top: openAbove ? rect.top - dropdownHeight : rect.bottom + 4,
1593
+ left: rect.left,
1594
+ width: rect.width,
1595
+ });
1596
+ }, [maxHeight, filteredOptions.length, searchable]);
1597
+ // Open dropdown
1598
+ const openDropdown = require$$0.useCallback(() => {
1599
+ if (disabled || loading)
1600
+ return;
1601
+ updateDropdownPosition();
1602
+ setIsOpen(true);
1603
+ setSearchTerm('');
1604
+ setHighlightedIndex(value ? filteredOptions.findIndex(opt => opt.value === value) : 0);
1605
+ }, [disabled, loading, updateDropdownPosition, value, filteredOptions]);
1606
+ // Close dropdown
1607
+ const closeDropdown = require$$0.useCallback(() => {
1608
+ setIsOpen(false);
1609
+ setSearchTerm('');
1610
+ setHighlightedIndex(-1);
1611
+ triggerRef.current?.focus();
1612
+ }, []);
1613
+ // Handle option select
1614
+ const handleSelect = require$$0.useCallback((optionValue) => {
1615
+ // Safety check: ensure we're passing a string, not an object
1616
+ const safeValue = typeof optionValue === 'string' ? optionValue : String(optionValue);
1617
+ onChange?.(safeValue);
1618
+ closeDropdown();
1619
+ }, [onChange, closeDropdown]);
1620
+ // Keyboard navigation
1621
+ const handleKeyDown = require$$0.useCallback((e) => {
1622
+ if (disabled || loading)
1623
+ return;
1624
+ switch (e.key) {
1625
+ case 'Enter':
1626
+ case ' ':
1627
+ e.preventDefault();
1628
+ if (isOpen && highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
1629
+ const opt = filteredOptions[highlightedIndex];
1630
+ if (!opt.disabled) {
1631
+ handleSelect(opt.value);
1632
+ }
1633
+ }
1634
+ else if (!isOpen) {
1635
+ openDropdown();
1636
+ }
1637
+ break;
1638
+ case 'ArrowDown':
1639
+ e.preventDefault();
1640
+ if (!isOpen) {
1641
+ openDropdown();
1642
+ }
1643
+ else {
1644
+ setHighlightedIndex(prev => {
1645
+ const next = prev + 1;
1646
+ return next >= filteredOptions.length ? 0 : next;
1647
+ });
1648
+ }
1649
+ break;
1650
+ case 'ArrowUp':
1651
+ e.preventDefault();
1652
+ if (isOpen) {
1653
+ setHighlightedIndex(prev => {
1654
+ const next = prev - 1;
1655
+ return next < 0 ? filteredOptions.length - 1 : next;
1656
+ });
1657
+ }
1658
+ break;
1659
+ case 'Escape':
1660
+ e.preventDefault();
1661
+ closeDropdown();
1662
+ break;
1663
+ case 'Tab':
1664
+ if (isOpen) {
1665
+ closeDropdown();
1666
+ }
1667
+ break;
1668
+ case 'Home':
1669
+ if (isOpen) {
1670
+ e.preventDefault();
1671
+ setHighlightedIndex(0);
1672
+ }
1673
+ break;
1674
+ case 'End':
1675
+ if (isOpen) {
1676
+ e.preventDefault();
1677
+ setHighlightedIndex(filteredOptions.length - 1);
1678
+ }
1679
+ break;
1680
+ }
1681
+ }, [disabled, loading, isOpen, highlightedIndex, filteredOptions, handleSelect, openDropdown, closeDropdown]);
1682
+ // Click outside to close
1683
+ require$$0.useEffect(() => {
1684
+ if (!isOpen)
1685
+ return;
1686
+ const handleClickOutside = (e) => {
1687
+ if (triggerRef.current?.contains(e.target) ||
1688
+ dropdownRef.current?.contains(e.target)) {
1689
+ return;
1690
+ }
1691
+ closeDropdown();
1692
+ };
1693
+ document.addEventListener('mousedown', handleClickOutside);
1694
+ return () => document.removeEventListener('mousedown', handleClickOutside);
1695
+ }, [isOpen, closeDropdown]);
1696
+ // Update position on scroll/resize
1697
+ require$$0.useEffect(() => {
1698
+ if (!isOpen)
1699
+ return;
1700
+ const handleUpdate = () => updateDropdownPosition();
1701
+ window.addEventListener('scroll', handleUpdate, true);
1702
+ window.addEventListener('resize', handleUpdate);
1703
+ return () => {
1704
+ window.removeEventListener('scroll', handleUpdate, true);
1705
+ window.removeEventListener('resize', handleUpdate);
1706
+ };
1707
+ }, [isOpen, updateDropdownPosition]);
1708
+ // Focus search input when dropdown opens
1709
+ require$$0.useEffect(() => {
1710
+ if (isOpen && searchable && searchInputRef.current) {
1711
+ searchInputRef.current.focus();
1712
+ }
1713
+ }, [isOpen, searchable]);
1714
+ // Scroll highlighted option into view
1715
+ require$$0.useEffect(() => {
1716
+ if (!isOpen || highlightedIndex < 0 || !listRef.current)
1717
+ return;
1718
+ const highlighted = listRef.current.children[highlightedIndex];
1719
+ if (highlighted) {
1720
+ highlighted.scrollIntoView({ block: 'nearest' });
1721
+ }
1722
+ }, [isOpen, highlightedIndex]);
1723
+ // Size classes
1724
+ const sizeClasses = {
1725
+ sm: 'mds-select--sm',
1726
+ md: 'mds-select--md',
1727
+ lg: 'mds-select--lg',
1728
+ };
1729
+ // Variant classes
1730
+ const variantClasses = {
1731
+ base: 'mds-select--base',
1732
+ themed: 'mds-select--themed',
1733
+ dashboard: 'mds-select--themed',
1734
+ };
1735
+ const triggerClasses = cn('mds-select-trigger', sizeClasses[size], variantClasses[variant], isOpen && 'mds-select-trigger--open', disabled && 'mds-select-trigger--disabled', loading && 'mds-select-trigger--loading', error && 'mds-select-trigger--error', fullWidth && 'mds-select-trigger--full-width', className);
1736
+ const dropdownClasses = cn('mds-select-dropdown', variantClasses[variant], dropdownClassName);
1737
+ // Hidden input for form submission
1738
+ const hiddenInput = name ? (jsxRuntimeExports.jsx("input", { type: "hidden", name: name, value: value || '' })) : null;
1739
+ // Dropdown portal content
1740
+ const dropdownContent = isOpen && mounted ? reactDom.createPortal(jsxRuntimeExports.jsxs("div", { ref: dropdownRef, className: dropdownClasses, style: {
1741
+ position: 'fixed',
1742
+ top: dropdownPosition.top,
1743
+ left: dropdownPosition.left,
1744
+ width: dropdownPosition.width,
1745
+ maxHeight,
1746
+ zIndex,
1747
+ }, role: "listbox", "aria-label": ariaLabel || placeholder, children: [searchable && (jsxRuntimeExports.jsxs("div", { className: "mds-select-search", children: [jsxRuntimeExports.jsx("input", { ref: searchInputRef, type: "text", className: "mds-select-search__input", placeholder: searchPlaceholder, value: searchTerm, onChange: (e) => {
1748
+ setSearchTerm(e.target.value);
1749
+ setHighlightedIndex(0);
1750
+ }, onKeyDown: handleKeyDown, "aria-label": "Search options" }), jsxRuntimeExports.jsx("svg", { className: "mds-select-search__icon", viewBox: "0 0 20 20", fill: "currentColor", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z", clipRule: "evenodd" }) })] })), jsxRuntimeExports.jsx("ul", { ref: listRef, className: "mds-select-options", children: filteredOptions.length === 0 ? (jsxRuntimeExports.jsx("li", { className: "mds-select-option mds-select-option--empty", children: "No options found" })) : (filteredOptions.map((option, index) => (jsxRuntimeExports.jsxs("li", { className: cn('mds-select-option', option.value === value && 'mds-select-option--selected', index === highlightedIndex && 'mds-select-option--highlighted', option.disabled && 'mds-select-option--disabled'), role: "option", "aria-selected": option.value === value, "aria-disabled": option.disabled, onClick: () => {
1751
+ if (!option.disabled) {
1752
+ handleSelect(option.value);
1753
+ }
1754
+ }, onMouseEnter: () => {
1755
+ if (!option.disabled) {
1756
+ setHighlightedIndex(index);
1757
+ }
1758
+ }, children: [jsxRuntimeExports.jsx("span", { className: "mds-select-option__label", children: option.label }), option.value === value && (jsxRuntimeExports.jsx("svg", { className: "mds-select-option__check", viewBox: "0 0 20 20", fill: "currentColor", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", clipRule: "evenodd" }) }))] }, option.value)))) })] }), document.body) : null;
1759
+ return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [hiddenInput, jsxRuntimeExports.jsxs("button", { ref: combinedRef, type: "button", id: id, className: triggerClasses, onClick: () => isOpen ? closeDropdown() : openDropdown(), onKeyDown: handleKeyDown, disabled: disabled || loading, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-label": ariaLabel, "aria-invalid": error, children: [jsxRuntimeExports.jsx("span", { className: cn('mds-select-trigger__value', !selectedOption && 'mds-select-trigger__placeholder'), children: loading ? 'Loading...' : (selectedOption?.label || placeholder) }), jsxRuntimeExports.jsx("span", { className: "mds-select-trigger__icon", children: loading ? (jsxRuntimeExports.jsx("svg", { className: "mds-select-spinner", viewBox: "0 0 24 24", fill: "none", children: jsxRuntimeExports.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeDasharray: "32", strokeDashoffset: "32", children: jsxRuntimeExports.jsx("animate", { attributeName: "stroke-dashoffset", values: "32;0", dur: "1s", repeatCount: "indefinite" }) }) })) : (jsxRuntimeExports.jsx("svg", { className: "mds-select-chevron", viewBox: "0 0 20 20", fill: "currentColor", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }) })) })] }), dropdownContent] }));
1760
+ });
1761
+ Select.displayName = 'Select';
1762
+
1763
+ function ThemeToggle({ size = 'md', className = '', disabled = false, onChange, storageKey = 'theme' }) {
1764
+ const [theme, setTheme] = require$$0.useState('dark');
1765
+ const [mounted, setMounted] = require$$0.useState(false);
1766
+ // Initialize theme on mount
1767
+ require$$0.useEffect(() => {
1768
+ try {
1769
+ if (typeof window !== 'undefined') {
1770
+ const savedTheme = localStorage.getItem(storageKey) || 'dark';
1771
+ setTheme(savedTheme);
1772
+ document.documentElement.setAttribute('data-theme', savedTheme);
1773
+ setMounted(true);
1774
+ }
1775
+ }
1776
+ catch (err) {
1777
+ setTheme('dark');
1778
+ setMounted(true);
1779
+ }
1780
+ }, [storageKey]);
1781
+ // Listen to external theme changes
1782
+ require$$0.useEffect(() => {
1783
+ if (typeof window !== 'undefined') {
1784
+ const updateTheme = () => {
1785
+ const currentTheme = document.documentElement.getAttribute('data-theme') || 'dark';
1786
+ setTheme(currentTheme);
1787
+ };
1788
+ const observer = new MutationObserver(() => {
1789
+ updateTheme();
1790
+ });
1791
+ observer.observe(document.documentElement, {
1792
+ attributes: true,
1793
+ attributeFilter: ['data-theme']
1794
+ });
1795
+ return () => observer.disconnect();
1796
+ }
1797
+ }, []);
1798
+ const toggleTheme = () => {
1799
+ if (disabled)
1800
+ return;
1801
+ try {
1802
+ const newTheme = theme === 'light' ? 'dark' : 'light';
1803
+ document.documentElement.setAttribute('data-theme', newTheme);
1804
+ localStorage.setItem(storageKey, newTheme);
1805
+ setTheme(newTheme);
1806
+ onChange?.(newTheme);
1807
+ }
1808
+ catch (err) {
1809
+ console.warn('Failed to toggle theme:', err);
1810
+ }
1811
+ };
1812
+ // Don't render until mounted (prevents hydration mismatch)
1813
+ if (!mounted) {
1814
+ return (jsxRuntimeExports.jsx("div", { className: `mds-theme-toggle mds-theme-toggle--${size} ${className}`, style: { opacity: 0.5 }, "aria-hidden": "true" }));
1815
+ }
1816
+ const isDark = theme === 'dark';
1817
+ const buttonStyle = isDark
1818
+ ? {
1819
+ backgroundColor: 'rgba(0, 0, 0, 0.35)',
1820
+ border: '1px solid rgba(255, 255, 255, 0.18)',
1821
+ boxShadow: '0 2px 8px rgba(0, 0, 0, 0.3)'
1822
+ }
1823
+ : undefined;
1824
+ const buttonClasses = [
1825
+ 'mds-theme-toggle',
1826
+ `mds-theme-toggle--${size}`,
1827
+ className
1828
+ ].filter(Boolean).join(' ');
1829
+ 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 }));
1830
+ }
1831
+
1832
+ const TableHeader = ({ columns, gridTemplate, onSort, sortColumn, sortDirection }) => {
1833
+ return (jsxRuntimeExports.jsx("div", { role: "rowgroup", style: {
1834
+ display: 'grid',
1835
+ gridTemplateColumns: gridTemplate,
1836
+ gap: '16px',
1837
+ padding: '16px 20px',
1838
+ borderBottom: '1px solid var(--border-color)',
1839
+ backgroundColor: 'rgba(255, 255, 255, 0.05)'
1840
+ }, children: columns.map((column) => (jsxRuntimeExports.jsxs("div", { role: "columnheader", style: {
1841
+ color: 'var(--text-primary)',
1842
+ fontWeight: '500',
1843
+ fontSize: '14px',
1844
+ display: 'flex',
1845
+ alignItems: 'center',
1846
+ justifyContent: column.align === 'center' ? 'center' :
1847
+ column.align === 'right' ? 'flex-end' : 'flex-start',
1848
+ cursor: column.sortable && onSort ? 'pointer' : 'default',
1849
+ gap: '4px',
1850
+ transition: 'color 0.2s ease'
1851
+ }, onClick: () => column.sortable && onSort && onSort(column.key), onMouseEnter: (e) => {
1852
+ if (column.sortable && onSort) {
1853
+ e.currentTarget.style.color = '#ffffff';
1854
+ }
1855
+ }, onMouseLeave: (e) => {
1856
+ e.currentTarget.style.color = 'var(--text-primary)';
1857
+ }, children: [column.label, column.sortable && onSort && (jsxRuntimeExports.jsx("span", { style: {
1858
+ fontSize: '12px',
1859
+ opacity: sortColumn === column.key ? 1 : 0.5
1860
+ }, children: sortColumn === column.key ?
1861
+ (sortDirection === 'asc' ? '↑' : '↓') : '↕' }))] }, column.key))) }));
1862
+ };
1863
+
1864
+ const TableRow = ({ item, index, columns, actions = [], gridTemplate, isLast, variant, onActionClick }) => {
1865
+ return (jsxRuntimeExports.jsxs("div", { role: "row", style: {
1866
+ display: 'grid',
1867
+ gridTemplateColumns: gridTemplate,
1868
+ gap: '16px',
1869
+ padding: variant === 'compact' ? '12px 20px' : '16px 20px',
1870
+ borderBottom: isLast ? 'none' : '1px solid var(--border-color)',
1871
+ backgroundColor: 'transparent',
1872
+ transition: 'background-color 0.2s ease'
1873
+ }, onMouseEnter: (e) => {
1874
+ e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.05)';
1875
+ }, onMouseLeave: (e) => {
1876
+ e.currentTarget.style.backgroundColor = 'transparent';
1877
+ }, children: [columns.map((column) => (jsxRuntimeExports.jsx("div", { role: "cell", style: {
1878
+ display: 'flex',
1879
+ flexDirection: 'column',
1880
+ gap: '4px',
1881
+ justifyContent: 'center',
1882
+ alignItems: column.align === 'center' ? 'center' :
1883
+ column.align === 'right' ? 'flex-end' : 'flex-start'
1884
+ }, children: column.render ?
1885
+ column.render(item[column.key], item, index) :
1886
+ jsxRuntimeExports.jsx("div", { style: {
1887
+ color: 'var(--text-primary)',
1888
+ fontSize: '14px'
1889
+ }, children: item[column.key] }) }, column.key))), actions.length > 0 && (jsxRuntimeExports.jsx("div", { role: "cell", style: {
1890
+ display: 'flex',
1891
+ gap: '8px',
1892
+ justifyContent: 'center',
1893
+ alignItems: 'center'
1894
+ }, children: actions.map((action) => {
1895
+ const isDisabled = action.disabled?.(item) || false;
1896
+ const isLoading = action.loading?.(item) || false;
1897
+ return (jsxRuntimeExports.jsxs("button", { onClick: () => !isDisabled && !isLoading && onActionClick(action, item), disabled: isDisabled || isLoading, style: {
1898
+ background: 'none',
1899
+ border: action.variant === 'danger' ? '1px solid rgba(239, 68, 68, 0.3)' :
1900
+ '1px solid var(--border-color)',
1901
+ borderRadius: '6px',
1902
+ padding: '6px 12px',
1903
+ color: action.variant === 'danger' ? '#f87171' : 'var(--text-primary)',
1904
+ fontSize: '12px',
1905
+ cursor: isDisabled || isLoading ? 'not-allowed' : 'pointer',
1906
+ display: 'flex',
1907
+ alignItems: 'center',
1908
+ gap: '4px',
1909
+ transition: 'all 0.2s ease',
1910
+ opacity: isDisabled || isLoading ? 0.5 : 1,
1911
+ whiteSpace: 'nowrap'
1912
+ }, onMouseEnter: (e) => {
1913
+ if (!isDisabled && !isLoading) {
1914
+ if (action.variant === 'danger') {
1915
+ e.currentTarget.style.backgroundColor = 'rgba(239, 68, 68, 0.1)';
1916
+ e.currentTarget.style.borderColor = 'rgba(239, 68, 68, 0.5)';
1917
+ }
1918
+ else {
1919
+ e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
1920
+ e.currentTarget.style.borderColor = 'var(--text-primary)';
1921
+ }
1922
+ }
1923
+ }, onMouseLeave: (e) => {
1924
+ if (!isDisabled && !isLoading) {
1925
+ e.currentTarget.style.backgroundColor = 'transparent';
1926
+ e.currentTarget.style.borderColor = action.variant === 'danger' ?
1927
+ 'rgba(239, 68, 68, 0.3)' : 'var(--border-color)';
1928
+ }
1929
+ }, children: [action.icon && action.icon, action.label] }, action.key));
1930
+ }) }))] }));
1931
+ };
1932
+
1933
+ 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 }) => {
1934
+ const [sortColumn, setSortColumn] = require$$0.useState('');
1935
+ const [sortDirection, setSortDirection] = require$$0.useState('asc');
1936
+ // Filter data based on search term
1937
+ const filteredData = require$$0.useMemo(() => {
1938
+ if (!searchTerm)
1939
+ return data;
1940
+ return data.filter(item => {
1941
+ return columns.some(column => {
1942
+ const value = item[column.key];
1943
+ if (value === null || value === undefined)
1944
+ return false;
1945
+ return String(value).toLowerCase().includes(searchTerm.toLowerCase());
1946
+ });
1947
+ });
1948
+ }, [data, searchTerm, columns]);
1949
+ // Generate grid template based on columns and actions
1950
+ const gridTemplate = require$$0.useMemo(() => {
1951
+ const columnWidths = columns.map(col => col.width || '1fr').join(' ');
1952
+ const actionsWidth = actions.length > 0 ? ' 120px' : '';
1953
+ return columnWidths + actionsWidth;
1954
+ }, [columns, actions]);
1955
+ // Handle sort
1956
+ const handleSort = (columnKey) => {
1957
+ let direction = 'asc';
1958
+ if (sortColumn === columnKey && sortDirection === 'asc') {
1959
+ direction = 'desc';
1960
+ }
1961
+ setSortColumn(columnKey);
1962
+ setSortDirection(direction);
1963
+ if (onSort) {
1964
+ onSort(columnKey, direction);
1965
+ }
1966
+ };
1967
+ // Handle action click
1968
+ const handleActionClick = (action, item) => {
1969
+ action.onClick(item);
1970
+ };
1971
+ // Loading state
1972
+ if (loading) {
1973
+ return (jsxRuntimeExports.jsx("div", { className: className, style: {
1974
+ position: 'relative',
1975
+ borderRadius: '24px',
1976
+ backdropFilter: 'blur(24px)',
1977
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
1978
+ border: '1px solid rgba(255, 255, 255, 0.3)',
1979
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
1980
+ padding: '32px',
1981
+ ...style
1982
+ }, children: jsxRuntimeExports.jsxs("div", { style: {
1983
+ display: 'flex',
1984
+ alignItems: 'center',
1985
+ justifyContent: 'center',
1986
+ gap: '12px'
1987
+ }, children: [jsxRuntimeExports.jsx("div", { style: {
1988
+ width: '32px',
1989
+ height: '32px',
1990
+ border: '2px solid transparent',
1991
+ borderTop: '2px solid white',
1992
+ borderRadius: '50%',
1993
+ animation: 'spin 1s linear infinite'
1994
+ } }), jsxRuntimeExports.jsx("span", { style: { color: 'var(--text-primary)' }, children: loadingMessage })] }) }));
1995
+ }
1996
+ // Empty state
1997
+ if (filteredData.length === 0) {
1998
+ return (jsxRuntimeExports.jsx("div", { className: className, style: {
1999
+ position: 'relative',
2000
+ borderRadius: '24px',
2001
+ backdropFilter: 'blur(24px)',
2002
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
2003
+ border: '1px solid rgba(255, 255, 255, 0.3)',
2004
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
2005
+ padding: '40px',
2006
+ textAlign: 'center',
2007
+ ...style
2008
+ }, children: jsxRuntimeExports.jsx("div", { style: {
2009
+ color: 'var(--text-secondary)',
2010
+ fontSize: '16px'
2011
+ }, children: emptyMessage }) }));
2012
+ }
2013
+ return (jsxRuntimeExports.jsxs("div", { className: className, style: {
2014
+ position: 'relative',
2015
+ borderRadius: '24px',
2016
+ backdropFilter: 'blur(24px)',
2017
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
2018
+ border: '1px solid rgba(255, 255, 255, 0.3)',
2019
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
2020
+ overflow: 'hidden',
2021
+ ...style
2022
+ }, role: "table", "aria-label": "Tabela de dados", children: [showSearchCount && searchTerm && (jsxRuntimeExports.jsxs("div", { style: {
2023
+ padding: '16px',
2024
+ color: 'var(--text-secondary)',
2025
+ fontSize: '14px',
2026
+ borderBottom: '1px solid var(--border-color)'
2027
+ }, 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: {
2028
+ maxHeight,
2029
+ overflowY: 'auto'
2030
+ }, 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))) })] }));
2031
+ };
2032
+
2033
+ const CellRenderers = {
2034
+ // ID cell - monospace background
2035
+ id: (value) => (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
2036
+ color: 'var(--text-secondary)',
2037
+ fontSize: '12px',
2038
+ backgroundColor: 'rgba(255, 255, 255, 0.05)',
2039
+ padding: '2px 8px',
2040
+ borderRadius: '4px',
2041
+ textAlign: 'center',
2042
+ fontFamily: 'monospace'
2043
+ }, children: value })),
2044
+ // Name cell - primary text with background
2045
+ name: (value) => (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
2046
+ color: 'var(--text-primary)',
2047
+ fontSize: '14px',
2048
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
2049
+ padding: '4px 12px',
2050
+ borderRadius: '8px',
2051
+ fontFamily: 'monospace'
2052
+ }, children: value })),
2053
+ // Parameter value - masked if secure
2054
+ parameterValue: (value, item) => {
2055
+ const displayValue = item.type === 'SecureString' ? '••••••••' :
2056
+ (value?.length > 50 ? `${value.substring(0, 50)}...` : value);
2057
+ return (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
2058
+ color: 'var(--text-primary)',
2059
+ fontSize: '14px',
2060
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
2061
+ borderRadius: '8px',
2062
+ maxWidth: '300px',
2063
+ wordBreak: 'break-all',
2064
+ padding: '4px 12px',
2065
+ fontFamily: 'monospace'
2066
+ }, children: displayValue }));
2067
+ },
2068
+ // Badge renderer for types/statuses
2069
+ badge: (value, variant = 'primary') => (jsxRuntimeExports.jsx("span", { className: `data-table-badge ${variant}`, children: value })),
2070
+ // Parameter type badge
2071
+ parameterType: (value) => {
2072
+ const variant = value === 'SecureString' ? 'danger' :
2073
+ value === 'StringList' ? 'success' : 'primary';
2074
+ return CellRenderers.badge(value, variant);
2075
+ },
2076
+ // Environment badge
2077
+ environment: (value, item) => {
2078
+ const env = item.name?.includes('/prod/') ? 'PROD' : 'DEV';
2079
+ const variant = env === 'PROD' ? 'info' : 'warning';
2080
+ return CellRenderers.badge(env, variant);
2081
+ },
2082
+ // Action type badge for audit logs
2083
+ actionType: (value) => {
2084
+ const variant = value === 'CREATE' ? 'success' :
2085
+ value === 'UPDATE' ? 'primary' : 'danger';
2086
+ return CellRenderers.badge(value, variant);
2087
+ },
2088
+ // Date formatter
2089
+ date: (value) => (jsxRuntimeExports.jsx("div", { style: {
2090
+ color: 'var(--text-primary)',
2091
+ fontSize: '14px'
2092
+ }, children: value ? new Date(value).toLocaleString('pt-BR') : '-' })),
2093
+ // Description/secondary text
2094
+ description: (value) => (jsxRuntimeExports.jsx("div", { style: {
2095
+ color: 'var(--text-secondary)',
2096
+ fontSize: '12px',
2097
+ maxWidth: '300px',
2098
+ overflow: 'hidden',
2099
+ textOverflow: 'ellipsis',
2100
+ whiteSpace: 'nowrap'
2101
+ }, children: value })),
2102
+ // JSON preview for audit changes
2103
+ jsonPreview: (value) => {
2104
+ const jsonString = JSON.stringify(value);
2105
+ const preview = jsonString.length > 30 ? jsonString.substring(0, 30) + '...' : jsonString;
2106
+ return (jsxRuntimeExports.jsx("div", { style: {
2107
+ color: 'var(--text-secondary)',
2108
+ fontSize: '12px',
2109
+ fontFamily: 'monospace',
2110
+ maxWidth: '150px',
2111
+ overflow: 'hidden',
2112
+ textOverflow: 'ellipsis',
2113
+ whiteSpace: 'nowrap'
2114
+ }, children: preview }));
2115
+ },
2116
+ // Combined cell with main value and description
2117
+ combined: (mainValue, description) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [CellRenderers.name(mainValue), description && CellRenderers.description(description)] })),
2118
+ // Combined with badges
2119
+ 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))) })] }))
2120
+ };
2121
+ // Common action icons
2122
+ const ActionIcons = {
2123
+ 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" }) })),
2124
+ 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" }) })),
2125
+ 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" }) })),
2126
+ 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" }) }))
2127
+ };
2128
+
2129
+ // Configuração para ParametersTable (Settings)
2130
+ const parametersTableConfig = {
2131
+ columns: [
2132
+ {
2133
+ key: 'name',
2134
+ label: 'Parâmetro',
2135
+ width: '1fr',
2136
+ render: (value, item) => CellRenderers.combinedWithBadges(value, [
2137
+ { value: item.type, variant: item.type === 'SecureString' ? 'danger' :
2138
+ item.type === 'StringList' ? 'success' : 'primary' },
2139
+ { value: item.name.includes('/prod/') ? 'PROD' : 'DEV',
2140
+ variant: item.name.includes('/prod/') ? 'info' : 'warning' }
2141
+ ])
2142
+ },
2143
+ {
2144
+ key: 'value',
2145
+ label: 'Valor',
2146
+ width: '2fr',
2147
+ render: (value, item) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [CellRenderers.parameterValue(value, item), CellRenderers.description(item.description)] }))
2148
+ }
2149
+ ],
2150
+ actions: [
2151
+ {
2152
+ key: 'edit',
2153
+ label: '✏️',
2154
+ variant: 'secondary',
2155
+ onClick: (item) => console.log('Edit', item),
2156
+ disabled: (item) => false
2157
+ },
2158
+ {
2159
+ key: 'delete',
2160
+ label: '🗑️',
2161
+ variant: 'danger',
2162
+ onClick: (item) => console.log('Delete', item),
2163
+ disabled: (item) => false,
2164
+ loading: (item) => item.deleting || false
2165
+ }
2166
+ ]
2167
+ };
2168
+ // Configuração para GeographyTable - Regions
2169
+ const regionsTableConfig = {
2170
+ columns: [
2171
+ {
2172
+ key: 'region_id',
2173
+ label: 'ID',
2174
+ width: '80px',
2175
+ render: CellRenderers.id
2176
+ },
2177
+ {
2178
+ key: 'name',
2179
+ label: 'Nome',
2180
+ width: '1fr',
2181
+ render: CellRenderers.name
2182
+ },
2183
+ {
2184
+ key: 'code',
2185
+ label: 'Código',
2186
+ width: '120px',
2187
+ render: CellRenderers.name
2188
+ },
2189
+ {
2190
+ key: 'created_at',
2191
+ label: 'Criado em',
2192
+ width: '140px',
2193
+ render: CellRenderers.date
2194
+ },
2195
+ {
2196
+ key: 'created_by',
2197
+ label: 'Criado por',
2198
+ width: '140px',
2199
+ render: (value) => CellRenderers.name(value)
2200
+ }
2201
+ ],
2202
+ actions: [
2203
+ {
2204
+ key: 'edit',
2205
+ label: '✏️',
2206
+ variant: 'secondary',
2207
+ onClick: (item) => console.log('Edit region', item)
2208
+ },
2209
+ {
2210
+ key: 'delete',
2211
+ label: '🗑️',
2212
+ variant: 'danger',
2213
+ onClick: (item) => console.log('Delete region', item),
2214
+ loading: (item) => item.deleting || false
2215
+ }
2216
+ ]
2217
+ };
2218
+ // Configuração para GeographyTable - Countries
2219
+ const countriesTableConfig = {
2220
+ columns: [
2221
+ {
2222
+ key: 'country_id',
2223
+ label: 'ID',
2224
+ width: '80px',
2225
+ render: CellRenderers.id
2226
+ },
2227
+ {
2228
+ key: 'name',
2229
+ label: 'Nome',
2230
+ width: '1fr',
2231
+ render: CellRenderers.name
2232
+ },
2233
+ {
2234
+ key: 'iso2',
2235
+ label: 'Código',
2236
+ width: '120px',
2237
+ render: (value, item) => CellRenderers.combinedWithBadges(value, [
2238
+ { value: item.iso3, variant: 'primary' }
2239
+ ])
2240
+ },
2241
+ {
2242
+ key: 'capital',
2243
+ label: 'Capital',
2244
+ width: '140px',
2245
+ render: CellRenderers.name
2246
+ },
2247
+ {
2248
+ key: 'region',
2249
+ label: 'Região',
2250
+ width: '120px',
2251
+ render: (value) => CellRenderers.badge(value, 'info')
2252
+ }
2253
+ ],
2254
+ actions: [
2255
+ {
2256
+ key: 'edit',
2257
+ label: '✏️',
2258
+ variant: 'secondary',
2259
+ onClick: (item) => console.log('Edit country', item)
2260
+ },
2261
+ {
2262
+ key: 'delete',
2263
+ label: '🗑️',
2264
+ variant: 'danger',
2265
+ onClick: (item) => console.log('Delete country', item)
2266
+ }
2267
+ ]
2268
+ };
2269
+ // Configuração para Audit Log
2270
+ const auditLogTableConfig = {
2271
+ columns: [
2272
+ {
2273
+ key: 'timestamp',
2274
+ label: 'Data/Hora',
2275
+ width: '140px',
2276
+ render: CellRenderers.date
2277
+ },
2278
+ {
2279
+ key: 'user_email',
2280
+ label: 'Usuário',
2281
+ width: '180px',
2282
+ render: CellRenderers.name
2283
+ },
2284
+ {
2285
+ key: 'action',
2286
+ label: 'Ação',
2287
+ width: '100px',
2288
+ render: CellRenderers.actionType
2289
+ },
2290
+ {
2291
+ key: 'entity_type',
2292
+ label: 'Tipo',
2293
+ width: '120px',
2294
+ render: (value) => CellRenderers.badge(value, 'primary')
2295
+ },
2296
+ {
2297
+ key: 'entity_id',
2298
+ label: 'ID',
2299
+ width: '120px',
2300
+ render: CellRenderers.description
2301
+ },
2302
+ {
2303
+ key: 'changes',
2304
+ label: 'Alterações',
2305
+ width: '1fr',
2306
+ 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: {
2307
+ background: 'none',
2308
+ border: '1px solid var(--border-color)',
2309
+ borderRadius: '4px',
2310
+ padding: '4px 8px',
2311
+ color: 'var(--text-primary)',
2312
+ fontSize: '12px',
2313
+ cursor: 'pointer',
2314
+ display: 'flex',
2315
+ alignItems: 'center',
2316
+ gap: '4px',
2317
+ transition: 'all 0.2s ease',
2318
+ whiteSpace: 'nowrap'
2319
+ }, children: [ActionIcons.view, "Ver Detalhes"] })] }))
2320
+ }
2321
+ ]
2322
+ };
2323
+ // Configuração para States
2324
+ const statesTableConfig = {
2325
+ columns: [
2326
+ {
2327
+ key: 'state_id',
2328
+ label: 'ID',
2329
+ width: '80px',
2330
+ render: CellRenderers.id
2331
+ },
2332
+ {
2333
+ key: 'name',
2334
+ label: 'Nome',
2335
+ width: '1fr',
2336
+ render: CellRenderers.name
2337
+ },
2338
+ {
2339
+ key: 'code',
2340
+ label: 'Código',
2341
+ width: '120px',
2342
+ render: CellRenderers.name
2343
+ },
2344
+ {
2345
+ key: 'country_name',
2346
+ label: 'País',
2347
+ width: '140px',
2348
+ render: (value) => CellRenderers.badge(value, 'info')
2349
+ }
2350
+ ],
2351
+ actions: [
2352
+ {
2353
+ key: 'edit',
2354
+ label: '✏️',
2355
+ variant: 'secondary',
2356
+ onClick: (item) => console.log('Edit state', item)
2357
+ },
2358
+ {
2359
+ key: 'delete',
2360
+ label: '🗑️',
2361
+ variant: 'danger',
2362
+ onClick: (item) => console.log('Delete state', item)
2363
+ }
2364
+ ]
2365
+ };
2366
+ // Configuração para Cities
2367
+ const citiesTableConfig = {
2368
+ columns: [
2369
+ {
2370
+ key: 'city_id',
2371
+ label: 'ID',
2372
+ width: '80px',
2373
+ render: CellRenderers.id
2374
+ },
2375
+ {
2376
+ key: 'name',
2377
+ label: 'Nome',
2378
+ width: '1fr',
2379
+ render: CellRenderers.name
2380
+ },
2381
+ {
2382
+ key: 'population',
2383
+ label: 'População',
2384
+ width: '120px',
2385
+ render: (value) => (jsxRuntimeExports.jsx("div", { style: { color: 'var(--text-primary)', fontSize: '14px' }, children: value ? value.toLocaleString('pt-BR') : '-' }))
2386
+ },
2387
+ {
2388
+ key: 'state_name',
2389
+ label: 'Estado',
2390
+ width: '140px',
2391
+ render: (value) => CellRenderers.badge(value, 'success')
2392
+ },
2393
+ {
2394
+ key: 'country_name',
2395
+ label: 'País',
2396
+ width: '120px',
2397
+ render: (value) => CellRenderers.badge(value, 'info')
2398
+ }
2399
+ ],
2400
+ actions: [
2401
+ {
2402
+ key: 'edit',
2403
+ label: '✏️',
2404
+ variant: 'secondary',
2405
+ onClick: (item) => console.log('Edit city', item)
2406
+ },
2407
+ {
2408
+ key: 'delete',
2409
+ label: '🗑️',
2410
+ variant: 'danger',
2411
+ onClick: (item) => console.log('Delete city', item)
2412
+ }
2413
+ ]
2414
+ };
2415
+ // Função helper para aplicar configuração baseada no tipo
2416
+ const getTableConfig = (type) => {
2417
+ switch (type) {
2418
+ case 'parameters':
2419
+ return parametersTableConfig;
2420
+ case 'regions':
2421
+ return regionsTableConfig;
2422
+ case 'countries':
2423
+ return countriesTableConfig;
2424
+ case 'states':
2425
+ return statesTableConfig;
2426
+ case 'cities':
2427
+ return citiesTableConfig;
2428
+ case 'audit':
2429
+ return auditLogTableConfig;
2430
+ default:
2431
+ return parametersTableConfig;
2432
+ }
2433
+ };
2434
+
2435
+ /**
2436
+ * Theme-aware styles generator - Liquid Glass pattern
2437
+ *
2438
+ * Light theme: White semi-transparent overlay to keep background bright
2439
+ * Dark theme: Dark overlay for contrast
2440
+ */
2441
+ function getStyles(isDark) {
2442
+ return {
2443
+ // Overlay behind the modal
2444
+ overlay: {
2445
+ position: 'fixed',
2446
+ inset: 0,
2447
+ zIndex: 9999,
2448
+ display: 'flex',
2449
+ alignItems: 'center',
2450
+ justifyContent: 'center',
2451
+ padding: 20,
2452
+ // Light theme: white overlay to keep brightness
2453
+ // Dark theme: dark overlay for contrast
2454
+ backgroundColor: isDark ? 'rgba(0, 0, 0, 0.6)' : 'rgba(255, 255, 255, 0.4)',
2455
+ backdropFilter: 'blur(8px)',
2456
+ WebkitBackdropFilter: 'blur(8px)',
2457
+ },
2458
+ // Modal card - Liquid Glass
2459
+ card: {
2460
+ position: 'relative',
2461
+ maxWidth: 640,
2462
+ width: '100%',
2463
+ borderRadius: 24,
2464
+ overflow: 'hidden',
2465
+ // Light theme: Liquid Glass transparency
2466
+ // Dark theme: subtle glass effect
2467
+ background: isDark
2468
+ ? 'rgba(255, 255, 255, 0.03)'
2469
+ : 'rgba(255, 255, 255, 0.55)',
2470
+ // Liquid Glass: Strong blur + saturation
2471
+ backdropFilter: 'blur(var(--mds-liquid-blur-xl, 24px)) saturate(var(--mds-liquid-saturate-vibrant, 140%))',
2472
+ WebkitBackdropFilter: 'blur(var(--mds-liquid-blur-xl, 24px)) saturate(var(--mds-liquid-saturate-vibrant, 140%))',
2473
+ // Liquid Glass: Subtle border for edge definition
2474
+ border: isDark
2475
+ ? '1px solid rgba(255, 255, 255, 0.08)'
2476
+ : '1px solid rgba(255, 255, 255, 0.9)',
2477
+ // Liquid Glass: Layered shadows + inner glow
2478
+ boxShadow: isDark
2479
+ ? 'var(--mds-liquid-shadow-elevated, 0 12px 40px rgba(0, 0, 0, 0.3)), var(--mds-liquid-glow-edge, inset 0 1px 0 rgba(255, 255, 255, 0.1))'
2480
+ : '0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 1)',
2481
+ // Liquid Glass: Smooth transition
2482
+ transition: 'var(--mds-liquid-transition, all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1))',
2483
+ },
2484
+ };
2485
+ }
2486
+ function Modal({ open, onClose, closeOnOverlay = true, children, className, style }) {
2487
+ const [mounted, setMounted] = require$$0.useState(false);
2488
+ const [visible, setVisible] = require$$0.useState(false);
2489
+ const [renderPortal, setRenderPortal] = require$$0.useState(false);
2490
+ const [isDarkTheme, setIsDarkTheme] = require$$0.useState(true);
2491
+ const containerRef = require$$0.useRef(null);
2492
+ require$$0.useEffect(() => setMounted(true), []);
2493
+ // Detect theme - EXACT same pattern as ProfileCard.tsx
2494
+ require$$0.useEffect(() => {
2495
+ const checkTheme = () => {
2496
+ const theme = document.documentElement.getAttribute('data-theme');
2497
+ setIsDarkTheme(theme !== 'light');
2498
+ };
2499
+ checkTheme();
2500
+ // Watch for theme changes
2501
+ const observer = new MutationObserver((mutations) => {
2502
+ mutations.forEach((mutation) => {
2503
+ if (mutation.attributeName === 'data-theme') {
2504
+ checkTheme();
2505
+ }
2506
+ });
2507
+ });
2508
+ observer.observe(document.documentElement, { attributes: true });
2509
+ return () => observer.disconnect();
2510
+ }, []);
2511
+ require$$0.useEffect(() => {
2512
+ if (!mounted)
2513
+ return;
2514
+ if (open) {
2515
+ setVisible(true);
2516
+ setRenderPortal(true);
2517
+ }
2518
+ else {
2519
+ setVisible(false);
2520
+ const t = setTimeout(() => setRenderPortal(false), 200);
2521
+ return () => clearTimeout(t);
2522
+ }
2523
+ }, [open, mounted]);
2524
+ require$$0.useEffect(() => {
2525
+ if (!open)
2526
+ return;
2527
+ const onKeyDown = (e) => {
2528
+ if (e.key === 'Escape')
2529
+ onClose();
2530
+ };
2531
+ document.addEventListener('keydown', onKeyDown);
2532
+ return () => document.removeEventListener('keydown', onKeyDown);
2533
+ }, [open, onClose]);
2534
+ if (!mounted || (!renderPortal && !open))
2535
+ return null;
2536
+ // Get theme-aware styles (same pattern as ProfileCard)
2537
+ const styles = getStyles(isDarkTheme);
2538
+ const overlayStyle = {
2539
+ ...styles.overlay,
2540
+ opacity: visible ? 1 : 0,
2541
+ transition: 'opacity 200ms ease',
2542
+ };
2543
+ const cardStyle = {
2544
+ ...styles.card,
2545
+ transform: visible ? 'scale(1)' : 'scale(0.96)',
2546
+ opacity: visible ? 1 : 0,
2547
+ transition: 'opacity 200ms ease, transform 200ms cubic-bezier(0.4, 0, 0.2, 1)',
2548
+ ...style,
2549
+ };
2550
+ const content = (jsxRuntimeExports.jsx("div", { className: "modal-overlay mds-modal-overlay", style: overlayStyle, onClick: closeOnOverlay ? onClose : undefined, "aria-modal": "true", role: "dialog", children: jsxRuntimeExports.jsx("div", { className: className, style: cardStyle, onClick: (e) => e.stopPropagation(), ref: (el) => (containerRef.current = el), children: children }) }));
2551
+ return reactDom.createPortal(content, document.body);
2552
+ }
2553
+
2554
+ function ModalHeader({ title, icon, onClose, closeAriaLabel = 'Fechar', align = 'center' }) {
2555
+ const CloseIcon = (jsxRuntimeExports.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: jsxRuntimeExports.jsx("path", { d: "M18.3 5.71a1 1 0 00-1.41 0L12 10.59 7.11 5.7A1 1 0 105.7 7.11L10.59 12l-4.9 4.89a1 1 0 101.42 1.42L12 13.41l4.89 4.9a1 1 0 001.42-1.42L13.41 12l4.9-4.89a1 1 0 000-1.4z" }) }));
2556
+ if (align === 'center') {
2557
+ const iconBox = {
2558
+ position: 'absolute',
2559
+ left: 16,
2560
+ top: '50%',
2561
+ transform: 'translateY(-50%)',
2562
+ width: 32,
2563
+ height: 32,
2564
+ display: 'inline-flex',
2565
+ alignItems: 'center',
2566
+ justifyContent: 'center',
2567
+ fontSize: '1.25rem',
2568
+ lineHeight: 0
2569
+ };
2570
+ const closeBox = {
2571
+ position: 'absolute',
2572
+ right: 16,
2573
+ top: '50%',
2574
+ transform: 'translateY(-50%)',
2575
+ width: 32,
2576
+ height: 32,
2577
+ display: 'inline-flex',
2578
+ alignItems: 'center',
2579
+ justifyContent: 'center',
2580
+ background: 'transparent',
2581
+ border: 'none',
2582
+ padding: 0,
2583
+ cursor: 'pointer',
2584
+ lineHeight: 0
2585
+ };
2586
+ return (jsxRuntimeExports.jsxs("div", { className: "mds-modal-header", style: {
2587
+ position: 'relative',
2588
+ padding: '16px 24px',
2589
+ marginBottom: 16,
2590
+ borderBottom: '1px solid var(--border-color)'
2591
+ }, children: [icon && (jsxRuntimeExports.jsx("div", { "aria-hidden": true, style: iconBox, children: icon })), jsxRuntimeExports.jsx("div", { style: { textAlign: 'center' }, children: typeof title === 'string' ? (jsxRuntimeExports.jsx("h3", { style: { margin: 0 }, children: title })) : (title) }), onClose && (jsxRuntimeExports.jsx("button", { type: "button", "aria-label": closeAriaLabel, onClick: onClose, style: closeBox, children: CloseIcon }))] }));
2592
+ }
2593
+ return (jsxRuntimeExports.jsxs("div", { className: "mds-modal-header", style: {
2594
+ display: 'flex',
2595
+ alignItems: 'center',
2596
+ gap: 12,
2597
+ padding: '16px 24px',
2598
+ marginBottom: 16,
2599
+ borderBottom: '1px solid var(--border-color)'
2600
+ }, children: [icon && (jsxRuntimeExports.jsx("div", { "aria-hidden": true, style: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 32, height: 32, fontSize: '1.25rem', lineHeight: 0 }, children: icon })), jsxRuntimeExports.jsx("div", { style: { margin: 0, fontSize: '1.125rem', fontWeight: 600, flex: 1 }, children: typeof title === 'string' ? (jsxRuntimeExports.jsx("h3", { style: { margin: 0 }, children: title })) : (title) }), onClose && (jsxRuntimeExports.jsx("button", { type: "button", "aria-label": closeAriaLabel, onClick: onClose, style: { marginLeft: 'auto', background: 'transparent', border: 'none', width: 32, height: 32, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', lineHeight: 0 }, children: CloseIcon }))] }));
2601
+ }
2602
+
2603
+ function ModalBody({ children, style, className }) {
2604
+ return (jsxRuntimeExports.jsx("div", { className: className, style: { padding: '16px 24px', ...style }, children: children }));
2605
+ }
2606
+
2607
+ function ModalFooter({ children, align = 'end' }) {
2608
+ const justify = align === 'start' ? 'flex-start' : align === 'center' ? 'center' : 'flex-end';
2609
+ return (jsxRuntimeExports.jsx("div", { style: { display: 'flex', gap: 12, justifyContent: justify, borderTop: '1px solid var(--border-color)', padding: '16px 24px', marginTop: 8 }, children: children }));
2610
+ }
2611
+
2612
+ const IconWarning = (jsxRuntimeExports.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: jsxRuntimeExports.jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) }));
2613
+ const IconDanger = (jsxRuntimeExports.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: jsxRuntimeExports.jsx("path", { d: "M12 2a10 10 0 100 20 10 10 0 000-20zm-1 5h2v8h-2V7zm0 10h2v2h-2v-2z" }) }));
2614
+ const IconInfo = (jsxRuntimeExports.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: jsxRuntimeExports.jsx("path", { d: "M11 9h2V7h-2v2zm0 8h2v-6h-2v6zm1-15a10 10 0 100 20 10 10 0 000-20z" }) }));
2615
+ const IconSuccess = (jsxRuntimeExports.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: jsxRuntimeExports.jsx("path", { d: "M12 2a10 10 0 100 20 10 10 0 000-20zm-1 14l-4-4 1.41-1.41L11 12.17l4.59-4.58L17 9l-6 7z" }) }));
2616
+ const toneIcon = {
2617
+ warning: IconWarning,
2618
+ danger: IconDanger,
2619
+ info: IconInfo,
2620
+ success: IconSuccess
2621
+ };
2622
+ function ConfirmDialog({ open, onClose, title, description, confirmText = 'Confirmar', cancelText = 'Cancelar', onConfirm, loading = false, tone = 'warning', icon, disableOverlayClose }) {
2623
+ 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 })] })] }) }));
2624
+ }
2625
+
2626
+ exports.ActionIcons = ActionIcons;
1493
2627
  exports.BrandLogo = BrandLogo;
1494
2628
  exports.Button = Button;
2629
+ exports.CellRenderers = CellRenderers;
2630
+ exports.ConfirmDialog = ConfirmDialog;
2631
+ exports.DataTable = DataTable;
1495
2632
  exports.GlassCard = GlassCard;
2633
+ exports.Modal = Modal;
2634
+ exports.ModalBody = ModalBody;
2635
+ exports.ModalFooter = ModalFooter;
2636
+ exports.ModalHeader = ModalHeader;
2637
+ exports.Select = Select;
2638
+ exports.TableHeader = TableHeader;
2639
+ exports.TableRow = TableRow;
2640
+ exports.ThemeToggle = ThemeToggle;
1496
2641
  exports.Typography = Typography;
2642
+ exports.auditLogTableConfig = auditLogTableConfig;
2643
+ exports.citiesTableConfig = citiesTableConfig;
1497
2644
  exports.cn = cn;
2645
+ exports.countriesTableConfig = countriesTableConfig;
2646
+ exports.getTableConfig = getTableConfig;
2647
+ exports.parametersTableConfig = parametersTableConfig;
2648
+ exports.regionsTableConfig = regionsTableConfig;
2649
+ exports.statesTableConfig = statesTableConfig;
1498
2650
  //# sourceMappingURL=index.js.map