@metropolle/design-system 1.0.0-beta.2025.9.12.1800.94b9f9c → 1.0.0-beta.2025.9.14.249.4545829
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/dist/css/components.css +101 -4
- package/dist/react/components/react/Select/Select.d.ts +19 -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/index.d.ts +4 -0
- package/dist/react/components/react/index.d.ts.map +1 -1
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.esm.js +91 -2
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react/index.js +91 -0
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/css/components.css
CHANGED
|
@@ -613,11 +613,11 @@ html:not([data-theme]) .modal-overlay .mds-modal-card {
|
|
|
613
613
|
|
|
614
614
|
/* Theme Support - Default (Dark Theme) */
|
|
615
615
|
:root {
|
|
616
|
-
/* Dashboard Control Variables - Dark Theme */
|
|
617
|
-
--mds-dashboard-control-bg: rgba(
|
|
618
|
-
--mds-dashboard-control-bg-hover: rgba(
|
|
616
|
+
/* Dashboard Control Variables - Dark Theme (default) */
|
|
617
|
+
--mds-dashboard-control-bg: rgba(0, 0, 0, 0.35);
|
|
618
|
+
--mds-dashboard-control-bg-hover: rgba(0, 0, 0, 0.5);
|
|
619
619
|
--mds-dashboard-control-color: #ffffff;
|
|
620
|
-
--mds-dashboard-control-border: rgba(255, 255, 255, 0.
|
|
620
|
+
--mds-dashboard-control-border: rgba(255, 255, 255, 0.18);
|
|
621
621
|
--mds-dashboard-control-border-disabled: rgba(255, 255, 255, 0.3);
|
|
622
622
|
--mds-dashboard-control-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
623
623
|
--mds-dashboard-control-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
@@ -626,6 +626,94 @@ html:not([data-theme]) .modal-overlay .mds-modal-card {
|
|
|
626
626
|
/* Dropdown Options - Dark Theme */
|
|
627
627
|
--mds-dashboard-control-option-bg: #2a2a2a;
|
|
628
628
|
--mds-dashboard-control-option-color: #ffffff;
|
|
629
|
+
|
|
630
|
+
/* Login specific variables - Dark Theme */
|
|
631
|
+
--mds-login-bg: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #2a2a2a 100%);
|
|
632
|
+
--mds-input-bg: rgba(255, 255, 255, 0.1);
|
|
633
|
+
--mds-input-focus-border: #aaaaaa;
|
|
634
|
+
--mds-input-focus-bg: rgba(255, 255, 255, 0.15);
|
|
635
|
+
--mds-input-focus-shadow: 0 4px 12px rgba(170, 170, 170, 0.2);
|
|
636
|
+
--mds-error-bg: rgba(200, 200, 200, 0.15);
|
|
637
|
+
--mds-error-border: rgba(200, 200, 200, 0.3);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/* Theme Toggle (square, themed) */
|
|
641
|
+
.mds-theme-toggle {
|
|
642
|
+
position: relative;
|
|
643
|
+
display: inline-flex;
|
|
644
|
+
align-items: center;
|
|
645
|
+
justify-content: center;
|
|
646
|
+
width: var(--mds-theme-toggle-size, 2.5rem);
|
|
647
|
+
height: var(--mds-theme-toggle-size, 2.5rem);
|
|
648
|
+
min-width: var(--mds-theme-toggle-size, 2.5rem);
|
|
649
|
+
padding: 0;
|
|
650
|
+
border-radius: var(--mds-spacing-borderRadius-md);
|
|
651
|
+
border: 1px solid var(--mds-dashboard-control-border);
|
|
652
|
+
background-color: var(--mds-dashboard-control-bg);
|
|
653
|
+
color: var(--mds-dashboard-control-color);
|
|
654
|
+
box-shadow: var(--mds-dashboard-control-shadow);
|
|
655
|
+
cursor: pointer;
|
|
656
|
+
outline: none;
|
|
657
|
+
transition: var(--mds-effects-transition-normal);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/* Force dark background in dark theme */
|
|
661
|
+
.mds-theme-toggle[data-theme="dark"] {
|
|
662
|
+
background-color: rgba(0, 0, 0, 0.35) !important;
|
|
663
|
+
border: 1px solid rgba(255, 255, 255, 0.18) !important;
|
|
664
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.mds-theme-toggle:hover:not(:disabled) {
|
|
668
|
+
background-color: var(--mds-dashboard-control-bg-hover);
|
|
669
|
+
box-shadow: var(--mds-dashboard-control-shadow-hover);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/* Force dark hover in dark theme */
|
|
673
|
+
.mds-theme-toggle[data-theme="dark"]:hover:not(:disabled) {
|
|
674
|
+
background-color: rgba(0, 0, 0, 0.5) !important;
|
|
675
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.mds-theme-toggle:disabled {
|
|
679
|
+
opacity: var(--mds-effects-opacity-disabled);
|
|
680
|
+
cursor: not-allowed;
|
|
681
|
+
background-color: transparent !important;
|
|
682
|
+
border: 2px solid var(--mds-dashboard-control-border-disabled);
|
|
683
|
+
box-shadow: none !important;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
.mds-theme-toggle--sm { --mds-theme-toggle-size: 2rem; }
|
|
687
|
+
.mds-theme-toggle--md { --mds-theme-toggle-size: 2.5rem; }
|
|
688
|
+
.mds-theme-toggle--lg { --mds-theme-toggle-size: 3rem; }
|
|
689
|
+
|
|
690
|
+
/* Monochromatic theme toggle icons via CSS pseudo-elements */
|
|
691
|
+
.mds-theme-toggle[data-theme="light"]::before {
|
|
692
|
+
content: '';
|
|
693
|
+
position: absolute;
|
|
694
|
+
left: 50%;
|
|
695
|
+
top: 50%;
|
|
696
|
+
transform: translate(-50%, -50%);
|
|
697
|
+
width: 20px;
|
|
698
|
+
height: 20px;
|
|
699
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z' fill='%23000000'/%3E%3C/svg%3E");
|
|
700
|
+
background-size: contain;
|
|
701
|
+
background-repeat: no-repeat;
|
|
702
|
+
background-position: center;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.mds-theme-toggle[data-theme="dark"]::before {
|
|
706
|
+
content: '';
|
|
707
|
+
position: absolute;
|
|
708
|
+
left: 50%;
|
|
709
|
+
top: 50%;
|
|
710
|
+
transform: translate(-50%, -50%);
|
|
711
|
+
width: 20px;
|
|
712
|
+
height: 20px;
|
|
713
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='4' fill='%23ffffff'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
|
|
714
|
+
background-size: contain;
|
|
715
|
+
background-repeat: no-repeat;
|
|
716
|
+
background-position: center;
|
|
629
717
|
}
|
|
630
718
|
|
|
631
719
|
/* Light Theme Support */
|
|
@@ -642,6 +730,15 @@ html:not([data-theme]) .modal-overlay .mds-modal-card {
|
|
|
642
730
|
/* Dropdown Options - Light Theme */
|
|
643
731
|
--mds-dashboard-control-option-bg: #ffffff;
|
|
644
732
|
--mds-dashboard-control-option-color: #1a1a1a;
|
|
733
|
+
|
|
734
|
+
/* Login specific variables - Light Theme */
|
|
735
|
+
--mds-login-bg: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 50%, #dcdcdc 100%);
|
|
736
|
+
--mds-input-bg: rgba(255, 255, 255, 0.8);
|
|
737
|
+
--mds-input-focus-border: #666666;
|
|
738
|
+
--mds-input-focus-bg: rgba(255, 255, 255, 1);
|
|
739
|
+
--mds-input-focus-shadow: 0 4px 12px rgba(102, 102, 102, 0.15);
|
|
740
|
+
--mds-error-bg: rgba(150, 150, 150, 0.1);
|
|
741
|
+
--mds-error-border: rgba(150, 150, 150, 0.3);
|
|
645
742
|
}
|
|
646
743
|
|
|
647
744
|
/* Form Input Styles */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { SelectHTMLAttributes } from 'react';
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
label: React.ReactNode;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
7
|
+
options?: SelectOption[];
|
|
8
|
+
variant?: 'base' | 'dashboard';
|
|
9
|
+
containerClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Select Component (Design System)
|
|
13
|
+
*
|
|
14
|
+
* Provides a themed select element. The `dashboard` variant uses the
|
|
15
|
+
* dashboard control styles/tokens to match the Refresh button styling
|
|
16
|
+
* across light/dark themes.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
19
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../../src/components/react/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAGhE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAE1E,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IAEzB,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAE/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,uFAsCjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/react/Select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ThemeToggleProps {
|
|
3
|
+
/**
|
|
4
|
+
* Size variant of the toggle button
|
|
5
|
+
* @default 'md'
|
|
6
|
+
*/
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
/**
|
|
9
|
+
* CSS class name to apply
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the toggle is disabled
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Callback when theme changes
|
|
19
|
+
*/
|
|
20
|
+
onChange?: (theme: 'light' | 'dark') => void;
|
|
21
|
+
/**
|
|
22
|
+
* Storage key for persisting theme preference
|
|
23
|
+
* @default 'theme'
|
|
24
|
+
*/
|
|
25
|
+
storageKey?: string;
|
|
26
|
+
}
|
|
27
|
+
export default function ThemeToggle({ size, className, disabled, onChange, storageKey }: ThemeToggleProps): React.JSX.Element;
|
|
28
|
+
//# sourceMappingURL=ThemeToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/react/ThemeToggle/ThemeToggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;IAE7C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,IAAW,EACX,SAAc,EACd,QAAgB,EAChB,QAAQ,EACR,UAAoB,EACrB,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgGtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/react/ThemeToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export { GlassCard, type GlassCardProps } from './GlassCard';
|
|
2
2
|
export { Typography, BrandLogo, type TypographyProps, type BrandLogoProps } from './Typography';
|
|
3
3
|
export { Button, type ButtonProps } from './Button';
|
|
4
|
+
export { Select, type SelectProps } from './Select';
|
|
5
|
+
export { ThemeToggle, type ThemeToggleProps } from './ThemeToggle';
|
|
4
6
|
export { cn } from '../../utils/cn';
|
|
5
7
|
export * from './GlassCard';
|
|
6
8
|
export * from './Typography';
|
|
7
9
|
export * from './Button';
|
|
10
|
+
export * from './Select';
|
|
8
11
|
export * from './Modal/Modal';
|
|
9
12
|
export * from './Modal/ModalHeader';
|
|
10
13
|
export * from './Modal/ModalBody';
|
|
11
14
|
export * from './Modal/ModalFooter';
|
|
12
15
|
export * from './Modal/ConfirmDialog';
|
|
16
|
+
export * from './ThemeToggle';
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/react/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/react/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGpC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export { GlassCard, type GlassCardProps } from './GlassCard';
|
|
2
2
|
export { Typography, BrandLogo, type TypographyProps, type BrandLogoProps } from './Typography';
|
|
3
3
|
export { Button, type ButtonProps } from './Button';
|
|
4
|
+
export { Select, type SelectProps } from './Select';
|
|
5
|
+
export { ThemeToggle, type ThemeToggleProps } from './ThemeToggle';
|
|
4
6
|
export { cn } from '../../utils/cn';
|
|
5
7
|
export * from './GlassCard';
|
|
6
8
|
export * from './Typography';
|
|
7
9
|
export * from './Button';
|
|
10
|
+
export * from './Select';
|
|
8
11
|
export * from './Modal/Modal';
|
|
9
12
|
export * from './Modal/ModalHeader';
|
|
10
13
|
export * from './Modal/ModalBody';
|
|
11
14
|
export * from './Modal/ModalFooter';
|
|
12
15
|
export * from './Modal/ConfirmDialog';
|
|
16
|
+
export * from './ThemeToggle';
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/react/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { forwardRef, useState,
|
|
1
|
+
import require$$0, { forwardRef, useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = {exports: {}};
|
|
@@ -1490,6 +1490,95 @@ Button.displayName = 'Button';
|
|
|
1490
1490
|
*/
|
|
1491
1491
|
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
1492
|
|
|
1493
|
+
/**
|
|
1494
|
+
* Select Component (Design System)
|
|
1495
|
+
*
|
|
1496
|
+
* Provides a themed select element. The `dashboard` variant uses the
|
|
1497
|
+
* dashboard control styles/tokens to match the Refresh button styling
|
|
1498
|
+
* across light/dark themes.
|
|
1499
|
+
*/
|
|
1500
|
+
const Select = forwardRef(({ options, children, className, containerClassName, variant = 'dashboard', ...rest }, ref) => {
|
|
1501
|
+
const selectEl = (jsxRuntimeExports.jsx("select", { ref: ref, className: cn(variant === 'dashboard'
|
|
1502
|
+
? 'mds-period-filter__select'
|
|
1503
|
+
: 'mds-input mds-select', className), ...rest, children: options
|
|
1504
|
+
? options.map(opt => (jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value)))
|
|
1505
|
+
: children }));
|
|
1506
|
+
if (variant === 'dashboard') {
|
|
1507
|
+
return (jsxRuntimeExports.jsx("div", { className: cn('mds-period-filter', containerClassName), children: selectEl }));
|
|
1508
|
+
}
|
|
1509
|
+
return selectEl;
|
|
1510
|
+
});
|
|
1511
|
+
Select.displayName = 'Select';
|
|
1512
|
+
|
|
1513
|
+
function ThemeToggle({ size = 'md', className = '', disabled = false, onChange, storageKey = 'theme' }) {
|
|
1514
|
+
const [theme, setTheme] = useState('dark');
|
|
1515
|
+
const [mounted, setMounted] = useState(false);
|
|
1516
|
+
// Initialize theme on mount
|
|
1517
|
+
useEffect(() => {
|
|
1518
|
+
try {
|
|
1519
|
+
if (typeof window !== 'undefined') {
|
|
1520
|
+
const savedTheme = localStorage.getItem(storageKey) || 'dark';
|
|
1521
|
+
setTheme(savedTheme);
|
|
1522
|
+
document.documentElement.setAttribute('data-theme', savedTheme);
|
|
1523
|
+
setMounted(true);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
catch (err) {
|
|
1527
|
+
setTheme('dark');
|
|
1528
|
+
setMounted(true);
|
|
1529
|
+
}
|
|
1530
|
+
}, [storageKey]);
|
|
1531
|
+
// Listen to external theme changes
|
|
1532
|
+
useEffect(() => {
|
|
1533
|
+
if (typeof window !== 'undefined') {
|
|
1534
|
+
const updateTheme = () => {
|
|
1535
|
+
const currentTheme = document.documentElement.getAttribute('data-theme') || 'dark';
|
|
1536
|
+
setTheme(currentTheme);
|
|
1537
|
+
};
|
|
1538
|
+
const observer = new MutationObserver(() => {
|
|
1539
|
+
updateTheme();
|
|
1540
|
+
});
|
|
1541
|
+
observer.observe(document.documentElement, {
|
|
1542
|
+
attributes: true,
|
|
1543
|
+
attributeFilter: ['data-theme']
|
|
1544
|
+
});
|
|
1545
|
+
return () => observer.disconnect();
|
|
1546
|
+
}
|
|
1547
|
+
}, []);
|
|
1548
|
+
const toggleTheme = () => {
|
|
1549
|
+
if (disabled)
|
|
1550
|
+
return;
|
|
1551
|
+
try {
|
|
1552
|
+
const newTheme = theme === 'light' ? 'dark' : 'light';
|
|
1553
|
+
document.documentElement.setAttribute('data-theme', newTheme);
|
|
1554
|
+
localStorage.setItem(storageKey, newTheme);
|
|
1555
|
+
setTheme(newTheme);
|
|
1556
|
+
onChange?.(newTheme);
|
|
1557
|
+
}
|
|
1558
|
+
catch (err) {
|
|
1559
|
+
console.warn('Failed to toggle theme:', err);
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
// Don't render until mounted (prevents hydration mismatch)
|
|
1563
|
+
if (!mounted) {
|
|
1564
|
+
return (jsxRuntimeExports.jsx("div", { className: `mds-theme-toggle mds-theme-toggle--${size} ${className}`, style: { opacity: 0.5 }, "aria-hidden": "true" }));
|
|
1565
|
+
}
|
|
1566
|
+
const isDark = theme === 'dark';
|
|
1567
|
+
const buttonStyle = isDark
|
|
1568
|
+
? {
|
|
1569
|
+
backgroundColor: 'rgba(0, 0, 0, 0.35)',
|
|
1570
|
+
border: '1px solid rgba(255, 255, 255, 0.18)',
|
|
1571
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.3)'
|
|
1572
|
+
}
|
|
1573
|
+
: undefined;
|
|
1574
|
+
const buttonClasses = [
|
|
1575
|
+
'mds-theme-toggle',
|
|
1576
|
+
`mds-theme-toggle--${size}`,
|
|
1577
|
+
className
|
|
1578
|
+
].filter(Boolean).join(' ');
|
|
1579
|
+
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 }));
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1493
1582
|
function Modal({ open, onClose, closeOnOverlay = true, children, className, style }) {
|
|
1494
1583
|
const [mounted, setMounted] = useState(false);
|
|
1495
1584
|
const [visible, setVisible] = useState(false);
|
|
@@ -1617,5 +1706,5 @@ function ConfirmDialog({ open, onClose, title, description, confirmText = 'Confi
|
|
|
1617
1706
|
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 })] })] }) }));
|
|
1618
1707
|
}
|
|
1619
1708
|
|
|
1620
|
-
export { BrandLogo, Button, ConfirmDialog, GlassCard, Modal, ModalBody, ModalFooter, ModalHeader, Typography, cn };
|
|
1709
|
+
export { BrandLogo, Button, ConfirmDialog, GlassCard, Modal, ModalBody, ModalFooter, ModalHeader, Select, ThemeToggle, Typography, cn };
|
|
1621
1710
|
//# sourceMappingURL=index.esm.js.map
|