@flipova/foundation 2.4.4 → 3.0.0-alpha.1

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 (402) hide show
  1. package/CHANGES.md +66 -0
  2. package/COMPONENTS.md +102 -0
  3. package/DOCS.md +261 -0
  4. package/LICENSE +1 -1
  5. package/README.md +169 -118
  6. package/components/contract/index.ts +3 -0
  7. package/components/contract/recipes/accordion.ts +42 -0
  8. package/components/contract/recipes/avatar.ts +41 -0
  9. package/components/contract/recipes/badge.ts +46 -0
  10. package/components/contract/recipes/button.ts +58 -0
  11. package/components/contract/recipes/calendar.ts +118 -0
  12. package/components/contract/recipes/card.ts +21 -0
  13. package/components/contract/recipes/checkbox.ts +33 -0
  14. package/components/contract/recipes/divider.ts +9 -0
  15. package/components/contract/recipes/fab.ts +31 -0
  16. package/components/contract/recipes/feedback.ts +66 -0
  17. package/components/contract/recipes/formcontrol.ts +16 -0
  18. package/components/contract/recipes/heading.ts +16 -0
  19. package/components/contract/recipes/icon.ts +40 -0
  20. package/components/contract/recipes/index.ts +30 -0
  21. package/components/contract/recipes/input.ts +39 -0
  22. package/components/contract/recipes/layout.ts +44 -0
  23. package/components/contract/recipes/link.ts +6 -0
  24. package/components/contract/recipes/modal.ts +40 -0
  25. package/components/contract/recipes/overlay.ts +250 -0
  26. package/components/contract/recipes/progress.ts +27 -0
  27. package/components/contract/recipes/radio.ts +39 -0
  28. package/components/contract/recipes/select.ts +63 -0
  29. package/components/contract/recipes/skeleton.ts +25 -0
  30. package/components/contract/recipes/slider.ts +50 -0
  31. package/components/contract/recipes/spinner.ts +12 -0
  32. package/components/contract/recipes/switch.ts +26 -0
  33. package/components/contract/recipes/table.ts +37 -0
  34. package/components/contract/recipes/tabs.ts +31 -0
  35. package/components/contract/recipes/text.ts +12 -0
  36. package/components/contract/recipes/textarea.ts +37 -0
  37. package/components/contract/recipes/util.ts +15 -0
  38. package/components/contract/theme.ts +116 -0
  39. package/components/contract/types.ts +598 -0
  40. package/components/providers/css-vars.ts +43 -0
  41. package/components/providers/flipova/components/Accordion.tsx +41 -0
  42. package/components/providers/flipova/components/ActionSheet.tsx +34 -0
  43. package/components/providers/flipova/components/Alert.tsx +15 -0
  44. package/components/providers/flipova/components/AlertDialog.tsx +31 -0
  45. package/components/providers/flipova/components/Avatar.tsx +30 -0
  46. package/components/providers/flipova/components/Badge.tsx +14 -0
  47. package/components/providers/flipova/components/BottomSheet.tsx +24 -0
  48. package/components/providers/flipova/components/Box.tsx +1 -0
  49. package/components/providers/flipova/components/Button.tsx +31 -0
  50. package/components/providers/flipova/components/Calendar.tsx +85 -0
  51. package/components/providers/flipova/components/Card.tsx +13 -0
  52. package/components/providers/flipova/components/Center.tsx +11 -0
  53. package/components/providers/flipova/components/Checkbox.tsx +24 -0
  54. package/components/providers/flipova/components/DateTimePicker.tsx +45 -0
  55. package/components/providers/flipova/components/Divider.tsx +9 -0
  56. package/components/providers/flipova/components/Drawer.tsx +18 -0
  57. package/components/providers/flipova/components/Fab.tsx +22 -0
  58. package/components/providers/flipova/components/FlatList.tsx +1 -0
  59. package/components/providers/flipova/components/FormControl.tsx +27 -0
  60. package/components/providers/flipova/components/Grid.tsx +18 -0
  61. package/components/providers/flipova/components/HStack.tsx +13 -0
  62. package/components/providers/flipova/components/Heading.tsx +19 -0
  63. package/components/providers/flipova/components/Icon.tsx +20 -0
  64. package/components/providers/flipova/components/Image.tsx +1 -0
  65. package/components/providers/flipova/components/ImageBackground.tsx +1 -0
  66. package/components/providers/flipova/components/ImageViewer.tsx +25 -0
  67. package/components/providers/flipova/components/Input.tsx +29 -0
  68. package/components/providers/flipova/components/InputAccessoryView.tsx +1 -0
  69. package/components/providers/flipova/components/KeyboardAvoidingView.tsx +1 -0
  70. package/components/providers/flipova/components/Link.tsx +21 -0
  71. package/components/providers/flipova/components/LiquidGlass.tsx +13 -0
  72. package/components/providers/flipova/components/Menu.tsx +43 -0
  73. package/components/providers/flipova/components/Modal.tsx +24 -0
  74. package/components/providers/flipova/components/Popover.tsx +23 -0
  75. package/components/providers/flipova/components/Portal.tsx +42 -0
  76. package/components/providers/flipova/components/Pressable.tsx +1 -0
  77. package/components/providers/flipova/components/Progress.tsx +22 -0
  78. package/components/providers/flipova/components/RadioGroup.tsx +36 -0
  79. package/components/providers/flipova/components/RefreshControl.tsx +1 -0
  80. package/components/providers/flipova/components/SafeAreaView.tsx +1 -0
  81. package/components/providers/flipova/components/ScrollView.tsx +1 -0
  82. package/components/providers/flipova/components/SectionList.tsx +1 -0
  83. package/components/providers/flipova/components/Select.tsx +61 -0
  84. package/components/providers/flipova/components/Skeleton.tsx +25 -0
  85. package/components/providers/flipova/components/Slider.tsx +52 -0
  86. package/components/providers/flipova/components/Spinner.tsx +19 -0
  87. package/components/providers/flipova/components/StatusBar.tsx +1 -0
  88. package/components/providers/flipova/components/Switch.tsx +21 -0
  89. package/components/providers/flipova/components/Table.tsx +33 -0
  90. package/components/providers/flipova/components/Tabs.tsx +39 -0
  91. package/components/providers/flipova/components/Text.tsx +13 -0
  92. package/components/providers/flipova/components/Textarea.tsx +28 -0
  93. package/components/providers/flipova/components/Toast.tsx +28 -0
  94. package/components/providers/flipova/components/Tooltip.tsx +34 -0
  95. package/components/providers/flipova/components/VStack.tsx +13 -0
  96. package/components/providers/flipova/components/View.tsx +1 -0
  97. package/components/providers/flipova/components/VirtualizedList.tsx +1 -0
  98. package/components/providers/flipova/index.tsx +189 -0
  99. package/components/providers/gluestack/index.tsx +226 -0
  100. package/components/providers/gluestack/more.tsx +151 -0
  101. package/components/{ui → providers/gluestack/ui}/accordion/index.tsx +2 -2
  102. package/components/{ui → providers/gluestack/ui}/actionsheet/index.tsx +15 -15
  103. package/components/{ui → providers/gluestack/ui}/alert/index.tsx +1 -1
  104. package/components/{ui → providers/gluestack/ui}/alert-dialog/index.tsx +3 -3
  105. package/components/{ui → providers/gluestack/ui}/badge/index.tsx +2 -2
  106. package/components/{ui → providers/gluestack/ui}/bottomsheet/index.tsx +11 -10
  107. package/components/{ui → providers/gluestack/ui}/box/index.tsx +4 -1
  108. package/components/{ui → providers/gluestack/ui}/button/index.tsx +1 -1
  109. package/components/{ui → providers/gluestack/ui}/calendar/index.tsx +4 -4
  110. package/components/{ui → providers/gluestack/ui}/card/index.tsx +1 -1
  111. package/components/{ui → providers/gluestack/ui}/center/index.tsx +1 -1
  112. package/components/{ui → providers/gluestack/ui}/checkbox/index.tsx +9 -8
  113. package/components/{ui → providers/gluestack/ui}/date-time-picker/index.tsx +4 -4
  114. package/components/providers/gluestack/ui/date-time-picker/index.web.tsx +197 -0
  115. package/components/{ui → providers/gluestack/ui}/divider/index.tsx +1 -1
  116. package/components/{ui → providers/gluestack/ui}/drawer/index.tsx +2 -2
  117. package/components/{ui → providers/gluestack/ui}/fab/index.tsx +1 -1
  118. package/components/{ui → providers/gluestack/ui}/form-control/index.tsx +3 -3
  119. package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/config.ts +1 -62
  120. package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.js +1 -1
  121. package/components/{ui → providers/gluestack/ui}/grid/index.tsx +3 -3
  122. package/components/{ui → providers/gluestack/ui}/heading/index.tsx +7 -7
  123. package/components/{ui → providers/gluestack/ui}/hstack/index.tsx +1 -1
  124. package/components/{ui → providers/gluestack/ui}/icon/index.tsx +1 -1
  125. package/components/{ui → providers/gluestack/ui}/image/index.tsx +0 -1
  126. package/components/{ui → providers/gluestack/ui}/image-viewer/index.tsx +96 -99
  127. package/components/providers/gluestack/ui/index.ts +58 -0
  128. package/components/{ui → providers/gluestack/ui}/input/index.tsx +1 -1
  129. package/components/{ui → providers/gluestack/ui}/link/index.tsx +2 -2
  130. package/components/{ui → providers/gluestack/ui}/liquid-glass/index.tsx +2 -2
  131. package/components/{ui → providers/gluestack/ui}/menu/index.tsx +5 -4
  132. package/components/{ui → providers/gluestack/ui}/modal/index.tsx +19 -17
  133. package/components/{ui → providers/gluestack/ui}/popover/index.tsx +4 -4
  134. package/components/{ui → providers/gluestack/ui}/portal/index.tsx +1 -1
  135. package/components/{ui → providers/gluestack/ui}/progress/index.tsx +2 -2
  136. package/components/{ui → providers/gluestack/ui}/radio/index.tsx +1 -1
  137. package/components/{ui → providers/gluestack/ui}/select/index.tsx +8 -12
  138. package/components/{ui → providers/gluestack/ui}/select/select-actionsheet.tsx +13 -13
  139. package/components/{ui → providers/gluestack/ui}/skeleton/index.tsx +2 -2
  140. package/components/{ui → providers/gluestack/ui}/slider/index.tsx +1 -1
  141. package/components/{ui → providers/gluestack/ui}/spinner/index.tsx +2 -2
  142. package/components/{ui → providers/gluestack/ui}/table/index.tsx +33 -33
  143. package/components/{ui → providers/gluestack/ui}/tabs/TabsAnimatedIndicator.tsx +1 -1
  144. package/components/{ui → providers/gluestack/ui}/tabs/index.tsx +2 -2
  145. package/components/{ui → providers/gluestack/ui}/text/index.tsx +1 -1
  146. package/components/{ui → providers/gluestack/ui}/toast/index.tsx +4 -4
  147. package/components/{ui → providers/gluestack/ui}/tooltip/index.tsx +1 -1
  148. package/components/{ui → providers/gluestack/ui}/vstack/index.tsx +1 -1
  149. package/components/providers/index.ts +2 -0
  150. package/components/providers/paper/index.tsx +449 -0
  151. package/components/providers/provider.tsx +80 -0
  152. package/components/providers/reusables/classes.ts +163 -0
  153. package/components/providers/reusables/index.tsx +289 -0
  154. package/components/providers/rn-base/Box.tsx +7 -0
  155. package/components/providers/rn-base/FlatList.tsx +16 -0
  156. package/components/providers/rn-base/Image.tsx +18 -0
  157. package/components/providers/rn-base/ImageBackground.tsx +11 -0
  158. package/components/providers/rn-base/InputAccessoryView.tsx +9 -0
  159. package/components/providers/rn-base/KeyboardAvoidingView.tsx +15 -0
  160. package/components/providers/rn-base/Pressable.tsx +19 -0
  161. package/components/providers/rn-base/RefreshControl.tsx +16 -0
  162. package/components/providers/rn-base/SafeAreaView.tsx +11 -0
  163. package/components/providers/rn-base/ScrollView.tsx +11 -0
  164. package/components/providers/rn-base/SectionList.tsx +22 -0
  165. package/components/providers/rn-base/StatusBar.tsx +17 -0
  166. package/components/providers/rn-base/View.tsx +7 -0
  167. package/components/providers/rn-base/VirtualizedList.tsx +18 -0
  168. package/components/providers/rn-base/index.tsx +64 -0
  169. package/components/providers/tamagui/index.tsx +375 -0
  170. package/components/providers/types.ts +17 -0
  171. package/components/theme/design-theme.ts +230 -0
  172. package/components/ui/create.tsx +14 -0
  173. package/components/ui/index.ts +68 -58
  174. package/components/ui/resolve.ts +40 -0
  175. package/design/canonical.index.txt +2 -16
  176. package/design/manifest.xml +4 -3
  177. package/design/schema.xsd +44 -434
  178. package/design/themes.xml +7 -177
  179. package/design/tools/{npm.js → cli.js} +173 -73
  180. package/design/tools/gui/index.html +998 -0
  181. package/design/tools/lib/check.js +533 -0
  182. package/design/tools/lib/contract.js +23 -0
  183. package/design/tools/lib/edit.js +166 -0
  184. package/design/tools/lib/generate.js +465 -0
  185. package/design/tools/lib/gui.js +614 -0
  186. package/design/tools/lib/lint.js +139 -0
  187. package/design/tools/lib/registry.js +135 -0
  188. package/design/tools/lib/util.js +53 -0
  189. package/design/tools/lib/xml.js +257 -0
  190. package/design/tools/lib/xsd.js +408 -0
  191. package/dist/chunk-2QM2ZUDS.mjs +1308 -0
  192. package/dist/chunk-2QM2ZUDS.mjs.map +1 -0
  193. package/dist/chunk-2T2TCUYF.js +1371 -0
  194. package/dist/chunk-2T2TCUYF.js.map +1 -0
  195. package/dist/chunk-6UKTC4KF.js +43 -0
  196. package/dist/chunk-6UKTC4KF.js.map +1 -0
  197. package/dist/chunk-6Z4WRTI4.mjs +37 -0
  198. package/dist/chunk-6Z4WRTI4.mjs.map +1 -0
  199. package/dist/chunk-G3K6J5KY.js +157 -0
  200. package/dist/chunk-G3K6J5KY.js.map +1 -0
  201. package/dist/chunk-GM45RCSI.mjs +96 -0
  202. package/dist/chunk-GM45RCSI.mjs.map +1 -0
  203. package/dist/chunk-GQJLHH2P.mjs +3 -0
  204. package/dist/chunk-GQJLHH2P.mjs.map +1 -0
  205. package/dist/chunk-ICNR56VP.js +1653 -0
  206. package/dist/chunk-ICNR56VP.js.map +1 -0
  207. package/dist/chunk-J5LGTIGS.mjs +9 -0
  208. package/dist/chunk-J5LGTIGS.mjs.map +1 -0
  209. package/dist/chunk-LRPZLF2K.mjs +30 -0
  210. package/dist/chunk-LRPZLF2K.mjs.map +1 -0
  211. package/dist/chunk-OC4MXNXU.js +32 -0
  212. package/dist/chunk-OC4MXNXU.js.map +1 -0
  213. package/dist/chunk-PZ5AY32C.js +11 -0
  214. package/dist/chunk-PZ5AY32C.js.map +1 -0
  215. package/dist/chunk-RWVTZUEG.js +161 -0
  216. package/dist/chunk-RWVTZUEG.js.map +1 -0
  217. package/dist/chunk-V473I5XQ.js +4 -0
  218. package/dist/chunk-V473I5XQ.js.map +1 -0
  219. package/dist/chunk-V4ULAISZ.js +915 -0
  220. package/dist/chunk-V4ULAISZ.js.map +1 -0
  221. package/dist/chunk-WRJERTJS.mjs +145 -0
  222. package/dist/chunk-WRJERTJS.mjs.map +1 -0
  223. package/dist/chunk-YIBPE3KQ.mjs +864 -0
  224. package/dist/chunk-YIBPE3KQ.mjs.map +1 -0
  225. package/dist/chunk-YUAQIZPN.mjs +1556 -0
  226. package/dist/chunk-YUAQIZPN.mjs.map +1 -0
  227. package/dist/contract/index.d.mts +304 -0
  228. package/dist/contract/index.d.ts +304 -0
  229. package/dist/contract/index.js +256 -0
  230. package/dist/contract/index.js.map +1 -0
  231. package/dist/contract/index.mjs +3 -0
  232. package/dist/contract/index.mjs.map +1 -0
  233. package/dist/index.d.mts +4 -40
  234. package/dist/index.d.ts +4 -40
  235. package/dist/index.js +73 -992
  236. package/dist/index.mjs +2 -1
  237. package/dist/providers/flipova/index.d.mts +133 -0
  238. package/dist/providers/flipova/index.d.ts +133 -0
  239. package/dist/providers/flipova/index.js +249 -0
  240. package/dist/providers/flipova/index.js.map +1 -0
  241. package/dist/providers/flipova/index.mjs +4 -0
  242. package/dist/providers/flipova/index.mjs.map +1 -0
  243. package/dist/providers/gluestack/index.d.mts +7 -0
  244. package/dist/providers/gluestack/index.d.ts +7 -0
  245. package/dist/providers/gluestack/index.js +240 -0
  246. package/dist/providers/gluestack/index.js.map +1 -0
  247. package/dist/providers/gluestack/index.mjs +238 -0
  248. package/dist/providers/gluestack/index.mjs.map +1 -0
  249. package/dist/providers/gluestack/ui/index.d.mts +3472 -0
  250. package/dist/providers/gluestack/ui/index.d.ts +3472 -0
  251. package/dist/{chunk-LCTFQJZM.js → providers/gluestack/ui/index.js} +860 -2297
  252. package/dist/providers/gluestack/ui/index.js.map +1 -0
  253. package/dist/{chunk-2R66P5X5.mjs → providers/gluestack/ui/index.mjs} +468 -2062
  254. package/dist/providers/gluestack/ui/index.mjs.map +1 -0
  255. package/dist/providers/index.d.mts +37 -0
  256. package/dist/providers/index.d.ts +37 -0
  257. package/dist/providers/index.js +28 -0
  258. package/dist/providers/index.js.map +1 -0
  259. package/dist/providers/index.mjs +3 -0
  260. package/dist/providers/index.mjs.map +1 -0
  261. package/dist/providers/paper/index.d.mts +30 -0
  262. package/dist/providers/paper/index.d.ts +30 -0
  263. package/dist/providers/paper/index.js +362 -0
  264. package/dist/providers/paper/index.js.map +1 -0
  265. package/dist/providers/paper/index.mjs +353 -0
  266. package/dist/providers/paper/index.mjs.map +1 -0
  267. package/dist/providers/reusables/index.d.mts +60 -0
  268. package/dist/providers/reusables/index.d.ts +60 -0
  269. package/dist/providers/reusables/index.js +348 -0
  270. package/dist/providers/reusables/index.js.map +1 -0
  271. package/dist/providers/reusables/index.mjs +311 -0
  272. package/dist/providers/reusables/index.mjs.map +1 -0
  273. package/dist/providers/tamagui/index.d.mts +15 -0
  274. package/dist/providers/tamagui/index.d.ts +15 -0
  275. package/dist/providers/tamagui/index.js +275 -0
  276. package/dist/providers/tamagui/index.js.map +1 -0
  277. package/dist/providers/tamagui/index.mjs +270 -0
  278. package/dist/providers/tamagui/index.mjs.map +1 -0
  279. package/dist/theme-BznFrVT1.d.mts +566 -0
  280. package/dist/theme-BznFrVT1.d.ts +566 -0
  281. package/dist/types-C7P80VKR.d.ts +22 -0
  282. package/dist/types-Tspvmask.d.mts +22 -0
  283. package/dist/ui/index.d.mts +190 -7017
  284. package/dist/ui/index.d.ts +190 -7017
  285. package/dist/ui/index.js +73 -992
  286. package/dist/ui/index.mjs +2 -1
  287. package/package.json +136 -35
  288. package/components/ui/date-time-picker/index.web.tsx +0 -195
  289. package/design/documentation.xml +0 -607
  290. package/design/tools/design.js +0 -188
  291. package/design/tools/requirements.txt +0 -35
  292. package/design/tools/sources/.checker/__init__.py +0 -81
  293. package/design/tools/sources/.checker/checks.py +0 -198
  294. package/design/tools/sources/.checker/cli.py +0 -154
  295. package/design/tools/sources/.checker/io.py +0 -242
  296. package/design/tools/sources/.checker/model.py +0 -144
  297. package/design/tools/sources/.checker/registry.py +0 -115
  298. package/design/tools/sources/.checker/report.py +0 -21
  299. package/design/tools/sources/.docgen/__init__.py +0 -45
  300. package/design/tools/sources/.docgen/cli.py +0 -101
  301. package/design/tools/sources/.docgen/model.py +0 -147
  302. package/design/tools/sources/.docgen/reference.py +0 -97
  303. package/design/tools/sources/.docgen/site.py +0 -145
  304. package/design/tools/sources/.docgen/xsddoc.py +0 -329
  305. package/design/tools/sources/.generate/__init__.py +0 -35
  306. package/design/tools/sources/.generate/cli.py +0 -76
  307. package/design/tools/sources/.generate/common.py +0 -33
  308. package/design/tools/sources/.generate/config.py +0 -177
  309. package/design/tools/sources/.generate/model.py +0 -51
  310. package/design/tools/sources/.generate/tokens.py +0 -141
  311. package/design/tools/sources/.linter/__init__.py +0 -9
  312. package/design/tools/sources/.linter/cli.py +0 -44
  313. package/design/tools/sources/.linter/discovery.py +0 -30
  314. package/design/tools/sources/.linter/errors.py +0 -45
  315. package/design/tools/sources/.linter/linter.py +0 -68
  316. package/design/tools/sources/.xmleditor/__init__.py +0 -74
  317. package/design/tools/sources/.xmleditor/blocks.py +0 -185
  318. package/design/tools/sources/.xmleditor/cli.py +0 -141
  319. package/design/tools/sources/.xmleditor/editor.py +0 -906
  320. package/design/tools/sources/.xmleditor/model.py +0 -708
  321. package/design/tools/sources/.xmleditor/widgets.py +0 -1832
  322. package/design/tools/sources/.xmleditor/xsdmodel.py +0 -753
  323. package/design/tools/sources/checker.py +0 -55
  324. package/design/tools/sources/docgen.py +0 -66
  325. package/design/tools/sources/generate.py +0 -48
  326. package/design/tools/sources/linter.py +0 -54
  327. package/design/tools/sources/ruff.toml +0 -12
  328. package/design/tools/sources/xmleditor.py +0 -62
  329. package/design/tools/unix/_venv_python.sh +0 -16
  330. package/design/tools/unix/check.sh +0 -13
  331. package/design/tools/unix/doc.sh +0 -14
  332. package/design/tools/unix/gen.sh +0 -14
  333. package/design/tools/unix/lint.sh +0 -10
  334. package/design/tools/unix/run.sh +0 -20
  335. package/design/tools/unix/verify.sh +0 -12
  336. package/design/tools/unix/xmledit.sh +0 -12
  337. package/design/tools/windows/check.cmd +0 -12
  338. package/design/tools/windows/doc.cmd +0 -12
  339. package/design/tools/windows/gen.cmd +0 -11
  340. package/design/tools/windows/lint.cmd +0 -9
  341. package/design/tools/windows/run.cmd +0 -26
  342. package/design/tools/windows/verify.cmd +0 -10
  343. package/design/tools/windows/xmledit.cmd +0 -10
  344. package/dist/chunk-2R66P5X5.mjs.map +0 -1
  345. package/dist/chunk-LCTFQJZM.js.map +0 -1
  346. /package/components/{ui → providers/gluestack/ui}/accordion/ANIMATION_CUSTOMIZATION.md +0 -0
  347. /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedHeight.tsx +0 -0
  348. /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedIcon.tsx +0 -0
  349. /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedHeight.tsx +0 -0
  350. /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedIcon.tsx +0 -0
  351. /package/components/{ui → providers/gluestack/ui}/accordion/MIGRATION_SUMMARY.md +0 -0
  352. /package/components/{ui → providers/gluestack/ui}/accordion/USAGE_EXAMPLE.tsx +0 -0
  353. /package/components/{ui → providers/gluestack/ui}/accordion/animation-config.ts +0 -0
  354. /package/components/{ui → providers/gluestack/ui}/avatar/index.tsx +0 -0
  355. /package/components/{ui → providers/gluestack/ui}/box/index.web.tsx +0 -0
  356. /package/components/{ui → providers/gluestack/ui}/box/styles.tsx +0 -0
  357. /package/components/{ui → providers/gluestack/ui}/calendar/creator.tsx +0 -0
  358. /package/components/{ui → providers/gluestack/ui}/calendar/styles.tsx +0 -0
  359. /package/components/{ui → providers/gluestack/ui}/card/index.web.tsx +0 -0
  360. /package/components/{ui → providers/gluestack/ui}/card/styles.tsx +0 -0
  361. /package/components/{ui → providers/gluestack/ui}/center/index.web.tsx +0 -0
  362. /package/components/{ui → providers/gluestack/ui}/center/styles.tsx +0 -0
  363. /package/components/{ui → providers/gluestack/ui}/date-time-picker/creator.tsx +0 -0
  364. /package/components/{ui → providers/gluestack/ui}/date-time-picker/styles.tsx +0 -0
  365. /package/components/{ui → providers/gluestack/ui}/flat-list/index.tsx +0 -0
  366. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.tsx +0 -0
  367. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.web.tsx +0 -0
  368. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/script.ts +0 -0
  369. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/theme-context.ts +0 -0
  370. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.d.ts +0 -0
  371. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/useGluestackColors.ts +0 -0
  372. /package/components/{ui → providers/gluestack/ui}/grid/index.web.tsx +0 -0
  373. /package/components/{ui → providers/gluestack/ui}/grid/styles.tsx +0 -0
  374. /package/components/{ui → providers/gluestack/ui}/heading/index.web.tsx +0 -0
  375. /package/components/{ui → providers/gluestack/ui}/heading/styles.tsx +0 -0
  376. /package/components/{ui → providers/gluestack/ui}/hstack/index.web.tsx +0 -0
  377. /package/components/{ui → providers/gluestack/ui}/hstack/styles.tsx +0 -0
  378. /package/components/{ui → providers/gluestack/ui}/icon/index.web.tsx +0 -0
  379. /package/components/{ui → providers/gluestack/ui}/image-background/index.tsx +0 -0
  380. /package/components/{ui → providers/gluestack/ui}/image-viewer/index.web.tsx +0 -0
  381. /package/components/{ui → providers/gluestack/ui}/input-accessory-view/index.tsx +0 -0
  382. /package/components/{ui → providers/gluestack/ui}/keyboard-avoiding-view/index.tsx +0 -0
  383. /package/components/{ui → providers/gluestack/ui}/pressable/index.tsx +0 -0
  384. /package/components/{ui → providers/gluestack/ui}/refresh-control/index.tsx +0 -0
  385. /package/components/{ui → providers/gluestack/ui}/safe-area-view/index.tsx +0 -0
  386. /package/components/{ui → providers/gluestack/ui}/scroll-view/index.tsx +0 -0
  387. /package/components/{ui → providers/gluestack/ui}/section-list/index.tsx +0 -0
  388. /package/components/{ui → providers/gluestack/ui}/skeleton/index.web.tsx +0 -0
  389. /package/components/{ui → providers/gluestack/ui}/skeleton/styles.tsx +0 -0
  390. /package/components/{ui → providers/gluestack/ui}/status-bar/index.tsx +0 -0
  391. /package/components/{ui → providers/gluestack/ui}/switch/index.tsx +0 -0
  392. /package/components/{ui → providers/gluestack/ui}/table/index.web.tsx +0 -0
  393. /package/components/{ui → providers/gluestack/ui}/table/styles.tsx +0 -0
  394. /package/components/{ui → providers/gluestack/ui}/tabs/animation-config.ts +0 -0
  395. /package/components/{ui → providers/gluestack/ui}/tabs/creator.tsx +0 -0
  396. /package/components/{ui → providers/gluestack/ui}/text/index.web.tsx +0 -0
  397. /package/components/{ui → providers/gluestack/ui}/text/styles.tsx +0 -0
  398. /package/components/{ui → providers/gluestack/ui}/textarea/index.tsx +0 -0
  399. /package/components/{ui → providers/gluestack/ui}/view/index.tsx +0 -0
  400. /package/components/{ui → providers/gluestack/ui}/virtualized-list/index.tsx +0 -0
  401. /package/components/{ui → providers/gluestack/ui}/vstack/index.web.tsx +0 -0
  402. /package/components/{ui → providers/gluestack/ui}/vstack/styles.tsx +0 -0
