@idealyst/theme 1.0.83 → 1.0.85

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 (68) hide show
  1. package/package.json +2 -1
  2. package/src/components/CLAUDE.md +468 -0
  3. package/src/components/accordion.ts +34 -0
  4. package/src/components/activity-indicator.ts +28 -0
  5. package/src/components/alert.ts +32 -0
  6. package/src/components/avatar.ts +27 -0
  7. package/src/components/badge.ts +28 -0
  8. package/src/components/breadcrumb.ts +36 -0
  9. package/src/components/button.ts +32 -0
  10. package/src/components/card.ts +31 -0
  11. package/src/components/checkbox.ts +37 -0
  12. package/src/components/chip.ts +34 -0
  13. package/src/components/dialog.ts +31 -0
  14. package/src/components/divider.ts +36 -0
  15. package/src/components/icon.ts +26 -0
  16. package/src/components/image.ts +22 -0
  17. package/src/components/index.ts +37 -0
  18. package/src/components/input.ts +35 -0
  19. package/src/components/list.ts +40 -0
  20. package/src/components/menu-item.ts +29 -0
  21. package/src/components/menu.ts +32 -0
  22. package/src/components/popover.ts +25 -0
  23. package/src/components/pressable.ts +20 -0
  24. package/src/components/progress.ts +35 -0
  25. package/src/components/radio-button.ts +38 -0
  26. package/src/components/screen.ts +25 -0
  27. package/src/components/select.ts +62 -0
  28. package/src/components/skeleton.ts +26 -0
  29. package/src/components/slider.ts +62 -0
  30. package/src/components/svg-image.ts +24 -0
  31. package/src/components/switch.ts +54 -0
  32. package/src/components/tab-bar.ts +54 -0
  33. package/src/components/table.ts +57 -0
  34. package/src/components/text.ts +29 -0
  35. package/src/components/textarea.ts +53 -0
  36. package/src/components/tooltip.ts +29 -0
  37. package/src/components/video.ts +18 -0
  38. package/src/components/view.ts +31 -0
  39. package/src/darkTheme.ts +890 -0
  40. package/src/index.ts +7 -166
  41. package/src/lightTheme.ts +873 -0
  42. package/src/styles.ts +14 -0
  43. package/src/theme/color.ts +15 -0
  44. package/src/theme/index.ts +16 -0
  45. package/src/theme/intent.ts +8 -0
  46. package/src/theme/shadow.ts +18 -0
  47. package/src/theme/size.ts +182 -0
  48. package/src/theme/surface.ts +3 -0
  49. package/src/unistyles.ts +6 -14
  50. package/src/variants/color.ts +9 -0
  51. package/src/variants/index.ts +2 -0
  52. package/src/variants/intent.ts +16 -0
  53. package/src/variants/size.ts +0 -0
  54. package/CLAUDE.md +0 -447
  55. package/LLM-ACCESS-GUIDE.md +0 -208
  56. package/README.md +0 -633
  57. package/src/README.md +0 -138
  58. package/src/breakpoints.ts +0 -8
  59. package/src/colorResolver.ts +0 -218
  60. package/src/colors.md +0 -353
  61. package/src/colors.ts +0 -315
  62. package/src/common.ts +0 -92
  63. package/src/defaultThemes.md +0 -407
  64. package/src/defaultThemes.ts +0 -238
  65. package/src/themeBuilder.md +0 -400
  66. package/src/themeBuilder.ts +0 -602
  67. package/src/variantHelpers.ts +0 -584
  68. package/src/variants.ts +0 -56
