@flipova/foundation 2.4.3 → 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.
- package/CHANGES.md +66 -0
- package/COMPONENTS.md +102 -0
- package/DOCS.md +261 -0
- package/LICENSE +1 -1
- package/README.md +169 -118
- package/components/contract/index.ts +3 -0
- package/components/contract/recipes/accordion.ts +42 -0
- package/components/contract/recipes/avatar.ts +41 -0
- package/components/contract/recipes/badge.ts +46 -0
- package/components/contract/recipes/button.ts +58 -0
- package/components/contract/recipes/calendar.ts +118 -0
- package/components/contract/recipes/card.ts +21 -0
- package/components/contract/recipes/checkbox.ts +33 -0
- package/components/contract/recipes/divider.ts +9 -0
- package/components/contract/recipes/fab.ts +31 -0
- package/components/contract/recipes/feedback.ts +66 -0
- package/components/contract/recipes/formcontrol.ts +16 -0
- package/components/contract/recipes/heading.ts +16 -0
- package/components/contract/recipes/icon.ts +40 -0
- package/components/contract/recipes/index.ts +30 -0
- package/components/contract/recipes/input.ts +39 -0
- package/components/contract/recipes/layout.ts +44 -0
- package/components/contract/recipes/link.ts +6 -0
- package/components/contract/recipes/modal.ts +40 -0
- package/components/contract/recipes/overlay.ts +250 -0
- package/components/contract/recipes/progress.ts +27 -0
- package/components/contract/recipes/radio.ts +39 -0
- package/components/contract/recipes/select.ts +63 -0
- package/components/contract/recipes/skeleton.ts +25 -0
- package/components/contract/recipes/slider.ts +50 -0
- package/components/contract/recipes/spinner.ts +12 -0
- package/components/contract/recipes/switch.ts +26 -0
- package/components/contract/recipes/table.ts +37 -0
- package/components/contract/recipes/tabs.ts +31 -0
- package/components/contract/recipes/text.ts +12 -0
- package/components/contract/recipes/textarea.ts +37 -0
- package/components/contract/recipes/util.ts +15 -0
- package/components/contract/theme.ts +116 -0
- package/components/contract/types.ts +598 -0
- package/components/providers/css-vars.ts +43 -0
- package/components/providers/flipova/components/Accordion.tsx +41 -0
- package/components/providers/flipova/components/ActionSheet.tsx +34 -0
- package/components/providers/flipova/components/Alert.tsx +15 -0
- package/components/providers/flipova/components/AlertDialog.tsx +31 -0
- package/components/providers/flipova/components/Avatar.tsx +30 -0
- package/components/providers/flipova/components/Badge.tsx +14 -0
- package/components/providers/flipova/components/BottomSheet.tsx +24 -0
- package/components/providers/flipova/components/Box.tsx +1 -0
- package/components/providers/flipova/components/Button.tsx +31 -0
- package/components/providers/flipova/components/Calendar.tsx +85 -0
- package/components/providers/flipova/components/Card.tsx +13 -0
- package/components/providers/flipova/components/Center.tsx +11 -0
- package/components/providers/flipova/components/Checkbox.tsx +24 -0
- package/components/providers/flipova/components/DateTimePicker.tsx +45 -0
- package/components/providers/flipova/components/Divider.tsx +9 -0
- package/components/providers/flipova/components/Drawer.tsx +18 -0
- package/components/providers/flipova/components/Fab.tsx +22 -0
- package/components/providers/flipova/components/FlatList.tsx +1 -0
- package/components/providers/flipova/components/FormControl.tsx +27 -0
- package/components/providers/flipova/components/Grid.tsx +18 -0
- package/components/providers/flipova/components/HStack.tsx +13 -0
- package/components/providers/flipova/components/Heading.tsx +19 -0
- package/components/providers/flipova/components/Icon.tsx +20 -0
- package/components/providers/flipova/components/Image.tsx +1 -0
- package/components/providers/flipova/components/ImageBackground.tsx +1 -0
- package/components/providers/flipova/components/ImageViewer.tsx +25 -0
- package/components/providers/flipova/components/Input.tsx +29 -0
- package/components/providers/flipova/components/InputAccessoryView.tsx +1 -0
- package/components/providers/flipova/components/KeyboardAvoidingView.tsx +1 -0
- package/components/providers/flipova/components/Link.tsx +21 -0
- package/components/providers/flipova/components/LiquidGlass.tsx +13 -0
- package/components/providers/flipova/components/Menu.tsx +43 -0
- package/components/providers/flipova/components/Modal.tsx +24 -0
- package/components/providers/flipova/components/Popover.tsx +23 -0
- package/components/providers/flipova/components/Portal.tsx +42 -0
- package/components/providers/flipova/components/Pressable.tsx +1 -0
- package/components/providers/flipova/components/Progress.tsx +22 -0
- package/components/providers/flipova/components/RadioGroup.tsx +36 -0
- package/components/providers/flipova/components/RefreshControl.tsx +1 -0
- package/components/providers/flipova/components/SafeAreaView.tsx +1 -0
- package/components/providers/flipova/components/ScrollView.tsx +1 -0
- package/components/providers/flipova/components/SectionList.tsx +1 -0
- package/components/providers/flipova/components/Select.tsx +61 -0
- package/components/providers/flipova/components/Skeleton.tsx +25 -0
- package/components/providers/flipova/components/Slider.tsx +52 -0
- package/components/providers/flipova/components/Spinner.tsx +19 -0
- package/components/providers/flipova/components/StatusBar.tsx +1 -0
- package/components/providers/flipova/components/Switch.tsx +21 -0
- package/components/providers/flipova/components/Table.tsx +33 -0
- package/components/providers/flipova/components/Tabs.tsx +39 -0
- package/components/providers/flipova/components/Text.tsx +13 -0
- package/components/providers/flipova/components/Textarea.tsx +28 -0
- package/components/providers/flipova/components/Toast.tsx +28 -0
- package/components/providers/flipova/components/Tooltip.tsx +34 -0
- package/components/providers/flipova/components/VStack.tsx +13 -0
- package/components/providers/flipova/components/View.tsx +1 -0
- package/components/providers/flipova/components/VirtualizedList.tsx +1 -0
- package/components/providers/flipova/index.tsx +189 -0
- package/components/providers/gluestack/index.tsx +226 -0
- package/components/providers/gluestack/more.tsx +151 -0
- package/components/{ui → providers/gluestack/ui}/accordion/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/actionsheet/index.tsx +15 -15
- package/components/{ui → providers/gluestack/ui}/alert/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/alert-dialog/index.tsx +3 -3
- package/components/{ui → providers/gluestack/ui}/badge/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/bottomsheet/index.tsx +11 -10
- package/components/{ui → providers/gluestack/ui}/box/index.tsx +4 -1
- package/components/{ui → providers/gluestack/ui}/button/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/calendar/index.tsx +4 -4
- package/components/{ui → providers/gluestack/ui}/card/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/center/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/checkbox/index.tsx +9 -8
- package/components/{ui → providers/gluestack/ui}/date-time-picker/index.tsx +4 -4
- package/components/providers/gluestack/ui/date-time-picker/index.web.tsx +197 -0
- package/components/{ui → providers/gluestack/ui}/divider/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/drawer/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/fab/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/form-control/index.tsx +3 -3
- package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/config.ts +1 -62
- package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.js +1 -1
- package/components/{ui → providers/gluestack/ui}/grid/index.tsx +3 -3
- package/components/{ui → providers/gluestack/ui}/heading/index.tsx +7 -7
- package/components/{ui → providers/gluestack/ui}/hstack/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/icon/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/image/index.tsx +0 -1
- package/components/{ui → providers/gluestack/ui}/image-viewer/index.tsx +96 -99
- package/components/providers/gluestack/ui/index.ts +58 -0
- package/components/{ui → providers/gluestack/ui}/input/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/link/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/liquid-glass/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/menu/index.tsx +5 -4
- package/components/{ui → providers/gluestack/ui}/modal/index.tsx +19 -17
- package/components/{ui → providers/gluestack/ui}/popover/index.tsx +4 -4
- package/components/{ui → providers/gluestack/ui}/portal/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/progress/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/radio/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/select/index.tsx +8 -12
- package/components/{ui → providers/gluestack/ui}/select/select-actionsheet.tsx +13 -13
- package/components/{ui → providers/gluestack/ui}/skeleton/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/slider/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/spinner/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/table/index.tsx +33 -33
- package/components/{ui → providers/gluestack/ui}/tabs/TabsAnimatedIndicator.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/tabs/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/text/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/toast/index.tsx +4 -4
- package/components/{ui → providers/gluestack/ui}/tooltip/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/vstack/index.tsx +1 -1
- package/components/providers/index.ts +2 -0
- package/components/providers/paper/index.tsx +449 -0
- package/components/providers/provider.tsx +80 -0
- package/components/providers/reusables/classes.ts +163 -0
- package/components/providers/reusables/index.tsx +289 -0
- package/components/providers/rn-base/Box.tsx +7 -0
- package/components/providers/rn-base/FlatList.tsx +16 -0
- package/components/providers/rn-base/Image.tsx +18 -0
- package/components/providers/rn-base/ImageBackground.tsx +11 -0
- package/components/providers/rn-base/InputAccessoryView.tsx +9 -0
- package/components/providers/rn-base/KeyboardAvoidingView.tsx +15 -0
- package/components/providers/rn-base/Pressable.tsx +19 -0
- package/components/providers/rn-base/RefreshControl.tsx +16 -0
- package/components/providers/rn-base/SafeAreaView.tsx +11 -0
- package/components/providers/rn-base/ScrollView.tsx +11 -0
- package/components/providers/rn-base/SectionList.tsx +22 -0
- package/components/providers/rn-base/StatusBar.tsx +17 -0
- package/components/providers/rn-base/View.tsx +7 -0
- package/components/providers/rn-base/VirtualizedList.tsx +18 -0
- package/components/providers/rn-base/index.tsx +64 -0
- package/components/providers/tamagui/index.tsx +375 -0
- package/components/providers/types.ts +17 -0
- package/components/theme/design-theme.ts +230 -0
- package/components/ui/create.tsx +14 -0
- package/components/ui/index.ts +68 -58
- package/components/ui/resolve.ts +40 -0
- package/design/canonical.index.txt +2 -16
- package/design/manifest.xml +4 -3
- package/design/schema.xsd +44 -434
- package/design/themes.xml +7 -177
- package/design/tools/{npm.js → cli.js} +173 -73
- package/design/tools/gui/index.html +998 -0
- package/design/tools/lib/check.js +533 -0
- package/design/tools/lib/contract.js +23 -0
- package/design/tools/lib/edit.js +166 -0
- package/design/tools/lib/generate.js +465 -0
- package/design/tools/lib/gui.js +614 -0
- package/design/tools/lib/lint.js +139 -0
- package/design/tools/lib/registry.js +135 -0
- package/design/tools/lib/util.js +53 -0
- package/design/tools/lib/xml.js +257 -0
- package/design/tools/lib/xsd.js +408 -0
- package/dist/chunk-2QM2ZUDS.mjs +1308 -0
- package/dist/chunk-2QM2ZUDS.mjs.map +1 -0
- package/dist/chunk-2T2TCUYF.js +1371 -0
- package/dist/chunk-2T2TCUYF.js.map +1 -0
- package/dist/chunk-6UKTC4KF.js +43 -0
- package/dist/chunk-6UKTC4KF.js.map +1 -0
- package/dist/chunk-6Z4WRTI4.mjs +37 -0
- package/dist/chunk-6Z4WRTI4.mjs.map +1 -0
- package/dist/chunk-G3K6J5KY.js +157 -0
- package/dist/chunk-G3K6J5KY.js.map +1 -0
- package/dist/chunk-GM45RCSI.mjs +96 -0
- package/dist/chunk-GM45RCSI.mjs.map +1 -0
- package/dist/chunk-GQJLHH2P.mjs +3 -0
- package/dist/chunk-GQJLHH2P.mjs.map +1 -0
- package/dist/chunk-ICNR56VP.js +1653 -0
- package/dist/chunk-ICNR56VP.js.map +1 -0
- package/dist/chunk-J5LGTIGS.mjs +9 -0
- package/dist/chunk-J5LGTIGS.mjs.map +1 -0
- package/dist/chunk-LRPZLF2K.mjs +30 -0
- package/dist/chunk-LRPZLF2K.mjs.map +1 -0
- package/dist/chunk-OC4MXNXU.js +32 -0
- package/dist/chunk-OC4MXNXU.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +11 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-RWVTZUEG.js +161 -0
- package/dist/chunk-RWVTZUEG.js.map +1 -0
- package/dist/chunk-V473I5XQ.js +4 -0
- package/dist/chunk-V473I5XQ.js.map +1 -0
- package/dist/chunk-V4ULAISZ.js +915 -0
- package/dist/chunk-V4ULAISZ.js.map +1 -0
- package/dist/chunk-WRJERTJS.mjs +145 -0
- package/dist/chunk-WRJERTJS.mjs.map +1 -0
- package/dist/chunk-YIBPE3KQ.mjs +864 -0
- package/dist/chunk-YIBPE3KQ.mjs.map +1 -0
- package/dist/chunk-YUAQIZPN.mjs +1556 -0
- package/dist/chunk-YUAQIZPN.mjs.map +1 -0
- package/dist/contract/index.d.mts +304 -0
- package/dist/contract/index.d.ts +304 -0
- package/dist/contract/index.js +256 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/index.mjs +3 -0
- package/dist/contract/index.mjs.map +1 -0
- package/dist/index.d.mts +4 -40
- package/dist/index.d.ts +4 -40
- package/dist/index.js +73 -992
- package/dist/index.mjs +2 -1
- package/dist/providers/flipova/index.d.mts +133 -0
- package/dist/providers/flipova/index.d.ts +133 -0
- package/dist/providers/flipova/index.js +249 -0
- package/dist/providers/flipova/index.js.map +1 -0
- package/dist/providers/flipova/index.mjs +4 -0
- package/dist/providers/flipova/index.mjs.map +1 -0
- package/dist/providers/gluestack/index.d.mts +7 -0
- package/dist/providers/gluestack/index.d.ts +7 -0
- package/dist/providers/gluestack/index.js +240 -0
- package/dist/providers/gluestack/index.js.map +1 -0
- package/dist/providers/gluestack/index.mjs +238 -0
- package/dist/providers/gluestack/index.mjs.map +1 -0
- package/dist/providers/gluestack/ui/index.d.mts +3472 -0
- package/dist/providers/gluestack/ui/index.d.ts +3472 -0
- package/dist/{chunk-LCTFQJZM.js → providers/gluestack/ui/index.js} +860 -2297
- package/dist/providers/gluestack/ui/index.js.map +1 -0
- package/dist/{chunk-2R66P5X5.mjs → providers/gluestack/ui/index.mjs} +468 -2062
- package/dist/providers/gluestack/ui/index.mjs.map +1 -0
- package/dist/providers/index.d.mts +37 -0
- package/dist/providers/index.d.ts +37 -0
- package/dist/providers/index.js +28 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +3 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/providers/paper/index.d.mts +30 -0
- package/dist/providers/paper/index.d.ts +30 -0
- package/dist/providers/paper/index.js +362 -0
- package/dist/providers/paper/index.js.map +1 -0
- package/dist/providers/paper/index.mjs +353 -0
- package/dist/providers/paper/index.mjs.map +1 -0
- package/dist/providers/reusables/index.d.mts +60 -0
- package/dist/providers/reusables/index.d.ts +60 -0
- package/dist/providers/reusables/index.js +348 -0
- package/dist/providers/reusables/index.js.map +1 -0
- package/dist/providers/reusables/index.mjs +311 -0
- package/dist/providers/reusables/index.mjs.map +1 -0
- package/dist/providers/tamagui/index.d.mts +15 -0
- package/dist/providers/tamagui/index.d.ts +15 -0
- package/dist/providers/tamagui/index.js +275 -0
- package/dist/providers/tamagui/index.js.map +1 -0
- package/dist/providers/tamagui/index.mjs +270 -0
- package/dist/providers/tamagui/index.mjs.map +1 -0
- package/dist/theme-BznFrVT1.d.mts +566 -0
- package/dist/theme-BznFrVT1.d.ts +566 -0
- package/dist/types-C7P80VKR.d.ts +22 -0
- package/dist/types-Tspvmask.d.mts +22 -0
- package/dist/ui/index.d.mts +190 -7017
- package/dist/ui/index.d.ts +190 -7017
- package/dist/ui/index.js +73 -992
- package/dist/ui/index.mjs +2 -1
- package/package.json +142 -38
- package/components/ui/date-time-picker/index.web.tsx +0 -195
- package/design/documentation.xml +0 -607
- package/design/tools/design.js +0 -188
- package/design/tools/requirements.txt +0 -35
- package/design/tools/sources/.checker/__init__.py +0 -81
- package/design/tools/sources/.checker/checks.py +0 -198
- package/design/tools/sources/.checker/cli.py +0 -154
- package/design/tools/sources/.checker/io.py +0 -242
- package/design/tools/sources/.checker/model.py +0 -144
- package/design/tools/sources/.checker/registry.py +0 -115
- package/design/tools/sources/.checker/report.py +0 -21
- package/design/tools/sources/.docgen/__init__.py +0 -45
- package/design/tools/sources/.docgen/cli.py +0 -101
- package/design/tools/sources/.docgen/model.py +0 -147
- package/design/tools/sources/.docgen/reference.py +0 -97
- package/design/tools/sources/.docgen/site.py +0 -145
- package/design/tools/sources/.docgen/xsddoc.py +0 -329
- package/design/tools/sources/.generate/__init__.py +0 -35
- package/design/tools/sources/.generate/cli.py +0 -76
- package/design/tools/sources/.generate/common.py +0 -33
- package/design/tools/sources/.generate/config.py +0 -177
- package/design/tools/sources/.generate/model.py +0 -51
- package/design/tools/sources/.generate/tokens.py +0 -141
- package/design/tools/sources/.linter/__init__.py +0 -9
- package/design/tools/sources/.linter/cli.py +0 -44
- package/design/tools/sources/.linter/discovery.py +0 -30
- package/design/tools/sources/.linter/errors.py +0 -45
- package/design/tools/sources/.linter/linter.py +0 -68
- package/design/tools/sources/.xmleditor/__init__.py +0 -74
- package/design/tools/sources/.xmleditor/blocks.py +0 -185
- package/design/tools/sources/.xmleditor/cli.py +0 -141
- package/design/tools/sources/.xmleditor/editor.py +0 -906
- package/design/tools/sources/.xmleditor/model.py +0 -708
- package/design/tools/sources/.xmleditor/widgets.py +0 -1832
- package/design/tools/sources/.xmleditor/xsdmodel.py +0 -753
- package/design/tools/sources/checker.py +0 -55
- package/design/tools/sources/docgen.py +0 -66
- package/design/tools/sources/generate.py +0 -48
- package/design/tools/sources/linter.py +0 -54
- package/design/tools/sources/ruff.toml +0 -12
- package/design/tools/sources/xmleditor.py +0 -62
- package/design/tools/unix/_venv_python.sh +0 -16
- package/design/tools/unix/check.sh +0 -13
- package/design/tools/unix/doc.sh +0 -14
- package/design/tools/unix/gen.sh +0 -14
- package/design/tools/unix/lint.sh +0 -10
- package/design/tools/unix/run.sh +0 -20
- package/design/tools/unix/verify.sh +0 -12
- package/design/tools/unix/xmledit.sh +0 -12
- package/design/tools/windows/check.cmd +0 -12
- package/design/tools/windows/doc.cmd +0 -12
- package/design/tools/windows/gen.cmd +0 -11
- package/design/tools/windows/lint.cmd +0 -9
- package/design/tools/windows/run.cmd +0 -26
- package/design/tools/windows/verify.cmd +0 -10
- package/design/tools/windows/xmledit.cmd +0 -10
- package/dist/chunk-2R66P5X5.mjs.map +0 -1
- package/dist/chunk-LCTFQJZM.js.map +0 -1
- /package/components/{ui → providers/gluestack/ui}/accordion/ANIMATION_CUSTOMIZATION.md +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedHeight.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedIcon.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedHeight.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedIcon.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/MIGRATION_SUMMARY.md +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/USAGE_EXAMPLE.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/animation-config.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/avatar/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/box/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/box/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/calendar/creator.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/calendar/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/card/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/card/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/center/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/center/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/date-time-picker/creator.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/date-time-picker/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/flat-list/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/script.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/theme-context.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.d.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/useGluestackColors.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/grid/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/grid/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/heading/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/heading/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/hstack/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/hstack/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/icon/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/image-background/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/image-viewer/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/input-accessory-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/keyboard-avoiding-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/pressable/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/refresh-control/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/safe-area-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/scroll-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/section-list/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/skeleton/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/skeleton/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/status-bar/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/switch/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/table/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/table/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/tabs/animation-config.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/tabs/creator.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/text/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/text/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/textarea/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/virtualized-list/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/vstack/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/vstack/styles.tsx +0 -0
package/README.md
CHANGED
|
@@ -3,153 +3,204 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@flipova/foundation)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
54
|
-
npx flipova-design
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
35
|
+
`theme/provider.tsx` is yours: it names the library and hands your generated theme to the components.
|
|
83
36
|
|
|
84
|
-
```
|
|
85
|
-
|
|
37
|
+
```tsx
|
|
38
|
+
<FlipovaProvider adapter={flipova} theme={designTheme} mode={mode}>
|
|
86
39
|
```
|
|
87
40
|
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
44
|
+
## Where things are
|
|
94
45
|
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
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
|
-
|
|
111
|
-
|
|
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
|
-
|
|
118
|
-
does not override. `npx flipova-design where` always says which side is in charge.
|
|
168
|
+
## How "identical" is tested
|
|
119
169
|
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
135
|
-
import { GluestackUIProvider } from '@flipova/foundation/ui';
|
|
136
|
-
// <GluestackUIProvider mode="system"> ... </GluestackUIProvider>
|
|
137
|
-
```
|
|
188
|
+
## Migrating from 2.x
|
|
138
189
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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,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
|
+
}
|