@nayhoo/ui 0.3.1 → 0.4.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.
@@ -0,0 +1,33 @@
1
+ import {
2
+ darkTheme,
3
+ lightTheme,
4
+ theme
5
+ } from "../chunk-CI5TDSK3.mjs";
6
+
7
+ // src/providers/theme-provider.tsx
8
+ import { createContext } from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+ var defaultThemeMode = "light";
11
+ var ThemeContext = createContext(defaultThemeMode);
12
+ var ThemeProvider = ({
13
+ children,
14
+ themeMode = defaultThemeMode
15
+ }) => {
16
+ const isDarkMode = themeMode === "dark";
17
+ return /* @__PURE__ */ jsx(ThemeContext, { value: themeMode, children: /* @__PURE__ */ jsx(
18
+ "div",
19
+ {
20
+ className: isDarkMode ? darkTheme : lightTheme,
21
+ style: {
22
+ backgroundColor: theme.semanticColors.background,
23
+ color: theme.semanticColors.backgroundTextContrast
24
+ },
25
+ children
26
+ }
27
+ ) });
28
+ };
29
+ export {
30
+ ThemeContext,
31
+ ThemeProvider
32
+ };
33
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/providers/theme-provider.tsx"],"sourcesContent":["import { theme } from \"@/theme-contracts/theme-contract.css\";\nimport { darkTheme } from \"@/themes/dark-theme.css\";\nimport { lightTheme } from \"@/themes/light-theme.css\";\nimport { ThemeMode } from \"@/types/theme-mode\";\nimport React, { createContext } from \"react\";\n\nconst defaultThemeMode: ThemeMode = \"light\";\n\nexport const ThemeContext = createContext<ThemeMode>(defaultThemeMode);\n\ntype ThemeProviderProps = {\n children: React.ReactNode;\n themeMode?: ThemeMode;\n};\n\n/**\n * This component applies the theme css. It should preferably be used at the root of your component tree.\n */\nexport const ThemeProvider = ({\n children,\n themeMode = defaultThemeMode,\n}: ThemeProviderProps) => {\n const isDarkMode = themeMode === \"dark\";\n\n return (\n <ThemeContext value={themeMode}>\n <div\n className={isDarkMode ? darkTheme : lightTheme}\n style={{\n backgroundColor: theme.semanticColors.background,\n color: theme.semanticColors.backgroundTextContrast,\n }}\n >\n {children}\n </div>\n </ThemeContext>\n );\n};\n"],"mappings":";;;;;;;AAIA,SAAgB,qBAAqB;AAsB/B;AApBN,IAAM,mBAA8B;AAE7B,IAAM,eAAe,cAAyB,gBAAgB;AAU9D,IAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,YAAY;AACd,MAA0B;AACxB,QAAM,aAAa,cAAc;AAEjC,SACE,oBAAC,gBAAa,OAAO,WACnB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,aAAa,YAAY;AAAA,MACpC,OAAO;AAAA,QACL,iBAAiB,MAAM,eAAe;AAAA,QACtC,OAAO,MAAM,eAAe;AAAA,MAC9B;AAAA,MAEC;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nayhoo/ui",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,6 +36,17 @@
36
36
  "rimraf": "~5.0.0",
37
37
  "typescript": "~5.3.3"
38
38
  },
39
+ "exports": {
40
+ ".": {
41
+ "types": "./dist/index.d.ts",
42
+ "default": "./dist/index.js"
43
+ },
44
+ "./css": "./dist/index.css",
45
+ "./providers": {
46
+ "types": "./dist/providers/index.d.ts",
47
+ "default": "./dist/providers/index.js"
48
+ }
49
+ },
39
50
  "scripts": {
40
51
  "build": "pnpm run clean && pnpm run compile",
41
52
  "clean": "rimraf ./dist",