@titan-design/react-ui 0.1.0 → 0.2.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 (236) hide show
  1. package/README.md +47 -1
  2. package/dist/{chunk-MGW37MPO.mjs → chunk-UXVRPOME.mjs} +173 -3
  3. package/dist/chunk-UXVRPOME.mjs.map +1 -0
  4. package/dist/index.d.mts +101 -12
  5. package/dist/index.d.ts +101 -12
  6. package/dist/index.js +1267 -468
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +734 -112
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/theme/index.d.mts +86 -1
  11. package/dist/theme/index.d.ts +86 -1
  12. package/dist/theme/index.js +166 -0
  13. package/dist/theme/index.js.map +1 -1
  14. package/dist/theme/index.mjs +1 -1
  15. package/package.json +22 -6
  16. package/src/components/custom/DateTime/DateTime.stories.tsx +180 -0
  17. package/src/components/custom/DateTime/DateTime.test.tsx +152 -0
  18. package/src/components/custom/DateTime/DateTime.tsx +235 -0
  19. package/src/components/custom/DateTime/index.ts +2 -0
  20. package/src/components/custom/EmptyState/EmptyState.stories.tsx +99 -0
  21. package/src/components/custom/EmptyState/EmptyState.test.tsx +106 -0
  22. package/src/components/custom/EmptyState/EmptyState.tsx +68 -0
  23. package/src/components/custom/EmptyState/index.ts +2 -0
  24. package/src/components/custom/Metric/Metric.stories.tsx +133 -0
  25. package/src/components/custom/Metric/Metric.test.tsx +120 -0
  26. package/src/components/custom/Metric/Metric.tsx +92 -0
  27. package/src/components/custom/Metric/index.ts +2 -0
  28. package/src/components/custom/Sidebar/Sidebar.stories.tsx +227 -0
  29. package/src/components/custom/Sidebar/Sidebar.test.tsx +185 -0
  30. package/src/components/custom/Sidebar/Sidebar.tsx +257 -0
  31. package/src/components/custom/Sidebar/index.ts +18 -0
  32. package/src/components/custom/Table/Table.stories.tsx +481 -0
  33. package/src/components/custom/Table/Table.test.tsx +531 -0
  34. package/src/components/custom/Table/Table.tsx +696 -0
  35. package/src/components/custom/Table/index.ts +22 -0
  36. package/src/components/custom/Typography/Typography.stories.tsx +153 -0
  37. package/src/components/custom/Typography/Typography.test.tsx +107 -0
  38. package/src/components/custom/Typography/Typography.tsx +218 -0
  39. package/src/components/custom/Typography/index.ts +19 -0
  40. package/src/components/custom/Workout/RestTimer.stories.tsx +71 -0
  41. package/src/components/custom/Workout/RestTimer.test.tsx +145 -0
  42. package/src/components/custom/Workout/RestTimer.tsx +172 -0
  43. package/src/components/custom/Workout/SupersetWrapper.stories.tsx +144 -0
  44. package/src/components/custom/Workout/SupersetWrapper.test.tsx +130 -0
  45. package/src/components/custom/Workout/SupersetWrapper.tsx +63 -0
  46. package/src/components/custom/Workout/index.ts +2 -0
  47. package/src/components/custom/index.ts +9 -0
  48. package/src/components/custom/stepper/Stepper.stories.tsx +245 -0
  49. package/src/components/custom/stepper/Stepper.test.tsx +230 -0
  50. package/src/components/custom/stepper/Stepper.tsx +250 -0
  51. package/src/components/custom/stepper/index.ts +10 -0
  52. package/src/components/index.ts +5 -0
  53. package/src/components/ui/alert/Alert.stories.tsx +154 -0
  54. package/src/components/ui/alert/Alert.test.tsx +202 -0
  55. package/src/components/ui/alert/Alert.tsx +170 -0
  56. package/src/components/ui/alert/index.ts +8 -0
  57. package/src/components/ui/autocomplete/Autocomplete.stories.tsx +299 -0
  58. package/src/components/ui/autocomplete/Autocomplete.test.tsx +247 -0
  59. package/src/components/ui/autocomplete/Autocomplete.tsx +332 -0
  60. package/src/components/ui/autocomplete/index.ts +2 -0
  61. package/src/components/ui/avatar/Avatar.stories.tsx +105 -0
  62. package/src/components/ui/avatar/Avatar.test.tsx +152 -0
  63. package/src/components/ui/avatar/Avatar.tsx +176 -0
  64. package/src/components/ui/avatar/index.ts +2 -0
  65. package/src/components/ui/badge/Badge.stories.tsx +100 -0
  66. package/src/components/ui/badge/Badge.test.tsx +103 -0
  67. package/src/components/ui/badge/Badge.tsx +119 -0
  68. package/src/components/ui/badge/index.ts +3 -0
  69. package/src/components/ui/breadcrumbs/Breadcrumbs.stories.tsx +70 -0
  70. package/src/components/ui/breadcrumbs/Breadcrumbs.test.tsx +156 -0
  71. package/src/components/ui/breadcrumbs/Breadcrumbs.tsx +127 -0
  72. package/src/components/ui/breadcrumbs/index.ts +2 -0
  73. package/src/components/ui/button/Button.stories.tsx +216 -0
  74. package/src/components/ui/button/Button.test.tsx +132 -0
  75. package/src/components/ui/button/Button.tsx +297 -0
  76. package/src/components/ui/button/index.ts +10 -0
  77. package/src/components/ui/card/Card.stories.tsx +443 -0
  78. package/src/components/ui/card/Card.test.tsx +294 -0
  79. package/src/components/ui/card/Card.tsx +401 -0
  80. package/src/components/ui/card/index.ts +20 -0
  81. package/src/components/ui/checkbox/Checkbox.stories.tsx +126 -0
  82. package/src/components/ui/checkbox/Checkbox.test.tsx +152 -0
  83. package/src/components/ui/checkbox/Checkbox.tsx +163 -0
  84. package/src/components/ui/checkbox/index.ts +2 -0
  85. package/src/components/ui/chip/Chip.stories.tsx +112 -0
  86. package/src/components/ui/chip/Chip.test.tsx +119 -0
  87. package/src/components/ui/chip/Chip.tsx +151 -0
  88. package/src/components/ui/chip/index.ts +2 -0
  89. package/src/components/ui/collapse/Collapse.stories.tsx +313 -0
  90. package/src/components/ui/collapse/Collapse.test.tsx +298 -0
  91. package/src/components/ui/collapse/Collapse.tsx +275 -0
  92. package/src/components/ui/collapse/index.ts +18 -0
  93. package/src/components/ui/data-row/DataRow.stories.tsx +78 -0
  94. package/src/components/ui/data-row/DataRow.test.tsx +78 -0
  95. package/src/components/ui/data-row/DataRow.tsx +29 -0
  96. package/src/components/ui/data-row/index.ts +2 -0
  97. package/src/components/ui/divider/Divider.stories.tsx +71 -0
  98. package/src/components/ui/divider/Divider.test.tsx +55 -0
  99. package/src/components/ui/divider/Divider.tsx +37 -0
  100. package/src/components/ui/divider/index.ts +2 -0
  101. package/src/components/ui/drawer/Drawer.stories.tsx +228 -0
  102. package/src/components/ui/drawer/Drawer.test.tsx +142 -0
  103. package/src/components/ui/drawer/Drawer.tsx +228 -0
  104. package/src/components/ui/drawer/index.ts +9 -0
  105. package/src/components/ui/form-field/FormField.stories.tsx +260 -0
  106. package/src/components/ui/form-field/FormField.test.tsx +280 -0
  107. package/src/components/ui/form-field/FormField.tsx +308 -0
  108. package/src/components/ui/form-field/index.ts +2 -0
  109. package/src/components/ui/help-tip/HelpTip.stories.tsx +250 -0
  110. package/src/components/ui/help-tip/HelpTip.test.tsx +198 -0
  111. package/src/components/ui/help-tip/HelpTip.tsx +229 -0
  112. package/src/components/ui/help-tip/index.ts +2 -0
  113. package/src/components/ui/icon-box/IconBox.stories.tsx +139 -0
  114. package/src/components/ui/icon-box/IconBox.test.tsx +120 -0
  115. package/src/components/ui/icon-box/IconBox.tsx +57 -0
  116. package/src/components/ui/icon-box/index.ts +1 -0
  117. package/src/components/ui/index.ts +38 -0
  118. package/src/components/ui/indicator/Indicator.stories.tsx +74 -0
  119. package/src/components/ui/indicator/Indicator.test.tsx +55 -0
  120. package/src/components/ui/indicator/Indicator.tsx +73 -0
  121. package/src/components/ui/indicator/index.ts +2 -0
  122. package/src/components/ui/input/Input.stories.tsx +192 -0
  123. package/src/components/ui/input/Input.test.tsx +86 -0
  124. package/src/components/ui/input/Input.tsx +273 -0
  125. package/src/components/ui/input/index.ts +2 -0
  126. package/src/components/ui/link/Link.stories.tsx +78 -0
  127. package/src/components/ui/link/Link.test.tsx +94 -0
  128. package/src/components/ui/link/Link.tsx +86 -0
  129. package/src/components/ui/link/index.ts +2 -0
  130. package/src/components/ui/list-item/ListItem.stories.tsx +146 -0
  131. package/src/components/ui/list-item/ListItem.test.tsx +128 -0
  132. package/src/components/ui/list-item/ListItem.tsx +89 -0
  133. package/src/components/ui/list-item/index.ts +14 -0
  134. package/src/components/ui/menu/Menu.stories.tsx +180 -0
  135. package/src/components/ui/menu/Menu.test.tsx +353 -0
  136. package/src/components/ui/menu/Menu.tsx +222 -0
  137. package/src/components/ui/menu/index.ts +2 -0
  138. package/src/components/ui/modal/Modal.stories.tsx +350 -0
  139. package/src/components/ui/modal/Modal.test.tsx +159 -0
  140. package/src/components/ui/modal/Modal.tsx +254 -0
  141. package/src/components/ui/modal/index.ts +19 -0
  142. package/src/components/ui/pill/Pill.stories.tsx +71 -0
  143. package/src/components/ui/pill/Pill.test.tsx +69 -0
  144. package/src/components/ui/pill/Pill.tsx +104 -0
  145. package/src/components/ui/pill/index.ts +2 -0
  146. package/src/components/ui/popover/Popover.stories.tsx +190 -0
  147. package/src/components/ui/popover/Popover.test.tsx +419 -0
  148. package/src/components/ui/popover/Popover.tsx +237 -0
  149. package/src/components/ui/popover/index.ts +2 -0
  150. package/src/components/ui/progress/Progress.stories.tsx +190 -0
  151. package/src/components/ui/progress/Progress.test.tsx +210 -0
  152. package/src/components/ui/progress/Progress.tsx +339 -0
  153. package/src/components/ui/progress/index.ts +9 -0
  154. package/src/components/ui/radio/Radio.stories.tsx +199 -0
  155. package/src/components/ui/radio/Radio.test.tsx +166 -0
  156. package/src/components/ui/radio/Radio.tsx +200 -0
  157. package/src/components/ui/radio/index.ts +2 -0
  158. package/src/components/ui/section/Section.stories.tsx +111 -0
  159. package/src/components/ui/section/Section.test.tsx +121 -0
  160. package/src/components/ui/section/Section.tsx +52 -0
  161. package/src/components/ui/section/index.ts +6 -0
  162. package/src/components/ui/select/Select.stories.tsx +286 -0
  163. package/src/components/ui/select/Select.test.tsx +200 -0
  164. package/src/components/ui/select/Select.tsx +243 -0
  165. package/src/components/ui/select/index.ts +2 -0
  166. package/src/components/ui/skeleton/Skeleton.stories.tsx +153 -0
  167. package/src/components/ui/skeleton/Skeleton.test.tsx +162 -0
  168. package/src/components/ui/skeleton/Skeleton.tsx +229 -0
  169. package/src/components/ui/skeleton/index.ts +16 -0
  170. package/src/components/ui/spinner/Spinner.stories.tsx +67 -0
  171. package/src/components/ui/spinner/Spinner.test.tsx +67 -0
  172. package/src/components/ui/spinner/Spinner.tsx +72 -0
  173. package/src/components/ui/spinner/index.ts +2 -0
  174. package/src/components/ui/stack/Stack.stories.tsx +127 -0
  175. package/src/components/ui/stack/Stack.test.tsx +184 -0
  176. package/src/components/ui/stack/Stack.tsx +76 -0
  177. package/src/components/ui/stack/index.ts +2 -0
  178. package/src/components/ui/surface/Surface.stories.tsx +91 -0
  179. package/src/components/ui/surface/Surface.test.tsx +63 -0
  180. package/src/components/ui/surface/Surface.tsx +51 -0
  181. package/src/components/ui/surface/index.ts +1 -0
  182. package/src/components/ui/switch/Switch.stories.tsx +111 -0
  183. package/src/components/ui/switch/Switch.test.tsx +112 -0
  184. package/src/components/ui/switch/Switch.tsx +103 -0
  185. package/src/components/ui/switch/index.ts +2 -0
  186. package/src/components/ui/tabs/Tabs.stories.tsx +213 -0
  187. package/src/components/ui/tabs/Tabs.test.tsx +192 -0
  188. package/src/components/ui/tabs/Tabs.tsx +253 -0
  189. package/src/components/ui/tabs/index.ts +16 -0
  190. package/src/components/ui/toast/Toast.stories.tsx +255 -0
  191. package/src/components/ui/toast/Toast.test.tsx +207 -0
  192. package/src/components/ui/toast/Toast.tsx +327 -0
  193. package/src/components/ui/toast/index.ts +9 -0
  194. package/src/components/ui/toolbar-button/ToolbarButton.stories.tsx +415 -0
  195. package/src/components/ui/toolbar-button/ToolbarButton.test.tsx +224 -0
  196. package/src/components/ui/toolbar-button/ToolbarButton.tsx +307 -0
  197. package/src/components/ui/toolbar-button/index.ts +7 -0
  198. package/src/components/ui/tooltip/Tooltip.stories.tsx +126 -0
  199. package/src/components/ui/tooltip/Tooltip.test.tsx +262 -0
  200. package/src/components/ui/tooltip/Tooltip.tsx +234 -0
  201. package/src/components/ui/tooltip/index.ts +2 -0
  202. package/src/index.ts +10 -0
  203. package/src/stories/PresetShowcase.stories.tsx +462 -0
  204. package/src/stories/ThemePresets.stories.tsx +85 -0
  205. package/src/test/setup.ts +19 -0
  206. package/src/theme/Colors.stories.tsx +258 -0
  207. package/src/theme/config.ts +193 -0
  208. package/src/theme/elevation.stories.tsx +346 -0
  209. package/src/theme/elevation.test.ts +27 -0
  210. package/src/theme/elevation.ts +567 -0
  211. package/src/theme/global.css +129 -1
  212. package/src/theme/index.ts +40 -0
  213. package/src/theme/presets/apply.ts +97 -0
  214. package/src/theme/presets/audiobook.ts +93 -0
  215. package/src/theme/presets/default.ts +6 -0
  216. package/src/theme/presets/index.ts +4 -0
  217. package/src/theme/presets/presets.test.ts +51 -0
  218. package/src/theme/presets/types.ts +76 -0
  219. package/src/theme/shadows.stories.tsx +523 -0
  220. package/src/theme/shadows.ts +439 -0
  221. package/src/theme/tokens/index.ts +2 -0
  222. package/src/theme/tokens/primitives.ts +354 -0
  223. package/src/theme/tokens/semantic.ts +381 -0
  224. package/src/types/jest-axe.d.ts +16 -0
  225. package/src/types/nativewind.d.ts +54 -0
  226. package/src/utils/avatar-color.test.ts +30 -0
  227. package/src/utils/avatar-color.ts +20 -0
  228. package/src/utils/cn.ts +14 -0
  229. package/src/utils/colors.ts +140 -0
  230. package/src/utils/form.ts +188 -0
  231. package/src/utils/index.ts +29 -0
  232. package/src/utils/useTheme.ts +72 -0
  233. package/src/web-jsx/jsx-dev-runtime.ts +28 -0
  234. package/src/web-jsx/jsx-runtime.ts +41 -0
  235. package/tailwind.config.js +53 -3
  236. package/dist/chunk-MGW37MPO.mjs.map +0 -1
