@titan-design/react-ui 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NA3EES23.mjs → chunk-MGW37MPO.mjs} +26 -4
- package/dist/chunk-MGW37MPO.mjs.map +1 -0
- package/dist/index.d.mts +115 -2
- package/dist/index.d.ts +115 -2
- package/dist/index.js +262 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -3
- package/dist/index.mjs.map +1 -1
- package/dist/theme/index.d.mts +124 -109
- package/dist/theme/index.d.ts +124 -109
- package/dist/theme/index.js +24 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/index.mjs +1 -1
- package/package.json +3 -1
- package/dist/chunk-NA3EES23.mjs.map +0 -1
package/dist/theme/index.d.mts
CHANGED
|
@@ -1,5 +1,128 @@
|
|
|
1
1
|
import { ViewStyle } from 'react-native';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Elevation System
|
|
5
|
+
*
|
|
6
|
+
* A unified depth system where each elevation level corresponds to:
|
|
7
|
+
* - Calculated surface color (derived from base using lighten)
|
|
8
|
+
* - Shadow intensity and style (raised/pressed)
|
|
9
|
+
* - Dynamically calculated shadow colors (derived from surface color)
|
|
10
|
+
* - Semantic name for reference
|
|
11
|
+
*
|
|
12
|
+
* Elevation range: -2 (deep inset) to +5 (floating overlay)
|
|
13
|
+
*
|
|
14
|
+
* Negative elevations: Inset/pressed elements (sunken into surface)
|
|
15
|
+
* Zero elevation: Base surface (background/page level)
|
|
16
|
+
* Positive elevations: Raised elements (floating above surface)
|
|
17
|
+
*
|
|
18
|
+
* All colors are calculated dynamically from a base surface color,
|
|
19
|
+
* allowing for custom surfaces and consistent color relationships.
|
|
20
|
+
*
|
|
21
|
+
* Lighting Model: Light source from upper-right corner
|
|
22
|
+
* - Raised elements are always lighter than base (consistent across themes)
|
|
23
|
+
* - Base colors must allow sufficient lightening in both themes
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
type ElevationLevel = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5;
|
|
27
|
+
interface ElevationConfig {
|
|
28
|
+
/** Semantic name for this elevation level */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Amount to lighten base color (0-1) */
|
|
31
|
+
colorAdjustment: number;
|
|
32
|
+
/** Shadow intensity */
|
|
33
|
+
shadowIntensity: 'subtle' | 'medium' | 'strong';
|
|
34
|
+
/** Shadow style: raised (floating) or pressed (inset) */
|
|
35
|
+
shadowStyle: 'raised' | 'pressed';
|
|
36
|
+
/** Description of use case */
|
|
37
|
+
description: string;
|
|
38
|
+
}
|
|
39
|
+
declare const elevationSystem: Record<ElevationLevel, ElevationConfig>;
|
|
40
|
+
/**
|
|
41
|
+
* Get elevation configuration for a given level
|
|
42
|
+
*/
|
|
43
|
+
declare function getElevationConfig(level: ElevationLevel): ElevationConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Calculate surface color for an elevation level from a base color.
|
|
46
|
+
* Results are cached to avoid redundant calculations.
|
|
47
|
+
*
|
|
48
|
+
* @param baseColor - Base surface color (hex)
|
|
49
|
+
* @param level - Elevation level
|
|
50
|
+
* @param theme - Current theme ('light' or 'dark')
|
|
51
|
+
* @returns Calculated surface color (hex)
|
|
52
|
+
*/
|
|
53
|
+
declare function getElevationSurface(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark'): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get shadow style for an elevation level, calculated dynamically from surface color.
|
|
56
|
+
* Results are cached to avoid redundant calculations.
|
|
57
|
+
*
|
|
58
|
+
* @param baseColor - Base surface color (hex)
|
|
59
|
+
* @param level - Elevation level
|
|
60
|
+
* @param theme - Current theme ('light' or 'dark')
|
|
61
|
+
* @param isHovered - Whether element is hovered
|
|
62
|
+
* @returns ViewStyle with shadow properties
|
|
63
|
+
*/
|
|
64
|
+
declare function getElevationShadow(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark', isHovered?: boolean): ViewStyle;
|
|
65
|
+
/**
|
|
66
|
+
* Get base surface color from theme.
|
|
67
|
+
* This is the foundation color that all elevations are calculated from.
|
|
68
|
+
*
|
|
69
|
+
* IMPORTANT: Base colors must be chosen to allow sufficient lightening.
|
|
70
|
+
*
|
|
71
|
+
* **Light Mode**: Cannot use `#FFFFFF` (white) - cannot lighten white!
|
|
72
|
+
* - Use `#F3F4F6` (neutral[100]) - can lighten to `#FAFAFA` → `#FFFFFF`
|
|
73
|
+
* - This allows raised elevations to be lighter (closer to white)
|
|
74
|
+
*
|
|
75
|
+
* **Dark Mode**: Need lighter base to allow sufficient lightening
|
|
76
|
+
* - Use `#191919` (charcoal[600]) - allows lightening to `#2A2A2A` at max elevation
|
|
77
|
+
*
|
|
78
|
+
* Can be overridden to use custom base colors for special cases.
|
|
79
|
+
*/
|
|
80
|
+
declare function getBaseSurfaceColor(theme: 'light' | 'dark'): string;
|
|
81
|
+
/**
|
|
82
|
+
* Component-specific elevation ranges
|
|
83
|
+
* Defines which elevation levels each component type can use
|
|
84
|
+
*/
|
|
85
|
+
declare const componentElevationRanges: {
|
|
86
|
+
readonly button: {
|
|
87
|
+
readonly allowed: readonly [2];
|
|
88
|
+
readonly default: 2;
|
|
89
|
+
readonly hover: 3;
|
|
90
|
+
};
|
|
91
|
+
readonly card: {
|
|
92
|
+
readonly allowed: readonly [1, 2, 3];
|
|
93
|
+
readonly default: 2;
|
|
94
|
+
readonly hover: 3;
|
|
95
|
+
};
|
|
96
|
+
readonly input: {
|
|
97
|
+
readonly allowed: readonly [-2, -1, 0];
|
|
98
|
+
readonly default: -1;
|
|
99
|
+
};
|
|
100
|
+
readonly overlay: {
|
|
101
|
+
readonly allowed: readonly [4, 5];
|
|
102
|
+
readonly default: 4;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
type ComponentType = keyof typeof componentElevationRanges;
|
|
106
|
+
/**
|
|
107
|
+
* Validate and clamp elevation to component's allowed range
|
|
108
|
+
*/
|
|
109
|
+
declare function getValidatedElevation(component: ComponentType, requested: ElevationLevel): ElevationLevel;
|
|
110
|
+
type GlowIntensity = 'subtle' | 'medium' | 'strong';
|
|
111
|
+
/**
|
|
112
|
+
* Get a glow shadow style for emphasis/active states.
|
|
113
|
+
*
|
|
114
|
+
* Creates a colored radial glow around an element, useful for:
|
|
115
|
+
* - Active recording indicators (orange glow)
|
|
116
|
+
* - Success states (green glow)
|
|
117
|
+
* - Error/danger indicators (red glow)
|
|
118
|
+
* - Focus rings and attention-drawing elements
|
|
119
|
+
*
|
|
120
|
+
* @param color - Glow color (hex string, e.g. '#FF7900')
|
|
121
|
+
* @param intensity - Glow intensity level
|
|
122
|
+
* @returns ViewStyle with platform-specific shadow properties
|
|
123
|
+
*/
|
|
124
|
+
declare function getGlowShadow(color: string, intensity?: GlowIntensity): ViewStyle;
|
|
125
|
+
|
|
3
126
|
/**
|
|
4
127
|
* Primitive Design Tokens
|
|
5
128
|
*
|
|
@@ -1176,112 +1299,4 @@ declare const neumorphicShadows: {
|
|
|
1176
1299
|
};
|
|
1177
1300
|
};
|
|
1178
1301
|
|
|
1179
|
-
|
|
1180
|
-
* Elevation System
|
|
1181
|
-
*
|
|
1182
|
-
* A unified depth system where each elevation level corresponds to:
|
|
1183
|
-
* - Calculated surface color (derived from base using lighten)
|
|
1184
|
-
* - Shadow intensity and style (raised/pressed)
|
|
1185
|
-
* - Dynamically calculated shadow colors (derived from surface color)
|
|
1186
|
-
* - Semantic name for reference
|
|
1187
|
-
*
|
|
1188
|
-
* Elevation range: -2 (deep inset) to +5 (floating overlay)
|
|
1189
|
-
*
|
|
1190
|
-
* Negative elevations: Inset/pressed elements (sunken into surface)
|
|
1191
|
-
* Zero elevation: Base surface (background/page level)
|
|
1192
|
-
* Positive elevations: Raised elements (floating above surface)
|
|
1193
|
-
*
|
|
1194
|
-
* All colors are calculated dynamically from a base surface color,
|
|
1195
|
-
* allowing for custom surfaces and consistent color relationships.
|
|
1196
|
-
*
|
|
1197
|
-
* Lighting Model: Light source from upper-right corner
|
|
1198
|
-
* - Raised elements are always lighter than base (consistent across themes)
|
|
1199
|
-
* - Base colors must allow sufficient lightening in both themes
|
|
1200
|
-
*/
|
|
1201
|
-
|
|
1202
|
-
type ElevationLevel = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5;
|
|
1203
|
-
interface ElevationConfig {
|
|
1204
|
-
/** Semantic name for this elevation level */
|
|
1205
|
-
name: string;
|
|
1206
|
-
/** Amount to lighten base color (0-1) */
|
|
1207
|
-
colorAdjustment: number;
|
|
1208
|
-
/** Shadow intensity */
|
|
1209
|
-
shadowIntensity: 'subtle' | 'medium' | 'strong';
|
|
1210
|
-
/** Shadow style: raised (floating) or pressed (inset) */
|
|
1211
|
-
shadowStyle: 'raised' | 'pressed';
|
|
1212
|
-
/** Description of use case */
|
|
1213
|
-
description: string;
|
|
1214
|
-
}
|
|
1215
|
-
declare const elevationSystem: Record<ElevationLevel, ElevationConfig>;
|
|
1216
|
-
/**
|
|
1217
|
-
* Get elevation configuration for a given level
|
|
1218
|
-
*/
|
|
1219
|
-
declare function getElevationConfig(level: ElevationLevel): ElevationConfig;
|
|
1220
|
-
/**
|
|
1221
|
-
* Calculate surface color for an elevation level from a base color.
|
|
1222
|
-
* Results are cached to avoid redundant calculations.
|
|
1223
|
-
*
|
|
1224
|
-
* @param baseColor - Base surface color (hex)
|
|
1225
|
-
* @param level - Elevation level
|
|
1226
|
-
* @param theme - Current theme ('light' or 'dark')
|
|
1227
|
-
* @returns Calculated surface color (hex)
|
|
1228
|
-
*/
|
|
1229
|
-
declare function getElevationSurface(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark'): string;
|
|
1230
|
-
/**
|
|
1231
|
-
* Get shadow style for an elevation level, calculated dynamically from surface color.
|
|
1232
|
-
* Results are cached to avoid redundant calculations.
|
|
1233
|
-
*
|
|
1234
|
-
* @param baseColor - Base surface color (hex)
|
|
1235
|
-
* @param level - Elevation level
|
|
1236
|
-
* @param theme - Current theme ('light' or 'dark')
|
|
1237
|
-
* @param isHovered - Whether element is hovered
|
|
1238
|
-
* @returns ViewStyle with shadow properties
|
|
1239
|
-
*/
|
|
1240
|
-
declare function getElevationShadow(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark', isHovered?: boolean): ViewStyle;
|
|
1241
|
-
/**
|
|
1242
|
-
* Get base surface color from theme.
|
|
1243
|
-
* This is the foundation color that all elevations are calculated from.
|
|
1244
|
-
*
|
|
1245
|
-
* IMPORTANT: Base colors must be chosen to allow sufficient lightening.
|
|
1246
|
-
*
|
|
1247
|
-
* **Light Mode**: Cannot use `#FFFFFF` (white) - cannot lighten white!
|
|
1248
|
-
* - Use `#F3F4F6` (neutral[100]) - can lighten to `#FAFAFA` → `#FFFFFF`
|
|
1249
|
-
* - This allows raised elevations to be lighter (closer to white)
|
|
1250
|
-
*
|
|
1251
|
-
* **Dark Mode**: Need lighter base to allow sufficient lightening
|
|
1252
|
-
* - Use `#191919` (charcoal[600]) - allows lightening to `#2A2A2A` at max elevation
|
|
1253
|
-
*
|
|
1254
|
-
* Can be overridden to use custom base colors for special cases.
|
|
1255
|
-
*/
|
|
1256
|
-
declare function getBaseSurfaceColor(theme: 'light' | 'dark'): string;
|
|
1257
|
-
/**
|
|
1258
|
-
* Component-specific elevation ranges
|
|
1259
|
-
* Defines which elevation levels each component type can use
|
|
1260
|
-
*/
|
|
1261
|
-
declare const componentElevationRanges: {
|
|
1262
|
-
readonly button: {
|
|
1263
|
-
readonly allowed: readonly [2];
|
|
1264
|
-
readonly default: 2;
|
|
1265
|
-
readonly hover: 3;
|
|
1266
|
-
};
|
|
1267
|
-
readonly card: {
|
|
1268
|
-
readonly allowed: readonly [1, 2, 3];
|
|
1269
|
-
readonly default: 2;
|
|
1270
|
-
readonly hover: 3;
|
|
1271
|
-
};
|
|
1272
|
-
readonly input: {
|
|
1273
|
-
readonly allowed: readonly [-2, -1, 0];
|
|
1274
|
-
readonly default: -1;
|
|
1275
|
-
};
|
|
1276
|
-
readonly overlay: {
|
|
1277
|
-
readonly allowed: readonly [4, 5];
|
|
1278
|
-
readonly default: 4;
|
|
1279
|
-
};
|
|
1280
|
-
};
|
|
1281
|
-
type ComponentType = keyof typeof componentElevationRanges;
|
|
1282
|
-
/**
|
|
1283
|
-
* Validate and clamp elevation to component's allowed range
|
|
1284
|
-
*/
|
|
1285
|
-
declare function getValidatedElevation(component: ComponentType, requested: ElevationLevel): ElevationLevel;
|
|
1286
|
-
|
|
1287
|
-
export { type ComponentType, type ElevationConfig, type ElevationLevel, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors };
|
|
1302
|
+
export { type ComponentType, type ElevationConfig, type ElevationLevel, type GlowIntensity, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors };
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,5 +1,128 @@
|
|
|
1
1
|
import { ViewStyle } from 'react-native';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Elevation System
|
|
5
|
+
*
|
|
6
|
+
* A unified depth system where each elevation level corresponds to:
|
|
7
|
+
* - Calculated surface color (derived from base using lighten)
|
|
8
|
+
* - Shadow intensity and style (raised/pressed)
|
|
9
|
+
* - Dynamically calculated shadow colors (derived from surface color)
|
|
10
|
+
* - Semantic name for reference
|
|
11
|
+
*
|
|
12
|
+
* Elevation range: -2 (deep inset) to +5 (floating overlay)
|
|
13
|
+
*
|
|
14
|
+
* Negative elevations: Inset/pressed elements (sunken into surface)
|
|
15
|
+
* Zero elevation: Base surface (background/page level)
|
|
16
|
+
* Positive elevations: Raised elements (floating above surface)
|
|
17
|
+
*
|
|
18
|
+
* All colors are calculated dynamically from a base surface color,
|
|
19
|
+
* allowing for custom surfaces and consistent color relationships.
|
|
20
|
+
*
|
|
21
|
+
* Lighting Model: Light source from upper-right corner
|
|
22
|
+
* - Raised elements are always lighter than base (consistent across themes)
|
|
23
|
+
* - Base colors must allow sufficient lightening in both themes
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
type ElevationLevel = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5;
|
|
27
|
+
interface ElevationConfig {
|
|
28
|
+
/** Semantic name for this elevation level */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Amount to lighten base color (0-1) */
|
|
31
|
+
colorAdjustment: number;
|
|
32
|
+
/** Shadow intensity */
|
|
33
|
+
shadowIntensity: 'subtle' | 'medium' | 'strong';
|
|
34
|
+
/** Shadow style: raised (floating) or pressed (inset) */
|
|
35
|
+
shadowStyle: 'raised' | 'pressed';
|
|
36
|
+
/** Description of use case */
|
|
37
|
+
description: string;
|
|
38
|
+
}
|
|
39
|
+
declare const elevationSystem: Record<ElevationLevel, ElevationConfig>;
|
|
40
|
+
/**
|
|
41
|
+
* Get elevation configuration for a given level
|
|
42
|
+
*/
|
|
43
|
+
declare function getElevationConfig(level: ElevationLevel): ElevationConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Calculate surface color for an elevation level from a base color.
|
|
46
|
+
* Results are cached to avoid redundant calculations.
|
|
47
|
+
*
|
|
48
|
+
* @param baseColor - Base surface color (hex)
|
|
49
|
+
* @param level - Elevation level
|
|
50
|
+
* @param theme - Current theme ('light' or 'dark')
|
|
51
|
+
* @returns Calculated surface color (hex)
|
|
52
|
+
*/
|
|
53
|
+
declare function getElevationSurface(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark'): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get shadow style for an elevation level, calculated dynamically from surface color.
|
|
56
|
+
* Results are cached to avoid redundant calculations.
|
|
57
|
+
*
|
|
58
|
+
* @param baseColor - Base surface color (hex)
|
|
59
|
+
* @param level - Elevation level
|
|
60
|
+
* @param theme - Current theme ('light' or 'dark')
|
|
61
|
+
* @param isHovered - Whether element is hovered
|
|
62
|
+
* @returns ViewStyle with shadow properties
|
|
63
|
+
*/
|
|
64
|
+
declare function getElevationShadow(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark', isHovered?: boolean): ViewStyle;
|
|
65
|
+
/**
|
|
66
|
+
* Get base surface color from theme.
|
|
67
|
+
* This is the foundation color that all elevations are calculated from.
|
|
68
|
+
*
|
|
69
|
+
* IMPORTANT: Base colors must be chosen to allow sufficient lightening.
|
|
70
|
+
*
|
|
71
|
+
* **Light Mode**: Cannot use `#FFFFFF` (white) - cannot lighten white!
|
|
72
|
+
* - Use `#F3F4F6` (neutral[100]) - can lighten to `#FAFAFA` → `#FFFFFF`
|
|
73
|
+
* - This allows raised elevations to be lighter (closer to white)
|
|
74
|
+
*
|
|
75
|
+
* **Dark Mode**: Need lighter base to allow sufficient lightening
|
|
76
|
+
* - Use `#191919` (charcoal[600]) - allows lightening to `#2A2A2A` at max elevation
|
|
77
|
+
*
|
|
78
|
+
* Can be overridden to use custom base colors for special cases.
|
|
79
|
+
*/
|
|
80
|
+
declare function getBaseSurfaceColor(theme: 'light' | 'dark'): string;
|
|
81
|
+
/**
|
|
82
|
+
* Component-specific elevation ranges
|
|
83
|
+
* Defines which elevation levels each component type can use
|
|
84
|
+
*/
|
|
85
|
+
declare const componentElevationRanges: {
|
|
86
|
+
readonly button: {
|
|
87
|
+
readonly allowed: readonly [2];
|
|
88
|
+
readonly default: 2;
|
|
89
|
+
readonly hover: 3;
|
|
90
|
+
};
|
|
91
|
+
readonly card: {
|
|
92
|
+
readonly allowed: readonly [1, 2, 3];
|
|
93
|
+
readonly default: 2;
|
|
94
|
+
readonly hover: 3;
|
|
95
|
+
};
|
|
96
|
+
readonly input: {
|
|
97
|
+
readonly allowed: readonly [-2, -1, 0];
|
|
98
|
+
readonly default: -1;
|
|
99
|
+
};
|
|
100
|
+
readonly overlay: {
|
|
101
|
+
readonly allowed: readonly [4, 5];
|
|
102
|
+
readonly default: 4;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
type ComponentType = keyof typeof componentElevationRanges;
|
|
106
|
+
/**
|
|
107
|
+
* Validate and clamp elevation to component's allowed range
|
|
108
|
+
*/
|
|
109
|
+
declare function getValidatedElevation(component: ComponentType, requested: ElevationLevel): ElevationLevel;
|
|
110
|
+
type GlowIntensity = 'subtle' | 'medium' | 'strong';
|
|
111
|
+
/**
|
|
112
|
+
* Get a glow shadow style for emphasis/active states.
|
|
113
|
+
*
|
|
114
|
+
* Creates a colored radial glow around an element, useful for:
|
|
115
|
+
* - Active recording indicators (orange glow)
|
|
116
|
+
* - Success states (green glow)
|
|
117
|
+
* - Error/danger indicators (red glow)
|
|
118
|
+
* - Focus rings and attention-drawing elements
|
|
119
|
+
*
|
|
120
|
+
* @param color - Glow color (hex string, e.g. '#FF7900')
|
|
121
|
+
* @param intensity - Glow intensity level
|
|
122
|
+
* @returns ViewStyle with platform-specific shadow properties
|
|
123
|
+
*/
|
|
124
|
+
declare function getGlowShadow(color: string, intensity?: GlowIntensity): ViewStyle;
|
|
125
|
+
|
|
3
126
|
/**
|
|
4
127
|
* Primitive Design Tokens
|
|
5
128
|
*
|
|
@@ -1176,112 +1299,4 @@ declare const neumorphicShadows: {
|
|
|
1176
1299
|
};
|
|
1177
1300
|
};
|
|
1178
1301
|
|
|
1179
|
-
|
|
1180
|
-
* Elevation System
|
|
1181
|
-
*
|
|
1182
|
-
* A unified depth system where each elevation level corresponds to:
|
|
1183
|
-
* - Calculated surface color (derived from base using lighten)
|
|
1184
|
-
* - Shadow intensity and style (raised/pressed)
|
|
1185
|
-
* - Dynamically calculated shadow colors (derived from surface color)
|
|
1186
|
-
* - Semantic name for reference
|
|
1187
|
-
*
|
|
1188
|
-
* Elevation range: -2 (deep inset) to +5 (floating overlay)
|
|
1189
|
-
*
|
|
1190
|
-
* Negative elevations: Inset/pressed elements (sunken into surface)
|
|
1191
|
-
* Zero elevation: Base surface (background/page level)
|
|
1192
|
-
* Positive elevations: Raised elements (floating above surface)
|
|
1193
|
-
*
|
|
1194
|
-
* All colors are calculated dynamically from a base surface color,
|
|
1195
|
-
* allowing for custom surfaces and consistent color relationships.
|
|
1196
|
-
*
|
|
1197
|
-
* Lighting Model: Light source from upper-right corner
|
|
1198
|
-
* - Raised elements are always lighter than base (consistent across themes)
|
|
1199
|
-
* - Base colors must allow sufficient lightening in both themes
|
|
1200
|
-
*/
|
|
1201
|
-
|
|
1202
|
-
type ElevationLevel = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5;
|
|
1203
|
-
interface ElevationConfig {
|
|
1204
|
-
/** Semantic name for this elevation level */
|
|
1205
|
-
name: string;
|
|
1206
|
-
/** Amount to lighten base color (0-1) */
|
|
1207
|
-
colorAdjustment: number;
|
|
1208
|
-
/** Shadow intensity */
|
|
1209
|
-
shadowIntensity: 'subtle' | 'medium' | 'strong';
|
|
1210
|
-
/** Shadow style: raised (floating) or pressed (inset) */
|
|
1211
|
-
shadowStyle: 'raised' | 'pressed';
|
|
1212
|
-
/** Description of use case */
|
|
1213
|
-
description: string;
|
|
1214
|
-
}
|
|
1215
|
-
declare const elevationSystem: Record<ElevationLevel, ElevationConfig>;
|
|
1216
|
-
/**
|
|
1217
|
-
* Get elevation configuration for a given level
|
|
1218
|
-
*/
|
|
1219
|
-
declare function getElevationConfig(level: ElevationLevel): ElevationConfig;
|
|
1220
|
-
/**
|
|
1221
|
-
* Calculate surface color for an elevation level from a base color.
|
|
1222
|
-
* Results are cached to avoid redundant calculations.
|
|
1223
|
-
*
|
|
1224
|
-
* @param baseColor - Base surface color (hex)
|
|
1225
|
-
* @param level - Elevation level
|
|
1226
|
-
* @param theme - Current theme ('light' or 'dark')
|
|
1227
|
-
* @returns Calculated surface color (hex)
|
|
1228
|
-
*/
|
|
1229
|
-
declare function getElevationSurface(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark'): string;
|
|
1230
|
-
/**
|
|
1231
|
-
* Get shadow style for an elevation level, calculated dynamically from surface color.
|
|
1232
|
-
* Results are cached to avoid redundant calculations.
|
|
1233
|
-
*
|
|
1234
|
-
* @param baseColor - Base surface color (hex)
|
|
1235
|
-
* @param level - Elevation level
|
|
1236
|
-
* @param theme - Current theme ('light' or 'dark')
|
|
1237
|
-
* @param isHovered - Whether element is hovered
|
|
1238
|
-
* @returns ViewStyle with shadow properties
|
|
1239
|
-
*/
|
|
1240
|
-
declare function getElevationShadow(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark', isHovered?: boolean): ViewStyle;
|
|
1241
|
-
/**
|
|
1242
|
-
* Get base surface color from theme.
|
|
1243
|
-
* This is the foundation color that all elevations are calculated from.
|
|
1244
|
-
*
|
|
1245
|
-
* IMPORTANT: Base colors must be chosen to allow sufficient lightening.
|
|
1246
|
-
*
|
|
1247
|
-
* **Light Mode**: Cannot use `#FFFFFF` (white) - cannot lighten white!
|
|
1248
|
-
* - Use `#F3F4F6` (neutral[100]) - can lighten to `#FAFAFA` → `#FFFFFF`
|
|
1249
|
-
* - This allows raised elevations to be lighter (closer to white)
|
|
1250
|
-
*
|
|
1251
|
-
* **Dark Mode**: Need lighter base to allow sufficient lightening
|
|
1252
|
-
* - Use `#191919` (charcoal[600]) - allows lightening to `#2A2A2A` at max elevation
|
|
1253
|
-
*
|
|
1254
|
-
* Can be overridden to use custom base colors for special cases.
|
|
1255
|
-
*/
|
|
1256
|
-
declare function getBaseSurfaceColor(theme: 'light' | 'dark'): string;
|
|
1257
|
-
/**
|
|
1258
|
-
* Component-specific elevation ranges
|
|
1259
|
-
* Defines which elevation levels each component type can use
|
|
1260
|
-
*/
|
|
1261
|
-
declare const componentElevationRanges: {
|
|
1262
|
-
readonly button: {
|
|
1263
|
-
readonly allowed: readonly [2];
|
|
1264
|
-
readonly default: 2;
|
|
1265
|
-
readonly hover: 3;
|
|
1266
|
-
};
|
|
1267
|
-
readonly card: {
|
|
1268
|
-
readonly allowed: readonly [1, 2, 3];
|
|
1269
|
-
readonly default: 2;
|
|
1270
|
-
readonly hover: 3;
|
|
1271
|
-
};
|
|
1272
|
-
readonly input: {
|
|
1273
|
-
readonly allowed: readonly [-2, -1, 0];
|
|
1274
|
-
readonly default: -1;
|
|
1275
|
-
};
|
|
1276
|
-
readonly overlay: {
|
|
1277
|
-
readonly allowed: readonly [4, 5];
|
|
1278
|
-
readonly default: 4;
|
|
1279
|
-
};
|
|
1280
|
-
};
|
|
1281
|
-
type ComponentType = keyof typeof componentElevationRanges;
|
|
1282
|
-
/**
|
|
1283
|
-
* Validate and clamp elevation to component's allowed range
|
|
1284
|
-
*/
|
|
1285
|
-
declare function getValidatedElevation(component: ComponentType, requested: ElevationLevel): ElevationLevel;
|
|
1286
|
-
|
|
1287
|
-
export { type ComponentType, type ElevationConfig, type ElevationLevel, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors };
|
|
1302
|
+
export { type ComponentType, type ElevationConfig, type ElevationLevel, type GlowIntensity, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors };
|
package/dist/theme/index.js
CHANGED
|
@@ -926,7 +926,7 @@ function hsvToRgb(h, s, v) {
|
|
|
926
926
|
const c = v * s;
|
|
927
927
|
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
928
928
|
const m = v - c;
|
|
929
|
-
let rPrime
|
|
929
|
+
let rPrime, gPrime, bPrime;
|
|
930
930
|
if (h >= 0 && h < 60) {
|
|
931
931
|
rPrime = c;
|
|
932
932
|
gPrime = x;
|
|
@@ -1477,6 +1477,28 @@ function getValidatedElevation(component, requested) {
|
|
|
1477
1477
|
(prev, curr) => Math.abs(curr - requested) < Math.abs(prev - requested) ? curr : prev
|
|
1478
1478
|
);
|
|
1479
1479
|
}
|
|
1480
|
+
var glowConfig = {
|
|
1481
|
+
subtle: { blur: 12, spread: 0, opacity: 0.25 },
|
|
1482
|
+
medium: { blur: 20, spread: 2, opacity: 0.4 },
|
|
1483
|
+
strong: { blur: 30, spread: 4, opacity: 0.55 }
|
|
1484
|
+
};
|
|
1485
|
+
function getGlowShadow(color, intensity = "medium") {
|
|
1486
|
+
const config = glowConfig[intensity];
|
|
1487
|
+
const rgb = hexToRgb(color);
|
|
1488
|
+
if (!rgb) return {};
|
|
1489
|
+
return reactNative.Platform.select({
|
|
1490
|
+
web: {
|
|
1491
|
+
boxShadow: `0 0 ${config.blur}px ${config.spread}px rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${config.opacity})`
|
|
1492
|
+
},
|
|
1493
|
+
default: {
|
|
1494
|
+
shadowColor: color,
|
|
1495
|
+
shadowOffset: { width: 0, height: 0 },
|
|
1496
|
+
shadowOpacity: config.opacity,
|
|
1497
|
+
shadowRadius: config.blur / 2,
|
|
1498
|
+
elevation: 0
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1480
1502
|
|
|
1481
1503
|
exports.buttonSizes = buttonSizes;
|
|
1482
1504
|
exports.componentElevationRanges = componentElevationRanges;
|
|
@@ -1494,6 +1516,7 @@ exports.getDiscreteRainbowColor = getDiscreteRainbowColor;
|
|
|
1494
1516
|
exports.getElevationConfig = getElevationConfig;
|
|
1495
1517
|
exports.getElevationShadow = getElevationShadow;
|
|
1496
1518
|
exports.getElevationSurface = getElevationSurface;
|
|
1519
|
+
exports.getGlowShadow = getGlowShadow;
|
|
1497
1520
|
exports.getHoverColors = getHoverColors;
|
|
1498
1521
|
exports.getSemanticColors = getSemanticColors;
|
|
1499
1522
|
exports.getThemeCSSVars = getThemeCSSVars;
|