@availity/theme-provider 0.2.4 → 0.3.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.3.0](https://github.com/Availity/element/compare/@availity/theme-provider@0.2.4...@availity/theme-provider@0.3.0) (2023-08-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * **theme-provider:** add predefined themes, remove custom theme ability ([b44d734](https://github.com/Availity/element/commit/b44d73424a344a3eb871bf27acd3dd53241b39a4))
11
+
5
12
  ## [0.2.4](https://github.com/Availity/element/compare/@availity/theme-provider@0.2.3...@availity/theme-provider@0.2.4) (2023-08-23)
6
13
 
7
14
  ## [0.2.3](https://github.com/Availity/element/compare/@availity/theme-provider@0.2.2...@availity/theme-provider@0.2.3) (2023-06-01)
@@ -12,30 +19,26 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/s
12
19
 
13
20
  ## [0.2.0](https://github.com/Availity/element/compare/@availity/theme-provider@0.1.2...@availity/theme-provider@0.2.0) (2023-03-01)
14
21
 
15
-
16
22
  ### Features
17
23
 
18
- * **theme:** update theme for button ([164f831](https://github.com/Availity/element/commit/164f83114c732da85f53bcf772f22b5436f2e9ff))
24
+ - **theme:** update theme for button ([164f831](https://github.com/Availity/element/commit/164f83114c732da85f53bcf772f22b5436f2e9ff))
19
25
 
20
26
  ## [0.1.2](https://github.com/Availity/element/compare/@availity/theme-provider@0.1.1...@availity/theme-provider@0.1.2) (2023-02-22)
21
27
 
22
-
23
28
  ### Bug Fixes
24
29
 
25
- * update exports ([af3f9f6](https://github.com/Availity/element/commit/af3f9f6715132b020bf96881dbc70906738bcda7))
30
+ - update exports ([af3f9f6](https://github.com/Availity/element/commit/af3f9f6715132b020bf96881dbc70906738bcda7))
26
31
 
27
32
  ## [0.1.1](https://github.com/Availity/element/compare/@availity/theme-provider@0.1.0...@availity/theme-provider@0.1.1) (2023-02-22)
28
33
 
29
34
  ## 0.1.0 (2023-02-21)
30
35
 
31
-
32
36
  ### Features
33
37
 
34
- * **theme-provider:** create component ([c532d6e](https://github.com/Availity/element/commit/c532d6e21c29f428c05a3b2159c18d95555dbbbb))
38
+ - **theme-provider:** create component ([c532d6e](https://github.com/Availity/element/commit/c532d6e21c29f428c05a3b2159c18d95555dbbbb))
35
39
 
36
40
  ## 0.0.1-alpha.0 (2023-02-20)
37
41
 
38
-
39
42
  ### Features
40
43
 
41
- * **theme-provider:** create component ([c532d6e](https://github.com/Availity/element/commit/c532d6e21c29f428c05a3b2159c18d95555dbbbb))
44
+ - **theme-provider:** create component ([c532d6e](https://github.com/Availity/element/commit/c532d6e21c29f428c05a3b2159c18d95555dbbbb))
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { Theme } from '@mui/material/styles';
2
-
3
- interface ThemeProviderProps {
1
+ declare type ThemeProviderProps = {
4
2
  children: React.ReactNode;
5
- theme?: Theme;
6
- }
3
+ /** Availity theme to use */
4
+ theme?: 'lightTheme' | 'legacyBS';
5
+ };
7
6
  declare function ThemeProvider({ children, theme }: ThemeProviderProps): JSX.Element;
8
7
 
9
8
  export { ThemeProvider, ThemeProviderProps };
package/dist/index.js CHANGED
@@ -37,12 +37,17 @@ var import_CssBaseline = __toESM(require("@mui/material/CssBaseline"));
37
37
  var import_AdapterDateFns = require("@mui/x-date-pickers/AdapterDateFns");
38
38
  var import_x_date_pickers = require("@mui/x-date-pickers");
39
39
  var import_jsx_runtime = require("react/jsx-runtime");
40
- var defaultTheme = (0, import_styles.createTheme)(import_theme.lightTheme);
41
- function ThemeProvider({ children, theme = defaultTheme }) {
40
+ var lightTheme = (0, import_styles.createTheme)(import_theme.lightTheme);
41
+ var legacyTheme = (0, import_styles.createTheme)(import_theme.legacyTheme);
42
+ var themes = {
43
+ lightTheme,
44
+ legacyBS: legacyTheme
45
+ };
46
+ function ThemeProvider({ children, theme = "lightTheme" }) {
42
47
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_x_date_pickers.LocalizationProvider, {
43
48
  dateAdapter: import_AdapterDateFns.AdapterDateFns,
44
49
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.ThemeProvider, {
45
- theme,
50
+ theme: themes[theme],
46
51
  children: [
47
52
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CssBaseline.default, {}),
48
53
  children
package/dist/index.mjs CHANGED
@@ -1,16 +1,21 @@
1
1
  // src/lib/theme-provider.tsx
2
- import { lightTheme } from "@availity/theme";
2
+ import { lightTheme as lightThemeOptions, legacyTheme as legacyThemeOptions } from "@availity/theme";
3
3
  import { ThemeProvider as MuiThemeProvider, createTheme } from "@mui/material/styles";
4
4
  import CssBaseline from "@mui/material/CssBaseline";
5
5
  import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
6
6
  import { LocalizationProvider } from "@mui/x-date-pickers";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
- var defaultTheme = createTheme(lightTheme);
9
- function ThemeProvider({ children, theme = defaultTheme }) {
8
+ var lightTheme = createTheme(lightThemeOptions);
9
+ var legacyTheme = createTheme(legacyThemeOptions);
10
+ var themes = {
11
+ lightTheme,
12
+ legacyBS: legacyTheme
13
+ };
14
+ function ThemeProvider({ children, theme = "lightTheme" }) {
10
15
  return /* @__PURE__ */ jsx(LocalizationProvider, {
11
16
  dateAdapter: AdapterDateFns,
12
17
  children: /* @__PURE__ */ jsxs(MuiThemeProvider, {
13
- theme,
18
+ theme: themes[theme],
14
19
  children: [
15
20
  /* @__PURE__ */ jsx(CssBaseline, {}),
16
21
  children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/theme-provider",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "description": "Theme provider for the Element design system",
5
5
  "browser": "./dist/index.js",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "publish:canary": "yarn npm publish --access public --tag canary"
16
16
  },
17
17
  "dependencies": {
18
- "@availity/theme": "0.11.2",
18
+ "@availity/theme": "0.14.0",
19
19
  "@emotion/react": "^11.10.5",
20
20
  "@emotion/styled": "^11.10.5",
21
21
  "@mui/material": "^5.11.6",
@@ -1,24 +1,27 @@
1
- import { lightTheme } from '@availity/theme';
1
+ import { lightTheme as lightThemeOptions, legacyTheme as legacyThemeOptions } from '@availity/theme';
2
2
  import { ThemeProvider as MuiThemeProvider, createTheme } from '@mui/material/styles';
3
3
  import type { Theme, ThemeOptions } from '@mui/material/styles';
4
4
  import CssBaseline from '@mui/material/CssBaseline';
5
5
  import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
6
6
  import { LocalizationProvider } from '@mui/x-date-pickers';
7
7
 
8
- // TODO: how do we add icon support?
9
- // import '../styles/material-icons.css'
8
+ const lightTheme = createTheme(lightThemeOptions as ThemeOptions);
9
+ const legacyTheme = createTheme(legacyThemeOptions as ThemeOptions);
10
10
 
11
- const defaultTheme = createTheme(lightTheme as ThemeOptions);
12
-
13
- export interface ThemeProviderProps {
11
+ export type ThemeProviderProps = {
14
12
  children: React.ReactNode;
15
- theme?: Theme;
16
- }
13
+ /** Availity theme to use */
14
+ theme?: 'lightTheme' | 'legacyBS';
15
+ };
16
+ const themes: Record<string, Theme> = {
17
+ lightTheme: lightTheme,
18
+ legacyBS: legacyTheme,
19
+ };
17
20
 
18
- export function ThemeProvider({ children, theme = defaultTheme }: ThemeProviderProps) {
21
+ export function ThemeProvider({ children, theme = 'lightTheme' }: ThemeProviderProps) {
19
22
  return (
20
23
  <LocalizationProvider dateAdapter={AdapterDateFns}>
21
- <MuiThemeProvider theme={theme}>
24
+ <MuiThemeProvider theme={themes[theme]}>
22
25
  <CssBaseline />
23
26
  {children}
24
27
  </MuiThemeProvider>