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,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, memo, useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import { Pressable as RNPressable, Platform, View, ActivityIndicator } from 'react-native';
|
|
5
|
+
import { parseBackground, parseBorder, parseBoxShadow } from "../adapters/cssStringAdapter.js";
|
|
6
|
+
import { resolveSurfaceStyle } from "../adapters/surfaceStyle.js";
|
|
7
|
+
import { LinearGradient } from "../adapters/optionalGradient.js";
|
|
8
|
+
import { MIN_TOUCH_TARGET, resolveHitSlop, sameHitSlop } from "./touchTarget.js";
|
|
9
|
+
import { useLiveRegionAnnounce } from "../a11y/useLiveRegion.js";
|
|
10
|
+
import { resolvePressFeedback } from "./pressFeedback.js";
|
|
11
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
export { MIN_TOUCH_TARGET };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Native `Pressable` — the interactive surface for buttons, tags, and any
|
|
16
|
+
* other pressable token-driven component.
|
|
17
|
+
*
|
|
18
|
+
* Web's `PrimitiveButton` is a styled-components `button` with `_active`,
|
|
19
|
+
* `_hover`, `_focusVisible` and `_disabled` pseudo-state objects. RN has no
|
|
20
|
+
* CSS pseudo-selectors; instead `Pressable` exposes a `style` callback
|
|
21
|
+
* receiving `{ pressed }`. This primitive takes the same token-derived CSS
|
|
22
|
+
* strings, translates them through the shared adapter, and composes them per
|
|
23
|
+
* state.
|
|
24
|
+
*
|
|
25
|
+
* `_hover` is ignored — RN has no hover. `_focusVisible` is ignored — there
|
|
26
|
+
* is no focus ring on touch.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* `expo-linear-gradient` is an **optional** peer (probe shared with
|
|
31
|
+
* Skeleton in `adapters/optionalGradient`). When it is absent the surface
|
|
32
|
+
* falls back to the gradient's first colour, which `resolveSurfaceStyle`
|
|
33
|
+
* already supplies as `backgroundColor` — so a gradient button degrades to
|
|
34
|
+
* a solid one rather than rendering transparent.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Note this extends `SurfaceStyleProps`, exactly as `BlockProps` does.
|
|
39
|
+
*
|
|
40
|
+
* That shared base is load-bearing, not cosmetic. Components that switch
|
|
41
|
+
* between `Block` and `Pressable` depending on interactivity (Tag, and web's
|
|
42
|
+
* `TagElement = onClick ? PrimitiveButton : Block` pattern) build one surface
|
|
43
|
+
* object and hand it to whichever they render. If the two accepted different
|
|
44
|
+
* prop sets, the extras would fall silently into `...rest` in one branch and
|
|
45
|
+
* vanish — and TypeScript would not catch it, because spreading an object
|
|
46
|
+
* into JSX skips excess-property checking. Keeping one base makes that class
|
|
47
|
+
* of bug unrepresentable.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
const PressableImpl = /*#__PURE__*/forwardRef(function Pressable({
|
|
51
|
+
children,
|
|
52
|
+
background,
|
|
53
|
+
backgroundColor,
|
|
54
|
+
activeBackground,
|
|
55
|
+
disabledBackground,
|
|
56
|
+
border,
|
|
57
|
+
activeBorder,
|
|
58
|
+
disabledBorder,
|
|
59
|
+
borderRadius,
|
|
60
|
+
boxShadow,
|
|
61
|
+
activeBoxShadow,
|
|
62
|
+
paddingTop,
|
|
63
|
+
paddingRight,
|
|
64
|
+
paddingBottom,
|
|
65
|
+
paddingLeft,
|
|
66
|
+
flexDirection,
|
|
67
|
+
alignItems,
|
|
68
|
+
justifyContent,
|
|
69
|
+
alignSelf,
|
|
70
|
+
gap,
|
|
71
|
+
width,
|
|
72
|
+
minWidth,
|
|
73
|
+
maxWidth,
|
|
74
|
+
height,
|
|
75
|
+
minHeight,
|
|
76
|
+
maxHeight,
|
|
77
|
+
flexShrink,
|
|
78
|
+
flexGrow,
|
|
79
|
+
opacity,
|
|
80
|
+
overflow,
|
|
81
|
+
disabled = false,
|
|
82
|
+
loading = false,
|
|
83
|
+
loaderColor,
|
|
84
|
+
loaderSize = 'small',
|
|
85
|
+
loadingAccessibilityLabel = 'Loading, please wait',
|
|
86
|
+
pressedScale = 0.99,
|
|
87
|
+
rippleColor,
|
|
88
|
+
rippleBorderless = false,
|
|
89
|
+
minTouchTarget = MIN_TOUCH_TARGET,
|
|
90
|
+
onPress,
|
|
91
|
+
style,
|
|
92
|
+
accessibilityRole = 'button',
|
|
93
|
+
accessible = true,
|
|
94
|
+
...rest
|
|
95
|
+
}, ref) {
|
|
96
|
+
// Parsing is memoised on the inputs themselves. The previous
|
|
97
|
+
// implementation stored these in refs and reassigned `.current`
|
|
98
|
+
// during render — a render-phase side effect that breaks under
|
|
99
|
+
// StrictMode/concurrent rendering, and which also kept a stale parse
|
|
100
|
+
// whenever a prop transitioned from a value back to `undefined`.
|
|
101
|
+
const parsedBg = useMemo(() => parseBackground(background), [background]);
|
|
102
|
+
const parsedActiveBg = useMemo(() => parseBackground(activeBackground), [activeBackground]);
|
|
103
|
+
const parsedDisabledBg = useMemo(() => parseBackground(disabledBackground), [disabledBackground]);
|
|
104
|
+
const activeBorderStyle = useMemo(() => parseBorder(activeBorder), [activeBorder]);
|
|
105
|
+
const disabledBorderStyle = useMemo(() => parseBorder(disabledBorder), [disabledBorder]);
|
|
106
|
+
const activeShadowStyle = useMemo(() => parseBoxShadow(activeBoxShadow) ?? {}, [activeBoxShadow]);
|
|
107
|
+
|
|
108
|
+
// Loading and disabled are deliberately *separate* concerns, matching
|
|
109
|
+
// web: `ButtonV2` passes `disabled={isDisabled}` to `PrimitiveButton`
|
|
110
|
+
// and computes `isDisabled` from the `disabled` prop alone, while
|
|
111
|
+
// `renderButtonContent` swaps in a spinner when loading. So a loading
|
|
112
|
+
// button keeps its normal chrome — including its gradient — and only
|
|
113
|
+
// its content changes.
|
|
114
|
+
//
|
|
115
|
+
// Collapsing the two (the earlier `isInert = disabled || loading`)
|
|
116
|
+
// made every loading button render in the disabled colour.
|
|
117
|
+
|
|
118
|
+
/** Blocks presses. Both states are non-interactive. */
|
|
119
|
+
const isInteractionBlocked = disabled || loading;
|
|
120
|
+
/** Applies disabled chrome. Only the real disabled state does. */
|
|
121
|
+
const usesDisabledChrome = disabled;
|
|
122
|
+
const surface = useMemo(() => resolveSurfaceStyle({
|
|
123
|
+
background,
|
|
124
|
+
backgroundColor,
|
|
125
|
+
border,
|
|
126
|
+
borderRadius,
|
|
127
|
+
boxShadow,
|
|
128
|
+
paddingTop,
|
|
129
|
+
paddingRight,
|
|
130
|
+
paddingBottom,
|
|
131
|
+
paddingLeft,
|
|
132
|
+
flexDirection,
|
|
133
|
+
alignItems,
|
|
134
|
+
justifyContent,
|
|
135
|
+
alignSelf,
|
|
136
|
+
gap,
|
|
137
|
+
width,
|
|
138
|
+
minWidth,
|
|
139
|
+
maxWidth,
|
|
140
|
+
height,
|
|
141
|
+
minHeight,
|
|
142
|
+
maxHeight,
|
|
143
|
+
flexShrink,
|
|
144
|
+
flexGrow,
|
|
145
|
+
opacity,
|
|
146
|
+
overflow
|
|
147
|
+
}, Platform.OS), [background, backgroundColor, border, borderRadius, boxShadow, paddingTop, paddingRight, paddingBottom, paddingLeft, flexDirection, alignItems, justifyContent, alignSelf, gap, width, minWidth, maxWidth, height, minHeight, maxHeight, flexShrink, flexGrow, opacity, overflow]);
|
|
148
|
+
const isGradient = parsedBg?.type === 'gradient';
|
|
149
|
+
const canRenderGradient = isGradient && LinearGradient !== null;
|
|
150
|
+
const activeFlatBgColor = parsedActiveBg?.type === 'flat' ? parsedActiveBg.color : undefined;
|
|
151
|
+
const disabledBgColor = parsedDisabledBg?.type === 'flat' ? parsedDisabledBg.color : parsedDisabledBg?.type === 'gradient' ? parsedDisabledBg.colors[0] : undefined;
|
|
152
|
+
|
|
153
|
+
// RN's equivalent of web's `aria-live="polite"` announcement. On
|
|
154
|
+
// Android `accessibilityState.busy` already conveys this, so the hook
|
|
155
|
+
// only speaks on iOS — see `a11y/useLiveRegion`.
|
|
156
|
+
useLiveRegionAnnounce(loadingAccessibilityLabel, loading);
|
|
157
|
+
const handlePress = useCallback(event => {
|
|
158
|
+
if (disabled || loading) return;
|
|
159
|
+
onPress?.(event);
|
|
160
|
+
}, [disabled, loading, onPress]);
|
|
161
|
+
const accessibilityState = useMemo(() => ({
|
|
162
|
+
disabled: isInteractionBlocked,
|
|
163
|
+
busy: loading
|
|
164
|
+
}), [isInteractionBlocked, loading]);
|
|
165
|
+
|
|
166
|
+
// Ripple on Android, scale elsewhere — see `./pressFeedback`.
|
|
167
|
+
const {
|
|
168
|
+
androidRipple,
|
|
169
|
+
pressedTransform
|
|
170
|
+
} = useMemo(() => resolvePressFeedback(Platform.OS, {
|
|
171
|
+
rippleColor,
|
|
172
|
+
activeBackgroundColor: activeFlatBgColor,
|
|
173
|
+
rippleBorderless,
|
|
174
|
+
pressedScale
|
|
175
|
+
}), [rippleColor, activeFlatBgColor, rippleBorderless, pressedScale]);
|
|
176
|
+
const disabledStyle = useMemo(() => usesDisabledChrome ? {
|
|
177
|
+
...(disabledBgColor ? {
|
|
178
|
+
backgroundColor: disabledBgColor
|
|
179
|
+
} : {}),
|
|
180
|
+
...disabledBorderStyle
|
|
181
|
+
} : undefined, [usesDisabledChrome, disabledBgColor, disabledBorderStyle]);
|
|
182
|
+
const pressedStyle = useMemo(() => ({
|
|
183
|
+
...(activeFlatBgColor ? {
|
|
184
|
+
backgroundColor: activeFlatBgColor
|
|
185
|
+
} : {}),
|
|
186
|
+
...activeBorderStyle,
|
|
187
|
+
...activeShadowStyle,
|
|
188
|
+
...pressedTransform
|
|
189
|
+
}), [activeFlatBgColor, activeBorderStyle, activeShadowStyle, pressedTransform]);
|
|
190
|
+
|
|
191
|
+
// Widen the tap target once laid out, if the control is smaller than
|
|
192
|
+
// the minimum. `hitSlop` extends only the touch region, so layout and
|
|
193
|
+
// appearance are untouched.
|
|
194
|
+
//
|
|
195
|
+
// The resolved slop is stored rather than the raw dimensions, and it
|
|
196
|
+
// starts as `undefined` — the same value a compliant control resolves
|
|
197
|
+
// to. A control already at or above the minimum therefore never
|
|
198
|
+
// changes state and never re-renders; only ones that actually need
|
|
199
|
+
// slop pay for a second pass. Storing `{ width, height }` instead made
|
|
200
|
+
// every Pressable on the screen re-render on mount.
|
|
201
|
+
const [hitSlop, setHitSlop] = useState(undefined);
|
|
202
|
+
const handleLayout = useCallback(event => {
|
|
203
|
+
const {
|
|
204
|
+
width,
|
|
205
|
+
height
|
|
206
|
+
} = event.nativeEvent.layout;
|
|
207
|
+
const next = resolveHitSlop(width, height, minTouchTarget);
|
|
208
|
+
setHitSlop(previous => sameHitSlop(previous, next) ? previous : next);
|
|
209
|
+
}, [minTouchTarget]);
|
|
210
|
+
const content = loading ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
211
|
+
size: loaderSize,
|
|
212
|
+
color: loaderColor
|
|
213
|
+
}) : children;
|
|
214
|
+
|
|
215
|
+
// ---- Gradient path ----------------------------------------------
|
|
216
|
+
//
|
|
217
|
+
// <Pressable border + radius + overflow:hidden>
|
|
218
|
+
// <LinearGradient absoluteFill (bled into the border zone) />
|
|
219
|
+
// <View padding + layout> {content} </View>
|
|
220
|
+
// </Pressable>
|
|
221
|
+
//
|
|
222
|
+
// The gradient absolute-fills the whole border box — including under
|
|
223
|
+
// the border — so no antialiasing wedge forms at the corners, and the
|
|
224
|
+
// Pressable's own radius + overflow:hidden clips the bleed.
|
|
225
|
+
if (canRenderGradient && !usesDisabledChrome && parsedBg?.type === 'gradient') {
|
|
226
|
+
const gradient = parsedBg;
|
|
227
|
+
const Gradient = LinearGradient;
|
|
228
|
+
const borderWidth = surface.borderWidth ?? 1;
|
|
229
|
+
const bleed = -borderWidth;
|
|
230
|
+
|
|
231
|
+
// Negative inset bleeds the gradient into the border zone so no
|
|
232
|
+
// antialiasing gap forms between border and gradient edge; the
|
|
233
|
+
// frame's radius + overflow:hidden clips the overhang.
|
|
234
|
+
const bleedStyle = {
|
|
235
|
+
position: 'absolute',
|
|
236
|
+
top: bleed,
|
|
237
|
+
right: bleed,
|
|
238
|
+
bottom: bleed,
|
|
239
|
+
left: bleed
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// The gradient fills the border box, so padding and inner layout
|
|
243
|
+
// move to a child view; the Pressable keeps only the frame
|
|
244
|
+
// (border, radius, sizing) plus the clip.
|
|
245
|
+
const {
|
|
246
|
+
paddingTop,
|
|
247
|
+
paddingRight,
|
|
248
|
+
paddingBottom,
|
|
249
|
+
paddingLeft,
|
|
250
|
+
flexDirection: frameFlexDirection,
|
|
251
|
+
alignItems: frameAlignItems,
|
|
252
|
+
justifyContent: frameJustifyContent,
|
|
253
|
+
gap: frameGap,
|
|
254
|
+
...frame
|
|
255
|
+
} = surface;
|
|
256
|
+
const contentLayout = {
|
|
257
|
+
flex: 1,
|
|
258
|
+
paddingTop,
|
|
259
|
+
paddingRight,
|
|
260
|
+
paddingBottom,
|
|
261
|
+
paddingLeft,
|
|
262
|
+
flexDirection: frameFlexDirection,
|
|
263
|
+
alignItems: frameAlignItems,
|
|
264
|
+
justifyContent: frameJustifyContent,
|
|
265
|
+
gap: frameGap
|
|
266
|
+
};
|
|
267
|
+
const frameStyle = {
|
|
268
|
+
...frame,
|
|
269
|
+
flexDirection: frameFlexDirection,
|
|
270
|
+
overflow: 'hidden'
|
|
271
|
+
};
|
|
272
|
+
return /*#__PURE__*/_jsx(RNPressable, {
|
|
273
|
+
ref: ref,
|
|
274
|
+
onPress: handlePress,
|
|
275
|
+
disabled: isInteractionBlocked,
|
|
276
|
+
accessibilityRole: accessibilityRole,
|
|
277
|
+
accessible: accessible,
|
|
278
|
+
accessibilityState: accessibilityState,
|
|
279
|
+
onLayout: minTouchTarget ? handleLayout : undefined,
|
|
280
|
+
hitSlop: hitSlop,
|
|
281
|
+
android_ripple: androidRipple,
|
|
282
|
+
style: ({
|
|
283
|
+
pressed
|
|
284
|
+
}) => [frameStyle, pressed ? pressedTransform : undefined, pressed ? activeBorderStyle : undefined, pressed ? activeShadowStyle : undefined, style],
|
|
285
|
+
...rest,
|
|
286
|
+
children: ({
|
|
287
|
+
pressed
|
|
288
|
+
}) => /*#__PURE__*/_jsxs(_Fragment, {
|
|
289
|
+
children: [/*#__PURE__*/_jsx(Gradient, {
|
|
290
|
+
colors: gradient.colors,
|
|
291
|
+
locations: gradient.locations,
|
|
292
|
+
start: gradient.start,
|
|
293
|
+
end: gradient.end,
|
|
294
|
+
style: bleedStyle
|
|
295
|
+
}), pressed && parsedActiveBg?.type === 'gradient' && /*#__PURE__*/_jsx(Gradient, {
|
|
296
|
+
colors: parsedActiveBg.colors,
|
|
297
|
+
locations: parsedActiveBg.locations,
|
|
298
|
+
start: parsedActiveBg.start,
|
|
299
|
+
end: parsedActiveBg.end,
|
|
300
|
+
style: bleedStyle
|
|
301
|
+
}), pressed && activeFlatBgColor && /*#__PURE__*/_jsx(View, {
|
|
302
|
+
style: [bleedStyle, {
|
|
303
|
+
backgroundColor: activeFlatBgColor
|
|
304
|
+
}]
|
|
305
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
306
|
+
style: contentLayout,
|
|
307
|
+
children: content
|
|
308
|
+
})]
|
|
309
|
+
})
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ---- Flat path ---------------------------------------------------
|
|
314
|
+
// Also the fallback when a gradient is requested but
|
|
315
|
+
// `expo-linear-gradient` is not installed: `resolveSurfaceStyle` has
|
|
316
|
+
// already set `backgroundColor` to the gradient's first stop.
|
|
317
|
+
return /*#__PURE__*/_jsx(RNPressable, {
|
|
318
|
+
ref: ref,
|
|
319
|
+
onPress: handlePress,
|
|
320
|
+
disabled: isInteractionBlocked,
|
|
321
|
+
accessibilityRole: accessibilityRole,
|
|
322
|
+
accessible: accessible,
|
|
323
|
+
accessibilityState: accessibilityState,
|
|
324
|
+
onLayout: minTouchTarget ? handleLayout : undefined,
|
|
325
|
+
hitSlop: hitSlop,
|
|
326
|
+
android_ripple: androidRipple,
|
|
327
|
+
style: ({
|
|
328
|
+
pressed
|
|
329
|
+
}) => [surface, disabledStyle, !isInteractionBlocked && pressed ? pressedStyle : undefined, style],
|
|
330
|
+
...rest,
|
|
331
|
+
children: content
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
/** Memoised — see the note on `Block`. */
|
|
336
|
+
export const Pressable = /*#__PURE__*/memo(PressableImpl);
|
|
337
|
+
Pressable.displayName = 'Pressable';
|
|
338
|
+
export default Pressable;
|
|
339
|
+
//# sourceMappingURL=Pressable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","memo","useCallback","useMemo","useState","Pressable","RNPressable","Platform","View","ActivityIndicator","parseBackground","parseBorder","parseBoxShadow","resolveSurfaceStyle","LinearGradient","MIN_TOUCH_TARGET","resolveHitSlop","sameHitSlop","useLiveRegionAnnounce","resolvePressFeedback","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PressableImpl","children","background","backgroundColor","activeBackground","disabledBackground","border","activeBorder","disabledBorder","borderRadius","boxShadow","activeBoxShadow","paddingTop","paddingRight","paddingBottom","paddingLeft","flexDirection","alignItems","justifyContent","alignSelf","gap","width","minWidth","maxWidth","height","minHeight","maxHeight","flexShrink","flexGrow","opacity","overflow","disabled","loading","loaderColor","loaderSize","loadingAccessibilityLabel","pressedScale","rippleColor","rippleBorderless","minTouchTarget","onPress","style","accessibilityRole","accessible","rest","ref","parsedBg","parsedActiveBg","parsedDisabledBg","activeBorderStyle","disabledBorderStyle","activeShadowStyle","isInteractionBlocked","usesDisabledChrome","surface","OS","isGradient","type","canRenderGradient","activeFlatBgColor","color","undefined","disabledBgColor","colors","handlePress","event","accessibilityState","busy","androidRipple","pressedTransform","activeBackgroundColor","disabledStyle","pressedStyle","hitSlop","setHitSlop","handleLayout","nativeEvent","layout","next","previous","content","size","gradient","Gradient","borderWidth","bleed","bleedStyle","position","top","right","bottom","left","frameFlexDirection","frameAlignItems","frameJustifyContent","frameGap","frame","contentLayout","flex","frameStyle","onLayout","android_ripple","pressed","locations","start","end","displayName"],"sourceRoot":"../../../src","sources":["primitives/Pressable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC/E,SACIC,SAAS,IAAIC,WAAW,EACxBC,QAAQ,EACRC,IAAI,EACJC,iBAAiB,QAMd,cAAc;AACrB,SACIC,eAAe,EACfC,WAAW,EACXC,cAAc,QACX,iCAA8B;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ACb,IAAI;UACD2D,KAAK,EAAE,CACH6C,UAAU,EACV;YAAEnF,eAAe,EAAEwD;UAAkB,CAAC;QACxC,CACL,CACJ,eACDhE,IAAA,CAACb,IAAI;UAAC2D,KAAK,EAAEwD,aAAc;UAAAhG,QAAA,EAAE+E;QAAO,CAAO,CAAC;MAAA,CAC9C;IACL,CACQ,CAAC;EAEtB;;EAEA;EACA;EACA;EACA;EACA,oBACIrF,IAAA,CAACf,WAAW;IACRiE,GAAG,EAAEA,GAAI;IACTL,OAAO,EAAEwB,WAAY;IACrBjC,QAAQ,EAAEqB,oBAAqB;IAC/BV,iBAAiB,EAAEA,iBAAkB;IACrCC,UAAU,EAAEA,UAAW;IACvBuB,kBAAkB,EAAEA,kBAAmB;IACvCkC,QAAQ,EAAE7D,cAAc,GAAGoC,YAAY,GAAGd,SAAU;IACpDY,OAAO,EAAEA,OAAQ;IACjB4B,cAAc,EAAEjC,aAAc;IAC9B3B,KAAK,EAAEA,CAAC;MAAE6D;IAAQ,CAAC,KAAK,CACpBhD,OAAO,EACPiB,aAAa,EACb,CAACnB,oBAAoB,IAAIkD,OAAO,GAAG9B,YAAY,GAAGX,SAAS,EAC3DpB,KAAK,CACP;IAAA,GACEG,IAAI;IAAA3C,QAAA,EAEP+E;EAAO,CACC,CAAC;AAEtB,CACJ,CAAC;;AAED;AACA,OAAO,MAAMrG,SAAS,gBAAGJ,IAAI,CAACyB,aAAa,CAAC;AAC5CrB,SAAS,CAAC+H,WAAW,GAAG,WAAW;AAEnC,eAAe/H,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, memo, useContext } from 'react';
|
|
4
|
+
import { TextInput as RNTextInput, StyleSheet } from 'react-native';
|
|
5
|
+
import { parseDimension } from "../adapters/cssStringAdapter.js";
|
|
6
|
+
import { resolveFontWeight } from "./textStyle.js";
|
|
7
|
+
import { BlendNativeThemeContext } from "../theme/BlendNativeProvider.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Native `PrimitiveInput` — a bare RN `TextInput` driven by token-shaped
|
|
11
|
+
* text props, the input counterpart of `Text`.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately *only* the text field: web's `PrimitiveInput` styles the
|
|
14
|
+
* `<input>` element itself with border and padding, but RN inputs carry
|
|
15
|
+
* leading/trailing slots, so the bordered container is a `Block` row that
|
|
16
|
+
* the field component owns and this primitive sits inside with `flex: 1`.
|
|
17
|
+
*
|
|
18
|
+
* Font family comes from the provider's role map (`body`), matching `Text`,
|
|
19
|
+
* and OS font scaling stays on per the package policy.
|
|
20
|
+
*/
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
const PrimitiveInputImpl = /*#__PURE__*/forwardRef(function PrimitiveInput({
|
|
23
|
+
fontSize,
|
|
24
|
+
fontWeight,
|
|
25
|
+
color,
|
|
26
|
+
lineHeight,
|
|
27
|
+
placeholderColor,
|
|
28
|
+
style,
|
|
29
|
+
...rest
|
|
30
|
+
}, ref) {
|
|
31
|
+
const {
|
|
32
|
+
fontFamily
|
|
33
|
+
} = useContext(BlendNativeThemeContext);
|
|
34
|
+
const resolved = {
|
|
35
|
+
fontSize: parseDimension(fontSize),
|
|
36
|
+
fontWeight: resolveFontWeight(fontWeight),
|
|
37
|
+
color,
|
|
38
|
+
lineHeight: parseDimension(lineHeight),
|
|
39
|
+
fontFamily: fontFamily.body ?? undefined
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/_jsx(RNTextInput, {
|
|
42
|
+
ref: ref,
|
|
43
|
+
style: StyleSheet.flatten([baseStyle.input, resolved, style]),
|
|
44
|
+
placeholderTextColor: placeholderColor,
|
|
45
|
+
...rest
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/** Memoised — see the note on `Block`. */
|
|
50
|
+
export const PrimitiveInput = /*#__PURE__*/memo(PrimitiveInputImpl);
|
|
51
|
+
PrimitiveInput.displayName = 'PrimitiveInput';
|
|
52
|
+
const baseStyle = StyleSheet.create({
|
|
53
|
+
input: {
|
|
54
|
+
// The field row owns padding; RN inputs default to platform padding
|
|
55
|
+
// that would double up with the container's token padding.
|
|
56
|
+
flex: 1,
|
|
57
|
+
paddingVertical: 0,
|
|
58
|
+
paddingHorizontal: 0
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export default PrimitiveInput;
|
|
62
|
+
//# sourceMappingURL=PrimitiveInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","memo","useContext","TextInput","RNTextInput","StyleSheet","parseDimension","resolveFontWeight","BlendNativeThemeContext","jsx","_jsx","PrimitiveInputImpl","PrimitiveInput","fontSize","fontWeight","color","lineHeight","placeholderColor","style","rest","ref","fontFamily","resolved","body","undefined","flatten","baseStyle","input","placeholderTextColor","displayName","create","flex","paddingVertical","paddingHorizontal"],"sourceRoot":"../../../src","sources":["primitives/PrimitiveInput.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,IAAI,EAAEC,UAAU,QAAQ,OAAO;AACpD,SACIC,SAAS,IAAIC,WAAW,EACxBC,UAAU,QAGP,cAAc;AACrB,SAASC,cAAc,QAAQ,iCAA8B;AAC7D,SAASC,iBAAiB,QAAQ,gBAAa;AAC/C,SAASC,uBAAuB,QAAQ,iCAA8B;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA,SAAAC,GAAA,IAAAC,IAAA;AA2BA,MAAMC,kBAAkB,gBAAGX,UAAU,CACjC,SAASY,cAAcA,CACnB;EACIC,QAAQ;EACRC,UAAU;EACVC,KAAK;EACLC,UAAU;EACVC,gBAAgB;EAChBC,KAAK;EACL,GAAGC;AACP,CAAC,EACDC,GAAG,EACL;EACE,MAAM;IAAEC;EAAW,CAAC,GAAGnB,UAAU,CAACM,uBAAuB,CAAC;EAE1D,MAAMc,QAAmB,GAAG;IACxBT,QAAQ,EAAEP,cAAc,CAACO,QAAQ,CAAC;IAClCC,UAAU,EAAEP,iBAAiB,CAACO,UAAU,CAAC;IACzCC,KAAK;IACLC,UAAU,EAAEV,cAAc,CAACU,UAAU,CAAC;IACtCK,UAAU,EAAEA,UAAU,CAACE,IAAI,IAAIC;EACnC,CAAC;EAED,oBACId,IAAA,CAACN,WAAW;IACRgB,GAAG,EAAEA,GAAI;IACTF,KAAK,EAAEb,UAAU,CAACoB,OAAO,CAAC,CAACC,SAAS,CAACC,KAAK,EAAEL,QAAQ,EAAEJ,KAAK,CAAC,CAAE;IAC9DU,oBAAoB,EAAEX,gBAAiB;IAAA,GACnCE;EAAI,CACX,CAAC;AAEV,CACJ,CAAC;;AAED;AACA,OAAO,MAAMP,cAAc,gBAAGX,IAAI,CAACU,kBAAkB,CAAC;AACtDC,cAAc,CAACiB,WAAW,GAAG,gBAAgB;AAE7C,MAAMH,SAAS,GAAGrB,UAAU,CAACyB,MAAM,CAAC;EAChCH,KAAK,EAAE;IACH;IACA;IACAI,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE,CAAC;IAClBC,iBAAiB,EAAE;EACvB;AACJ,CAAC,CAAC;AAEF,eAAerB,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { FOUNDATION_THEME } from '@juspay/blend-design-system/node';
|
|
5
|
+
import { parseDimension } from "../adapters/cssStringAdapter.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Decorative divider.
|
|
9
|
+
*
|
|
10
|
+
* Native counterpart of web's `components/common/Seperator.tsx` — a fixed-size
|
|
11
|
+
* block of colour used to separate adjacent content. Alert renders one between
|
|
12
|
+
* its actions and its close button when the actions sit inline.
|
|
13
|
+
*
|
|
14
|
+
* Always hidden from assistive tech: it carries no information that the
|
|
15
|
+
* surrounding content does not already convey.
|
|
16
|
+
*/
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
const DEFAULT_LENGTH = FOUNDATION_THEME.unit[16];
|
|
19
|
+
const DEFAULT_THICKNESS = 1;
|
|
20
|
+
const DEFAULT_COLOR = String(FOUNDATION_THEME.colors.gray[300]);
|
|
21
|
+
export function Separator({
|
|
22
|
+
orientation = 'vertical',
|
|
23
|
+
length = DEFAULT_LENGTH,
|
|
24
|
+
thickness = DEFAULT_THICKNESS,
|
|
25
|
+
color = DEFAULT_COLOR,
|
|
26
|
+
style,
|
|
27
|
+
testID
|
|
28
|
+
}) {
|
|
29
|
+
const resolvedLength = parseDimension(length);
|
|
30
|
+
const resolvedThickness = parseDimension(thickness);
|
|
31
|
+
const sizing = orientation === 'vertical' ? {
|
|
32
|
+
width: resolvedThickness,
|
|
33
|
+
height: resolvedLength
|
|
34
|
+
} : {
|
|
35
|
+
width: resolvedLength,
|
|
36
|
+
height: resolvedThickness
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/_jsx(View, {
|
|
39
|
+
testID: testID,
|
|
40
|
+
accessible: false,
|
|
41
|
+
accessibilityElementsHidden: true,
|
|
42
|
+
importantForAccessibility: "no-hide-descendants",
|
|
43
|
+
style: StyleSheet.flatten([sizing, {
|
|
44
|
+
backgroundColor: color
|
|
45
|
+
}, style])
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
Separator.displayName = 'Separator';
|
|
49
|
+
export default Separator;
|
|
50
|
+
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","View","FOUNDATION_THEME","parseDimension","jsx","_jsx","DEFAULT_LENGTH","unit","DEFAULT_THICKNESS","DEFAULT_COLOR","String","colors","gray","Separator","orientation","length","thickness","color","style","testID","resolvedLength","resolvedThickness","sizing","width","height","accessible","accessibilityElementsHidden","importantForAccessibility","flatten","backgroundColor","displayName"],"sourceRoot":"../../../src","sources":["primitives/Separator.tsx"],"mappings":";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
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { memo } from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import { parseSize } from "../adapters/cssStringAdapter.js";
|
|
6
|
+
import { tintSlot } from "./tintSlot.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export { tintSlot };
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Leading / trailing icon slot.
|
|
12
|
+
*
|
|
13
|
+
* Shared by `Button` and `Tag`, both of which need identical behaviour and
|
|
14
|
+
* both of which previously got it wrong in the same three ways:
|
|
15
|
+
*
|
|
16
|
+
* 1. **Tinting.** On web, components pass `color` to `Block`, which maps to
|
|
17
|
+
* CSS `color`, and SVG icons pick it up through `currentColor`. The native
|
|
18
|
+
* `Block` mapped `color` to `backgroundColor`, so the same call painted a
|
|
19
|
+
* solid rectangle *behind* the icon and never tinted the icon at all. RN
|
|
20
|
+
* has no `currentColor`, so the tint has to be handed to the element
|
|
21
|
+
* explicitly — that is what this component does.
|
|
22
|
+
* 2. **Per-slot `maxHeight`.** `leftSlot.maxHeight` / `rightSlot.maxHeight`
|
|
23
|
+
* are part of the web prop contract and were ignored.
|
|
24
|
+
* 3. **Screen readers.** Web marks slots `aria-hidden` when the component
|
|
25
|
+
* also renders text, so the icon is not announced separately from the
|
|
26
|
+
* label. Native rendered them as visible accessibility nodes.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function SlotImpl({
|
|
30
|
+
children,
|
|
31
|
+
color,
|
|
32
|
+
maxHeight,
|
|
33
|
+
hidden = false,
|
|
34
|
+
style,
|
|
35
|
+
testID
|
|
36
|
+
}) {
|
|
37
|
+
if (!children) return null;
|
|
38
|
+
const resolved = {
|
|
39
|
+
...baseStyle.slot
|
|
40
|
+
};
|
|
41
|
+
const size = parseSize(maxHeight);
|
|
42
|
+
if (size !== undefined) resolved.maxHeight = size;
|
|
43
|
+
return /*#__PURE__*/_jsx(View, {
|
|
44
|
+
style: StyleSheet.flatten([resolved, style]),
|
|
45
|
+
testID: testID
|
|
46
|
+
// Matches web's `aria-hidden` on slots that accompany text: the
|
|
47
|
+
// icon should not be announced as a separate element, and the
|
|
48
|
+
// parent already carries the accessible name.
|
|
49
|
+
,
|
|
50
|
+
accessible: hidden ? false : undefined,
|
|
51
|
+
importantForAccessibility: hidden ? 'no-hide-descendants' : undefined,
|
|
52
|
+
accessibilityElementsHidden: hidden || undefined,
|
|
53
|
+
children: tintSlot(children, color)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Memoised — see the note on `Block`. */
|
|
58
|
+
export const Slot = /*#__PURE__*/memo(SlotImpl);
|
|
59
|
+
Slot.displayName = 'Slot';
|
|
60
|
+
const baseStyle = StyleSheet.create({
|
|
61
|
+
slot: {
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
flexShrink: 0
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export default Slot;
|
|
69
|
+
//# sourceMappingURL=Slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","memo","View","StyleSheet","parseSize","tintSlot","jsx","_jsx","SlotImpl","children","color","maxHeight","hidden","style","testID","resolved","baseStyle","slot","size","undefined","flatten","accessible","importantForAccessibility","accessibilityElementsHidden","Slot","displayName","create","flexDirection","alignItems","justifyContent","flexShrink"],"sourceRoot":"../../../src","sources":["primitives/Slot.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,IAAI,EAAEC,UAAU,QAAwB,cAAc;AAC/D,SAASC,SAAS,QAAQ,iCAA8B;AACxD,SAASC,QAAQ,QAAQ,eAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAErC,SAASF,QAAQ;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA,SAASG,QAAQA,CAAC;EACdC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,MAAM,GAAG,KAAK;EACdC,KAAK;EACLC;AACO,CAAC,EAAE;EACV,IAAI,CAACL,QAAQ,EAAE,OAAO,IAAI;EAE1B,MAAMM,QAAmB,GAAG;IAAE,GAAGC,SAAS,CAACC;EAAK,CAAC;EACjD,MAAMC,IAAI,GAAGd,SAAS,CAACO,SAAS,CAAC;EACjC,IAAIO,IAAI,KAAKC,SAAS,EAAEJ,QAAQ,CAACJ,SAAS,GAAGO,IAAI;EAEjD,oBACIX,IAAA,CAACL,IAAI;IACDW,KAAK,EAAEV,UAAU,CAACiB,OAAO,CAAC,CAACL,QAAQ,EAAEF,KAAK,CAAC,CAAE;IAC7CC,MAAM,EAAEA;IACR;IACA;IACA;IAAA;IACAO,UAAU,EAAET,MAAM,GAAG,KAAK,GAAGO,SAAU;IACvCG,yBAAyB,EACrBV,MAAM,GAAG,qBAAqB,GAAGO,SACpC;IACDI,2BAA2B,EAAEX,MAAM,IAAIO,SAAU;IAAAV,QAAA,EAEhDJ,QAAQ,CAACI,QAAQ,EAAEC,KAAK;EAAC,CACxB,CAAC;AAEf;;AAEA;AACA,OAAO,MAAMc,IAAI,gBAAGvB,IAAI,CAACO,QAAQ,CAAC;AAClCgB,IAAI,CAACC,WAAW,GAAG,MAAM;AAEzB,MAAMT,SAAS,GAAGb,UAAU,CAACuB,MAAM,CAAC;EAChCT,IAAI,EAAE;IACFU,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EAChB;AACJ,CAAC,CAAC;AAEF,eAAeN,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { memo, useContext } from 'react';
|
|
4
|
+
import { Text as RNText, StyleSheet } from 'react-native';
|
|
5
|
+
import { parseDimension } from "../adapters/cssStringAdapter.js";
|
|
6
|
+
import { resolveFontWeight } from "./textStyle.js";
|
|
7
|
+
import { BlendNativeThemeContext } from "../theme/BlendNativeProvider.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Native `Text` — renders a RN `Text` from token-driven style props.
|
|
11
|
+
*
|
|
12
|
+
* Mirrors the web `Text` component's API (`fontSize`, `fontWeight`, `color`,
|
|
13
|
+
* `lineHeight`, `textAlign`) but accepts CSS-string values directly from
|
|
14
|
+
* Blend tokens and translates them to `TextStyle` numbers.
|
|
15
|
+
*
|
|
16
|
+
* **Font family** comes from the provider's resolved role map (web has CSS
|
|
17
|
+
* inheritance; RN does not, so the provider is the inheritance mechanism).
|
|
18
|
+
* Defaults to the `body` role; `fontRole` picks another role and an explicit
|
|
19
|
+
* `fontFamily` wins outright.
|
|
20
|
+
*
|
|
21
|
+
* **Font scaling** is deliberately left ON (RN's default). The package policy
|
|
22
|
+
* is to respect OS Dynamic Type and let controls grow — components size with
|
|
23
|
+
* `minHeight`, never a fixed `height`, so scaled text expands the control
|
|
24
|
+
* instead of clipping. Consumers needing a cap can pass RN's own
|
|
25
|
+
* `maxFontSizeMultiplier` through `...rest`.
|
|
26
|
+
*/
|
|
27
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
function TextImpl({
|
|
29
|
+
children,
|
|
30
|
+
fontSize,
|
|
31
|
+
fontWeight,
|
|
32
|
+
color,
|
|
33
|
+
lineHeight,
|
|
34
|
+
textAlign,
|
|
35
|
+
fontFamily,
|
|
36
|
+
fontRole = 'body',
|
|
37
|
+
style,
|
|
38
|
+
...rest
|
|
39
|
+
}) {
|
|
40
|
+
const {
|
|
41
|
+
fontFamily: familyMap
|
|
42
|
+
} = useContext(BlendNativeThemeContext);
|
|
43
|
+
// `null` in the map means "leave the platform font" — emit nothing.
|
|
44
|
+
const resolvedFamily = fontFamily ?? familyMap[fontRole] ?? undefined;
|
|
45
|
+
const resolved = {
|
|
46
|
+
fontSize: parseDimension(fontSize),
|
|
47
|
+
fontWeight: resolveFontWeight(fontWeight),
|
|
48
|
+
color,
|
|
49
|
+
lineHeight: parseDimension(lineHeight),
|
|
50
|
+
textAlign,
|
|
51
|
+
fontFamily: resolvedFamily
|
|
52
|
+
};
|
|
53
|
+
const flat = StyleSheet.flatten([baseStyle.text, resolved, style]);
|
|
54
|
+
return /*#__PURE__*/_jsx(RNText, {
|
|
55
|
+
style: flat,
|
|
56
|
+
...rest,
|
|
57
|
+
children: children
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Memoised — see the note on `Block`. */
|
|
62
|
+
export const Text = /*#__PURE__*/memo(TextImpl);
|
|
63
|
+
Text.displayName = 'Text';
|
|
64
|
+
const baseStyle = StyleSheet.create({
|
|
65
|
+
text: {}
|
|
66
|
+
});
|
|
67
|
+
export default Text;
|
|
68
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","memo","useContext","Text","RNText","StyleSheet","parseDimension","resolveFontWeight","BlendNativeThemeContext","jsx","_jsx","TextImpl","children","fontSize","fontWeight","color","lineHeight","textAlign","fontFamily","fontRole","style","rest","familyMap","resolvedFamily","undefined","resolved","flat","flatten","baseStyle","text","displayName","create"],"sourceRoot":"../../../src","sources":["primitives/Text.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,UAAU,QAAQ,OAAO;AAC/C,SACIC,IAAI,IAAIC,MAAM,EACdC,UAAU,QAGP,cAAc;AACrB,SAASC,cAAc,QAAQ,iCAA8B;AAC7D,SAASC,iBAAiB,QAAQ,gBAAa;AAC/C,SAASC,uBAAuB,QAAQ,iCAA8B;;AAGtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA,SAAAC,GAAA,IAAAC,IAAA;AA4CA,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