@availity/theme-provider 1.0.0-alpha.0 → 1.0.1

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,27 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.0.1](https://github.com/Availity/element/compare/@availity/theme-provider@1.0.0...@availity/theme-provider@1.0.1) (2025-03-07)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `theme` updated to version `1.0.0`
10
+ * `mui-alert` updated to version `1.0.0`
11
+ ## [1.0.0](https://github.com/Availity/element/compare/@availity/theme-provider@1.0.0-alpha.0...@availity/theme-provider@1.0.0) (2025-02-25)
12
+
13
+ ### Dependency Updates
14
+
15
+ * `theme` updated to version `0.5.1`
16
+ * `mui-alert` updated to version `0.5.1`
17
+
18
+ ### ⚠ BREAKING CHANGES
19
+
20
+ * upgrade to @mui/material v6
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * element v1 release ([a6e3567](https://github.com/Availity/element/commit/a6e35671185b9f13d25c7a39c4488ecb8774633e))
25
+
5
26
  ## [1.0.0-alpha.0](https://github.com/Availity/element/compare/@availity/theme-provider@0.5.1...@availity/theme-provider@1.0.0-alpha.0) (2025-02-24)
6
27
 
7
28
 
package/introduction.mdx CHANGED
@@ -1,7 +1,10 @@
1
1
  import { Markdown } from '@storybook/blocks';
2
2
  import { Meta } from '@storybook/addon-docs';
3
3
  import ReadMe from './README.md?raw';
4
+ import CHANGELOG from './CHANGELOG.md?raw';
4
5
 
5
6
  <Meta title="Design System/ThemeProvider/Introduction" />
6
7
 
7
8
  <Markdown>{ReadMe}</Markdown>
9
+
10
+ <Markdown>{CHANGELOG}</Markdown>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/theme-provider",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.1",
4
4
  "description": "Theme provider for the Element design system",
5
5
  "browser": "./dist/index.js",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "publish:canary": "yarn npm publish --access public --tag canary"
24
24
  },
25
25
  "dependencies": {
26
- "@availity/theme": "0.67.2-alpha.0",
26
+ "@availity/theme": "1.0.1",
27
27
  "@emotion/react": "^11.14.0",
28
28
  "@emotion/styled": "^11.14.0",
29
29
  "@mui/material": "^6.4.5",
@@ -1,17 +1,23 @@
1
1
  import type { StoryObj } from '@storybook/react';
2
+ import { Alert } from '@availity/mui-alert';
2
3
  import { ThemeProvider } from './theme-provider';
3
4
 
5
+ /** Wraps entire app for theme, locale, and date context */
6
+ export default {
7
+ title: 'Design System/ThemeProvider',
8
+ component: ThemeProvider,
9
+ tags: ['autodocs']
10
+ };
11
+
4
12
  export const Default: StoryObj<typeof ThemeProvider> = {
5
13
  render: () => (
6
14
  <>
7
- <ThemeProvider>
8
- <div>This component is inside the ThemeProvider</div>
15
+ <ThemeProvider theme="lightTheme">
16
+ <Alert severity="info" sx={{mb: 2}}>This alert is inside the ThemeProvider using "lightTheme"</Alert>
17
+ </ThemeProvider>
18
+ <ThemeProvider theme="legacyBS">
19
+ <Alert severity="info">This alert is inside the ThemeProvider using "legacyBS" theme</Alert>
9
20
  </ThemeProvider>
10
- <div>This component is outside the ThemeProvider</div>
11
21
  </>
12
22
  ),
13
23
  };
14
-
15
- export default {
16
- title: 'Design System/ThemeProvider',
17
- };
@@ -6,5 +6,5 @@
6
6
  "types": ["jest", "node", "@testing-library/jest-dom"],
7
7
  "allowJs": true
8
8
  },
9
- "include": ["**/*.test.js", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
9
+ "include": ["jest.config.ts", "**/*.test.js", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
10
10
  }
@@ -1,72 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { lightTheme as lightThemeOptions, legacyTheme as legacyThemeOptions } from '@availity/theme';
3
- import CssBaseline from '@mui/material/CssBaseline';
4
- import { ThemeProvider as MuiThemeProvider, createTheme } from '@mui/material/styles';
5
- import type { Theme, ThemeOptions } from '@mui/material/styles';
6
- import { deepmerge } from '@mui/utils';
7
- import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
8
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
9
- import { enUS as enUSDate, esES as esESDate } from '@mui/x-date-pickers/locales';
10
- import { enUS, esES } from '@mui/material/locale';
11
- // import type { Dayjs } from 'dayjs';
12
- // import "dayjs/locale/es-pr";
13
- // import "dayjs/locale/en";
14
- const muiTheme = createTheme();
15
-
16
- export type ThemeProviderProps = {
17
- children: React.ReactNode;
18
- /** Availity theme to use */
19
- theme?: 'lightTheme' | 'legacyBS' | 'mui';
20
- /** Internationalization locale */
21
- locale?: 'en' | 'es';
22
- };
23
-
24
- // dayjs
25
- const dayjsLocales = {
26
- en: 'en',
27
- es: 'es-pr'
28
- }
29
-
30
- // @mui/x-date-pickers
31
- const dateLocales = {
32
- en: enUSDate,
33
- es: esESDate
34
- };
35
-
36
- // @mui/material
37
- const coreLocales = {
38
- en: enUS,
39
- es: esES
40
- }
41
-
42
- const lightTheme = lightThemeOptions as ThemeOptions;
43
- const legacyTheme = deepmerge(legacyThemeOptions as ThemeOptions, legacyDatePickerOptions);
44
-
45
- const themeOptions: Record<string, ThemeOptions> = {
46
- lightTheme: lightTheme,
47
- legacyBS: legacyTheme,
48
- mui: undefined
49
- };
50
-
51
- export function ThemeProvider({ children, theme = 'lightTheme', locale = 'en' }: ThemeProviderProps) {
52
- // is localization provider still needed because of the dateadapter? or should we use themeprovider to handle locale globally?
53
- // const themeWithLocale = createTheme(themeOptions[theme], {...locales[locale]});
54
- const themeWithLocale = useMemo(
55
- () => createTheme(themeOptions[theme], dateLocales[locale], coreLocales[locale]),
56
- [locale, theme],
57
- );
58
- return (
59
- <LocalizationProvider
60
- dateAdapter={AdapterDayjs}
61
- adapterLocale={dayjsLocales[locale]}
62
- localeText={dateLocales[locale].components.MuiLocalizationProvider.defaultProps.localeText}
63
- >
64
- <MuiThemeProvider theme={themeWithLocale}>
65
- <CssBaseline />
66
- {children}
67
- </MuiThemeProvider>
68
- </LocalizationProvider>
69
- );
70
- }
71
-
72
- export default ThemeProvider;