@particle-network/ui-react 0.5.1-beta.4 → 0.5.1-beta.5

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.
Files changed (32) hide show
  1. package/dist/components/ProgressWrapper/index.d.ts +2 -2
  2. package/dist/components/UXChip/chip.extend.d.ts +2 -1
  3. package/dist/components/UXChip/index.d.ts +1 -1
  4. package/dist/components/UXColorPicker/color-picker.js +1 -1
  5. package/dist/components/UXColorPicker/types.d.ts +1 -1
  6. package/dist/components/UXThemeSwitch/constants.d.ts +9 -0
  7. package/dist/components/UXThemeSwitch/constants.js +3 -0
  8. package/dist/components/UXThemeSwitch/custom-theme-config.js +52 -15
  9. package/dist/components/UXThemeSwitch/theme-item.js +47 -11
  10. package/dist/components/UXThemeSwitch/theme-switch.js +6 -5
  11. package/dist/components/UXThemeSwitch/use-theme-color.d.ts +1 -22
  12. package/dist/components/UXThemeSwitch/use-theme-color.js +1 -9
  13. package/dist/components/UXThemeSwitch/use-theme-store.d.ts +5 -0
  14. package/dist/components/UXThemeSwitch/use-theme-store.js +9 -4
  15. package/dist/components/UXThemeSwitch/use-theme.d.ts +2 -0
  16. package/dist/components/UXThemeSwitch/use-theme.js +5 -76
  17. package/dist/components/UXThemeSwitch/utils.d.ts +28 -0
  18. package/dist/components/UXThemeSwitch/utils.js +202 -0
  19. package/dist/components/typography/Text.type.d.ts +2 -2
  20. package/dist/components/typography/Text.type.js +0 -1
  21. package/dist/heroui/constants.d.ts +18 -0
  22. package/dist/heroui/constants.js +98 -0
  23. package/dist/heroui/types.d.ts +91 -0
  24. package/dist/heroui/types.js +0 -0
  25. package/dist/heroui/utils/colors.d.ts +34 -0
  26. package/dist/heroui/utils/colors.js +121 -0
  27. package/dist/heroui/utils/object.d.ts +1 -0
  28. package/dist/heroui/utils/object.js +17 -0
  29. package/dist/hooks/useI18n.d.ts +54 -38
  30. package/dist/hooks/useI18n.js +54 -38
  31. package/package.json +4 -3
  32. package/tailwind-preset.js +22 -69
