blend-native 0.0.1-beta.0
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/README.md +404 -0
- package/lib/commonjs/a11y/announcement.js +42 -0
- package/lib/commonjs/a11y/announcement.js.map +1 -0
- package/lib/commonjs/a11y/useLiveRegion.js +37 -0
- package/lib/commonjs/a11y/useLiveRegion.js.map +1 -0
- package/lib/commonjs/adapters/cssStringAdapter.js +363 -0
- package/lib/commonjs/adapters/cssStringAdapter.js.map +1 -0
- package/lib/commonjs/adapters/optionalGradient.js +33 -0
- package/lib/commonjs/adapters/optionalGradient.js.map +1 -0
- package/lib/commonjs/adapters/surfaceStyle.js +159 -0
- package/lib/commonjs/adapters/surfaceStyle.js.map +1 -0
- package/lib/commonjs/components/Alert/Alert.js +130 -0
- package/lib/commonjs/components/Alert/Alert.js.map +1 -0
- package/lib/commonjs/components/Alert/AlertActions.js +74 -0
- package/lib/commonjs/components/Alert/AlertActions.js.map +1 -0
- package/lib/commonjs/components/Alert/AlertClose.js +48 -0
- package/lib/commonjs/components/Alert/AlertClose.js.map +1 -0
- package/lib/commonjs/components/Alert/AlertText.js +49 -0
- package/lib/commonjs/components/Alert/AlertText.js.map +1 -0
- package/lib/commonjs/components/Alert/alert.tokens.js +6 -0
- package/lib/commonjs/components/Alert/alert.tokens.js.map +1 -0
- package/lib/commonjs/components/Alert/alert.types.js +6 -0
- package/lib/commonjs/components/Alert/alert.types.js.map +1 -0
- package/lib/commonjs/components/Alert/alert.utils.js +80 -0
- package/lib/commonjs/components/Alert/alert.utils.js.map +1 -0
- package/lib/commonjs/components/Alert/index.js +51 -0
- package/lib/commonjs/components/Alert/index.js.map +1 -0
- package/lib/commonjs/components/Button/Button.js +125 -0
- package/lib/commonjs/components/Button/Button.js.map +1 -0
- package/lib/commonjs/components/Button/button.types.js +6 -0
- package/lib/commonjs/components/Button/button.types.js.map +1 -0
- package/lib/commonjs/components/Button/button.utils.js +129 -0
- package/lib/commonjs/components/Button/button.utils.js.map +1 -0
- package/lib/commonjs/components/Button/index.js +57 -0
- package/lib/commonjs/components/Button/index.js.map +1 -0
- package/lib/commonjs/components/Skeleton/Skeleton.js +154 -0
- package/lib/commonjs/components/Skeleton/Skeleton.js.map +1 -0
- package/lib/commonjs/components/Skeleton/index.js +20 -0
- package/lib/commonjs/components/Skeleton/index.js.map +1 -0
- package/lib/commonjs/components/Skeleton/skeleton.types.js +6 -0
- package/lib/commonjs/components/Skeleton/skeleton.types.js.map +1 -0
- package/lib/commonjs/components/Skeleton/skeleton.utils.js +45 -0
- package/lib/commonjs/components/Skeleton/skeleton.utils.js.map +1 -0
- package/lib/commonjs/components/Tag/Tag.js +161 -0
- package/lib/commonjs/components/Tag/Tag.js.map +1 -0
- package/lib/commonjs/components/Tag/index.js +33 -0
- package/lib/commonjs/components/Tag/index.js.map +1 -0
- package/lib/commonjs/components/Tag/tag.types.js +6 -0
- package/lib/commonjs/components/Tag/tag.types.js.map +1 -0
- package/lib/commonjs/components/Tag/tag.utils.js +69 -0
- package/lib/commonjs/components/Tag/tag.utils.js.map +1 -0
- package/lib/commonjs/components/TextInput/TextInput.js +138 -0
- package/lib/commonjs/components/TextInput/TextInput.js.map +1 -0
- package/lib/commonjs/components/TextInput/index.js +14 -0
- package/lib/commonjs/components/TextInput/index.js.map +1 -0
- package/lib/commonjs/components/TextInput/textInput.types.js +6 -0
- package/lib/commonjs/components/TextInput/textInput.types.js.map +1 -0
- package/lib/commonjs/components/TextInput/textInput.utils.js +40 -0
- package/lib/commonjs/components/TextInput/textInput.utils.js.map +1 -0
- package/lib/commonjs/components/shared/field/FieldFooter.js +51 -0
- package/lib/commonjs/components/shared/field/FieldFooter.js.map +1 -0
- package/lib/commonjs/components/shared/field/FieldLabels.js +67 -0
- package/lib/commonjs/components/shared/field/FieldLabels.js.map +1 -0
- package/lib/commonjs/components/shared/field/fieldState.js +37 -0
- package/lib/commonjs/components/shared/field/fieldState.js.map +1 -0
- package/lib/commonjs/components/shared/group.js +73 -0
- package/lib/commonjs/components/shared/group.js.map +1 -0
- package/lib/commonjs/index.js +256 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/motion/motion.js +128 -0
- package/lib/commonjs/motion/motion.js.map +1 -0
- package/lib/commonjs/motion/useReduceMotion.js +37 -0
- package/lib/commonjs/motion/useReduceMotion.js.map +1 -0
- package/lib/commonjs/overlay/portal.js +110 -0
- package/lib/commonjs/overlay/portal.js.map +1 -0
- package/lib/commonjs/overlay/positioning.js +122 -0
- package/lib/commonjs/overlay/positioning.js.map +1 -0
- package/lib/commonjs/overlay/safeAreaInsets.js +30 -0
- package/lib/commonjs/overlay/safeAreaInsets.js.map +1 -0
- package/lib/commonjs/overlay/sheet/BottomSheet.js +196 -0
- package/lib/commonjs/overlay/sheet/BottomSheet.js.map +1 -0
- package/lib/commonjs/overlay/sheet/sheetMath.js +60 -0
- package/lib/commonjs/overlay/sheet/sheetMath.js.map +1 -0
- package/lib/commonjs/overlay/toast/ToastOutlet.js +106 -0
- package/lib/commonjs/overlay/toast/ToastOutlet.js.map +1 -0
- package/lib/commonjs/overlay/toast/toastStore.js +76 -0
- package/lib/commonjs/overlay/toast/toastStore.js.map +1 -0
- package/lib/commonjs/overlay/useAnchoredPosition.js +85 -0
- package/lib/commonjs/overlay/useAnchoredPosition.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/primitives/Block.js +112 -0
- package/lib/commonjs/primitives/Block.js.map +1 -0
- package/lib/commonjs/primitives/Pressable.js +348 -0
- package/lib/commonjs/primitives/Pressable.js.map +1 -0
- package/lib/commonjs/primitives/PrimitiveInput.js +66 -0
- package/lib/commonjs/primitives/PrimitiveInput.js.map +1 -0
- package/lib/commonjs/primitives/Separator.js +55 -0
- package/lib/commonjs/primitives/Separator.js.map +1 -0
- package/lib/commonjs/primitives/Slot.js +78 -0
- package/lib/commonjs/primitives/Slot.js.map +1 -0
- package/lib/commonjs/primitives/Text.js +73 -0
- package/lib/commonjs/primitives/Text.js.map +1 -0
- package/lib/commonjs/primitives/pressFeedback.js +53 -0
- package/lib/commonjs/primitives/pressFeedback.js.map +1 -0
- package/lib/commonjs/primitives/textStyle.js +27 -0
- package/lib/commonjs/primitives/textStyle.js.map +1 -0
- package/lib/commonjs/primitives/tintSlot.js +45 -0
- package/lib/commonjs/primitives/tintSlot.js.map +1 -0
- package/lib/commonjs/primitives/touchTarget.js +64 -0
- package/lib/commonjs/primitives/touchTarget.js.map +1 -0
- package/lib/commonjs/theme/BlendNativeProvider.js +90 -0
- package/lib/commonjs/theme/BlendNativeProvider.js.map +1 -0
- package/lib/commonjs/theme/breakpoint.js +36 -0
- package/lib/commonjs/theme/breakpoint.js.map +1 -0
- package/lib/commonjs/theme/fonts.js +58 -0
- package/lib/commonjs/theme/fonts.js.map +1 -0
- package/lib/commonjs/theme/nativeTokenRegistry.js +44 -0
- package/lib/commonjs/theme/nativeTokenRegistry.js.map +1 -0
- package/lib/commonjs/theme/systemTheme.js +35 -0
- package/lib/commonjs/theme/systemTheme.js.map +1 -0
- package/lib/commonjs/theme/useNativeBreakpoint.js +33 -0
- package/lib/commonjs/theme/useNativeBreakpoint.js.map +1 -0
- package/lib/commonjs/theme/useNativeTokens.js +71 -0
- package/lib/commonjs/theme/useNativeTokens.js.map +1 -0
- package/lib/module/a11y/announcement.js +38 -0
- package/lib/module/a11y/announcement.js.map +1 -0
- package/lib/module/a11y/useLiveRegion.js +33 -0
- package/lib/module/a11y/useLiveRegion.js.map +1 -0
- package/lib/module/adapters/cssStringAdapter.js +352 -0
- package/lib/module/adapters/cssStringAdapter.js.map +1 -0
- package/lib/module/adapters/optionalGradient.js +29 -0
- package/lib/module/adapters/optionalGradient.js.map +1 -0
- package/lib/module/adapters/surfaceStyle.js +155 -0
- package/lib/module/adapters/surfaceStyle.js.map +1 -0
- package/lib/module/components/Alert/Alert.js +126 -0
- package/lib/module/components/Alert/Alert.js.map +1 -0
- package/lib/module/components/Alert/AlertActions.js +70 -0
- package/lib/module/components/Alert/AlertActions.js.map +1 -0
- package/lib/module/components/Alert/AlertClose.js +44 -0
- package/lib/module/components/Alert/AlertClose.js.map +1 -0
- package/lib/module/components/Alert/AlertText.js +45 -0
- package/lib/module/components/Alert/AlertText.js.map +1 -0
- package/lib/module/components/Alert/alert.tokens.js +4 -0
- package/lib/module/components/Alert/alert.tokens.js.map +1 -0
- package/lib/module/components/Alert/alert.types.js +4 -0
- package/lib/module/components/Alert/alert.types.js.map +1 -0
- package/lib/module/components/Alert/alert.utils.js +72 -0
- package/lib/module/components/Alert/alert.utils.js.map +1 -0
- package/lib/module/components/Alert/index.js +6 -0
- package/lib/module/components/Alert/index.js.map +1 -0
- package/lib/module/components/Button/Button.js +121 -0
- package/lib/module/components/Button/Button.js.map +1 -0
- package/lib/module/components/Button/button.types.js +4 -0
- package/lib/module/components/Button/button.types.js.map +1 -0
- package/lib/module/components/Button/button.utils.js +120 -0
- package/lib/module/components/Button/button.utils.js.map +1 -0
- package/lib/module/components/Button/index.js +5 -0
- package/lib/module/components/Button/index.js.map +1 -0
- package/lib/module/components/Skeleton/Skeleton.js +149 -0
- package/lib/module/components/Skeleton/Skeleton.js.map +1 -0
- package/lib/module/components/Skeleton/index.js +4 -0
- package/lib/module/components/Skeleton/index.js.map +1 -0
- package/lib/module/components/Skeleton/skeleton.types.js +4 -0
- package/lib/module/components/Skeleton/skeleton.types.js.map +1 -0
- package/lib/module/components/Skeleton/skeleton.utils.js +40 -0
- package/lib/module/components/Skeleton/skeleton.utils.js.map +1 -0
- package/lib/module/components/Tag/Tag.js +157 -0
- package/lib/module/components/Tag/Tag.js.map +1 -0
- package/lib/module/components/Tag/index.js +5 -0
- package/lib/module/components/Tag/index.js.map +1 -0
- package/lib/module/components/Tag/tag.types.js +4 -0
- package/lib/module/components/Tag/tag.types.js.map +1 -0
- package/lib/module/components/Tag/tag.utils.js +64 -0
- package/lib/module/components/Tag/tag.utils.js.map +1 -0
- package/lib/module/components/TextInput/TextInput.js +134 -0
- package/lib/module/components/TextInput/TextInput.js.map +1 -0
- package/lib/module/components/TextInput/index.js +4 -0
- package/lib/module/components/TextInput/index.js.map +1 -0
- package/lib/module/components/TextInput/textInput.types.js +4 -0
- package/lib/module/components/TextInput/textInput.types.js.map +1 -0
- package/lib/module/components/TextInput/textInput.utils.js +36 -0
- package/lib/module/components/TextInput/textInput.utils.js.map +1 -0
- package/lib/module/components/shared/field/FieldFooter.js +47 -0
- package/lib/module/components/shared/field/FieldFooter.js.map +1 -0
- package/lib/module/components/shared/field/FieldLabels.js +63 -0
- package/lib/module/components/shared/field/FieldLabels.js.map +1 -0
- package/lib/module/components/shared/field/fieldState.js +33 -0
- package/lib/module/components/shared/field/fieldState.js.map +1 -0
- package/lib/module/components/shared/group.js +68 -0
- package/lib/module/components/shared/group.js.map +1 -0
- package/lib/module/index.js +80 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/motion/motion.js +123 -0
- package/lib/module/motion/motion.js.map +1 -0
- package/lib/module/motion/useReduceMotion.js +33 -0
- package/lib/module/motion/useReduceMotion.js.map +1 -0
- package/lib/module/overlay/portal.js +104 -0
- package/lib/module/overlay/portal.js.map +1 -0
- package/lib/module/overlay/positioning.js +118 -0
- package/lib/module/overlay/positioning.js.map +1 -0
- package/lib/module/overlay/safeAreaInsets.js +27 -0
- package/lib/module/overlay/safeAreaInsets.js.map +1 -0
- package/lib/module/overlay/sheet/BottomSheet.js +190 -0
- package/lib/module/overlay/sheet/BottomSheet.js.map +1 -0
- package/lib/module/overlay/sheet/sheetMath.js +53 -0
- package/lib/module/overlay/sheet/sheetMath.js.map +1 -0
- package/lib/module/overlay/toast/ToastOutlet.js +101 -0
- package/lib/module/overlay/toast/ToastOutlet.js.map +1 -0
- package/lib/module/overlay/toast/toastStore.js +66 -0
- package/lib/module/overlay/toast/toastStore.js.map +1 -0
- package/lib/module/overlay/useAnchoredPosition.js +82 -0
- package/lib/module/overlay/useAnchoredPosition.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/primitives/Block.js +107 -0
- package/lib/module/primitives/Block.js.map +1 -0
- package/lib/module/primitives/Pressable.js +339 -0
- package/lib/module/primitives/Pressable.js.map +1 -0
- package/lib/module/primitives/PrimitiveInput.js +62 -0
- package/lib/module/primitives/PrimitiveInput.js.map +1 -0
- package/lib/module/primitives/Separator.js +50 -0
- package/lib/module/primitives/Separator.js.map +1 -0
- package/lib/module/primitives/Slot.js +69 -0
- package/lib/module/primitives/Slot.js.map +1 -0
- package/lib/module/primitives/Text.js +68 -0
- package/lib/module/primitives/Text.js.map +1 -0
- package/lib/module/primitives/pressFeedback.js +48 -0
- package/lib/module/primitives/pressFeedback.js.map +1 -0
- package/lib/module/primitives/textStyle.js +23 -0
- package/lib/module/primitives/textStyle.js.map +1 -0
- package/lib/module/primitives/tintSlot.js +42 -0
- package/lib/module/primitives/tintSlot.js.map +1 -0
- package/lib/module/primitives/touchTarget.js +58 -0
- package/lib/module/primitives/touchTarget.js.map +1 -0
- package/lib/module/theme/BlendNativeProvider.js +78 -0
- package/lib/module/theme/BlendNativeProvider.js.map +1 -0
- package/lib/module/theme/breakpoint.js +33 -0
- package/lib/module/theme/breakpoint.js.map +1 -0
- package/lib/module/theme/fonts.js +55 -0
- package/lib/module/theme/fonts.js.map +1 -0
- package/lib/module/theme/nativeTokenRegistry.js +40 -0
- package/lib/module/theme/nativeTokenRegistry.js.map +1 -0
- package/lib/module/theme/systemTheme.js +31 -0
- package/lib/module/theme/systemTheme.js.map +1 -0
- package/lib/module/theme/useNativeBreakpoint.js +24 -0
- package/lib/module/theme/useNativeBreakpoint.js.map +1 -0
- package/lib/module/theme/useNativeTokens.js +67 -0
- package/lib/module/theme/useNativeTokens.js.map +1 -0
- package/lib/typescript/commonjs/a11y/announcement.d.ts +26 -0
- package/lib/typescript/commonjs/a11y/announcement.d.ts.map +1 -0
- package/lib/typescript/commonjs/a11y/useLiveRegion.d.ts +17 -0
- package/lib/typescript/commonjs/a11y/useLiveRegion.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapters/cssStringAdapter.d.ts +119 -0
- package/lib/typescript/commonjs/adapters/cssStringAdapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapters/optionalGradient.d.ts +32 -0
- package/lib/typescript/commonjs/adapters/optionalGradient.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapters/surfaceStyle.d.ts +75 -0
- package/lib/typescript/commonjs/adapters/surfaceStyle.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/Alert.d.ts +14 -0
- package/lib/typescript/commonjs/components/Alert/Alert.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/AlertActions.d.ts +13 -0
- package/lib/typescript/commonjs/components/Alert/AlertActions.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/AlertClose.d.ts +22 -0
- package/lib/typescript/commonjs/components/Alert/AlertClose.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/AlertText.d.ts +19 -0
- package/lib/typescript/commonjs/components/Alert/AlertText.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/alert.tokens.d.ts +17 -0
- package/lib/typescript/commonjs/components/Alert/alert.tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/alert.types.d.ts +70 -0
- package/lib/typescript/commonjs/components/Alert/alert.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/alert.utils.d.ts +58 -0
- package/lib/typescript/commonjs/components/Alert/alert.utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/index.d.ts +7 -0
- package/lib/typescript/commonjs/components/Alert/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +22 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Button/button.types.d.ts +37 -0
- package/lib/typescript/commonjs/components/Button/button.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Button/button.utils.d.ts +98 -0
- package/lib/typescript/commonjs/components/Button/button.utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Button/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +7 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Skeleton/skeleton.types.d.ts +25 -0
- package/lib/typescript/commonjs/components/Skeleton/skeleton.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Skeleton/skeleton.utils.d.ts +21 -0
- package/lib/typescript/commonjs/components/Skeleton/skeleton.utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Tag/Tag.d.ts +21 -0
- package/lib/typescript/commonjs/components/Tag/Tag.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Tag/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/Tag/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Tag/tag.types.d.ts +56 -0
- package/lib/typescript/commonjs/components/Tag/tag.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Tag/tag.utils.d.ts +41 -0
- package/lib/typescript/commonjs/components/Tag/tag.utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/TextInput/TextInput.d.ts +33 -0
- package/lib/typescript/commonjs/components/TextInput/TextInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/TextInput/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/TextInput/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/TextInput/textInput.types.d.ts +45 -0
- package/lib/typescript/commonjs/components/TextInput/textInput.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/TextInput/textInput.utils.d.ts +35 -0
- package/lib/typescript/commonjs/components/TextInput/textInput.utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/shared/field/FieldFooter.d.ts +22 -0
- package/lib/typescript/commonjs/components/shared/field/FieldFooter.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/shared/field/FieldLabels.d.ts +27 -0
- package/lib/typescript/commonjs/components/shared/field/FieldLabels.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/shared/field/fieldState.d.ts +23 -0
- package/lib/typescript/commonjs/components/shared/field/fieldState.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/shared/group.d.ts +50 -0
- package/lib/typescript/commonjs/components/shared/group.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +74 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/motion/motion.d.ts +121 -0
- package/lib/typescript/commonjs/motion/motion.d.ts.map +1 -0
- package/lib/typescript/commonjs/motion/useReduceMotion.d.ts +14 -0
- package/lib/typescript/commonjs/motion/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/portal.d.ts +20 -0
- package/lib/typescript/commonjs/overlay/portal.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/positioning.d.ts +65 -0
- package/lib/typescript/commonjs/overlay/positioning.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/safeAreaInsets.d.ts +19 -0
- package/lib/typescript/commonjs/overlay/safeAreaInsets.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/sheet/BottomSheet.d.ts +56 -0
- package/lib/typescript/commonjs/overlay/sheet/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/sheet/sheetMath.d.ts +32 -0
- package/lib/typescript/commonjs/overlay/sheet/sheetMath.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/toast/ToastOutlet.d.ts +17 -0
- package/lib/typescript/commonjs/overlay/toast/ToastOutlet.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/toast/toastStore.d.ts +45 -0
- package/lib/typescript/commonjs/overlay/toast/toastStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/useAnchoredPosition.d.ts +40 -0
- package/lib/typescript/commonjs/overlay/useAnchoredPosition.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/primitives/Block.d.ts +37 -0
- package/lib/typescript/commonjs/primitives/Block.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/Pressable.d.ts +135 -0
- package/lib/typescript/commonjs/primitives/Pressable.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/PrimitiveInput.d.ts +42 -0
- package/lib/typescript/commonjs/primitives/PrimitiveInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/Separator.d.ts +28 -0
- package/lib/typescript/commonjs/primitives/Separator.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/Slot.d.ts +48 -0
- package/lib/typescript/commonjs/primitives/Slot.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/Text.d.ts +50 -0
- package/lib/typescript/commonjs/primitives/Text.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/pressFeedback.d.ts +39 -0
- package/lib/typescript/commonjs/primitives/pressFeedback.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/textStyle.d.ts +13 -0
- package/lib/typescript/commonjs/primitives/textStyle.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/tintSlot.d.ts +10 -0
- package/lib/typescript/commonjs/primitives/tintSlot.d.ts.map +1 -0
- package/lib/typescript/commonjs/primitives/touchTarget.d.ts +43 -0
- package/lib/typescript/commonjs/primitives/touchTarget.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/BlendNativeProvider.d.ts +69 -0
- package/lib/typescript/commonjs/theme/BlendNativeProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/breakpoint.d.ts +27 -0
- package/lib/typescript/commonjs/theme/breakpoint.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/fonts.d.ts +34 -0
- package/lib/typescript/commonjs/theme/fonts.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/nativeTokenRegistry.d.ts +34 -0
- package/lib/typescript/commonjs/theme/nativeTokenRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/systemTheme.d.ts +25 -0
- package/lib/typescript/commonjs/theme/systemTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/useNativeBreakpoint.d.ts +17 -0
- package/lib/typescript/commonjs/theme/useNativeBreakpoint.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/useNativeTokens.d.ts +4 -0
- package/lib/typescript/commonjs/theme/useNativeTokens.d.ts.map +1 -0
- package/lib/typescript/module/a11y/announcement.d.ts +26 -0
- package/lib/typescript/module/a11y/announcement.d.ts.map +1 -0
- package/lib/typescript/module/a11y/useLiveRegion.d.ts +17 -0
- package/lib/typescript/module/a11y/useLiveRegion.d.ts.map +1 -0
- package/lib/typescript/module/adapters/cssStringAdapter.d.ts +119 -0
- package/lib/typescript/module/adapters/cssStringAdapter.d.ts.map +1 -0
- package/lib/typescript/module/adapters/optionalGradient.d.ts +32 -0
- package/lib/typescript/module/adapters/optionalGradient.d.ts.map +1 -0
- package/lib/typescript/module/adapters/surfaceStyle.d.ts +75 -0
- package/lib/typescript/module/adapters/surfaceStyle.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/Alert.d.ts +14 -0
- package/lib/typescript/module/components/Alert/Alert.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/AlertActions.d.ts +13 -0
- package/lib/typescript/module/components/Alert/AlertActions.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/AlertClose.d.ts +22 -0
- package/lib/typescript/module/components/Alert/AlertClose.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/AlertText.d.ts +19 -0
- package/lib/typescript/module/components/Alert/AlertText.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/alert.tokens.d.ts +17 -0
- package/lib/typescript/module/components/Alert/alert.tokens.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/alert.types.d.ts +70 -0
- package/lib/typescript/module/components/Alert/alert.types.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/alert.utils.d.ts +58 -0
- package/lib/typescript/module/components/Alert/alert.utils.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/index.d.ts +7 -0
- package/lib/typescript/module/components/Alert/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Button/Button.d.ts +22 -0
- package/lib/typescript/module/components/Button/Button.d.ts.map +1 -0
- package/lib/typescript/module/components/Button/button.types.d.ts +37 -0
- package/lib/typescript/module/components/Button/button.types.d.ts.map +1 -0
- package/lib/typescript/module/components/Button/button.utils.d.ts +98 -0
- package/lib/typescript/module/components/Button/button.utils.d.ts.map +1 -0
- package/lib/typescript/module/components/Button/index.d.ts +5 -0
- package/lib/typescript/module/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +7 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/typescript/module/components/Skeleton/index.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Skeleton/skeleton.types.d.ts +25 -0
- package/lib/typescript/module/components/Skeleton/skeleton.types.d.ts.map +1 -0
- package/lib/typescript/module/components/Skeleton/skeleton.utils.d.ts +21 -0
- package/lib/typescript/module/components/Skeleton/skeleton.utils.d.ts.map +1 -0
- package/lib/typescript/module/components/Tag/Tag.d.ts +21 -0
- package/lib/typescript/module/components/Tag/Tag.d.ts.map +1 -0
- package/lib/typescript/module/components/Tag/index.d.ts +4 -0
- package/lib/typescript/module/components/Tag/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Tag/tag.types.d.ts +56 -0
- package/lib/typescript/module/components/Tag/tag.types.d.ts.map +1 -0
- package/lib/typescript/module/components/Tag/tag.utils.d.ts +41 -0
- package/lib/typescript/module/components/Tag/tag.utils.d.ts.map +1 -0
- package/lib/typescript/module/components/TextInput/TextInput.d.ts +33 -0
- package/lib/typescript/module/components/TextInput/TextInput.d.ts.map +1 -0
- package/lib/typescript/module/components/TextInput/index.d.ts +3 -0
- package/lib/typescript/module/components/TextInput/index.d.ts.map +1 -0
- package/lib/typescript/module/components/TextInput/textInput.types.d.ts +45 -0
- package/lib/typescript/module/components/TextInput/textInput.types.d.ts.map +1 -0
- package/lib/typescript/module/components/TextInput/textInput.utils.d.ts +35 -0
- package/lib/typescript/module/components/TextInput/textInput.utils.d.ts.map +1 -0
- package/lib/typescript/module/components/shared/field/FieldFooter.d.ts +22 -0
- package/lib/typescript/module/components/shared/field/FieldFooter.d.ts.map +1 -0
- package/lib/typescript/module/components/shared/field/FieldLabels.d.ts +27 -0
- package/lib/typescript/module/components/shared/field/FieldLabels.d.ts.map +1 -0
- package/lib/typescript/module/components/shared/field/fieldState.d.ts +23 -0
- package/lib/typescript/module/components/shared/field/fieldState.d.ts.map +1 -0
- package/lib/typescript/module/components/shared/group.d.ts +50 -0
- package/lib/typescript/module/components/shared/group.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +74 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/motion/motion.d.ts +121 -0
- package/lib/typescript/module/motion/motion.d.ts.map +1 -0
- package/lib/typescript/module/motion/useReduceMotion.d.ts +14 -0
- package/lib/typescript/module/motion/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/module/overlay/portal.d.ts +20 -0
- package/lib/typescript/module/overlay/portal.d.ts.map +1 -0
- package/lib/typescript/module/overlay/positioning.d.ts +65 -0
- package/lib/typescript/module/overlay/positioning.d.ts.map +1 -0
- package/lib/typescript/module/overlay/safeAreaInsets.d.ts +19 -0
- package/lib/typescript/module/overlay/safeAreaInsets.d.ts.map +1 -0
- package/lib/typescript/module/overlay/sheet/BottomSheet.d.ts +56 -0
- package/lib/typescript/module/overlay/sheet/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/module/overlay/sheet/sheetMath.d.ts +32 -0
- package/lib/typescript/module/overlay/sheet/sheetMath.d.ts.map +1 -0
- package/lib/typescript/module/overlay/toast/ToastOutlet.d.ts +17 -0
- package/lib/typescript/module/overlay/toast/ToastOutlet.d.ts.map +1 -0
- package/lib/typescript/module/overlay/toast/toastStore.d.ts +45 -0
- package/lib/typescript/module/overlay/toast/toastStore.d.ts.map +1 -0
- package/lib/typescript/module/overlay/useAnchoredPosition.d.ts +40 -0
- package/lib/typescript/module/overlay/useAnchoredPosition.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/primitives/Block.d.ts +37 -0
- package/lib/typescript/module/primitives/Block.d.ts.map +1 -0
- package/lib/typescript/module/primitives/Pressable.d.ts +135 -0
- package/lib/typescript/module/primitives/Pressable.d.ts.map +1 -0
- package/lib/typescript/module/primitives/PrimitiveInput.d.ts +42 -0
- package/lib/typescript/module/primitives/PrimitiveInput.d.ts.map +1 -0
- package/lib/typescript/module/primitives/Separator.d.ts +28 -0
- package/lib/typescript/module/primitives/Separator.d.ts.map +1 -0
- package/lib/typescript/module/primitives/Slot.d.ts +48 -0
- package/lib/typescript/module/primitives/Slot.d.ts.map +1 -0
- package/lib/typescript/module/primitives/Text.d.ts +50 -0
- package/lib/typescript/module/primitives/Text.d.ts.map +1 -0
- package/lib/typescript/module/primitives/pressFeedback.d.ts +39 -0
- package/lib/typescript/module/primitives/pressFeedback.d.ts.map +1 -0
- package/lib/typescript/module/primitives/textStyle.d.ts +13 -0
- package/lib/typescript/module/primitives/textStyle.d.ts.map +1 -0
- package/lib/typescript/module/primitives/tintSlot.d.ts +10 -0
- package/lib/typescript/module/primitives/tintSlot.d.ts.map +1 -0
- package/lib/typescript/module/primitives/touchTarget.d.ts +43 -0
- package/lib/typescript/module/primitives/touchTarget.d.ts.map +1 -0
- package/lib/typescript/module/theme/BlendNativeProvider.d.ts +69 -0
- package/lib/typescript/module/theme/BlendNativeProvider.d.ts.map +1 -0
- package/lib/typescript/module/theme/breakpoint.d.ts +27 -0
- package/lib/typescript/module/theme/breakpoint.d.ts.map +1 -0
- package/lib/typescript/module/theme/fonts.d.ts +34 -0
- package/lib/typescript/module/theme/fonts.d.ts.map +1 -0
- package/lib/typescript/module/theme/nativeTokenRegistry.d.ts +34 -0
- package/lib/typescript/module/theme/nativeTokenRegistry.d.ts.map +1 -0
- package/lib/typescript/module/theme/systemTheme.d.ts +25 -0
- package/lib/typescript/module/theme/systemTheme.d.ts.map +1 -0
- package/lib/typescript/module/theme/useNativeBreakpoint.d.ts +17 -0
- package/lib/typescript/module/theme/useNativeBreakpoint.d.ts.map +1 -0
- package/lib/typescript/module/theme/useNativeTokens.d.ts +4 -0
- package/lib/typescript/module/theme/useNativeTokens.d.ts.map +1 -0
- package/package.json +137 -0
- package/src/a11y/announcement.ts +41 -0
- package/src/a11y/useLiveRegion.ts +36 -0
- package/src/adapters/cssStringAdapter.ts +403 -0
- package/src/adapters/optionalGradient.ts +39 -0
- package/src/adapters/surfaceStyle.ts +209 -0
- package/src/components/Alert/Alert.tsx +167 -0
- package/src/components/Alert/AlertActions.tsx +98 -0
- package/src/components/Alert/AlertClose.tsx +53 -0
- package/src/components/Alert/AlertText.tsx +58 -0
- package/src/components/Alert/alert.tokens.ts +24 -0
- package/src/components/Alert/alert.types.ts +81 -0
- package/src/components/Alert/alert.utils.ts +94 -0
- package/src/components/Alert/index.ts +21 -0
- package/src/components/Button/Button.tsx +180 -0
- package/src/components/Button/button.types.ts +44 -0
- package/src/components/Button/button.utils.ts +213 -0
- package/src/components/Button/index.ts +12 -0
- package/src/components/Skeleton/Skeleton.tsx +196 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Skeleton/skeleton.types.ts +28 -0
- package/src/components/Skeleton/skeleton.utils.ts +56 -0
- package/src/components/Tag/Tag.tsx +204 -0
- package/src/components/Tag/index.ts +7 -0
- package/src/components/Tag/tag.types.ts +63 -0
- package/src/components/Tag/tag.utils.ts +82 -0
- package/src/components/TextInput/TextInput.tsx +165 -0
- package/src/components/TextInput/index.ts +2 -0
- package/src/components/TextInput/textInput.types.ts +54 -0
- package/src/components/TextInput/textInput.utils.ts +68 -0
- package/src/components/shared/field/FieldFooter.tsx +66 -0
- package/src/components/shared/field/FieldLabels.tsx +86 -0
- package/src/components/shared/field/fieldState.ts +39 -0
- package/src/components/shared/group.ts +72 -0
- package/src/index.ts +144 -0
- package/src/motion/motion.ts +115 -0
- package/src/motion/useReduceMotion.ts +36 -0
- package/src/overlay/portal.tsx +122 -0
- package/src/overlay/positioning.ts +196 -0
- package/src/overlay/safeAreaInsets.ts +36 -0
- package/src/overlay/sheet/BottomSheet.tsx +276 -0
- package/src/overlay/sheet/sheetMath.ts +58 -0
- package/src/overlay/toast/ToastOutlet.tsx +127 -0
- package/src/overlay/toast/toastStore.ts +96 -0
- package/src/overlay/useAnchoredPosition.ts +92 -0
- package/src/primitives/Block.tsx +129 -0
- package/src/primitives/Pressable.tsx +528 -0
- package/src/primitives/PrimitiveInput.tsx +87 -0
- package/src/primitives/Separator.tsx +65 -0
- package/src/primitives/Slot.tsx +94 -0
- package/src/primitives/Text.tsx +98 -0
- package/src/primitives/pressFeedback.ts +78 -0
- package/src/primitives/textStyle.ts +24 -0
- package/src/primitives/tintSlot.ts +44 -0
- package/src/primitives/touchTarget.ts +72 -0
- package/src/theme/BlendNativeProvider.tsx +147 -0
- package/src/theme/breakpoint.ts +38 -0
- package/src/theme/fonts.ts +63 -0
- package/src/theme/nativeTokenRegistry.ts +57 -0
- package/src/theme/systemTheme.ts +34 -0
- package/src/theme/useNativeBreakpoint.ts +27 -0
- package/src/theme/useNativeTokens.ts +99 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared styling for grouped controls (button groups, tag groups).
|
|
5
|
+
*
|
|
6
|
+
* Members join edge to edge, so each keeps its radius only on the outward
|
|
7
|
+
* corners, and interior members drop the borders they would otherwise double
|
|
8
|
+
* up with their neighbour. Web implements the radius half identically in
|
|
9
|
+
* `ButtonV2/utils.ts` and `TagV2/utils.ts`, and the border half in
|
|
10
|
+
* `ButtonV2/utils.ts` (`getButtonBorderStyles`).
|
|
11
|
+
*
|
|
12
|
+
* Mirrors `components/shared/` in the web package, which holds cross-component
|
|
13
|
+
* internals rather than components.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Where a control sits within its group. `undefined` means ungrouped. */
|
|
17
|
+
|
|
18
|
+
/** Every corner squared — the interior members of a group. */
|
|
19
|
+
const ALL_SQUARE = '0px 0px 0px 0px';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Collapse a control's border radius for its position in a group.
|
|
23
|
+
*
|
|
24
|
+
* Returns a CSS string — either the untouched radius or a four-corner
|
|
25
|
+
* shorthand in CSS order (top-left, top-right, bottom-right, bottom-left).
|
|
26
|
+
* `parseBorderRadius` handles both forms.
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
* getGroupedBorderRadius('10px', undefined) -> '10px'
|
|
30
|
+
* getGroupedBorderRadius('10px', 'left') -> '10px 0 0 10px'
|
|
31
|
+
* getGroupedBorderRadius('10px', 'right') -> '0 10px 10px 0'
|
|
32
|
+
* getGroupedBorderRadius('10px', 'center') -> '0px 0px 0px 0px'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function getGroupedBorderRadius(radius, position) {
|
|
36
|
+
const value = String(radius);
|
|
37
|
+
if (position === undefined) return value;
|
|
38
|
+
if (position === 'left') return `${value} 0 0 ${value}`;
|
|
39
|
+
if (position === 'right') return `0 ${value} ${value} 0`;
|
|
40
|
+
return ALL_SQUARE;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Border widths to overlay for a control's position in a group.
|
|
45
|
+
*
|
|
46
|
+
* Interior (`center`) members drop their left and right borders so a shared
|
|
47
|
+
* edge is one line wide rather than two. Web does this in
|
|
48
|
+
* `getButtonBorderStyles`, which sets `borderLeft`/`borderRight` to `'none'`
|
|
49
|
+
* for the centre position and leaves the end caps fully bordered.
|
|
50
|
+
*
|
|
51
|
+
* Returned as a `ViewStyle` fragment to spread *after* the resolved surface,
|
|
52
|
+
* so `borderWidth: 1` still applies to the remaining sides.
|
|
53
|
+
*
|
|
54
|
+
* ```
|
|
55
|
+
* getGroupedBorderWidths(undefined) -> {}
|
|
56
|
+
* getGroupedBorderWidths('left') -> {}
|
|
57
|
+
* getGroupedBorderWidths('right') -> {}
|
|
58
|
+
* getGroupedBorderWidths('center') -> { borderLeftWidth: 0, borderRightWidth: 0 }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function getGroupedBorderWidths(position) {
|
|
62
|
+
if (position !== 'center') return {};
|
|
63
|
+
return {
|
|
64
|
+
borderLeftWidth: 0,
|
|
65
|
+
borderRightWidth: 0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ALL_SQUARE","getGroupedBorderRadius","radius","position","value","String","undefined","getGroupedBorderWidths","borderLeftWidth","borderRightWidth"],"sourceRoot":"../../../../src","sources":["components/shared/group.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAGA;AACA,MAAMA,UAAU,GAAG,iBAAiB;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAClCC,MAAuB,EACvBC,QAAmC,EAC7B;EACN,MAAMC,KAAK,GAAGC,MAAM,CAACH,MAAM,CAAC;EAE5B,IAAIC,QAAQ,KAAKG,SAAS,EAAE,OAAOF,KAAK;EACxC,IAAID,QAAQ,KAAK,MAAM,EAAE,OAAO,GAAGC,KAAK,QAAQA,KAAK,EAAE;EACvD,IAAID,QAAQ,KAAK,OAAO,EAAE,OAAO,KAAKC,KAAK,IAAIA,KAAK,IAAI;EAExD,OAAOJ,UAAU;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,sBAAsBA,CAClCJ,QAAmC,EACoB;EACvD,IAAIA,QAAQ,KAAK,QAAQ,EAAE,OAAO,CAAC,CAAC;EACpC,OAAO;IAAEK,eAAe,EAAE,CAAC;IAAEC,gBAAgB,EAAE;EAAE,CAAC;AACtD","ignoreList":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* blend-native — React Native components for Blend Design System.
|
|
5
|
+
*
|
|
6
|
+
* Consumes Blend's token system via the React-free
|
|
7
|
+
* `@juspay/blend-design-system/node` entry and translates CSS-string token
|
|
8
|
+
* values into RN style objects.
|
|
9
|
+
*
|
|
10
|
+
* No `styled-components`, no DOM, no `window.addEventListener`.
|
|
11
|
+
*
|
|
12
|
+
* ---
|
|
13
|
+
*
|
|
14
|
+
* This barrel is the package's **public API**, and everything named here is a
|
|
15
|
+
* semver commitment. Low-level internals — the CSS-string parsers, the surface
|
|
16
|
+
* resolver, the token registry, the grouped-control helpers — are deliberately
|
|
17
|
+
* NOT exported: they exist to serve the primitives, their shapes will change as
|
|
18
|
+
* more components land, and `Block` / `Pressable` already expose everything a
|
|
19
|
+
* consumer needs to build a token-driven surface of their own.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// ---- Components ---------------------------------------------------------
|
|
23
|
+
export { Alert } from "./components/Alert/index.js";
|
|
24
|
+
export { Button } from "./components/Button/index.js";
|
|
25
|
+
export { Tag } from "./components/Tag/index.js";
|
|
26
|
+
export { TextInput } from "./components/TextInput/index.js";
|
|
27
|
+
export { Skeleton } from "./components/Skeleton/index.js";
|
|
28
|
+
// ---- Theming ------------------------------------------------------------
|
|
29
|
+
export { BlendNativeProvider, BlendNativeThemeContext, DEFAULT_NATIVE_THEME } from "./theme/BlendNativeProvider.js";
|
|
30
|
+
/** Pass `theme={SYSTEM_THEME}` (or `theme="system"`) to follow the OS. */
|
|
31
|
+
export { SYSTEM_THEME } from "./theme/systemTheme.js";
|
|
32
|
+
export { useNativeTokens } from "./theme/useNativeTokens.js";
|
|
33
|
+
export { useNativeBreakpoint } from "./theme/useNativeBreakpoint.js";
|
|
34
|
+
// ---- Primitives ---------------------------------------------------------
|
|
35
|
+
// Exported so consumers can compose token-driven surfaces of their own.
|
|
36
|
+
export { Block } from "./primitives/Block.js";
|
|
37
|
+
export { Pressable } from "./primitives/Pressable.js";
|
|
38
|
+
export { Text } from "./primitives/Text.js";
|
|
39
|
+
export { Slot } from "./primitives/Slot.js";
|
|
40
|
+
export { Separator } from "./primitives/Separator.js";
|
|
41
|
+
export { PrimitiveInput } from "./primitives/PrimitiveInput.js";
|
|
42
|
+
|
|
43
|
+
// The shared base both `Block` and `Pressable` accept — needed to type a
|
|
44
|
+
// wrapper around either.
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The minimum tap target `Pressable` enforces via `hitSlop`, in points.
|
|
48
|
+
* Exposed so consumers can reason about it; pass `minTouchTarget={0}` to opt
|
|
49
|
+
* a control out.
|
|
50
|
+
*/
|
|
51
|
+
export { MIN_TOUCH_TARGET } from "./primitives/touchTarget.js";
|
|
52
|
+
|
|
53
|
+
// ---- Overlay & motion ---------------------------------------------------
|
|
54
|
+
// `Portal` renders content into the provider's overlay layer (above the
|
|
55
|
+
// app), and `useReduceMotion` mirrors web's prefers-reduced-motion. The
|
|
56
|
+
// positioning engine and motion presets stay internal until the overlay
|
|
57
|
+
// components stabilise their shapes.
|
|
58
|
+
export { Portal } from "./overlay/portal.js";
|
|
59
|
+
export { useReduceMotion } from "./motion/useReduceMotion.js";
|
|
60
|
+
|
|
61
|
+
// The gesture-driven sheet foundation — DrawerV2 and the phone modes of
|
|
62
|
+
// Select/Menu/Modal compose it; also public for consumer-built sheets.
|
|
63
|
+
export { BottomSheet } from "./overlay/sheet/BottomSheet.js";
|
|
64
|
+
// The toast host: the provider mounts the outlet, this pair drives it.
|
|
65
|
+
// SnackbarV2 will layer token styling on top when it lands.
|
|
66
|
+
export { showToast, dismissToast } from "./overlay/toast/toastStore.js";
|
|
67
|
+
|
|
68
|
+
/** Position of a control within a button or tag group. */
|
|
69
|
+
|
|
70
|
+
// ---- Enums --------------------------------------------------------------
|
|
71
|
+
// Re-exported with cleaner native names (no "V2" suffix). The underlying
|
|
72
|
+
// values are the same string constants, so they are interchangeable with the
|
|
73
|
+
// web enums at runtime.
|
|
74
|
+
/**
|
|
75
|
+
* Announce a status message to assistive tech. Exposed for consumers building
|
|
76
|
+
* their own status surfaces; `Alert` uses it internally.
|
|
77
|
+
*/
|
|
78
|
+
export { useLiveRegionAnnounce } from "./a11y/useLiveRegion.js";
|
|
79
|
+
export { AlertV2Type as AlertType, AlertV2SubType as AlertSubType, AlertV2ActionPosition as AlertActionPosition, ButtonV2Type as ButtonType, ButtonV2Size as ButtonSize, ButtonV2SubType as ButtonSubType, ButtonV2State as ButtonState, InputSizeV2 as InputSize, InputStateV2 as InputState, TagV2Type as TagType, TagV2Size as TagSize, TagV2SubType as TagSubType, TagV2Color as TagColor, Theme } from '@juspay/blend-design-system/node';
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Alert","Button","Tag","TextInput","Skeleton","BlendNativeProvider","BlendNativeThemeContext","DEFAULT_NATIVE_THEME","SYSTEM_THEME","useNativeTokens","useNativeBreakpoint","Block","Pressable","Text","Slot","Separator","PrimitiveInput","MIN_TOUCH_TARGET","Portal","useReduceMotion","BottomSheet","showToast","dismissToast","useLiveRegionAnnounce","AlertV2Type","AlertType","AlertV2SubType","AlertSubType","AlertV2ActionPosition","AlertActionPosition","ButtonV2Type","ButtonType","ButtonV2Size","ButtonSize","ButtonV2SubType","ButtonSubType","ButtonV2State","ButtonState","InputSizeV2","InputSize","InputStateV2","InputState","TagV2Type","TagType","TagV2Size","TagSize","TagV2SubType","TagSubType","TagV2Color","TagColor","Theme"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,KAAK,QAAQ,6BAAoB;AAC1C,SAASC,MAAM,QAAQ,8BAAqB;AAC5C,SAASC,GAAG,QAAQ,2BAAkB;AACtC,SAASC,SAAS,QAAQ,iCAAwB;AAKlD,SAASC,QAAQ,QAAQ,gCAAuB;AAahD;AACA,SACIC,mBAAmB,EACnBC,uBAAuB,EACvBC,oBAAoB,QACjB,gCAA6B;AAMpC;AACA,SAASC,YAAY,QAAQ,wBAAqB;AAQlD,SAASC,eAAe,QAAQ,4BAAyB;AACzD,SAASC,mBAAmB,QAAQ,gCAA6B;AAOjE;AACA;AACA,SAASC,KAAK,QAAQ,uBAAoB;AAC1C,SAASC,SAAS,QAAQ,2BAAwB;AAClD,SAASC,IAAI,QAAQ,sBAAmB;AACxC,SAASC,IAAI,QAAQ,sBAAmB;AACxC,SAASC,SAAS,QAAQ,2BAAwB;AAClD,SAASC,cAAc,QAAQ,gCAA6B;;AAQ5D;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,6BAA0B;;AAE3D;AACA;AACA;AACA;AACA;AACA,SAASC,MAAM,QAAQ,qBAAkB;AAEzC,SAASC,eAAe,QAAQ,6BAA0B;;AAE1D;AACA;AACA,SAASC,WAAW,QAAQ,gCAA6B;AAGzD;AACA;AACA,SAASC,SAAS,EAAEC,YAAY,QAAQ,+BAA4B;;AAGpE;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,qBAAqB,QAAQ,yBAAsB;AAE5D,SACIC,WAAW,IAAIC,SAAS,EACxBC,cAAc,IAAIC,YAAY,EAC9BC,qBAAqB,IAAIC,mBAAmB,EAC5CC,YAAY,IAAIC,UAAU,EAC1BC,YAAY,IAAIC,UAAU,EAC1BC,eAAe,IAAIC,aAAa,EAChCC,aAAa,IAAIC,WAAW,EAC5BC,WAAW,IAAIC,SAAS,EACxBC,YAAY,IAAIC,UAAU,EAC1BC,SAAS,IAAIC,OAAO,EACpBC,SAAS,IAAIC,OAAO,EACpBC,YAAY,IAAIC,UAAU,EAC1BC,UAAU,IAAIC,QAAQ,EACtBC,KAAK,QACF,kCAAkC","ignoreList":[]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Motion tokens and presets.
|
|
5
|
+
*
|
|
6
|
+
* Web Blend has no motion token layer — durations and curves are scattered
|
|
7
|
+
* inline (`transition: 'transform 0.15s ease-in-out'`, the MenuV2/ModalV2
|
|
8
|
+
* animation modules). Native centralises them here so every overlay and
|
|
9
|
+
* state change moves the same way.
|
|
10
|
+
*
|
|
11
|
+
* Pure data, deliberately independent of any animation library: consumers
|
|
12
|
+
* (the Reanimated-based overlay components) translate a preset into
|
|
13
|
+
* `withTiming`/`withSpring` calls. Keeping the descriptions library-free
|
|
14
|
+
* means this module stays vitest-testable and the animation dependency
|
|
15
|
+
* stays contained to the components that actually animate.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Milliseconds. `fast` = state feedback, `normal` = overlays, `slow` = sheets. */
|
|
19
|
+
export const MOTION_DURATION = {
|
|
20
|
+
fast: 150,
|
|
21
|
+
normal: 250,
|
|
22
|
+
slow: 400
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Cubic-bezier control points, CSS order `[x1, y1, x2, y2]`. */
|
|
26
|
+
export const MOTION_EASING = {
|
|
27
|
+
/** Both ends eased — in-place state changes. */
|
|
28
|
+
standard: [0.4, 0, 0.2, 1],
|
|
29
|
+
/** Fast start, soft landing — content entering the screen. */
|
|
30
|
+
decelerate: [0, 0, 0.2, 1],
|
|
31
|
+
/** Soft start, fast exit — content leaving the screen. */
|
|
32
|
+
accelerate: [0.4, 0, 1, 1]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Transform/opacity state at one end of a transition. */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The presets the overlay components share.
|
|
39
|
+
*
|
|
40
|
+
* - `fade` — tooltips, backdrops.
|
|
41
|
+
* - `scaleFade` — menus, popovers, selects (anchored surfaces growing from
|
|
42
|
+
* their anchor).
|
|
43
|
+
* - `slideUp` — toasts and sheets entering from the bottom edge (the
|
|
44
|
+
* translate distance is a starting offset; sheets override it with their
|
|
45
|
+
* own measured height).
|
|
46
|
+
* - `slideDown` — banners entering from the top edge.
|
|
47
|
+
*/
|
|
48
|
+
export const MOTION_PRESETS = {
|
|
49
|
+
fade: {
|
|
50
|
+
from: {
|
|
51
|
+
opacity: 0
|
|
52
|
+
},
|
|
53
|
+
to: {
|
|
54
|
+
opacity: 1
|
|
55
|
+
},
|
|
56
|
+
duration: MOTION_DURATION.fast,
|
|
57
|
+
easing: 'decelerate',
|
|
58
|
+
exitDuration: MOTION_DURATION.fast,
|
|
59
|
+
exitEasing: 'accelerate'
|
|
60
|
+
},
|
|
61
|
+
scaleFade: {
|
|
62
|
+
from: {
|
|
63
|
+
opacity: 0,
|
|
64
|
+
scale: 0.95
|
|
65
|
+
},
|
|
66
|
+
to: {
|
|
67
|
+
opacity: 1,
|
|
68
|
+
scale: 1
|
|
69
|
+
},
|
|
70
|
+
duration: MOTION_DURATION.normal,
|
|
71
|
+
easing: 'decelerate',
|
|
72
|
+
exitDuration: MOTION_DURATION.fast,
|
|
73
|
+
exitEasing: 'accelerate'
|
|
74
|
+
},
|
|
75
|
+
slideUp: {
|
|
76
|
+
from: {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
translateY: 16
|
|
79
|
+
},
|
|
80
|
+
to: {
|
|
81
|
+
opacity: 1,
|
|
82
|
+
translateY: 0
|
|
83
|
+
},
|
|
84
|
+
duration: MOTION_DURATION.normal,
|
|
85
|
+
easing: 'decelerate',
|
|
86
|
+
exitDuration: MOTION_DURATION.fast,
|
|
87
|
+
exitEasing: 'accelerate'
|
|
88
|
+
},
|
|
89
|
+
slideDown: {
|
|
90
|
+
from: {
|
|
91
|
+
opacity: 0,
|
|
92
|
+
translateY: -16
|
|
93
|
+
},
|
|
94
|
+
to: {
|
|
95
|
+
opacity: 1,
|
|
96
|
+
translateY: 0
|
|
97
|
+
},
|
|
98
|
+
duration: MOTION_DURATION.normal,
|
|
99
|
+
easing: 'decelerate',
|
|
100
|
+
exitDuration: MOTION_DURATION.fast,
|
|
101
|
+
exitEasing: 'accelerate'
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* A preset with motion removed — what every animation collapses to when the
|
|
106
|
+
* user has OS reduce-motion enabled (see `useReduceMotion`): a fast opacity
|
|
107
|
+
* change, no movement, no scaling.
|
|
108
|
+
*/
|
|
109
|
+
export function reducedMotionVariant(preset) {
|
|
110
|
+
return {
|
|
111
|
+
from: {
|
|
112
|
+
opacity: preset.from.opacity ?? 0
|
|
113
|
+
},
|
|
114
|
+
to: {
|
|
115
|
+
opacity: preset.to.opacity ?? 1
|
|
116
|
+
},
|
|
117
|
+
duration: MOTION_DURATION.fast,
|
|
118
|
+
easing: 'standard',
|
|
119
|
+
exitDuration: MOTION_DURATION.fast,
|
|
120
|
+
exitEasing: 'standard'
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MOTION_DURATION","fast","normal","slow","MOTION_EASING","standard","decelerate","accelerate","MOTION_PRESETS","fade","from","opacity","to","duration","easing","exitDuration","exitEasing","scaleFade","scale","slideUp","translateY","slideDown","reducedMotionVariant","preset"],"sourceRoot":"../../../src","sources":["motion/motion.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,eAAe,GAAG;EAC3BC,IAAI,EAAE,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YAAY,EAAEf,eAAe,CAACC,IAAI;IAClCe,UAAU,EAAE;EAChB,CAAC;EACDK,SAAS,EAAE;IACPX,IAAI,EAAE;MAAEC,OAAO,EAAE,CAAC;MAAES,UAAU,EAAE,CAAC;IAAG,CAAC;IACrCR,EAAE,EAAE;MAAED,OAAO,EAAE,CAAC;MAAES,UAAU,EAAE;IAAE,CAAC;IACjCP,QAAQ,EAAEb,eAAe,CAACE,MAAM;IAChCY,MAAM,EAAE,YAAY;IACpBC,YAAY,EAAEf,eAAe,CAACC,IAAI;IAClCe,UAAU,EAAE;EAChB;AACJ,CAAiD;AAIjD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,oBAAoBA,CAACC,MAAoB,EAAgB;EACrE,OAAO;IACHb,IAAI,EAAE;MAAEC,OAAO,EAAEY,MAAM,CAACb,IAAI,CAACC,OAAO,IAAI;IAAE,CAAC;IAC3CC,EAAE,EAAE;MAAED,OAAO,EAAEY,MAAM,CAACX,EAAE,CAACD,OAAO,IAAI;IAAE,CAAC;IACvCE,QAAQ,EAAEb,eAAe,CAACC,IAAI;IAC9Ba,MAAM,EAAE,UAAU;IAClBC,YAAY,EAAEf,eAAe,CAACC,IAAI;IAClCe,UAAU,EAAE;EAChB,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { AccessibilityInfo } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Whether the OS reduce-motion accessibility setting is on.
|
|
8
|
+
*
|
|
9
|
+
* The native counterpart of web's `prefers-reduced-motion` media query.
|
|
10
|
+
* Overlay components pair this with `reducedMotionVariant` so every
|
|
11
|
+
* animation collapses to a quick fade when the user asked for less motion.
|
|
12
|
+
*
|
|
13
|
+
* Starts `false` and corrects itself once the async platform query
|
|
14
|
+
* resolves — the safe default, since acting on it only ever *removes*
|
|
15
|
+
* motion. Subscribes to changes for the lifetime of the component.
|
|
16
|
+
*/
|
|
17
|
+
export function useReduceMotion() {
|
|
18
|
+
const [reduceMotion, setReduceMotion] = useState(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
let mounted = true;
|
|
21
|
+
AccessibilityInfo.isReduceMotionEnabled().then(enabled => {
|
|
22
|
+
if (mounted) setReduceMotion(enabled);
|
|
23
|
+
});
|
|
24
|
+
const subscription = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduceMotion);
|
|
25
|
+
return () => {
|
|
26
|
+
mounted = false;
|
|
27
|
+
subscription.remove();
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
return reduceMotion;
|
|
31
|
+
}
|
|
32
|
+
export default useReduceMotion;
|
|
33
|
+
//# sourceMappingURL=useReduceMotion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","AccessibilityInfo","useReduceMotion","reduceMotion","setReduceMotion","mounted","isReduceMotionEnabled","then","enabled","subscription","addEventListener","remove"],"sourceRoot":"../../../src","sources":["motion/useReduceMotion.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,iBAAiB,QAAQ,cAAc;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAA,EAAY;EACvC,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGJ,QAAQ,CAAC,KAAK,CAAC;EAEvDD,SAAS,CAAC,MAAM;IACZ,IAAIM,OAAO,GAAG,IAAI;IAClBJ,iBAAiB,CAACK,qBAAqB,CAAC,CAAC,CAACC,IAAI,CAAEC,OAAO,IAAK;MACxD,IAAIH,OAAO,EAAED,eAAe,CAACI,OAAO,CAAC;IACzC,CAAC,CAAC;IACF,MAAMC,YAAY,GAAGR,iBAAiB,CAACS,gBAAgB,CACnD,qBAAqB,EACrBN,eACJ,CAAC;IACD,OAAO,MAAM;MACTC,OAAO,GAAG,KAAK;MACfI,YAAY,CAACE,MAAM,CAAC,CAAC;IACzB,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOR,YAAY;AACvB;AAEA,eAAeD,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { createContext, useCallback, useContext, useEffect, useId, useMemo, useState } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Portal — layered rendering above the app's content.
|
|
8
|
+
*
|
|
9
|
+
* The native replacement for web's `createPortal`/Radix `Portal`: overlay
|
|
10
|
+
* components (modal, menu, popover, tooltip, snackbar) mount their surface
|
|
11
|
+
* through `<Portal>` and it renders in an absolute-fill layer that
|
|
12
|
+
* `BlendNativeProvider` places *after* the app's children, so it paints on
|
|
13
|
+
* top regardless of where in the tree the overlay was opened.
|
|
14
|
+
*
|
|
15
|
+
* Layers stack in mount order — the overlay opened last paints on top,
|
|
16
|
+
* which matches how web portals appended to `document.body` behave.
|
|
17
|
+
*
|
|
18
|
+
* The provider must sit at a screen-filling root (the usual place for a
|
|
19
|
+
* theme provider): the layers are absolutely positioned siblings of the
|
|
20
|
+
* app's children, so they cover exactly what the provider's parent covers.
|
|
21
|
+
*
|
|
22
|
+
* With no provider mounted, `<Portal>` renders its children in place — an
|
|
23
|
+
* overlay degrades to inline rendering rather than disappearing.
|
|
24
|
+
*/
|
|
25
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
const PortalRegistryContext = /*#__PURE__*/createContext(null);
|
|
27
|
+
let warnedNoProvider = false;
|
|
28
|
+
/** Renders `children` into the provider's overlay layer. */
|
|
29
|
+
export function Portal({
|
|
30
|
+
children
|
|
31
|
+
}) {
|
|
32
|
+
const registry = useContext(PortalRegistryContext);
|
|
33
|
+
const key = useId();
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!registry) return;
|
|
36
|
+
registry.mount(key, children);
|
|
37
|
+
return () => registry.unmount(key);
|
|
38
|
+
}, [registry, key, children]);
|
|
39
|
+
|
|
40
|
+
// In an effect, not during render — warning inline would be a
|
|
41
|
+
// render-phase side effect (breaks under StrictMode double-render, the
|
|
42
|
+
// same class of bug Pressable's parse memoisation fixed).
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (registry || warnedNoProvider) return;
|
|
45
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
46
|
+
warnedNoProvider = true;
|
|
47
|
+
console.warn('[blend-native] <Portal> used without BlendNativeProvider — ' + 'rendering inline. Overlays will not layer above the app.');
|
|
48
|
+
}
|
|
49
|
+
}, [registry]);
|
|
50
|
+
if (!registry) return /*#__PURE__*/_jsx(_Fragment, {
|
|
51
|
+
children: children
|
|
52
|
+
});
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
Portal.displayName = 'Portal';
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Internal — wraps the app's children with the portal registry and renders
|
|
59
|
+
* the mounted layers after them. Used by `BlendNativeProvider`; not public.
|
|
60
|
+
*/
|
|
61
|
+
export function PortalArea({
|
|
62
|
+
children
|
|
63
|
+
}) {
|
|
64
|
+
const [portals, setPortals] = useState([]);
|
|
65
|
+
const mount = useCallback((key, node) => {
|
|
66
|
+
setPortals(current => {
|
|
67
|
+
const existing = current.findIndex(p => p.key === key);
|
|
68
|
+
if (existing === -1) return [...current, {
|
|
69
|
+
key,
|
|
70
|
+
node
|
|
71
|
+
}];
|
|
72
|
+
// Re-mount with new content keeps its layer position.
|
|
73
|
+
const next = current.slice();
|
|
74
|
+
next[existing] = {
|
|
75
|
+
key,
|
|
76
|
+
node
|
|
77
|
+
};
|
|
78
|
+
return next;
|
|
79
|
+
});
|
|
80
|
+
}, []);
|
|
81
|
+
const unmount = useCallback(key => {
|
|
82
|
+
setPortals(current => current.filter(p => p.key !== key));
|
|
83
|
+
}, []);
|
|
84
|
+
const registry = useMemo(() => ({
|
|
85
|
+
mount,
|
|
86
|
+
unmount
|
|
87
|
+
}), [mount, unmount]);
|
|
88
|
+
return /*#__PURE__*/_jsxs(PortalRegistryContext.Provider, {
|
|
89
|
+
value: registry,
|
|
90
|
+
children: [children, portals.map(({
|
|
91
|
+
key,
|
|
92
|
+
node
|
|
93
|
+
}) => /*#__PURE__*/_jsx(View, {
|
|
94
|
+
style: StyleSheet.absoluteFill
|
|
95
|
+
// Touches fall through empty layer area to the app;
|
|
96
|
+
// the overlay's own views still receive theirs.
|
|
97
|
+
,
|
|
98
|
+
pointerEvents: "box-none",
|
|
99
|
+
children: node
|
|
100
|
+
}, key))]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
PortalArea.displayName = 'PortalArea';
|
|
104
|
+
//# sourceMappingURL=portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createContext","useCallback","useContext","useEffect","useId","useMemo","useState","StyleSheet","View","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","PortalRegistryContext","warnedNoProvider","Portal","children","registry","key","mount","unmount","__DEV__","console","warn","displayName","PortalArea","portals","setPortals","node","current","existing","findIndex","p","next","slice","filter","Provider","value","map","style","absoluteFill","pointerEvents"],"sourceRoot":"../../../src","sources":["overlay/portal.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACRC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,KAAK,EACLC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlBA,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA2BA,MAAMC,qBAAqB,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* The native replacement for what Radix/floating-ui do on web: place a
|
|
7
|
+
* floating box (menu, popover, tooltip, select list) against an anchor
|
|
8
|
+
* rect, flipping to the opposite side when space runs out and clamping
|
|
9
|
+
* into the viewport.
|
|
10
|
+
*
|
|
11
|
+
* Pure and RN-free — rects in, a position out — so the whole placement
|
|
12
|
+
* matrix is unit-testable under vitest. `useAnchoredPosition` layers the
|
|
13
|
+
* measurement plumbing on top.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Which side of the anchor the content prefers. */
|
|
17
|
+
|
|
18
|
+
/** Alignment along the anchor's other axis. */
|
|
19
|
+
|
|
20
|
+
const opposite = {
|
|
21
|
+
top: 'bottom',
|
|
22
|
+
bottom: 'top',
|
|
23
|
+
left: 'right',
|
|
24
|
+
right: 'left'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Space between the anchor and the viewport edge on one side. */
|
|
28
|
+
function spaceOn(side, anchor, viewport, offset, padding) {
|
|
29
|
+
switch (side) {
|
|
30
|
+
case 'top':
|
|
31
|
+
return anchor.y - offset - padding;
|
|
32
|
+
case 'bottom':
|
|
33
|
+
return viewport.height - (anchor.y + anchor.height) - offset - padding;
|
|
34
|
+
case 'left':
|
|
35
|
+
return anchor.x - offset - padding;
|
|
36
|
+
case 'right':
|
|
37
|
+
return viewport.width - (anchor.x + anchor.width) - offset - padding;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const clamp = (value, min, max) =>
|
|
41
|
+
// A viewport smaller than the padding produces min > max; the lower
|
|
42
|
+
// bound wins so content pins to the leading edge instead of NaN-ing.
|
|
43
|
+
Math.max(min, Math.min(value, Math.max(min, max)));
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Compute where to place floating content against an anchor.
|
|
47
|
+
*
|
|
48
|
+
* - **Flip**: when the preferred side cannot fit the content but the
|
|
49
|
+
* opposite side can fit more of it, the placement flips.
|
|
50
|
+
* - **Clamp**: the cross-axis position shifts to keep the content inside
|
|
51
|
+
* the viewport padding (matching floating-ui's `shift`).
|
|
52
|
+
* - **Cap**: `maxHeight`/`maxWidth` report the space actually available on
|
|
53
|
+
* the resolved side, so scrollable content can cap itself.
|
|
54
|
+
*/
|
|
55
|
+
export function computeAnchoredPosition(input) {
|
|
56
|
+
const {
|
|
57
|
+
anchor,
|
|
58
|
+
content,
|
|
59
|
+
viewport,
|
|
60
|
+
placement: preferred = 'bottom',
|
|
61
|
+
alignment = 'start',
|
|
62
|
+
offset = 8,
|
|
63
|
+
viewportPadding = 8
|
|
64
|
+
} = input;
|
|
65
|
+
const preferredSpace = spaceOn(preferred, anchor, viewport, offset, viewportPadding);
|
|
66
|
+
const isVertical = preferred === 'top' || preferred === 'bottom';
|
|
67
|
+
const needed = isVertical ? content.height : content.width;
|
|
68
|
+
let placement = preferred;
|
|
69
|
+
if (needed > preferredSpace) {
|
|
70
|
+
const other = spaceOn(opposite[preferred], anchor, viewport, offset, viewportPadding);
|
|
71
|
+
if (other > preferredSpace) placement = opposite[preferred];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ---- Main axis ------------------------------------------------------
|
|
75
|
+
let x = 0;
|
|
76
|
+
let y = 0;
|
|
77
|
+
switch (placement) {
|
|
78
|
+
case 'top':
|
|
79
|
+
y = anchor.y - offset - content.height;
|
|
80
|
+
break;
|
|
81
|
+
case 'bottom':
|
|
82
|
+
y = anchor.y + anchor.height + offset;
|
|
83
|
+
break;
|
|
84
|
+
case 'left':
|
|
85
|
+
x = anchor.x - offset - content.width;
|
|
86
|
+
break;
|
|
87
|
+
case 'right':
|
|
88
|
+
x = anchor.x + anchor.width + offset;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---- Cross axis -----------------------------------------------------
|
|
93
|
+
const alignAlong = (anchorStart, anchorLength, contentLength) => {
|
|
94
|
+
if (alignment === 'start') return anchorStart;
|
|
95
|
+
if (alignment === 'end') return anchorStart + anchorLength - contentLength;
|
|
96
|
+
return anchorStart + (anchorLength - contentLength) / 2;
|
|
97
|
+
};
|
|
98
|
+
if (placement === 'top' || placement === 'bottom') {
|
|
99
|
+
x = alignAlong(anchor.x, anchor.width, content.width);
|
|
100
|
+
} else {
|
|
101
|
+
y = alignAlong(anchor.y, anchor.height, content.height);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ---- Keep inside the viewport ---------------------------------------
|
|
105
|
+
x = clamp(x, viewportPadding, viewport.width - viewportPadding - content.width);
|
|
106
|
+
y = clamp(y, viewportPadding, viewport.height - viewportPadding - content.height);
|
|
107
|
+
const available = spaceOn(placement, anchor, viewport, offset, viewportPadding);
|
|
108
|
+
const maxHeight = placement === 'top' || placement === 'bottom' ? Math.max(0, available) : Math.max(0, viewport.height - 2 * viewportPadding);
|
|
109
|
+
const maxWidth = placement === 'left' || placement === 'right' ? Math.max(0, available) : Math.max(0, viewport.width - 2 * viewportPadding);
|
|
110
|
+
return {
|
|
111
|
+
x,
|
|
112
|
+
y,
|
|
113
|
+
placement,
|
|
114
|
+
maxHeight,
|
|
115
|
+
maxWidth
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=positioning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["opposite","top","bottom","left","right","spaceOn","side","anchor","viewport","offset","padding","y","height","x","width","clamp","value","min","max","Math","computeAnchoredPosition","input","content","placement","preferred","alignment","viewportPadding","preferredSpace","isVertical","needed","other","alignAlong","anchorStart","anchorLength","contentLength","available","maxHeight","maxWidth"],"sourceRoot":"../../../src","sources":["overlay/positioning.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;;AAGA;;AAgCA,MAAMA,QAAsC,GAAG;EAC3CC,GAAG,EAAE,QAAQ;EACbC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,OAAO;EACbC,KAAK,EAAE;AACX,CAAC;;AAED;AACA,SAASC,OAAOA,CACZC,I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ACO,KAAK,EAAEQ,OAAO,CAACR,KAAK,CAAC;EACzD,CAAC,MAAM;IACHH,CAAC,GAAGoB,UAAU,CAACxB,MAAM,CAACI,CAAC,EAAEJ,MAAM,CAACK,MAAM,EAAEU,OAAO,CAACV,MAAM,CAAC;EAC3D;;EAEA;EACAC,CAAC,GAAGE,KAAK,CACLF,CAAC,EACDa,eAAe,EACflB,QAAQ,CAACM,KAAK,GAAGY,eAAe,GAAGJ,OAAO,CAACR,KAC/C,CAAC;EACDH,CAAC,GAAGI,KAAK,CACLJ,CAAC,EACDe,eAAe,EACflB,QAAQ,CAACI,MAAM,GAAGc,eAAe,GAAGJ,OAAO,CAACV,MAChD,CAAC;EAED,MAAMuB,SAAS,GAAG9B,OAAO,CACrBkB,SAAS,EACThB,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNiB,eACJ,CAAC;EACD,MAAMU,SAAS,GACXb,SAAS,KAAK,KAAK,IAAIA,SAAS,KAAK,QAAQ,GACvCJ,IAAI,CAACD,GAAG,CAAC,CAAC,EAAEiB,SAAS,CAAC,GACtBhB,IAAI,CAACD,GAAG,CAAC,CAAC,EAAEV,QAAQ,CAACI,MAAM,GAAG,CAAC,GAAGc,eAAe,CAAC;EAC5D,MAAMW,QAAQ,GACVd,SAAS,KAAK,MAAM,IAAIA,SAAS,KAAK,OAAO,GACvCJ,IAAI,CAACD,GAAG,CAAC,CAAC,EAAEiB,SAAS,CAAC,GACtBhB,IAAI,CAACD,GAAG,CAAC,CAAC,EAAEV,QAAQ,CAACM,KAAK,GAAG,CAAC,GAAGY,eAAe,CAAC;EAE3D,OAAO;IAAEb,CAAC;IAAEF,CAAC;IAAEY,SAAS;IAAEa,SAAS;IAAEC;EAAS,CAAC;AACnD","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Optional `react-native-safe-area-context` integration, shared by every
|
|
7
|
+
* overlay that must respect the home indicator or notch (BottomSheet, the
|
|
8
|
+
* toast outlet).
|
|
9
|
+
*
|
|
10
|
+
* `useContext` needs *a* context unconditionally, so when the optional peer
|
|
11
|
+
* is absent — or its provider is not mounted — a null-valued fallback
|
|
12
|
+
* stands in and insets resolve to zero. Same probe pattern as
|
|
13
|
+
* expo-linear-gradient.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const FallbackInsetsContext = /*#__PURE__*/createContext(null);
|
|
17
|
+
export let SafeAreaInsetsContext = FallbackInsetsContext;
|
|
18
|
+
try {
|
|
19
|
+
if (typeof require === 'function') {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
|
+
const safeArea = require('react-native-safe-area-context');
|
|
22
|
+
SafeAreaInsetsContext = safeArea.SafeAreaInsetsContext ?? FallbackInsetsContext;
|
|
23
|
+
}
|
|
24
|
+
} catch {
|
|
25
|
+
SafeAreaInsetsContext = FallbackInsetsContext;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=safeAreaInsets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","FallbackInsetsContext","SafeAreaInsetsContext","require","safeArea"],"sourceRoot":"../../../src","sources":["overlay/safeAreaInsets.ts"],"mappings":";;AAAA,SAAgBA,aAAa,QAAQ,OAAO;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,MAAMC,qBAAqB,gBAAGD,aAAa,CAAoB,IAAI,CAAC;AAEpE,OAAO,IAAIE,qBAAuD,GAC9DD,qBAAqB;AACzB,IAAI;EACA,IAAI,OAAOE,OAAO,KAAK,UAAU,EAAE;IAC/B;IACA,MAAMC,QAAQ,GAAGD,OAAO,CAAC,gCAAgC,CAExD;IACDD,qBAAqB,GACjBE,QAAQ,CAACF,qBAAqB,IAAID,qBAAqB;EAC/D;AACJ,CAAC,CAAC,MAAM;EACJC,qBAAqB,GAAGD,qBAAqB;AACjD","ignoreList":[]}
|