package/src/styles.ts ADDED
@@ -0,0 +1,14 @@
1
+ export type Styles = Record<string, any> & {
2
+ _web?: Styles,
3
+ }
4
+ export type Variants = Record<string, Record<string, Styles>>
5
+ export type CompoundDefinition<V extends string> = Partial<Record<V, any>> & { styles: Styles }
6
+ export type CompoundVariants<V extends string> = CompoundDefinition<V>[]
7
+ export type ExpandedStyles<V extends string> = Styles & {
8
+ compoundVariants?: CompoundVariants<V>;
9
+ variants?: Variants;
10
+ }
11
+
12
+ export type StaticStyles<V extends string> = ExpandedStyles<V>;
13
+ export type DynamicStyles<V extends string> = (dynamic: Partial<Record<V, any>>) => ExpandedStyles<V>;
14
+ export type StylesheetStyles<V extends string> = StaticStyles<V> | DynamicStyles<V>;
@@ -0,0 +1,15 @@
1
+ export type Pallet = 'red' | 'orange' | 'blue' | 'green' | 'yellow' | 'purple' | 'gray' | 'black' | 'white';
2
+ export type Shade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
3
+ export type Color = `${Pallet}.${Shade}` | Pallet;
4
+ export type ColorValue = string;
5
+
6
+ export type Surface = 'primary' | 'secondary' | 'tertiary' | 'inverse' | 'inverse-secondary' | 'inverse-tertiary';
7
+ export type Text = 'primary' | 'secondary' | 'tertiary' | 'inverse' | 'inverse-secondary' | 'inverse-tertiary';
8
+ export type Border = 'primary' | 'secondary' | 'tertiary' | 'disabled';
9
+
10
+ export type AllColorTypes = {
11
+ surface: Record<Surface, ColorValue>;
12
+ text: Record<Text, ColorValue>;
13
+ border: Record<Border, ColorValue>;
14
+ pallet: Record<Pallet, Record<Shade, ColorValue>>;
15
+ }
@@ -0,0 +1,16 @@
1
+ import { AllColorTypes, Color, ColorValue } from "./color";
2
+ import { Intent, IntentValue } from "./intent";
3
+ import { AllComponentSizes, SizeValue } from "./size";
4
+ import { AllShadowTypes } from "./shadow";
5
+
6
+ export type Theme = {
7
+ intents: Record<Intent, IntentValue>;
8
+ colors: AllColorTypes;
9
+ sizes: AllComponentSizes;
10
+ shadows: AllShadowTypes;
11
+ };
12
+
13
+ export * from "./intent";
14
+ export * from "./size";
15
+ export * from "./color";
16
+ export * from "./shadow";
@@ -0,0 +1,8 @@
1
+ export type Intent = 'primary' | 'success' | 'error' | 'warning' | 'neutral' | 'info';
2
+
3
+ export type IntentValue = {
4
+ primary: string;
5
+ contrast: string;
6
+ light: string;
7
+ dark: string;
8
+ }
@@ -0,0 +1,18 @@
1
+ export type ShadowVariant = 'none' | 'sm' | 'md' | 'lg' | 'xl';
2
+
3
+ export type ShadowValue = {
4
+ // Android: elevation value
5
+ elevation: number;
6
+
7
+ // iOS: shadow properties
8
+ shadowColor: string;
9
+ shadowOffset: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ shadowOpacity: number;
14
+ shadowRadius: number;
15
+ boxShadow?: string;
16
+ } | {}
17
+
18
+ export type AllShadowTypes = Record<ShadowVariant, ShadowValue>;
@@ -0,0 +1,182 @@
1
+ export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
2
+ export type SizeValue = number | string
3
+
4
+ // Size alone is not very useful, as sizes are contextual based on the component
5
+ export type AllComponentSizes = {
6
+ button: Record<Size, ButtonSizeValue>;
7
+ chip: Record<Size, ChipSizeValue>;
8
+ badge: Record<Size, BadgeSizeValue>;
9
+ icon: Record<Size, IconSizeValue>;
10
+ input: Record<Size, InputSizeValue>;
11
+ radioButton: Record<Size, RadioButtonSizeValue>;
12
+ select: Record<Size, SelectSizeValue>;
13
+ slider: Record<Size, SliderSizeValue>;
14
+ switch: Record<Size, SwitchSizeValue>;
15
+ textarea: Record<Size, TextAreaSizeValue>;
16
+ avatar: Record<Size, AvatarSizeValue>;
17
+ progress: Record<Size, ProgressSizeValue>;
18
+ accordion: Record<Size, AccordionSizeValue>;
19
+ activityIndicator: Record<Size, ActivityIndicatorSizeValue>;
20
+ breadcrumb: Record<Size, BreadcrumbSizeValue>;
21
+ list: Record<Size, ListSizeValue>;
22
+ menu: Record<Size, MenuSizeValue>;
23
+ text: Record<Size, TextSizeValue>;
24
+ tabBar: Record<Size, TabBarSizeValue>;
25
+ table: Record<Size, TableSizeValue>;
26
+ tooltip: Record<Size, TooltipSizeValue>;
27
+ view: Record<Size, ViewSizeValue>;
28
+ }
29
+
30
+
31
+ // Derivative size values based on context
32
+ export type ButtonSizeValue = {
33
+ paddingVertical: SizeValue;
34
+ paddingHorizontal: SizeValue;
35
+ minHeight: SizeValue;
36
+ fontSize: SizeValue;
37
+ iconSize: SizeValue;
38
+ }
39
+
40
+ export type ChipSizeValue = {
41
+ paddingVertical: SizeValue;
42
+ paddingHorizontal: SizeValue;
43
+ minHeight: SizeValue;
44
+ borderRadius: SizeValue;
45
+ fontSize: SizeValue;
46
+ lineHeight: SizeValue;
47
+ iconSize: SizeValue;
48
+ }
49
+
50
+ export type BadgeSizeValue = {
51
+ minWidth: SizeValue;
52
+ height: SizeValue;
53
+ paddingHorizontal: SizeValue;
54
+ fontSize: SizeValue;
55
+ lineHeight: SizeValue;
56
+ iconSize: SizeValue;
57
+ }
58
+
59
+ export type IconSizeValue = {
60
+ width: SizeValue;
61
+ height: SizeValue;
62
+ fontSize: SizeValue;
63
+ }
64
+
65
+ export type InputSizeValue = {
66
+ height: SizeValue;
67
+ paddingHorizontal: SizeValue;
68
+ fontSize: SizeValue;
69
+ iconSize: SizeValue;
70
+ iconMargin: SizeValue;
71
+ }
72
+
73
+ export type RadioButtonSizeValue = {
74
+ radioSize: SizeValue;
75
+ radioDotSize: SizeValue;
76
+ fontSize: SizeValue;
77
+ gap: SizeValue;
78
+ }
79
+
80
+ export type SelectSizeValue = {
81
+ paddingHorizontal: SizeValue;
82
+ minHeight: SizeValue;
83
+ fontSize: SizeValue;
84
+ iconSize: SizeValue;
85
+ }
86
+
87
+ export type SliderSizeValue = {
88
+ trackHeight: SizeValue;
89
+ thumbSize: SizeValue;
90
+ thumbIconSize: SizeValue;
91
+ markHeight: SizeValue;
92
+ labelFontSize: SizeValue;
93
+ }
94
+
95
+ export type SwitchSizeValue = {
96
+ trackWidth: SizeValue;
97
+ trackHeight: SizeValue;
98
+ thumbSize: SizeValue;
99
+ thumbIconSize: SizeValue;
100
+ translateX: SizeValue;
101
+ }
102
+
103
+ export type TextAreaSizeValue = {
104
+ fontSize: SizeValue;
105
+ padding: SizeValue;
106
+ lineHeight: SizeValue;
107
+ minHeight: SizeValue;
108
+ }
109
+
110
+ export type AvatarSizeValue = {
111
+ width: SizeValue;
112
+ height: SizeValue;
113
+ fontSize: SizeValue;
114
+ }
115
+
116
+ export type ProgressSizeValue = {
117
+ linearHeight: SizeValue;
118
+ circularSize: SizeValue;
119
+ labelFontSize: SizeValue;
120
+ circularLabelFontSize: SizeValue;
121
+ }
122
+
123
+ export type AccordionSizeValue = {
124
+ headerPadding: SizeValue;
125
+ headerFontSize: SizeValue;
126
+ iconSize: SizeValue;
127
+ contentPadding: SizeValue;
128
+ }
129
+
130
+ export type ActivityIndicatorSizeValue = {
131
+ size: SizeValue;
132
+ borderWidth: SizeValue;
133
+ }
134
+
135
+ export type BreadcrumbSizeValue = {
136
+ fontSize: SizeValue;
137
+ lineHeight: SizeValue;
138
+ iconSize: SizeValue;
139
+ }
140
+
141
+ export type ListSizeValue = {
142
+ paddingVertical: SizeValue;
143
+ paddingHorizontal: SizeValue;
144
+ minHeight: SizeValue;
145
+ iconSize: SizeValue;
146
+ labelFontSize: SizeValue;
147
+ labelLineHeight: SizeValue;
148
+ }
149
+
150
+ export type MenuSizeValue = {
151
+ paddingVertical: SizeValue;
152
+ paddingHorizontal: SizeValue;
153
+ iconSize: SizeValue;
154
+ labelFontSize: SizeValue;
155
+ }
156
+
157
+ export type TextSizeValue = {
158
+ fontSize: SizeValue;
159
+ lineHeight: SizeValue;
160
+ }
161
+
162
+ export type TabBarSizeValue = {
163
+ fontSize: SizeValue;
164
+ lineHeight: SizeValue;
165
+ padding: SizeValue;
166
+ }
167
+
168
+ export type TableSizeValue = {
169
+ padding: SizeValue;
170
+ fontSize: SizeValue;
171
+ lineHeight: SizeValue;
172
+ }
173
+
174
+ export type TooltipSizeValue = {
175
+ fontSize: SizeValue;
176
+ padding: SizeValue;
177
+ }
178
+
179
+ export type ViewSizeValue = {
180
+ padding: SizeValue;
181
+ spacing: SizeValue;
182
+ }
@@ -0,0 +1,3 @@
1
+ export type Surface = 'primary' | 'secondary' | 'tertiary' | 'inverse' | 'inverse-secondary' | 'inverse-tertiary';
2
+
3
+ export type SurfaceValue = string;
package/src/unistyles.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { StyleSheet } from 'react-native-unistyles';
2
- import { breakpoints } from './breakpoints';
3
- import { defaultLightTheme as lightTheme, defaultDarkTheme as darkTheme } from './defaultThemes';
2
+ import { darkTheme } from './darkTheme';
3
+ import { lightTheme } from './lightTheme';
4
4
 
