@wso2/oxygen-ui 0.0.1-alpha.10 → 0.0.1-alpha.12
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 +134 -2
- package/dist/animations/ParticleBackground/ParticleBackground.d.ts +66 -0
- package/dist/animations/ParticleBackground/index.d.ts +19 -0
- package/dist/animations/index.d.ts +18 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +47 -0
- package/dist/components/CodeBlock/index.d.ts +19 -0
- package/dist/components/ColorSchemeImage/index.d.ts +19 -0
- package/dist/components/ColorSchemeToggle/index.d.ts +18 -0
- package/dist/components/ComplexSelect/ComplexSelect.d.ts +17 -0
- package/dist/components/ComplexSelect/ComplexSelectDivider.d.ts +4 -0
- package/dist/components/ComplexSelect/ComplexSelectListHeader.d.ts +7 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItem.d.ts +16 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItemAvatar.d.ts +7 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItemIcon.d.ts +7 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItemText.d.ts +8 -0
- package/dist/components/ComplexSelect/index.d.ts +21 -0
- package/dist/components/PageTitle/PageTitle.d.ts +34 -0
- package/dist/components/PageTitle/PageTitleAvatar.d.ts +16 -0
- package/dist/components/PageTitle/PageTitleHeader.d.ts +16 -0
- package/dist/components/PageTitle/PageTitleLink.d.ts +20 -0
- package/dist/components/PageTitle/PageTitleSubHeader.d.ts +16 -0
- package/dist/components/PageTitle/index.d.ts +27 -0
- package/dist/components/ThemeSwitcher/ThemeSelect.d.ts +37 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +65 -0
- package/dist/components/ThemeSwitcher/index.d.ts +4 -0
- package/dist/components/index.d.ts +28 -0
- package/dist/contexts/OxygenUIThemeProvider/OxygenUIThemeProvider.d.ts +58 -3
- package/dist/contexts/OxygenUIThemeProvider/index.d.ts +20 -0
- package/dist/contexts/index.d.ts +19 -0
- package/dist/hooks/index.d.ts +18 -0
- package/dist/hooks/useThemeContent/index.d.ts +18 -0
- package/dist/hooks/useThemeContent/useThemeContent.d.ts +57 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1360 -169
- package/dist/index.js.map +4 -4
- package/dist/styles/Themes/AsgardeoTheme.d.ts +17 -0
- package/dist/styles/Themes/ChoreoTheme.d.ts +20 -0
- package/dist/styles/Themes/ClassicTheme.d.ts +20 -0
- package/dist/styles/Themes/HighContrastTheme.d.ts +20 -0
- package/dist/styles/Themes/OxygenBaseTheme.d.ts +66 -0
- package/dist/styles/Themes/index.d.ts +22 -0
- package/dist/styles/index.d.ts +18 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/pxToRem.d.ts +23 -0
- package/package.json +10 -8
- package/dist/components/ColorSchemeImage/ColorSchemeImage.js +0 -57
- package/dist/components/ColorSchemeImage/ColorSchemeImage.js.map +0 -7
- package/dist/components/ColorSchemeToggle/ColorSchemeToggle.js +0 -76
- package/dist/components/ColorSchemeToggle/ColorSchemeToggle.js.map +0 -7
- package/dist/contexts/OxygenUIThemeProvider/OxygenUIThemeProvider.js +0 -378
- package/dist/contexts/OxygenUIThemeProvider/OxygenUIThemeProvider.js.map +0 -7
- package/dist/styles/OxygenTheme/OxygenTheme.d.ts +0 -38
- package/dist/styles/OxygenTheme/OxygenTheme.js +0 -356
- package/dist/styles/OxygenTheme/OxygenTheme.js.map +0 -7
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { type ThemeSwitcherContextValue } from '../../contexts/OxygenUIThemeProvider/OxygenUIThemeProvider';
|
|
3
|
+
export interface ThemeSwitcherProps {
|
|
4
|
+
/**
|
|
5
|
+
* Optional render props function for custom UI.
|
|
6
|
+
* If not provided, renders the default ThemeSelect component.
|
|
7
|
+
*/
|
|
8
|
+
children?: (props: ThemeSwitcherContextValue) => ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Size of the default select component (when not using render props)
|
|
11
|
+
*/
|
|
12
|
+
size?: 'small' | 'medium';
|
|
13
|
+
/**
|
|
14
|
+
* Show label for the default select (when not using render props)
|
|
15
|
+
*/
|
|
16
|
+
showLabel?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Custom label text for the default select (when not using render props)
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Variant of the default select (when not using render props)
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'outlined' | 'filled' | 'standard';
|
|
25
|
+
/**
|
|
26
|
+
* Additional sx prop for styling the default select (when not using render props)
|
|
27
|
+
*/
|
|
28
|
+
sx?: object;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* ThemeSwitcher - UI component for theme switching
|
|
32
|
+
*
|
|
33
|
+
* Must be used within OxygenUIThemeProvider with themes prop.
|
|
34
|
+
*
|
|
35
|
+
* Default Usage (renders a select dropdown):
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <OxygenUIThemeProvider themes={myThemes}>
|
|
38
|
+
* <ThemeSwitcher />
|
|
39
|
+
* <App />
|
|
40
|
+
* </OxygenUIThemeProvider>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* Custom UI with Render Props:
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <OxygenUIThemeProvider themes={myThemes}>
|
|
46
|
+
* <ThemeSwitcher>
|
|
47
|
+
* {({ currentTheme, themes, setTheme, isActive }) => (
|
|
48
|
+
* <div>
|
|
49
|
+
* {themes.map(t => (
|
|
50
|
+
* <button
|
|
51
|
+
* key={t.key}
|
|
52
|
+
* onClick={() => setTheme(t.key)}
|
|
53
|
+
* style={{ fontWeight: isActive(t.key) ? 'bold' : 'normal' }}
|
|
54
|
+
* >
|
|
55
|
+
* {t.label}
|
|
56
|
+
* </button>
|
|
57
|
+
* ))}
|
|
58
|
+
* </div>
|
|
59
|
+
* )}
|
|
60
|
+
* </ThemeSwitcher>
|
|
61
|
+
* <App />
|
|
62
|
+
* </OxygenUIThemeProvider>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export default function ThemeSwitcher({ children, size, showLabel, label, variant, sx, }: ThemeSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { default as CodeBlock } from './CodeBlock';
|
|
19
|
+
export type { CodeBlockProps } from './CodeBlock';
|
|
20
|
+
export { default as ColorSchemeImage } from './ColorSchemeImage';
|
|
21
|
+
export type { ColorSchemeImageProps, ColorSchemeImageAttribute } from './ColorSchemeImage';
|
|
22
|
+
export { ColorSchemeToggle, default as ColorSchemeToggleDefault } from './ColorSchemeToggle';
|
|
23
|
+
export { default as ComplexSelect } from './ComplexSelect';
|
|
24
|
+
export type { ComplexSelectProps } from './ComplexSelect';
|
|
25
|
+
export { default as PageTitle } from './PageTitle';
|
|
26
|
+
export type { PageTitleProps, PageTitleAvatarProps, PageTitleHeaderProps, PageTitleSubHeaderProps, PageTitleLinkProps } from './PageTitle';
|
|
27
|
+
export { default as ThemeSwitcher, ThemeSelect } from './ThemeSwitcher';
|
|
28
|
+
export type { ThemeSwitcherProps, ThemeSelectProps } from './ThemeSwitcher';
|
|
@@ -1,8 +1,63 @@
|
|
|
1
1
|
import { Theme } from '@mui/material/styles';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface ThemeOption {
|
|
4
|
+
/**
|
|
5
|
+
* Unique key for the theme
|
|
6
|
+
*/
|
|
7
|
+
key: string;
|
|
8
|
+
/**
|
|
9
|
+
* Display label for the theme
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* The theme object
|
|
14
|
+
*/
|
|
15
|
+
theme: Theme;
|
|
16
|
+
}
|
|
17
|
+
export interface ThemeSwitcherContextValue {
|
|
18
|
+
/**
|
|
19
|
+
* The current active theme object
|
|
20
|
+
*/
|
|
21
|
+
theme: Theme;
|
|
22
|
+
/**
|
|
23
|
+
* The current theme key
|
|
24
|
+
*/
|
|
25
|
+
currentTheme: string;
|
|
26
|
+
/**
|
|
27
|
+
* All available theme options
|
|
28
|
+
*/
|
|
29
|
+
themes: ThemeOption[];
|
|
30
|
+
/**
|
|
31
|
+
* Function to switch to a specific theme by key
|
|
32
|
+
*/
|
|
33
|
+
setTheme: (themeKey: string) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a specific theme is active
|
|
36
|
+
*/
|
|
37
|
+
isActive: (themeKey: string) => boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Hook to access theme switcher context
|
|
41
|
+
*/
|
|
42
|
+
export declare const useThemeSwitcher: () => ThemeSwitcherContextValue;
|
|
2
43
|
interface OxygenUIThemeProviderProps {
|
|
3
|
-
children:
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Optional single theme object. If provided, theme switching will be disabled.
|
|
47
|
+
* Use this for simple single-theme applications.
|
|
48
|
+
*/
|
|
4
49
|
theme?: Theme;
|
|
5
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Array of theme options for theme switching.
|
|
52
|
+
* If provided, enables theme switching functionality.
|
|
53
|
+
* Takes precedence over the `theme` prop.
|
|
54
|
+
*/
|
|
55
|
+
themes?: ThemeOption[];
|
|
56
|
+
/**
|
|
57
|
+
* Initial theme key when using theme switching.
|
|
58
|
+
* Defaults to the first theme in the themes array.
|
|
59
|
+
*/
|
|
60
|
+
initialTheme?: string;
|
|
6
61
|
}
|
|
7
|
-
export default function OxygenUIThemeProvider({ children, theme,
|
|
62
|
+
export default function OxygenUIThemeProvider({ children, theme, themes, initialTheme, }: OxygenUIThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
63
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { default } from './OxygenUIThemeProvider';
|
|
19
|
+
export { useThemeSwitcher } from './OxygenUIThemeProvider';
|
|
20
|
+
export type { ThemeOption, ThemeSwitcherContextValue } from './OxygenUIThemeProvider';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { default as OxygenUIThemeProvider, useThemeSwitcher } from './OxygenUIThemeProvider/OxygenUIThemeProvider';
|
|
19
|
+
export type { ThemeOption, ThemeSwitcherContextValue } from './OxygenUIThemeProvider/OxygenUIThemeProvider';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { useThemeContent, default as useThemeContentDefault } from './useThemeContent/useThemeContent';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { useThemeContent, default } from './useThemeContent';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to get theme-specific content based on the currently active theme.
|
|
3
|
+
* Returns the appropriate content for the current theme from the provided mapping.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of content being returned
|
|
6
|
+
* @param contentMap - Object mapping theme keys to content values
|
|
7
|
+
* @param fallback - Optional fallback content if current theme key is not in the map
|
|
8
|
+
* @returns The content for the current theme, or fallback, or the first available content
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* Basic usage with strings
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const greeting = useThemeContent({
|
|
14
|
+
* default: 'Welcome to Default Theme',
|
|
15
|
+
* purple: 'Welcome to Purple Theme',
|
|
16
|
+
* green: 'Welcome to Green Theme'
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* return <h1>{greeting}</h1>;
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* With image URLs
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const logoSrc = useThemeContent({
|
|
26
|
+
* default: '/logos/logo-blue.svg',
|
|
27
|
+
* purple: '/logos/logo-purple.svg'
|
|
28
|
+
* }, '/logos/logo-default.svg');
|
|
29
|
+
*
|
|
30
|
+
* return <img src={logoSrc} alt="Logo" />;
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* With complex objects
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const themeConfig = useThemeContent({
|
|
37
|
+
* default: { color: '#1976d2', icon: 'home' },
|
|
38
|
+
* purple: { color: '#9c27b0', icon: 'star' }
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* return <Icon name={themeConfig.icon} color={themeConfig.color} />;
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* With React components
|
|
46
|
+
* ```tsx
|
|
47
|
+
* const ThemeIcon = useThemeContent({
|
|
48
|
+
* default: <HomeIcon />,
|
|
49
|
+
* purple: <StarIcon />,
|
|
50
|
+
* green: <NatureIcon />
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* return <div>{ThemeIcon}</div>;
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function useThemeContent<T>(contentMap: Record<string, T>, fallback?: T): T;
|
|
57
|
+
export default useThemeContent;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,13 +16,16 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import './fonts.css';
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export { default as ColorSchemeToggle } from "./components/ColorSchemeToggle/ColorSchemeToggle";
|
|
19
|
+
export * from "./styles";
|
|
20
|
+
export * from "./contexts";
|
|
21
|
+
export * from "./components";
|
|
23
22
|
export { default as Layout } from "./layouts";
|
|
23
|
+
export * from "./animations";
|
|
24
|
+
export * from "./hooks";
|
|
24
25
|
export * from '@mui/material';
|
|
26
|
+
export * as colors from '@mui/material/colors';
|
|
25
27
|
export * as Charts from '@mui/x-charts';
|
|
26
28
|
export * as DataGrid from '@mui/x-data-grid';
|
|
27
29
|
export * as DatePickers from '@mui/x-date-pickers';
|
|
30
|
+
export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
28
31
|
export * as TreeView from '@mui/x-tree-view';
|