@metropolle/design-system 1.0.0-beta.20250821024300.dfbe136 → 1.0.0-beta.2026.1.10.2327.6729fca
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.
- package/README.md +1 -0
- package/dist/css/compat/back.css +478 -0
- package/dist/css/components.css +3638 -8
- package/dist/css/liquid-glass.css +468 -0
- package/dist/css/mermaid.css +163 -0
- package/dist/css/tokens.css +67 -0
- package/dist/react/components/react/Button/Button.d.ts +1 -1
- package/dist/react/components/react/Button/Button.d.ts.map +1 -1
- package/dist/react/components/react/DataTable/DataTable.d.ts +4 -0
- package/dist/react/components/react/DataTable/DataTable.d.ts.map +1 -0
- package/dist/react/components/react/DataTable/TableHeader.d.ts +4 -0
- package/dist/react/components/react/DataTable/TableHeader.d.ts.map +1 -0
- package/dist/react/components/react/DataTable/TableRow.d.ts +4 -0
- package/dist/react/components/react/DataTable/TableRow.d.ts.map +1 -0
- package/dist/react/components/react/DataTable/examples.d.ts +28 -0
- package/dist/react/components/react/DataTable/examples.d.ts.map +1 -0
- package/dist/react/components/react/DataTable/index.d.ts +7 -0
- package/dist/react/components/react/DataTable/index.d.ts.map +1 -0
- package/dist/react/components/react/DataTable/migration-example.d.ts +46 -0
- package/dist/react/components/react/DataTable/migration-example.d.ts.map +1 -0
- package/dist/react/components/react/DataTable/renderers.d.ts +24 -0
- package/dist/react/components/react/DataTable/renderers.d.ts.map +1 -0
- package/dist/react/components/react/DataTable/types.d.ts +58 -0
- package/dist/react/components/react/DataTable/types.d.ts.map +1 -0
- package/dist/react/components/react/DetailModal/DetailModal.d.ts +55 -0
- package/dist/react/components/react/DetailModal/DetailModal.d.ts.map +1 -0
- package/dist/react/components/react/DetailModal/index.d.ts +3 -0
- package/dist/react/components/react/DetailModal/index.d.ts.map +1 -0
- package/dist/react/components/react/FormField/FormField.d.ts +26 -0
- package/dist/react/components/react/FormField/FormField.d.ts.map +1 -0
- package/dist/react/components/react/FormField/index.d.ts +3 -0
- package/dist/react/components/react/FormField/index.d.ts.map +1 -0
- package/dist/react/components/react/FormGrid/FormGrid.d.ts +20 -0
- package/dist/react/components/react/FormGrid/FormGrid.d.ts.map +1 -0
- package/dist/react/components/react/FormGrid/index.d.ts +3 -0
- package/dist/react/components/react/FormGrid/index.d.ts.map +1 -0
- package/dist/react/components/react/FormModal/FormModal.d.ts +58 -0
- package/dist/react/components/react/FormModal/FormModal.d.ts.map +1 -0
- package/dist/react/components/react/FormModal/index.d.ts +3 -0
- package/dist/react/components/react/FormModal/index.d.ts.map +1 -0
- package/dist/react/components/react/FormSection/FormSection.d.ts +20 -0
- package/dist/react/components/react/FormSection/FormSection.d.ts.map +1 -0
- package/dist/react/components/react/FormSection/index.d.ts +3 -0
- package/dist/react/components/react/FormSection/index.d.ts.map +1 -0
- package/dist/react/components/react/GlassCard/GlassCard.d.ts +56 -6
- package/dist/react/components/react/GlassCard/GlassCard.d.ts.map +1 -1
- package/dist/react/components/react/GlassCard/index.d.ts +1 -1
- package/dist/react/components/react/GlassCard/index.d.ts.map +1 -1
- package/dist/react/components/react/InfoBox/InfoBox.d.ts +46 -0
- package/dist/react/components/react/InfoBox/InfoBox.d.ts.map +1 -0
- package/dist/react/components/react/InfoBox/index.d.ts +3 -0
- package/dist/react/components/react/InfoBox/index.d.ts.map +1 -0
- package/dist/react/components/react/Modal/ConfirmDialog.d.ts +17 -0
- package/dist/react/components/react/Modal/ConfirmDialog.d.ts.map +1 -0
- package/dist/react/components/react/Modal/Modal.d.ts +12 -0
- package/dist/react/components/react/Modal/Modal.d.ts.map +1 -0
- package/dist/react/components/react/Modal/ModalBody.d.ts +9 -0
- package/dist/react/components/react/Modal/ModalBody.d.ts.map +1 -0
- package/dist/react/components/react/Modal/ModalFooter.d.ts +8 -0
- package/dist/react/components/react/Modal/ModalFooter.d.ts.map +1 -0
- package/dist/react/components/react/Modal/ModalHeader.d.ts +11 -0
- package/dist/react/components/react/Modal/ModalHeader.d.ts.map +1 -0
- package/dist/react/components/react/Modal/index.d.ts +6 -0
- package/dist/react/components/react/Modal/index.d.ts.map +1 -0
- package/dist/react/components/react/ProfileCard/ProfileCard.d.ts +55 -0
- package/dist/react/components/react/ProfileCard/ProfileCard.d.ts.map +1 -0
- package/dist/react/components/react/ProfileCard/index.d.ts +3 -0
- package/dist/react/components/react/ProfileCard/index.d.ts.map +1 -0
- package/dist/react/components/react/Select/Select.d.ts +71 -0
- package/dist/react/components/react/Select/Select.d.ts.map +1 -0
- package/dist/react/components/react/Select/index.d.ts +2 -0
- package/dist/react/components/react/Select/index.d.ts.map +1 -0
- package/dist/react/components/react/ThemeToggle/ThemeToggle.d.ts +28 -0
- package/dist/react/components/react/ThemeToggle/ThemeToggle.d.ts.map +1 -0
- package/dist/react/components/react/ThemeToggle/index.d.ts +3 -0
- package/dist/react/components/react/ThemeToggle/index.d.ts.map +1 -0
- package/dist/react/components/react/Typography/Typography.d.ts.map +1 -1
- package/dist/react/components/react/index.d.ts +25 -0
- package/dist/react/components/react/index.d.ts.map +1 -1
- package/dist/react/index.d.ts +32 -7
- package/dist/react/index.esm.js +1586 -14
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react/index.js +1611 -12
- package/dist/react/index.js.map +1 -1
- package/dist/tokens/colors.json +100 -18
- package/dist/tokens/index.d.ts +19 -24
- package/dist/tokens/index.js +69 -2
- package/dist/tokens/index.json +100 -18
- package/package.json +24 -13
package/dist/react/index.js
CHANGED
|
@@ -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,47 @@ function cn(...classes) {
|
|
|
1371
1372
|
/**
|
|
1372
1373
|
* Glass Card Component
|
|
1373
1374
|
*
|
|
1374
|
-
* Componente de cartão com efeito glassmorphism
|
|
1375
|
-
*
|
|
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(({
|
|
1390
|
+
const GlassCard = require$$0.forwardRef(({ glassStyle = 'liquid', intensity = 'md', theme, variant = 'light', blur, opacity, children, className, enableHover = true, cardVariant = 'default', 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
|
+
// PROC-007: Card variant styles
|
|
1398
|
+
const variantStyles = {
|
|
1399
|
+
default: {},
|
|
1400
|
+
highlight: {
|
|
1401
|
+
borderLeft: '4px solid var(--mds-color-brand-primary, #0055FF)',
|
|
1402
|
+
boxShadow: '0 4px 20px rgba(0, 85, 255, 0.15)'
|
|
1403
|
+
},
|
|
1404
|
+
subtle: {
|
|
1405
|
+
background: 'rgba(255, 255, 255, 0.02)',
|
|
1406
|
+
border: '1px solid rgba(255, 255, 255, 0.05)'
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
return (jsxRuntimeExports.jsx("div", { ref: ref, className: cn('mds-liquid-glass', `mds-liquid-glass--${intensity}`, `mds-liquid-glass--${cardVariant}`, !enableHover && 'mds-liquid-glass--no-hover', className), style: { ...variantStyles[cardVariant], ...style }, ...props, children: children }));
|
|
1410
|
+
}
|
|
1411
|
+
// =====================
|
|
1412
|
+
// GLASS MODE (legacy)
|
|
1413
|
+
// =====================
|
|
1378
1414
|
// Default opacities baseadas no design existente
|
|
1379
|
-
const defaultOpacity =
|
|
1415
|
+
const defaultOpacity = resolvedTheme === 'light' ? 0.15 : 0.8;
|
|
1380
1416
|
const finalOpacity = opacity ?? defaultOpacity;
|
|
1381
1417
|
// Use CSS classes for base styles to avoid hydration mismatches
|
|
1382
1418
|
const baseStyles = {
|
|
@@ -1384,12 +1420,16 @@ const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity
|
|
|
1384
1420
|
};
|
|
1385
1421
|
// Only apply custom styles for non-default values
|
|
1386
1422
|
const customStyles = {};
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1423
|
+
// Support legacy blur prop or convert from intensity
|
|
1424
|
+
const resolvedBlur = blur ?? (intensity ? {
|
|
1425
|
+
xs: 2, sm: 4, md: 6, lg: 8, xl: 12
|
|
1426
|
+
}[intensity] : 20);
|
|
1427
|
+
if (resolvedBlur !== 20) {
|
|
1428
|
+
customStyles.backdropFilter = `blur(${resolvedBlur}px)`;
|
|
1429
|
+
customStyles.WebkitBackdropFilter = `blur(${resolvedBlur}px)`;
|
|
1390
1430
|
}
|
|
1391
1431
|
if (opacity !== undefined) {
|
|
1392
|
-
customStyles.background =
|
|
1432
|
+
customStyles.background = resolvedTheme === 'light'
|
|
1393
1433
|
? `rgba(255, 255, 255, ${finalOpacity})`
|
|
1394
1434
|
: `rgba(60, 60, 60, ${finalOpacity})`;
|
|
1395
1435
|
}
|
|
@@ -1404,7 +1444,7 @@ const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity
|
|
|
1404
1444
|
borderColor: 'rgba(255, 255, 255, 0.2)',
|
|
1405
1445
|
background: opacity !== undefined ? `rgba(70, 70, 70, ${finalOpacity})` : undefined,
|
|
1406
1446
|
}
|
|
1407
|
-
}[
|
|
1447
|
+
}[resolvedTheme] : {};
|
|
1408
1448
|
const handleMouseEnter = (e) => {
|
|
1409
1449
|
if (!enableHover)
|
|
1410
1450
|
return;
|
|
@@ -1422,7 +1462,7 @@ const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity
|
|
|
1422
1462
|
});
|
|
1423
1463
|
props.onMouseLeave?.(e);
|
|
1424
1464
|
};
|
|
1425
|
-
return (jsxRuntimeExports.jsx("div", { ref: ref, className: cn('mds-glass-card', `mds-glass-card--${
|
|
1465
|
+
return (jsxRuntimeExports.jsx("div", { ref: ref, className: cn('mds-glass-card', `mds-glass-card--${resolvedTheme}`, !enableHover && 'mds-glass-card--no-hover', className), style: {
|
|
1426
1466
|
...baseStyles,
|
|
1427
1467
|
...customStyles,
|
|
1428
1468
|
...style
|
|
@@ -1430,6 +1470,125 @@ const GlassCard = require$$0.forwardRef(({ variant = 'light', blur = 20, opacity
|
|
|
1430
1470
|
});
|
|
1431
1471
|
GlassCard.displayName = 'GlassCard';
|
|
1432
1472
|
|
|
1473
|
+
// Default placeholder avatar - adapts to theme with high transparency
|
|
1474
|
+
const getPlaceholderAvatar = (isDark) => {
|
|
1475
|
+
const bgColor = isDark ? 'rgba(26, 26, 46, 0.15)' : 'rgba(255, 255, 255, 0.1)';
|
|
1476
|
+
const fgColor = isDark ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.06)';
|
|
1477
|
+
return 'data:image/svg+xml,' + encodeURIComponent(`
|
|
1478
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" fill="none">
|
|
1479
|
+
<rect width="200" height="200" fill="${bgColor}"/>
|
|
1480
|
+
<circle cx="100" cy="80" r="40" fill="${fgColor}"/>
|
|
1481
|
+
<ellipse cx="100" cy="180" rx="60" ry="50" fill="${fgColor}"/>
|
|
1482
|
+
</svg>
|
|
1483
|
+
`);
|
|
1484
|
+
};
|
|
1485
|
+
// =============================================================================
|
|
1486
|
+
// Icons
|
|
1487
|
+
// =============================================================================
|
|
1488
|
+
const Icons = {
|
|
1489
|
+
shield: (jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", children: jsxRuntimeExports.jsx("path", { d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z", fill: "currentColor" }) })),
|
|
1490
|
+
plus: (jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", children: jsxRuntimeExports.jsx("path", { d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", fill: "currentColor" }) })),
|
|
1491
|
+
instagram: jsxRuntimeExports.jsx("path", { d: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z" }),
|
|
1492
|
+
x: jsxRuntimeExports.jsx("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }),
|
|
1493
|
+
linkedin: jsxRuntimeExports.jsx("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" }),
|
|
1494
|
+
website: jsxRuntimeExports.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z" }),
|
|
1495
|
+
};
|
|
1496
|
+
function SocialLink({ href, title, icon }) {
|
|
1497
|
+
const iconPath = Icons[icon];
|
|
1498
|
+
if (!iconPath || typeof iconPath === 'object')
|
|
1499
|
+
return null;
|
|
1500
|
+
return (jsxRuntimeExports.jsx("a", { href: href, className: "mds-profile-card__social-link", title: title, target: "_blank", rel: "noopener noreferrer", children: jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", children: iconPath }) }));
|
|
1501
|
+
}
|
|
1502
|
+
function StatItem({ label, verified }) {
|
|
1503
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__stat-item", children: [jsxRuntimeExports.jsx("span", { className: "mds-profile-card__stat-label", children: label }), jsxRuntimeExports.jsx("span", { className: `mds-profile-card__stat-value ${verified ? 'mds-profile-card__stat-value--verified' : ''}`, children: verified ? 'Verified' : 'Not Verified' })] }));
|
|
1504
|
+
}
|
|
1505
|
+
// =============================================================================
|
|
1506
|
+
// Main Component
|
|
1507
|
+
// =============================================================================
|
|
1508
|
+
function ProfileCard({ user, variant = 'full', photoWidth, showSocial = false, socialLinks, showRotatingInfo = false, photoSlot, className = '', onSocialClick, }) {
|
|
1509
|
+
const [showVerifiedPopup, setShowVerifiedPopup] = require$$0.useState(false);
|
|
1510
|
+
const [showSocialPopup, setShowSocialPopup] = require$$0.useState(false);
|
|
1511
|
+
const [currentInfoIndex, setCurrentInfoIndex] = require$$0.useState(0);
|
|
1512
|
+
const [isDarkTheme, setIsDarkTheme] = require$$0.useState(true);
|
|
1513
|
+
const verifiedRef = require$$0.useRef(null);
|
|
1514
|
+
const socialRef = require$$0.useRef(null);
|
|
1515
|
+
// Calculate photo width based on variant
|
|
1516
|
+
const computedPhotoWidth = photoWidth ?? (variant === 'full' ? 280 : 200);
|
|
1517
|
+
// Detect theme
|
|
1518
|
+
require$$0.useEffect(() => {
|
|
1519
|
+
const checkTheme = () => {
|
|
1520
|
+
const theme = document.documentElement.getAttribute('data-theme');
|
|
1521
|
+
setIsDarkTheme(theme !== 'light');
|
|
1522
|
+
};
|
|
1523
|
+
checkTheme();
|
|
1524
|
+
const observer = new MutationObserver((mutations) => {
|
|
1525
|
+
mutations.forEach((mutation) => {
|
|
1526
|
+
if (mutation.attributeName === 'data-theme') {
|
|
1527
|
+
checkTheme();
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
});
|
|
1531
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
|
|
1532
|
+
return () => observer.disconnect();
|
|
1533
|
+
}, []);
|
|
1534
|
+
// Dynamic info texts for rotating display
|
|
1535
|
+
const infoTexts = [
|
|
1536
|
+
`Member since ${new Date(user.created_at).getFullYear()}`,
|
|
1537
|
+
...(user.verified >= 1 ? ['Email Verified'] : []),
|
|
1538
|
+
...(user.verified >= 2 ? ['Identity Verified'] : []),
|
|
1539
|
+
...(user.verified >= 3 ? ['Professional Verified'] : []),
|
|
1540
|
+
];
|
|
1541
|
+
// Rotate info text
|
|
1542
|
+
require$$0.useEffect(() => {
|
|
1543
|
+
if (!showRotatingInfo)
|
|
1544
|
+
return;
|
|
1545
|
+
const interval = setInterval(() => {
|
|
1546
|
+
setCurrentInfoIndex((prev) => (prev + 1) % infoTexts.length);
|
|
1547
|
+
}, 10000);
|
|
1548
|
+
return () => clearInterval(interval);
|
|
1549
|
+
}, [infoTexts.length, showRotatingInfo]);
|
|
1550
|
+
// Close popups on click outside
|
|
1551
|
+
require$$0.useEffect(() => {
|
|
1552
|
+
const handleClickOutside = (e) => {
|
|
1553
|
+
if (verifiedRef.current && !verifiedRef.current.contains(e.target)) {
|
|
1554
|
+
setShowVerifiedPopup(false);
|
|
1555
|
+
}
|
|
1556
|
+
if (socialRef.current && !socialRef.current.contains(e.target)) {
|
|
1557
|
+
setShowSocialPopup(false);
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
document.addEventListener('click', handleClickOutside);
|
|
1561
|
+
return () => document.removeEventListener('click', handleClickOutside);
|
|
1562
|
+
}, []);
|
|
1563
|
+
// Get display values
|
|
1564
|
+
const displayName = user.full_name || user.username || 'User';
|
|
1565
|
+
const profession = user.profession_name || user.profession_code || '';
|
|
1566
|
+
const getLocation = () => {
|
|
1567
|
+
if (!user.city_code && !user.state_code && !user.country_code)
|
|
1568
|
+
return null;
|
|
1569
|
+
const city = user.city_name || user.city_code?.toUpperCase() || '';
|
|
1570
|
+
const state = user.state_code?.toUpperCase() || '';
|
|
1571
|
+
const country = user.country_name || user.country_code?.toUpperCase() || '';
|
|
1572
|
+
const parts = [city, state, country].filter(Boolean);
|
|
1573
|
+
return parts.join(', ');
|
|
1574
|
+
};
|
|
1575
|
+
const memberSince = new Date(user.created_at).getFullYear().toString();
|
|
1576
|
+
const photoUrl = user.photo_url_medium || user.photo_url_full || getPlaceholderAvatar(isDarkTheme);
|
|
1577
|
+
return (jsxRuntimeExports.jsxs("article", { className: `mds-profile-card ${className}`, style: { '--mds-profile-card-photo-width': `${computedPhotoWidth}px` }, children: [jsxRuntimeExports.jsx("div", { className: "mds-profile-card__grain" }), jsxRuntimeExports.jsx("div", { className: "mds-profile-card__photo", children: photoSlot ? (jsxRuntimeExports.jsx("div", { className: "mds-profile-card__photo-slot", children: photoSlot })) : (jsxRuntimeExports.jsx("img", { src: photoUrl, alt: displayName, className: "mds-profile-card__avatar" })) }), jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__content", children: [jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__identity", children: [jsxRuntimeExports.jsx("h1", { className: "mds-profile-card__name", children: displayName.toUpperCase() }), variant === 'full' && profession && (jsxRuntimeExports.jsx("p", { className: "mds-profile-card__profession", children: profession.toUpperCase() })), variant === 'compact' && (jsxRuntimeExports.jsx("p", { className: "mds-profile-card__username", children: user.username }))] }), jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__details", children: [variant === 'full' && getLocation() && (jsxRuntimeExports.jsx("p", { className: "mds-profile-card__location", children: getLocation() })), variant === 'full' && (jsxRuntimeExports.jsx("span", { className: "mds-profile-card__username-detail", children: user.username })), variant === 'compact' && user.email && (jsxRuntimeExports.jsx("p", { className: "mds-profile-card__email", children: user.email })), variant === 'compact' && (jsxRuntimeExports.jsxs("span", { className: "mds-profile-card__member", children: ["Member since ", memberSince] }))] }), variant === 'compact' && (jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__verification", children: [jsxRuntimeExports.jsxs("button", { className: "mds-profile-card__verified-badge", title: `Verification Level ${user.verified}`, onClick: (e) => {
|
|
1578
|
+
e.stopPropagation();
|
|
1579
|
+
setShowVerifiedPopup(!showVerifiedPopup);
|
|
1580
|
+
}, children: [Icons.shield, jsxRuntimeExports.jsxs("span", { children: ["Level ", user.verified] })] }), jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__dots", children: [jsxRuntimeExports.jsx("span", { className: `mds-profile-card__dot ${user.verified >= 1 ? 'active' : ''}`, title: "Email Verified" }), jsxRuntimeExports.jsx("span", { className: `mds-profile-card__dot ${user.verified >= 2 ? 'active' : ''}`, title: "Identity Verified" }), jsxRuntimeExports.jsx("span", { className: `mds-profile-card__dot ${user.verified >= 3 ? 'active' : ''}`, title: "Professional Verified" })] })] })), showSocial && (jsxRuntimeExports.jsxs("div", { ref: socialRef, className: "mds-profile-card__social", children: [jsxRuntimeExports.jsx("button", { className: "mds-profile-card__social-trigger", onClick: (e) => {
|
|
1581
|
+
e.stopPropagation();
|
|
1582
|
+
setShowSocialPopup(!showSocialPopup);
|
|
1583
|
+
setShowVerifiedPopup(false);
|
|
1584
|
+
onSocialClick?.();
|
|
1585
|
+
}, "aria-label": "Show social links", children: Icons.plus }), showSocialPopup && socialLinks && (jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__social-popup", children: [socialLinks.instagram && jsxRuntimeExports.jsx(SocialLink, { href: socialLinks.instagram, title: "Instagram", icon: "instagram" }), socialLinks.x && jsxRuntimeExports.jsx(SocialLink, { href: socialLinks.x, title: "X", icon: "x" }), socialLinks.linkedin && jsxRuntimeExports.jsx(SocialLink, { href: socialLinks.linkedin, title: "LinkedIn", icon: "linkedin" }), socialLinks.website && jsxRuntimeExports.jsx(SocialLink, { href: socialLinks.website, title: "Website", icon: "website" })] }))] })), variant === 'full' && (jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__dynamic-group", children: [showRotatingInfo && (jsxRuntimeExports.jsx("span", { className: "mds-profile-card__dynamic-info", children: infoTexts[currentInfoIndex] })), jsxRuntimeExports.jsxs("div", { ref: verifiedRef, className: "mds-profile-card__verified-section", children: [jsxRuntimeExports.jsx("button", { className: "mds-profile-card__verified-trigger", onClick: (e) => {
|
|
1586
|
+
e.stopPropagation();
|
|
1587
|
+
setShowVerifiedPopup(!showVerifiedPopup);
|
|
1588
|
+
setShowSocialPopup(false);
|
|
1589
|
+
}, title: "Verification Status", children: Icons.shield }), showVerifiedPopup && (jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__verified-popup", children: [jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__verified-header", children: ["Verification Level ", user.verified] }), jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__verified-stats", children: [jsxRuntimeExports.jsx(StatItem, { label: "Email", verified: user.verified >= 1 }), jsxRuntimeExports.jsx(StatItem, { label: "Identity", verified: user.verified >= 2 }), jsxRuntimeExports.jsx(StatItem, { label: "Professional", verified: user.verified >= 3 })] }), jsxRuntimeExports.jsxs("div", { className: "mds-profile-card__verified-date", children: ["Since ", memberSince] })] }))] }), showRotatingInfo && (jsxRuntimeExports.jsx("div", { className: "mds-profile-card__info-dots", children: infoTexts.map((_, index) => (jsxRuntimeExports.jsx("span", { className: `mds-profile-card__info-dot ${index === currentInfoIndex ? 'active' : ''}` }, index))) }))] }))] })] }));
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1433
1592
|
const variantElementMap = {
|
|
1434
1593
|
h1: 'h1',
|
|
1435
1594
|
h2: 'h2',
|
|
@@ -1460,13 +1619,14 @@ const Typography = require$$0.forwardRef(({ variant = 'body', size, as, children
|
|
|
1460
1619
|
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
1620
|
});
|
|
1462
1621
|
Typography.displayName = 'Typography';
|
|
1463
|
-
const BrandLogo = require$$0.forwardRef(({ size = 'md',
|
|
1622
|
+
const BrandLogo = require$$0.forwardRef(({ size = 'md', weight = 'bold', // Peso bold por padrão para a marca
|
|
1623
|
+
className, children = 'Metropolle', ...props }, ref) => {
|
|
1464
1624
|
const sizeMap = {
|
|
1465
1625
|
sm: '2xl',
|
|
1466
1626
|
md: '4xl',
|
|
1467
1627
|
lg: '4xl', // Same as md but with different mobile behavior
|
|
1468
1628
|
};
|
|
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 }));
|
|
1629
|
+
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
1630
|
});
|
|
1471
1631
|
BrandLogo.displayName = 'BrandLogo';
|
|
1472
1632
|
|
|
@@ -1490,9 +1650,1448 @@ Button.displayName = 'Button';
|
|
|
1490
1650
|
*/
|
|
1491
1651
|
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
1652
|
|
|
1653
|
+
/**
|
|
1654
|
+
* Select Component (Design System)
|
|
1655
|
+
*
|
|
1656
|
+
* Custom dropdown select that renders consistently across all browsers.
|
|
1657
|
+
* Unlike native <select>, this component renders the dropdown via JavaScript,
|
|
1658
|
+
* ensuring proper theming support on Edge/Chrome Windows.
|
|
1659
|
+
*
|
|
1660
|
+
* @example
|
|
1661
|
+
* ```tsx
|
|
1662
|
+
* <Select
|
|
1663
|
+
* options={[
|
|
1664
|
+
* { label: 'Option 1', value: '1' },
|
|
1665
|
+
* { label: 'Option 2', value: '2' },
|
|
1666
|
+
* ]}
|
|
1667
|
+
* value={selectedValue}
|
|
1668
|
+
* onChange={setSelectedValue}
|
|
1669
|
+
* placeholder="Select an option..."
|
|
1670
|
+
* />
|
|
1671
|
+
* ```
|
|
1672
|
+
*/
|
|
1673
|
+
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) => {
|
|
1674
|
+
const [isOpen, setIsOpen] = require$$0.useState(false);
|
|
1675
|
+
const [searchTerm, setSearchTerm] = require$$0.useState('');
|
|
1676
|
+
const [highlightedIndex, setHighlightedIndex] = require$$0.useState(-1);
|
|
1677
|
+
const [mounted, setMounted] = require$$0.useState(false);
|
|
1678
|
+
const triggerRef = require$$0.useRef(null);
|
|
1679
|
+
const dropdownRef = require$$0.useRef(null);
|
|
1680
|
+
const searchInputRef = require$$0.useRef(null);
|
|
1681
|
+
const listRef = require$$0.useRef(null);
|
|
1682
|
+
// Combine refs
|
|
1683
|
+
const combinedRef = (el) => {
|
|
1684
|
+
triggerRef.current = el;
|
|
1685
|
+
if (typeof ref === 'function') {
|
|
1686
|
+
ref(el);
|
|
1687
|
+
}
|
|
1688
|
+
else if (ref) {
|
|
1689
|
+
ref.current = el;
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
// Client-side only
|
|
1693
|
+
require$$0.useEffect(() => {
|
|
1694
|
+
setMounted(true);
|
|
1695
|
+
}, []);
|
|
1696
|
+
// Filter options based on search
|
|
1697
|
+
const filteredOptions = require$$0.useMemo(() => {
|
|
1698
|
+
if (!searchTerm)
|
|
1699
|
+
return options;
|
|
1700
|
+
const term = searchTerm.toLowerCase();
|
|
1701
|
+
return options.filter(opt => {
|
|
1702
|
+
const label = typeof opt.label === 'string' ? opt.label : String(opt.value);
|
|
1703
|
+
return label.toLowerCase().includes(term);
|
|
1704
|
+
});
|
|
1705
|
+
}, [options, searchTerm]);
|
|
1706
|
+
// Get selected option label
|
|
1707
|
+
const selectedOption = require$$0.useMemo(() => {
|
|
1708
|
+
return options.find(opt => opt.value === value);
|
|
1709
|
+
}, [options, value]);
|
|
1710
|
+
// Handle dropdown positioning
|
|
1711
|
+
const [dropdownPosition, setDropdownPosition] = require$$0.useState({ top: 0, left: 0, width: 0 });
|
|
1712
|
+
const updateDropdownPosition = require$$0.useCallback(() => {
|
|
1713
|
+
if (!triggerRef.current)
|
|
1714
|
+
return;
|
|
1715
|
+
const rect = triggerRef.current.getBoundingClientRect();
|
|
1716
|
+
const viewportHeight = window.innerHeight;
|
|
1717
|
+
const spaceBelow = viewportHeight - rect.bottom;
|
|
1718
|
+
const spaceAbove = rect.top;
|
|
1719
|
+
// Determine if dropdown should open above or below
|
|
1720
|
+
const dropdownHeight = Math.min(maxHeight, filteredOptions.length * 40 + (searchable ? 48 : 0));
|
|
1721
|
+
const openAbove = spaceBelow < dropdownHeight && spaceAbove > spaceBelow;
|
|
1722
|
+
setDropdownPosition({
|
|
1723
|
+
top: openAbove ? rect.top - dropdownHeight : rect.bottom + 4,
|
|
1724
|
+
left: rect.left,
|
|
1725
|
+
width: rect.width,
|
|
1726
|
+
});
|
|
1727
|
+
}, [maxHeight, filteredOptions.length, searchable]);
|
|
1728
|
+
// Open dropdown
|
|
1729
|
+
const openDropdown = require$$0.useCallback(() => {
|
|
1730
|
+
if (disabled || loading)
|
|
1731
|
+
return;
|
|
1732
|
+
updateDropdownPosition();
|
|
1733
|
+
setIsOpen(true);
|
|
1734
|
+
setSearchTerm('');
|
|
1735
|
+
setHighlightedIndex(value ? filteredOptions.findIndex(opt => opt.value === value) : 0);
|
|
1736
|
+
}, [disabled, loading, updateDropdownPosition, value, filteredOptions]);
|
|
1737
|
+
// Close dropdown
|
|
1738
|
+
const closeDropdown = require$$0.useCallback(() => {
|
|
1739
|
+
setIsOpen(false);
|
|
1740
|
+
setSearchTerm('');
|
|
1741
|
+
setHighlightedIndex(-1);
|
|
1742
|
+
triggerRef.current?.focus();
|
|
1743
|
+
}, []);
|
|
1744
|
+
// Handle option select
|
|
1745
|
+
const handleSelect = require$$0.useCallback((optionValue) => {
|
|
1746
|
+
// Safety check: ensure we're passing a string, not an object
|
|
1747
|
+
const safeValue = typeof optionValue === 'string' ? optionValue : String(optionValue);
|
|
1748
|
+
onChange?.(safeValue);
|
|
1749
|
+
closeDropdown();
|
|
1750
|
+
}, [onChange, closeDropdown]);
|
|
1751
|
+
// Keyboard navigation
|
|
1752
|
+
const handleKeyDown = require$$0.useCallback((e) => {
|
|
1753
|
+
if (disabled || loading)
|
|
1754
|
+
return;
|
|
1755
|
+
switch (e.key) {
|
|
1756
|
+
case 'Enter':
|
|
1757
|
+
case ' ':
|
|
1758
|
+
e.preventDefault();
|
|
1759
|
+
if (isOpen && highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
|
|
1760
|
+
const opt = filteredOptions[highlightedIndex];
|
|
1761
|
+
if (!opt.disabled) {
|
|
1762
|
+
handleSelect(opt.value);
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
else if (!isOpen) {
|
|
1766
|
+
openDropdown();
|
|
1767
|
+
}
|
|
1768
|
+
break;
|
|
1769
|
+
case 'ArrowDown':
|
|
1770
|
+
e.preventDefault();
|
|
1771
|
+
if (!isOpen) {
|
|
1772
|
+
openDropdown();
|
|
1773
|
+
}
|
|
1774
|
+
else {
|
|
1775
|
+
setHighlightedIndex(prev => {
|
|
1776
|
+
const next = prev + 1;
|
|
1777
|
+
return next >= filteredOptions.length ? 0 : next;
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
break;
|
|
1781
|
+
case 'ArrowUp':
|
|
1782
|
+
e.preventDefault();
|
|
1783
|
+
if (isOpen) {
|
|
1784
|
+
setHighlightedIndex(prev => {
|
|
1785
|
+
const next = prev - 1;
|
|
1786
|
+
return next < 0 ? filteredOptions.length - 1 : next;
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
break;
|
|
1790
|
+
case 'Escape':
|
|
1791
|
+
e.preventDefault();
|
|
1792
|
+
closeDropdown();
|
|
1793
|
+
break;
|
|
1794
|
+
case 'Tab':
|
|
1795
|
+
if (isOpen) {
|
|
1796
|
+
closeDropdown();
|
|
1797
|
+
}
|
|
1798
|
+
break;
|
|
1799
|
+
case 'Home':
|
|
1800
|
+
if (isOpen) {
|
|
1801
|
+
e.preventDefault();
|
|
1802
|
+
setHighlightedIndex(0);
|
|
1803
|
+
}
|
|
1804
|
+
break;
|
|
1805
|
+
case 'End':
|
|
1806
|
+
if (isOpen) {
|
|
1807
|
+
e.preventDefault();
|
|
1808
|
+
setHighlightedIndex(filteredOptions.length - 1);
|
|
1809
|
+
}
|
|
1810
|
+
break;
|
|
1811
|
+
}
|
|
1812
|
+
}, [disabled, loading, isOpen, highlightedIndex, filteredOptions, handleSelect, openDropdown, closeDropdown]);
|
|
1813
|
+
// Click outside to close
|
|
1814
|
+
require$$0.useEffect(() => {
|
|
1815
|
+
if (!isOpen)
|
|
1816
|
+
return;
|
|
1817
|
+
const handleClickOutside = (e) => {
|
|
1818
|
+
if (triggerRef.current?.contains(e.target) ||
|
|
1819
|
+
dropdownRef.current?.contains(e.target)) {
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
closeDropdown();
|
|
1823
|
+
};
|
|
1824
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
1825
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
1826
|
+
}, [isOpen, closeDropdown]);
|
|
1827
|
+
// Update position on scroll/resize
|
|
1828
|
+
require$$0.useEffect(() => {
|
|
1829
|
+
if (!isOpen)
|
|
1830
|
+
return;
|
|
1831
|
+
const handleUpdate = () => updateDropdownPosition();
|
|
1832
|
+
window.addEventListener('scroll', handleUpdate, true);
|
|
1833
|
+
window.addEventListener('resize', handleUpdate);
|
|
1834
|
+
return () => {
|
|
1835
|
+
window.removeEventListener('scroll', handleUpdate, true);
|
|
1836
|
+
window.removeEventListener('resize', handleUpdate);
|
|
1837
|
+
};
|
|
1838
|
+
}, [isOpen, updateDropdownPosition]);
|
|
1839
|
+
// Focus search input when dropdown opens
|
|
1840
|
+
require$$0.useEffect(() => {
|
|
1841
|
+
if (isOpen && searchable && searchInputRef.current) {
|
|
1842
|
+
searchInputRef.current.focus();
|
|
1843
|
+
}
|
|
1844
|
+
}, [isOpen, searchable]);
|
|
1845
|
+
// Scroll highlighted option into view
|
|
1846
|
+
require$$0.useEffect(() => {
|
|
1847
|
+
if (!isOpen || highlightedIndex < 0 || !listRef.current)
|
|
1848
|
+
return;
|
|
1849
|
+
const highlighted = listRef.current.children[highlightedIndex];
|
|
1850
|
+
if (highlighted) {
|
|
1851
|
+
highlighted.scrollIntoView({ block: 'nearest' });
|
|
1852
|
+
}
|
|
1853
|
+
}, [isOpen, highlightedIndex]);
|
|
1854
|
+
// Size classes
|
|
1855
|
+
const sizeClasses = {
|
|
1856
|
+
sm: 'mds-select--sm',
|
|
1857
|
+
md: 'mds-select--md',
|
|
1858
|
+
lg: 'mds-select--lg',
|
|
1859
|
+
};
|
|
1860
|
+
// Variant classes
|
|
1861
|
+
const variantClasses = {
|
|
1862
|
+
base: 'mds-select--base',
|
|
1863
|
+
themed: 'mds-select--themed',
|
|
1864
|
+
dashboard: 'mds-select--themed',
|
|
1865
|
+
};
|
|
1866
|
+
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);
|
|
1867
|
+
const dropdownClasses = cn('mds-select-dropdown', variantClasses[variant], dropdownClassName);
|
|
1868
|
+
// Hidden input for form submission
|
|
1869
|
+
const hiddenInput = name ? (jsxRuntimeExports.jsx("input", { type: "hidden", name: name, value: value || '' })) : null;
|
|
1870
|
+
// Dropdown portal content
|
|
1871
|
+
const dropdownContent = isOpen && mounted ? reactDom.createPortal(jsxRuntimeExports.jsxs("div", { ref: dropdownRef, className: dropdownClasses, style: {
|
|
1872
|
+
position: 'fixed',
|
|
1873
|
+
top: dropdownPosition.top,
|
|
1874
|
+
left: dropdownPosition.left,
|
|
1875
|
+
width: dropdownPosition.width,
|
|
1876
|
+
maxHeight,
|
|
1877
|
+
zIndex,
|
|
1878
|
+
}, 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) => {
|
|
1879
|
+
setSearchTerm(e.target.value);
|
|
1880
|
+
setHighlightedIndex(0);
|
|
1881
|
+
}, 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: () => {
|
|
1882
|
+
if (!option.disabled) {
|
|
1883
|
+
handleSelect(option.value);
|
|
1884
|
+
}
|
|
1885
|
+
}, onMouseEnter: () => {
|
|
1886
|
+
if (!option.disabled) {
|
|
1887
|
+
setHighlightedIndex(index);
|
|
1888
|
+
}
|
|
1889
|
+
}, 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;
|
|
1890
|
+
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] }));
|
|
1891
|
+
});
|
|
1892
|
+
Select.displayName = 'Select';
|
|
1893
|
+
|
|
1894
|
+
function ThemeToggle({ size = 'md', className = '', disabled = false, onChange, storageKey = 'theme' }) {
|
|
1895
|
+
const [theme, setTheme] = require$$0.useState('dark');
|
|
1896
|
+
const [mounted, setMounted] = require$$0.useState(false);
|
|
1897
|
+
// Initialize theme on mount
|
|
1898
|
+
require$$0.useEffect(() => {
|
|
1899
|
+
try {
|
|
1900
|
+
if (typeof window !== 'undefined') {
|
|
1901
|
+
const savedTheme = localStorage.getItem(storageKey) || 'dark';
|
|
1902
|
+
setTheme(savedTheme);
|
|
1903
|
+
document.documentElement.setAttribute('data-theme', savedTheme);
|
|
1904
|
+
setMounted(true);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
catch (err) {
|
|
1908
|
+
setTheme('dark');
|
|
1909
|
+
setMounted(true);
|
|
1910
|
+
}
|
|
1911
|
+
}, [storageKey]);
|
|
1912
|
+
// Listen to external theme changes
|
|
1913
|
+
require$$0.useEffect(() => {
|
|
1914
|
+
if (typeof window !== 'undefined') {
|
|
1915
|
+
const updateTheme = () => {
|
|
1916
|
+
const currentTheme = document.documentElement.getAttribute('data-theme') || 'dark';
|
|
1917
|
+
setTheme(currentTheme);
|
|
1918
|
+
};
|
|
1919
|
+
const observer = new MutationObserver(() => {
|
|
1920
|
+
updateTheme();
|
|
1921
|
+
});
|
|
1922
|
+
observer.observe(document.documentElement, {
|
|
1923
|
+
attributes: true,
|
|
1924
|
+
attributeFilter: ['data-theme']
|
|
1925
|
+
});
|
|
1926
|
+
return () => observer.disconnect();
|
|
1927
|
+
}
|
|
1928
|
+
}, []);
|
|
1929
|
+
const toggleTheme = () => {
|
|
1930
|
+
if (disabled)
|
|
1931
|
+
return;
|
|
1932
|
+
try {
|
|
1933
|
+
const newTheme = theme === 'light' ? 'dark' : 'light';
|
|
1934
|
+
document.documentElement.setAttribute('data-theme', newTheme);
|
|
1935
|
+
localStorage.setItem(storageKey, newTheme);
|
|
1936
|
+
setTheme(newTheme);
|
|
1937
|
+
onChange?.(newTheme);
|
|
1938
|
+
}
|
|
1939
|
+
catch (err) {
|
|
1940
|
+
console.warn('Failed to toggle theme:', err);
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
// Don't render until mounted (prevents hydration mismatch)
|
|
1944
|
+
if (!mounted) {
|
|
1945
|
+
return (jsxRuntimeExports.jsx("div", { className: `mds-theme-toggle mds-theme-toggle--${size} ${className}`, style: { opacity: 0.5 }, "aria-hidden": "true" }));
|
|
1946
|
+
}
|
|
1947
|
+
const isDark = theme === 'dark';
|
|
1948
|
+
const buttonStyle = isDark
|
|
1949
|
+
? {
|
|
1950
|
+
backgroundColor: 'rgba(0, 0, 0, 0.35)',
|
|
1951
|
+
border: '1px solid rgba(255, 255, 255, 0.18)',
|
|
1952
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.3)'
|
|
1953
|
+
}
|
|
1954
|
+
: undefined;
|
|
1955
|
+
const buttonClasses = [
|
|
1956
|
+
'mds-theme-toggle',
|
|
1957
|
+
`mds-theme-toggle--${size}`,
|
|
1958
|
+
className
|
|
1959
|
+
].filter(Boolean).join(' ');
|
|
1960
|
+
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 }));
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
const TableHeader = ({ columns, gridTemplate, onSort, sortColumn, sortDirection, hasActions = false }) => {
|
|
1964
|
+
return (jsxRuntimeExports.jsxs("div", { role: "rowgroup", style: {
|
|
1965
|
+
display: 'grid',
|
|
1966
|
+
gridTemplateColumns: gridTemplate,
|
|
1967
|
+
gap: '16px',
|
|
1968
|
+
padding: '16px 20px',
|
|
1969
|
+
borderBottom: '1px solid var(--border-color)',
|
|
1970
|
+
backgroundColor: 'rgba(255, 255, 255, 0.05)'
|
|
1971
|
+
}, children: [columns.map((column) => (jsxRuntimeExports.jsxs("div", { role: "columnheader", style: {
|
|
1972
|
+
color: 'var(--text-primary)',
|
|
1973
|
+
fontWeight: '500',
|
|
1974
|
+
fontSize: '14px',
|
|
1975
|
+
display: 'flex',
|
|
1976
|
+
alignItems: 'center',
|
|
1977
|
+
justifyContent: column.align === 'center' ? 'center' :
|
|
1978
|
+
column.align === 'right' ? 'flex-end' : 'flex-start',
|
|
1979
|
+
cursor: column.sortable && onSort ? 'pointer' : 'default',
|
|
1980
|
+
gap: '4px',
|
|
1981
|
+
transition: 'color 0.2s ease'
|
|
1982
|
+
}, onClick: () => column.sortable && onSort && onSort(column.key), onMouseEnter: (e) => {
|
|
1983
|
+
if (column.sortable && onSort) {
|
|
1984
|
+
e.currentTarget.style.color = '#ffffff';
|
|
1985
|
+
}
|
|
1986
|
+
}, onMouseLeave: (e) => {
|
|
1987
|
+
e.currentTarget.style.color = 'var(--text-primary)';
|
|
1988
|
+
}, children: [column.label, column.sortable && onSort && (jsxRuntimeExports.jsx("span", { style: {
|
|
1989
|
+
fontSize: '12px',
|
|
1990
|
+
opacity: sortColumn === column.key ? 1 : 0.5
|
|
1991
|
+
}, children: sortColumn === column.key ?
|
|
1992
|
+
(sortDirection === 'asc' ? '↑' : '↓') : '↕' }))] }, column.key))), hasActions && (jsxRuntimeExports.jsx("div", { role: "columnheader", style: {
|
|
1993
|
+
color: 'var(--text-primary)',
|
|
1994
|
+
fontWeight: '500',
|
|
1995
|
+
fontSize: '14px',
|
|
1996
|
+
display: 'flex',
|
|
1997
|
+
alignItems: 'center',
|
|
1998
|
+
justifyContent: 'center'
|
|
1999
|
+
}, children: "Actions" }))] }));
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
const TableRow = ({ item, index, columns, actions = [], gridTemplate, isLast, variant, onActionClick }) => {
|
|
2003
|
+
return (jsxRuntimeExports.jsxs("div", { role: "row", style: {
|
|
2004
|
+
display: 'grid',
|
|
2005
|
+
gridTemplateColumns: gridTemplate,
|
|
2006
|
+
gap: '16px',
|
|
2007
|
+
padding: variant === 'compact' ? '12px 20px' : '16px 20px',
|
|
2008
|
+
borderBottom: isLast ? 'none' : '1px solid var(--border-color)',
|
|
2009
|
+
backgroundColor: 'transparent',
|
|
2010
|
+
transition: 'background-color 0.2s ease'
|
|
2011
|
+
}, onMouseEnter: (e) => {
|
|
2012
|
+
e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.05)';
|
|
2013
|
+
}, onMouseLeave: (e) => {
|
|
2014
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
2015
|
+
}, children: [columns.map((column) => (jsxRuntimeExports.jsx("div", { role: "cell", style: {
|
|
2016
|
+
display: 'flex',
|
|
2017
|
+
flexDirection: 'column',
|
|
2018
|
+
gap: '4px',
|
|
2019
|
+
justifyContent: 'center',
|
|
2020
|
+
alignItems: column.align === 'center' ? 'center' :
|
|
2021
|
+
column.align === 'right' ? 'flex-end' : 'flex-start'
|
|
2022
|
+
}, children: column.render ?
|
|
2023
|
+
column.render(item[column.key], item, index) :
|
|
2024
|
+
jsxRuntimeExports.jsx("div", { style: {
|
|
2025
|
+
color: 'var(--text-primary)',
|
|
2026
|
+
fontSize: '14px'
|
|
2027
|
+
}, children: item[column.key] }) }, column.key))), actions.length > 0 && (jsxRuntimeExports.jsx("div", { role: "cell", style: {
|
|
2028
|
+
display: 'flex',
|
|
2029
|
+
gap: '8px',
|
|
2030
|
+
justifyContent: 'center',
|
|
2031
|
+
alignItems: 'center'
|
|
2032
|
+
}, children: actions.map((action) => {
|
|
2033
|
+
const isDisabled = action.disabled?.(item) || false;
|
|
2034
|
+
const isLoading = action.loading?.(item) || false;
|
|
2035
|
+
return (jsxRuntimeExports.jsxs("button", { onClick: () => !isDisabled && !isLoading && onActionClick(action, item), disabled: isDisabled || isLoading, style: {
|
|
2036
|
+
background: 'none',
|
|
2037
|
+
border: 'none',
|
|
2038
|
+
borderRadius: '6px',
|
|
2039
|
+
padding: '6px 8px',
|
|
2040
|
+
color: action.variant === 'danger' ? '#f87171' : 'var(--text-primary)',
|
|
2041
|
+
fontSize: '12px',
|
|
2042
|
+
cursor: isDisabled || isLoading ? 'not-allowed' : 'pointer',
|
|
2043
|
+
display: 'flex',
|
|
2044
|
+
alignItems: 'center',
|
|
2045
|
+
gap: '4px',
|
|
2046
|
+
transition: 'all 0.2s ease',
|
|
2047
|
+
opacity: isDisabled || isLoading ? 0.5 : 1,
|
|
2048
|
+
whiteSpace: 'nowrap'
|
|
2049
|
+
}, onMouseEnter: (e) => {
|
|
2050
|
+
if (!isDisabled && !isLoading) {
|
|
2051
|
+
if (action.variant === 'danger') {
|
|
2052
|
+
e.currentTarget.style.backgroundColor = 'rgba(239, 68, 68, 0.1)';
|
|
2053
|
+
}
|
|
2054
|
+
else {
|
|
2055
|
+
e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}, onMouseLeave: (e) => {
|
|
2059
|
+
if (!isDisabled && !isLoading) {
|
|
2060
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
2061
|
+
}
|
|
2062
|
+
}, children: [action.icon && action.icon, action.label] }, action.key));
|
|
2063
|
+
}) }))] }));
|
|
2064
|
+
};
|
|
2065
|
+
|
|
2066
|
+
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 }) => {
|
|
2067
|
+
const [sortColumn, setSortColumn] = require$$0.useState('');
|
|
2068
|
+
const [sortDirection, setSortDirection] = require$$0.useState('asc');
|
|
2069
|
+
// Filter data based on search term
|
|
2070
|
+
const filteredData = require$$0.useMemo(() => {
|
|
2071
|
+
if (!searchTerm)
|
|
2072
|
+
return data;
|
|
2073
|
+
return data.filter(item => {
|
|
2074
|
+
return columns.some(column => {
|
|
2075
|
+
const value = item[column.key];
|
|
2076
|
+
if (value === null || value === undefined)
|
|
2077
|
+
return false;
|
|
2078
|
+
return String(value).toLowerCase().includes(searchTerm.toLowerCase());
|
|
2079
|
+
});
|
|
2080
|
+
});
|
|
2081
|
+
}, [data, searchTerm, columns]);
|
|
2082
|
+
// Generate grid template based on columns and actions
|
|
2083
|
+
const gridTemplate = require$$0.useMemo(() => {
|
|
2084
|
+
const columnWidths = columns.map(col => col.width || '1fr').join(' ');
|
|
2085
|
+
const actionsWidth = actions.length > 0 ? ' 120px' : '';
|
|
2086
|
+
return columnWidths + actionsWidth;
|
|
2087
|
+
}, [columns, actions]);
|
|
2088
|
+
// Handle sort
|
|
2089
|
+
const handleSort = (columnKey) => {
|
|
2090
|
+
let direction = 'asc';
|
|
2091
|
+
if (sortColumn === columnKey && sortDirection === 'asc') {
|
|
2092
|
+
direction = 'desc';
|
|
2093
|
+
}
|
|
2094
|
+
setSortColumn(columnKey);
|
|
2095
|
+
setSortDirection(direction);
|
|
2096
|
+
if (onSort) {
|
|
2097
|
+
onSort(columnKey, direction);
|
|
2098
|
+
}
|
|
2099
|
+
};
|
|
2100
|
+
// Handle action click
|
|
2101
|
+
const handleActionClick = (action, item) => {
|
|
2102
|
+
action.onClick(item);
|
|
2103
|
+
};
|
|
2104
|
+
// Loading state
|
|
2105
|
+
if (loading) {
|
|
2106
|
+
return (jsxRuntimeExports.jsx("div", { className: className, style: {
|
|
2107
|
+
position: 'relative',
|
|
2108
|
+
borderRadius: '24px',
|
|
2109
|
+
backdropFilter: 'blur(24px)',
|
|
2110
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2111
|
+
border: '1px solid rgba(255, 255, 255, 0.3)',
|
|
2112
|
+
boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
|
|
2113
|
+
padding: '32px',
|
|
2114
|
+
...style
|
|
2115
|
+
}, children: jsxRuntimeExports.jsxs("div", { style: {
|
|
2116
|
+
display: 'flex',
|
|
2117
|
+
alignItems: 'center',
|
|
2118
|
+
justifyContent: 'center',
|
|
2119
|
+
gap: '12px'
|
|
2120
|
+
}, children: [jsxRuntimeExports.jsx("div", { style: {
|
|
2121
|
+
width: '32px',
|
|
2122
|
+
height: '32px',
|
|
2123
|
+
border: '2px solid transparent',
|
|
2124
|
+
borderTop: '2px solid white',
|
|
2125
|
+
borderRadius: '50%',
|
|
2126
|
+
animation: 'spin 1s linear infinite'
|
|
2127
|
+
} }), jsxRuntimeExports.jsx("span", { style: { color: 'var(--text-primary)' }, children: loadingMessage })] }) }));
|
|
2128
|
+
}
|
|
2129
|
+
// Empty state
|
|
2130
|
+
if (filteredData.length === 0) {
|
|
2131
|
+
return (jsxRuntimeExports.jsx("div", { className: className, style: {
|
|
2132
|
+
position: 'relative',
|
|
2133
|
+
borderRadius: '24px',
|
|
2134
|
+
backdropFilter: 'blur(24px)',
|
|
2135
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2136
|
+
border: '1px solid rgba(255, 255, 255, 0.3)',
|
|
2137
|
+
boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
|
|
2138
|
+
padding: '40px',
|
|
2139
|
+
textAlign: 'center',
|
|
2140
|
+
...style
|
|
2141
|
+
}, children: jsxRuntimeExports.jsx("div", { style: {
|
|
2142
|
+
color: 'var(--text-secondary)',
|
|
2143
|
+
fontSize: '16px'
|
|
2144
|
+
}, children: emptyMessage }) }));
|
|
2145
|
+
}
|
|
2146
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, style: {
|
|
2147
|
+
position: 'relative',
|
|
2148
|
+
borderRadius: '24px',
|
|
2149
|
+
backdropFilter: 'blur(24px)',
|
|
2150
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2151
|
+
border: '1px solid rgba(255, 255, 255, 0.3)',
|
|
2152
|
+
boxShadow: '0 12px 40px rgba(0, 0, 0, 0.15)',
|
|
2153
|
+
overflow: 'hidden',
|
|
2154
|
+
...style
|
|
2155
|
+
}, role: "table", "aria-label": "Tabela de dados", children: [showSearchCount && searchTerm && (jsxRuntimeExports.jsxs("div", { style: {
|
|
2156
|
+
padding: '16px',
|
|
2157
|
+
color: 'var(--text-secondary)',
|
|
2158
|
+
fontSize: '14px',
|
|
2159
|
+
borderBottom: '1px solid var(--border-color)'
|
|
2160
|
+
}, 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, hasActions: actions.length > 0 }), jsxRuntimeExports.jsx("div", { role: "rowgroup", style: {
|
|
2161
|
+
maxHeight,
|
|
2162
|
+
overflowY: 'auto'
|
|
2163
|
+
}, 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))) })] }));
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
const CellRenderers = {
|
|
2167
|
+
// ID cell - monospace background
|
|
2168
|
+
id: (value) => (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
|
|
2169
|
+
color: 'var(--text-secondary)',
|
|
2170
|
+
fontSize: '12px',
|
|
2171
|
+
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
2172
|
+
padding: '2px 8px',
|
|
2173
|
+
borderRadius: '4px',
|
|
2174
|
+
textAlign: 'center',
|
|
2175
|
+
fontFamily: 'monospace'
|
|
2176
|
+
}, children: value })),
|
|
2177
|
+
// Name cell - primary text with background
|
|
2178
|
+
name: (value) => (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
|
|
2179
|
+
color: 'var(--text-primary)',
|
|
2180
|
+
fontSize: '14px',
|
|
2181
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2182
|
+
padding: '4px 12px',
|
|
2183
|
+
borderRadius: '8px',
|
|
2184
|
+
fontFamily: 'monospace'
|
|
2185
|
+
}, children: value })),
|
|
2186
|
+
// Parameter value - masked if secure
|
|
2187
|
+
parameterValue: (value, item) => {
|
|
2188
|
+
const displayValue = item.type === 'SecureString' ? '••••••••' :
|
|
2189
|
+
(value?.length > 50 ? `${value.substring(0, 50)}...` : value);
|
|
2190
|
+
return (jsxRuntimeExports.jsx("div", { className: "data-table-code", style: {
|
|
2191
|
+
color: 'var(--text-primary)',
|
|
2192
|
+
fontSize: '14px',
|
|
2193
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2194
|
+
borderRadius: '8px',
|
|
2195
|
+
maxWidth: '300px',
|
|
2196
|
+
wordBreak: 'break-all',
|
|
2197
|
+
padding: '4px 12px',
|
|
2198
|
+
fontFamily: 'monospace'
|
|
2199
|
+
}, children: displayValue }));
|
|
2200
|
+
},
|
|
2201
|
+
// Badge renderer for types/statuses
|
|
2202
|
+
badge: (value, variant = 'primary') => (jsxRuntimeExports.jsx("span", { className: `data-table-badge ${variant}`, children: value })),
|
|
2203
|
+
// Parameter type badge
|
|
2204
|
+
parameterType: (value) => {
|
|
2205
|
+
const variant = value === 'SecureString' ? 'danger' :
|
|
2206
|
+
value === 'StringList' ? 'success' : 'primary';
|
|
2207
|
+
return CellRenderers.badge(value, variant);
|
|
2208
|
+
},
|
|
2209
|
+
// Environment badge
|
|
2210
|
+
environment: (value, item) => {
|
|
2211
|
+
const env = item.name?.includes('/prod/') ? 'PROD' : 'DEV';
|
|
2212
|
+
const variant = env === 'PROD' ? 'info' : 'warning';
|
|
2213
|
+
return CellRenderers.badge(env, variant);
|
|
2214
|
+
},
|
|
2215
|
+
// Action type badge for audit logs
|
|
2216
|
+
actionType: (value) => {
|
|
2217
|
+
const variant = value === 'CREATE' ? 'success' :
|
|
2218
|
+
value === 'UPDATE' ? 'primary' : 'danger';
|
|
2219
|
+
return CellRenderers.badge(value, variant);
|
|
2220
|
+
},
|
|
2221
|
+
// Date formatter
|
|
2222
|
+
date: (value) => (jsxRuntimeExports.jsx("div", { style: {
|
|
2223
|
+
color: 'var(--text-primary)',
|
|
2224
|
+
fontSize: '14px'
|
|
2225
|
+
}, children: value ? new Date(value).toLocaleString('pt-BR') : '-' })),
|
|
2226
|
+
// Description/secondary text
|
|
2227
|
+
description: (value) => (jsxRuntimeExports.jsx("div", { style: {
|
|
2228
|
+
color: 'var(--text-secondary)',
|
|
2229
|
+
fontSize: '12px',
|
|
2230
|
+
maxWidth: '300px',
|
|
2231
|
+
overflow: 'hidden',
|
|
2232
|
+
textOverflow: 'ellipsis',
|
|
2233
|
+
whiteSpace: 'nowrap'
|
|
2234
|
+
}, children: value })),
|
|
2235
|
+
// JSON preview for audit changes
|
|
2236
|
+
jsonPreview: (value) => {
|
|
2237
|
+
const jsonString = JSON.stringify(value);
|
|
2238
|
+
const preview = jsonString.length > 30 ? jsonString.substring(0, 30) + '...' : jsonString;
|
|
2239
|
+
return (jsxRuntimeExports.jsx("div", { style: {
|
|
2240
|
+
color: 'var(--text-secondary)',
|
|
2241
|
+
fontSize: '12px',
|
|
2242
|
+
fontFamily: 'monospace',
|
|
2243
|
+
maxWidth: '150px',
|
|
2244
|
+
overflow: 'hidden',
|
|
2245
|
+
textOverflow: 'ellipsis',
|
|
2246
|
+
whiteSpace: 'nowrap'
|
|
2247
|
+
}, children: preview }));
|
|
2248
|
+
},
|
|
2249
|
+
// Combined cell with main value and description
|
|
2250
|
+
combined: (mainValue, description) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [CellRenderers.name(mainValue), description && CellRenderers.description(description)] })),
|
|
2251
|
+
// Combined with badges
|
|
2252
|
+
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))) })] }))
|
|
2253
|
+
};
|
|
2254
|
+
// Common action icons
|
|
2255
|
+
const ActionIcons = {
|
|
2256
|
+
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" }) })),
|
|
2257
|
+
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" }) })),
|
|
2258
|
+
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" }) })),
|
|
2259
|
+
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" }) }))
|
|
2260
|
+
};
|
|
2261
|
+
|
|
2262
|
+
// Configuração para ParametersTable (Settings)
|
|
2263
|
+
const parametersTableConfig = {
|
|
2264
|
+
columns: [
|
|
2265
|
+
{
|
|
2266
|
+
key: 'name',
|
|
2267
|
+
label: 'Parâmetro',
|
|
2268
|
+
width: '1fr',
|
|
2269
|
+
render: (value, item) => CellRenderers.combinedWithBadges(value, [
|
|
2270
|
+
{ value: item.type, variant: item.type === 'SecureString' ? 'danger' :
|
|
2271
|
+
item.type === 'StringList' ? 'success' : 'primary' },
|
|
2272
|
+
{ value: item.name.includes('/prod/') ? 'PROD' : 'DEV',
|
|
2273
|
+
variant: item.name.includes('/prod/') ? 'info' : 'warning' }
|
|
2274
|
+
])
|
|
2275
|
+
},
|
|
2276
|
+
{
|
|
2277
|
+
key: 'value',
|
|
2278
|
+
label: 'Valor',
|
|
2279
|
+
width: '2fr',
|
|
2280
|
+
render: (value, item) => (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [CellRenderers.parameterValue(value, item), CellRenderers.description(item.description)] }))
|
|
2281
|
+
}
|
|
2282
|
+
],
|
|
2283
|
+
actions: [
|
|
2284
|
+
{
|
|
2285
|
+
key: 'edit',
|
|
2286
|
+
label: '✏️',
|
|
2287
|
+
variant: 'secondary',
|
|
2288
|
+
onClick: (item) => console.log('Edit', item),
|
|
2289
|
+
disabled: (item) => false
|
|
2290
|
+
},
|
|
2291
|
+
{
|
|
2292
|
+
key: 'delete',
|
|
2293
|
+
label: '🗑️',
|
|
2294
|
+
variant: 'danger',
|
|
2295
|
+
onClick: (item) => console.log('Delete', item),
|
|
2296
|
+
disabled: (item) => false,
|
|
2297
|
+
loading: (item) => item.deleting || false
|
|
2298
|
+
}
|
|
2299
|
+
]
|
|
2300
|
+
};
|
|
2301
|
+
// Configuração para GeographyTable - Regions
|
|
2302
|
+
const regionsTableConfig = {
|
|
2303
|
+
columns: [
|
|
2304
|
+
{
|
|
2305
|
+
key: 'region_id',
|
|
2306
|
+
label: 'ID',
|
|
2307
|
+
width: '80px',
|
|
2308
|
+
render: CellRenderers.id
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
key: 'name',
|
|
2312
|
+
label: 'Nome',
|
|
2313
|
+
width: '1fr',
|
|
2314
|
+
render: CellRenderers.name
|
|
2315
|
+
},
|
|
2316
|
+
{
|
|
2317
|
+
key: 'code',
|
|
2318
|
+
label: 'Código',
|
|
2319
|
+
width: '120px',
|
|
2320
|
+
render: CellRenderers.name
|
|
2321
|
+
},
|
|
2322
|
+
{
|
|
2323
|
+
key: 'created_at',
|
|
2324
|
+
label: 'Criado em',
|
|
2325
|
+
width: '140px',
|
|
2326
|
+
render: CellRenderers.date
|
|
2327
|
+
},
|
|
2328
|
+
{
|
|
2329
|
+
key: 'created_by',
|
|
2330
|
+
label: 'Criado por',
|
|
2331
|
+
width: '140px',
|
|
2332
|
+
render: (value) => CellRenderers.name(value)
|
|
2333
|
+
}
|
|
2334
|
+
],
|
|
2335
|
+
actions: [
|
|
2336
|
+
{
|
|
2337
|
+
key: 'edit',
|
|
2338
|
+
label: '✏️',
|
|
2339
|
+
variant: 'secondary',
|
|
2340
|
+
onClick: (item) => console.log('Edit region', item)
|
|
2341
|
+
},
|
|
2342
|
+
{
|
|
2343
|
+
key: 'delete',
|
|
2344
|
+
label: '🗑️',
|
|
2345
|
+
variant: 'danger',
|
|
2346
|
+
onClick: (item) => console.log('Delete region', item),
|
|
2347
|
+
loading: (item) => item.deleting || false
|
|
2348
|
+
}
|
|
2349
|
+
]
|
|
2350
|
+
};
|
|
2351
|
+
// Configuração para GeographyTable - Countries
|
|
2352
|
+
const countriesTableConfig = {
|
|
2353
|
+
columns: [
|
|
2354
|
+
{
|
|
2355
|
+
key: 'country_id',
|
|
2356
|
+
label: 'ID',
|
|
2357
|
+
width: '80px',
|
|
2358
|
+
render: CellRenderers.id
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
key: 'name',
|
|
2362
|
+
label: 'Nome',
|
|
2363
|
+
width: '1fr',
|
|
2364
|
+
render: CellRenderers.name
|
|
2365
|
+
},
|
|
2366
|
+
{
|
|
2367
|
+
key: 'iso2',
|
|
2368
|
+
label: 'Código',
|
|
2369
|
+
width: '120px',
|
|
2370
|
+
render: (value, item) => CellRenderers.combinedWithBadges(value, [
|
|
2371
|
+
{ value: item.iso3, variant: 'primary' }
|
|
2372
|
+
])
|
|
2373
|
+
},
|
|
2374
|
+
{
|
|
2375
|
+
key: 'capital',
|
|
2376
|
+
label: 'Capital',
|
|
2377
|
+
width: '140px',
|
|
2378
|
+
render: CellRenderers.name
|
|
2379
|
+
},
|
|
2380
|
+
{
|
|
2381
|
+
key: 'region',
|
|
2382
|
+
label: 'Região',
|
|
2383
|
+
width: '120px',
|
|
2384
|
+
render: (value) => CellRenderers.badge(value, 'info')
|
|
2385
|
+
}
|
|
2386
|
+
],
|
|
2387
|
+
actions: [
|
|
2388
|
+
{
|
|
2389
|
+
key: 'edit',
|
|
2390
|
+
label: '✏️',
|
|
2391
|
+
variant: 'secondary',
|
|
2392
|
+
onClick: (item) => console.log('Edit country', item)
|
|
2393
|
+
},
|
|
2394
|
+
{
|
|
2395
|
+
key: 'delete',
|
|
2396
|
+
label: '🗑️',
|
|
2397
|
+
variant: 'danger',
|
|
2398
|
+
onClick: (item) => console.log('Delete country', item)
|
|
2399
|
+
}
|
|
2400
|
+
]
|
|
2401
|
+
};
|
|
2402
|
+
// Configuração para Audit Log
|
|
2403
|
+
const auditLogTableConfig = {
|
|
2404
|
+
columns: [
|
|
2405
|
+
{
|
|
2406
|
+
key: 'timestamp',
|
|
2407
|
+
label: 'Data/Hora',
|
|
2408
|
+
width: '140px',
|
|
2409
|
+
render: CellRenderers.date
|
|
2410
|
+
},
|
|
2411
|
+
{
|
|
2412
|
+
key: 'user_email',
|
|
2413
|
+
label: 'Usuário',
|
|
2414
|
+
width: '180px',
|
|
2415
|
+
render: CellRenderers.name
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
key: 'action',
|
|
2419
|
+
label: 'Ação',
|
|
2420
|
+
width: '100px',
|
|
2421
|
+
render: CellRenderers.actionType
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
key: 'entity_type',
|
|
2425
|
+
label: 'Tipo',
|
|
2426
|
+
width: '120px',
|
|
2427
|
+
render: (value) => CellRenderers.badge(value, 'primary')
|
|
2428
|
+
},
|
|
2429
|
+
{
|
|
2430
|
+
key: 'entity_id',
|
|
2431
|
+
label: 'ID',
|
|
2432
|
+
width: '120px',
|
|
2433
|
+
render: CellRenderers.description
|
|
2434
|
+
},
|
|
2435
|
+
{
|
|
2436
|
+
key: 'changes',
|
|
2437
|
+
label: 'Alterações',
|
|
2438
|
+
width: '1fr',
|
|
2439
|
+
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: {
|
|
2440
|
+
background: 'none',
|
|
2441
|
+
border: '1px solid var(--border-color)',
|
|
2442
|
+
borderRadius: '4px',
|
|
2443
|
+
padding: '4px 8px',
|
|
2444
|
+
color: 'var(--text-primary)',
|
|
2445
|
+
fontSize: '12px',
|
|
2446
|
+
cursor: 'pointer',
|
|
2447
|
+
display: 'flex',
|
|
2448
|
+
alignItems: 'center',
|
|
2449
|
+
gap: '4px',
|
|
2450
|
+
transition: 'all 0.2s ease',
|
|
2451
|
+
whiteSpace: 'nowrap'
|
|
2452
|
+
}, children: [ActionIcons.view, "Ver Detalhes"] })] }))
|
|
2453
|
+
}
|
|
2454
|
+
]
|
|
2455
|
+
};
|
|
2456
|
+
// Configuração para States
|
|
2457
|
+
const statesTableConfig = {
|
|
2458
|
+
columns: [
|
|
2459
|
+
{
|
|
2460
|
+
key: 'state_id',
|
|
2461
|
+
label: 'ID',
|
|
2462
|
+
width: '80px',
|
|
2463
|
+
render: CellRenderers.id
|
|
2464
|
+
},
|
|
2465
|
+
{
|
|
2466
|
+
key: 'name',
|
|
2467
|
+
label: 'Nome',
|
|
2468
|
+
width: '1fr',
|
|
2469
|
+
render: CellRenderers.name
|
|
2470
|
+
},
|
|
2471
|
+
{
|
|
2472
|
+
key: 'code',
|
|
2473
|
+
label: 'Código',
|
|
2474
|
+
width: '120px',
|
|
2475
|
+
render: CellRenderers.name
|
|
2476
|
+
},
|
|
2477
|
+
{
|
|
2478
|
+
key: 'country_name',
|
|
2479
|
+
label: 'País',
|
|
2480
|
+
width: '140px',
|
|
2481
|
+
render: (value) => CellRenderers.badge(value, 'info')
|
|
2482
|
+
}
|
|
2483
|
+
],
|
|
2484
|
+
actions: [
|
|
2485
|
+
{
|
|
2486
|
+
key: 'edit',
|
|
2487
|
+
label: '✏️',
|
|
2488
|
+
variant: 'secondary',
|
|
2489
|
+
onClick: (item) => console.log('Edit state', item)
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
key: 'delete',
|
|
2493
|
+
label: '🗑️',
|
|
2494
|
+
variant: 'danger',
|
|
2495
|
+
onClick: (item) => console.log('Delete state', item)
|
|
2496
|
+
}
|
|
2497
|
+
]
|
|
2498
|
+
};
|
|
2499
|
+
// Configuração para Cities
|
|
2500
|
+
const citiesTableConfig = {
|
|
2501
|
+
columns: [
|
|
2502
|
+
{
|
|
2503
|
+
key: 'city_id',
|
|
2504
|
+
label: 'ID',
|
|
2505
|
+
width: '80px',
|
|
2506
|
+
render: CellRenderers.id
|
|
2507
|
+
},
|
|
2508
|
+
{
|
|
2509
|
+
key: 'name',
|
|
2510
|
+
label: 'Nome',
|
|
2511
|
+
width: '1fr',
|
|
2512
|
+
render: CellRenderers.name
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
key: 'population',
|
|
2516
|
+
label: 'População',
|
|
2517
|
+
width: '120px',
|
|
2518
|
+
render: (value) => (jsxRuntimeExports.jsx("div", { style: { color: 'var(--text-primary)', fontSize: '14px' }, children: value ? value.toLocaleString('pt-BR') : '-' }))
|
|
2519
|
+
},
|
|
2520
|
+
{
|
|
2521
|
+
key: 'state_name',
|
|
2522
|
+
label: 'Estado',
|
|
2523
|
+
width: '140px',
|
|
2524
|
+
render: (value) => CellRenderers.badge(value, 'success')
|
|
2525
|
+
},
|
|
2526
|
+
{
|
|
2527
|
+
key: 'country_name',
|
|
2528
|
+
label: 'País',
|
|
2529
|
+
width: '120px',
|
|
2530
|
+
render: (value) => CellRenderers.badge(value, 'info')
|
|
2531
|
+
}
|
|
2532
|
+
],
|
|
2533
|
+
actions: [
|
|
2534
|
+
{
|
|
2535
|
+
key: 'edit',
|
|
2536
|
+
label: '✏️',
|
|
2537
|
+
variant: 'secondary',
|
|
2538
|
+
onClick: (item) => console.log('Edit city', item)
|
|
2539
|
+
},
|
|
2540
|
+
{
|
|
2541
|
+
key: 'delete',
|
|
2542
|
+
label: '🗑️',
|
|
2543
|
+
variant: 'danger',
|
|
2544
|
+
onClick: (item) => console.log('Delete city', item)
|
|
2545
|
+
}
|
|
2546
|
+
]
|
|
2547
|
+
};
|
|
2548
|
+
// Função helper para aplicar configuração baseada no tipo
|
|
2549
|
+
const getTableConfig = (type) => {
|
|
2550
|
+
switch (type) {
|
|
2551
|
+
case 'parameters':
|
|
2552
|
+
return parametersTableConfig;
|
|
2553
|
+
case 'regions':
|
|
2554
|
+
return regionsTableConfig;
|
|
2555
|
+
case 'countries':
|
|
2556
|
+
return countriesTableConfig;
|
|
2557
|
+
case 'states':
|
|
2558
|
+
return statesTableConfig;
|
|
2559
|
+
case 'cities':
|
|
2560
|
+
return citiesTableConfig;
|
|
2561
|
+
case 'audit':
|
|
2562
|
+
return auditLogTableConfig;
|
|
2563
|
+
default:
|
|
2564
|
+
return parametersTableConfig;
|
|
2565
|
+
}
|
|
2566
|
+
};
|
|
2567
|
+
|
|
2568
|
+
/**
|
|
2569
|
+
* FormField - Normalized wrapper for form inputs
|
|
2570
|
+
*
|
|
2571
|
+
* Pattern extracted from AdminUserModal.tsx (backoffice/users)
|
|
2572
|
+
* Provides consistent label, error, and helper text styling
|
|
2573
|
+
*/
|
|
2574
|
+
function FormField({ label, required = false, error, helper, disabled = false, children, className = '' }) {
|
|
2575
|
+
return (jsxRuntimeExports.jsxs("div", { className: `mds-form-field ${className}`, style: { opacity: disabled ? 0.6 : 1 }, children: [jsxRuntimeExports.jsxs("label", { style: {
|
|
2576
|
+
display: 'block',
|
|
2577
|
+
marginBottom: '6px',
|
|
2578
|
+
color: 'var(--mds-color-text-primary, var(--text-primary))',
|
|
2579
|
+
fontSize: '0.9rem',
|
|
2580
|
+
fontWeight: 500
|
|
2581
|
+
}, children: [label, required && (jsxRuntimeExports.jsx("span", { style: { color: 'var(--mds-color-error, #ef4444)', marginLeft: '4px' }, children: "*" }))] }), children, error && (jsxRuntimeExports.jsx("span", { style: {
|
|
2582
|
+
color: 'var(--mds-color-error, #ef4444)',
|
|
2583
|
+
fontSize: '0.8rem',
|
|
2584
|
+
marginTop: '4px',
|
|
2585
|
+
display: 'block'
|
|
2586
|
+
}, children: error })), helper && !error && (jsxRuntimeExports.jsx("span", { style: {
|
|
2587
|
+
color: 'var(--mds-color-text-secondary, var(--text-secondary))',
|
|
2588
|
+
fontSize: '0.75rem',
|
|
2589
|
+
marginTop: '4px',
|
|
2590
|
+
display: 'block'
|
|
2591
|
+
}, children: helper }))] }));
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
const gapValues = {
|
|
2595
|
+
sm: '12px',
|
|
2596
|
+
md: '16px',
|
|
2597
|
+
lg: '24px'
|
|
2598
|
+
};
|
|
2599
|
+
/**
|
|
2600
|
+
* FormGrid - Normalized grid layout for form fields
|
|
2601
|
+
*
|
|
2602
|
+
* Pattern extracted from AdminUserModal.tsx (backoffice/users)
|
|
2603
|
+
* Provides consistent 1 or 2 column layouts with proper gap
|
|
2604
|
+
*/
|
|
2605
|
+
function FormGrid({ columns = 1, gap = 'md', children, className = '' }) {
|
|
2606
|
+
return (jsxRuntimeExports.jsx("div", { className: `mds-form-grid ${className}`, style: {
|
|
2607
|
+
display: 'grid',
|
|
2608
|
+
gridTemplateColumns: columns === 2 ? 'repeat(2, 1fr)' : '1fr',
|
|
2609
|
+
gap: gapValues[gap]
|
|
2610
|
+
}, children: children }));
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
/**
|
|
2614
|
+
* FormSection - Normalized section wrapper for grouping form fields
|
|
2615
|
+
*
|
|
2616
|
+
* Pattern extracted from AdminUserModal.tsx (backoffice/users)
|
|
2617
|
+
* Provides consistent section headers and spacing
|
|
2618
|
+
*/
|
|
2619
|
+
function FormSection({ title, description, children, className = '' }) {
|
|
2620
|
+
return (jsxRuntimeExports.jsxs("div", { className: `mds-form-section ${className}`, style: {
|
|
2621
|
+
marginBottom: '24px'
|
|
2622
|
+
}, children: [title && (jsxRuntimeExports.jsx("h4", { style: {
|
|
2623
|
+
margin: '0 0 8px 0',
|
|
2624
|
+
color: 'var(--mds-color-text-primary, var(--text-primary))',
|
|
2625
|
+
fontSize: '1rem',
|
|
2626
|
+
fontWeight: 600,
|
|
2627
|
+
letterSpacing: '-0.02em'
|
|
2628
|
+
}, children: title })), description && (jsxRuntimeExports.jsx("p", { style: {
|
|
2629
|
+
margin: '0 0 16px 0',
|
|
2630
|
+
color: 'var(--mds-color-text-secondary, var(--text-secondary))',
|
|
2631
|
+
fontSize: '0.85rem',
|
|
2632
|
+
lineHeight: 1.5
|
|
2633
|
+
}, children: description })), jsxRuntimeExports.jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' }, children: children })] }));
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
const variantColors = {
|
|
2637
|
+
default: {
|
|
2638
|
+
bg: 'rgba(255, 255, 255, 0.03)',
|
|
2639
|
+
border: 'rgba(255, 255, 255, 0.1)',
|
|
2640
|
+
accent: 'var(--mds-color-text-secondary, #888)'
|
|
2641
|
+
},
|
|
2642
|
+
info: {
|
|
2643
|
+
bg: 'rgba(59, 130, 246, 0.1)',
|
|
2644
|
+
border: 'rgba(59, 130, 246, 0.2)',
|
|
2645
|
+
accent: 'var(--mds-color-info, #3b82f6)'
|
|
2646
|
+
},
|
|
2647
|
+
success: {
|
|
2648
|
+
bg: 'rgba(16, 185, 129, 0.1)',
|
|
2649
|
+
border: 'rgba(16, 185, 129, 0.2)',
|
|
2650
|
+
accent: 'var(--mds-color-success, #10b981)'
|
|
2651
|
+
},
|
|
2652
|
+
warning: {
|
|
2653
|
+
bg: 'rgba(245, 158, 11, 0.1)',
|
|
2654
|
+
border: 'rgba(245, 158, 11, 0.2)',
|
|
2655
|
+
accent: 'var(--mds-color-warning, #f59e0b)'
|
|
2656
|
+
},
|
|
2657
|
+
danger: {
|
|
2658
|
+
bg: 'rgba(239, 68, 68, 0.1)',
|
|
2659
|
+
border: 'rgba(239, 68, 68, 0.2)',
|
|
2660
|
+
accent: 'var(--mds-color-error, #ef4444)'
|
|
2661
|
+
}
|
|
2662
|
+
};
|
|
2663
|
+
/**
|
|
2664
|
+
* InfoBox - Normalized info/alert box for read-only information
|
|
2665
|
+
*
|
|
2666
|
+
* Pattern extracted from AdminUserModal.tsx (backoffice/users)
|
|
2667
|
+
* Provides consistent info boxes for alerts, status displays, and read-only data
|
|
2668
|
+
*
|
|
2669
|
+
* @example
|
|
2670
|
+
* // Alert style (with accent)
|
|
2671
|
+
* <InfoBox variant="info" accent>
|
|
2672
|
+
* An invitation email will be sent...
|
|
2673
|
+
* </InfoBox>
|
|
2674
|
+
*
|
|
2675
|
+
* @example
|
|
2676
|
+
* // Status display (default)
|
|
2677
|
+
* <InfoBox title="User Information">
|
|
2678
|
+
* <InfoRow label="Status" value="Active" />
|
|
2679
|
+
* <InfoRow label="Created" value="Jan 1, 2024" />
|
|
2680
|
+
* </InfoBox>
|
|
2681
|
+
*/
|
|
2682
|
+
function InfoBox({ title, variant = 'default', accent = false, copyable = false, children, className = '' }) {
|
|
2683
|
+
const colors = variantColors[variant];
|
|
2684
|
+
const handleCopy = () => {
|
|
2685
|
+
if (!copyable)
|
|
2686
|
+
return;
|
|
2687
|
+
const text = typeof children === 'string' ? children : '';
|
|
2688
|
+
if (text) {
|
|
2689
|
+
navigator.clipboard.writeText(text);
|
|
2690
|
+
}
|
|
2691
|
+
};
|
|
2692
|
+
return (jsxRuntimeExports.jsxs("div", { className: `mds-info-box ${className}`, style: {
|
|
2693
|
+
padding: '12px 16px',
|
|
2694
|
+
backgroundColor: colors.bg,
|
|
2695
|
+
borderRadius: '8px',
|
|
2696
|
+
border: `1px solid ${colors.border}`,
|
|
2697
|
+
borderLeft: accent ? `4px solid ${colors.accent}` : `1px solid ${colors.border}`,
|
|
2698
|
+
cursor: copyable ? 'pointer' : 'default'
|
|
2699
|
+
}, onClick: copyable ? handleCopy : undefined, title: copyable ? 'Click to copy' : undefined, children: [title && (jsxRuntimeExports.jsx("div", { style: {
|
|
2700
|
+
color: 'var(--mds-color-text-secondary, var(--text-secondary))',
|
|
2701
|
+
fontSize: '0.85rem',
|
|
2702
|
+
marginBottom: '8px',
|
|
2703
|
+
fontWeight: 500
|
|
2704
|
+
}, children: title })), jsxRuntimeExports.jsx("div", { style: {
|
|
2705
|
+
color: 'var(--mds-color-text-primary, var(--text-primary))',
|
|
2706
|
+
fontSize: '0.9rem',
|
|
2707
|
+
lineHeight: 1.5
|
|
2708
|
+
}, children: children })] }));
|
|
2709
|
+
}
|
|
2710
|
+
function InfoRow({ label, value, valueColor }) {
|
|
2711
|
+
return (jsxRuntimeExports.jsxs("div", { style: {
|
|
2712
|
+
display: 'flex',
|
|
2713
|
+
justifyContent: 'space-between',
|
|
2714
|
+
fontSize: '0.85rem',
|
|
2715
|
+
padding: '2px 0'
|
|
2716
|
+
}, children: [jsxRuntimeExports.jsxs("span", { style: { color: 'var(--mds-color-text-secondary, var(--text-secondary))' }, children: [label, ":"] }), jsxRuntimeExports.jsx("span", { style: { color: valueColor || 'var(--mds-color-text-primary, var(--text-primary))' }, children: value })] }));
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
/**
|
|
2720
|
+
* Theme-aware styles generator - Liquid Glass pattern
|
|
2721
|
+
*
|
|
2722
|
+
* Light theme: White semi-transparent overlay to keep background bright
|
|
2723
|
+
* Dark theme: Dark overlay for contrast
|
|
2724
|
+
*/
|
|
2725
|
+
function getStyles(isDark) {
|
|
2726
|
+
return {
|
|
2727
|
+
// Overlay behind the modal
|
|
2728
|
+
overlay: {
|
|
2729
|
+
position: 'fixed',
|
|
2730
|
+
inset: 0,
|
|
2731
|
+
zIndex: 9999,
|
|
2732
|
+
display: 'flex',
|
|
2733
|
+
alignItems: 'center',
|
|
2734
|
+
justifyContent: 'center',
|
|
2735
|
+
padding: 20,
|
|
2736
|
+
// Light theme: white overlay to keep brightness
|
|
2737
|
+
// Dark theme: dark overlay for contrast
|
|
2738
|
+
backgroundColor: isDark ? 'rgba(0, 0, 0, 0.6)' : 'rgba(255, 255, 255, 0.4)',
|
|
2739
|
+
backdropFilter: 'blur(8px)',
|
|
2740
|
+
WebkitBackdropFilter: 'blur(8px)',
|
|
2741
|
+
},
|
|
2742
|
+
// Modal card - Liquid Glass
|
|
2743
|
+
card: {
|
|
2744
|
+
position: 'relative',
|
|
2745
|
+
maxWidth: 640,
|
|
2746
|
+
width: '100%',
|
|
2747
|
+
borderRadius: 24,
|
|
2748
|
+
overflow: 'hidden',
|
|
2749
|
+
// Light theme: Liquid Glass transparency
|
|
2750
|
+
// Dark theme: subtle glass effect
|
|
2751
|
+
background: isDark
|
|
2752
|
+
? 'rgba(255, 255, 255, 0.03)'
|
|
2753
|
+
: 'rgba(255, 255, 255, 0.45)',
|
|
2754
|
+
// Liquid Glass: Strong blur + saturation
|
|
2755
|
+
backdropFilter: 'blur(var(--mds-liquid-blur-xl, 24px)) saturate(var(--mds-liquid-saturate-vibrant, 140%))',
|
|
2756
|
+
WebkitBackdropFilter: 'blur(var(--mds-liquid-blur-xl, 24px)) saturate(var(--mds-liquid-saturate-vibrant, 140%))',
|
|
2757
|
+
// Liquid Glass: Subtle border for edge definition
|
|
2758
|
+
border: isDark
|
|
2759
|
+
? '1px solid rgba(255, 255, 255, 0.08)'
|
|
2760
|
+
: '1px solid rgba(255, 255, 255, 0.9)',
|
|
2761
|
+
// Liquid Glass: Layered shadows + inner glow
|
|
2762
|
+
boxShadow: isDark
|
|
2763
|
+
? '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))'
|
|
2764
|
+
: '0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 1)',
|
|
2765
|
+
// Liquid Glass: Smooth transition
|
|
2766
|
+
transition: 'var(--mds-liquid-transition, all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1))',
|
|
2767
|
+
},
|
|
2768
|
+
};
|
|
2769
|
+
}
|
|
2770
|
+
function Modal({ open, onClose, closeOnOverlay = true, children, className, style }) {
|
|
2771
|
+
const [mounted, setMounted] = require$$0.useState(false);
|
|
2772
|
+
const [visible, setVisible] = require$$0.useState(false);
|
|
2773
|
+
const [renderPortal, setRenderPortal] = require$$0.useState(false);
|
|
2774
|
+
const [isDarkTheme, setIsDarkTheme] = require$$0.useState(true);
|
|
2775
|
+
const containerRef = require$$0.useRef(null);
|
|
2776
|
+
require$$0.useEffect(() => setMounted(true), []);
|
|
2777
|
+
// Detect theme - EXACT same pattern as ProfileCard.tsx
|
|
2778
|
+
require$$0.useEffect(() => {
|
|
2779
|
+
const checkTheme = () => {
|
|
2780
|
+
const theme = document.documentElement.getAttribute('data-theme');
|
|
2781
|
+
setIsDarkTheme(theme !== 'light');
|
|
2782
|
+
};
|
|
2783
|
+
checkTheme();
|
|
2784
|
+
// Watch for theme changes
|
|
2785
|
+
const observer = new MutationObserver((mutations) => {
|
|
2786
|
+
mutations.forEach((mutation) => {
|
|
2787
|
+
if (mutation.attributeName === 'data-theme') {
|
|
2788
|
+
checkTheme();
|
|
2789
|
+
}
|
|
2790
|
+
});
|
|
2791
|
+
});
|
|
2792
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
2793
|
+
return () => observer.disconnect();
|
|
2794
|
+
}, []);
|
|
2795
|
+
require$$0.useEffect(() => {
|
|
2796
|
+
if (!mounted)
|
|
2797
|
+
return;
|
|
2798
|
+
if (open) {
|
|
2799
|
+
setVisible(true);
|
|
2800
|
+
setRenderPortal(true);
|
|
2801
|
+
}
|
|
2802
|
+
else {
|
|
2803
|
+
setVisible(false);
|
|
2804
|
+
const t = setTimeout(() => setRenderPortal(false), 200);
|
|
2805
|
+
return () => clearTimeout(t);
|
|
2806
|
+
}
|
|
2807
|
+
}, [open, mounted]);
|
|
2808
|
+
require$$0.useEffect(() => {
|
|
2809
|
+
if (!open)
|
|
2810
|
+
return;
|
|
2811
|
+
const onKeyDown = (e) => {
|
|
2812
|
+
if (e.key === 'Escape')
|
|
2813
|
+
onClose();
|
|
2814
|
+
};
|
|
2815
|
+
document.addEventListener('keydown', onKeyDown);
|
|
2816
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
2817
|
+
}, [open, onClose]);
|
|
2818
|
+
if (!mounted || (!renderPortal && !open))
|
|
2819
|
+
return null;
|
|
2820
|
+
// Get theme-aware styles (same pattern as ProfileCard)
|
|
2821
|
+
const styles = getStyles(isDarkTheme);
|
|
2822
|
+
const overlayStyle = {
|
|
2823
|
+
...styles.overlay,
|
|
2824
|
+
opacity: visible ? 1 : 0,
|
|
2825
|
+
transition: 'opacity 200ms ease',
|
|
2826
|
+
};
|
|
2827
|
+
const cardStyle = {
|
|
2828
|
+
...styles.card,
|
|
2829
|
+
transform: visible ? 'scale(1)' : 'scale(0.96)',
|
|
2830
|
+
opacity: visible ? 1 : 0,
|
|
2831
|
+
transition: 'opacity 200ms ease, transform 200ms cubic-bezier(0.4, 0, 0.2, 1)',
|
|
2832
|
+
...style,
|
|
2833
|
+
};
|
|
2834
|
+
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 }) }));
|
|
2835
|
+
return reactDom.createPortal(content, document.body);
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
const sizeMap$1 = {
|
|
2839
|
+
sm: '400px',
|
|
2840
|
+
md: '480px',
|
|
2841
|
+
lg: '600px',
|
|
2842
|
+
xl: '800px'
|
|
2843
|
+
};
|
|
2844
|
+
/**
|
|
2845
|
+
* FormModal - Normalized template for CRUD modal forms
|
|
2846
|
+
*
|
|
2847
|
+
* Pattern extracted from AdminUserModal.tsx (backoffice/users)
|
|
2848
|
+
* Provides consistent structure for create/edit entity modals
|
|
2849
|
+
*
|
|
2850
|
+
* @example
|
|
2851
|
+
* <FormModal
|
|
2852
|
+
* open={showModal}
|
|
2853
|
+
* onClose={() => setShowModal(false)}
|
|
2854
|
+
* onSubmit={handleSubmit}
|
|
2855
|
+
* title="Edit User"
|
|
2856
|
+
* info="Changes will be saved immediately."
|
|
2857
|
+
* infoVariant="info"
|
|
2858
|
+
* loading={isSaving}
|
|
2859
|
+
* submitText="Save"
|
|
2860
|
+
* >
|
|
2861
|
+
* <FormField label="Name" required error={errors.name}>
|
|
2862
|
+
* <input className="mds-input" value={name} onChange={...} />
|
|
2863
|
+
* </FormField>
|
|
2864
|
+
* </FormModal>
|
|
2865
|
+
*/
|
|
2866
|
+
function FormModal({ open, onClose, onSubmit, title, icon, subtitle, info, infoVariant = 'info', children, submitText = 'Save', cancelText = 'Cancel', loading = false, submitDisabled = false, size = 'md', className = '' }) {
|
|
2867
|
+
const handleSubmit = (e) => {
|
|
2868
|
+
e.preventDefault();
|
|
2869
|
+
onSubmit(e);
|
|
2870
|
+
};
|
|
2871
|
+
return (jsxRuntimeExports.jsxs(Modal, { open: open, onClose: onClose, closeOnOverlay: !loading, className: className, style: {
|
|
2872
|
+
maxWidth: sizeMap$1[size],
|
|
2873
|
+
maxHeight: '90vh',
|
|
2874
|
+
overflowY: 'auto',
|
|
2875
|
+
padding: '24px'
|
|
2876
|
+
}, children: [jsxRuntimeExports.jsxs("div", { style: {
|
|
2877
|
+
display: 'flex',
|
|
2878
|
+
alignItems: 'center',
|
|
2879
|
+
justifyContent: 'space-between',
|
|
2880
|
+
marginBottom: subtitle ? '8px' : '24px'
|
|
2881
|
+
}, children: [jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: [icon && (jsxRuntimeExports.jsx("div", { style: {
|
|
2882
|
+
display: 'flex',
|
|
2883
|
+
alignItems: 'center',
|
|
2884
|
+
justifyContent: 'center',
|
|
2885
|
+
width: 32,
|
|
2886
|
+
height: 32,
|
|
2887
|
+
fontSize: '1.25rem',
|
|
2888
|
+
lineHeight: 0,
|
|
2889
|
+
opacity: 0.5
|
|
2890
|
+
}, children: icon })), jsxRuntimeExports.jsx(Typography, { variant: "h3", color: "primary", style: { margin: 0 }, children: title })] }), jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: loading, style: {
|
|
2891
|
+
background: 'none',
|
|
2892
|
+
border: 'none',
|
|
2893
|
+
padding: '8px',
|
|
2894
|
+
cursor: loading ? 'not-allowed' : 'pointer',
|
|
2895
|
+
color: 'var(--mds-color-text-secondary)',
|
|
2896
|
+
opacity: loading ? 0.5 : 1,
|
|
2897
|
+
borderRadius: '6px',
|
|
2898
|
+
display: 'flex',
|
|
2899
|
+
alignItems: 'center',
|
|
2900
|
+
justifyContent: 'center',
|
|
2901
|
+
transition: 'all 0.2s ease'
|
|
2902
|
+
}, onMouseEnter: (e) => {
|
|
2903
|
+
if (!loading)
|
|
2904
|
+
e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
|
|
2905
|
+
}, onMouseLeave: (e) => {
|
|
2906
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
2907
|
+
}, "aria-label": "Close modal", children: jsxRuntimeExports.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), jsxRuntimeExports.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }) })] }), subtitle && (jsxRuntimeExports.jsx(Typography, { variant: "body", color: "secondary", style: { marginBottom: '24px', fontSize: '0.9rem' }, children: subtitle })), info && (jsxRuntimeExports.jsx("div", { style: { marginBottom: '20px' }, children: jsxRuntimeExports.jsx(InfoBox, { variant: infoVariant, accent: true, children: info }) })), jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, style: { display: 'flex', flexDirection: 'column', gap: '16px' }, children: [children, jsxRuntimeExports.jsxs("div", { style: {
|
|
2908
|
+
display: 'flex',
|
|
2909
|
+
gap: '12px',
|
|
2910
|
+
justifyContent: 'flex-end',
|
|
2911
|
+
marginTop: '16px',
|
|
2912
|
+
paddingTop: '16px',
|
|
2913
|
+
borderTop: '1px solid rgba(255, 255, 255, 0.1)'
|
|
2914
|
+
}, children: [jsxRuntimeExports.jsx(Button, { variant: "secondary", size: "sm", type: "button", onClick: onClose, disabled: loading, style: { minWidth: '90px' }, children: cancelText }), jsxRuntimeExports.jsx(Button, { variant: "primary", size: "sm", type: "submit", loading: loading, disabled: loading || submitDisabled, style: { minWidth: '110px' }, children: submitText })] })] })] }));
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
const sizeMap = {
|
|
2918
|
+
sm: '400px',
|
|
2919
|
+
md: '480px',
|
|
2920
|
+
lg: '600px',
|
|
2921
|
+
xl: '800px'
|
|
2922
|
+
};
|
|
2923
|
+
/**
|
|
2924
|
+
* DetailModal - Normalized template for read-only detail modals
|
|
2925
|
+
*
|
|
2926
|
+
* Pattern extracted from GeographyDetailsModal, AuditLogDetailModal (backoffice)
|
|
2927
|
+
* Provides consistent structure for viewing entity details
|
|
2928
|
+
*
|
|
2929
|
+
* @example
|
|
2930
|
+
* <DetailModal
|
|
2931
|
+
* open={showDetails}
|
|
2932
|
+
* onClose={() => setShowDetails(false)}
|
|
2933
|
+
* title="User Details"
|
|
2934
|
+
* subtitle="Created on Jan 1, 2024"
|
|
2935
|
+
* action={{
|
|
2936
|
+
* label: 'Edit',
|
|
2937
|
+
* onClick: handleEdit,
|
|
2938
|
+
* variant: 'primary'
|
|
2939
|
+
* }}
|
|
2940
|
+
* >
|
|
2941
|
+
* <InfoBox title="Basic Information">
|
|
2942
|
+
* <InfoRow label="Name" value={user.name} />
|
|
2943
|
+
* <InfoRow label="Email" value={user.email} />
|
|
2944
|
+
* </InfoBox>
|
|
2945
|
+
* </DetailModal>
|
|
2946
|
+
*/
|
|
2947
|
+
function DetailModal({ open, onClose, title, icon, subtitle, children, closeText = 'Close', action, size = 'md', className = '' }) {
|
|
2948
|
+
return (jsxRuntimeExports.jsxs(Modal, { open: open, onClose: onClose, closeOnOverlay: true, className: className, style: {
|
|
2949
|
+
maxWidth: sizeMap[size],
|
|
2950
|
+
maxHeight: '90vh',
|
|
2951
|
+
overflowY: 'auto',
|
|
2952
|
+
padding: '24px'
|
|
2953
|
+
}, children: [jsxRuntimeExports.jsxs("div", { style: {
|
|
2954
|
+
display: 'flex',
|
|
2955
|
+
alignItems: 'center',
|
|
2956
|
+
justifyContent: 'space-between',
|
|
2957
|
+
marginBottom: subtitle ? '8px' : '24px'
|
|
2958
|
+
}, children: [jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: [icon && (jsxRuntimeExports.jsx("div", { style: {
|
|
2959
|
+
display: 'flex',
|
|
2960
|
+
alignItems: 'center',
|
|
2961
|
+
justifyContent: 'center',
|
|
2962
|
+
width: 32,
|
|
2963
|
+
height: 32,
|
|
2964
|
+
fontSize: '1.25rem',
|
|
2965
|
+
lineHeight: 0,
|
|
2966
|
+
opacity: 0.5
|
|
2967
|
+
}, children: icon })), jsxRuntimeExports.jsx(Typography, { variant: "h3", color: "primary", style: { margin: 0 }, children: title })] }), jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, style: {
|
|
2968
|
+
background: 'none',
|
|
2969
|
+
border: 'none',
|
|
2970
|
+
padding: '8px',
|
|
2971
|
+
cursor: 'pointer',
|
|
2972
|
+
color: 'var(--mds-color-text-secondary)',
|
|
2973
|
+
borderRadius: '6px',
|
|
2974
|
+
display: 'flex',
|
|
2975
|
+
alignItems: 'center',
|
|
2976
|
+
justifyContent: 'center',
|
|
2977
|
+
transition: 'all 0.2s ease'
|
|
2978
|
+
}, onMouseEnter: (e) => {
|
|
2979
|
+
e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
|
|
2980
|
+
}, onMouseLeave: (e) => {
|
|
2981
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
2982
|
+
}, "aria-label": "Close modal", children: jsxRuntimeExports.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), jsxRuntimeExports.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }) })] }), subtitle && (jsxRuntimeExports.jsx(Typography, { variant: "body", color: "secondary", style: { marginBottom: '24px', fontSize: '0.9rem' }, children: subtitle })), jsxRuntimeExports.jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' }, children: children }), jsxRuntimeExports.jsxs("div", { style: {
|
|
2983
|
+
display: 'flex',
|
|
2984
|
+
gap: '12px',
|
|
2985
|
+
justifyContent: 'flex-end',
|
|
2986
|
+
marginTop: '24px',
|
|
2987
|
+
paddingTop: '16px',
|
|
2988
|
+
borderTop: '1px solid rgba(255, 255, 255, 0.1)'
|
|
2989
|
+
}, children: [jsxRuntimeExports.jsx(Button, { variant: "secondary", size: "sm", onClick: onClose, children: closeText }), action && (jsxRuntimeExports.jsx(Button, { variant: action.variant || 'primary', size: "sm", onClick: action.onClick, disabled: action.disabled, children: action.label }))] })] }));
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
function ModalHeader({ title, icon, onClose, closeAriaLabel = 'Fechar', align = 'center' }) {
|
|
2993
|
+
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" }) }));
|
|
2994
|
+
if (align === 'center') {
|
|
2995
|
+
const iconBox = {
|
|
2996
|
+
position: 'absolute',
|
|
2997
|
+
left: 16,
|
|
2998
|
+
top: '50%',
|
|
2999
|
+
transform: 'translateY(-50%)',
|
|
3000
|
+
width: 32,
|
|
3001
|
+
height: 32,
|
|
3002
|
+
display: 'inline-flex',
|
|
3003
|
+
alignItems: 'center',
|
|
3004
|
+
justifyContent: 'center',
|
|
3005
|
+
fontSize: '1.25rem',
|
|
3006
|
+
lineHeight: 0,
|
|
3007
|
+
opacity: 0.5
|
|
3008
|
+
};
|
|
3009
|
+
const closeBox = {
|
|
3010
|
+
position: 'absolute',
|
|
3011
|
+
right: 16,
|
|
3012
|
+
top: '50%',
|
|
3013
|
+
transform: 'translateY(-50%)',
|
|
3014
|
+
width: 32,
|
|
3015
|
+
height: 32,
|
|
3016
|
+
display: 'inline-flex',
|
|
3017
|
+
alignItems: 'center',
|
|
3018
|
+
justifyContent: 'center',
|
|
3019
|
+
background: 'transparent',
|
|
3020
|
+
border: 'none',
|
|
3021
|
+
padding: 0,
|
|
3022
|
+
cursor: 'pointer',
|
|
3023
|
+
lineHeight: 0
|
|
3024
|
+
};
|
|
3025
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mds-modal-header", style: {
|
|
3026
|
+
position: 'relative',
|
|
3027
|
+
padding: '16px 24px',
|
|
3028
|
+
marginBottom: 16,
|
|
3029
|
+
borderBottom: '1px solid var(--border-color)'
|
|
3030
|
+
}, 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 }))] }));
|
|
3031
|
+
}
|
|
3032
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mds-modal-header", style: {
|
|
3033
|
+
display: 'flex',
|
|
3034
|
+
alignItems: 'center',
|
|
3035
|
+
gap: 12,
|
|
3036
|
+
padding: '16px 24px',
|
|
3037
|
+
marginBottom: 16,
|
|
3038
|
+
borderBottom: '1px solid var(--border-color)'
|
|
3039
|
+
}, 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, opacity: 0.5 }, 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 }))] }));
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
function ModalBody({ children, style, className }) {
|
|
3043
|
+
return (jsxRuntimeExports.jsx("div", { className: className, style: { padding: '16px 24px', ...style }, children: children }));
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
function ModalFooter({ children, align = 'end' }) {
|
|
3047
|
+
const justify = align === 'start' ? 'flex-start' : align === 'center' ? 'center' : 'flex-end';
|
|
3048
|
+
return (jsxRuntimeExports.jsx("div", { style: { display: 'flex', gap: 12, justifyContent: justify, borderTop: '1px solid var(--border-color)', padding: '16px 24px', marginTop: 8 }, children: children }));
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
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" }) }));
|
|
3052
|
+
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" }) }));
|
|
3053
|
+
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" }) }));
|
|
3054
|
+
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" }) }));
|
|
3055
|
+
const toneIcon = {
|
|
3056
|
+
warning: IconWarning,
|
|
3057
|
+
danger: IconDanger,
|
|
3058
|
+
info: IconInfo,
|
|
3059
|
+
success: IconSuccess
|
|
3060
|
+
};
|
|
3061
|
+
function ConfirmDialog({ open, onClose, title, description, confirmText = 'Confirmar', cancelText = 'Cancelar', onConfirm, loading = false, tone = 'warning', icon, disableOverlayClose }) {
|
|
3062
|
+
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 })] })] }) }));
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
exports.ActionIcons = ActionIcons;
|
|
1493
3066
|
exports.BrandLogo = BrandLogo;
|
|
1494
3067
|
exports.Button = Button;
|
|
3068
|
+
exports.CellRenderers = CellRenderers;
|
|
3069
|
+
exports.ConfirmDialog = ConfirmDialog;
|
|
3070
|
+
exports.DataTable = DataTable;
|
|
3071
|
+
exports.DetailModal = DetailModal;
|
|
3072
|
+
exports.FormField = FormField;
|
|
3073
|
+
exports.FormGrid = FormGrid;
|
|
3074
|
+
exports.FormModal = FormModal;
|
|
3075
|
+
exports.FormSection = FormSection;
|
|
1495
3076
|
exports.GlassCard = GlassCard;
|
|
3077
|
+
exports.InfoBox = InfoBox;
|
|
3078
|
+
exports.InfoRow = InfoRow;
|
|
3079
|
+
exports.Modal = Modal;
|
|
3080
|
+
exports.ModalBody = ModalBody;
|
|
3081
|
+
exports.ModalFooter = ModalFooter;
|
|
3082
|
+
exports.ModalHeader = ModalHeader;
|
|
3083
|
+
exports.ProfileCard = ProfileCard;
|
|
3084
|
+
exports.Select = Select;
|
|
3085
|
+
exports.TableHeader = TableHeader;
|
|
3086
|
+
exports.TableRow = TableRow;
|
|
3087
|
+
exports.ThemeToggle = ThemeToggle;
|
|
1496
3088
|
exports.Typography = Typography;
|
|
3089
|
+
exports.auditLogTableConfig = auditLogTableConfig;
|
|
3090
|
+
exports.citiesTableConfig = citiesTableConfig;
|
|
1497
3091
|
exports.cn = cn;
|
|
3092
|
+
exports.countriesTableConfig = countriesTableConfig;
|
|
3093
|
+
exports.getTableConfig = getTableConfig;
|
|
3094
|
+
exports.parametersTableConfig = parametersTableConfig;
|
|
3095
|
+
exports.regionsTableConfig = regionsTableConfig;
|
|
3096
|
+
exports.statesTableConfig = statesTableConfig;
|
|
1498
3097
|
//# sourceMappingURL=index.js.map
|