@@ -0,0 +1,202 @@
1
+ import { hexColorToHSLValue, themeKeys } from "@particle-network/ui-shared";
2
+ import { readableColor } from "color2k";
3
+ import { generateThemeColor } from "../../heroui/utils/colors.js";
4
+ import { DEFAULT_FONT_FAMILY, PRELOAD_FONTS_URL } from "./constants.js";
5
+ const getCSSProperties = (theme)=>{
6
+ const { colorVariables } = theme;
7
+ return {
8
+ foreground: [
9
+ [
10
+ '--heroui-foreground',
11
+ colorVariables.foreground
12
+ ]
13
+ ],
14
+ secondary: [
15
+ ...generateThemeColor(colorVariables.secondary, 'secondary', theme.colorScheme).cssVariables,
16
+ [
17
+ '--heroui-foreground-300',
18
+ colorVariables.secondary
19
+ ]
20
+ ],
21
+ tertiary: [
22
+ [
23
+ '--heroui-tertiary',
24
+ colorVariables.tertiary
25
+ ],
26
+ [
27
+ '--heroui-foreground-100',
28
+ colorVariables.tertiary
29
+ ],
30
+ [
31
+ '--heroui-tertiary-foreground',
32
+ readableColor(colorVariables.tertiary)
33
+ ]
34
+ ],
35
+ primary: generateThemeColor(colorVariables.primary, 'primary', theme.colorScheme).cssVariables,
36
+ success: generateThemeColor(colorVariables.success, 'success', theme.colorScheme).cssVariables,
37
+ danger: generateThemeColor(colorVariables.danger, 'danger', theme.colorScheme).cssVariables,
38
+ alert: [
39
+ [
40
+ '--heroui-alert',
41
+ colorVariables.alert
42
+ ],
43
+ [
44
+ '--heroui-alert-foreground',
45
+ readableColor(colorVariables.alert)
46
+ ]
47
+ ],
48
+ warning: generateThemeColor(colorVariables.warning, 'warning', theme.colorScheme).cssVariables,
49
+ 'bg-default': [
50
+ [
51
+ '--heroui-background',
52
+ colorVariables['bg-default']
53
+ ],
54
+ [
55
+ '--heroui-background-500',
56
+ colorVariables['bg-default']
57
+ ]
58
+ ],
59
+ 'bg-200': [
60
+ [
61
+ '--heroui-background-200',
62
+ colorVariables['bg-200']
63
+ ]
64
+ ],
65
+ 'bg-300': [
66
+ [
67
+ '--heroui-background-300',
68
+ colorVariables['bg-300']
69
+ ]
70
+ ],
71
+ 'bg-400': [
72
+ [
73
+ '--heroui-background-400',
74
+ colorVariables['bg-400']
75
+ ]
76
+ ],
77
+ overlay: [
78
+ [
79
+ '--heroui-overlay',
80
+ colorVariables.overlay
81
+ ],
82
+ [
83
+ '--heroui-content1',
84
+ colorVariables.overlay
85
+ ],
86
+ [
87
+ '--heroui-overlay-foreground',
88
+ readableColor(colorVariables.overlay)
89
+ ],
90
+ [
91
+ '--heroui-content1-foreground',
92
+ readableColor(colorVariables.overlay)
93
+ ]
94
+ ],
95
+ divider: [
96
+ [
97
+ '--heroui-divider',
98
+ colorVariables.divider
99
+ ],
100
+ [
101
+ '--heroui-divider-foreground',
102
+ readableColor(colorVariables.divider)
103
+ ]
104
+ ],
105
+ bullish: [
106
+ [
107
+ '--heroui-bullish',
108
+ colorVariables.bullish
109
+ ],
110
+ [
111
+ '--heroui-bullish-foreground',
112
+ readableColor(colorVariables.bullish)
113
+ ]
114
+ ],
115
+ bearish: [
116
+ [
117
+ '--heroui-bearish',
118
+ colorVariables.bearish
119
+ ],
120
+ [
121
+ '--heroui-bearish-foreground',
122
+ readableColor(colorVariables.bearish)
123
+ ]
124
+ ]
125
+ };
126
+ };
127
+ const preloadFonts = ()=>{
128
+ if ('undefined' == typeof window) return;
129
+ const existingLink = document.getElementById('ux-preload-fonts-link');
130
+ if (existingLink) return;
131
+ const linkElement = document.createElement('link');
132
+ linkElement.id = 'ux-preload-fonts-link';
133
+ linkElement.rel = 'stylesheet';
134
+ linkElement.href = PRELOAD_FONTS_URL;
135
+ document.head.appendChild(linkElement);
136
+ };
137
+ const setCSSProperty = (property, value)=>{
138
+ if ('undefined' == typeof window) return;
139
+ const root = document.documentElement;
140
+ root.style.setProperty(property, hexColorToHSLValue(value));
141
+ };
142
+ const applyCustomThemeColors = (theme)=>{
143
+ if ('undefined' == typeof window) return;
144
+ const cssProperties = getCSSProperties(theme);
145
+ Object.entries(cssProperties).forEach(([, value])=>{
146
+ value.forEach(([variable, value])=>{
147
+ setCSSProperty(variable, value);
148
+ });
149
+ });
150
+ };
151
+ const clearCustomThemeColors = ()=>{
152
+ if ('undefined' == typeof window) return;
153
+ const rootStyles = getComputedStyle(document.documentElement);
154
+ Array.from(rootStyles).filter((prop)=>prop.startsWith('--heroui')).forEach((prop)=>{
155
+ document.documentElement.style.removeProperty(prop);
156
+ });
157
+ };
158
+ const applyTheme = (theme)=>{
159
+ if ('undefined' == typeof window) return;
160
+ const root = document.documentElement;
161
+ const isClassListCorrect = root.classList.contains(theme.id);
162
+ const isDataThemeCorrect = root.getAttribute('data-theme') === theme.colorScheme;
163
+ const isDataPrefersColorCorrect = root.getAttribute('data-prefers-color') === theme.colorScheme;
164
+ if ('custom' === theme.id) {
165
+ clearCustomThemeColors();
166
+ applyCustomThemeColors(theme);
167
+ } else clearCustomThemeColors();
168
+ if (isClassListCorrect && isDataThemeCorrect && isDataPrefersColorCorrect && 'custom' !== theme.id) return;
169
+ if (!isDataThemeCorrect) root.setAttribute('data-theme', theme.colorScheme);
170
+ if (!isDataPrefersColorCorrect) root.setAttribute('data-prefers-color', theme.colorScheme);
171
+ root.classList.remove('dark');
172
+ root.classList.remove('light');
173
+ if (!isClassListCorrect) {
174
+ themeKeys.forEach((key)=>{
175
+ root.classList.remove(key);
176
+ });
177
+ root.classList.add('custom' === theme.id ? theme.baseThemeId : theme.id);
178
+ }
179
+ };
180
+ const extractFontFamilyFromLink = (link)=>{
181
+ if (!link) return null;
182
+ try {
183
+ const url = new URL(link);
184
+ const familyParam = url.searchParams.get('family');
185
+ if (!familyParam) return null;
186
+ const firstFamily = familyParam.split('&family=')[0].split(':')[0].replace(/\+/g, ' ');
187
+ return firstFamily;
188
+ } catch {
189
+ return null;
190
+ }
191
+ };
192
+ const applyFont = (fontName)=>{
193
+ if ('undefined' == typeof window) return;
194
+ if (fontName) {
195
+ document.documentElement.style.setProperty('--ux-font-family', `"${fontName}", ${DEFAULT_FONT_FAMILY}`);
196
+ document.body.style.fontFamily = `"${fontName}", ${DEFAULT_FONT_FAMILY}`;
197
+ } else {
198
+ document.documentElement.style.setProperty('--ux-font-family', DEFAULT_FONT_FAMILY);
199
+ document.body.style.fontFamily = DEFAULT_FONT_FAMILY;
200
+ }
201
+ };
202
+ export { applyCustomThemeColors, applyFont, applyTheme, clearCustomThemeColors, extractFontFamilyFromLink, preloadFonts, setCSSProperty };
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { UXForegroundColor } from '@particle-network/ui-shared';
2
+ import type { HexColor, UXForegroundColor } from '@particle-network/ui-shared';
3
3
  type TextVariant = 'h1' | 'h2' | 'h3' | 'body1' | 'body1Bold' | 'body2' | 'body2Bold' | 'body3' | 'body3Bold' | 'caption1' | 'caption1Bold';
