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,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SYSTEM_THEME = void 0;
|
|
7
|
+
exports.resolveThemeSetting = resolveThemeSetting;
|
|
8
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
9
|
+
/**
|
|
10
|
+
* `theme="system"` resolution.
|
|
11
|
+
*
|
|
12
|
+
* The provider accepts the sentinel and resolves it against the OS appearance
|
|
13
|
+
* (`useColorScheme`) before the value enters context, so token resolution and
|
|
14
|
+
* every consumer below only ever see a concrete theme.
|
|
15
|
+
*
|
|
16
|
+
* Kept as a leaf module with no `react-native` value import so the mapping is
|
|
17
|
+
* testable under plain vitest; the provider owns the `useColorScheme`
|
|
18
|
+
* subscription.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Pass as `theme` to follow the OS light/dark setting. */
|
|
22
|
+
const SYSTEM_THEME = exports.SYSTEM_THEME = 'system';
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a theme setting to a concrete theme.
|
|
25
|
+
*
|
|
26
|
+
* `colorScheme` is `useColorScheme()`'s value. Typed as `string` rather than
|
|
27
|
+
* a literal union because RN's `ColorSchemeName` has grown values across
|
|
28
|
+
* versions (`'unspecified'` on some platforms) — anything that is not
|
|
29
|
+
* `'dark'` resolves light, matching the provider's default.
|
|
30
|
+
*/
|
|
31
|
+
function resolveThemeSetting(theme, colorScheme) {
|
|
32
|
+
if (theme !== SYSTEM_THEME) return theme;
|
|
33
|
+
return colorScheme === 'dark' ? _node.Theme.DARK : _node.Theme.LIGHT;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=systemTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_node","require","SYSTEM_THEME","exports","resolveThemeSetting","theme","colorScheme","Theme","DARK","LIGHT"],"sourceRoot":"../../../src","sources":["theme/systemTheme.ts"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,QAAiB;AAI7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAC/BC,KAAyB,EACzBC,WAAsC,EACxB;EACd,IAAID,KAAK,KAAKH,YAAY,EAAE,OAAOG,KAAK;EACxC,OAAOC,WAAW,KAAK,MAAM,GAAGC,WAAK,CAACC,IAAI,GAAGD,WAAK,CAACE,KAAK;AAC5D","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "resolveBreakpoint", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _breakpoint.resolveBreakpoint;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.useNativeBreakpoint = useNativeBreakpoint;
|
|
13
|
+
var _reactNative = require("react-native");
|
|
14
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
15
|
+
var _breakpoint = require("./breakpoint.js");
|
|
16
|
+
/**
|
|
17
|
+
* The active breakpoint for the current RN viewport.
|
|
18
|
+
*
|
|
19
|
+
* `useWindowDimensions` is RN's equivalent of web's resize listener — it
|
|
20
|
+
* re-renders on rotation, split-screen, and foldable unfold. The previous
|
|
21
|
+
* implementation hardcoded `'sm'` on the assumption that native is
|
|
22
|
+
* phone-only, which silently gave tablets and landscape the wrong tokens.
|
|
23
|
+
*
|
|
24
|
+
* The width→label mapping itself lives in `./breakpoint`, which imports
|
|
25
|
+
* nothing from `react-native` and is therefore unit-testable.
|
|
26
|
+
*/
|
|
27
|
+
function useNativeBreakpoint(breakpoints = _node.BREAKPOINTS) {
|
|
28
|
+
const {
|
|
29
|
+
width
|
|
30
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
31
|
+
return (0, _breakpoint.resolveBreakpoint)(width, breakpoints);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=useNativeBreakpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_node","_breakpoint","useNativeBreakpoint","breakpoints","BREAKPOINTS","width","useWindowDimensions","resolveBreakpoint"],"sourceRoot":"../../../src","sources":["theme/useNativeBreakpoint.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAF,OAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,mBAAmBA,CAC/BC,WAA2B,GAAGC,iBAAW,EACzB;EAChB,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EACvC,OAAO,IAAAC,6BAAiB,EAACF,KAAK,EAAEF,WAAW,CAAC;AAChD","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.useNativeTokens = useNativeTokens;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
10
|
+
var _BlendNativeProvider = require("./BlendNativeProvider.js");
|
|
11
|
+
var _nativeTokenRegistry = require("./nativeTokenRegistry.js");
|
|
12
|
+
var _useNativeBreakpoint = require("./useNativeBreakpoint.js");
|
|
13
|
+
/**
|
|
14
|
+
* Resolve one component's tokens, flattened for the active breakpoint and
|
|
15
|
+
* with any provider overrides deep-merged in.
|
|
16
|
+
*
|
|
17
|
+
* The native counterpart of web's `useResponsiveTokens('BUTTONV2')`, and
|
|
18
|
+
* deliberately the same call shape so component code reads the same on both
|
|
19
|
+
* platforms.
|
|
20
|
+
*
|
|
21
|
+
* Note `mergeTokenTree` is imported from the web package rather than
|
|
22
|
+
* reimplemented — override semantics (plain objects merge key-by-key,
|
|
23
|
+
* everything else replaces, `undefined` is skipped) must not drift between
|
|
24
|
+
* web and native.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Resolution cache, keyed the way web's `initTokens` keys its own. */
|
|
28
|
+
const resolutionCache = new WeakMap();
|
|
29
|
+
function resolveResponsive(slot, foundationTokens, theme, overrides) {
|
|
30
|
+
let byKey = resolutionCache.get(foundationTokens);
|
|
31
|
+
if (!byKey) {
|
|
32
|
+
byKey = new Map();
|
|
33
|
+
resolutionCache.set(foundationTokens, byKey);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Overrides participate in the key by identity — they are expected to be
|
|
37
|
+
// a stable object from the consumer, exactly as on web.
|
|
38
|
+
const hasOverride = overrides !== undefined;
|
|
39
|
+
const cacheKey = `${slot}::${String(theme)}::${hasOverride ? 'o' : '-'}`;
|
|
40
|
+
if (!hasOverride) {
|
|
41
|
+
const cached = byKey.get(cacheKey);
|
|
42
|
+
if (cached) return cached;
|
|
43
|
+
}
|
|
44
|
+
const factory = _nativeTokenRegistry.NATIVE_TOKEN_REGISTRY[slot];
|
|
45
|
+
const responsive = factory(foundationTokens, theme);
|
|
46
|
+
const resolved = hasOverride ? (0, _node.mergeTokenTree)(responsive, overrides) : responsive;
|
|
47
|
+
if (!hasOverride) byKey.set(cacheKey, resolved);
|
|
48
|
+
return resolved;
|
|
49
|
+
}
|
|
50
|
+
function useNativeTokens(slot) {
|
|
51
|
+
const {
|
|
52
|
+
theme,
|
|
53
|
+
componentTokens,
|
|
54
|
+
foundationTokens,
|
|
55
|
+
breakpoints
|
|
56
|
+
} = (0, _react.useContext)(_BlendNativeProvider.BlendNativeThemeContext);
|
|
57
|
+
// The provider's `breakpoints` must reach the resolver — calling
|
|
58
|
+
// `useNativeBreakpoint()` bare silently ignores a consumer's override
|
|
59
|
+
// and resolves against the defaults.
|
|
60
|
+
const breakpoint = (0, _useNativeBreakpoint.useNativeBreakpoint)(breakpoints);
|
|
61
|
+
if (!(0, _nativeTokenRegistry.isNativeTokenSlot)(slot)) {
|
|
62
|
+
throw new Error(`[blend-native] Unknown component token slot "${slot}". ` + `Known slots: ${_nativeTokenRegistry.NATIVE_TOKEN_SLOTS.join(', ')}. ` + `Register new components in src/theme/nativeTokenRegistry.ts.`);
|
|
63
|
+
}
|
|
64
|
+
const overrides = componentTokens?.[slot];
|
|
65
|
+
return (0, _react.useMemo)(() => {
|
|
66
|
+
const responsive = resolveResponsive(slot, foundationTokens, theme, overrides);
|
|
67
|
+
return responsive[breakpoint];
|
|
68
|
+
}, [slot, foundationTokens, theme, overrides, breakpoint]);
|
|
69
|
+
}
|
|
70
|
+
var _default = exports.default = useNativeTokens;
|
|
71
|
+
//# sourceMappingURL=useNativeTokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_node","_BlendNativeProvider","_nativeTokenRegistry","_useNativeBreakpoint","resolutionCache","WeakMap","resolveResponsive","slot","foundationTokens","theme","overrides","byKey","get","Map","set","hasOverride","undefined","cacheKey","String","cached","factory","NATIVE_TOKEN_REGISTRY","responsive","resolved","mergeTokenTree","useNativeTokens","componentTokens","breakpoints","useContext","BlendNativeThemeContext","breakpoint","useNativeBreakpoint","isNativeTokenSlot","Error","NATIVE_TOKEN_SLOTS","join","useMemo","_default","exports","default"],"sourceRoot":"../../../src","sources":["theme/useNativeTokens.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAMA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AAOA,IAAAI,oBAAA,GAAAJ,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMK,eAAe,GAAG,IAAIC,OAAO,CAGjC,CAAC;AAEH,SAASC,iBAAiBA,CACtBC,IAAqB,EACrBC,gBAAyC,EACzCC,KAAqB,EACrBC,SAAkB,EACmB;EACrC,IAAIC,KAAK,GAAGP,eAAe,CAACQ,GAAG,CAACJ,gBAAgB,CAAC;EACjD,IAAI,CAACG,KAAK,EAAE;IACRA,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C;EAEzC,OAAO,IAAA6B,cAAO,EAAC,MAAM;IACjB,MAAMd,UAAU,GAAGhB,iBAAiB,CAChCC,IAAI,EACJC,gBAAgB,EAChBC,KAAK,EACLC,SACJ,CAAC;IACD,OAAOY,UAAU,CAACQ,UAAU,CAAC;EACjC,CAAC,EAAE,CAACvB,IAAI,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,SAAS,EAAEoB,UAAU,CAAC,CAAC;AAC9D;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Live-region message construction.
|
|
5
|
+
*
|
|
6
|
+
* Kept RN-free so it stays unit-testable outside a renderer — the same split
|
|
7
|
+
* as `theme/breakpoint.ts` and `primitives/touchTarget.ts`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Compose the sentence a screen reader should announce for a status surface.
|
|
12
|
+
*
|
|
13
|
+
* Web relies on `aria-atomic="true"` to have the whole region re-read when any
|
|
14
|
+
* part changes, so the announcement is heading and description together. iOS
|
|
15
|
+
* has no live-region concept at all and must be told the exact string, so it
|
|
16
|
+
* is built here rather than left to the platform.
|
|
17
|
+
*
|
|
18
|
+
* Returns `undefined` when there is nothing worth announcing, so callers can
|
|
19
|
+
* skip the announcement entirely instead of interrupting the user with silence.
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* buildAnnouncement('Saved', 'Your changes are live') -> 'Saved. Your changes are live'
|
|
23
|
+
* buildAnnouncement('Saved', undefined) -> 'Saved'
|
|
24
|
+
* buildAnnouncement(undefined, 'Your changes are live')-> 'Your changes are live'
|
|
25
|
+
* buildAnnouncement(undefined, undefined) -> undefined
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function buildAnnouncement(heading, description) {
|
|
29
|
+
const parts = [heading, description].map(part => part?.trim()).filter(part => Boolean(part));
|
|
30
|
+
if (parts.length === 0) return undefined;
|
|
31
|
+
if (parts.length === 1) return parts[0];
|
|
32
|
+
|
|
33
|
+
// Punctuate between the two so the reader pauses rather than running the
|
|
34
|
+
// heading into the description as one sentence.
|
|
35
|
+
const [head, rest] = parts;
|
|
36
|
+
return /[.!?:]$/.test(head) ? `${head} ${rest}` : `${head}. ${rest}`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=announcement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["buildAnnouncement","heading","description","parts","map","part","trim","filter","Boolean","length","undefined","head","rest","test"],"sourceRoot":"../../../src","sources":["a11y/announcement.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,iBAAiBA,CAC7BC,OAAgB,EAChBC,WAAoB,EACF;EAClB,MAAMC,KAAK,GAAG,CAACF,OAAO,EAAEC,WAAW,CAAC,CAC/BE,GAAG,CAAEC,IAAI,IAAKA,IAAI,EAAEC,IAAI,CAAC,CAAC,CAAC,CAC3BC,MAAM,CAAEF,IAAI,IAAqBG,OAAO,CAACH,IAAI,CAAC,CAAC;EAEpD,IAAIF,KAAK,CAACM,MAAM,KAAK,CAAC,EAAE,OAAOC,SAAS;EACxC,IAAIP,KAAK,CAACM,MAAM,KAAK,CAAC,EAAE,OAAON,KAAK,CAAC,CAAC,CAAC;;EAEvC;EACA;EACA,MAAM,CAACQ,IAAI,EAAEC,IAAI,CAAC,GAAGT,KAAK;EAC1B,OAAO,SAAS,CAACU,IAAI,CAACF,IAAI,CAAC,GAAG,GAAGA,IAAI,IAAIC,IAAI,EAAE,GAAG,GAAGD,IAAI,KAAKC,IAAI,EAAE;AACxE","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { AccessibilityInfo, Platform } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Announce a status message to assistive tech.
|
|
8
|
+
*
|
|
9
|
+
* Web expresses this declaratively with `aria-live` + `aria-atomic`. React
|
|
10
|
+
* Native splits it across platforms:
|
|
11
|
+
*
|
|
12
|
+
* - **Android** understands `accessibilityLiveRegion` on the view itself, so
|
|
13
|
+
* callers set that prop directly and this hook stays out of the way.
|
|
14
|
+
* - **iOS** has no live-region support. The only route is to hand the exact
|
|
15
|
+
* string to `announceForAccessibility`, which is what this does.
|
|
16
|
+
*
|
|
17
|
+
* Re-announces when the message changes, and skips repeats of the same string
|
|
18
|
+
* so a parent re-render does not interrupt the user twice with the same text.
|
|
19
|
+
*/
|
|
20
|
+
export function useLiveRegionAnnounce(message, enabled = true) {
|
|
21
|
+
const lastAnnounced = useRef(undefined);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!enabled || !message) return;
|
|
24
|
+
// Android already announces via accessibilityLiveRegion; announcing
|
|
25
|
+
// again here would read the alert twice.
|
|
26
|
+
if (Platform.OS !== 'ios') return;
|
|
27
|
+
if (lastAnnounced.current === message) return;
|
|
28
|
+
lastAnnounced.current = message;
|
|
29
|
+
AccessibilityInfo.announceForAccessibility(message);
|
|
30
|
+
}, [message, enabled]);
|
|
31
|
+
}
|
|
32
|
+
export default useLiveRegionAnnounce;
|
|
33
|
+
//# sourceMappingURL=useLiveRegion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","AccessibilityInfo","Platform","useLiveRegionAnnounce","message","enabled","lastAnnounced","undefined","OS","current","announceForAccessibility"],"sourceRoot":"../../../src","sources":["a11y/useLiveRegion.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,cAAc;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CACjCC,OAA2B,EAC3BC,OAAO,GAAG,IAAI,EACV;EACJ,MAAMC,aAAa,GAAGN,MAAM,CAAqBO,SAAS,CAAC;EAE3DR,SAAS,CAAC,MAAM;IACZ,IAAI,CAACM,OAAO,IAAI,CAACD,OAAO,EAAE;IAC1B;IACA;IACA,IAAIF,QAAQ,CAACM,EAAE,KAAK,KAAK,EAAE;IAC3B,IAAIF,aAAa,CAACG,OAAO,KAAKL,OAAO,EAAE;IAEvCE,aAAa,CAACG,OAAO,GAAGL,OAAO;IAC/BH,iBAAiB,CAACS,wBAAwB,CAACN,OAAO,CAAC;EACvD,CAAC,EAAE,CAACA,OAAO,EAAEC,OAAO,CAAC,CAAC;AAC1B;AAEA,eAAeF,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CSS-string token adapter for React Native.
|
|
5
|
+
*
|
|
6
|
+
* Blend's token factories emit CSS string values (`"6px"`,
|
|
7
|
+
* `"1px solid #E1E4EA"`, `"linear-gradient(180deg, #1A56DB -5%, #2563EB 107.5%)"`).
|
|
8
|
+
* RN's stylesheet engine accepts only numbers or platform-specific style
|
|
9
|
+
* objects, so every token value that touches layout/decoration must be
|
|
10
|
+
* translated here.
|
|
11
|
+
*
|
|
12
|
+
* Every function is pure and defensive: unparseable input returns a safe
|
|
13
|
+
* fallback (usually `undefined`) rather than throwing, so a single bad token
|
|
14
|
+
* never crashes the whole button.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A decimal number, in a form the regex engine cannot backtrack over.
|
|
19
|
+
*
|
|
20
|
+
* The obvious spellings — `\d*\.?\d+` and `\d+\.?\d*` — are **ambiguous**:
|
|
21
|
+
* with no `.` present, a run of digits can be divided between the two
|
|
22
|
+
* quantifiers in as many ways as there are digits, so a long non-matching
|
|
23
|
+
* input costs O(n^2). CodeQL flags both as `js/polynomial-redos`, correctly.
|
|
24
|
+
*
|
|
25
|
+
* Here the `.` inside the optional group is mandatory, so each digit run has
|
|
26
|
+
* exactly one valid division and matching stays linear.
|
|
27
|
+
*/
|
|
28
|
+
const NUMBER = String.raw`-?(?:\d+(?:\.\d+)?|\.\d+)`;
|
|
29
|
+
|
|
30
|
+
/** `"6px"`, `"1.5px"`, `"0"` — a length, with the unit optional. */
|
|
31
|
+
const DIMENSION_RE = new RegExp(`^(${NUMBER})(?:px)?$`);
|
|
32
|
+
|
|
33
|
+
/** `"50%"`, `"33.5%"`, `"-5%"` — a percentage. */
|
|
34
|
+
const PERCENT_RE = new RegExp(`^(${NUMBER})%$`);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Result of parsing a background token.
|
|
38
|
+
*
|
|
39
|
+
* - `flat` — solid color, apply via `backgroundColor`.
|
|
40
|
+
* - `gradient` — linear gradient, requires a `<LinearGradient>` wrapper.
|
|
41
|
+
* - `null` — `none` / transparent / unparseable; no background.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Parse a CSS dimension string (`"6px"`, `"1.5px"`, `"0"`) into a number.
|
|
46
|
+
* Returns `undefined` for non-numeric input.
|
|
47
|
+
*
|
|
48
|
+
* `parseDimension("6px") → 6`
|
|
49
|
+
* `parseDimension("1.5px") → 1.5`
|
|
50
|
+
* `parseDimension("0") → 0`
|
|
51
|
+
*/
|
|
52
|
+
export function parseDimension(value) {
|
|
53
|
+
if (value === undefined || value === null) return undefined;
|
|
54
|
+
if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
|
|
55
|
+
const match = value.trim().match(DIMENSION_RE);
|
|
56
|
+
if (!match) return undefined;
|
|
57
|
+
const n = parseFloat(match[1]);
|
|
58
|
+
return Number.isNaN(n) ? undefined : n;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* RN's type for anything that accepts a length or a percentage
|
|
63
|
+
* (`width`, `maxHeight`, `flexBasis`, ...).
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Parse a CSS size value — `width`, `height`, `maxHeight`, `minWidth`, ... —
|
|
68
|
+
* into something RN's stylesheet actually understands.
|
|
69
|
+
*
|
|
70
|
+
* This is deliberately strict. `parseFloat` is NOT a safe fallback here: it
|
|
71
|
+
* turns `"100%"` into `100`, which RN renders as **100 pixels** rather than
|
|
72
|
+
* full width, and it silently accepts `"12abc"` (→ `12`) and `"50em"` (→ `50`).
|
|
73
|
+
* Anything not explicitly understood returns `undefined` so the caller skips
|
|
74
|
+
* the prop instead of laying out a wrong value.
|
|
75
|
+
*
|
|
76
|
+
* ```
|
|
77
|
+
* parseSize(24) → 24
|
|
78
|
+
* parseSize('24px') → 24
|
|
79
|
+
* parseSize('50%') → '50%'
|
|
80
|
+
* parseSize('100%') → '100%'
|
|
81
|
+
* parseSize('auto') → 'auto'
|
|
82
|
+
* parseSize('fit-content') → 'auto' // RN's nearest equivalent
|
|
83
|
+
* parseSize('min-content') → undefined
|
|
84
|
+
* parseSize('calc(1+2)') → undefined
|
|
85
|
+
* parseSize('50em') → undefined
|
|
86
|
+
* parseSize('12abc') → undefined
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export function parseSize(value) {
|
|
90
|
+
if (value === undefined || value === null) return undefined;
|
|
91
|
+
if (typeof value === 'number') {
|
|
92
|
+
return Number.isFinite(value) ? value : undefined;
|
|
93
|
+
}
|
|
94
|
+
const trimmed = value.trim();
|
|
95
|
+
if (trimmed === '') return undefined;
|
|
96
|
+
|
|
97
|
+
// `fit-content` has no RN equivalent; `auto` is the closest behaviour
|
|
98
|
+
// (shrink-to-fit within the parent's constraints).
|
|
99
|
+
if (trimmed === 'auto' || trimmed === 'fit-content') return 'auto';
|
|
100
|
+
|
|
101
|
+
// Percentages. See `NUMBER` — linear, so a long adversarial input cannot
|
|
102
|
+
// degrade this.
|
|
103
|
+
const pct = trimmed.match(PERCENT_RE);
|
|
104
|
+
if (pct) {
|
|
105
|
+
const n = parseFloat(pct[1]);
|
|
106
|
+
return Number.isNaN(n) ? undefined : `${n}%`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Bare numbers and `px` lengths.
|
|
110
|
+
return parseDimension(trimmed);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Parse a CSS time value (`"1.5s"`, `"200ms"`, `1500`) into milliseconds.
|
|
115
|
+
* Returns `undefined` for unparseable input so callers fall back to their
|
|
116
|
+
* own default duration.
|
|
117
|
+
*
|
|
118
|
+
* `parseDuration('1.5s') → 1500`
|
|
119
|
+
* `parseDuration('200ms') → 200`
|
|
120
|
+
*/
|
|
121
|
+
export function parseDuration(value) {
|
|
122
|
+
if (value === undefined || value === null) return undefined;
|
|
123
|
+
if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
|
|
124
|
+
const match = value.trim().match(new RegExp(`^(${NUMBER})(ms|s)$`));
|
|
125
|
+
if (!match) return undefined;
|
|
126
|
+
const n = parseFloat(match[1]);
|
|
127
|
+
if (Number.isNaN(n)) return undefined;
|
|
128
|
+
return match[2] === 's' ? n * 1000 : n;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Parse a CSS `border` shorthand (`"1px solid #E1E4EA"`) into RN border props.
|
|
133
|
+
* Returns `{ borderWidth, borderColor }` — the only two border properties RN
|
|
134
|
+
* supports uniformly across iOS/Android.
|
|
135
|
+
*
|
|
136
|
+
* `parseBorder("1.5px solid #1A56DB") → { borderWidth: 1.5, borderColor: "#1A56DB" }`
|
|
137
|
+
* `parseBorder("none") → {}`
|
|
138
|
+
*/
|
|
139
|
+
export function parseBorder(value) {
|
|
140
|
+
if (!value || value === 'none' || value === 'transparent') {
|
|
141
|
+
return {};
|
|
142
|
+
}
|
|
143
|
+
// Match: <width> <style> <color>
|
|
144
|
+
// width: "1px" / "1.5px"
|
|
145
|
+
// style: "solid" / "dashed" / "dotted" (RN only renders solid reliably)
|
|
146
|
+
// color: hex / rgb / rgba / named
|
|
147
|
+
const match = value.trim().match(/^(\d*\.?\d+)px\s+(?:solid|dashed|dotted)\s+(.+)$/);
|
|
148
|
+
if (!match) return {};
|
|
149
|
+
const width = parseFloat(match[1]);
|
|
150
|
+
const color = match[2].trim();
|
|
151
|
+
if (Number.isNaN(width) || !color) return {};
|
|
152
|
+
return {
|
|
153
|
+
borderWidth: width,
|
|
154
|
+
borderColor: color
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Parse a CSS `border-radius` value into a number or corner-tuple for RN.
|
|
160
|
+
*
|
|
161
|
+
* Single value: `"10px" → 10`
|
|
162
|
+
* Four values (per CSS order TL TR BR BL): `"10px 0 0 10px" → { topLeft: 10, topRight: 0, bottomRight: 0, bottomLeft: 10 }`
|
|
163
|
+
*
|
|
164
|
+
* Returns `undefined` for unparseable input so callers can skip the prop.
|
|
165
|
+
*/
|
|
166
|
+
export function parseBorderRadius(value) {
|
|
167
|
+
if (value === undefined || value === null) return undefined;
|
|
168
|
+
if (typeof value === 'number') return value;
|
|
169
|
+
const trimmed = value.trim();
|
|
170
|
+
if (trimmed === '' || trimmed === 'none') return undefined;
|
|
171
|
+
const parts = trimmed.split(/\s+/).map(p => parseFloat(p));
|
|
172
|
+
if (parts.some(p => Number.isNaN(p))) return undefined;
|
|
173
|
+
if (parts.length === 1) return parts[0];
|
|
174
|
+
if (parts.length === 4) {
|
|
175
|
+
// CSS order: top-left, top-right, bottom-right, bottom-left
|
|
176
|
+
return {
|
|
177
|
+
borderTopLeftRadius: parts[0],
|
|
178
|
+
borderTopRightRadius: parts[1],
|
|
179
|
+
borderBottomRightRadius: parts[2],
|
|
180
|
+
borderBottomLeftRadius: parts[3]
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
// 2 or 3 value shorthands are rare in tokens; fall back to single.
|
|
184
|
+
return parts[0];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Parse one or more CSS `box-shadow` declarations into RN shadow/elevation props.
|
|
189
|
+
*
|
|
190
|
+
* RN does NOT support `inset` shadows — any `inset` declaration returns `null`
|
|
191
|
+
* (the caller should treat that as "no shadow"). Multiple comma-separated
|
|
192
|
+
* shadows are collapsed into the first non-inset shadow, because RN's shadow
|
|
193
|
+
* API models a single shadow.
|
|
194
|
+
*
|
|
195
|
+
* Focus-ring shadows (`"0 0 0 3px #EFF6FF"`) are parsed normally and become
|
|
196
|
+
* outer shadows — visually acceptable on native.
|
|
197
|
+
*
|
|
198
|
+
* Returns a `ViewStyle` subset: `shadowColor`, `shadowOffset`, `shadowOpacity`,
|
|
199
|
+
* `shadowRadius` (iOS) + `elevation` (Android).
|
|
200
|
+
*/
|
|
201
|
+
export function parseBoxShadow(value) {
|
|
202
|
+
if (!value || value === 'none') return null;
|
|
203
|
+
|
|
204
|
+
// Split on commas that separate multiple shadow declarations — but NOT
|
|
205
|
+
// commas inside rgba()/rgb() parens, which are part of a color, not
|
|
206
|
+
// separators. `(?![^(]*\))` = skip commas inside parens.
|
|
207
|
+
const shadows = value.split(/,(?![^(]*\))/).map(s => s.trim()).filter(Boolean);
|
|
208
|
+
|
|
209
|
+
// Find the first non-inset shadow — RN cannot render inset shadows at all.
|
|
210
|
+
const outer = shadows.find(s => !/\binset\b/i.test(s));
|
|
211
|
+
if (!outer) return null;
|
|
212
|
+
|
|
213
|
+
// Extract the color first, then parse numbers from the remainder.
|
|
214
|
+
// This avoids picking up digits from inside rgba(...) as offsets.
|
|
215
|
+
const colorMatch = outer.match(/#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)/i);
|
|
216
|
+
const numericPart = outer.replace(/#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)/gi, ' ').replace(/\binset\b/gi, ' ');
|
|
217
|
+
const nums = numericPart.match(/-?\d*\.?\d+/g)?.map(t => parseFloat(t)) ?? [];
|
|
218
|
+
const [offsetX = 0, offsetY = 0, blur = 0, spread = 0] = nums;
|
|
219
|
+
|
|
220
|
+
// RN's shadowRadius is the blur radius, not the spread.
|
|
221
|
+
// Elevation approximates the combined shadow depth on Android.
|
|
222
|
+
const shadowColor = colorMatch?.[0] ?? '#000000';
|
|
223
|
+
|
|
224
|
+
// If shadowColor is rgba(), extract the rgb for shadowColor and keep the
|
|
225
|
+
// alpha separately for shadowOpacity (iOS multiplies them).
|
|
226
|
+
let resolvedColor = shadowColor;
|
|
227
|
+
let resolvedOpacity = 1;
|
|
228
|
+
const rgbaMatch = shadowColor.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/i);
|
|
229
|
+
if (rgbaMatch) {
|
|
230
|
+
const [, r, g, b, a] = rgbaMatch;
|
|
231
|
+
resolvedColor = `rgb(${r}, ${g}, ${b})`;
|
|
232
|
+
resolvedOpacity = a ? parseFloat(a) : 1;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Elevation: a rough heuristic — use blur + |offsetY| as the depth cue.
|
|
236
|
+
// Spread on focus rings (e.g. `0 0 0 3px`) should still produce visible
|
|
237
|
+
// elevation, so include it.
|
|
238
|
+
const elevation = Math.max(blur, spread, Math.abs(offsetY));
|
|
239
|
+
return {
|
|
240
|
+
shadowColor: resolvedColor,
|
|
241
|
+
shadowOffset: {
|
|
242
|
+
width: offsetX,
|
|
243
|
+
height: offsetY
|
|
244
|
+
},
|
|
245
|
+
shadowOpacity: resolvedOpacity,
|
|
246
|
+
shadowRadius: blur + spread,
|
|
247
|
+
elevation
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Parse a CSS `background` value into a `ParsedBackground`.
|
|
253
|
+
*
|
|
254
|
+
* - `"linear-gradient(180deg, #1A56DB -5%, #2563EB 107.5%)"` → gradient descriptor
|
|
255
|
+
* (percentage midpoints outside [0,1] are clamped — known limitation)
|
|
256
|
+
* - `"#FFFFFF"` / `"rgb(255,255,255)"` → flat color
|
|
257
|
+
* - `"none"` / `"transparent"` → null
|
|
258
|
+
*/
|
|
259
|
+
export function parseBackground(value) {
|
|
260
|
+
if (!value || value === 'none' || value === 'transparent') return null;
|
|
261
|
+
|
|
262
|
+
// Gradient?
|
|
263
|
+
const gradientMatch = value.match(/linear-gradient\(\s*(\d+)deg\s*,\s*(.+)\s*\)/i);
|
|
264
|
+
if (gradientMatch) {
|
|
265
|
+
const angle = parseFloat(gradientMatch[1]);
|
|
266
|
+
const stopsStr = gradientMatch[2];
|
|
267
|
+
|
|
268
|
+
// Parse color stops: "<color> <position>?" separated by commas.
|
|
269
|
+
// Blend gradient tokens use hex colors (no embedded commas), so a
|
|
270
|
+
// simple split on "," is safe. Each stop is trimmed, then split on
|
|
271
|
+
// whitespace to separate color from its optional percentage position.
|
|
272
|
+
// Positions may be outside [0,1] (e.g. "-5%", "107.5%") — clamped.
|
|
273
|
+
const stopStrs = stopsStr.split(',').map(s => s.trim()).filter(Boolean);
|
|
274
|
+
const colors = [];
|
|
275
|
+
const locations = [];
|
|
276
|
+
for (const stop of stopStrs) {
|
|
277
|
+
// "color" or "color position%"
|
|
278
|
+
const parts = stop.split(/\s+/);
|
|
279
|
+
colors.push(parts[0]);
|
|
280
|
+
if (parts[1]) {
|
|
281
|
+
const pct = parseFloat(parts[1]) / 100;
|
|
282
|
+
locations.push(Math.min(1, Math.max(0, pct)));
|
|
283
|
+
} else {
|
|
284
|
+
locations.push(0);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (colors.length < 2) {
|
|
288
|
+
// Degenerate gradient — treat as flat color.
|
|
289
|
+
return colors[0] ? {
|
|
290
|
+
type: 'flat',
|
|
291
|
+
color: colors[0]
|
|
292
|
+
} : null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// If locations weren't specified, distribute evenly.
|
|
296
|
+
const allZero = locations.every(l => l === 0);
|
|
297
|
+
let resolvedLocations = locations;
|
|
298
|
+
if (allZero) {
|
|
299
|
+
resolvedLocations = colors.map((_, i) => i / (colors.length - 1));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Convert CSS angle (0deg = bottom→top) to RN {start, end} coords.
|
|
303
|
+
// RN's LinearGradient uses normalized [0,1] coordinates on the bounding box.
|
|
304
|
+
// 0deg → start={x:0.5,y:1} end={x:0.5,y:0}
|
|
305
|
+
// 90deg → start={x:0,y:0.5} end={x:1,y:0.5}
|
|
306
|
+
// 180deg → start={x:0.5,y:0} end={x:0.5,y:1}
|
|
307
|
+
const rad = angle * Math.PI / 180;
|
|
308
|
+
const start = {
|
|
309
|
+
x: 0.5 - Math.sin(rad) * 0.5,
|
|
310
|
+
y: 0.5 + Math.cos(rad) * 0.5
|
|
311
|
+
};
|
|
312
|
+
const end = {
|
|
313
|
+
x: 0.5 + Math.sin(rad) * 0.5,
|
|
314
|
+
y: 0.5 - Math.cos(rad) * 0.5
|
|
315
|
+
};
|
|
316
|
+
return {
|
|
317
|
+
type: 'gradient',
|
|
318
|
+
colors,
|
|
319
|
+
locations: resolvedLocations,
|
|
320
|
+
start,
|
|
321
|
+
end
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Solid color (hex / rgb / rgba / named)
|
|
326
|
+
if (/^(#[0-9a-fA-F]{3,8}|rgba?\(|[a-z]+)/i.test(value)) {
|
|
327
|
+
return {
|
|
328
|
+
type: 'flat',
|
|
329
|
+
color: value
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Merge multiple style objects into one, skipping `undefined` values.
|
|
337
|
+
* Helper for composing adapter output with caller-provided overrides.
|
|
338
|
+
*/
|
|
339
|
+
export function mergeStyles(...styles) {
|
|
340
|
+
const result = {};
|
|
341
|
+
for (const s of styles) {
|
|
342
|
+
if (!s) continue;
|
|
343
|
+
for (const key of Object.keys(s)) {
|
|
344
|
+
const val = s[key];
|
|
345
|
+
if (val !== undefined && val !== null) {
|
|
346
|
+
result[key] = val;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return result;
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=cssStringAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NUMBER","String","raw","DIMENSION_RE","RegExp","PERCENT_RE","parseDimension","value","undefined","Number","isFinite","match","trim","n","parseFloat","isNaN","parseSize","trimmed","pct","parseDuration","parseBorder","width","color","borderWidth","borderColor","parseBorderRadius","parts","split","map","p","some","length","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","parseBoxShadow","shadows","s","filter","Boolean","outer","find","test","colorMatch","numericPart","replace","nums","t","offsetX","offsetY","blur","spread","shadowColor","resolvedColor","resolvedOpacity","rgbaMatch","r","g","b","a","elevation","Math","max","abs","shadowOffset","height","shadowOpacity","shadowRadius","parseBackground","gradientMatch","angle","stopsStr","stopStrs","colors","locations","stop","push","min","type","allZero","every","l","resolvedLocations","_","i","rad","PI","start","x","sin","y","cos","end","mergeStyles","styles","result","key","Object","keys","val"],"sourceRoot":"../../../src","sources":["adapters/cssStringAdapter.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAM,GAAGC,MAAM,CAACC,GAAG,2BAA2B;;AAEpD;AACA,MAAMC,YAAY,GAAG,IAAIC,MAAM,CAAC,KAAKJ,MAAM,WAAW,CAAC;;AAEvD;AACA,MAAMK,UAAU,GAAG,IAAID,MAAM,CAAC,KAAKJ,MAAM,KAAK,CAAC;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;A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 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Optional `expo-linear-gradient` probe, shared by every surface that can
|
|
5
|
+
* render a gradient (Pressable's gradient buttons, Skeleton's wave sweep).
|
|
6
|
+
*
|
|
7
|
+
* The probe must survive every build target this package ships:
|
|
8
|
+
*
|
|
9
|
+
* - **Metro (`react-native` condition, raw `src/`)** and the **CJS build**
|
|
10
|
+
* (`require`/`default` conditions): `require` exists, the module loads
|
|
11
|
+
* when installed, and the `catch` absorbs its absence.
|
|
12
|
+
* - **The ESM build** (`import` condition): there is no `require` in module
|
|
13
|
+
* scope. The `typeof` guard makes the degradation explicit — gradient
|
|
14
|
+
* surfaces fall back to a flat fill — instead of relying on a caught
|
|
15
|
+
* `ReferenceError`. Bundlers that polyfill `require` in ESM (webpack)
|
|
16
|
+
* still resolve the real module.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export let LinearGradient = null;
|
|
20
|
+
try {
|
|
21
|
+
if (typeof require === 'function') {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
23
|
+
const mod = require('expo-linear-gradient');
|
|
24
|
+
LinearGradient = mod.LinearGradient;
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
LinearGradient = null;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=optionalGradient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LinearGradient","require","mod"],"sourceRoot":"../../../src","sources":["adapters/optionalGradient.ts"],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAO,IAAIA,cAAwC,GAAG,IAAI;AAC1D,IAAI;EACA,IAAI,OAAOC,OAAO,KAAK,UAAU,EAAE;IAC/B;IACA,MAAMC,GAAmB,GAAGD,OAAO,CAAC,sBAAsB,CAAC;IAC3DD,cAAc,GAAGE,GAAG,CAACF,cAAc;EACvC;AACJ,CAAC,CAAC,MAAM;EACJA,cAAc,GAAG,IAAI;AACzB","ignoreList":[]}
|