@metropolle/design-system 1.0.0-beta.2025.9.3.1718.3e1e35c → 1.0.0-beta.2025.9.30.1300.746e606
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/compat/back.css +462 -0
- package/dist/css/components.css +127 -9
- package/dist/css/mermaid.css +102 -0
- 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 +13 -9
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* Metropolle Design System – Mermaid Diagram Styling */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Provides palette-aware theming for Mermaid diagrams that matches the
|
|
5
|
+
architecture documentation reference. Consumers should pair these styles
|
|
6
|
+
with the class definitions exported in documentation snippets (ex: pastelBlue,
|
|
7
|
+
accentOrange) to ensure consistent fill and typography across projects.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
:root {
|
|
11
|
+
--mds-mermaid-label-dark: var(--mds-color-neutral-900, #0f172a);
|
|
12
|
+
--mds-mermaid-label-light: var(--mds-color-neutral-50, #f8fafc);
|
|
13
|
+
--mds-mermaid-node-font-weight: 600;
|
|
14
|
+
--mds-mermaid-edge-font-weight: 500;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Base container styling – glass morphism aligned with platform visuals */
|
|
18
|
+
html[data-theme='dark'] .mermaid {
|
|
19
|
+
background: rgba(255, 255, 255, 0.05) !important;
|
|
20
|
+
border-radius: var(--mds-border-radius-lg, 12px);
|
|
21
|
+
padding: var(--mds-space-4, 1rem);
|
|
22
|
+
backdrop-filter: blur(10px);
|
|
23
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
24
|
+
margin: var(--mds-space-4, 1rem) 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
html[data-theme='light'] .mermaid {
|
|
28
|
+
background: rgba(255, 255, 255, 0.7) !important;
|
|
29
|
+
border-radius: var(--mds-border-radius-lg, 12px);
|
|
30
|
+
padding: var(--mds-space-4, 1rem);
|
|
31
|
+
backdrop-filter: blur(10px);
|
|
32
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
33
|
+
margin: var(--mds-space-4, 1rem) 0;
|
|
34
|
+
box-shadow: var(--mds-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Default typography settings for nodes and clusters */
|
|
38
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster) {
|
|
39
|
+
--mds-mermaid-node-color: var(--mds-mermaid-label-dark);
|
|
40
|
+
--mds-mermaid-node-weight-current: var(--mds-mermaid-node-font-weight);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Switch to light foreground when nodes use strong accent fills */
|
|
44
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#00bcd4" i]),
|
|
45
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#1565c0" i]),
|
|
46
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#1976d2" i]),
|
|
47
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#2196f3" i]),
|
|
48
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#34a853" i]),
|
|
49
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#388e3c" i]),
|
|
50
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#3b82f6" i]),
|
|
51
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#3f48cc" i]),
|
|
52
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#4285f4" i]),
|
|
53
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#45b7d1" i]),
|
|
54
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#4b612c" i]),
|
|
55
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#4caf50" i]),
|
|
56
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#4ecdc4" i]),
|
|
57
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#607d8b" i]),
|
|
58
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#627eea" i]),
|
|
59
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#673ab7" i]),
|
|
60
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#689f38" i]),
|
|
61
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#759c3e" i]),
|
|
62
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#795548" i]),
|
|
63
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#7b1fa2" i]),
|
|
64
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#96ceb4" i]),
|
|
65
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#9c27b0" i]),
|
|
66
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#c2185b" i]),
|
|
67
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#dd344c" i]),
|
|
68
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#e91e63" i]),
|
|
69
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#f44336" i]),
|
|
70
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#f57c00" i]),
|
|
71
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#f7931a" i]),
|
|
72
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#ff5722" i]),
|
|
73
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#ff6b6b" i]),
|
|
74
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster):has(> :is(rect, polygon, ellipse, circle, path)[fill="#ff9800" i]) {
|
|
75
|
+
--mds-mermaid-node-color: var(--mds-mermaid-label-light);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Apply the computed foreground colour to all supported Mermaid label types */
|
|
79
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster) g.label text,
|
|
80
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster) g.label tspan {
|
|
81
|
+
fill: var(--mds-mermaid-node-color) !important;
|
|
82
|
+
font-weight: var(--mds-mermaid-node-weight-current);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
html[data-theme='dark'] .mermaid :is(g.node, g.cluster) g.label foreignObject * {
|
|
86
|
+
color: var(--mds-mermaid-node-color) !important;
|
|
87
|
+
font-weight: var(--mds-mermaid-node-weight-current);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Preserve lighter typography for edge labels so they remain legible */
|
|
91
|
+
html[data-theme='dark'] .mermaid .edgeLabel text,
|
|
92
|
+
html[data-theme='dark'] .mermaid .edgeLabel tspan {
|
|
93
|
+
fill: var(--ifm-font-color-base, #e5e7eb) !important;
|
|
94
|
+
font-weight: var(--mds-mermaid-edge-font-weight);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Light theme keeps default dark text but enforces consistent weight */
|
|
98
|
+
html[data-theme='light'] .mermaid :is(g.node, g.cluster) g.label text,
|
|
99
|
+
html[data-theme='light'] .mermaid :is(g.node, g.cluster) g.label tspan,
|
|
100
|
+
html[data-theme='light'] .mermaid :is(g.node, g.cluster) g.label foreignObject * {
|
|
101
|
+
font-weight: var(--mds-mermaid-node-font-weight, 600);
|
|
102
|
+
}
|
|
@@ -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
|