4
4
  type TextWeight = 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
5
5
  type TextLineHeight = '1' | '1.4';
@@ -75,7 +75,7 @@ export interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {
75
75
  * | extrabold | 800 |
76
76
  */
77
77
  fontWeight?: TextWeight;
78
- color?: UXForegroundColor | `#${string}`;
78
+ color?: UXForegroundColor | HexColor;
79
79
  lineHeight?: TextLineHeight;
80
80
  align?: TextAlign;
81
81
  }
@@ -23,7 +23,6 @@ const textClasses = {
23
23
  danger: 'text-danger',
24
24
  alert: 'text-alert',
25
25
  warning: 'text-warning',
26
- gold: 'text-gold',
27
26
  bullish: 'text-bullish',
28
27
  bearish: 'text-bearish'
29
28
  },
@@ -0,0 +1,18 @@
1
+ import type { Config, ConfigColors, ConfigLayout } from './types';
2
+ export declare const defaultDarkColorWeight = 20;
3
+ export declare const defaultLightColorWeight = 17.5;
4
+ export declare const colorWeight = 17.5;
5
+ export declare const floatNumberPattern: RegExp;
6
+ export declare const colorsId = "th-colors";
7
+ export declare const defaultColorsId = "th-default-colors";
8
+ export declare const baseColorsId = "th-base-colors";
9
+ export declare const otherColorsId = "th-other-colors";
10
+ export declare const showcaseId = "th-showcase";
11
+ export declare const contentShowcaseId = "th-content-showcase";
12
+ export declare const contentColorsId = "th-content-colors";
13
+ export declare const configKey = "config";
14
+ export declare const syncThemesKey = "sync-themes";
15
+ export declare const initialLightTheme: ConfigColors;
16
+ export declare const initialDarkTheme: ConfigColors;
17
+ export declare const initialLayout: ConfigLayout;
18
+ export declare const initialConfig: Config;
@@ -0,0 +1,98 @@
1
+ import { colors } from "@heroui/theme";
2
+ const defaultDarkColorWeight = 20;
3
+ const defaultLightColorWeight = 17.5;
4
+ const colorWeight = 17.5;
5
+ const floatNumberPattern = /^\d+(\.\d*)?$/;
6
+ const colorsId = 'th-colors';
7
+ const defaultColorsId = 'th-default-colors';
8
+ const baseColorsId = 'th-base-colors';
9
+ const otherColorsId = 'th-other-colors';
10
+ const showcaseId = 'th-showcase';
11
+ const contentShowcaseId = 'th-content-showcase';
12
+ const contentColorsId = 'th-content-colors';
13
+ const configKey = 'config';
14
+ const syncThemesKey = 'sync-themes';
15
+ const initialLightTheme = {
16
+ defaultColor: {
17
+ default: '#d4d4d8'
18
+ },
19
+ baseColor: {
20
+ primary: colors.blue["500"],
21
+ secondary: colors.purple["500"],
22
+ success: colors.green["500"],
23
+ warning: colors.yellow["500"],
24
+ danger: colors.red["500"]
25
+ },
26
+ layoutColor: {
27
+ foreground: colors.black,
28
+ background: colors.white,
29
+ focus: colors.blue["500"],
30
+ overlay: colors.white
31
+ },
32
+ contentColor: {
33
+ content1: colors.white,
34
+ content2: colors.zinc["100"],
35
+ content3: colors.zinc["200"],
36
+ content4: colors.zinc["300"]
37
+ }
38
+ };
39
+ const initialDarkTheme = {
40
+ defaultColor: {
41
+ default: colors.zinc["700"]
42
+ },
43
+ baseColor: {
44
+ primary: colors.blue["500"],
45
+ secondary: colors.purple["500"],
46
+ success: colors.green["500"],
47
+ warning: colors.yellow["500"],
48
+ danger: colors.red["500"]
49
+ },
50
+ layoutColor: {
51
+ foreground: colors.white,
52
+ background: colors.black,
53
+ focus: colors.blue["500"],
54
+ overlay: colors.black
55
+ },
56
+ contentColor: {
57
+ content1: colors.zinc["900"],
58
+ content2: colors.zinc["800"],
59
+ content3: colors.zinc["700"],
60
+ content4: colors.zinc["600"]
61
+ }
62
+ };
63
+ const initialLayout = {
64
+ fontSize: {
65
+ tiny: '0.75',
66
+ small: '0.875',
67
+ medium: '1',
68
+ large: '1.125'
69
+ },
70
+ lineHeight: {
71
+ tiny: '1',
72
+ small: '1.25',
73
+ medium: '1.5',
74
+ large: '1.75'
75
+ },
76
+ radius: {
77
+ small: '0.5',
78
+ medium: '0.75',
79
+ large: '0.875'
80
+ },
81
+ borderWidth: {
82
+ small: '1',
83
+ medium: '2',
84
+ large: '3'
85
+ },
86
+ otherParams: {
87
+ disabledOpacity: '0.5',
88
+ dividerWeight: '1',
89
+ hoverOpacity: '0.9'
90
+ }
91
+ };
92
+ const initialConfig = {
93
+ name: 'heroui',
94
+ light: initialLightTheme,
95
+ dark: initialDarkTheme,
96
+ layout: initialLayout
97
+ };
98
+ export { baseColorsId, colorWeight, colorsId, configKey, contentColorsId, contentShowcaseId, defaultColorsId, defaultDarkColorWeight, defaultLightColorWeight, floatNumberPattern, initialConfig, initialDarkTheme, initialLayout, initialLightTheme, otherColorsId, showcaseId, syncThemesKey };
@@ -0,0 +1,91 @@
1
+ export interface ColorShades {
2
+ 50: string;
3
+ 100: string;
4
+ 200: string;
5
+ 300: string;
6
+ 400: string;
7
+ 500: string;
8
+ 600: string;
9
+ 700: string;
10
+ 800: string;
11
+ 900: string;
12
+ }
13
+ export type ColorPickerType = 'background' | 'content1' | 'content2' | 'content3' | 'content4' | 'danger' | 'default' | 'divider' | 'focus' | 'foreground' | 'overlay' | 'primary' | 'secondary' | 'success' | 'warning';
14
+ export type Color = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
15
+ export type Size = 'sm' | 'md' | 'lg';
16
+ export type Variant = 'dot' | 'solid' | 'faded' | 'bordered' | 'light' | 'flat' | 'ghost' | 'shadow' | 'underlined';
17
+ export type Radius = 'none' | 'sm' | 'md' | 'lg' | 'full';
18
+ export type HeroUIScaling = 90 | 95 | 100 | 105 | 110;
19
+ export type Border = 'thin' | 'medium' | 'thick';
20
+ export type FontName = 'Inter' | 'Roboto' | 'Outfit' | 'Lora';
21
+ export type ThemeType = 'light' | 'dark';
22
+ export interface ThemeColor extends ColorShades {
23
+ foreground: string;
24
+ DEFAULT: string;
25
+ }
26
+ export interface Config {
27
+ name: TemplateType;
28
+ light: ConfigColors;
29
+ dark: ConfigColors;
30
+ layout: ConfigLayout;
31
+ }
32
+ export interface ConfigColors {
33
+ defaultColor: {
34
+ default: string;
35
+ };
36
+ baseColor: {
37
+ primary: string;
38
+ secondary: string;
39
+ success: string;
40
+ warning: string;
41
+ danger: string;
42
+ };
43
+ layoutColor: {
44
+ foreground: string;
45
+ background: string;
46
+ focus: string;
47
+ overlay: string;
48
+ };
49
+ contentColor: {
50
+ content1: string;
51
+ content2: string;
52
+ content3: string;
53
+ content4: string;
54
+ };
55
+ }
56
+ export interface ConfigLayout {
57
+ fontSize: {
58
+ tiny: string;
59
+ small: string;
60
+ medium: string;
61
+ large: string;
62
+ };
63
+ lineHeight: {
64
+ tiny: string;
65
+ small: string;
66
+ medium: string;
67
+ large: string;
68
+ };
69
+ radius: {
70
+ small: string;
71
+ medium: string;
72
+ large: string;
73
+ };
74
+ borderWidth: {
75
+ small: string;
76
+ medium: string;
77
+ large: string;
78
+ };
79
+ otherParams: {
80
+ disabledOpacity: string;
81
+ dividerWeight: string;
82
+ hoverOpacity: string;
83
+ };
84
+ }
85
+ export interface Template {
86
+ label: string;
87
+ name: TemplateType;
88
+ value: Config;
89
+ }
90
+ export type TemplateType = 'coffee' | 'emerald' | 'heroui' | 'elegant' | 'modern' | 'retro';
91
+ export type FontType = 'Inter' | 'Roboto' | 'Outfit' | 'Lora';
File without changes
@@ -0,0 +1,34 @@
1
+ import type { ColorPickerType, ThemeType } from '../types';
2
+ import Values from 'values.js';
3
+ /**
4
+ * Convert color values to RGB
5
+ */
6
+ export declare function colorValuesToRgb(value: Values): string;
7
+ /**
8
+ * Convert hex color to HSL
9
+ */
10
+ export declare function hexToHsl(hex: string): string;
11
+ /**
12
+ * Get the color weight
13
+ */
14
+ export declare function getColorWeight(colorType: ColorPickerType, theme: ThemeType): 20 | 17.5;
15
+ /**
16
+ * Generate theme color
17
+ */
18
+ export declare function generateThemeColor(color: string, type: ColorPickerType, theme: ThemeType): {
19
+ twTheme: {
20
+ foreground: string;
21
+ DEFAULT: string;
22
+ 50: string;
23
+ 100: string;
24
+ 200: string;
25
+ 300: string;
26
+ 400: string;
27
+ 500: string;
28
+ 600: string;
29
+ 700: string;
30
+ 800: string;
31
+ 900: string;
32
+ };
33
+ cssVariables: string[][];
34
+ };
@@ -0,0 +1,121 @@
1
+ import { readableColor } from "color2k";
2
+ import { colorWeight as external_constants_js_colorWeight, defaultDarkColorWeight, defaultLightColorWeight } from "../constants.js";
3
+ import { swapColorValues } from "./object.js";
4
+ import values_0 from "values.js";
5
+ function colorValuesToRgb(value) {
6
+ return `rgba(${value.rgb.join(', ')}, ${value.alpha})`;
7
+ }
8
+ function hexToRgb(hex) {
9
+ let r = 0, g = 0, b = 0;
10
+ if (4 === hex.length || 5 === hex.length) {
11
+ r = parseInt(hex[1] + hex[1], 16);
12
+ g = parseInt(hex[2] + hex[2], 16);
13
+ b = parseInt(hex[3] + hex[3], 16);
14
+ } else if (7 === hex.length || 9 === hex.length) {
15
+ r = parseInt(hex.slice(1, 3), 16);
16
+ g = parseInt(hex.slice(3, 5), 16);
17
+ b = parseInt(hex.slice(5, 7), 16);
18
+ } else throw new Error('Invalid hex color format');
19
+ return [
20
+ r,
21
+ g,
22
+ b
23
+ ];
24
+ }
25
+ function hexToHsl(hex) {
26
+ const [r, g, b] = hexToRgb(hex);
27
+ const normalizedR = r / 255;
28
+ const normalizedG = g / 255;
29
+ const normalizedB = b / 255;
30
+ const max = Math.max(normalizedR, normalizedG, normalizedB);
31
+ const min = Math.min(normalizedR, normalizedG, normalizedB);
32
+ const lightness = (max + min) / 2;
33
+ if (max === min) return `0 0% ${100 * lightness}%`;
34
+ let saturation = 0;
35
+ saturation = lightness < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min);
36
+ let hue;
37
+ hue = max === normalizedR ? (normalizedG - normalizedB) / (max - min) : max === normalizedG ? 2 + (normalizedB - normalizedR) / (max - min) : 4 + (normalizedR - normalizedG) / (max - min);
38
+ hue *= 60;
39
+ if (hue < 0) hue += 360;
40
+ return `${hue.toFixed(2)} ${(100 * saturation).toFixed(2)}% ${(100 * lightness).toFixed(2)}%`;
41
+ }
42
+ function getColorWeight(colorType, theme) {
43
+ if ('default' === colorType) return 'dark' === theme ? defaultDarkColorWeight : defaultLightColorWeight;
44
+ return external_constants_js_colorWeight;
45
+ }
46
+ function rgbValueToHex(c) {
47
+ const hex = c.toString(16);
48
+ return 1 === hex.length ? `0${hex}` : hex;
49
+ }
50
+ function rgbToHex([r, g, b]) {
51
+ return `#${rgbValueToHex(r)}${rgbValueToHex(g)}${rgbValueToHex(b)}`;
52
+ }
53
+ function generateThemeColor(color, type, theme) {
54
+ const values = new values_0(color);
55
+ const colorWeight = getColorWeight(type, theme);
56
+ const colorValues = values.all(colorWeight);
57
+ const shades = colorValues.slice(0, colorValues.length - 1).reduce((acc, shadeValue, index)=>{
58
+ acc[0 === index ? 50 : 100 * index] = rgbToHex(shadeValue.rgb);
59
+ return acc;
60
+ }, {});
61
+ const twTheme = {
62
+ ...'light' === theme ? shades : swapColorValues(shades),
63
+ foreground: readableColor(shades[500]),
64
+ DEFAULT: shades[500]
65
+ };
66
+ const cssVariables = [
67
+ [
68
+ `--heroui-${type}-50`,
69
+ twTheme[50]
70
+ ],
71
+ [
72
+ `--heroui-${type}-100`,
73
+ twTheme[100]
74
+ ],
75
+ [
76
+ `--heroui-${type}-200`,
77
+ twTheme[200]
78
+ ],
79
+ [
80
+ `--heroui-${type}-300`,
81
+ twTheme[300]
82
+ ],
83
+ [
84
+ `--heroui-${type}-400`,
85
+ twTheme[400]
86
+ ],
87
+ [
88
+ `--heroui-${type}-500`,
89
+ twTheme[500]
90
+ ],
91
+ [
92
+ `--heroui-${type}-600`,
93
+ twTheme[600]
94
+ ],
95
+ [
96
+ `--heroui-${type}-700`,
97
+ twTheme[700]
98
+ ],
99
+ [
100
+ `--heroui-${type}-800`,
101
+ twTheme[800]
102
+ ],
103
+ [
104
+ `--heroui-${type}-900`,
105
+ twTheme[900]
106
+ ],
107
+ [
108
+ `--heroui-${type}-foreground`,
109
+ twTheme.foreground
110
+ ],
111
+ [
112
+ `--heroui-${type}`,
113
+ twTheme.DEFAULT
114
+ ]
115
+ ];
116
+ return {
117
+ twTheme,
118
+ cssVariables
119
+ };
120
+ }
121
+ export { colorValuesToRgb, generateThemeColor, getColorWeight, hexToHsl };
@@ -0,0 +1 @@
1
+ export declare function swapColorValues<T extends Object>(colors: T): {};
@@ -0,0 +1,17 @@
1
+ function swapColorValues(colors) {
2
+ const swappedColors = {};
3
+ const keys = Object.keys(colors);
4
+ const { length } = keys;
5
+ for(let i = 0; i < length / 2; i++){
6
+ const key1 = keys[i];
7
+ const key2 = keys[length - 1 - i];
8
+ swappedColors[key1] = colors[key2];
9
+ swappedColors[key2] = colors[key1];
10
+ }
11
+ if (length % 2 !== 0) {
12
+ const middleKey = keys[Math.floor(length / 2)];
13
+ swappedColors[middleKey] = colors[middleKey];
14
+ }
15
+ return swappedColors;
16
+ }
17
+ export { swapColorValues };