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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +1 -0
  2. package/dist/css/compat/back.css +466 -0
  3. package/dist/css/components.css +999 -3
  4. package/dist/css/mermaid.css +163 -0
  5. package/dist/css/tokens.css +53 -0
  6. package/dist/react/components/react/Modal/ConfirmDialog.d.ts +17 -0
  7. package/dist/react/components/react/Modal/ConfirmDialog.d.ts.map +1 -0
  8. package/dist/react/components/react/Modal/Modal.d.ts +12 -0
  9. package/dist/react/components/react/Modal/Modal.d.ts.map +1 -0
  10. package/dist/react/components/react/Modal/ModalBody.d.ts +9 -0
  11. package/dist/react/components/react/Modal/ModalBody.d.ts.map +1 -0
  12. package/dist/react/components/react/Modal/ModalFooter.d.ts +8 -0
  13. package/dist/react/components/react/Modal/ModalFooter.d.ts.map +1 -0
  14. package/dist/react/components/react/Modal/ModalHeader.d.ts +11 -0
  15. package/dist/react/components/react/Modal/ModalHeader.d.ts.map +1 -0
  16. package/dist/react/components/react/Modal/index.d.ts +6 -0
  17. package/dist/react/components/react/Modal/index.d.ts.map +1 -0
  18. package/dist/react/components/react/Select/Select.d.ts +20 -0
  19. package/dist/react/components/react/Select/Select.d.ts.map +1 -0
  20. package/dist/react/components/react/Select/index.d.ts +2 -0
  21. package/dist/react/components/react/Select/index.d.ts.map +1 -0
  22. package/dist/react/components/react/ThemeToggle/ThemeToggle.d.ts +28 -0
  23. package/dist/react/components/react/ThemeToggle/ThemeToggle.d.ts.map +1 -0
  24. package/dist/react/components/react/ThemeToggle/index.d.ts +3 -0
  25. package/dist/react/components/react/ThemeToggle/index.d.ts.map +1 -0
  26. package/dist/react/components/react/Typography/Typography.d.ts.map +1 -1
  27. package/dist/react/components/react/index.d.ts +9 -0
  28. package/dist/react/components/react/index.d.ts.map +1 -1
  29. package/dist/react/index.d.ts +17 -0
  30. package/dist/react/index.esm.js +224 -4
  31. package/dist/react/index.esm.js.map +1 -1
  32. package/dist/react/index.js +229 -2
  33. package/dist/react/index.js.map +1 -1
  34. package/dist/tokens/index.d.ts +19 -24
  35. package/dist/tokens/index.js +55 -2
  36. package/package.json +24 -14
@@ -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
 
@@ -1460,13 +1461,14 @@ const Typography = require$$0.forwardRef(({ variant = 'body', size, as, children
1460
1461
  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
1462
  });
1462
1463
  Typography.displayName = 'Typography';
1463
- const BrandLogo = require$$0.forwardRef(({ size = 'md', className, children = 'Metropolle', ...props }, ref) => {
1464
+ const BrandLogo = require$$0.forwardRef(({ size = 'md', weight = 'bold', // Peso bold por padrão para a marca
1465
+ className, children = 'Metropolle', ...props }, ref) => {
1464
1466
  const sizeMap = {
1465
1467
  sm: '2xl',
1466
1468
  md: '4xl',
1467
1469
  lg: '4xl', // Same as md but with different mobile behavior
1468
1470
  };
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 }));
1471
+ 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
1472
  });
1471
1473
  BrandLogo.displayName = 'BrandLogo';
1472
1474
 
@@ -1490,9 +1492,234 @@ Button.displayName = 'Button';
1490
1492
  */
1491
1493
  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
1494
 
