@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.
- 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 +136 -35
- 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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { createContext, useContext, useMemo } from 'react';
|
|
2
|
+
import { useColorScheme } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
defaultRegistry,
|
|
5
|
+
resolveTheme,
|
|
6
|
+
themeIdFor,
|
|
7
|
+
type Mode,
|
|
8
|
+
type ResolvedTheme,
|
|
9
|
+
type ThemeRegistry,
|
|
10
|
+
} from '../contract';
|
|
11
|
+
import type { ProviderAdapter } from './types';
|
|
12
|
+
|
|
13
|
+
interface Ctx {
|
|
14
|
+
adapter: ProviderAdapter;
|
|
15
|
+
theme: ResolvedTheme;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const FlipovaContext = createContext<Ctx | null>(null);
|
|
19
|
+
|
|
20
|
+
export interface FlipovaProviderProps {
|
|
21
|
+
/**
|
|
22
|
+
* The component library to render with (`flipova`, `gluestack`, `reusables`, `paper` or `tamagui` adapter, each from
|
|
23
|
+
* its own sub-path). Components the library lacks are served by the flipova provider.
|
|
24
|
+
*/
|
|
25
|
+
adapter: ProviderAdapter;
|
|
26
|
+
mode?: Mode | 'system';
|
|
27
|
+
/** Light/dark pair declared in the registry's themes (the `default` pair when omitted). */
|
|
28
|
+
variant?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The app's own themes: the `design-theme.ts` that `npx flipova-design gen` writes in the project. When omitted the
|
|
31
|
+
* neutral light/dark starter bundled with the package is used.
|
|
32
|
+
*/
|
|
33
|
+
theme?: ThemeRegistry;
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Mounts one adapter with one theme. Colours, radii, spacings and type sizes come from the registry whatever the
|
|
39
|
+
* adapter, which is what keeps the design identical across libraries.
|
|
40
|
+
*/
|
|
41
|
+
export function FlipovaProvider({
|
|
42
|
+
adapter,
|
|
43
|
+
mode = 'light',
|
|
44
|
+
variant,
|
|
45
|
+
theme: registry = defaultRegistry,
|
|
46
|
+
children,
|
|
47
|
+
}: FlipovaProviderProps) {
|
|
48
|
+
const system = useColorScheme();
|
|
49
|
+
const resolvedMode: Mode = mode === 'system' ? (system === 'dark' ? 'dark' : 'light') : mode;
|
|
50
|
+
const theme = useMemo(
|
|
51
|
+
() => resolveTheme(themeIdFor(variant, resolvedMode, registry), registry),
|
|
52
|
+
[variant, resolvedMode, registry],
|
|
53
|
+
);
|
|
54
|
+
const value = useMemo(() => ({ adapter, theme }), [adapter, theme]);
|
|
55
|
+
return (
|
|
56
|
+
<FlipovaContext.Provider value={value}>
|
|
57
|
+
<adapter.Provider theme={theme} registry={registry}>
|
|
58
|
+
{children}
|
|
59
|
+
</adapter.Provider>
|
|
60
|
+
</FlipovaContext.Provider>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let fallbackTheme: ResolvedTheme | undefined;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The resolved theme in use (hex colours, numeric scales). Outside a <FlipovaProvider> it is the light theme of the
|
|
68
|
+
* bundled registry, so a component never renders without a design.
|
|
69
|
+
*/
|
|
70
|
+
export function useResolvedTheme(): ResolvedTheme {
|
|
71
|
+
const ctx = useContext(FlipovaContext);
|
|
72
|
+
if (ctx) return ctx.theme;
|
|
73
|
+
return (fallbackTheme ??= resolveTheme(themeIdFor(undefined, 'light')));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The mounted adapter, or null when no <FlipovaProvider> is above. */
|
|
77
|
+
export const useAdapter = (): ProviderAdapter | null => useContext(FlipovaContext)?.adapter ?? null;
|
|
78
|
+
|
|
79
|
+
/** Which provider is mounted (`flipova` when none is). */
|
|
80
|
+
export const useProviderName = () => useAdapter()?.name ?? 'flipova';
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AvatarProps,
|
|
3
|
+
CheckboxProps,
|
|
4
|
+
DividerProps,
|
|
5
|
+
HeadingProps,
|
|
6
|
+
ProgressProps,
|
|
7
|
+
SkeletonProps,
|
|
8
|
+
StackProps,
|
|
9
|
+
BadgeProps,
|
|
10
|
+
ButtonProps,
|
|
11
|
+
CardProps,
|
|
12
|
+
InputProps,
|
|
13
|
+
SwitchProps,
|
|
14
|
+
TextProps,
|
|
15
|
+
} from '../../contract';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The Tailwind classes of the Reusables adapter (shadcn naming: bg-primary, text-muted-foreground...). They only name
|
|
19
|
+
* theme roles and scale steps; the values come from the CSS variables / Tailwind theme generated from the same
|
|
20
|
+
* registry as every other provider, and the tests resolve them back to numbers and compare with the recipes.
|
|
21
|
+
*/
|
|
22
|
+
const join = (...parts: Array<string | false | undefined>) => parts.filter(Boolean).join(' ');
|
|
23
|
+
|
|
24
|
+
export function buttonClasses({ variant = 'default', size = 'default', disabled }: ButtonProps) {
|
|
25
|
+
const bg = {
|
|
26
|
+
default: 'bg-primary',
|
|
27
|
+
destructive: 'bg-destructive',
|
|
28
|
+
outline: 'border border-border bg-background',
|
|
29
|
+
secondary: 'bg-secondary',
|
|
30
|
+
ghost: '',
|
|
31
|
+
link: '',
|
|
32
|
+
}[variant];
|
|
33
|
+
const dims = { default: 'px-4 py-2', sm: 'min-h-8 px-3', lg: 'min-h-10 px-8', icon: 'min-h-9 min-w-9' }[size];
|
|
34
|
+
const fg = {
|
|
35
|
+
default: 'text-primary-foreground',
|
|
36
|
+
destructive: 'text-white',
|
|
37
|
+
outline: 'text-foreground',
|
|
38
|
+
secondary: 'text-secondary-foreground',
|
|
39
|
+
ghost: 'text-foreground',
|
|
40
|
+
link: 'text-primary',
|
|
41
|
+
}[variant];
|
|
42
|
+
return {
|
|
43
|
+
container: join('flex-row items-center justify-center rounded-md gap-2', bg, dims, disabled && 'opacity-40'),
|
|
44
|
+
label: join('font-medium', size === 'sm' ? 'text-xs' : 'text-sm', fg),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const textClasses = ({ size = 'md', bold, underline, strikeThrough }: TextProps) =>
|
|
49
|
+
join(
|
|
50
|
+
'text-foreground',
|
|
51
|
+
`text-${size}`,
|
|
52
|
+
bold && 'font-bold',
|
|
53
|
+
underline && 'underline',
|
|
54
|
+
strikeThrough && 'line-through',
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export function inputClasses({ disabled, invalid }: InputProps) {
|
|
58
|
+
return {
|
|
59
|
+
container: join(
|
|
60
|
+
'h-9 w-full flex-row items-center gap-2 rounded-md border bg-transparent px-3',
|
|
61
|
+
invalid ? 'border-destructive/40' : 'border-border',
|
|
62
|
+
disabled && 'opacity-50',
|
|
63
|
+
),
|
|
64
|
+
field: 'flex-1 h-full py-1 text-sm text-foreground',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const cardClasses = ({ size = 'default' }: CardProps) =>
|
|
69
|
+
join('flex-col bg-card border border-border rounded-xl shadow-sm', size === 'sm' ? 'p-3 gap-3' : 'p-4 gap-6');
|
|
70
|
+
|
|
71
|
+
export function badgeClasses({ variant = 'default' }: BadgeProps) {
|
|
72
|
+
const bg = {
|
|
73
|
+
default: 'bg-primary',
|
|
74
|
+
secondary: 'bg-secondary',
|
|
75
|
+
destructive: 'bg-destructive',
|
|
76
|
+
outline: 'border border-border bg-transparent',
|
|
77
|
+
}[variant];
|
|
78
|
+
const fg = {
|
|
79
|
+
default: 'text-primary-foreground',
|
|
80
|
+
secondary: 'text-secondary-foreground',
|
|
81
|
+
destructive: 'text-white',
|
|
82
|
+
outline: 'text-foreground',
|
|
83
|
+
}[variant];
|
|
84
|
+
return {
|
|
85
|
+
container: join('flex-row items-center justify-center rounded-sm px-2 py-0.5', bg),
|
|
86
|
+
label: join('text-xs font-medium uppercase', fg),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function switchClasses({ size = 'md', disabled }: SwitchProps) {
|
|
91
|
+
return {
|
|
92
|
+
root: join(
|
|
93
|
+
'h-6 w-11 flex-row items-center rounded-full',
|
|
94
|
+
{ sm: 'scale-75', md: '', lg: 'scale-125' }[size],
|
|
95
|
+
disabled && 'opacity-40',
|
|
96
|
+
),
|
|
97
|
+
trackOn: 'bg-primary',
|
|
98
|
+
trackOff: 'bg-input',
|
|
99
|
+
thumb: 'h-5 w-5 rounded-full bg-background',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ---- the rest of the contract that a Tailwind class list can express ---------------------------------------------------
|
|
104
|
+
|
|
105
|
+
export const dividerClasses = ({ orientation = 'horizontal' }: DividerProps) =>
|
|
106
|
+
orientation === 'vertical' ? 'w-px self-stretch bg-border' : 'h-px w-full bg-border';
|
|
107
|
+
|
|
108
|
+
export const stackClasses = (direction: 'row' | 'column', { space = '2' }: StackProps) =>
|
|
109
|
+
`${direction === 'row' ? 'flex-row' : 'flex-col'} gap-${space}`;
|
|
110
|
+
|
|
111
|
+
const HEADING_SIZE = { 1: '4xl', 2: '3xl', 3: '2xl', 4: 'xl', 5: 'lg', 6: 'md' } as const;
|
|
112
|
+
export const headingClasses = ({ level = 2 }: HeadingProps) =>
|
|
113
|
+
join(
|
|
114
|
+
'text-foreground',
|
|
115
|
+
`text-${HEADING_SIZE[level]}`,
|
|
116
|
+
level <= 4 ? 'font-bold' : 'font-semibold',
|
|
117
|
+
level <= 2 && 'tracking-tight',
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export const linkClasses = () => 'text-primary text-md underline';
|
|
121
|
+
|
|
122
|
+
const AVATAR_BOX = { sm: '8', md: '10', lg: '14', xl: '20' } as const;
|
|
123
|
+
const AVATAR_TEXT = { sm: 'xs', md: 'sm', lg: 'xl', xl: '3xl' } as const;
|
|
124
|
+
export function avatarClasses({ size = 'md' }: AvatarProps) {
|
|
125
|
+
const box = AVATAR_BOX[size];
|
|
126
|
+
return {
|
|
127
|
+
container: `h-${box} w-${box} rounded-full overflow-hidden items-center justify-center bg-muted`,
|
|
128
|
+
image: `h-${box} w-${box}`,
|
|
129
|
+
initials: `text-muted-foreground text-${AVATAR_TEXT[size]} font-medium`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const PROGRESS_HEIGHT = { sm: '1', md: '2', lg: '3' } as const;
|
|
134
|
+
/** the bar's width is the value itself, so it goes in `style`, not in a class */
|
|
135
|
+
export const progressClasses = ({ size = 'md' }: Pick<ProgressProps, 'size'>) => ({
|
|
136
|
+
track: `w-full h-${PROGRESS_HEIGHT[size]} rounded-full overflow-hidden bg-muted`,
|
|
137
|
+
bar: 'h-full rounded-full bg-primary',
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export function checkboxClasses({ checked = false, disabled = false, invalid = false }: CheckboxProps) {
|
|
141
|
+
return {
|
|
142
|
+
row: join('flex-row items-center gap-2', disabled && 'opacity-40'),
|
|
143
|
+
box: join(
|
|
144
|
+
'h-5 w-5 items-center justify-center rounded-sm border',
|
|
145
|
+
invalid ? 'border-destructive/60' : checked ? 'border-primary' : 'border-input',
|
|
146
|
+
checked ? 'bg-primary' : 'bg-transparent',
|
|
147
|
+
),
|
|
148
|
+
mark: 'text-primary-foreground text-xs',
|
|
149
|
+
label: 'text-foreground text-sm',
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const formControlClasses = ({ disabled = false }: { disabled?: boolean }) => ({
|
|
154
|
+
root: join('gap-1.5', disabled && 'opacity-50'),
|
|
155
|
+
label: 'text-foreground text-sm font-medium',
|
|
156
|
+
required: 'text-destructive',
|
|
157
|
+
helper: 'text-muted-foreground text-xs',
|
|
158
|
+
error: 'text-destructive text-xs',
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
/** width / height come from the props, so they go in `style` */
|
|
162
|
+
export const skeletonClasses = ({ circle = false }: SkeletonProps) =>
|
|
163
|
+
join('bg-muted', circle ? 'rounded-full' : 'rounded-md');
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, Pressable, Text as RNText, TextInput, View, ActivityIndicator } from 'react-native';
|
|
3
|
+
import * as SwitchPrimitive from '@rn-primitives/switch';
|
|
4
|
+
|
|
5
|
+
import { cssVarTables } from '../css-vars';
|
|
6
|
+
import type {
|
|
7
|
+
AvatarProps,
|
|
8
|
+
CheckboxProps,
|
|
9
|
+
DividerProps,
|
|
10
|
+
FormControlProps,
|
|
11
|
+
HeadingProps,
|
|
12
|
+
HStackProps,
|
|
13
|
+
LinkProps,
|
|
14
|
+
ProgressProps,
|
|
15
|
+
SkeletonProps,
|
|
16
|
+
VStackProps,
|
|
17
|
+
BoxProps,
|
|
18
|
+
CenterProps,
|
|
19
|
+
ViewProps,
|
|
20
|
+
BadgeProps,
|
|
21
|
+
ButtonProps,
|
|
22
|
+
CardProps,
|
|
23
|
+
InputProps,
|
|
24
|
+
ProviderComponents,
|
|
25
|
+
SwitchProps,
|
|
26
|
+
TextProps,
|
|
27
|
+
} from '../../contract';
|
|
28
|
+
import { initialsOf } from '../../contract';
|
|
29
|
+
import { rnBase } from '../rn-base';
|
|
30
|
+
import { useResolvedTheme } from '../provider';
|
|
31
|
+
import { defineAdapter } from '../types';
|
|
32
|
+
import {
|
|
33
|
+
avatarClasses,
|
|
34
|
+
checkboxClasses,
|
|
35
|
+
dividerClasses,
|
|
36
|
+
formControlClasses,
|
|
37
|
+
headingClasses,
|
|
38
|
+
linkClasses,
|
|
39
|
+
progressClasses,
|
|
40
|
+
skeletonClasses,
|
|
41
|
+
stackClasses,
|
|
42
|
+
badgeClasses,
|
|
43
|
+
buttonClasses,
|
|
44
|
+
cardClasses,
|
|
45
|
+
inputClasses,
|
|
46
|
+
switchClasses,
|
|
47
|
+
textClasses,
|
|
48
|
+
} from './classes';
|
|
49
|
+
|
|
50
|
+
export * from './classes';
|
|
51
|
+
|
|
52
|
+
function Button(p: ButtonProps) {
|
|
53
|
+
const t = useResolvedTheme();
|
|
54
|
+
const c = buttonClasses(p);
|
|
55
|
+
const off = p.disabled || p.loading;
|
|
56
|
+
return (
|
|
57
|
+
<Pressable
|
|
58
|
+
className={c.container}
|
|
59
|
+
disabled={off}
|
|
60
|
+
onPress={p.onPress}
|
|
61
|
+
accessibilityRole="button"
|
|
62
|
+
accessibilityLabel={p.accessibilityLabel}
|
|
63
|
+
testID={p.testID}
|
|
64
|
+
>
|
|
65
|
+
{p.loading ? <ActivityIndicator size="small" color={t.colors.primaryForeground} /> : null}
|
|
66
|
+
{typeof p.children === 'string' ? <RNText className={c.label}>{p.children}</RNText> : p.children}
|
|
67
|
+
</Pressable>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function Text(p: TextProps) {
|
|
72
|
+
return (
|
|
73
|
+
<RNText className={textClasses(p)} numberOfLines={p.isTruncated ? 1 : undefined} testID={p.testID}>
|
|
74
|
+
{p.children}
|
|
75
|
+
</RNText>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function Input(p: InputProps) {
|
|
80
|
+
const t = useResolvedTheme();
|
|
81
|
+
const c = inputClasses(p);
|
|
82
|
+
return (
|
|
83
|
+
<View className={c.container}>
|
|
84
|
+
<TextInput
|
|
85
|
+
className={c.field}
|
|
86
|
+
value={p.value}
|
|
87
|
+
defaultValue={p.defaultValue}
|
|
88
|
+
placeholder={p.placeholder}
|
|
89
|
+
placeholderTextColor={t.colors.mutedForeground}
|
|
90
|
+
onChangeText={p.onChangeText}
|
|
91
|
+
editable={!p.disabled}
|
|
92
|
+
secureTextEntry={p.secureTextEntry}
|
|
93
|
+
accessibilityLabel={p.accessibilityLabel}
|
|
94
|
+
testID={p.testID}
|
|
95
|
+
/>
|
|
96
|
+
</View>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function Card(p: CardProps) {
|
|
101
|
+
return (
|
|
102
|
+
<View className={cardClasses(p)} testID={p.testID}>
|
|
103
|
+
{p.children}
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function Badge(p: BadgeProps) {
|
|
109
|
+
const c = badgeClasses(p);
|
|
110
|
+
return (
|
|
111
|
+
<View className={c.container} testID={p.testID}>
|
|
112
|
+
<RNText className={c.label}>{p.children}</RNText>
|
|
113
|
+
</View>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function Switch(p: SwitchProps) {
|
|
118
|
+
const c = switchClasses(p);
|
|
119
|
+
const on = !!p.value;
|
|
120
|
+
return (
|
|
121
|
+
<SwitchPrimitive.Root
|
|
122
|
+
checked={on}
|
|
123
|
+
onCheckedChange={p.onValueChange ?? (() => undefined)}
|
|
124
|
+
disabled={p.disabled}
|
|
125
|
+
className={`${c.root} ${on ? c.trackOn : c.trackOff}`}
|
|
126
|
+
accessibilityLabel={p.accessibilityLabel}
|
|
127
|
+
testID={p.testID}
|
|
128
|
+
>
|
|
129
|
+
<SwitchPrimitive.Thumb className={`${c.thumb} ${on ? 'ml-auto' : ''}`} />
|
|
130
|
+
</SwitchPrimitive.Root>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ---- plain containers: the library is NativeWind classes over React Native, so these are Views --------------------------
|
|
135
|
+
|
|
136
|
+
const Box = (p: BoxProps) => <View testID={p.testID}>{p.children}</View>;
|
|
137
|
+
const PlainView = (p: ViewProps) => <View testID={p.testID}>{p.children}</View>;
|
|
138
|
+
const Center = (p: CenterProps) => (
|
|
139
|
+
<View className="items-center justify-center" testID={p.testID}>
|
|
140
|
+
{p.children}
|
|
141
|
+
</View>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const Divider = (p: DividerProps) => <View className={dividerClasses(p)} testID={p.testID} />;
|
|
145
|
+
const HStack = (p: HStackProps) => (
|
|
146
|
+
<View className={stackClasses('row', p)} testID={p.testID}>
|
|
147
|
+
{p.children}
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
const VStack = (p: VStackProps) => (
|
|
151
|
+
<View className={stackClasses('column', p)} testID={p.testID}>
|
|
152
|
+
{p.children}
|
|
153
|
+
</View>
|
|
154
|
+
);
|
|
155
|
+
const Heading = (p: HeadingProps) => (
|
|
156
|
+
<RNText
|
|
157
|
+
accessibilityRole="header"
|
|
158
|
+
className={headingClasses(p)}
|
|
159
|
+
numberOfLines={p.isTruncated ? 1 : undefined}
|
|
160
|
+
testID={p.testID}
|
|
161
|
+
>
|
|
162
|
+
{p.children}
|
|
163
|
+
</RNText>
|
|
164
|
+
);
|
|
165
|
+
const Link = (p: LinkProps) => (
|
|
166
|
+
<RNText accessibilityRole="link" className={linkClasses()} onPress={p.onPress} testID={p.testID}>
|
|
167
|
+
{p.children}
|
|
168
|
+
</RNText>
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
function Avatar(p: AvatarProps) {
|
|
172
|
+
const c = avatarClasses(p);
|
|
173
|
+
return (
|
|
174
|
+
<View
|
|
175
|
+
accessibilityRole="image"
|
|
176
|
+
accessibilityLabel={p.accessibilityLabel ?? p.name}
|
|
177
|
+
className={c.container}
|
|
178
|
+
testID={p.testID}
|
|
179
|
+
>
|
|
180
|
+
{p.source ? (
|
|
181
|
+
<Image source={{ uri: p.source }} className={c.image} />
|
|
182
|
+
) : (
|
|
183
|
+
<RNText className={c.initials}>{initialsOf(p.name)}</RNText>
|
|
184
|
+
)}
|
|
185
|
+
</View>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function Progress(p: ProgressProps) {
|
|
190
|
+
const c = progressClasses(p);
|
|
191
|
+
const pct = Math.min(100, Math.max(0, Number.isFinite(p.value) ? p.value : 0));
|
|
192
|
+
return (
|
|
193
|
+
<View
|
|
194
|
+
accessibilityRole="progressbar"
|
|
195
|
+
accessibilityLabel={p.accessibilityLabel}
|
|
196
|
+
aria-valuemin={0}
|
|
197
|
+
aria-valuemax={100}
|
|
198
|
+
aria-valuenow={pct}
|
|
199
|
+
className={c.track}
|
|
200
|
+
testID={p.testID}
|
|
201
|
+
>
|
|
202
|
+
<View className={c.bar} style={{ width: `${pct}%` }} />
|
|
203
|
+
</View>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function Checkbox(p: CheckboxProps) {
|
|
208
|
+
const c = checkboxClasses(p);
|
|
209
|
+
return (
|
|
210
|
+
<Pressable
|
|
211
|
+
accessibilityRole="checkbox"
|
|
212
|
+
accessibilityLabel={p.accessibilityLabel ?? p.label}
|
|
213
|
+
aria-checked={!!p.checked}
|
|
214
|
+
aria-disabled={!!p.disabled}
|
|
215
|
+
disabled={p.disabled}
|
|
216
|
+
onPress={() => p.onCheckedChange?.(!p.checked)}
|
|
217
|
+
className={c.row}
|
|
218
|
+
testID={p.testID}
|
|
219
|
+
>
|
|
220
|
+
<View className={c.box}>{p.checked ? <RNText className={c.mark}>✓</RNText> : null}</View>
|
|
221
|
+
{p.label ? <RNText className={c.label}>{p.label}</RNText> : null}
|
|
222
|
+
</Pressable>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function FormControl(p: FormControlProps) {
|
|
227
|
+
const c = formControlClasses(p);
|
|
228
|
+
return (
|
|
229
|
+
<View className={c.root} testID={p.testID}>
|
|
230
|
+
{p.label ? (
|
|
231
|
+
<RNText className={c.label}>
|
|
232
|
+
{p.label}
|
|
233
|
+
{p.required ? <RNText className={c.required}> *</RNText> : null}
|
|
234
|
+
</RNText>
|
|
235
|
+
) : null}
|
|
236
|
+
{p.children}
|
|
237
|
+
{p.error ? (
|
|
238
|
+
<RNText accessibilityRole="alert" className={c.error}>
|
|
239
|
+
{p.error}
|
|
240
|
+
</RNText>
|
|
241
|
+
) : p.helper ? (
|
|
242
|
+
<RNText className={c.helper}>{p.helper}</RNText>
|
|
243
|
+
) : null}
|
|
244
|
+
</View>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const Skeleton = (p: SkeletonProps) => {
|
|
249
|
+
const h = p.height ?? 16;
|
|
250
|
+
return (
|
|
251
|
+
<View
|
|
252
|
+
className={skeletonClasses(p)}
|
|
253
|
+
style={{ width: (p.circle ? h : (p.width ?? '100%')) as number, height: h }}
|
|
254
|
+
testID={p.testID}
|
|
255
|
+
/>
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const components: ProviderComponents = {
|
|
260
|
+
...rnBase,
|
|
261
|
+
Button,
|
|
262
|
+
Text,
|
|
263
|
+
Input,
|
|
264
|
+
Card,
|
|
265
|
+
Badge,
|
|
266
|
+
Switch,
|
|
267
|
+
Box,
|
|
268
|
+
View: PlainView,
|
|
269
|
+
Center,
|
|
270
|
+
Divider,
|
|
271
|
+
HStack,
|
|
272
|
+
VStack,
|
|
273
|
+
Heading,
|
|
274
|
+
Link,
|
|
275
|
+
Avatar,
|
|
276
|
+
Progress,
|
|
277
|
+
Checkbox,
|
|
278
|
+
FormControl,
|
|
279
|
+
Skeleton,
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/** NativeWind classes + shadcn-style roles; the CSS variables of the theme are set on a wrapping view (as gluestack does). */
|
|
283
|
+
export const reusables = defineAdapter({
|
|
284
|
+
name: 'reusables',
|
|
285
|
+
Provider: ({ theme, registry, children }) => (
|
|
286
|
+
<View style={[cssVarTables(registry).config[theme.id] as object, { flex: 1 }]}>{children}</View>
|
|
287
|
+
),
|
|
288
|
+
components,
|
|
289
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlatList as RNFlatList } from 'react-native';
|
|
3
|
+
import type { FlatListProps } from '../../contract';
|
|
4
|
+
|
|
5
|
+
export function FlatList(p: FlatListProps) {
|
|
6
|
+
return (
|
|
7
|
+
<RNFlatList
|
|
8
|
+
testID={p.testID}
|
|
9
|
+
data={p.data}
|
|
10
|
+
horizontal={p.horizontal}
|
|
11
|
+
keyExtractor={p.keyExtractor ?? ((_, i) => String(i))}
|
|
12
|
+
renderItem={({ item, index }) => <>{p.renderItem(item, index)}</>}
|
|
13
|
+
ListEmptyComponent={p.empty ? <>{p.empty}</> : undefined}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image as RNImage } from 'react-native';
|
|
3
|
+
import { imageRecipe, type ImageProps } from '../../contract';
|
|
4
|
+
import { useResolvedTheme } from '../provider';
|
|
5
|
+
|
|
6
|
+
export function Image(p: ImageProps) {
|
|
7
|
+
const t = useResolvedTheme();
|
|
8
|
+
return (
|
|
9
|
+
<RNImage
|
|
10
|
+
testID={p.testID}
|
|
11
|
+
source={{ uri: p.source }}
|
|
12
|
+
accessibilityLabel={p.alt}
|
|
13
|
+
alt={p.alt}
|
|
14
|
+
resizeMode={p.resizeMode ?? 'cover'}
|
|
15
|
+
style={imageRecipe(p, t) as never}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ImageBackground as RNImageBackground } from 'react-native';
|
|
3
|
+
import type { ImageBackgroundProps } from '../../contract';
|
|
4
|
+
|
|
5
|
+
export function ImageBackground({ source, children, testID }: ImageBackgroundProps) {
|
|
6
|
+
return (
|
|
7
|
+
<RNImageBackground testID={testID} source={{ uri: source }} resizeMode="cover">
|
|
8
|
+
{children}
|
|
9
|
+
</RNImageBackground>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputAccessoryView as RNInputAccessoryView, Platform } from 'react-native';
|
|
3
|
+
import type { InputAccessoryViewProps } from '../../contract';
|
|
4
|
+
|
|
5
|
+
/** iOS only: other platforms have no such view, so the children are simply not shown. */
|
|
6
|
+
export function InputAccessoryView({ nativeID, children }: InputAccessoryViewProps) {
|
|
7
|
+
if (Platform.OS !== 'ios') return null;
|
|
8
|
+
return <RNInputAccessoryView nativeID={nativeID}>{children}</RNInputAccessoryView>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KeyboardAvoidingView as RNKeyboardAvoidingView, Platform } from 'react-native';
|
|
3
|
+
import type { KeyboardAvoidingViewProps } from '../../contract';
|
|
4
|
+
|
|
5
|
+
export function KeyboardAvoidingView({ children, testID }: KeyboardAvoidingViewProps) {
|
|
6
|
+
return (
|
|
7
|
+
<RNKeyboardAvoidingView
|
|
8
|
+
testID={testID}
|
|
9
|
+
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
10
|
+
style={{ flex: 1 }}
|
|
11
|
+
>
|
|
12
|
+
{children}
|
|
13
|
+
</RNKeyboardAvoidingView>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable as RNPressable } from 'react-native';
|
|
3
|
+
import type { PressableProps } from '../../contract';
|
|
4
|
+
|
|
5
|
+
export function Pressable(p: PressableProps) {
|
|
6
|
+
return (
|
|
7
|
+
<RNPressable
|
|
8
|
+
testID={p.testID}
|
|
9
|
+
accessibilityRole="button"
|
|
10
|
+
accessibilityLabel={p.accessibilityLabel}
|
|
11
|
+
disabled={p.disabled}
|
|
12
|
+
aria-disabled={p.disabled || undefined}
|
|
13
|
+
onPress={p.onPress}
|
|
14
|
+
style={({ pressed }) => ({ opacity: p.disabled ? 0.4 : pressed ? 0.7 : 1 })}
|
|
15
|
+
>
|
|
16
|
+
{p.children}
|
|
17
|
+
</RNPressable>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RefreshControl as RNRefreshControl } from 'react-native';
|
|
3
|
+
import type { RefreshControlProps } from '../../contract';
|
|
4
|
+
import { useResolvedTheme } from '../provider';
|
|
5
|
+
|
|
6
|
+
export function RefreshControl(p: RefreshControlProps) {
|
|
7
|
+
const t = useResolvedTheme();
|
|
8
|
+
return (
|
|
9
|
+
<RNRefreshControl
|
|
10
|
+
refreshing={p.refreshing}
|
|
11
|
+
onRefresh={p.onRefresh}
|
|
12
|
+
tintColor={t.colors.primary}
|
|
13
|
+
colors={[t.colors.primary]}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SafeAreaView as RNSafeAreaView } from 'react-native';
|
|
3
|
+
import type { SafeAreaViewProps } from '../../contract';
|
|
4
|
+
|
|
5
|
+
export function SafeAreaView({ children, testID }: SafeAreaViewProps) {
|
|
6
|
+
return (
|
|
7
|
+
<RNSafeAreaView testID={testID} style={{ flex: 1 }}>
|
|
8
|
+
{children}
|
|
9
|
+
</RNSafeAreaView>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView as RNScrollView } from 'react-native';
|
|
3
|
+
import type { ScrollViewProps } from '../../contract';
|
|
4
|
+
|
|
5
|
+
export function ScrollView({ children, horizontal, testID }: ScrollViewProps) {
|
|
6
|
+
return (
|
|
7
|
+
<RNScrollView testID={testID} horizontal={horizontal}>
|
|
8
|
+
{children}
|
|
9
|
+
</RNScrollView>
|
|
10
|
+
);
|
|
11
|
+
}
|