@@ -0,0 +1,258 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import { View, Text } from 'react-native'
3
+ import { primitiveColors, discreteRainbow } from './tokens/primitives'
4
+ import { semanticColorsLight, semanticColorsDark } from './tokens/semantic'
5
+
6
+ const meta: Meta = {
7
+ title: 'Design Tokens/Colors',
8
+ tags: ['autodocs'],
9
+ }
10
+
11
+ export default meta
12
+
13
+ interface ColorSwatchProps {
14
+ name: string
15
+ value: string
16
+ textColor?: string
17
+ }
18
+
19
+ function ColorSwatch({ name, value, textColor = '#FFFFFF' }: ColorSwatchProps) {
20
+ const displayValue = value.startsWith('rgba') ? value : value.toUpperCase()
21
+
22
+ return (
23
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
24
+ <View
25
+ style={{
26
+ width: 48,
27
+ height: 48,
28
+ borderRadius: 8,
29
+ backgroundColor: value,
30
+ borderWidth: 1,
31
+ borderColor: '#374151',
32
+ }}
33
+ />
34
+ <View>
35
+ <Text className="font-semibold text-text-primary text-sm">
36
+ {name}
37
+ </Text>
38
+ <Text className="text-text-secondary text-xs">
39
+ {displayValue}
40
+ </Text>
41
+ </View>
42
+ </View>
43
+ )
44
+ }
45
+
46
+ function ColorScale({ name, colors }: { name: string; colors: Record<string | number, string> }) {
47
+ return (
48
+ <View style={{ marginBottom: 32 }}>
49
+ <Text className="text-lg font-bold text-text-primary mb-3">
50
+ {name}
51
+ </Text>
52
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
53
+ {Object.entries(colors).map(([shade, color]) => (
54
+ <View key={shade} style={{ alignItems: 'center' }}>
55
+ <View
56
+ style={{
57
+ width: 64,
58
+ height: 64,
59
+ borderRadius: 8,
60
+ backgroundColor: color,
61
+ borderWidth: 1,
62
+ borderColor: '#374151',
63
+ }}
64
+ />
65
+ <Text className="text-text-secondary text-xs mt-1">
66
+ {shade}
67
+ </Text>
68
+ </View>
69
+ ))}
70
+ </View>
71
+ </View>
72
+ )
73
+ }
74
+
75
+ export const PrimitiveColors: StoryObj = {
76
+ render: () => (
77
+ <View style={{ padding: 24 }}>
78
+ <Text className="text-2xl font-bold text-text-primary mb-6">
79
+ Primitive Colors
80
+ </Text>
81
+ <Text className="text-text-secondary mb-6">
82
+ Raw color values. Use semantic tokens instead when building components.
83
+ </Text>
84
+
85
+ <ColorScale name="Orange (Primary Brand)" colors={primitiveColors.accent} />
86
+ <ColorScale name="Steel (Secondary Brand)" colors={primitiveColors.steel} />
87
+ <ColorScale name="Blue" colors={primitiveColors.blue} />
88
+ <ColorScale name="Green" colors={primitiveColors.green} />
89
+ <ColorScale name="Teal (Success)" colors={primitiveColors.teal} />
90
+ <ColorScale name="Red (Error)" colors={primitiveColors.red} />
91
+ <ColorScale name="Sky (Info)" colors={primitiveColors.sky} />
92
+ <ColorScale name="Neutral" colors={primitiveColors.neutral} />
93
+ <ColorScale name="Charcoal (Dark Backgrounds)" colors={primitiveColors.charcoal} />
94
+ </View>
95
+ ),
96
+ }
97
+
98
+ export const BrandColors: StoryObj = {
99
+ render: () => (
100
+ <View style={{ padding: 24 }}>
101
+ <Text className="text-2xl font-bold text-text-primary mb-6">
102
+ Brand Colors
103
+ </Text>
104
+
105
+ <View style={{ gap: 16 }}>
106
+ <ColorSwatch name="brand-primary" value={semanticColorsLight['brand-primary']} />
107
+ <ColorSwatch name="brand-primary-light" value={semanticColorsLight['brand-primary-light']} />
108
+ <ColorSwatch name="brand-primary-dark" value={semanticColorsLight['brand-primary-dark']} />
109
+ <ColorSwatch name="brand-secondary" value={semanticColorsLight['brand-secondary']} />
110
+ <ColorSwatch name="brand-secondary-light" value={semanticColorsLight['brand-secondary-light']} />
111
+ <ColorSwatch name="brand-secondary-dark" value={semanticColorsLight['brand-secondary-dark']} />
112
+ </View>
113
+ </View>
114
+ ),
115
+ }
116
+
117
+ export const StatusColors: StoryObj = {
118
+ render: () => (
119
+ <View style={{ padding: 24 }}>
120
+ <Text className="text-2xl font-bold text-text-primary mb-6">
121
+ Status Colors
122
+ </Text>
123
+
124
+ <View style={{ gap: 16 }}>
125
+ <ColorSwatch name="status-success" value={semanticColorsLight['status-success']} />
126
+ <ColorSwatch name="status-error" value={semanticColorsLight['status-error']} />
127
+ <ColorSwatch name="status-warning" value={semanticColorsLight['status-warning']} />
128
+ <ColorSwatch name="status-info" value={semanticColorsLight['status-info']} />
129
+ </View>
130
+ </View>
131
+ ),
132
+ }
133
+
134
+ export const TextColors: StoryObj = {
135
+ render: () => (
136
+ <View style={{ padding: 24 }}>
137
+ <Text className="text-2xl font-bold text-text-primary mb-6">
138
+ Text Colors (Dark Mode)
139
+ </Text>
140
+
141
+ <View style={{ gap: 16 }}>
142
+ <ColorSwatch name="text-primary" value={semanticColorsDark['text-primary']} />
143
+ <ColorSwatch name="text-secondary" value={semanticColorsDark['text-secondary']} />
144
+ <ColorSwatch name="text-tertiary" value={semanticColorsDark['text-tertiary']} />
145
+ <ColorSwatch name="text-disabled" value={semanticColorsDark['text-disabled']} />
146
+ <ColorSwatch name="text-link" value={semanticColorsDark['text-link']} />
147
+ </View>
148
+ </View>
149
+ ),
150
+ }
151
+
152
+ export const SurfaceColors: StoryObj = {
153
+ render: () => (
154
+ <View style={{ padding: 24 }}>
155
+ <Text className="text-2xl font-bold text-text-primary mb-6">
156
+ Surface Colors (Dark Mode)
157
+ </Text>
158
+
159
+ <View style={{ gap: 16 }}>
160
+ <ColorSwatch name="surface-base" value={semanticColorsDark['surface-base']} />
161
+ <ColorSwatch name="surface-elevated" value={semanticColorsDark['surface-elevated']} />
162
+ <ColorSwatch name="surface-raised" value={semanticColorsDark['surface-raised']} />
163
+ <ColorSwatch name="surface-input" value={semanticColorsDark['surface-input']} />
164
+ <ColorSwatch name="background-base" value={semanticColorsDark['background-base']} />
165
+ <ColorSwatch name="background-default" value={semanticColorsDark['background-default']} />
166
+ </View>
167
+ </View>
168
+ ),
169
+ }
170
+
171
+ export const ResultColors: StoryObj = {
172
+ render: () => (
173
+ <View style={{ padding: 24 }}>
174
+ <Text className="text-2xl font-bold text-text-primary mb-6">
175
+ Result/Outcome Colors
176
+ </Text>
177
+ <Text className="text-text-secondary mb-6">
178
+ Colors for indicating positive, negative, or neutral outcomes.
179
+ </Text>
180
+
181
+ <View style={{ gap: 16 }}>
182
+ <ColorSwatch name="result-improve" value={semanticColorsLight['result-improve']} />
183
+ <ColorSwatch name="result-improve-light" value={semanticColorsLight['result-improve-light']} />
184
+ <ColorSwatch name="result-degrade" value={semanticColorsLight['result-degrade']} />
185
+ <ColorSwatch name="result-degrade-light" value={semanticColorsLight['result-degrade-light']} />
186
+ <ColorSwatch name="result-inconclusive" value={semanticColorsLight['result-inconclusive']} />
187
+ <ColorSwatch name="result-inconclusive-light" value={semanticColorsLight['result-inconclusive-light']} />
188
+ <ColorSwatch name="result-neutral" value={semanticColorsLight['result-neutral']} />
189
+ </View>
190
+ </View>
191
+ ),
192
+ }
193
+
194
+ export const DataVisualizationColors: StoryObj = {
195
+ render: () => (
196
+ <View style={{ padding: 24 }}>
197
+ <Text className="text-2xl font-bold text-text-primary mb-6">
198
+ Data Visualization Colors
199
+ </Text>
200
+ <Text className="text-text-secondary mb-6">
201
+ Colors optimized for charts and data visualization. Based on Paul Tol&apos;s color schemes.
202
+ </Text>
203
+
204
+ <View style={{ gap: 16 }}>
205
+ <ColorSwatch name="data-1" value={semanticColorsLight['data-1']} />
206
+ <ColorSwatch name="data-2" value={semanticColorsLight['data-2']} />
207
+ <ColorSwatch name="data-3" value={semanticColorsLight['data-3']} textColor="#000000" />
208
+ <ColorSwatch name="data-4" value={semanticColorsLight['data-4']} />
209
+ <ColorSwatch name="data-5" value={semanticColorsLight['data-5']} />
210
+ <ColorSwatch name="data-6" value={semanticColorsLight['data-6']} />
211
+ <ColorSwatch name="data-7" value={semanticColorsLight['data-7']} textColor="#000000" />
212
+ <ColorSwatch name="data-8" value={semanticColorsLight['data-8']} textColor="#000000" />
213
+ <ColorSwatch name="data-9" value={semanticColorsLight['data-9']} textColor="#000000" />
214
+ <ColorSwatch name="data-10" value={semanticColorsLight['data-10']} />
215
+ </View>
216
+
217
+ <Text className="text-lg font-bold text-text-primary mt-8 mb-3">
218
+ Full Discrete Rainbow Palette
219
+ </Text>
220
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 4 }}>
221
+ {discreteRainbow.map((color, index) => (
222
+ <View
223
+ key={index}
224
+ style={{
225
+ width: 32,
226
+ height: 32,
227
+ borderRadius: 4,
228
+ backgroundColor: color,
229
+ borderWidth: 1,
230
+ borderColor: '#374151',
231
+ }}
232
+ />
233
+ ))}
234
+ </View>
235
+ </View>
236
+ ),
237
+ }
238
+
239
+ export const BorderColors: StoryObj = {
240
+ render: () => (
241
+ <View style={{ padding: 24 }}>
242
+ <Text className="text-2xl font-bold text-text-primary mb-6">
243
+ Border Colors (Dark Mode)
244
+ </Text>
245
+
246
+ <View style={{ gap: 16 }}>
247
+ <ColorSwatch name="border-default" value={semanticColorsDark['border-default']} />
248
+ <ColorSwatch name="border-subtle" value={semanticColorsDark['border-subtle']} />
249
+ <ColorSwatch name="border-strong" value={semanticColorsDark['border-strong']} />
250
+ <ColorSwatch name="border-focus" value={semanticColorsDark['border-focus']} />
251
+ <ColorSwatch name="border-input" value={semanticColorsDark['border-input']} />
252
+ <ColorSwatch name="border-input-hover" value={semanticColorsDark['border-input-hover']} />
253
+ <ColorSwatch name="border-input-focus" value={semanticColorsDark['border-input-focus']} />
254
+ <ColorSwatch name="border-input-error" value={semanticColorsDark['border-input-error']} />
255
+ </View>
256
+ </View>
257
+ ),
258
+ }
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Theme Configuration
3
+ *
4
+ * Maps semantic tokens to CSS custom properties for runtime theming.
5
+ * Dark mode is the default theme.
6
+ */
7
+
8
+ import { semanticColorsLight, semanticColorsDark, type ThemeMode } from './tokens/semantic'
9
+
10
+ // CSS custom properties for light mode
11
+ export const lightThemeCSSVars = {
12
+ '--color-brand-primary': semanticColorsLight['brand-primary'],
13
+ '--color-brand-primary-light': semanticColorsLight['brand-primary-light'],
14
+ '--color-brand-primary-dark': semanticColorsLight['brand-primary-dark'],
15
+ '--color-brand-primary-subtle': semanticColorsLight['brand-primary-subtle'],
16
+ '--color-brand-secondary': semanticColorsLight['brand-secondary'],
17
+ '--color-brand-secondary-light': semanticColorsLight['brand-secondary-light'],
18
+ '--color-brand-secondary-dark': semanticColorsLight['brand-secondary-dark'],
19
+ '--color-brand-secondary-subtle': semanticColorsLight['brand-secondary-subtle'],
20
+
21
+ '--color-on-brand-primary': semanticColorsLight['on-brand-primary'],
22
+ '--color-on-brand-secondary': semanticColorsLight['on-brand-secondary'],
23
+
24
+ '--color-status-success': semanticColorsLight['status-success'],
25
+ '--color-status-success-subtle': semanticColorsLight['status-success-subtle'],
26
+ '--color-status-error': semanticColorsLight['status-error'],
27
+ '--color-status-error-subtle': semanticColorsLight['status-error-subtle'],
28
+ '--color-status-warning': semanticColorsLight['status-warning'],
29
+ '--color-status-warning-subtle': semanticColorsLight['status-warning-subtle'],
30
+ '--color-status-info': semanticColorsLight['status-info'],
31
+ '--color-status-info-subtle': semanticColorsLight['status-info-subtle'],
32
+
33
+ '--color-text-primary': semanticColorsLight['text-primary'],
34
+ '--color-text-secondary': semanticColorsLight['text-secondary'],
35
+ '--color-text-tertiary': semanticColorsLight['text-tertiary'],
36
+ '--color-text-disabled': semanticColorsLight['text-disabled'],
37
+ '--color-text-inverse': semanticColorsLight['text-inverse'],
38
+ '--color-text-link': semanticColorsLight['text-link'],
39
+
40
+ '--color-surface-base': semanticColorsLight['surface-base'],
41
+ '--color-surface-elevated': semanticColorsLight['surface-elevated'],
42
+ '--color-surface-raised': semanticColorsLight['surface-raised'],
43
+
44
+ '--color-background-base': semanticColorsLight['background-base'],
45
+ '--color-background-default': semanticColorsLight['background-default'],
46
+ '--color-background-subtle': semanticColorsLight['background-subtle'],
47
+
48
+ '--color-border-default': semanticColorsLight['border-default'],
49
+ '--color-border-subtle': semanticColorsLight['border-subtle'],
50
+ '--color-border-strong': semanticColorsLight['border-strong'],
51
+ '--color-border-focus': semanticColorsLight['border-focus'],
52
+
53
+ '--color-interactive-hover': semanticColorsLight['interactive-hover'],
54
+ '--color-interactive-focus': semanticColorsLight['interactive-focus'],
55
+ '--color-interactive-active': semanticColorsLight['interactive-active'],
56
+ '--color-interactive-selected': semanticColorsLight['interactive-selected'],
57
+ '--color-interactive-disabled': semanticColorsLight['interactive-disabled'],
58
+
59
+ '--color-divider': semanticColorsLight['divider'],
60
+ } as const
61
+
62
+ // CSS custom properties for dark mode (default)
63
+ export const darkThemeCSSVars = {
64
+ '--color-brand-primary': semanticColorsDark['brand-primary'],
65
+ '--color-brand-primary-light': semanticColorsDark['brand-primary-light'],
66
+ '--color-brand-primary-dark': semanticColorsDark['brand-primary-dark'],
67
+ '--color-brand-primary-subtle': semanticColorsDark['brand-primary-subtle'],
68
+ '--color-brand-secondary': semanticColorsDark['brand-secondary'],
69
+ '--color-brand-secondary-light': semanticColorsDark['brand-secondary-light'],
70
+ '--color-brand-secondary-dark': semanticColorsDark['brand-secondary-dark'],
71
+ '--color-brand-secondary-subtle': semanticColorsDark['brand-secondary-subtle'],
72
+
73
+ '--color-on-brand-primary': semanticColorsDark['on-brand-primary'],
74
+ '--color-on-brand-secondary': semanticColorsDark['on-brand-secondary'],
75
+
76
+ '--color-status-success': semanticColorsDark['status-success'],
77
+ '--color-status-success-subtle': semanticColorsDark['status-success-subtle'],
78
+ '--color-status-error': semanticColorsDark['status-error'],
79
+ '--color-status-error-subtle': semanticColorsDark['status-error-subtle'],
80
+ '--color-status-warning': semanticColorsDark['status-warning'],
81
+ '--color-status-warning-subtle': semanticColorsDark['status-warning-subtle'],
82
+ '--color-status-info': semanticColorsDark['status-info'],
83
+ '--color-status-info-subtle': semanticColorsDark['status-info-subtle'],
84
+
85
+ '--color-text-primary': semanticColorsDark['text-primary'],
86
+ '--color-text-secondary': semanticColorsDark['text-secondary'],
87
+ '--color-text-tertiary': semanticColorsDark['text-tertiary'],
88
+ '--color-text-disabled': semanticColorsDark['text-disabled'],
89
+ '--color-text-inverse': semanticColorsDark['text-inverse'],
90
+ '--color-text-link': semanticColorsDark['text-link'],
91
+
92
+ '--color-surface-base': semanticColorsDark['surface-base'],
93
+ '--color-surface-elevated': semanticColorsDark['surface-elevated'],
94
+ '--color-surface-raised': semanticColorsDark['surface-raised'],
95
+
96
+ '--color-background-base': semanticColorsDark['background-base'],
97
+ '--color-background-default': semanticColorsDark['background-default'],
98
+ '--color-background-subtle': semanticColorsDark['background-subtle'],
99
+
100
+ '--color-border-default': semanticColorsDark['border-default'],
101
+ '--color-border-subtle': semanticColorsDark['border-subtle'],
102
+ '--color-border-strong': semanticColorsDark['border-strong'],
103
+ '--color-border-focus': semanticColorsDark['border-focus'],
104
+
105
+ '--color-interactive-hover': semanticColorsDark['interactive-hover'],
106
+ '--color-interactive-focus': semanticColorsDark['interactive-focus'],
107
+ '--color-interactive-active': semanticColorsDark['interactive-active'],
108
+ '--color-interactive-selected': semanticColorsDark['interactive-selected'],
109
+ '--color-interactive-disabled': semanticColorsDark['interactive-disabled'],
110
+
111
+ '--color-divider': semanticColorsDark['divider'],
112
+ } as const
113
+
114
+ // Helper to get CSS vars for a theme mode
115
+ export function getThemeCSSVars(mode: ThemeMode) {
116
+ return mode === 'dark' ? darkThemeCSSVars : lightThemeCSSVars
117
+ }
118
+
119
+ // Gluestack UI theme configuration
120
+ export const gluestackConfig = {
121
+ tokens: {
122
+ colors: {
123
+ // Map to our semantic colors via CSS vars
124
+ primary500: 'var(--color-brand-primary)',
125
+ primary600: 'var(--color-brand-primary-dark)',
126
+ primary400: 'var(--color-brand-primary-light)',
127
+
128
+ secondary500: 'var(--color-brand-secondary)',
129
+ secondary600: 'var(--color-brand-secondary-dark)',
130
+ secondary400: 'var(--color-brand-secondary-light)',
131
+
132
+ success500: 'var(--color-status-success)',
133
+ error500: 'var(--color-status-error)',
134
+ warning500: 'var(--color-status-warning)',
135
+ info500: 'var(--color-status-info)',
136
+
137
+ textLight: 'var(--color-text-primary)',
138
+ textDark: 'var(--color-text-inverse)',
139
+
140
+ backgroundLight: 'var(--color-background-default)',
141
+ backgroundDark: 'var(--color-surface-base)',
142
+ },
143
+ space: {
144
+ '0': 0,
145
+ '1': 4,
146
+ '2': 8,
147
+ '3': 12,
148
+ '4': 16,
149
+ '5': 20,
150
+ '6': 24,
151
+ '8': 32,
152
+ '10': 40,
153
+ '12': 48,
154
+ '16': 64,
155
+ '20': 80,
156
+ '24': 96,
157
+ },
158
+ radii: {
159
+ none: 0,
160
+ sm: 4,
161
+ md: 8,
162
+ lg: 12,
163
+ xl: 16,
164
+ '2xl': 24,
165
+ full: 9999,
166
+ },
167
+ fontSizes: {
168
+ xs: 12,
169
+ sm: 14,
170
+ md: 16,
171
+ lg: 18,
172
+ xl: 20,
173
+ '2xl': 24,
174
+ '3xl': 30,
175
+ '4xl': 36,
176
+ '5xl': 48,
177
+ },
178
+ },
179
+ aliases: {
180
+ bg: 'backgroundColor',
181
+ p: 'padding',
182
+ px: 'paddingHorizontal',
183
+ py: 'paddingVertical',
184
+ m: 'margin',
185
+ mx: 'marginHorizontal',
186
+ my: 'marginVertical',
187
+ h: 'height',
188
+ w: 'width',
189
+ rounded: 'borderRadius',
190
+ },
191
+ } as const
192
+
193
+ export type ThemeConfig = typeof gluestackConfig