@purr-react-styled-components/services.styled-theme 0.0.8 → 0.0.9
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 +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var m=require('react'),styledComponents=require('styled-components');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);var r={data:{light:{id:"T_001",name:"Light",colors:{body:"#FFFFFF",text:"#222222",button:{text:"#FFFFFF",background:"#000000"},link:{text:"teal",opacity:1}},font:"Tinos"},dark:{id:"T_007",name:"Dark",colors:{body:"#222222",text:"#c5cbce",button:{text:"#ffffff",background:"#0d47a1"},link:{text:"#0d47a1",opacity:.8}},font:"Ubuntu"}}};var d=m.createContext({theme:"dark",setTheme:()=>""}),y=({schema:e=r,defaultTheme:t="dark",children:n})=>{let[o,a]=m.useState(t),T=m.useMemo(()=>o?e?.data?.[o]:e?.data?.[t],[t,e?.data,o]);return m__default.default.createElement(d.Provider,{value:{theme:o,setTheme:a}},m__default.default.createElement(styledComponents.ThemeProvider,{theme:T},n),";")},S=()=>{let{setTheme:e,theme:t}=m.useContext(d);return {setTheme:e,theme:t}};exports.ThemesProvider=y;exports.useTheme=S;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { TAny } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
type TStyledTheme = "light" | "dark";
|
|
5
|
+
type TStyledThemeContext = {
|
|
6
|
+
theme: TStyledTheme;
|
|
7
|
+
setTheme: (theme: TStyledTheme) => void;
|
|
8
|
+
};
|
|
9
|
+
interface IStyledThemeProps {
|
|
10
|
+
schema?: TAny;
|
|
11
|
+
defaultTheme?: TStyledTheme;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare const ThemesProvider: ({ schema, defaultTheme, children, }: IStyledThemeProps) => React.JSX.Element;
|
|
16
|
+
declare const useTheme: () => {
|
|
17
|
+
setTheme: (theme: TStyledTheme) => void;
|
|
18
|
+
theme: TStyledTheme;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { type IStyledThemeProps, type TStyledTheme, type TStyledThemeContext, ThemesProvider, useTheme };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { TAny } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
type TStyledTheme = "light" | "dark";
|
|
5
|
+
type TStyledThemeContext = {
|
|
6
|
+
theme: TStyledTheme;
|
|
7
|
+
setTheme: (theme: TStyledTheme) => void;
|
|
8
|
+
};
|
|
9
|
+
interface IStyledThemeProps {
|
|
10
|
+
schema?: TAny;
|
|
11
|
+
defaultTheme?: TStyledTheme;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare const ThemesProvider: ({ schema, defaultTheme, children, }: IStyledThemeProps) => React.JSX.Element;
|
|
16
|
+
declare const useTheme: () => {
|
|
17
|
+
setTheme: (theme: TStyledTheme) => void;
|
|
18
|
+
theme: TStyledTheme;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { type IStyledThemeProps, type TStyledTheme, type TStyledThemeContext, ThemesProvider, useTheme };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import m,{createContext,useState,useMemo,useContext}from'react';import {ThemeProvider}from'styled-components';var r={data:{light:{id:"T_001",name:"Light",colors:{body:"#FFFFFF",text:"#222222",button:{text:"#FFFFFF",background:"#000000"},link:{text:"teal",opacity:1}},font:"Tinos"},dark:{id:"T_007",name:"Dark",colors:{body:"#222222",text:"#c5cbce",button:{text:"#ffffff",background:"#0d47a1"},link:{text:"#0d47a1",opacity:.8}},font:"Ubuntu"}}};var d=createContext({theme:"dark",setTheme:()=>""}),y=({schema:e=r,defaultTheme:t="dark",children:n})=>{let[o,a]=useState(t),T=useMemo(()=>o?e?.data?.[o]:e?.data?.[t],[t,e?.data,o]);return m.createElement(d.Provider,{value:{theme:o,setTheme:a}},m.createElement(ThemeProvider,{theme:T},n),";")},S=()=>{let{setTheme:e,theme:t}=useContext(d);return {setTheme:e,theme:t}};export{y as ThemesProvider,S as useTheme};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-styled-components/services.styled-theme",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"typescript": "*",
|
|
25
25
|
"react": "*",
|
|
26
26
|
"styled-components": "*",
|
|
27
|
-
"@purr-core/utils.definitions": "0.0.
|
|
27
|
+
"@purr-core/utils.definitions": "0.0.12"
|
|
28
28
|
},
|
|
29
29
|
"author": "@DinhThienPhuc",
|
|
30
30
|
"license": "ISC",
|