1495
+ /**
1496
+ * Select Component (Design System)
1497
+ *
1498
+ * Provides a themed select element with multiple variants:
1499
+ * - `base`: Standard form select with mds-input styling
1500
+ * - `themed`: Generic themed select with dashboard control styling (recommended)
1501
+ * - `dashboard`: Legacy alias for themed variant (backward compatibility)
1502
+ */
1503
+ const Select = require$$0.forwardRef(({ options, children, className, containerClassName, variant = 'themed', ...rest }, ref) => {
1504
+ const isThemed = variant === 'themed' || variant === 'dashboard';
1505
+ const selectEl = (jsxRuntimeExports.jsx("select", { ref: ref, className: cn(isThemed
1506
+ ? 'mds-select-themed'
1507
+ : 'mds-input mds-select', className), ...rest, children: options
1508
+ ? options.map(opt => (jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value)))
1509
+ : children }));
1510
+ if (isThemed) {
1511
+ return (jsxRuntimeExports.jsx("div", { className: cn('mds-dropdown', containerClassName), children: selectEl }));
1512
+ }
1513
+ return selectEl;
1514
+ });
1515
+ Select.displayName = 'Select';
1516
+
1517
+ function ThemeToggle({ size = 'md', className = '', disabled = false, onChange, storageKey = 'theme' }) {
1518
+ const [theme, setTheme] = require$$0.useState('dark');
1519
+ const [mounted, setMounted] = require$$0.useState(false);
1520
+ // Initialize theme on mount
1521
+ require$$0.useEffect(() => {
1522
+ try {
1523
+ if (typeof window !== 'undefined') {
1524
+ const savedTheme = localStorage.getItem(storageKey) || 'dark';
1525
+ setTheme(savedTheme);
1526
+ document.documentElement.setAttribute('data-theme', savedTheme);
1527
+ setMounted(true);
1528
+ }
1529
+ }
1530
+ catch (err) {
1531
+ setTheme('dark');
1532
+ setMounted(true);
1533
+ }
1534
+ }, [storageKey]);
1535
+ // Listen to external theme changes
1536
+ require$$0.useEffect(() => {
1537
+ if (typeof window !== 'undefined') {
1538
+ const updateTheme = () => {
1539
+ const currentTheme = document.documentElement.getAttribute('data-theme') || 'dark';
1540
+ setTheme(currentTheme);
1541
+ };
1542
+ const observer = new MutationObserver(() => {
1543
+ updateTheme();
1544
+ });
1545
+ observer.observe(document.documentElement, {
1546
+ attributes: true,
1547
+ attributeFilter: ['data-theme']
1548
+ });
1549
+ return () => observer.disconnect();
1550
+ }
1551
+ }, []);
1552
+ const toggleTheme = () => {
1553
+ if (disabled)
1554
+ return;
1555
+ try {
1556
+ const newTheme = theme === 'light' ? 'dark' : 'light';
1557
+ document.documentElement.setAttribute('data-theme', newTheme);
1558
+ localStorage.setItem(storageKey, newTheme);
1559
+ setTheme(newTheme);
1560
+ onChange?.(newTheme);
1561
+ }
1562
+ catch (err) {
1563
+ console.warn('Failed to toggle theme:', err);
1564
+ }
1565
+ };
1566
+ // Don't render until mounted (prevents hydration mismatch)
1567
+ if (!mounted) {
1568
+ return (jsxRuntimeExports.jsx("div", { className: `mds-theme-toggle mds-theme-toggle--${size} ${className}`, style: { opacity: 0.5 }, "aria-hidden": "true" }));
1569
+ }
1570
+ const isDark = theme === 'dark';
1571
+ const buttonStyle = isDark
1572
+ ? {
1573
+ backgroundColor: 'rgba(0, 0, 0, 0.35)',
1574
+ border: '1px solid rgba(255, 255, 255, 0.18)',
1575
+ boxShadow: '0 2px 8px rgba(0, 0, 0, 0.3)'
1576
+ }
1577
+ : undefined;
1578
+ const buttonClasses = [
1579
+ 'mds-theme-toggle',
1580
+ `mds-theme-toggle--${size}`,
1581
+ className
1582
+ ].filter(Boolean).join(' ');
1583
+ 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 }));
1584
+ }
1585
+
1586
+ function Modal({ open, onClose, closeOnOverlay = true, children, className, style }) {
1587
+ const [mounted, setMounted] = require$$0.useState(false);
1588
+ const [visible, setVisible] = require$$0.useState(false);
1589
+ const [renderPortal, setRenderPortal] = require$$0.useState(false);
1590
+ const containerRef = require$$0.useRef(null);
1591
+ require$$0.useEffect(() => setMounted(true), []);
1592
+ require$$0.useEffect(() => {
1593
+ if (!mounted)
1594
+ return;
1595
+ if (open) {
1596
+ setVisible(true);
1597
+ setRenderPortal(true);
1598
+ }
1599
+ else {
1600
+ setVisible(false);
1601
+ const t = setTimeout(() => setRenderPortal(false), 200);
1602
+ return () => clearTimeout(t);
1603
+ }
1604
+ }, [open, mounted]);
1605
+ require$$0.useEffect(() => {
1606
+ if (!open)
1607
+ return;
1608
+ const onKeyDown = (e) => {
1609
+ if (e.key === 'Escape')
1610
+ onClose();
1611
+ };
1612
+ document.addEventListener('keydown', onKeyDown);
1613
+ return () => document.removeEventListener('keydown', onKeyDown);
1614
+ }, [open, onClose]);
1615
+ if (!mounted || (!renderPortal && !open))
1616
+ return null;
1617
+ const overlayStyle = {
1618
+ position: 'fixed',
1619
+ inset: 0,
1620
+ backgroundColor: 'rgba(0, 0, 0, 0.7)',
1621
+ display: 'flex',
1622
+ alignItems: 'center',
1623
+ justifyContent: 'center',
1624
+ zIndex: 1000,
1625
+ padding: '16px',
1626
+ opacity: visible ? 1 : 0,
1627
+ transition: 'opacity 200ms ease'
1628
+ };
1629
+ const innerStyle = {
1630
+ maxWidth: '640px',
1631
+ width: '100%',
1632
+ transform: visible ? 'scale(1)' : 'scale(0.98)',
1633
+ opacity: visible ? 1 : 0,
1634
+ transition: 'opacity 200ms ease, transform 200ms ease',
1635
+ ...style
1636
+ };
1637
+ 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: innerStyle, onClick: (e) => e.stopPropagation(), ref: (el) => (containerRef.current = el), children: children }) }));
1638
+ return reactDom.createPortal(content, document.body);
1639
+ }
1640
+
1641
+ function ModalHeader({ title, icon, onClose, closeAriaLabel = 'Fechar', align = 'center' }) {
1642
+ 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" }) }));
1643
+ if (align === 'center') {
1644
+ const iconBox = {
1645
+ position: 'absolute',
1646
+ left: 16,
1647
+ top: '50%',
1648
+ transform: 'translateY(-50%)',
1649
+ width: 32,
1650
+ height: 32,
1651
+ display: 'inline-flex',
1652
+ alignItems: 'center',
1653
+ justifyContent: 'center',
1654
+ fontSize: '1.25rem',
1655
+ lineHeight: 0
1656
+ };
1657
+ const closeBox = {
1658
+ position: 'absolute',
1659
+ right: 16,
1660
+ top: '50%',
1661
+ transform: 'translateY(-50%)',
1662
+ width: 32,
1663
+ height: 32,
1664
+ display: 'inline-flex',
1665
+ alignItems: 'center',
1666
+ justifyContent: 'center',
1667
+ background: 'transparent',
1668
+ border: 'none',
1669
+ padding: 0,
1670
+ cursor: 'pointer',
1671
+ lineHeight: 0
1672
+ };
1673
+ return (jsxRuntimeExports.jsxs("div", { className: "mds-modal-header", style: {
1674
+ position: 'relative',
1675
+ padding: '16px 24px',
1676
+ marginBottom: 16,
1677
+ borderBottom: '1px solid var(--border-color)'
1678
+ }, 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 }))] }));
1679
+ }
1680
+ return (jsxRuntimeExports.jsxs("div", { className: "mds-modal-header", style: {
1681
+ display: 'flex',
1682
+ alignItems: 'center',
1683
+ gap: 12,
1684
+ padding: '16px 24px',
1685
+ marginBottom: 16,
1686
+ borderBottom: '1px solid var(--border-color)'
1687
+ }, children: [icon && (jsxRuntimeExports.jsx("div", { "aria-hidden": true, style: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 32, height: 32, fontSize: '1.25rem', lineHeight: 0 }, children: icon })), jsxRuntimeExports.jsx("div", { style: { margin: 0, fontSize: '1.125rem', fontWeight: 600, flex: 1 }, children: typeof title === 'string' ? (jsxRuntimeExports.jsx("h3", { style: { margin: 0 }, children: title })) : (title) }), onClose && (jsxRuntimeExports.jsx("button", { type: "button", "aria-label": closeAriaLabel, onClick: onClose, style: { marginLeft: 'auto', background: 'transparent', border: 'none', width: 32, height: 32, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', lineHeight: 0 }, children: CloseIcon }))] }));
1688
+ }
1689
+
1690
+ function ModalBody({ children, style, className }) {
1691
+ return (jsxRuntimeExports.jsx("div", { className: className, style: { padding: '16px 24px', ...style }, children: children }));
1692
+ }
1693
+
1694
+ function ModalFooter({ children, align = 'end' }) {
1695
+ const justify = align === 'start' ? 'flex-start' : align === 'center' ? 'center' : 'flex-end';
1696
+ return (jsxRuntimeExports.jsx("div", { style: { display: 'flex', gap: 12, justifyContent: justify, borderTop: '1px solid var(--border-color)', padding: '16px 24px', marginTop: 8 }, children: children }));
1697
+ }
1698
+
1699
+ 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" }) }));
1700
+ 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" }) }));
1701
+ 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" }) }));
1702
+ 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" }) }));
1703
+ const toneIcon = {
1704
+ warning: IconWarning,
1705
+ danger: IconDanger,
1706
+ info: IconInfo,
1707
+ success: IconSuccess
1708
+ };
1709
+ function ConfirmDialog({ open, onClose, title, description, confirmText = 'Confirmar', cancelText = 'Cancelar', onConfirm, loading = false, tone = 'warning', icon, disableOverlayClose }) {
1710
+ 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 })] })] }) }));
1711
+ }
1712
+
1493
1713
  exports.BrandLogo = BrandLogo;
1494
1714
  exports.Button = Button;
1715
+ exports.ConfirmDialog = ConfirmDialog;
1495
1716
  exports.GlassCard = GlassCard;
1717
+ exports.Modal = Modal;
1718
+ exports.ModalBody = ModalBody;
1719
+ exports.ModalFooter = ModalFooter;
1720
+ exports.ModalHeader = ModalHeader;
1721
+ exports.Select = Select;
1722
+ exports.ThemeToggle = ThemeToggle;
1496
1723
  exports.Typography = Typography;
1497
1724
  exports.cn = cn;
1498
1725
  //# sourceMappingURL=index.js.map