@chayns-components/core 5.0.0-beta.875 → 5.0.0-beta.876
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/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +93 -72
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +93 -72
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +11 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -38,10 +38,12 @@ const ColorSchemeProvider = ({
|
|
|
38
38
|
siteId,
|
|
39
39
|
style = {},
|
|
40
40
|
paragraphFormat,
|
|
41
|
-
designSettings
|
|
41
|
+
designSettings,
|
|
42
|
+
theme,
|
|
43
|
+
colors
|
|
42
44
|
}) => {
|
|
43
|
-
const [
|
|
44
|
-
const [
|
|
45
|
+
const [internalColors, setInternalColors] = (0, _react.useState)({});
|
|
46
|
+
const [internalTheme, setInternalTheme] = (0, _react.useState)({});
|
|
45
47
|
const [internalDesignSettings, setInternalDesignSettings] = (0, _react.useState)();
|
|
46
48
|
const [internalParagraphFormat, setInternalParagraphFormat] = (0, _react.useState)();
|
|
47
49
|
|
|
@@ -67,89 +69,108 @@ const ColorSchemeProvider = ({
|
|
|
67
69
|
}
|
|
68
70
|
}, [designSettings, paragraphFormat, siteId]);
|
|
69
71
|
(0, _react.useEffect)(() => {
|
|
72
|
+
let newColors = {};
|
|
73
|
+
let newTheme = {};
|
|
70
74
|
const availableColors = (0, _colors.getAvailableColorList)();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
newTheme.colorMode = 'dark';
|
|
95
|
-
break;
|
|
96
|
-
default:
|
|
97
|
-
newTheme.colorMode = 'classic';
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (internalDesignSettings) {
|
|
101
|
-
Object.keys(internalDesignSettings).forEach(key => {
|
|
102
|
-
if (key === 'iconStyle') {
|
|
103
|
-
newTheme[key] = (0, _font.convertIconStyle)(internalDesignSettings.iconStyle);
|
|
104
|
-
return;
|
|
75
|
+
if (!colors || !theme) {
|
|
76
|
+
availableColors.forEach(colorName => {
|
|
77
|
+
const hexColor = (0, _colors.getColorFromPalette)(colorName, {
|
|
78
|
+
color: color ?? internalColor,
|
|
79
|
+
colorMode: colorMode ?? internalColorMode,
|
|
80
|
+
secondaryColor
|
|
81
|
+
});
|
|
82
|
+
if (hexColor) {
|
|
83
|
+
const rgbColor = (0, _colors.hexToRgb255)(hexColor);
|
|
84
|
+
if (!theme) {
|
|
85
|
+
newTheme[colorName] = hexColor;
|
|
86
|
+
}
|
|
87
|
+
if (!colors) {
|
|
88
|
+
newColors[`--chayns-color--${colorName}`] = hexColor;
|
|
89
|
+
}
|
|
90
|
+
if (rgbColor) {
|
|
91
|
+
if (!theme) {
|
|
92
|
+
newTheme[`${colorName}-rgb`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;
|
|
93
|
+
}
|
|
94
|
+
if (!colors) {
|
|
95
|
+
newColors[`--chayns-color-rgb--${colorName}`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
105
98
|
}
|
|
106
|
-
|
|
107
|
-
// ToDo: Find better solution
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
111
|
-
newTheme[key] = internalDesignSettings[key];
|
|
112
99
|
});
|
|
113
100
|
}
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
101
|
+
if (colors) {
|
|
102
|
+
newColors = colors;
|
|
103
|
+
}
|
|
104
|
+
if (!theme) {
|
|
105
|
+
switch (colorMode ?? internalColorMode) {
|
|
106
|
+
case ColorMode.Light:
|
|
107
|
+
newTheme.colorMode = 'light';
|
|
108
|
+
break;
|
|
109
|
+
case ColorMode.Dark:
|
|
110
|
+
newTheme.colorMode = 'dark';
|
|
111
|
+
break;
|
|
112
|
+
default:
|
|
113
|
+
newTheme.colorMode = 'classic';
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
if (internalDesignSettings) {
|
|
117
|
+
Object.keys(internalDesignSettings).forEach(key => {
|
|
118
|
+
if (key === 'iconStyle') {
|
|
119
|
+
newTheme[key] = (0, _font.convertIconStyle)(internalDesignSettings.iconStyle);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
119
122
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
// ToDo: Find better solution
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
127
|
+
newTheme[key] = internalDesignSettings[key];
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (internalParagraphFormat) {
|
|
131
|
+
const {
|
|
132
|
+
colorResult,
|
|
133
|
+
themeResult
|
|
134
|
+
} = (0, _font.getHeadlineColorSelector)(internalParagraphFormat);
|
|
128
135
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
// Update chayns-colors
|
|
137
|
+
Object.keys(colorResult).forEach(key => {
|
|
138
|
+
// ToDo: Find better solution
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
142
|
+
newColors[key] = colorResult[key];
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Update Theme
|
|
146
|
+
Object.keys(themeResult).forEach(key => {
|
|
147
|
+
// ToDo: Find better solution
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
151
|
+
newTheme[key] = themeResult[key];
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
newTheme.fontSize = (0, _font.getFontSize)();
|
|
155
|
+
} else {
|
|
156
|
+
newTheme = theme;
|
|
137
157
|
}
|
|
138
|
-
newTheme
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}, [color, colorMode, internalColor, internalColorMode, internalDesignSettings, internalParagraphFormat, secondaryColor]);
|
|
158
|
+
setInternalTheme(newTheme);
|
|
159
|
+
setInternalColors(newColors);
|
|
160
|
+
}, [color, colorMode, colors, internalColor, internalColorMode, internalDesignSettings, internalParagraphFormat, secondaryColor, theme]);
|
|
142
161
|
const contextValue = (0, _react.useMemo)(() => {
|
|
143
162
|
if (internalDesignSettings && internalParagraphFormat) {
|
|
144
163
|
return {
|
|
145
164
|
paragraphFormat: internalParagraphFormat,
|
|
146
|
-
designSettings: internalDesignSettings
|
|
165
|
+
designSettings: internalDesignSettings,
|
|
166
|
+
colors: internalColors,
|
|
167
|
+
theme: internalTheme
|
|
147
168
|
};
|
|
148
169
|
}
|
|
149
170
|
return undefined;
|
|
150
|
-
}, [internalDesignSettings, internalParagraphFormat]);
|
|
171
|
+
}, [internalColors, internalDesignSettings, internalParagraphFormat, internalTheme]);
|
|
151
172
|
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
152
|
-
theme:
|
|
173
|
+
theme: internalTheme
|
|
153
174
|
}, /*#__PURE__*/_react.default.createElement(ColorSchemeContext.Provider, {
|
|
154
175
|
value: contextValue
|
|
155
176
|
}, /*#__PURE__*/_react.default.createElement(_reactHelmet.Helmet, null, /*#__PURE__*/_react.default.createElement("link", {
|
|
@@ -158,7 +179,7 @@ const ColorSchemeProvider = ({
|
|
|
158
179
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
159
180
|
className: "color-scheme-provider",
|
|
160
181
|
style: {
|
|
161
|
-
...
|
|
182
|
+
...internalColors,
|
|
162
183
|
...cssVariables,
|
|
163
184
|
...style,
|
|
164
185
|
color: 'var(--chayns-color--text)'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSchemeProvider.js","names":["_colors","require","_chaynsApi","_react","_interopRequireWildcard","_reactHelmet","_styledComponents","_get","_font","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ColorMode","GlobalStyle","createGlobalStyle","ColorSchemeContext","exports","createContext","undefined","useColorScheme","useContext","ColorSchemeProvider","children","color","colorMode","cssVariables","secondaryColor","siteId","style","paragraphFormat","designSettings","colors","setColors","useState","theme","setTheme","internalDesignSettings","setInternalDesignSettings","internalParagraphFormat","setInternalParagraphFormat","internalColor","internalColorMode","useSite","useEffect","getDesignSettings","then","result","getParagraphFormat","availableColors","getAvailableColorList","newColors","newTheme","forEach","colorName","hexColor","getColorFromPalette","rgbColor","hexToRgb255","g","b","Light","Dark","keys","key","convertIconStyle","iconStyle","colorResult","themeResult","getHeadlineColorSelector","fontSize","getFontSize","contextValue","useMemo","createElement","ThemeProvider","Provider","value","Helmet","rel","href","className","displayName","_default"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, {\n createContext,\n FC,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { Helmet } from 'react-helmet';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings, getParagraphFormat } from '../../api/theme/get';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\nimport { convertIconStyle, getFontSize, getHeadlineColorSelector } from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The general format settings.\n */\n paragraphFormat?: ParagraphFormat[];\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\ninterface ColorSchemeContextProps {\n designSettings: DesignSettings;\n paragraphFormat: ParagraphFormat[];\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n siteId,\n style = {},\n paragraphFormat,\n designSettings,\n}) => {\n const [colors, setColors] = useState<Theme>({});\n const [theme, setTheme] = useState<Theme>({});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n const [internalParagraphFormat, setInternalParagraphFormat] = useState<ParagraphFormat[]>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n } else {\n void getDesignSettings(siteId).then((result) => {\n setInternalDesignSettings(result);\n });\n }\n\n if (paragraphFormat) {\n setInternalParagraphFormat(paragraphFormat);\n } else {\n void getParagraphFormat(siteId).then((result) => {\n setInternalParagraphFormat(result);\n });\n }\n }, [designSettings, paragraphFormat, siteId]);\n\n useEffect(() => {\n const availableColors = getAvailableColorList();\n\n const newColors: Theme = {};\n const newTheme: Theme = {};\n\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n newColors[`--chayns-color--${colorName}`] = hexColor;\n newTheme[colorName] = hexColor;\n\n if (rgbColor) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n newTheme[`${colorName}-rgb`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n });\n\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n if (internalParagraphFormat) {\n const { colorResult, themeResult } = getHeadlineColorSelector(internalParagraphFormat);\n\n // Update chayns-colors\n Object.keys(colorResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newColors[key] = colorResult[key];\n });\n\n // Update Theme\n Object.keys(themeResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = themeResult[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n\n setTheme(newTheme);\n setColors(newColors);\n }, [\n color,\n colorMode,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n internalParagraphFormat,\n secondaryColor,\n ]);\n\n const contextValue = useMemo(() => {\n if (internalDesignSettings && internalParagraphFormat) {\n return {\n paragraphFormat: internalParagraphFormat,\n designSettings: internalDesignSettings,\n };\n }\n\n return undefined;\n }, [internalDesignSettings, internalParagraphFormat]);\n\n return (\n <ThemeProvider theme={theme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <Helmet>\n <link\n rel=\"stylesheet\"\n href=\"https://api.chayns-static.space/font/NotoColorEmoji/v1/font.css\"\n />\n </Helmet>\n <div\n className=\"color-scheme-provider\"\n style={{\n ...colors,\n ...cssVariables,\n ...style,\n color: 'var(--chayns-color--text)',\n }}\n >\n {children}\n </div>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":";;;;;;AAAA,IAA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AAExB,CAAC;AAEDQ,mBAAmB,CAAC4D,WAAW,GAAG,qBAAqB;AAAC,IAAAC,QAAA,GAAAlE,OAAA,CAAAlB,OAAA,GAEzCuB,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ColorSchemeProvider.js","names":["_colors","require","_chaynsApi","_react","_interopRequireWildcard","_reactHelmet","_styledComponents","_get","_font","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ColorMode","GlobalStyle","createGlobalStyle","ColorSchemeContext","exports","createContext","undefined","useColorScheme","useContext","ColorSchemeProvider","children","color","colorMode","cssVariables","secondaryColor","siteId","style","paragraphFormat","designSettings","theme","colors","internalColors","setInternalColors","useState","internalTheme","setInternalTheme","internalDesignSettings","setInternalDesignSettings","internalParagraphFormat","setInternalParagraphFormat","internalColor","internalColorMode","useSite","useEffect","getDesignSettings","then","result","getParagraphFormat","newColors","newTheme","availableColors","getAvailableColorList","forEach","colorName","hexColor","getColorFromPalette","rgbColor","hexToRgb255","g","b","Light","Dark","keys","key","convertIconStyle","iconStyle","colorResult","themeResult","getHeadlineColorSelector","fontSize","getFontSize","contextValue","useMemo","createElement","ThemeProvider","Provider","value","Helmet","rel","href","className","displayName","_default"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, {\n createContext,\n FC,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { Helmet } from 'react-helmet';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings, getParagraphFormat } from '../../api/theme/get';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\nimport { convertIconStyle, getFontSize, getHeadlineColorSelector } from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The colors of the components\n */\n colors?: Theme;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The general format settings.\n */\n paragraphFormat?: ParagraphFormat[];\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n /**\n * The theme for the components\n */\n theme?: Theme;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings: DesignSettings;\n paragraphFormat: ParagraphFormat[];\n colors: Theme;\n theme: Theme;\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n siteId,\n style = {},\n paragraphFormat,\n designSettings,\n theme,\n colors,\n}) => {\n const [internalColors, setInternalColors] = useState<Theme>({});\n const [internalTheme, setInternalTheme] = useState<Theme>({});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n const [internalParagraphFormat, setInternalParagraphFormat] = useState<ParagraphFormat[]>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n } else {\n void getDesignSettings(siteId).then((result) => {\n setInternalDesignSettings(result);\n });\n }\n\n if (paragraphFormat) {\n setInternalParagraphFormat(paragraphFormat);\n } else {\n void getParagraphFormat(siteId).then((result) => {\n setInternalParagraphFormat(result);\n });\n }\n }, [designSettings, paragraphFormat, siteId]);\n\n useEffect(() => {\n let newColors: Theme = {};\n let newTheme: Theme = {};\n\n const availableColors = getAvailableColorList();\n\n if (!colors || !theme) {\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n if (!theme) {\n newTheme[colorName] = hexColor;\n }\n\n if (!colors) {\n newColors[`--chayns-color--${colorName}`] = hexColor;\n }\n\n if (rgbColor) {\n if (!theme) {\n newTheme[`${colorName}-rgb`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n\n if (!colors) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n }\n });\n }\n\n if (colors) {\n newColors = colors;\n }\n\n if (!theme) {\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n if (internalParagraphFormat) {\n const { colorResult, themeResult } =\n getHeadlineColorSelector(internalParagraphFormat);\n\n // Update chayns-colors\n Object.keys(colorResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newColors[key] = colorResult[key];\n });\n\n // Update Theme\n Object.keys(themeResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = themeResult[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n } else {\n newTheme = theme;\n }\n\n setInternalTheme(newTheme);\n setInternalColors(newColors);\n }, [\n color,\n colorMode,\n colors,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n internalParagraphFormat,\n secondaryColor,\n theme,\n ]);\n\n const contextValue: ColorSchemeContextProps | undefined = useMemo(() => {\n if (internalDesignSettings && internalParagraphFormat) {\n return {\n paragraphFormat: internalParagraphFormat,\n designSettings: internalDesignSettings,\n colors: internalColors,\n theme: internalTheme,\n };\n }\n\n return undefined;\n }, [internalColors, internalDesignSettings, internalParagraphFormat, internalTheme]);\n\n return (\n <ThemeProvider theme={internalTheme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <Helmet>\n <link\n rel=\"stylesheet\"\n href=\"https://api.chayns-static.space/font/NotoColorEmoji/v1/font.css\"\n />\n </Helmet>\n <div\n className=\"color-scheme-provider\"\n style={{\n ...internalColors,\n ...cssVariables,\n ...style,\n color: 'var(--chayns-color--text)',\n }}\n >\n {children}\n </div>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,M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A,CAACvF,YAAA,CAAA2F,MAAM,qBACH7F,MAAA,CAAAY,OAAA,CAAA6E,aAAA;IACIK,GAAG,EAAC,YAAY;IAChBC,IAAI,EAAC;EAAiE,CACzE,CACG,CAAC,eACT/F,MAAA,CAAAY,OAAA,CAAA6E,aAAA;IACIO,SAAS,EAAC,uBAAuB;IACjCtD,KAAK,EAAE;MACH,GAAGK,cAAc;MACjB,GAAGR,YAAY;MACf,GAAGG,KAAK;MACRL,KAAK,EAAE;IACX;EAAE,GAEDD,QACA,CAAC,eACNpC,MAAA,CAAAY,OAAA,CAAA6E,aAAA,CAAC9D,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDQ,mBAAmB,CAAC8D,WAAW,GAAG,qBAAqB;AAAC,IAAAC,QAAA,GAAApE,OAAA,CAAAlB,OAAA,GAEzCuB,mBAAmB","ignoreList":[]}
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu, type ContextMenuRef } from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport { useColorScheme } from './components/color-scheme-provider/ColorSchemeProvider';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,oBAAA,GAAAC,uBAAA,CAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,OAAA,GAA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sD,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAAtE,uBAAA8D,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAI,UAAA,GAAAJ,CAAA,KAAAK,OAAA,EAAAL,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu, type ContextMenuRef } from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport { useColorScheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { ColorSchemeContextProps } from './components/color-scheme-provider/ColorSchemeProvider';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAAtE,uBAAA8D,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAI,UAAA,GAAAJ,CAAA,KAAAK,OAAA,EAAAL,CAAA","ignoreList":[]}
|
|
@@ -30,10 +30,12 @@ const ColorSchemeProvider = _ref => {
|
|
|
30
30
|
siteId,
|
|
31
31
|
style = {},
|
|
32
32
|
paragraphFormat,
|
|
33
|
-
designSettings
|
|
33
|
+
designSettings,
|
|
34
|
+
theme,
|
|
35
|
+
colors
|
|
34
36
|
} = _ref;
|
|
35
|
-
const [
|
|
36
|
-
const [
|
|
37
|
+
const [internalColors, setInternalColors] = useState({});
|
|
38
|
+
const [internalTheme, setInternalTheme] = useState({});
|
|
37
39
|
const [internalDesignSettings, setInternalDesignSettings] = useState();
|
|
38
40
|
const [internalParagraphFormat, setInternalParagraphFormat] = useState();
|
|
39
41
|
|
|
@@ -59,89 +61,108 @@ const ColorSchemeProvider = _ref => {
|
|
|
59
61
|
}
|
|
60
62
|
}, [designSettings, paragraphFormat, siteId]);
|
|
61
63
|
useEffect(() => {
|
|
64
|
+
let newColors = {};
|
|
65
|
+
let newTheme = {};
|
|
62
66
|
const availableColors = getAvailableColorList();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
newTheme.colorMode = 'dark';
|
|
87
|
-
break;
|
|
88
|
-
default:
|
|
89
|
-
newTheme.colorMode = 'classic';
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
if (internalDesignSettings) {
|
|
93
|
-
Object.keys(internalDesignSettings).forEach(key => {
|
|
94
|
-
if (key === 'iconStyle') {
|
|
95
|
-
newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);
|
|
96
|
-
return;
|
|
67
|
+
if (!colors || !theme) {
|
|
68
|
+
availableColors.forEach(colorName => {
|
|
69
|
+
const hexColor = getColorFromPalette(colorName, {
|
|
70
|
+
color: color ?? internalColor,
|
|
71
|
+
colorMode: colorMode ?? internalColorMode,
|
|
72
|
+
secondaryColor
|
|
73
|
+
});
|
|
74
|
+
if (hexColor) {
|
|
75
|
+
const rgbColor = hexToRgb255(hexColor);
|
|
76
|
+
if (!theme) {
|
|
77
|
+
newTheme[colorName] = hexColor;
|
|
78
|
+
}
|
|
79
|
+
if (!colors) {
|
|
80
|
+
newColors[`--chayns-color--${colorName}`] = hexColor;
|
|
81
|
+
}
|
|
82
|
+
if (rgbColor) {
|
|
83
|
+
if (!theme) {
|
|
84
|
+
newTheme[`${colorName}-rgb`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;
|
|
85
|
+
}
|
|
86
|
+
if (!colors) {
|
|
87
|
+
newColors[`--chayns-color-rgb--${colorName}`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
97
90
|
}
|
|
98
|
-
|
|
99
|
-
// ToDo: Find better solution
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
103
|
-
newTheme[key] = internalDesignSettings[key];
|
|
104
91
|
});
|
|
105
92
|
}
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
93
|
+
if (colors) {
|
|
94
|
+
newColors = colors;
|
|
95
|
+
}
|
|
96
|
+
if (!theme) {
|
|
97
|
+
switch (colorMode ?? internalColorMode) {
|
|
98
|
+
case ColorMode.Light:
|
|
99
|
+
newTheme.colorMode = 'light';
|
|
100
|
+
break;
|
|
101
|
+
case ColorMode.Dark:
|
|
102
|
+
newTheme.colorMode = 'dark';
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
newTheme.colorMode = 'classic';
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
if (internalDesignSettings) {
|
|
109
|
+
Object.keys(internalDesignSettings).forEach(key => {
|
|
110
|
+
if (key === 'iconStyle') {
|
|
111
|
+
newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
// ToDo: Find better solution
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
119
|
+
newTheme[key] = internalDesignSettings[key];
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (internalParagraphFormat) {
|
|
123
|
+
const {
|
|
124
|
+
colorResult,
|
|
125
|
+
themeResult
|
|
126
|
+
} = getHeadlineColorSelector(internalParagraphFormat);
|
|
120
127
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
// Update chayns-colors
|
|
129
|
+
Object.keys(colorResult).forEach(key => {
|
|
130
|
+
// ToDo: Find better solution
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
134
|
+
newColors[key] = colorResult[key];
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Update Theme
|
|
138
|
+
Object.keys(themeResult).forEach(key => {
|
|
139
|
+
// ToDo: Find better solution
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
143
|
+
newTheme[key] = themeResult[key];
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
newTheme.fontSize = getFontSize();
|
|
147
|
+
} else {
|
|
148
|
+
newTheme = theme;
|
|
129
149
|
}
|
|
130
|
-
newTheme
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, [color, colorMode, internalColor, internalColorMode, internalDesignSettings, internalParagraphFormat, secondaryColor]);
|
|
150
|
+
setInternalTheme(newTheme);
|
|
151
|
+
setInternalColors(newColors);
|
|
152
|
+
}, [color, colorMode, colors, internalColor, internalColorMode, internalDesignSettings, internalParagraphFormat, secondaryColor, theme]);
|
|
134
153
|
const contextValue = useMemo(() => {
|
|
135
154
|
if (internalDesignSettings && internalParagraphFormat) {
|
|
136
155
|
return {
|
|
137
156
|
paragraphFormat: internalParagraphFormat,
|
|
138
|
-
designSettings: internalDesignSettings
|
|
157
|
+
designSettings: internalDesignSettings,
|
|
158
|
+
colors: internalColors,
|
|
159
|
+
theme: internalTheme
|
|
139
160
|
};
|
|
140
161
|
}
|
|
141
162
|
return undefined;
|
|
142
|
-
}, [internalDesignSettings, internalParagraphFormat]);
|
|
163
|
+
}, [internalColors, internalDesignSettings, internalParagraphFormat, internalTheme]);
|
|
143
164
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
144
|
-
theme:
|
|
165
|
+
theme: internalTheme
|
|
145
166
|
}, /*#__PURE__*/React.createElement(ColorSchemeContext.Provider, {
|
|
146
167
|
value: contextValue
|
|
147
168
|
}, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("link", {
|
|
@@ -150,7 +171,7 @@ const ColorSchemeProvider = _ref => {
|
|
|
150
171
|
})), /*#__PURE__*/React.createElement("div", {
|
|
151
172
|
className: "color-scheme-provider",
|
|
152
173
|
style: {
|
|
153
|
-
...
|
|
174
|
+
...internalColors,
|
|
154
175
|
...cssVariables,
|
|
155
176
|
...style,
|
|
156
177
|
color: 'var(--chayns-color--text)'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSchemeProvider.js","names":["getAvailableColorList","getColorFromPalette","hexToRgb255","useSite","React","createContext","useContext","useEffect","useMemo","useState","Helmet","createGlobalStyle","ThemeProvider","getDesignSettings","getParagraphFormat","convertIconStyle","getFontSize","getHeadlineColorSelector","ColorMode","GlobalStyle","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","_ref","children","color","colorMode","cssVariables","secondaryColor","siteId","style","paragraphFormat","designSettings","colors","setColors","theme","setTheme","internalDesignSettings","setInternalDesignSettings","internalParagraphFormat","setInternalParagraphFormat","internalColor","internalColorMode","then","result","availableColors","newColors","newTheme","forEach","colorName","hexColor","rgbColor","r","g","b","Light","Dark","Object","keys","key","iconStyle","colorResult","themeResult","fontSize","contextValue","createElement","Provider","value","rel","href","className","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, {\n createContext,\n FC,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { Helmet } from 'react-helmet';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings, getParagraphFormat } from '../../api/theme/get';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\nimport { convertIconStyle, getFontSize, getHeadlineColorSelector } from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The general format settings.\n */\n paragraphFormat?: ParagraphFormat[];\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\ninterface ColorSchemeContextProps {\n designSettings: DesignSettings;\n paragraphFormat: ParagraphFormat[];\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n siteId,\n style = {},\n paragraphFormat,\n designSettings,\n}) => {\n const [colors, setColors] = useState<Theme>({});\n const [theme, setTheme] = useState<Theme>({});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n const [internalParagraphFormat, setInternalParagraphFormat] = useState<ParagraphFormat[]>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n } else {\n void getDesignSettings(siteId).then((result) => {\n setInternalDesignSettings(result);\n });\n }\n\n if (paragraphFormat) {\n setInternalParagraphFormat(paragraphFormat);\n } else {\n void getParagraphFormat(siteId).then((result) => {\n setInternalParagraphFormat(result);\n });\n }\n }, [designSettings, paragraphFormat, siteId]);\n\n useEffect(() => {\n const availableColors = getAvailableColorList();\n\n const newColors: Theme = {};\n const newTheme: Theme = {};\n\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n newColors[`--chayns-color--${colorName}`] = hexColor;\n newTheme[colorName] = hexColor;\n\n if (rgbColor) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n newTheme[`${colorName}-rgb`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n });\n\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n if (internalParagraphFormat) {\n const { colorResult, themeResult } = getHeadlineColorSelector(internalParagraphFormat);\n\n // Update chayns-colors\n Object.keys(colorResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newColors[key] = colorResult[key];\n });\n\n // Update Theme\n Object.keys(themeResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = themeResult[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n\n setTheme(newTheme);\n setColors(newColors);\n }, [\n color,\n colorMode,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n internalParagraphFormat,\n secondaryColor,\n ]);\n\n const contextValue = useMemo(() => {\n if (internalDesignSettings && internalParagraphFormat) {\n return {\n paragraphFormat: internalParagraphFormat,\n designSettings: internalDesignSettings,\n };\n }\n\n return undefined;\n }, [internalDesignSettings, internalParagraphFormat]);\n\n return (\n <ThemeProvider theme={theme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <Helmet>\n <link\n rel=\"stylesheet\"\n href=\"https://api.chayns-static.space/font/NotoColorEmoji/v1/font.css\"\n />\n </Helmet>\n <div\n className=\"color-scheme-provider\"\n style={{\n ...colors,\n ...cssVariables,\n ...style,\n color: 'var(--chayns-color--text)',\n }}\n >\n {children}\n </div>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":"AAAA,SAASA,qBAAqB,EAAEC,mBAAmB,EAAEC,WAAW,QAAQ,gBAAgB;AACxF,SAASC,OAAO,QAAQ,YAAY;AACpC,OAAOC,KAAK,IACRC,aAAa,EAGbC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACpE,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,qBAAqB;AAE3E,SAASC,gBAAgB,EAAEC,WAAW,EAAEC,wBAAwB,QAAQ,kBAAkB;AAAC,IAEtFC,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,EAATA,SAAS,SAqD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M;IAC/B,IAAI8B,sBAAsB,IAAIE,uBAAuB,EAAE;MACnD,OAAO;QACHR,eAAe,EAAEQ,uBAAuB;QACxCP,cAAc,EAAEK;MACpB,CAAC;IACL;IAEA,OAAOjB,SAAS;EACpB,CAAC,EAAE,CAACiB,sBAAsB,EAAEE,uBAAuB,CAAC,CAAC;EAErD,oBACIpC,KAAA,CAAA8D,aAAA,CAACtD,aAAa;IAACwB,KAAK,EAAEA;EAAM,gBACxBhC,KAAA,CAAA8D,aAAA,CAAC9C,kBAAkB,CAAC+C,QAAQ;IAACC,KAAK,EAAEH;EAAa,gBAC7C7D,KAAA,CAAA8D,aAAA,CAACxD,MAAM,qBACHN,KAAA,CAAA8D,aAAA;IACIG,GAAG,EAAC,YAAY;IAChBC,IAAI,EAAC;EAAiE,CACzE,CACG,CAAC,eACTlE,KAAA,CAAA8D,aAAA;IACIK,SAAS,EAAC,uBAAuB;IACjCxC,KAAK,EAAE;MACH,GAAGG,MAAM;MACT,GAAGN,YAAY;MACf,GAAGG,KAAK;MACRL,KAAK,EAAE;IACX;EAAE,GAEDD,QACA,CAAC,eACNrB,KAAA,CAAA8D,aAAA,CAAC/C,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDI,mBAAmB,CAACiD,WAAW,GAAG,qBAAqB;AAEvD,eAAejD,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ColorSchemeProvider.js","names":["getAvailableColorList","getColorFromPalette","hexToRgb255","useSite","React","createContext","useContext","useEffect","useMemo","useState","Helmet","createGlobalStyle","ThemeProvider","getDesignSettings","getParagraphFormat","convertIconStyle","getFontSize","getHeadlineColorSelector","ColorMode","GlobalStyle","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","_ref","children","color","colorMode","cssVariables","secondaryColor","siteId","style","paragraphFormat","designSettings","theme","colors","internalColors","setInternalColors","internalTheme","setInternalTheme","internalDesignSettings","setInternalDesignSettings","internalParagraphFormat","setInternalParagraphFormat","internalColor","internalColorMode","then","result","newColors","newTheme","availableColors","forEach","colorName","hexColor","rgbColor","r","g","b","Light","Dark","Object","keys","key","iconStyle","colorResult","themeResult","fontSize","contextValue","createElement","Provider","value","rel","href","className","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, {\n createContext,\n FC,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { Helmet } from 'react-helmet';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings, getParagraphFormat } from '../../api/theme/get';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\nimport { convertIconStyle, getFontSize, getHeadlineColorSelector } from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The colors of the components\n */\n colors?: Theme;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The general format settings.\n */\n paragraphFormat?: ParagraphFormat[];\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n /**\n * The theme for the components\n */\n theme?: Theme;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings: DesignSettings;\n paragraphFormat: ParagraphFormat[];\n colors: Theme;\n theme: Theme;\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n siteId,\n style = {},\n paragraphFormat,\n designSettings,\n theme,\n colors,\n}) => {\n const [internalColors, setInternalColors] = useState<Theme>({});\n const [internalTheme, setInternalTheme] = useState<Theme>({});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n const [internalParagraphFormat, setInternalParagraphFormat] = useState<ParagraphFormat[]>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n } else {\n void getDesignSettings(siteId).then((result) => {\n setInternalDesignSettings(result);\n });\n }\n\n if (paragraphFormat) {\n setInternalParagraphFormat(paragraphFormat);\n } else {\n void getParagraphFormat(siteId).then((result) => {\n setInternalParagraphFormat(result);\n });\n }\n }, [designSettings, paragraphFormat, siteId]);\n\n useEffect(() => {\n let newColors: Theme = {};\n let newTheme: Theme = {};\n\n const availableColors = getAvailableColorList();\n\n if (!colors || !theme) {\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n if (!theme) {\n newTheme[colorName] = hexColor;\n }\n\n if (!colors) {\n newColors[`--chayns-color--${colorName}`] = hexColor;\n }\n\n if (rgbColor) {\n if (!theme) {\n newTheme[`${colorName}-rgb`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n\n if (!colors) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n }\n });\n }\n\n if (colors) {\n newColors = colors;\n }\n\n if (!theme) {\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n if (internalParagraphFormat) {\n const { colorResult, themeResult } =\n getHeadlineColorSelector(internalParagraphFormat);\n\n // Update chayns-colors\n Object.keys(colorResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newColors[key] = colorResult[key];\n });\n\n // Update Theme\n Object.keys(themeResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = themeResult[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n } else {\n newTheme = theme;\n }\n\n setInternalTheme(newTheme);\n setInternalColors(newColors);\n }, [\n color,\n colorMode,\n colors,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n internalParagraphFormat,\n secondaryColor,\n theme,\n ]);\n\n const contextValue: ColorSchemeContextProps | undefined = useMemo(() => {\n if (internalDesignSettings && internalParagraphFormat) {\n return {\n paragraphFormat: internalParagraphFormat,\n designSettings: internalDesignSettings,\n colors: internalColors,\n theme: internalTheme,\n };\n }\n\n return undefined;\n }, [internalColors, internalDesignSettings, internalParagraphFormat, internalTheme]);\n\n return (\n <ThemeProvider theme={internalTheme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <Helmet>\n <link\n rel=\"stylesheet\"\n href=\"https://api.chayns-static.space/font/NotoColorEmoji/v1/font.css\"\n />\n </Helmet>\n <div\n className=\"color-scheme-provider\"\n style={{\n ...internalColors,\n ...cssVariables,\n ...style,\n color: 'var(--chayns-color--text)',\n }}\n >\n {children}\n </div>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":"AAAA,SAASA,qBAAqB,EAAEC,mBAAmB,EAAEC,WAAW,QAAQ,gBAAgB;AACxF,SAASC,OAAO,QAAQ,YAAY;AACpC,OAAOC,KAAK,IACRC,aAAa,EAGbC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACpE,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,qBAAqB;AAE3E,SAASC,gBAAgB,EAAEC,WAAW,EAAEC,wBAAwB,QAAQ,kBAAkB;AAAC,IAEtFC,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,EAATA,SAAS,SA6Dd;AAGA,MAAMC,WAAW,GAAGR,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA,CAAC;AASD,OAAO,MAAMS,kBAAkB,gBAAGf,aAAa,CAAsCgB,SAAS,CAAC;AAE/F,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAMhB,UAAU,CAACc,kBAAkB,CAAC;AAElE,MAAMG,mBAAi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EACTQ,MAAM,EACNS,aAAa,EACbC,iBAAiB,EACjBL,sBAAsB,EACtBE,uBAAuB,EACvBb,cAAc,EACdK,KAAK,CACR,CAAC;EAEF,MAAMiC,YAAiD,GAAG3D,OAAO,CAAC,MAAM;IACpE,IAAIgC,sBAAsB,IAAIE,uBAAuB,EAAE;MACnD,OAAO;QACHV,eAAe,EAAEU,uBAAuB;QACxCT,cAAc,EAAEO,sBAAsB;QACtCL,MAAM,EAAEC,cAAc;QACtBF,KAAK,EAAEI;MACX,CAAC;IACL;IAEA,OAAOjB,SAAS;EACpB,CAAC,EAAE,CAACe,cAAc,EAAEI,sBAAsB,EAAEE,uBAAuB,EAAEJ,aAAa,CAAC,CAAC;EAEpF,oBACIlC,KAAA,CAAAgE,aAAA,CAACxD,aAAa;IAACsB,KAAK,EAAEI;EAAc,gBAChClC,KAAA,CAAAgE,aAAA,CAAChD,kBAAkB,CAACiD,QAAQ;IAACC,KAAK,EAAEH;EAAa,gBAC7C/D,KAAA,CAAAgE,aAAA,CAAC1D,MAAM,qBACHN,KAAA,CAAAgE,aAAA;IACIG,GAAG,EAAC,YAAY;IAChBC,IAAI,EAAC;EAAiE,CACzE,CACG,CAAC,eACTpE,KAAA,CAAAgE,aAAA;IACIK,SAAS,EAAC,uBAAuB;IACjC1C,KAAK,EAAE;MACH,GAAGK,cAAc;MACjB,GAAGR,YAAY;MACf,GAAGG,KAAK;MACRL,KAAK,EAAE;IACX;EAAE,GAEDD,QACA,CAAC,eACNrB,KAAA,CAAAgE,aAAA,CAACjD,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDI,mBAAmB,CAACmD,WAAW,GAAG,qBAAqB;AAEvD,eAAenD,mBAAmB","ignoreList":[]}
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","ComboBox","ContentCard","ContextMenu","ExpandableContent","FileInput","FilterButton","FilterButtons","GridImage","Icon","Input","List","ListItemContent","ListItem","MentionFinder","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingBar","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ComboBoxDirection","ContentCardType","ContextMenuAlignment","FilterButtonItemShape","FilterButtonSize","ClampPosition","getIsTouch","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile","useColorScheme"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu, type ContextMenuRef } from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport { useColorScheme } from './components/color-scheme-provider/ColorSchemeProvider';\n"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,SAAS,QAAQ,kCAAkC;AACvE,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,2DAA2D;AACvG,SAASF,OAAO,IAAIG,cAAc,QAAQ,uDAAuD;AACjG,SAASH,OAAO,IAAII,cAAc,QAAQ,uDAAuD;AACjG,SAASJ,OAAO,IAAIK,aAAa,QAAQ,qDAAqD;AAC9F,SAASL,OAAO,IAAIM,aAAa,QAAQ,2CAA2C;AACpF,SACIC,WAAW,EACXP,OAAO,IAAIQ,YAAY,QACpB,gDAAgD;AACvD,SAASR,OAAO,IAAIS,KAAK,QAAQ,0BAA0B;AAC3D,SAAST,OAAO,IAAIU,MAAM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3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","ComboBox","ContentCard","ContextMenu","ExpandableContent","FileInput","FilterButton","FilterButtons","GridImage","Icon","Input","List","ListItemContent","ListItem","MentionFinder","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingBar","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ComboBoxDirection","ContentCardType","ContextMenuAlignment","FilterButtonItemShape","FilterButtonSize","ClampPosition","getIsTouch","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile","useColorScheme"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu, type ContextMenuRef } from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport { useColorScheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { ColorSchemeContextProps } from './components/color-scheme-provider/ColorSchemeProvider';\n"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,SAAS,QAAQ,kCAAkC;AACvE,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,2DAA2D;AACvG,SAASF,OAAO,IAAIG,cAAc,QAAQ,uDAAuD;AACjG,SAASH,OAAO,IAAII,cAAc,QAAQ,uDAAuD;AACjG,SAASJ,OAAO,IAAIK,aAAa,QAAQ,qDAAqD;AAC9F,SAASL,OAAO,IAAIM,aAAa,QAA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e,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,cAAc,QAAQ,wDAAwD","ignoreList":[]}
|
|
@@ -14,6 +14,10 @@ export type ColorSchemeProviderProps = {
|
|
|
14
14
|
* The hex color to be used for the children
|
|
15
15
|
*/
|
|
16
16
|
color?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The colors of the components
|
|
19
|
+
*/
|
|
20
|
+
colors?: Theme;
|
|
17
21
|
/**
|
|
18
22
|
* The color mode to be used for the children
|
|
19
23
|
*/
|
|
@@ -46,6 +50,10 @@ export type ColorSchemeProviderProps = {
|
|
|
46
50
|
style?: {
|
|
47
51
|
[key: string]: string | number;
|
|
48
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* The theme for the components
|
|
55
|
+
*/
|
|
56
|
+
theme?: Theme;
|
|
49
57
|
};
|
|
50
58
|
export interface Theme {
|
|
51
59
|
[key: string]: string;
|
|
@@ -54,9 +62,11 @@ export type WithTheme<T> = T & {
|
|
|
54
62
|
theme: Theme;
|
|
55
63
|
};
|
|
56
64
|
export type FramerMotionBugFix = WithTheme<unknown>;
|
|
57
|
-
interface ColorSchemeContextProps {
|
|
65
|
+
export interface ColorSchemeContextProps {
|
|
58
66
|
designSettings: DesignSettings;
|
|
59
67
|
paragraphFormat: ParagraphFormat[];
|
|
68
|
+
colors: Theme;
|
|
69
|
+
theme: Theme;
|
|
60
70
|
}
|
|
61
71
|
export declare const ColorSchemeContext: React.Context<ColorSchemeContextProps | undefined>;
|
|
62
72
|
export declare const useColorScheme: () => ColorSchemeContextProps | undefined;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -71,3 +71,4 @@ export { isTobitEmployee } from './utils/isTobitEmployee';
|
|
|
71
71
|
export { getUsableHeight } from './utils/pageProvider';
|
|
72
72
|
export { uploadFile } from './utils/uploadFile';
|
|
73
73
|
export { useColorScheme } from './components/color-scheme-provider/ColorSchemeProvider';
|
|
74
|
+
export type { ColorSchemeContextProps } from './components/color-scheme-provider/ColorSchemeProvider';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.876",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "d670dd7cc1886179f756bf8f73d12d8ae0320ff8"
|
|
91
91
|
}
|