5
5
  // Export enhanced theme types
6
6
  export type AppTheme = typeof lightTheme;
7
7
  export type AppIntents = typeof lightTheme.intents;
8
8
  export type AppColors = typeof lightTheme.colors;
9
- export type AppPalettes = typeof lightTheme.palettes;
10
- export type IntentNames = keyof AppIntents;
11
- export type ColorNames = keyof AppColors;
9
+
10
+ // Utility types to extract keys from theme
11
+ export type ThemeIntentKeys = keyof AppIntents;
12
+ export type ThemeColorKeys = keyof AppColors;
12
13
 
13
14
  // Unistyles v3 themes declaration
14
15
  declare module 'react-native-unistyles' {
@@ -16,14 +17,6 @@ declare module 'react-native-unistyles' {
16
17
  light: typeof lightTheme;
17
18
  dark: typeof darkTheme;
18
19
  }
19
-
20
- export interface UnistylesBreakpoints {
21
- xs: typeof breakpoints.xs;
22
- sm: typeof breakpoints.sm;
23
- md: typeof breakpoints.md;
24
- lg: typeof breakpoints.lg;
25
- xl: typeof breakpoints.xl;
26
- }
27
20
  }
28
21
 
29
22
 
@@ -31,7 +24,6 @@ StyleSheet.configure({
31
24
  settings: {
32
25
  initialTheme: 'light',
33
26
  },
34
- breakpoints,
35
27
  themes: {
36
28
  light: lightTheme,
37
29
  dark: darkTheme,
@@ -0,0 +1,9 @@
1
+ import { Styles } from "../styles";
2
+ import { Color, ColorValue, Theme } from "../theme";
3
+
4
+ export function getColorFromString(theme: Theme, color: Color): ColorValue {
5
+ const [colorName, shade] = color.split('.') as [Color, string | undefined];
6
+ const colorPallet = theme.colors.pallet;
7
+ return colorPallet[colorName]?.[shade || '500']
8
+
9
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./intent";
2
+ export * from "./color";
@@ -0,0 +1,16 @@
1
+ import { Intent, IntentValue, Theme } from "../theme";
2
+ import { Styles } from "../styles";
3
+
4
+ /**
5
+ * Build the intent variants using a builder function
6
+ * @param theme
7
+ * @param builder
8
+ * @returns
9
+ */
10
+ export function buildIntentVariants(theme: Theme, builder: (intent: IntentValue) => Styles): Record<Intent, Styles> {
11
+ const variants = {} as Record<Intent, Styles>;
12
+ for (const intent in theme.intents) {
13
+ variants[intent as Intent] = builder(theme.intents[intent as Intent]);
14
+ }
15
+ return variants;
16
+ }
File without changes