@raystack/apsara 0.10.5 → 0.10.7
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/index.cjs +225 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +354 -262
- package/dist/index.js.map +1 -1
- package/dist/sidebar/sidebar.d.ts +2 -2
- package/dist/sidebar/sidebar.d.ts.map +1 -1
- package/dist/table/DataTableToolbar.d.ts +1 -1
- package/dist/table/DataTableToolbar.d.ts.map +1 -1
- package/dist/table/datatable.d.ts +3 -2
- package/dist/table/datatable.d.ts.map +1 -1
- package/dist/themprovider/index.d.ts +1 -1
- package/dist/themprovider/index.d.ts.map +1 -1
- package/dist/themprovider/theme.d.ts +5 -0
- package/dist/themprovider/theme.d.ts.map +1 -0
- package/dist/themprovider/types.d.ts +43 -0
- package/dist/themprovider/types.d.ts.map +1 -0
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -11610,8 +11610,8 @@ const cell$1 = cva(styles$6.cell, {
|
|
|
11610
11610
|
},
|
|
11611
11611
|
},
|
|
11612
11612
|
});
|
|
11613
|
-
const SidebarNavigationCell = ({ leadingIcon, trailingIcon, active, disabled, children,
|
|
11614
|
-
return (jsxRuntimeExports.jsxs(
|
|
11613
|
+
const SidebarNavigationCell = ({ leadingIcon, trailingIcon, active, disabled, children, onClick, }) => {
|
|
11614
|
+
return (jsxRuntimeExports.jsxs(Flex, { className: cell$1({ active, disabled }), onClick: onClick, children: [jsxRuntimeExports.jsxs(Flex, { gap: "small", children: [leadingIcon, jsxRuntimeExports.jsx(Text, { className: styles$6.cellText, children: children })] }), trailingIcon] }));
|
|
11615
11615
|
};
|
|
11616
11616
|
const SidebarFooter = ({ children, action }) => {
|
|
11617
11617
|
return (jsxRuntimeExports.jsxs(Flex, { className: styles$6.footer, gap: "small", justify: "between", children: [jsxRuntimeExports.jsx(Text, { children: children }), action] }));
|
|
@@ -15308,8 +15308,8 @@ function DataTableGloabalSearch(props) {
|
|
|
15308
15308
|
return (jsxRuntimeExports.jsx(TextField, { placeholder: "Filter tasks...", value: globalFilter ?? "", onChange: (event) => onGlobalFilterChange(String(event.target.value)), ...props }));
|
|
15309
15309
|
}
|
|
15310
15310
|
|
|
15311
|
-
function DataTableToolbar({ children, }) {
|
|
15312
|
-
return (jsxRuntimeExports.jsx(Flex, { direction: "column", className: styles$4.toolbar, children: children }));
|
|
15311
|
+
function DataTableToolbar({ children, ...props }) {
|
|
15312
|
+
return (jsxRuntimeExports.jsx(Flex, { direction: "column", className: styles$4.toolbar, ...props, children: children }));
|
|
15313
15313
|
}
|
|
15314
15314
|
|
|
15315
15315
|
function DataTableViewOptions({ children, ...props }) {
|
|
@@ -15385,7 +15385,7 @@ const Table = Object.assign(TableRoot, {
|
|
|
15385
15385
|
Caption: TableCaption,
|
|
15386
15386
|
});
|
|
15387
15387
|
|
|
15388
|
-
function DataTableRoot({ columns, data, emptyState, children, ...props }) {
|
|
15388
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, ...props }) {
|
|
15389
15389
|
const convertedChildren = React.Children.toArray(children);
|
|
15390
15390
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
15391
15391
|
const footer = convertedChildren.find((child) => child.type === DataTableFooter) || jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
@@ -15429,7 +15429,7 @@ function DataTableRoot({ columns, data, emptyState, children, ...props }) {
|
|
|
15429
15429
|
resetColumns,
|
|
15430
15430
|
onGlobalFilterChange: setGlobalFilter,
|
|
15431
15431
|
onChange: () => ({}),
|
|
15432
|
-
}, children: [jsxRuntimeExports.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports.jsxs(Flex, { children: [jsxRuntimeExports.jsxs(Table, { ...props, children: [jsxRuntimeExports.jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports.jsx(Table.Row, { children: headerGroup.headers.map((header) => {
|
|
15432
|
+
}, children: [jsxRuntimeExports.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports.jsxs(Flex, { style: parentStyle, children: [jsxRuntimeExports.jsxs(Table, { ...props, children: [jsxRuntimeExports.jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports.jsx(Table.Row, { children: headerGroup.headers.map((header) => {
|
|
15433
15433
|
return (jsxRuntimeExports.jsx(Table.Head, { children: jsxRuntimeExports.jsxs(Text, { className: styles$4.head, children: [header.isPlaceholder
|
|
15434
15434
|
? null
|
|
15435
15435
|
: flexRender(header.column.columnDef.header, header.getContext()), {
|
|
@@ -15622,136 +15622,228 @@ const Tabs = Object.assign(TabsRoot, {
|
|
|
15622
15622
|
List: TabsList,
|
|
15623
15623
|
});
|
|
15624
15624
|
|
|
15625
|
-
const
|
|
15626
|
-
const
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
};
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15654
|
-
|
|
15655
|
-
|
|
15656
|
-
|
|
15657
|
-
|
|
15658
|
-
const saveThemePreference = (newTheme) => {
|
|
15659
|
-
try {
|
|
15660
|
-
if (typeof newTheme === "string")
|
|
15661
|
-
window.localStorage.setItem(themeLocalStorageKey, newTheme);
|
|
15662
|
-
}
|
|
15663
|
-
catch (e) {
|
|
15664
|
-
console.warn(e);
|
|
15665
|
-
}
|
|
15666
|
-
};
|
|
15667
|
-
const getSavedThemePreference = () => {
|
|
15668
|
-
try {
|
|
15669
|
-
const savedMode = window.localStorage.getItem(themeLocalStorageKey);
|
|
15670
|
-
// If the user has explicitly chosen a colour mode,
|
|
15671
|
-
// let's use it. Otherwise, this value will be null.
|
|
15672
|
-
return isValidThemePreference(savedMode) ? savedMode : null;
|
|
15673
|
-
}
|
|
15674
|
-
catch (e) {
|
|
15675
|
-
// When Chrome in incognito, localStorage cannot be accessed
|
|
15676
|
-
console.warn(e);
|
|
15677
|
-
return null;
|
|
15678
|
-
}
|
|
15679
|
-
};
|
|
15680
|
-
|
|
15681
|
-
const { createContext, useState, useEffect } = React;
|
|
15682
|
-
const defaultThemeName = "dark";
|
|
15683
|
-
const initialValues = {
|
|
15684
|
-
themeName: defaultThemeName,
|
|
15685
|
-
themePreference: defaultThemeName,
|
|
15686
|
-
setTheme: () => { },
|
|
15687
|
-
};
|
|
15688
|
-
const ApsaraThemeContext = createContext(initialValues);
|
|
15689
|
-
ApsaraThemeContext.displayName = "ApsaraThemeContext ";
|
|
15690
|
-
const useTheme = () => {
|
|
15691
|
-
const [themePreference, setThemePreference] = useState(defaultThemeName);
|
|
15692
|
-
const [themeName, setThemeName] = useState(defaultThemeName);
|
|
15693
|
-
const [osTheme, setOsTheme] = useState(getMediaTheme());
|
|
15694
|
-
// in the future this should prefer auto if no saved
|
|
15695
|
-
useEffect(() => {
|
|
15696
|
-
const initialTheme = getSavedThemePreference();
|
|
15697
|
-
if (isValidThemePreference(initialTheme)) {
|
|
15698
|
-
setThemePreference(initialTheme);
|
|
15625
|
+
const colorSchemes = ["light", "dark"];
|
|
15626
|
+
const MEDIA = "(prefers-color-scheme: dark)";
|
|
15627
|
+
const isServer = typeof window === "undefined";
|
|
15628
|
+
const ThemeContext = React.createContext(undefined);
|
|
15629
|
+
const defaultContext = { setTheme: (_) => { }, themes: [] };
|
|
15630
|
+
const useTheme = () => React.useContext(ThemeContext) ?? defaultContext;
|
|
15631
|
+
const ThemeProvider = (props) => {
|
|
15632
|
+
const context = React.useContext(ThemeContext);
|
|
15633
|
+
// Ignore nested context providers, just passthrough children
|
|
15634
|
+
if (context)
|
|
15635
|
+
return jsxRuntimeExports.jsx(React.Fragment, { children: props.children });
|
|
15636
|
+
return jsxRuntimeExports.jsx(Theme$1, { ...props });
|
|
15637
|
+
};
|
|
15638
|
+
const defaultThemes = ["light", "dark"];
|
|
15639
|
+
const Theme$1 = ({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme = true, storageKey = "theme", themes = defaultThemes, defaultTheme = enableSystem ? "system" : "light", attribute = "data-theme", value, children, nonce, }) => {
|
|
15640
|
+
const [theme, setThemeState] = React.useState(() => getTheme(storageKey, defaultTheme));
|
|
15641
|
+
const [resolvedTheme, setResolvedTheme] = React.useState(() => getTheme(storageKey));
|
|
15642
|
+
const attrs = !value ? themes : Object.values(value);
|
|
15643
|
+
const applyTheme = React.useCallback((theme) => {
|
|
15644
|
+
let resolved = theme;
|
|
15645
|
+
if (!resolved)
|
|
15646
|
+
return;
|
|
15647
|
+
// If theme is system, resolve it before setting theme
|
|
15648
|
+
if (theme === "system" && enableSystem) {
|
|
15649
|
+
resolved = getSystemTheme();
|
|
15650
|
+
}
|
|
15651
|
+
const name = value ? value[resolved] : resolved;
|
|
15652
|
+
const enable = disableTransitionOnChange ? disableAnimation() : null;
|
|
15653
|
+
const d = document.documentElement;
|
|
15654
|
+
if (attribute === "class") {
|
|
15655
|
+
d.classList.remove(...attrs);
|
|
15656
|
+
if (name)
|
|
15657
|
+
d.classList.add(name);
|
|
15699
15658
|
}
|
|
15700
15659
|
else {
|
|
15701
|
-
|
|
15660
|
+
if (name) {
|
|
15661
|
+
d.setAttribute(attribute, name);
|
|
15662
|
+
}
|
|
15663
|
+
else {
|
|
15664
|
+
d.removeAttribute(attribute);
|
|
15665
|
+
}
|
|
15702
15666
|
}
|
|
15667
|
+
if (enableColorScheme) {
|
|
15668
|
+
const fallback = colorSchemes.includes(defaultTheme)
|
|
15669
|
+
? defaultTheme
|
|
15670
|
+
: null;
|
|
15671
|
+
const colorScheme = colorSchemes.includes(resolved) ? resolved : fallback;
|
|
15672
|
+
// @ts-ignore
|
|
15673
|
+
d.style.colorScheme = colorScheme;
|
|
15674
|
+
}
|
|
15675
|
+
enable?.();
|
|
15703
15676
|
}, []);
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15677
|
+
const setTheme = React.useCallback((theme) => {
|
|
15678
|
+
setThemeState(theme);
|
|
15679
|
+
// Save to storage
|
|
15680
|
+
try {
|
|
15681
|
+
localStorage.setItem(storageKey, theme);
|
|
15682
|
+
}
|
|
15683
|
+
catch (e) {
|
|
15684
|
+
// Unsupported
|
|
15685
|
+
}
|
|
15686
|
+
}, [forcedTheme]);
|
|
15687
|
+
const handleMediaQuery = React.useCallback((e) => {
|
|
15688
|
+
const resolved = getSystemTheme(e);
|
|
15689
|
+
setResolvedTheme(resolved);
|
|
15690
|
+
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
15691
|
+
applyTheme("system");
|
|
15692
|
+
}
|
|
15693
|
+
}, [theme, forcedTheme]);
|
|
15694
|
+
// Always listen to System preference
|
|
15695
|
+
React.useEffect(() => {
|
|
15696
|
+
const media = window.matchMedia(MEDIA);
|
|
15697
|
+
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
15698
|
+
media.addListener(handleMediaQuery);
|
|
15699
|
+
handleMediaQuery(media);
|
|
15700
|
+
return () => media.removeListener(handleMediaQuery);
|
|
15701
|
+
}, [handleMediaQuery]);
|
|
15702
|
+
// localStorage event handling
|
|
15703
|
+
React.useEffect(() => {
|
|
15704
|
+
const handleStorage = (e) => {
|
|
15705
|
+
if (e.key !== storageKey) {
|
|
15706
|
+
return;
|
|
15707
|
+
}
|
|
15708
|
+
// If default theme set, use it if localstorage === null (happens on local storage manual deletion)
|
|
15709
|
+
const theme = e.newValue || defaultTheme;
|
|
15710
|
+
setTheme(theme);
|
|
15711
|
+
};
|
|
15712
|
+
window.addEventListener("storage", handleStorage);
|
|
15713
|
+
return () => window.removeEventListener("storage", handleStorage);
|
|
15714
|
+
}, [setTheme]);
|
|
15715
|
+
// Whenever theme or forcedTheme changes, apply it
|
|
15716
|
+
React.useEffect(() => {
|
|
15717
|
+
// @ts-ignore
|
|
15718
|
+
applyTheme(forcedTheme ?? theme);
|
|
15719
|
+
}, [forcedTheme, theme]);
|
|
15720
|
+
const providerValue = React.useMemo(() => ({
|
|
15721
|
+
theme,
|
|
15722
|
+
setTheme,
|
|
15723
|
+
forcedTheme,
|
|
15724
|
+
resolvedTheme: theme === "system" ? resolvedTheme : theme,
|
|
15725
|
+
themes: enableSystem ? [...themes, "system"] : themes,
|
|
15726
|
+
systemTheme: (enableSystem ? resolvedTheme : undefined),
|
|
15727
|
+
}), [theme, setTheme, forcedTheme, resolvedTheme, enableSystem, themes]);
|
|
15728
|
+
return (jsxRuntimeExports.jsxs(ThemeContext.Provider, { value: providerValue, children: [jsxRuntimeExports.jsx(ThemeScript, { ...{
|
|
15729
|
+
forcedTheme,
|
|
15730
|
+
disableTransitionOnChange,
|
|
15731
|
+
enableSystem,
|
|
15732
|
+
enableColorScheme,
|
|
15733
|
+
storageKey,
|
|
15734
|
+
themes,
|
|
15735
|
+
defaultTheme,
|
|
15736
|
+
attribute,
|
|
15737
|
+
value,
|
|
15738
|
+
children,
|
|
15739
|
+
attrs,
|
|
15740
|
+
nonce,
|
|
15741
|
+
} }), children] }));
|
|
15742
|
+
};
|
|
15743
|
+
const ThemeScript = React.memo(({ forcedTheme, storageKey, attribute, enableSystem, enableColorScheme, defaultTheme, value, attrs, nonce, }) => {
|
|
15744
|
+
const defaultSystem = defaultTheme === "system";
|
|
15745
|
+
// Code-golfing the amount of characters in the script
|
|
15746
|
+
const optimization = (() => {
|
|
15747
|
+
if (attribute === "class") {
|
|
15748
|
+
const removeClasses = `c.remove(${attrs
|
|
15749
|
+
.map((t) => `'${t}'`)
|
|
15750
|
+
.join(",")})`;
|
|
15751
|
+
return `var d=document.documentElement,c=d.classList;${removeClasses};`;
|
|
15707
15752
|
}
|
|
15708
15753
|
else {
|
|
15709
|
-
|
|
15710
|
-
}
|
|
15711
|
-
}
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15754
|
+
return `var d=document.documentElement,n='${attribute}',s='setAttribute';`;
|
|
15755
|
+
}
|
|
15756
|
+
})();
|
|
15757
|
+
const fallbackColorScheme = (() => {
|
|
15758
|
+
if (!enableColorScheme) {
|
|
15759
|
+
return "";
|
|
15760
|
+
}
|
|
15761
|
+
const fallback = colorSchemes.includes(defaultTheme)
|
|
15762
|
+
? defaultTheme
|
|
15763
|
+
: null;
|
|
15764
|
+
if (fallback) {
|
|
15765
|
+
return `if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${defaultTheme}'`;
|
|
15766
|
+
}
|
|
15767
|
+
else {
|
|
15768
|
+
return `if(e==='light'||e==='dark')d.style.colorScheme=e`;
|
|
15769
|
+
}
|
|
15770
|
+
})();
|
|
15771
|
+
const updateDOM = (name, literal = false, setColorScheme = true) => {
|
|
15772
|
+
const resolvedName = value ? value[name] : name;
|
|
15773
|
+
const val = literal ? name + `|| ''` : `'${resolvedName}'`;
|
|
15774
|
+
let text = "";
|
|
15775
|
+
// MUCH faster to set colorScheme alongside HTML attribute/class
|
|
15776
|
+
// as it only incurs 1 style recalculation rather than 2
|
|
15777
|
+
// This can save over 250ms of work for pages with big DOM
|
|
15778
|
+
if (enableColorScheme &&
|
|
15779
|
+
setColorScheme &&
|
|
15780
|
+
!literal &&
|
|
15781
|
+
colorSchemes.includes(name)) {
|
|
15782
|
+
text += `d.style.colorScheme = '${name}';`;
|
|
15783
|
+
}
|
|
15784
|
+
if (attribute === "class") {
|
|
15785
|
+
if (literal || resolvedName) {
|
|
15786
|
+
text += `c.add(${val})`;
|
|
15787
|
+
}
|
|
15788
|
+
else {
|
|
15789
|
+
text += `null`;
|
|
15790
|
+
}
|
|
15791
|
+
}
|
|
15792
|
+
else {
|
|
15793
|
+
if (resolvedName) {
|
|
15794
|
+
text += `d[s](n,${val})`;
|
|
15795
|
+
}
|
|
15796
|
+
}
|
|
15797
|
+
return text;
|
|
15737
15798
|
};
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
}
|
|
15747
|
-
function
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15799
|
+
const scriptSrc = (() => {
|
|
15800
|
+
if (forcedTheme) {
|
|
15801
|
+
return `!function(){${optimization}${updateDOM(forcedTheme)}}()`;
|
|
15802
|
+
}
|
|
15803
|
+
if (enableSystem) {
|
|
15804
|
+
return `!function(){try{${optimization}var e=localStorage.getItem('${storageKey}');if('system'===e||(!e&&${defaultSystem})){var t='${MEDIA}',m=window.matchMedia(t);if(m.media!==t||m.matches){${updateDOM("dark")}}else{${updateDOM("light")}}}else if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}${!defaultSystem
|
|
15805
|
+
? `else{` + updateDOM(defaultTheme, false, false) + "}"
|
|
15806
|
+
: ""}${fallbackColorScheme}}catch(e){}}()`;
|
|
15807
|
+
}
|
|
15808
|
+
return `!function(){try{${optimization}var e=localStorage.getItem('${storageKey}');if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}else{${updateDOM(defaultTheme, false, false)};}${fallbackColorScheme}}catch(t){}}();`;
|
|
15809
|
+
})();
|
|
15810
|
+
return (jsxRuntimeExports.jsx("script", { nonce: nonce, dangerouslySetInnerHTML: { __html: scriptSrc } }));
|
|
15811
|
+
},
|
|
15812
|
+
// Never re-render this component
|
|
15813
|
+
() => true);
|
|
15814
|
+
// Helpers
|
|
15815
|
+
const getTheme = (key, fallback) => {
|
|
15816
|
+
if (isServer)
|
|
15817
|
+
return undefined;
|
|
15818
|
+
let theme;
|
|
15819
|
+
try {
|
|
15820
|
+
theme = localStorage.getItem(key) || undefined;
|
|
15751
15821
|
}
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
}
|
|
15822
|
+
catch (e) {
|
|
15823
|
+
// Unsupported
|
|
15824
|
+
}
|
|
15825
|
+
return theme || fallback;
|
|
15826
|
+
};
|
|
15827
|
+
const disableAnimation = () => {
|
|
15828
|
+
const css = document.createElement("style");
|
|
15829
|
+
css.appendChild(document.createTextNode(`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`));
|
|
15830
|
+
document.head.appendChild(css);
|
|
15831
|
+
return () => {
|
|
15832
|
+
// Force restyle
|
|
15833
|
+
(() => window.getComputedStyle(document.body))();
|
|
15834
|
+
// Wait for next tick before removing
|
|
15835
|
+
setTimeout(() => {
|
|
15836
|
+
document.head.removeChild(css);
|
|
15837
|
+
}, 1);
|
|
15838
|
+
};
|
|
15839
|
+
};
|
|
15840
|
+
const getSystemTheme = (e) => {
|
|
15841
|
+
if (!e)
|
|
15842
|
+
e = window.matchMedia(MEDIA);
|
|
15843
|
+
const isDark = e.matches;
|
|
15844
|
+
const systemTheme = isDark ? "dark" : "light";
|
|
15845
|
+
return systemTheme;
|
|
15846
|
+
};
|
|
15755
15847
|
|
|
15756
15848
|
var Theme;
|
|
15757
15849
|
(function (Theme) {
|
|
@@ -15759,11 +15851,11 @@ var Theme;
|
|
|
15759
15851
|
Theme["LIGHT"] = "light";
|
|
15760
15852
|
})(Theme || (Theme = {}));
|
|
15761
15853
|
function ThemeSwitcher({ size = 30, ...props }) {
|
|
15762
|
-
const {
|
|
15854
|
+
const { theme, setTheme } = useTheme();
|
|
15763
15855
|
const onClickHandler = () => {
|
|
15764
|
-
setTheme(
|
|
15856
|
+
setTheme(theme === Theme.DARK ? Theme.LIGHT : Theme.DARK);
|
|
15765
15857
|
};
|
|
15766
|
-
return (jsxRuntimeExports.jsx(Box, { ...props, children:
|
|
15858
|
+
return (jsxRuntimeExports.jsx(Box, { ...props, children: theme === Theme.DARK ? (jsxRuntimeExports.jsx(SunIcon, { width: size, height: size, onClick: onClickHandler })) : (jsxRuntimeExports.jsx(MoonIcon, { width: size, height: size, onClick: onClickHandler })) }));
|
|
15767
15859
|
}
|
|
15768
15860
|
|
|
15769
15861
|
var styles = {"title":"title-module_title__r78X4","title-small":"title-module_title-small__aS4B3","title-medium":"title-module_title-medium__e8yQc","title-large":"title-module_title-large__TVRRL"};
|
|
@@ -15784,7 +15876,6 @@ function Title({ children, className, size, ...props }) {
|
|
|
15784
15876
|
return (jsxRuntimeExports.jsx("span", { className: title({ size, className }), ...props, children: children }));
|
|
15785
15877
|
}
|
|
15786
15878
|
|
|
15787
|
-
exports.ApsaraThemeProvider = ApsaraThemeProvider;
|
|
15788
15879
|
exports.Avatar = Avatar;
|
|
15789
15880
|
exports.Badge = badge$1;
|
|
15790
15881
|
exports.Body = Body;
|
|
@@ -15817,8 +15908,9 @@ exports.Table = Table;
|
|
|
15817
15908
|
exports.Tabs = Tabs;
|
|
15818
15909
|
exports.Text = Text;
|
|
15819
15910
|
exports.TextField = TextField;
|
|
15911
|
+
exports.ThemeProvider = ThemeProvider;
|
|
15820
15912
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
15821
15913
|
exports.Title = Title;
|
|
15822
|
-
exports.useApsaraTheme = useApsaraTheme;
|
|
15823
15914
|
exports.useTable = useTable;
|
|
15915
|
+
exports.useTheme = useTheme;
|
|
15824
15916
|
//# sourceMappingURL=index.cjs.map
|