package/README.md CHANGED
@@ -3,153 +3,204 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@flipova/foundation.svg)](https://www.npmjs.com/package/@flipova/foundation)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- gluestack-ui components for React Native (iOS, Android) and Web, plus a
7
- registry-driven theming pipeline.
6
+ UI components for React Native (iOS, Android) and Web, with **one design applied to everything**.
7
+ Write `<Button>` once; choose which library renders it (Flipova's own, gluestack, React Native
8
+ Reusables, React Native Paper, Tamagui) in one line; the look comes from your own XML themes,
9
+ which you edit visually with `npx flipova-design gui`.
8
10
 
9
- ## Design pipeline
10
-
11
- The design pipeline has a single function:
12
-
13
- > **`design/tokens.xml` + `design/themes.xml`**
14
- >
15
- > - -> `components/ui/gluestack-ui-provider/config.ts` (gluestack / nativewind colour vars)
16
- > - -> `components/ui/gluestack-ui-provider/tokens.js` (Tailwind/nativewind token theme)
17
-
18
- Role ids in `themes.xml` are the gluestack CSS variable names (dash-prefixed at
19
- generation time), so the design registry and the runtime theme config always
20
- speak the same language. Every colour is emitted as a space-separated RGB
21
- triplet, enabling Tailwind opacity modifiers such as `bg-primary/50`.
22
-
23
- The scale tokens (spacing, radii, breakpoints, typography, shadow, z-index,
24
- opacity, motion) are emitted as a Tailwind `theme` fragment, and the semantic
25
- colours are derived from the `themes.xml` roles. `tailwind.config.js` contains
26
- **no design value**: it just does `extend: tokens.theme`. The XML registries are
27
- therefore the single source of truth for both the gluestack runtime vars and
28
- the Tailwind/nativewind theme.
29
-
30
- ```bash
31
- npm run design:pipeline # gen + check + verify + lint + doc
32
- ```
33
-
34
- | Script | What it does |
35
- | :------------------------- | :--------------------------------------------------- |
36
- | `npm run design:gen` | compile tokens/themes into `config.ts` + `tokens.js` |
37
- | `npm run design:gen:check` | verify regeneration is a no-op (drift check) |
38
- | `npm run design:check` | determinism rules + XSD pass + ruff |
39
- | `npm run design:verify` | verify the committed canonical index |
40
- | `npm run design:canonical` | re-emit `design/canonical.index.txt` |
41
- | `npm run design:lint` | XSD-validate every design XML |
42
- | `npm run design:doc` | regenerate the docs site (`docs/generated`) |
43
- | `npm run design:edit` | open the XSD-driven XML editor |
44
-
45
- Never hand-edit the generated `config.ts`, `tokens.js` or `docs/generated/**` -
46
- the next run overwrites them. And never add a design value to
47
- `tailwind.config.js`: it only wires the generated theme.
48
-
49
- ## Install
11
+ ## Quick start
50
12
 
51
13
  ```bash
52
14
  npm install @flipova/foundation
53
- npm install gluestack-ui
54
- npx flipova-design init
15
+ npx flipova-design adopt # copies the neutral starter themes into your project, writes theme/provider.tsx
16
+ npx flipova-design gui # edit colours, scales and themes visually (or edit design/*.xml by hand)
17
+ npm run design:gen # -> theme/design-theme.ts (+ Tailwind artifacts)
55
18
  ```
56
19
 
57
- `init` **does not copy the registries into your project**. The XML registries and
58
- the whole toolchain stay in `node_modules/@flipova/foundation/design`, and the
59
- command only injects the app-level wiring that the package cannot own:
60
-
61
- - `tailwind.config.js`, `postcss.config.js`, `globals.css` - created only when
62
- missing (never overwritten unless `--force`);
63
- - the `design:*` npm scripts in your `package.json` (`design:gen`, `design:lint`,
64
- `design:check`, `design:verify`, `design:canonical`, `design:doc`,
65
- `design:pipeline`).
66
-
67
- | Command | What it does |
68
- | :--------------------------------- | :---------------------------------------------------- |
69
- | `npx flipova-design where` | print the resolved registries/artifacts paths |
70
- | `npx flipova-design inject` | re-run the injection only |
71
- | `npx flipova-design adopt` | copy the registries into the project and own them |
72
- | `npx flipova-design gen [--check]` | compile the registries into `config.ts` + `tokens.js` |
73
- | `npx flipova-design lint` | XSD-validate the registries |
74
-
75
- `gen` writes into the resolved output root, i.e. straight into the installed
76
- package (`node_modules/@flipova/foundation/components/ui/gluestack-ui-provider`),
77
- so the artifacts consumed by `@flipova/foundation/tokens` and
78
- `@flipova/foundation/ui` are always the ones the pipeline produced.
79
-
80
- ## Own the design system
20
+ ```tsx
21
+ import { AppThemeProvider } from './theme/provider';
22
+ import { Button, Card, Heading, Input, Select, Tabs } from '@flipova/foundation';
23
+
24
+ export default () => (
25
+ <AppThemeProvider mode="system">
26
+ <Card>
27
+ <Heading>Sign in</Heading>
28
+ <Input placeholder="Email" />
29
+ <Button onPress={signIn}>Continue</Button>
30
+ </Card>
31
+ </AppThemeProvider>
32
+ );
33
+ ```
81
34
 
82
- An app that wants its own branding adopts the registries:
35
+ `theme/provider.tsx` is yours: it names the library and hands your generated theme to the components.
83
36
 
84
- ```bash
85
- npx flipova-design adopt
37
+ ```tsx
38
+ <FlipovaProvider adapter={flipova} theme={designTheme} mode={mode}>
86
39
  ```
87
40
 
88
- That copies `manifest.xml`, `schema.xsd`, `tokens.xml`, `themes.xml`,
89
- `documentation.xml` and `canonical.index.txt` into `design/` - and **not** the
90
- toolchain, which stays in `node_modules`. It rewrites the manifest outputs to
91
- `theme/config.ts` and `theme/tokens.js`, and creates `theme/provider.tsx`.
41
+ Switch library by changing `flipova` to `paper`, `tamagui`, `reusables` or `gluestack`
42
+ (each imported from `@flipova/foundation/providers/<name>`). Nothing else changes.
92
43
 
93
- From then on the project is the source of truth:
44
+ ## Where things are
94
45
 
95
- ```bash
96
- # edit design/tokens.xml and design/themes.xml - the colours, the scales, the roles
97
- npm run design:gen # -> theme/config.ts + theme/tokens.js
98
- npm run design:verify # the registries are in step with the artifacts
99
- npm run design:check # determinism + XSD, on YOUR registries
46
+ ```
47
+ components/
48
+ theme/ design-theme.ts generated from your XML: every colour of every theme, every scale
49
+ contract/ what a component is props (types.ts) + recipes/ (one pure function per component: the exact
50
+ colours, radii, spacings, sizes) + theme resolution
51
+ providers/
52
+ provider.tsx <FlipovaProvider> mounts one library with one theme
53
+ rn-base/ React Native's own components, shared by every adapter
54
+ flipova/ Flipova's own all 57 components, built from react-native only, styled only by the recipes
55
+ gluestack/ gluestack-ui adapter (31 native) + ui/ (the whole gluestack catalogue, as it was)
56
+ reusables/ React Native Reusables adapter (31 native), NativeWind classes
57
+ paper/ React Native Paper adapter (31 native)
58
+ tamagui/ Tamagui adapter (32 native)
59
+ ui/ the unified components import { Button } from '@flipova/foundation' (or '/ui')
60
+ design/ the XML registries, the schema, and the toolchain (tools/: CLI, generator, checker, GUI)
100
61
  ```
101
62
 
102
- Wire the two artifacts into the app:
63
+ **The unified `ui`** renders, for each component, the one the chosen library offers, with the design
64
+ applied. When the library does not have it, the **flipova provider** serves it (and when no provider
65
+ is mounted at all, flipova with the bundled neutral theme), so there is never a hole.
66
+
67
+ The contract is **the whole gluestack catalogue: 57 components**. flipova implements all of them; every other
68
+ provider implements natively what its library really has and the tests can verify, and the rest is served by
69
+ flipova. The exact table is [`COMPONENTS.md`](COMPONENTS.md) (generated), and `coverageOf(adapter)` tells it in code.
70
+
71
+ | Provider | Native | of which the library's own | of which React Native's (shared) | Served by flipova |
72
+ | :-------- | -----: | -------------------------: | -------------------------------: | ----------------: |
73
+ | flipova | 57 | 43 | 14 | 0 |
74
+ | gluestack | 31 | 31 | 0 | 26 |
75
+ | reusables | 31 | 19 | 12 | 26 |
76
+ | paper | 31 | 17 | 14 | 26 |
77
+ | tamagui | 32 | 20 | 12 | 25 |
78
+
79
+ Every adapter is native for more than half of the contract. "React Native's" are the 14 components that are React
80
+ Native itself (View, ScrollView, FlatList, SectionList, VirtualizedList, SafeAreaView, KeyboardAvoidingView,
81
+ StatusBar, RefreshControl, InputAccessoryView, Image, ImageBackground, Pressable, Box): no library replaces them,
82
+ so they live once in `providers/rn-base` and every adapter that does not wrap its own serves that one.
83
+
84
+ **Alignment check** (`components/alignment.test.ts`, part of `npm test`): every directory of the gluestack catalogue
85
+ must be mapped to a contract name (a new one fails until it is), the mapping is one to one with `UI_NAMES`, flipova
86
+ has a file for every name, the unified `ui` exports every name, adapters declare only names of the contract, and
87
+ `COMPONENTS.md` is up to date (`npm run components:doc` rewrites it).
88
+
89
+ Honest limits: four gluestack modules (bottomsheet, date-time-picker, image-viewer, slider) cannot be loaded by
90
+ the test environment (native-only or missing dependencies), so no gluestack wrapper is declared for them. The
91
+ animation libraries gluestack's overlays use (react-native-reanimated, @legendapp/motion) are replaced in tests by
92
+ stand-ins in `test-support/` (plain views, no animation): what is verified is the gluestack component and its
93
+ wrapper, not the animation. Components gluestack has but that still fall back (Accordion, Menu, Popover, Select,
94
+ Tabs, Toast, Tooltip...) are listed with the reason in COMPONENTS.md; adding a wrapper is: write it in the adapter,
95
+ add it to its `components`, `npm run components:doc`.
96
+
97
+ Props are the same on every provider (`components/contract/types.ts`). Icons are text glyphs (no SVG
98
+ dependency), Calendar and DateTimePicker work on dates only (`YYYY-MM-DD`), and `Portal` content is drawn by the
99
+ flipova provider's host.
100
+
101
+ To go straight to one library's own components, import from its sub-path
102
+ (`@flipova/foundation/providers/paper`, `.../providers/gluestack/ui` for the whole gluestack catalogue, ...).
103
+ Only that sub-path imports the library, which is an **optional peer dependency**: the root, `/ui`,
104
+ `/contract`, `/providers` and `/providers/flipova` need nothing but `react` and `react-native`.
105
+
106
+ | Sub-path | Library | Optional peer |
107
+ | :---------------------------------------- | :--------------------- | :---------------------- |
108
+ | `@flipova/foundation` , `/ui` | the unified components | none |
109
+ | `@flipova/foundation/providers/flipova` | Flipova's own | none |
110
+ | `@flipova/foundation/providers/gluestack` | gluestack-ui | `nativewind` |
111
+ | `@flipova/foundation/providers/reusables` | React Native Reusables | `@rn-primitives/switch` |
112
+ | `@flipova/foundation/providers/paper` | React Native Paper | `react-native-paper` |
113
+ | `@flipova/foundation/providers/tamagui` | Tamagui | `@tamagui/core` |
114
+
115
+ ## The design is yours
116
+
117
+ The package ships **no brand and no theme names**: only a neutral starter (`light` and `dark`).
118
+ `adopt` copies it into `design/` and from then on the registries are your source of truth. The
119
+ components read colour **roles** (`primary`, `card`, `border`, `success`, ...), never theme ids, so
120
+ rename, add and recolour themes freely; a light/dark pair shares a `variant`
121
+ (`<FlipovaProvider variant="brand">`). A theme must define the roles the components read
122
+ (`REQUIRED_ROLES`); the GUI, `flipova-design check` on save, and the provider all name any that are missing.
123
+
124
+ - **Tokens** (`design/tokens.xml`): colour palettes, spacing, radii, type sizes and weights, shadows, opacity, motion.
125
+ - **Themes** (`design/themes.xml`): each theme maps roles to palette colours (`$ref.tokens.color.primary.600`) or to a literal colour.
126
+
127
+ ### `npx flipova-design gui`
128
+
129
+ A local editor (nothing leaves your machine; it listens on 127.0.0.1 with a one-time token):
130
+
131
+ - **Preview**: every component, drawn from the real recipes, in the theme you pick, updated as you edit.
132
+ - **Colours**: edit any shade; build a whole palette from one colour; add or remove colours.
133
+ - **Scales**: spacing, radii, font sizes, weights, line heights, opacity, durations, z-index, breakpoints.
134
+ - **Themes**: add (copy), rename, change mode/variant, delete; map every role to a colour with a picker.
135
+ - Edits live in a working copy. **Save** validates first (determinism rules, XSD, required roles), then writes
136
+ your XML, the canonical index and the generated files. **Revert** drops the working copy.
137
+ - The preview needs the built package (`dist/`); the published package has it.
138
+
139
+ Edits are made in the text of the XML (comments and layout are kept), so the diff is what a careful hand edit would give.
140
+
141
+ ## The XML toolchain
142
+
143
+ Plain Node (>= 18, no dependency, no Python): `npx flipova-design <command>`.
144
+
145
+ | Command | What it does |
146
+ | :------------------------------------- | :-------------------------------------------------------------------------------------------------- |
147
+ | `init` | inject app-level wiring (Tailwind/PostCSS/CSS files, `design:*` scripts); never overwrites |
148
+ | `adopt` | copy the registries into the project, rewrite the outputs into `theme/`, write `theme/provider.tsx` |
149
+ | `gui [--port N] [--no-open]` | the visual editor (adopts first if the project has not) |
150
+ | `gen [--check]` | compile the registries into `design-theme.ts`, `config.ts`, `tokens.js` |
151
+ | `check`, `verify`, `canonical`, `lint` | determinism rules, canonical index, XSD |
152
+ | `pipeline` | gen, check, verify, lint |
153
+ | `where` | print the resolved paths |
154
+
155
+ `design/schema.xsd` is validated by a built-in validator for the subset of XML Schema the registries use;
156
+ a schema that uses anything else is refused when loaded rather than half-checked. Never hand-edit the
157
+ generated files; and `tailwind.config.js` holds no design value: it only wires `theme/tokens`.
103
158
 
104
159
  ```js
105
- // tailwind.config.js
160
+ // tailwind.config.js (only needed for the gluestack / reusables providers, which use NativeWind classes)
106
161
  const tokens = require('./theme/tokens');
107
162
  module.exports = { presets: [require('nativewind/preset')], theme: { extend: tokens.theme } };
108
163
  ```
109
164
 
110
- ```tsx
111
- // theme/provider.tsx (generated by adopt)
112
- import { createGluestackUIProvider } from '@flipova/foundation/ui';
113
- import { config } from './config';
114
- export const AppThemeProvider = createGluestackUIProvider(config);
115
- ```
165
+ The flipova, Paper and Tamagui providers read `theme/design-theme.ts` directly; the gluestack and reusables
166
+ providers build their CSS variables at runtime from the same theme you pass to `<FlipovaProvider>`.
116
167
 
117
- The package still provides the components, the generator and every token the app
118
- does not override. `npx flipova-design where` always says which side is in charge.
168
+ ## How "identical" is tested
119
169
 
120
- The generated theme is wired into your Tailwind config (app-level files are not
121
- shipped by the package):
170
+ Parity is on the resolved style values, not on pixels. `npm test` runs the toolchain tests (including a real
171
+ adopt, a real GUI server driven over HTTP, and the XML edits), the boundary check, and the component tests:
172
+ Reusables classes resolved back to numbers and colours and compared with the recipes; the props handed to
173
+ Paper; the Tamagui configuration; every recipe on every theme (no undefined or NaN value); the 57 flipova
174
+ components rendered through react-native-web (interaction, accessibility attributes, the app's own theme
175
+ applied, no colour literal in their source); the six shared components of the four libraries rendered in
176
+ light and dark; and the natives each library gained rendered through its adapter. Not covered: rendering on a device, and the internals Paper imposes on its own Button and
177
+ Switch (ripple, switch geometry): what is guaranteed there is what is passed to them.
122
178
 
123
- ```js
124
- // tailwind.config.js
125
- const tokens = require('@flipova/foundation/tokens');
126
- module.exports = {
127
- presets: [require('nativewind/preset')],
128
- theme: { extend: tokens.theme },
129
- };
130
- ```
179
+ ## Boundary with the frontend
131
180
 
132
- and the provider is mounted once at the root:
181
+ Foundation is the bottom of the stack: primitives and the design. Layouts, sections, auth screens, mockups
182
+ and effects live in the frontend package, and foundation depends on no other `@flipova/*` package.
183
+ `npm run boundary` (run by `npm test` and CI) reads the imports and fails on: another `@flipova/*` import; a
184
+ frontend folder under `components/`; a layer importing one above it (`theme` < `contract` < `providers` <
185
+ `ui`, where `ui` reaches only the flipova provider); a provider importing another; an optional peer imported
186
+ outside its own provider; the flipova provider importing anything but `react` and `react-native`.
133
187
 
134
- ```tsx
135
- import { GluestackUIProvider } from '@flipova/foundation/ui';
136
- // <GluestackUIProvider mode="system"> ... </GluestackUIProvider>
137
- ```
188
+ ## Migrating from 2.x
138
189
 
139
- The design tooling needs Python 3.8+ with `lxml` (`design/tools/requirements.txt`).
140
- Resolution order: `$FOUNDATION_PYTHON`, then `$FOUNDATION_VENV`, then
141
- `design/tools/.venv`, then any `python3`/`python` on `PATH` that can import
142
- `lxml`.
190
+ - `@flipova/foundation` and `/ui` now export the **unified** components (`Button`, `Card`, ...). The gluestack
191
+ catalogue (`Box`, `VStack`, `Accordion`, ...) moved to `@flipova/foundation/providers/gluestack/ui`.
192
+ - `createGluestackUIProvider` and `GluestackUIProvider` are there too; `<FlipovaProvider adapter={gluestack}>`
193
+ replaces them for new code.
194
+ - The package no longer ships the `spring` theme; add your own with the GUI.
195
+ - `@flipova/foundation/tokens` is unchanged.
143
196
 
144
197
  ## Documentation
145
198
 
146
- The full guide (installation, theming, tokens, the gluestack config, tools,
147
- contributing) is generated from `design/documentation.xml` into the Docusaurus
148
- site under `docs/`:
149
-
150
- ```bash
151
- cd docs && npm start
152
- ```
199
+ - [DOCS.md](DOCS.md): the maintainer guide (setup, architecture, tests, releasing, conformity).
200
+ - [COMPONENTS.md](COMPONENTS.md): the generated coverage table of the five providers.
201
+ - Public documentation: `documentation/v1.0/` (French, written from the public templates of `flipova.assets` with
202
+ `corral docs`) published as a Docusaurus site from `website/` (`corral docs docusaurus --repo foundation`).
203
+ - `npm run docs:check` keeps all of the above consistent with the code (see [DOCS.md](DOCS.md#11-public-documentation)).
153
204
 
154
205
  ## License
155
206
 
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './theme';
3
+ export * from './recipes';
@@ -0,0 +1,42 @@
1
+ import type { ResolvedTheme } from '../theme';
2
+ import { px, weight, type Style } from './util';
3
+
4
+ export interface AccordionRecipe {
5
+ container: Style;
6
+ item: Style;
7
+ header: (open: boolean, disabled: boolean) => Style;
8
+ title: Style;
9
+ chevron: Style;
10
+ content: Style;
11
+ }
12
+
13
+ export function accordionRecipe(t: ResolvedTheme): AccordionRecipe {
14
+ const c = t.colors;
15
+ return {
16
+ container: {
17
+ width: '100%',
18
+ borderWidth: 1,
19
+ borderColor: c.border,
20
+ borderRadius: px(t, 'radii', 'lg'),
21
+ backgroundColor: c.card,
22
+ overflow: 'hidden',
23
+ },
24
+ item: { borderBottomWidth: 1, borderBottomColor: c.border },
25
+ header: (_open, disabled) => ({
26
+ flexDirection: 'row',
27
+ alignItems: 'center',
28
+ justifyContent: 'space-between',
29
+ gap: px(t, 'spacing', '2'),
30
+ paddingHorizontal: px(t, 'spacing', '4'),
31
+ paddingVertical: px(t, 'spacing', '3'),
32
+ opacity: disabled ? 0.4 : 1,
33
+ }),
34
+ title: { flex: 1, color: c.cardForeground, fontSize: px(t, 'fontSizes', 'sm'), fontWeight: weight(t, 'medium') },
35
+ chevron: { color: c.mutedForeground, fontSize: px(t, 'fontSizes', 'sm') },
36
+ content: {
37
+ paddingHorizontal: px(t, 'spacing', '4'),
38
+ paddingBottom: px(t, 'spacing', '4'),
39
+ gap: px(t, 'spacing', '2'),
40
+ },
41
+ };
42
+ }
@@ -0,0 +1,41 @@
1
+ import type { ResolvedTheme } from '../theme';
2
+ import type { AvatarProps } from '../types';
3
+ import { px, weight, type Style } from './util';
4
+
5
+ const BOX = { sm: '8', md: '10', lg: '14', xl: '20' } as const;
6
+ const TEXT = { sm: 'xs', md: 'sm', lg: 'xl', xl: '3xl' } as const;
7
+
8
+ export interface AvatarRecipe {
9
+ container: Style;
10
+ image: Style;
11
+ initials: Style;
12
+ }
13
+
14
+ export function avatarRecipe({ size = 'md' }: AvatarProps, t: ResolvedTheme): AvatarRecipe {
15
+ const box = px(t, 'spacing', BOX[size]);
16
+ return {
17
+ container: {
18
+ width: box,
19
+ height: box,
20
+ borderRadius: px(t, 'radii', 'full'),
21
+ overflow: 'hidden',
22
+ alignItems: 'center',
23
+ justifyContent: 'center',
24
+ backgroundColor: t.colors.muted,
25
+ },
26
+ image: { width: box, height: box },
27
+ initials: {
28
+ color: t.colors.mutedForeground,
29
+ fontSize: px(t, 'fontSizes', TEXT[size]),
30
+ fontWeight: weight(t, 'medium'),
31
+ },
32
+ };
33
+ }
34
+
35
+ /** "Ada Lovelace" -> "AL"; one word -> its first letter; nothing -> "?" */
36
+ export function initialsOf(name?: string): string {
37
+ const words = (name ?? '').trim().split(/\s+/).filter(Boolean);
38
+ if (!words.length) return '?';
39
+ const letters = words.length === 1 ? [words[0]] : [words[0], words[words.length - 1]];
40
+ return letters.map((w) => Array.from(w)[0].toUpperCase()).join('');
41
+ }
@@ -0,0 +1,46 @@
1
+ import { type ResolvedTheme } from '../theme';
2
+ import type { BadgeProps } from '../types';
3
+ import { px, weight, type Style } from './util';
4
+
5
+ export interface BadgeRecipe {
6
+ container: Style;
7
+ label: Style;
8
+ }
9
+
10
+ export function badgeRecipe({ variant = 'default' }: BadgeProps, t: ResolvedTheme): BadgeRecipe {
11
+ const c = t.colors;
12
+ const bg: Record<string, string> = {
13
+ default: c.primary,
14
+ secondary: c.secondary,
15
+ destructive: c.destructive,
16
+ outline: 'transparent',
17
+ };
18
+ const fg: Record<string, string> = {
19
+ default: c.primaryForeground,
20
+ secondary: c.secondaryForeground,
21
+ destructive: '#ffffff',
22
+ outline: c.foreground,
23
+ };
24
+ const container: Style = {
25
+ flexDirection: 'row',
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ borderRadius: px(t, 'radii', 'sm'),
29
+ paddingHorizontal: px(t, 'spacing', '2'),
30
+ paddingVertical: px(t, 'spacing', '0.5'),
31
+ backgroundColor: bg[variant],
32
+ };
33
+ if (variant === 'outline') {
34
+ container.borderWidth = 1;
35
+ container.borderColor = c.border;
36
+ }
37
+ return {
38
+ container,
39
+ label: {
40
+ color: fg[variant],
41
+ fontSize: px(t, 'fontSizes', 'xs'),
42
+ fontWeight: weight(t, 'medium'),
43
+ textTransform: 'uppercase',
44
+ },
45
+ };
46
+ }
@@ -0,0 +1,58 @@
1
+ import { type ResolvedTheme } from '../theme';
2
+ import type { ButtonProps } from '../types';
3
+ import { px, weight, type Style } from './util';
4
+
5
+ export interface ButtonRecipe {
6
+ container: Style;
7
+ label: Style;
8
+ spinner: { size: number; color: string };
9
+ }
10
+
11
+ export function buttonRecipe(
12
+ { variant = 'default', size = 'default', disabled = false }: ButtonProps,
13
+ t: ResolvedTheme,
14
+ ): ButtonRecipe {
15
+ const c = t.colors;
16
+ const bg: Record<string, string> = {
17
+ default: c.primary,
18
+ destructive: c.destructive,
19
+ outline: c.background,
20
+ secondary: c.secondary,
21
+ ghost: 'transparent',
22
+ link: 'transparent',
23
+ };
24
+ const fg: Record<string, string> = {
25
+ default: c.primaryForeground,
26
+ destructive: '#ffffff',
27
+ outline: c.foreground,
28
+ secondary: c.secondaryForeground,
29
+ ghost: c.foreground,
30
+ link: c.primary,
31
+ };
32
+ const dims: Record<string, Style> = {
33
+ default: { paddingHorizontal: px(t, 'spacing', '4'), paddingVertical: px(t, 'spacing', '2') },
34
+ sm: { minHeight: px(t, 'spacing', '8'), paddingHorizontal: px(t, 'spacing', '3') },
35
+ lg: { minHeight: px(t, 'spacing', '10'), paddingHorizontal: px(t, 'spacing', '8') },
36
+ icon: { minHeight: px(t, 'spacing', '9'), minWidth: px(t, 'spacing', '9') },
37
+ };
38
+ const container: Style = {
39
+ flexDirection: 'row',
40
+ alignItems: 'center',
41
+ justifyContent: 'center',
42
+ borderRadius: px(t, 'radii', 'md'),
43
+ gap: px(t, 'spacing', '2'),
44
+ backgroundColor: bg[variant],
45
+ ...dims[size],
46
+ opacity: disabled ? 0.4 : 1,
47
+ };
48
+ if (variant === 'outline') {
49
+ container.borderWidth = 1;
50
+ container.borderColor = c.border;
51
+ }
52
+ const label: Style = {
53
+ color: fg[variant],
54
+ fontSize: px(t, 'fontSizes', size === 'sm' ? 'xs' : 'sm'),
55
+ fontWeight: weight(t, 'medium'),
56
+ };
57
+ return { container, label, spinner: { size: px(t, 'spacing', '4'), color: fg[variant] } };
58
+ }
@@ -0,0 +1,118 @@
1
+ import type { ResolvedTheme } from '../theme';
2
+ import type { CalendarProps } from '../types';
3
+ import { px, weight, type Style } from './util';
4
+
5
+ const pad2 = (n: number) => String(n).padStart(2, '0');
6
+
7
+ /** 'YYYY-MM-DD' -> [y, m(1-12), d]; null when it is not a real date */
8
+ export function parseDate(s: string | undefined): [number, number, number] | null {
9
+ const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s ?? '');
10
+ if (!m) return null;
11
+ const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
12
+ const dt = new Date(Date.UTC(y, mo - 1, d));
13
+ return dt.getUTCFullYear() === y && dt.getUTCMonth() === mo - 1 && dt.getUTCDate() === d ? [y, mo, d] : null;
14
+ }
15
+
16
+ export const formatDate = (y: number, m: number, d: number) => `${String(y).padStart(4, '0')}-${pad2(m)}-${pad2(d)}`;
17
+ export const daysIn = (y: number, m: number) => new Date(Date.UTC(y, m, 0)).getUTCDate();
18
+
19
+ /** 'YYYY-MM' of a month shifted by `by` months */
20
+ export function shiftMonth(y: number, m: number, by: number): [number, number] {
21
+ const idx = y * 12 + (m - 1) + by;
22
+ return [Math.floor(idx / 12), (idx % 12) + 1];
23
+ }
24
+
25
+ export interface Cell {
26
+ /** 'YYYY-MM-DD', or null for the blanks before the 1st and after the last day */
27
+ date: string | null;
28
+ day: number | null;
29
+ disabled: boolean;
30
+ }
31
+
32
+ /** The month as rows of 7 cells, the first column being Sunday (weekStartsOn 0) or Monday (1). */
33
+ export function monthGrid(
34
+ y: number,
35
+ m: number,
36
+ { weekStartsOn = 0, min, max }: Pick<CalendarProps, 'weekStartsOn' | 'min' | 'max'>,
37
+ ): Cell[][] {
38
+ const first = new Date(Date.UTC(y, m - 1, 1)).getUTCDay();
39
+ const lead = (first - weekStartsOn + 7) % 7;
40
+ const cells: Cell[] = Array.from({ length: lead }, () => ({ date: null, day: null, disabled: true }));
41
+ for (let d = 1; d <= daysIn(y, m); d++) {
42
+ const date = formatDate(y, m, d);
43
+ cells.push({ date, day: d, disabled: (!!min && date < min) || (!!max && date > max) });
44
+ }
45
+ while (cells.length % 7) cells.push({ date: null, day: null, disabled: true });
46
+ return Array.from({ length: cells.length / 7 }, (_, i) => cells.slice(i * 7, i * 7 + 7));
47
+ }
48
+
49
+ export const WEEKDAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
50
+ export const MONTHS = [
51
+ 'January',
52
+ 'February',
53
+ 'March',
54
+ 'April',
55
+ 'May',
56
+ 'June',
57
+ 'July',
58
+ 'August',
59
+ 'September',
60
+ 'October',
61
+ 'November',
62
+ 'December',
63
+ ];
64
+
65
+ export interface CalendarRecipe {
66
+ container: Style;
67
+ header: Style;
68
+ title: Style;
69
+ nav: Style;
70
+ navLabel: Style;
71
+ weekRow: Style;
72
+ weekday: Style;
73
+ row: Style;
74
+ day: (selected: boolean, disabled: boolean) => Style;
75
+ dayLabel: (selected: boolean, disabled: boolean) => Style;
76
+ }
77
+
78
+ export function calendarRecipe(t: ResolvedTheme): CalendarRecipe {
79
+ const c = t.colors;
80
+ const cell = px(t, 'spacing', '10');
81
+ return {
82
+ container: {
83
+ padding: px(t, 'spacing', '3'),
84
+ gap: px(t, 'spacing', '2'),
85
+ backgroundColor: c.card,
86
+ borderWidth: 1,
87
+ borderColor: c.border,
88
+ borderRadius: px(t, 'radii', 'lg'),
89
+ alignSelf: 'flex-start',
90
+ },
91
+ header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
92
+ title: { color: c.cardForeground, fontSize: px(t, 'fontSizes', 'sm'), fontWeight: weight(t, 'semibold') },
93
+ nav: {
94
+ width: px(t, 'spacing', '8'),
95
+ height: px(t, 'spacing', '8'),
96
+ alignItems: 'center',
97
+ justifyContent: 'center',
98
+ borderRadius: px(t, 'radii', 'md'),
99
+ },
100
+ navLabel: { color: c.mutedForeground, fontSize: px(t, 'fontSizes', 'md') },
101
+ weekRow: { flexDirection: 'row' },
102
+ weekday: { width: cell, textAlign: 'center', color: c.mutedForeground, fontSize: px(t, 'fontSizes', 'xs') },
103
+ row: { flexDirection: 'row' },
104
+ day: (selected, disabled) => ({
105
+ width: cell,
106
+ height: cell,
107
+ alignItems: 'center',
108
+ justifyContent: 'center',
109
+ borderRadius: px(t, 'radii', 'md'),
110
+ backgroundColor: selected ? c.primary : 'transparent',
111
+ opacity: disabled ? 0.3 : 1,
112
+ }),
113
+ dayLabel: (selected) => ({
114
+ color: selected ? c.primaryForeground : c.cardForeground,
115
+ fontSize: px(t, 'fontSizes', 'sm'),
116
+ }),
117
+ };
118
+ }