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,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Slot = void 0;
|
|
7
|
+
Object.defineProperty(exports, "tintSlot", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _tintSlot.tintSlot;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _reactNative = require("react-native");
|
|
15
|
+
var _cssStringAdapter = require("../adapters/cssStringAdapter.js");
|
|
16
|
+
var _tintSlot = require("./tintSlot.js");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
|
+
/**
|
|
20
|
+
* Leading / trailing icon slot.
|
|
21
|
+
*
|
|
22
|
+
* Shared by `Button` and `Tag`, both of which need identical behaviour and
|
|
23
|
+
* both of which previously got it wrong in the same three ways:
|
|
24
|
+
*
|
|
25
|
+
* 1. **Tinting.** On web, components pass `color` to `Block`, which maps to
|
|
26
|
+
* CSS `color`, and SVG icons pick it up through `currentColor`. The native
|
|
27
|
+
* `Block` mapped `color` to `backgroundColor`, so the same call painted a
|
|
28
|
+
* solid rectangle *behind* the icon and never tinted the icon at all. RN
|
|
29
|
+
* has no `currentColor`, so the tint has to be handed to the element
|
|
30
|
+
* explicitly — that is what this component does.
|
|
31
|
+
* 2. **Per-slot `maxHeight`.** `leftSlot.maxHeight` / `rightSlot.maxHeight`
|
|
32
|
+
* are part of the web prop contract and were ignored.
|
|
33
|
+
* 3. **Screen readers.** Web marks slots `aria-hidden` when the component
|
|
34
|
+
* also renders text, so the icon is not announced separately from the
|
|
35
|
+
* label. Native rendered them as visible accessibility nodes.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function SlotImpl({
|
|
39
|
+
children,
|
|
40
|
+
color,
|
|
41
|
+
maxHeight,
|
|
42
|
+
hidden = false,
|
|
43
|
+
style,
|
|
44
|
+
testID
|
|
45
|
+
}) {
|
|
46
|
+
if (!children) return null;
|
|
47
|
+
const resolved = {
|
|
48
|
+
...baseStyle.slot
|
|
49
|
+
};
|
|
50
|
+
const size = (0, _cssStringAdapter.parseSize)(maxHeight);
|
|
51
|
+
if (size !== undefined) resolved.maxHeight = size;
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
53
|
+
style: _reactNative.StyleSheet.flatten([resolved, style]),
|
|
54
|
+
testID: testID
|
|
55
|
+
// Matches web's `aria-hidden` on slots that accompany text: the
|
|
56
|
+
// icon should not be announced as a separate element, and the
|
|
57
|
+
// parent already carries the accessible name.
|
|
58
|
+
,
|
|
59
|
+
accessible: hidden ? false : undefined,
|
|
60
|
+
importantForAccessibility: hidden ? 'no-hide-descendants' : undefined,
|
|
61
|
+
accessibilityElementsHidden: hidden || undefined,
|
|
62
|
+
children: (0, _tintSlot.tintSlot)(children, color)
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Memoised — see the note on `Block`. */
|
|
67
|
+
const Slot = exports.Slot = /*#__PURE__*/(0, _react.memo)(SlotImpl);
|
|
68
|
+
Slot.displayName = 'Slot';
|
|
69
|
+
const baseStyle = _reactNative.StyleSheet.create({
|
|
70
|
+
slot: {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
justifyContent: 'center',
|
|
74
|
+
flexShrink: 0
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
var _default = exports.default = Slot;
|
|
78
|
+
//# sourceMappingURL=Slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_cssStringAdapter","_tintSlot","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SlotImpl","children","color","maxHeight","hidden","style","testID","resolved","baseStyle","slot","size","parseSize","undefined","jsx","View","StyleSheet","flatten","accessible","importantForAccessibility","accessibilityElementsHidden","tintSlot","Slot","exports","memo","displayName","create","flexDirection","alignItems","justifyContent","flexShrink","_default"],"sourceRoot":"../../../src","sources":["primitives/Slot.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Text = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _cssStringAdapter = require("../adapters/cssStringAdapter.js");
|
|
10
|
+
var _textStyle = require("./textStyle.js");
|
|
11
|
+
var _BlendNativeProvider = require("../theme/BlendNativeProvider.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
/**
|
|
15
|
+
* Native `Text` — renders a RN `Text` from token-driven style props.
|
|
16
|
+
*
|
|
17
|
+
* Mirrors the web `Text` component's API (`fontSize`, `fontWeight`, `color`,
|
|
18
|
+
* `lineHeight`, `textAlign`) but accepts CSS-string values directly from
|
|
19
|
+
* Blend tokens and translates them to `TextStyle` numbers.
|
|
20
|
+
*
|
|
21
|
+
* **Font family** comes from the provider's resolved role map (web has CSS
|
|
22
|
+
* inheritance; RN does not, so the provider is the inheritance mechanism).
|
|
23
|
+
* Defaults to the `body` role; `fontRole` picks another role and an explicit
|
|
24
|
+
* `fontFamily` wins outright.
|
|
25
|
+
*
|
|
26
|
+
* **Font scaling** is deliberately left ON (RN's default). The package policy
|
|
27
|
+
* is to respect OS Dynamic Type and let controls grow — components size with
|
|
28
|
+
* `minHeight`, never a fixed `height`, so scaled text expands the control
|
|
29
|
+
* instead of clipping. Consumers needing a cap can pass RN's own
|
|
30
|
+
* `maxFontSizeMultiplier` through `...rest`.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
function TextImpl({
|
|
34
|
+
children,
|
|
35
|
+
fontSize,
|
|
36
|
+
fontWeight,
|
|
37
|
+
color,
|
|
38
|
+
lineHeight,
|
|
39
|
+
textAlign,
|
|
40
|
+
fontFamily,
|
|
41
|
+
fontRole = 'body',
|
|
42
|
+
style,
|
|
43
|
+
...rest
|
|
44
|
+
}) {
|
|
45
|
+
const {
|
|
46
|
+
fontFamily: familyMap
|
|
47
|
+
} = (0, _react.useContext)(_BlendNativeProvider.BlendNativeThemeContext);
|
|
48
|
+
// `null` in the map means "leave the platform font" — emit nothing.
|
|
49
|
+
const resolvedFamily = fontFamily ?? familyMap[fontRole] ?? undefined;
|
|
50
|
+
const resolved = {
|
|
51
|
+
fontSize: (0, _cssStringAdapter.parseDimension)(fontSize),
|
|
52
|
+
fontWeight: (0, _textStyle.resolveFontWeight)(fontWeight),
|
|
53
|
+
color,
|
|
54
|
+
lineHeight: (0, _cssStringAdapter.parseDimension)(lineHeight),
|
|
55
|
+
textAlign,
|
|
56
|
+
fontFamily: resolvedFamily
|
|
57
|
+
};
|
|
58
|
+
const flat = _reactNative.StyleSheet.flatten([baseStyle.text, resolved, style]);
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
60
|
+
style: flat,
|
|
61
|
+
...rest,
|
|
62
|
+
children: children
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Memoised — see the note on `Block`. */
|
|
67
|
+
const Text = exports.Text = /*#__PURE__*/(0, _react.memo)(TextImpl);
|
|
68
|
+
Text.displayName = 'Text';
|
|
69
|
+
const baseStyle = _reactNative.StyleSheet.create({
|
|
70
|
+
text: {}
|
|
71
|
+
});
|
|
72
|
+
var _default = exports.default = Text;
|
|
73
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_cssStringAdapter","_textStyle","_BlendNativeProvider","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TextImpl","children","fontSize","fontWeight","color","lineHeight","textAlign","fontFamily","fontRole","style","rest","familyMap","useContext","BlendNativeThemeContext","resolvedFamily","undefined","resolved","parseDimension","resolveFontWeight","flat","StyleSheet","flatten","baseStyle","text","jsx","Text","exports","memo","displayName","create","_default"],"sourceRoot":"../../../src","sources":["primitives/Text.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_RIPPLE_COLOR = void 0;
|
|
7
|
+
exports.resolvePressFeedback = resolvePressFeedback;
|
|
8
|
+
/**
|
|
9
|
+
* Press feedback is platform-idiomatic, not uniform.
|
|
10
|
+
*
|
|
11
|
+
* Web scales the surface by `0.99`, and that reads correctly on iOS where a
|
|
12
|
+
* subtle depress is the convention. Android users expect a **ripple**, and a
|
|
13
|
+
* scale transform there looks like a bug. Applying both would double the
|
|
14
|
+
* feedback.
|
|
15
|
+
*
|
|
16
|
+
* The decision lives here — a leaf module with no `react-native` value import
|
|
17
|
+
* — so it is unit-testable outside a renderer, the same split as
|
|
18
|
+
* `theme/breakpoint.ts`, `primitives/touchTarget.ts` and the shadow handling
|
|
19
|
+
* in `adapters/surfaceStyle.ts`. `Pressable` passes the real `Platform.OS`.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Ripple colour used when neither the caller nor the active-state token
|
|
24
|
+
* supplies one. Low-alpha black is Android's own default for light surfaces.
|
|
25
|
+
*/
|
|
26
|
+
const DEFAULT_RIPPLE_COLOR = exports.DEFAULT_RIPPLE_COLOR = 'rgba(0, 0, 0, 0.12)';
|
|
27
|
+
function resolvePressFeedback(platform, options = {}) {
|
|
28
|
+
const {
|
|
29
|
+
rippleColor,
|
|
30
|
+
activeBackgroundColor,
|
|
31
|
+
rippleBorderless = false,
|
|
32
|
+
pressedScale = 0.99
|
|
33
|
+
} = options;
|
|
34
|
+
if (platform === 'android') {
|
|
35
|
+
return {
|
|
36
|
+
androidRipple: {
|
|
37
|
+
color: rippleColor ?? activeBackgroundColor ?? DEFAULT_RIPPLE_COLOR,
|
|
38
|
+
borderless: rippleBorderless
|
|
39
|
+
},
|
|
40
|
+
// The ripple is the feedback; scaling as well would double it.
|
|
41
|
+
pressedTransform: {}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
androidRipple: undefined,
|
|
46
|
+
pressedTransform: {
|
|
47
|
+
transform: [{
|
|
48
|
+
scale: pressedScale
|
|
49
|
+
}]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=pressFeedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_RIPPLE_COLOR","exports","resolvePressFeedback","platform","options","rippleColor","activeBackgroundColor","rippleBorderless","pressedScale","androidRipple","color","borderless","pressedTransform","undefined","transform","scale"],"sourceRoot":"../../../src","sources":["primitives/pressFeedback.ts"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACO,MAAMA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,qBAAqB;AAElD,SAASE,oBAAoBA,CAChCC,QAA+B,EAC/BC,OAOC,GAAG,CAAC,CAAC,EACO;EACb,MAAM;IACFC,WAAW;IACXC,qBAAqB;IACrBC,gBAAgB,GAAG,KAAK;IACxBC,YAAY,GAAG;EACnB,CAAC,GAAGJ,OAAO;EAEX,IAAID,QAAQ,KAAK,SAAS,EAAE;IACxB,OAAO;MACHM,aAAa,EAAE;QACXC,KAAK,EACDL,WAAW,IACXC,qBAAqB,IACrBN,oBAAoB;QACxBW,UAAU,EAAEJ;MAChB,CAAC;MACD;MACAK,gBAAgB,EAAE,CAAC;IACvB,CAAC;EACL;EAEA,OAAO;IACHH,aAAa,EAAEI,SAAS;IACxBD,gBAAgB,EAAE;MAAEE,SAAS,EAAE,CAAC;QAAEC,KAAK,EAAEP;MAAa,CAAC;IAAE;EAC7D,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveFontWeight = resolveFontWeight;
|
|
7
|
+
/**
|
|
8
|
+
* Shared text-style resolution for `Text` and `PrimitiveInput`.
|
|
9
|
+
*
|
|
10
|
+
* Leaf module with only a type import from `react-native`, so it stays
|
|
11
|
+
* vitest-testable — the `theme/breakpoint.ts` pattern.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a CSS font-weight value to a RN-compatible `TextStyle['fontWeight']`.
|
|
16
|
+
* RN accepts `'normal' | 'bold' | '100'..'900'` (as string or number).
|
|
17
|
+
*/
|
|
18
|
+
function resolveFontWeight(w) {
|
|
19
|
+
if (w === undefined) return undefined;
|
|
20
|
+
if (typeof w === 'number') return String(w);
|
|
21
|
+
// Token values are numeric strings like `"500"`.
|
|
22
|
+
if (/^\d+$/.test(w)) return w;
|
|
23
|
+
const lower = w.toLowerCase();
|
|
24
|
+
if (lower === 'normal' || lower === 'bold') return lower;
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=textStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolveFontWeight","w","undefined","String","test","lower","toLowerCase"],"sourceRoot":"../../../src","sources":["primitives/textStyle.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO,SAASA,iBAAiBA,CAC7BC,CAA8B,EACP;EACvB,IAAIA,CAAC,KAAKC,SAAS,EAAE,OAAOA,SAAS;EACrC,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE,OAAOE,MAAM,CAACF,CAAC,CAAC;EAC3C;EACA,IAAI,OAAO,CAACG,IAAI,CAACH,CAAC,CAAC,EAAE,OAAOA,CAAC;EAC7B,MAAMI,KAAK,GAAGJ,CAAC,CAACK,WAAW,CAAC,CAAC;EAC7B,IAAID,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,MAAM,EAAE,OAAOA,KAAK;EACxD,OAAOH,SAAS;AACpB","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tintSlot = tintSlot;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Icon tinting.
|
|
10
|
+
*
|
|
11
|
+
* Kept in its own leaf module — importing nothing from `react-native` — so it
|
|
12
|
+
* stays unit-testable outside a renderer, the same split as
|
|
13
|
+
* `theme/breakpoint.ts` and `primitives/touchTarget.ts`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Props an icon element may accept for tinting.
|
|
18
|
+
*
|
|
19
|
+
* `color` is the channel every mainstream RN icon library understands —
|
|
20
|
+
* `lucide-react-native`, `phosphor-react-native`, `react-native-vector-icons`
|
|
21
|
+
* — and is what `Slot` sets.
|
|
22
|
+
*
|
|
23
|
+
* `fill` is deliberately NOT set. Lucide renders stroke-based artwork with
|
|
24
|
+
* `fill: "none"`, and its `Icon` spreads unknown props over both the root
|
|
25
|
+
* `Svg` and every child path *after* those defaults, so supplying a `fill`
|
|
26
|
+
* overrides `"none"` and floods the glyph solid — an outlined X becomes a
|
|
27
|
+
* filled block. Artwork that genuinely needs a fill should set it itself.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Apply a tint to an icon element.
|
|
32
|
+
*
|
|
33
|
+
* Only sets `color`, and only when the element has not set it explicitly —
|
|
34
|
+
* an icon rendered as `<Icon color="red" />` keeps red. Non-element children
|
|
35
|
+
* (a bare string, a number, `null`) are returned untouched.
|
|
36
|
+
*/
|
|
37
|
+
function tintSlot(node, color) {
|
|
38
|
+
if (!color || ! /*#__PURE__*/(0, _react.isValidElement)(node)) return node;
|
|
39
|
+
const element = node;
|
|
40
|
+
if (element.props.color !== undefined) return node;
|
|
41
|
+
return /*#__PURE__*/(0, _react.cloneElement)(element, {
|
|
42
|
+
color
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=tintSlot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","tintSlot","node","color","isValidElement","element","props","undefined","cloneElement"],"sourceRoot":"../../../src","sources":["primitives/tintSlot.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CACpBC,IAAe,EACfC,KAAyB,EAChB;EACT,IAAI,CAACA,KAAK,IAAI,eAAC,IAAAC,qBAAc,EAACF,IAAI,CAAC,EAAE,OAAOA,IAAI;EAEhD,MAAMG,OAAO,GAAGH,IAAmC;EACnD,IAAIG,OAAO,CAACC,KAAK,CAACH,KAAK,KAAKI,SAAS,EAAE,OAAOL,IAAI;EAElD,oBAAO,IAAAM,mBAAY,EAACH,OAAO,EAAE;IAAEF;EAAM,CAAC,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MIN_TOUCH_TARGET = void 0;
|
|
7
|
+
exports.resolveHitSlop = resolveHitSlop;
|
|
8
|
+
exports.sameHitSlop = sameHitSlop;
|
|
9
|
+
/**
|
|
10
|
+
* Minimum tap-target policy.
|
|
11
|
+
*
|
|
12
|
+
* Kept in its own leaf module — importing nothing from `react-native` — so it
|
|
13
|
+
* stays unit-testable outside a renderer. (RN's entrypoint ships Flow syntax
|
|
14
|
+
* that non-Metro bundlers cannot parse, so any module that value-imports it is
|
|
15
|
+
* unusable from a plain Node test runner. Same split as `theme/breakpoint.ts`.)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Inset applied to each edge of the touch region. */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Apple's Human Interface Guidelines minimum tappable size, in points. Also
|
|
22
|
+
* clears Material's 48dp target once RN's density conversion is applied.
|
|
23
|
+
*/
|
|
24
|
+
const MIN_TOUCH_TARGET = exports.MIN_TOUCH_TARGET = 44;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Slop needed to bring a rendered control up to the minimum tap target.
|
|
28
|
+
*
|
|
29
|
+
* Design-system controls are frequently smaller than the guideline by intent —
|
|
30
|
+
* an `xs` Tag is 20pt tall — so the fix is to widen the *touch* region rather
|
|
31
|
+
* than the control. Returns `undefined` when the control already complies (or
|
|
32
|
+
* when the minimum is disabled with `0`), so no `hitSlop` prop is emitted.
|
|
33
|
+
*
|
|
34
|
+
* ```
|
|
35
|
+
* resolveHitSlop(120, 48) -> undefined // already compliant
|
|
36
|
+
* resolveHitSlop(60, 20) -> { top: 12, bottom: 12, left: 0, right: 0 }
|
|
37
|
+
* resolveHitSlop(24, 24) -> { top: 10, bottom: 10, left: 10, right: 10 }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
function resolveHitSlop(width, height, minTouchTarget = MIN_TOUCH_TARGET) {
|
|
41
|
+
if (!minTouchTarget) return undefined;
|
|
42
|
+
const horizontal = Math.max(0, (minTouchTarget - width) / 2);
|
|
43
|
+
const vertical = Math.max(0, (minTouchTarget - height) / 2);
|
|
44
|
+
if (horizontal === 0 && vertical === 0) return undefined;
|
|
45
|
+
return {
|
|
46
|
+
top: vertical,
|
|
47
|
+
bottom: vertical,
|
|
48
|
+
left: horizontal,
|
|
49
|
+
right: horizontal
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Whether two slop values are equivalent.
|
|
55
|
+
*
|
|
56
|
+
* Lets callers skip a state update when a re-measure produces the same result,
|
|
57
|
+
* which keeps a control that never needed slop from re-rendering at all.
|
|
58
|
+
*/
|
|
59
|
+
function sameHitSlop(a, b) {
|
|
60
|
+
if (a === b) return true;
|
|
61
|
+
if (!a || !b) return false;
|
|
62
|
+
return a.top === b.top && a.bottom === b.bottom && a.left === b.left && a.right === b.right;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=touchTarget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MIN_TOUCH_TARGET","exports","resolveHitSlop","width","height","minTouchTarget","undefined","horizontal","Math","max","vertical","top","bottom","left","right","sameHitSlop","a","b"],"sourceRoot":"../../../src","sources":["primitives/touchTarget.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAQA;AACA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,EAAE;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAC1BC,KAAa,EACbC,MAAc,EACdC,cAAsB,GAAGL,gBAAgB,EACtB;EACnB,IAAI,CAACK,cAAc,EAAE,OAAOC,SAAS;EAErC,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,CAACJ,cAAc,GAAGF,KAAK,IAAI,CAAC,CAAC;EAC5D,MAAMO,QAAQ,GAAGF,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,CAACJ,cAAc,GAAGD,MAAM,IAAI,CAAC,CAAC;EAC3D,IAAIG,UAAU,KAAK,CAAC,IAAIG,QAAQ,KAAK,CAAC,EAAE,OAAOJ,SAAS;EAExD,OAAO;IACHK,GAAG,EAAED,QAAQ;IACbE,MAAM,EAAEF,QAAQ;IAChBG,IAAI,EAAEN,UAAU;IAChBO,KAAK,EAAEP;EACX,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,WAAWA,CAACC,CAAW,EAAEC,CAAW,EAAW;EAC3D,IAAID,CAAC,KAAKC,CAAC,EAAE,OAAO,IAAI;EACxB,IAAI,CAACD,CAAC,IAAI,CAACC,CAAC,EAAE,OAAO,KAAK;EAC1B,OACID,CAAC,CAACL,GAAG,KAAKM,CAAC,CAACN,GAAG,IACfK,CAAC,CAACJ,MAAM,KAAKK,CAAC,CAACL,MAAM,IACrBI,CAAC,CAACH,IAAI,KAAKI,CAAC,CAACJ,IAAI,IACjBG,CAAC,CAACF,KAAK,KAAKG,CAAC,CAACH,KAAK;AAE3B","ignoreList":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BlendNativeProvider = BlendNativeProvider;
|
|
7
|
+
exports.DEFAULT_NATIVE_THEME = exports.BlendNativeThemeContext = void 0;
|
|
8
|
+
Object.defineProperty(exports, "SYSTEM_THEME", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _systemTheme.SYSTEM_THEME;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
exports.default = void 0;
|
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
+
var _reactNative = require("react-native");
|
|
17
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
18
|
+
var _portal = require("../overlay/portal.js");
|
|
19
|
+
var _ToastOutlet = require("../overlay/toast/ToastOutlet.js");
|
|
20
|
+
var _fonts = require("./fonts.js");
|
|
21
|
+
var _systemTheme = require("./systemTheme.js");
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
24
|
+
/**
|
|
25
|
+
* Theme context for `blend-native`.
|
|
26
|
+
*
|
|
27
|
+
* Replaces the per-component `theme` prop the package shipped with. A prop
|
|
28
|
+
* meant no app-wide dark mode (every call site had to thread it), no nested
|
|
29
|
+
* theme scopes, and — most importantly — no `componentTokens` overrides,
|
|
30
|
+
* which is a first-class feature of web Blend that native consumers simply
|
|
31
|
+
* did not have.
|
|
32
|
+
*
|
|
33
|
+
* Mirrors web's `ThemeProvider` API (`{ theme, componentTokens,
|
|
34
|
+
* foundationTokens }`) so the two platforms are configured the same way, and
|
|
35
|
+
* like web it is optional: components fall back to these defaults when no
|
|
36
|
+
* provider is mounted.
|
|
37
|
+
*
|
|
38
|
+
* Two native-only additions:
|
|
39
|
+
*
|
|
40
|
+
* - `theme="system"` follows the OS appearance via `useColorScheme`,
|
|
41
|
+
* re-rendering when the user flips light/dark. The sentinel is resolved
|
|
42
|
+
* *before* the value enters context, so consumers only ever see a concrete
|
|
43
|
+
* theme.
|
|
44
|
+
* - `fontFamily` resolves one font family per role (see `theme/fonts.ts`) —
|
|
45
|
+
* RN's replacement for web's CSS font inheritance.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
const EMPTY_OVERRIDES = {};
|
|
49
|
+
const DEFAULT_NATIVE_THEME = exports.DEFAULT_NATIVE_THEME = {
|
|
50
|
+
theme: _node.Theme.LIGHT,
|
|
51
|
+
componentTokens: EMPTY_OVERRIDES,
|
|
52
|
+
foundationTokens: _node.FOUNDATION_THEME,
|
|
53
|
+
breakpoints: _node.BREAKPOINTS,
|
|
54
|
+
fontFamily: (0, _fonts.resolveFontFamilies)(_node.FOUNDATION_THEME)
|
|
55
|
+
};
|
|
56
|
+
const BlendNativeThemeContext = exports.BlendNativeThemeContext = /*#__PURE__*/(0, _react.createContext)(DEFAULT_NATIVE_THEME);
|
|
57
|
+
function BlendNativeProvider({
|
|
58
|
+
children,
|
|
59
|
+
theme = _node.Theme.LIGHT,
|
|
60
|
+
componentTokens = EMPTY_OVERRIDES,
|
|
61
|
+
foundationTokens = _node.FOUNDATION_THEME,
|
|
62
|
+
breakpoints = _node.BREAKPOINTS,
|
|
63
|
+
fontFamily
|
|
64
|
+
}) {
|
|
65
|
+
// Subscribed unconditionally (hooks must be), but only `theme="system"`
|
|
66
|
+
// reads it — an explicit theme is unaffected by OS appearance changes.
|
|
67
|
+
const colorScheme = (0, _reactNative.useColorScheme)();
|
|
68
|
+
const resolvedTheme = (0, _systemTheme.resolveThemeSetting)(theme, colorScheme);
|
|
69
|
+
|
|
70
|
+
// Memoised on the same keys web's `initTokens` uses: objects by
|
|
71
|
+
// reference (they are module-scope singletons in practice), theme by
|
|
72
|
+
// value. Keeps the context value stable so a re-render of the provider's
|
|
73
|
+
// parent does not invalidate every consumer's token memo.
|
|
74
|
+
const value = (0, _react.useMemo)(() => ({
|
|
75
|
+
theme: resolvedTheme,
|
|
76
|
+
componentTokens,
|
|
77
|
+
foundationTokens,
|
|
78
|
+
breakpoints,
|
|
79
|
+
fontFamily: (0, _fonts.resolveFontFamilies)(foundationTokens, fontFamily)
|
|
80
|
+
}), [resolvedTheme, componentTokens, foundationTokens, breakpoints, fontFamily]);
|
|
81
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BlendNativeThemeContext.Provider, {
|
|
82
|
+
value: value,
|
|
83
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_portal.PortalArea, {
|
|
84
|
+
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToastOutlet.ToastOutlet, {})]
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
BlendNativeProvider.displayName = 'BlendNativeProvider';
|
|
89
|
+
var _default = exports.default = BlendNativeProvider;
|
|
90
|
+
//# sourceMappingURL=BlendNativeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_node","_portal","_ToastOutlet","_fonts","_systemTheme","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","EMPTY_OVERRIDES","DEFAULT_NATIVE_THEME","exports","theme","Theme","LIGHT","componentTokens","foundationTokens","FOUNDATION_THEME","breakpoints","BREAKPOINTS","fontFamily","resolveFontFamilies","BlendNativeThemeContext","createContext","BlendNativeProvider","children","colorScheme","useColorScheme","resolvedTheme","resolveThemeSetting","value","useMemo","jsx","Provider","jsxs","PortalArea","ToastOutlet","displayName","_default"],"sourceRoot":"../../../src","sources":["theme/BlendNativeProvider.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveBreakpoint = resolveBreakpoint;
|
|
7
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
8
|
+
/**
|
|
9
|
+
* Pure breakpoint resolution.
|
|
10
|
+
*
|
|
11
|
+
* Kept in its own leaf module — importing nothing from `react-native` — so it
|
|
12
|
+
* stays testable and reusable outside a React render. `useNativeBreakpoint`
|
|
13
|
+
* layers the `useWindowDimensions` subscription on top.
|
|
14
|
+
*
|
|
15
|
+
* (React Native's entrypoint ships Flow syntax that non-Metro bundlers cannot
|
|
16
|
+
* parse, so any module that value-imports it is unusable from a plain Node
|
|
17
|
+
* test runner. Splitting the logic out is the same pattern the web package
|
|
18
|
+
* uses for `shared/datetime/timeCore.ts`.)
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a viewport width to a Blend breakpoint label.
|
|
23
|
+
*
|
|
24
|
+
* Mirrors web's `useBreakPoints` exactly, including its quirk: **only**
|
|
25
|
+
* 320–1023 maps to `'sm'`; everything else — including widths below 320 —
|
|
26
|
+
* returns `'lg'`. Reproduced deliberately so a given width resolves to the
|
|
27
|
+
* same tokens on both platforms.
|
|
28
|
+
*
|
|
29
|
+
* Thresholds come from `BREAKPOINTS` in the web package rather than being
|
|
30
|
+
* duplicated, so retuning them stays a one-line change in one place.
|
|
31
|
+
*/
|
|
32
|
+
function resolveBreakpoint(width, breakpoints = _node.BREAKPOINTS) {
|
|
33
|
+
if (width >= breakpoints.sm && width < breakpoints.lg) return 'sm';
|
|
34
|
+
return 'lg';
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=breakpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_node","require","resolveBreakpoint","width","breakpoints","BREAKPOINTS","sm","lg"],"sourceRoot":"../../../src","sources":["theme/breakpoint.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,iBAAiBA,CAC7BC,KAAa,EACbC,WAA2B,GAAGC,iBAAW,EACzB;EAChB,IAAIF,KAAK,IAAIC,WAAW,CAACE,EAAE,IAAIH,KAAK,GAAGC,WAAW,CAACG,EAAE,EAAE,OAAO,IAAI;EAClE,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveFontFamilies = resolveFontFamilies;
|
|
7
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
8
|
+
/**
|
|
9
|
+
* Font-family policy.
|
|
10
|
+
*
|
|
11
|
+
* Web never applies Blend's font tokens — components inherit whatever face the
|
|
12
|
+
* host document loads (`fontFamily: 'inherit'` in the primitives), and the
|
|
13
|
+
* consuming app supplies InterDisplay via `@font-face`. React Native has no
|
|
14
|
+
* inheritance and no `@font-face`, so the provider is the inheritance
|
|
15
|
+
* mechanism: it resolves one family per role and `Text` applies it.
|
|
16
|
+
*
|
|
17
|
+
* Defaults come from the foundation tokens (`font.family`), so out of the box
|
|
18
|
+
* native asks for the same faces the design system names. A consumer that has
|
|
19
|
+
* not loaded those fonts sees the platform fallback (plus a dev warning on
|
|
20
|
+
* iOS) — load them with `expo-font` or native assets, or opt out:
|
|
21
|
+
*
|
|
22
|
+
* - `fontFamily="system"` — platform fonts everywhere, no families applied.
|
|
23
|
+
* - `fontFamily={{ mono: 'JetBrainsMono' }}` — override one role, keep the
|
|
24
|
+
* token defaults for the rest.
|
|
25
|
+
* - `fontFamily={{ body: null }}` — disable one role only.
|
|
26
|
+
*
|
|
27
|
+
* Kept as a leaf module with no `react-native` value import so it stays
|
|
28
|
+
* testable under plain vitest — the same constraint as `theme/breakpoint.ts`.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/** One resolved family per role; `null` means "leave the platform font". */
|
|
32
|
+
|
|
33
|
+
/** What `BlendNativeProvider` accepts for its `fontFamily` prop. */
|
|
34
|
+
|
|
35
|
+
const ROLES = ['display', 'body', 'heading', 'mono'];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the provider's `fontFamily` option against the active foundation
|
|
39
|
+
* tokens. Pure; called once per provider render.
|
|
40
|
+
*/
|
|
41
|
+
function resolveFontFamilies(foundationTokens = _node.FOUNDATION_THEME, option) {
|
|
42
|
+
const resolved = {};
|
|
43
|
+
for (const role of ROLES) {
|
|
44
|
+
if (option === 'system') {
|
|
45
|
+
resolved[role] = null;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const override = option?.[role];
|
|
49
|
+
if (override !== undefined) {
|
|
50
|
+
resolved[role] = override;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const token = foundationTokens.font?.family?.[role];
|
|
54
|
+
resolved[role] = token !== undefined ? String(token) : null;
|
|
55
|
+
}
|
|
56
|
+
return resolved;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_node","require","ROLES","resolveFontFamilies","foundationTokens","FOUNDATION_THEME","option","resolved","role","override","undefined","token","font","family","String"],"sourceRoot":"../../../src","sources":["theme/fonts.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;AAGA;;AAKA,MAAMC,KAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC;;AAEtE;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAC/BC,gBAAyC,GAAGC,sBAAgB,EAC5DC,MAA+B,EACb;EAClB,MAAMC,QAAQ,GAAG,CAAC,CAAuB;EAEzC,KAAK,MAAMC,IAAI,IAAIN,KAAK,EAAE;IACtB,IAAII,MAAM,KAAK,QAAQ,EAAE;MACrBC,QAAQ,CAACC,IAAI,CAAC,GAAG,IAAI;MACrB;IACJ;IACA,MAAMC,QAAQ,GAAGH,MAAM,GAAGE,IAAI,CAAC;IAC/B,IAAIC,QAAQ,KAAKC,SAAS,EAAE;MACxBH,QAAQ,CAACC,IAAI,CAAC,GAAGC,QAAQ;MACzB;IACJ;IACA,MAAME,KAAK,GAAGP,gBAAgB,CAACQ,IAAI,EAAEC,MAAM,GAAGL,IAAI,CAAC;IACnDD,QAAQ,CAACC,IAAI,CAAC,GAAGG,KAAK,KAAKD,SAAS,GAAGI,MAAM,CAACH,KAAK,CAAC,GAAG,IAAI;EAC/D;EAEA,OAAOJ,QAAQ;AACnB","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NATIVE_TOKEN_SLOTS = exports.NATIVE_TOKEN_REGISTRY = void 0;
|
|
7
|
+
exports.isNativeTokenSlot = isNativeTokenSlot;
|
|
8
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
9
|
+
/**
|
|
10
|
+
* Slot name → token factory.
|
|
11
|
+
*
|
|
12
|
+
* **This is the only file to edit when adding a component.** Web needs three
|
|
13
|
+
* files changed in lockstep for a new token slot (`context/ThemeContext.tsx`
|
|
14
|
+
* for the type + default, `context/initComponentTokens.ts` for the `??`
|
|
15
|
+
* fallback, `context/useComponentToken.ts` for the union and `switch` case) —
|
|
16
|
+
* and missing one throws at runtime. Native collapses that to a single
|
|
17
|
+
* registry entry, with the slot union derived from the object rather than
|
|
18
|
+
* hand-maintained alongside it.
|
|
19
|
+
*
|
|
20
|
+
* Factories come from `@juspay/blend-design-system/node`, the React-free
|
|
21
|
+
* entry, so registering one pulls in no UI code.
|
|
22
|
+
*/
|
|
23
|
+
const NATIVE_TOKEN_REGISTRY = exports.NATIVE_TOKEN_REGISTRY = {
|
|
24
|
+
ALERTV2: _node.getAlertV2Tokens,
|
|
25
|
+
BUTTONV2: _node.getButtonV2Tokens,
|
|
26
|
+
SKELETON: _node.getSkeletonTokens,
|
|
27
|
+
TAGV2: _node.getTagV2Tokens,
|
|
28
|
+
TEXT_INPUTV2: _node.getTextInputV2Tokens
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Every component slot native can resolve. Derived, never hand-written. */
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A Blend token factory: pure, takes foundation tokens plus a theme, and
|
|
35
|
+
* returns one token object per breakpoint.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/** Overrides accepted by `BlendNativeProvider`, keyed by slot. */
|
|
39
|
+
|
|
40
|
+
const NATIVE_TOKEN_SLOTS = exports.NATIVE_TOKEN_SLOTS = Object.keys(NATIVE_TOKEN_REGISTRY);
|
|
41
|
+
function isNativeTokenSlot(value) {
|
|
42
|
+
return Object.prototype.hasOwnProperty.call(NATIVE_TOKEN_REGISTRY, value);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=nativeTokenRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_node","require","NATIVE_TOKEN_REGISTRY","exports","ALERTV2","getAlertV2Tokens","BUTTONV2","getButtonV2Tokens","SKELETON","getSkeletonTokens","TAGV2","getTagV2Tokens","TEXT_INPUTV2","getTextInputV2Tokens","NATIVE_TOKEN_SLOTS","Object","keys","isNativeTokenSlot","value","prototype","hasOwnProperty","call"],"sourceRoot":"../../../src","sources":["theme/nativeTokenRegistry.ts"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EACjCE,OAAO,EAAEC,sBAAgB;EACzBC,QAAQ,EAAEC,uBAAiB;EAC3BC,QAAQ,EAAEC,uBAAiB;EAC3BC,KAAK,EAAEC,oBAAc;EACrBC,YAAY,EAAEC;AAClB,CAAU;;AAEV;;AAGA;AACA;AACA;AACA;;AAMA;;AAKO,MAAMC,kBAAkB,GAAAX,OAAA,CAAAW,kBAAA,GAAGC,MAAM,CAACC,IAAI,CACzCd,qBACJ,CAAsB;AAEf,SAASe,iBAAiBA,CAACC,KAAa,EAA4B;EACvE,OAAOH,MAAM,CAACI,SAAS,CAACC,cAAc,CAACC,IAAI,CAACnB,qBAAqB,EAAEgB,KAAK,CAAC;AAC7E","ignoreList":[]}
|