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,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { parseBackground, parseBorder, parseBorderRadius, parseBoxShadow, parseDimension, parseSize } from "./cssStringAdapter.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared CSS-string → `ViewStyle` resolution for every native surface.
|
|
7
|
+
*
|
|
8
|
+
* Both `Block` (a plain `View`) and `Pressable` (an interactive surface) need
|
|
9
|
+
* to turn the same token-shaped CSS strings into RN styles. Before this
|
|
10
|
+
* existed, `Pressable` inlined the whole translation and `Block` had none at
|
|
11
|
+
* all — which meant a non-interactive container could not render a border,
|
|
12
|
+
* a radius, or a height. Components that switch between the two depending on
|
|
13
|
+
* whether they are interactive (web's `TagElement = onClick ? PrimitiveButton
|
|
14
|
+
* : Block` pattern) would have rendered differently in each branch.
|
|
15
|
+
*
|
|
16
|
+
* Pure and total: unparseable input is dropped rather than thrown, and no key
|
|
17
|
+
* is emitted for a value that could not be resolved, so `undefined`/`NaN`
|
|
18
|
+
* never reaches RN's stylesheet.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Which platform's shadow model to emit.
|
|
23
|
+
*
|
|
24
|
+
* Passed in rather than read from `Platform.OS` so this module stays free of
|
|
25
|
+
* any `react-native` value import and remains unit-testable outside a
|
|
26
|
+
* renderer — the same constraint that shapes `theme/breakpoint.ts` and
|
|
27
|
+
* `primitives/touchTarget.ts`.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Assign `value` to `target[key]` only when it is a usable style value.
|
|
32
|
+
* Keeps `undefined` and `NaN` out of the emitted `ViewStyle`.
|
|
33
|
+
*/
|
|
34
|
+
function put(target, key, value) {
|
|
35
|
+
if (value === undefined || value === null) return;
|
|
36
|
+
if (typeof value === 'number' && Number.isNaN(value)) return;
|
|
37
|
+
target[key] = value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the parsed background into `backgroundColor`, and report whether a
|
|
42
|
+
* gradient was requested. Gradients cannot be expressed as a `ViewStyle`, so
|
|
43
|
+
* callers that support them (`Pressable`) render a `<LinearGradient>` layer
|
|
44
|
+
* and callers that do not fall back to the gradient's first colour.
|
|
45
|
+
*/
|
|
46
|
+
export function resolveBackground(background, explicitBackgroundColor) {
|
|
47
|
+
if (explicitBackgroundColor) {
|
|
48
|
+
return {
|
|
49
|
+
backgroundColor: explicitBackgroundColor
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const parsed = parseBackground(background);
|
|
53
|
+
if (!parsed) return {};
|
|
54
|
+
if (parsed.type === 'flat') return {
|
|
55
|
+
backgroundColor: parsed.color
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Gradient — hand it back for the caller to render, and supply the first
|
|
59
|
+
// stop as a static fallback so a non-gradient-capable surface still shows
|
|
60
|
+
// something in the right colour family rather than transparent.
|
|
61
|
+
return {
|
|
62
|
+
backgroundColor: parsed.colors[0],
|
|
63
|
+
gradient: parsed
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Apply the shadow model the platform actually understands.
|
|
69
|
+
*
|
|
70
|
+
* The two are mutually exclusive in practice:
|
|
71
|
+
*
|
|
72
|
+
* - **iOS** renders `shadowColor` / `shadowOffset` / `shadowOpacity` /
|
|
73
|
+
* `shadowRadius` and ignores `elevation` entirely.
|
|
74
|
+
* - **Android** renders only `elevation`, and before API 28 it ignores
|
|
75
|
+
* `shadowColor` — so emitting the iOS keys alongside it is at best dead
|
|
76
|
+
* weight and at worst misleading to anyone reading the resolved style.
|
|
77
|
+
* - **Web** (react-native-web) maps the iOS keys onto `box-shadow`, as do
|
|
78
|
+
* RN-Windows and RN-macOS — so Android is the only platform that diverges.
|
|
79
|
+
*
|
|
80
|
+
* Emitting both unconditionally, as this used to, meant every surface carried
|
|
81
|
+
* four properties the running platform would never read.
|
|
82
|
+
*/
|
|
83
|
+
function applyShadow(style, shadow, platform) {
|
|
84
|
+
if (!shadow) return;
|
|
85
|
+
if (platform === 'android') {
|
|
86
|
+
put(style, 'elevation', shadow.elevation);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
put(style, 'shadowColor', shadow.shadowColor);
|
|
90
|
+
put(style, 'shadowOffset', shadow.shadowOffset);
|
|
91
|
+
put(style, 'shadowOpacity', shadow.shadowOpacity);
|
|
92
|
+
put(style, 'shadowRadius', shadow.shadowRadius);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Translate token-shaped surface props into a `ViewStyle`.
|
|
97
|
+
*
|
|
98
|
+
* Gradients are reported separately via `resolveBackground` — this function
|
|
99
|
+
* emits only the flat-colour fallback, so it is safe for any `View`.
|
|
100
|
+
*/
|
|
101
|
+
export function resolveSurfaceStyle(props, platform = 'ios') {
|
|
102
|
+
const style = {};
|
|
103
|
+
|
|
104
|
+
// ---- Background -----------------------------------------------------
|
|
105
|
+
const {
|
|
106
|
+
backgroundColor
|
|
107
|
+
} = resolveBackground(props.background, props.backgroundColor);
|
|
108
|
+
put(style, 'backgroundColor', backgroundColor);
|
|
109
|
+
|
|
110
|
+
// ---- Border ---------------------------------------------------------
|
|
111
|
+
const borderStyle = parseBorder(props.border);
|
|
112
|
+
put(style, 'borderWidth', borderStyle.borderWidth);
|
|
113
|
+
put(style, 'borderColor', borderStyle.borderColor);
|
|
114
|
+
|
|
115
|
+
// ---- Radius ---------------------------------------------------------
|
|
116
|
+
const radius = parseBorderRadius(props.borderRadius);
|
|
117
|
+
if (typeof radius === 'number') {
|
|
118
|
+
put(style, 'borderRadius', radius);
|
|
119
|
+
} else if (radius && typeof radius === 'object') {
|
|
120
|
+
put(style, 'borderTopLeftRadius', radius.borderTopLeftRadius);
|
|
121
|
+
put(style, 'borderTopRightRadius', radius.borderTopRightRadius);
|
|
122
|
+
put(style, 'borderBottomRightRadius', radius.borderBottomRightRadius);
|
|
123
|
+
put(style, 'borderBottomLeftRadius', radius.borderBottomLeftRadius);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ---- Shadow ---------------------------------------------------------
|
|
127
|
+
applyShadow(style, parseBoxShadow(props.boxShadow), platform);
|
|
128
|
+
|
|
129
|
+
// ---- Spacing --------------------------------------------------------
|
|
130
|
+
put(style, 'paddingTop', parseDimension(props.paddingTop));
|
|
131
|
+
put(style, 'paddingRight', parseDimension(props.paddingRight));
|
|
132
|
+
put(style, 'paddingBottom', parseDimension(props.paddingBottom));
|
|
133
|
+
put(style, 'paddingLeft', parseDimension(props.paddingLeft));
|
|
134
|
+
put(style, 'gap', parseDimension(props.gap));
|
|
135
|
+
|
|
136
|
+
// ---- Sizing ---------------------------------------------------------
|
|
137
|
+
put(style, 'width', parseSize(props.width));
|
|
138
|
+
put(style, 'minWidth', parseSize(props.minWidth));
|
|
139
|
+
put(style, 'maxWidth', parseSize(props.maxWidth));
|
|
140
|
+
put(style, 'height', parseSize(props.height));
|
|
141
|
+
put(style, 'minHeight', parseSize(props.minHeight));
|
|
142
|
+
put(style, 'maxHeight', parseSize(props.maxHeight));
|
|
143
|
+
|
|
144
|
+
// ---- Layout (already RN-shaped) -------------------------------------
|
|
145
|
+
put(style, 'flexDirection', props.flexDirection);
|
|
146
|
+
put(style, 'alignItems', props.alignItems);
|
|
147
|
+
put(style, 'justifyContent', props.justifyContent);
|
|
148
|
+
put(style, 'alignSelf', props.alignSelf);
|
|
149
|
+
put(style, 'flexShrink', props.flexShrink);
|
|
150
|
+
put(style, 'flexGrow', props.flexGrow);
|
|
151
|
+
put(style, 'opacity', props.opacity);
|
|
152
|
+
put(style, 'overflow', props.overflow);
|
|
153
|
+
return style;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=surfaceStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["parseBackground","parseBorder","parseBorderRadius","parseBoxShadow","parseDimension","parseSize","put","target","key","value","undefined","Number","isNaN","resolveBackground","background","explicitBackgroundColor","backgroundColor","parsed","type","color","colors","gradient","applyShadow","style","shadow","platform","elevation","shadowColor","shadowOffset","shadowOpacity","shadowRadius","resolveSurfaceStyle","props","borderStyle","border","borderWidth","borderColor","radius","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow","paddingTop","paddingRight","paddingBottom","paddingLeft","gap","width","minWidth","maxWidth","height","minHeight","maxHeight","flexDirection","alignItems","justifyContent","alignSelf","flexShrink","flexGrow","opacity","overflow"],"sourceRoot":"../../../src","sources":["adapters/surfaceStyle.ts"],"mappings":";;AACA,SACIA,eAAe,EACfC,WAAW,EACXC,iBAAiB,EACjBC,cAAc,EACdC,cAAc,EACdC,SAAS,QAEN,uBAAoB;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsCA;AACA;AACA;AACA;AACA,SAASC,GAAGA,CACRC,MAAiB,EACjBC,GAAM,EACNC,KAA+B,EAC3B;EACJ,IAAIA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI,EAAE;EAC3C,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIE,MAAM,CAACC,KAAK,CAACH,KAAK,CAAC,EAAE;EACtDF,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,iBAAiBA,CAC7BC,UAA8B,EAC9BC,uBAA2C,EACc;EACzD,IAAIA,uBAAuB,EAAE;IACzB,OAAO;MAAEC,eAAe,EAAED;IAAwB,CAAC;EACvD;EAEA,MAAME,MAAM,GAAGjB,eAAe,CAACc,UAAU,CAAC;EAC1C,IAAI,CAACG,MAAM,EAAE,OAAO,CAAC,CAAC;EACtB,IAAIA,MAAM,CAACC,IAAI,KAAK,MAAM,EAAE,OAAO;IAAEF,eAAe,EAAEC,MAAM,CAACE;EAAM,CAAC;;EAEpE;EACA;EACA;EACA,OAAO;IAAEH,eAAe,EAAEC,MAAM,CAACG,MAAM,CAAC,CAAC,CAAC;IAAEC,QAAQ,EAAEJ;EAAO,CAAC;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,WAAWA,CAChBC,KAAgB,EAChBC,MAAyC,EACzCC,QAAyB,EAC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2B,KAAK,CAACoB,MAAM,CAAC,CAAC;EAC7C9C,GAAG,CAACiB,KAAK,EAAE,WAAW,EAAElB,SAAS,CAAC2B,KAAK,CAACqB,SAAS,CAAC,CAAC;EACnD/C,GAAG,CAACiB,KAAK,EAAE,WAAW,EAAElB,SAAS,CAAC2B,KAAK,CAACsB,SAAS,CAAC,CAAC;;EAEnD;EACAhD,GAAG,CAACiB,KAAK,EAAE,eAAe,EAAES,KAAK,CAACuB,aAAa,CAAC;EAChDjD,GAAG,CAACiB,KAAK,EAAE,YAAY,EAAES,KAAK,CAACwB,UAAU,CAAC;EAC1ClD,GAAG,CAACiB,KAAK,EAAE,gBAAgB,EAAES,KAAK,CAACyB,cAAc,CAAC;EAClDnD,GAAG,CAACiB,KAAK,EAAE,WAAW,EAAES,KAAK,CAAC0B,SAAS,CAAC;EACxCpD,GAAG,CAACiB,KAAK,EAAE,YAAY,EAAES,KAAK,CAAC2B,UAAU,CAAC;EAC1CrD,GAAG,CAACiB,KAAK,EAAE,UAAU,EAAES,KAAK,CAAC4B,QAAQ,CAAC;EACtCtD,GAAG,CAACiB,KAAK,EAAE,SAAS,EAAES,KAAK,CAAC6B,OAAO,CAAC;EACpCvD,GAAG,CAACiB,KAAK,EAAE,UAAU,EAAES,KAAK,CAAC8B,QAAQ,CAAC;EAEtC,OAAOvC,KAAK;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { AlertV2ActionPosition, AlertV2SubType, AlertV2Type } from '@juspay/blend-design-system/node';
|
|
5
|
+
import { useNativeTokens } from "../../theme/useNativeTokens.js";
|
|
6
|
+
import { Block } from "../../primitives/Block.js";
|
|
7
|
+
import { Separator } from "../../primitives/Separator.js";
|
|
8
|
+
import { Slot } from "../../primitives/Slot.js";
|
|
9
|
+
import { buildAnnouncement } from "../../a11y/announcement.js";
|
|
10
|
+
import { useLiveRegionAnnounce } from "../../a11y/useLiveRegion.js";
|
|
11
|
+
import { AlertActions } from "./AlertActions.js";
|
|
12
|
+
import { AlertClose } from "./AlertClose.js";
|
|
13
|
+
import { AlertText } from "./AlertText.js";
|
|
14
|
+
import { ALERT_FLEX_BOX, getAlertLayout, getCloseIconSize, shouldShowSeparator } from "./alert.utils.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
/**
|
|
17
|
+
* Alert — React Native implementation of web's `AlertV2`.
|
|
18
|
+
*
|
|
19
|
+
* Tokens resolve through `useNativeTokens('ALERTV2')`, so theme and per-slot
|
|
20
|
+
* overrides come from `BlendNativeProvider`.
|
|
21
|
+
*
|
|
22
|
+
* AlertV2's tokens contain no gradients, so this needs no native module beyond
|
|
23
|
+
* the icon set.
|
|
24
|
+
*/
|
|
25
|
+
const Alert = /*#__PURE__*/forwardRef(function Alert({
|
|
26
|
+
type = AlertV2Type.PRIMARY,
|
|
27
|
+
subType = AlertV2SubType.SUBTLE,
|
|
28
|
+
slot,
|
|
29
|
+
heading,
|
|
30
|
+
description,
|
|
31
|
+
actions,
|
|
32
|
+
closeButton = {
|
|
33
|
+
show: true
|
|
34
|
+
},
|
|
35
|
+
width,
|
|
36
|
+
maxWidth,
|
|
37
|
+
minWidth,
|
|
38
|
+
announce = true,
|
|
39
|
+
accessibilityLabel,
|
|
40
|
+
testID,
|
|
41
|
+
style
|
|
42
|
+
}, ref) {
|
|
43
|
+
const tokens = useNativeTokens('ALERTV2');
|
|
44
|
+
const position = actions?.position ?? AlertV2ActionPosition.BOTTOM;
|
|
45
|
+
const layout = useMemo(() => getAlertLayout(position), [position]);
|
|
46
|
+
const closeShown = Boolean(closeButton?.show);
|
|
47
|
+
const showSeparator = shouldShowSeparator(position, closeShown);
|
|
48
|
+
|
|
49
|
+
// Web hard-codes `aria-live="assertive"` + `aria-atomic`. Android reads the
|
|
50
|
+
// region itself via `accessibilityLiveRegion`; iOS has no live-region
|
|
51
|
+
// support, so the composed sentence is announced imperatively.
|
|
52
|
+
const announcement = useMemo(() => buildAnnouncement(heading, description), [heading, description]);
|
|
53
|
+
useLiveRegionAnnounce(announcement, announce);
|
|
54
|
+
const hasText = Boolean(heading || description);
|
|
55
|
+
return /*#__PURE__*/_jsxs(Block, {
|
|
56
|
+
ref: ref,
|
|
57
|
+
testID: testID
|
|
58
|
+
// NOTE: `accessible` is deliberately NOT set here.
|
|
59
|
+
//
|
|
60
|
+
// In RN, marking a View as an accessibility element "groups its
|
|
61
|
+
// children into a single selectable component" — which on iOS makes
|
|
62
|
+
// the action links and the close button individually unreachable by
|
|
63
|
+
// VoiceOver. Web has no such problem: `role="alert"` does not affect
|
|
64
|
+
// whether nested buttons can be focused.
|
|
65
|
+
//
|
|
66
|
+
// `accessibilityRole="alert"` conveys the semantic without
|
|
67
|
+
// collapsing the subtree, and each child keeps its own label.
|
|
68
|
+
,
|
|
69
|
+
accessibilityRole: "alert",
|
|
70
|
+
accessibilityLabel: accessibilityLabel,
|
|
71
|
+
accessibilityLiveRegion: announce ? 'assertive' : 'none',
|
|
72
|
+
flexDirection: "row",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
width: width ?? tokens.width,
|
|
75
|
+
maxWidth: maxWidth ?? tokens.maxWidth,
|
|
76
|
+
minWidth: minWidth ?? tokens.minWidth,
|
|
77
|
+
border: String(tokens.border[type][subType]),
|
|
78
|
+
borderRadius: tokens.borderRadius,
|
|
79
|
+
backgroundColor: String(tokens.backgroundColor[type][subType]),
|
|
80
|
+
paddingTop: tokens.padding.top,
|
|
81
|
+
paddingBottom: tokens.padding.bottom,
|
|
82
|
+
paddingLeft: tokens.padding.left,
|
|
83
|
+
paddingRight: tokens.padding.right,
|
|
84
|
+
gap: tokens.gap[position],
|
|
85
|
+
style: style,
|
|
86
|
+
children: [/*#__PURE__*/_jsxs(Block, {
|
|
87
|
+
...ALERT_FLEX_BOX,
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
gap: tokens.mainContainer.gap,
|
|
90
|
+
children: [slot?.slot ? /*#__PURE__*/_jsx(Slot, {
|
|
91
|
+
maxHeight: slot.maxHeight ?? tokens.slot.maxHeight,
|
|
92
|
+
hidden: hasText,
|
|
93
|
+
testID: testID ? `${testID}-slot` : undefined,
|
|
94
|
+
children: slot.slot
|
|
95
|
+
}) : null, /*#__PURE__*/_jsxs(Block, {
|
|
96
|
+
...ALERT_FLEX_BOX,
|
|
97
|
+
flexDirection: layout.contentDirection,
|
|
98
|
+
justifyContent: layout.contentJustify,
|
|
99
|
+
alignItems: layout.contentAlign,
|
|
100
|
+
gap: tokens.mainContainer.content.gap[position],
|
|
101
|
+
children: [/*#__PURE__*/_jsx(AlertText, {
|
|
102
|
+
heading: heading,
|
|
103
|
+
description: description,
|
|
104
|
+
type: type,
|
|
105
|
+
tokens: tokens.mainContainer.content.textContainer
|
|
106
|
+
}), /*#__PURE__*/_jsx(AlertActions, {
|
|
107
|
+
actions: actions,
|
|
108
|
+
type: type,
|
|
109
|
+
tokens: tokens.mainContainer.content.actionContainer,
|
|
110
|
+
testID: testID
|
|
111
|
+
})]
|
|
112
|
+
})]
|
|
113
|
+
}), showSeparator ? /*#__PURE__*/_jsx(Separator, {
|
|
114
|
+
testID: testID ? `${testID}-separator` : undefined
|
|
115
|
+
}) : null, closeShown ? /*#__PURE__*/_jsx(AlertClose, {
|
|
116
|
+
closeButton: closeButton,
|
|
117
|
+
color: String(tokens.mainContainer.closeButton.color[type]),
|
|
118
|
+
size: getCloseIconSize(tokens),
|
|
119
|
+
alignSelf: layout.closeAlign,
|
|
120
|
+
testID: testID ? `${testID}-close` : undefined
|
|
121
|
+
}) : null]
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
Alert.displayName = 'Alert';
|
|
125
|
+
export default Alert;
|
|
126
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","AlertV2ActionPosition","AlertV2SubType","AlertV2Type","useNativeTokens","Block","Separator","Slot","buildAnnouncement","useLiveRegionAnnounce","AlertActions","AlertClose","AlertText","ALERT_FLEX_BOX","getAlertLayout","getCloseIconSize","shouldShowSeparator","jsx","_jsx","jsxs","_jsxs","Alert","type","PRIMARY","subType","SUBTLE","slot","heading","description","actions","closeButton","show","width","maxWidth","minWidth","announce","accessibilityLabel","testID","style","ref","tokens","position","BOTTOM","layout","closeShown","Boolean","showSeparator","announcement","hasText","accessibilityRole","accessibilityLiveRegion","flexDirection","alignItems","border","String","borderRadius","backgroundColor","paddingTop","padding","top","paddingBottom","bottom","paddingLeft","left","paddingRight","right","gap","children","mainContainer","maxHeight","hidden","undefined","contentDirection","justifyContent","contentJustify","contentAlign","content","textContainer","actionContainer","color","size","alignSelf","closeAlign","displayName"],"sourceRoot":"../../../../src","sources":["components/Alert/Alert.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAE3C,SACIC,qBAAqB,EACrBC,cAAc,EACdC,WAAW,QAER,kCAAkC;AACzC,SAASC,eAAe,QAAQ,gCAA6B;AAC7D,SAASC,KAAK,QAAQ,2BAAwB;AAC9C,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SAASC,iBAAiB,QAAQ,4BAAyB;AAC3D,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,SAAS,QAAQ,gBAAa;AACvC,SACIC,cAAc,EACdC,cAAc,EACdC,gBAAgB,EAChBC,mBAAmB,QAChB,kBAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,gBAAGtB,UAAU,CAA2B,SAASsB,KAAKA,CAC7D;EACIC,IAAI,GAAGnB,WAAW,CAAC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|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { Block } from "../../primitives/Block.js";
|
|
5
|
+
import { Pressable } from "../../primitives/Pressable.js";
|
|
6
|
+
import { Text } from "../../primitives/Text.js";
|
|
7
|
+
import { getActionAccessibilityLabel } from "./alert.utils.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `Alert`'s action row.
|
|
11
|
+
*
|
|
12
|
+
* These are **text links**, not `Button`s: web renders them as a bare
|
|
13
|
+
* `PrimitiveButton` with no border or background, so native composes
|
|
14
|
+
* `Pressable` + `Text` rather than reusing the `Button` component.
|
|
15
|
+
*/
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
function ActionLink({
|
|
18
|
+
action,
|
|
19
|
+
type,
|
|
20
|
+
tokens,
|
|
21
|
+
testID
|
|
22
|
+
}) {
|
|
23
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
24
|
+
onPress: action.onPress,
|
|
25
|
+
accessibilityRole: "button",
|
|
26
|
+
accessibilityLabel: getActionAccessibilityLabel(action.text, action.accessibilityLabel),
|
|
27
|
+
testID: testID,
|
|
28
|
+
alignSelf: "flex-start",
|
|
29
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
30
|
+
fontSize: tokens.fontSize,
|
|
31
|
+
fontWeight: tokens.fontWeight,
|
|
32
|
+
lineHeight: tokens.lineHeight,
|
|
33
|
+
color: String(tokens.color[type])
|
|
34
|
+
// Web sets `white-space: nowrap`; the RN equivalent is a single
|
|
35
|
+
// line. `tail` makes an over-long label visibly truncated rather
|
|
36
|
+
// than silently clipped.
|
|
37
|
+
,
|
|
38
|
+
numberOfLines: 1,
|
|
39
|
+
ellipsizeMode: "tail",
|
|
40
|
+
children: action.text
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function AlertActionsImpl({
|
|
45
|
+
actions,
|
|
46
|
+
type,
|
|
47
|
+
tokens,
|
|
48
|
+
testID
|
|
49
|
+
}) {
|
|
50
|
+
if (!actions?.primaryAction && !actions?.secondaryAction) return null;
|
|
51
|
+
return /*#__PURE__*/_jsxs(Block, {
|
|
52
|
+
flexDirection: "row",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
gap: tokens.gap,
|
|
55
|
+
children: [actions.primaryAction ? /*#__PURE__*/_jsx(ActionLink, {
|
|
56
|
+
action: actions.primaryAction,
|
|
57
|
+
type: type,
|
|
58
|
+
tokens: tokens.primaryAction,
|
|
59
|
+
testID: testID ? `${testID}-primary-action` : undefined
|
|
60
|
+
}) : null, actions.secondaryAction ? /*#__PURE__*/_jsx(ActionLink, {
|
|
61
|
+
action: actions.secondaryAction,
|
|
62
|
+
type: type,
|
|
63
|
+
tokens: tokens.secondaryAction,
|
|
64
|
+
testID: testID ? `${testID}-secondary-action` : undefined
|
|
65
|
+
}) : null]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export const AlertActions = /*#__PURE__*/memo(AlertActionsImpl);
|
|
69
|
+
AlertActions.displayName = 'AlertActions';
|
|
70
|
+
//# sourceMappingURL=AlertActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","Block","Pressable","Text","getActionAccessibilityLabel","jsx","_jsx","jsxs","_jsxs","ActionLink","action","type","tokens","testID","onPress","accessibilityRole","accessibilityLabel","text","alignSelf","children","fontSize","fontWeight","lineHeight","color","String","numberOfLines","ellipsizeMode","AlertActionsImpl","actions","primaryAction","secondaryAction","flexDirection","alignItems","gap","undefined","AlertActions","displayName"],"sourceRoot":"../../../../src","sources":["components/Alert/AlertActions.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAE5B,SAASC,KAAK,QAAQ,2BAAwB;AAC9C,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SAASC,2BAA2B,QAAQ,kBAAe;;AAU3D;AACA;AACA;AACA;AACA;AACA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c;MAC7BhB,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,iBAAiB,GAAGqB;IAAU,CAC3D,CAAC,GACF,IAAI,EACPN,OAAO,CAACE,eAAe,gBACpBxB,IAAA,CAACG,UAAU;MACPC,MAAM,EAAEkB,OAAO,CAACE,eAAgB;MAChCnB,IAAI,EAAEA,IAAK;MACXC,MAAM,EAAEA,MAAM,CAACkB,eAAgB;MAC/BjB,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,mBAAmB,GAAGqB;IAAU,CAC7D,CAAC,GACF,IAAI;EAAA,CACL,CAAC;AAEhB;AAEA,OAAO,MAAMC,YAAY,gBAAGnC,IAAI,CAAC2B,gBAAgB,CAAC;AAClDQ,YAAY,CAACC,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { X } from 'lucide-react-native';
|
|
5
|
+
import { Pressable } from "../../primitives/Pressable.js";
|
|
6
|
+
import { Slot } from "../../primitives/Slot.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `Alert`'s close affordance.
|
|
10
|
+
*
|
|
11
|
+
* Renders lucide's `X` by default; a consumer icon supplied via
|
|
12
|
+
* `closeButton.icon` goes through `Slot` so it is tinted the same way.
|
|
13
|
+
*
|
|
14
|
+
* The control is smaller than the 44pt minimum tap target, so it relies on the
|
|
15
|
+
* `hitSlop` `Pressable` applies automatically.
|
|
16
|
+
*/
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
function AlertCloseImpl({
|
|
19
|
+
closeButton,
|
|
20
|
+
color,
|
|
21
|
+
size,
|
|
22
|
+
alignSelf,
|
|
23
|
+
testID
|
|
24
|
+
}) {
|
|
25
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
26
|
+
onPress: closeButton.onPress,
|
|
27
|
+
accessibilityRole: "button",
|
|
28
|
+
accessibilityLabel: closeButton.accessibilityLabel ?? 'Close',
|
|
29
|
+
testID: testID,
|
|
30
|
+
alignSelf: alignSelf,
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
justifyContent: "center",
|
|
33
|
+
children: closeButton.icon ? /*#__PURE__*/_jsx(Slot, {
|
|
34
|
+
color: color,
|
|
35
|
+
children: closeButton.icon
|
|
36
|
+
}) : /*#__PURE__*/_jsx(X, {
|
|
37
|
+
size: size,
|
|
38
|
+
color: color
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export const AlertClose = /*#__PURE__*/memo(AlertCloseImpl);
|
|
43
|
+
AlertClose.displayName = 'AlertClose';
|
|
44
|
+
//# sourceMappingURL=AlertClose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","X","Pressable","Slot","jsx","_jsx","AlertCloseImpl","closeButton","color","size","alignSelf","testID","onPress","accessibilityRole","accessibilityLabel","alignItems","justifyContent","children","icon","AlertClose","displayName"],"sourceRoot":"../../../../src","sources":["components/Alert/AlertClose.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAE5B,SAASC,CAAC,QAAQ,qBAAqB;AACvC,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,IAAI,QAAQ,0BAAuB;;AAG5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,SAAAC,GAAA,IAAAC,IAAA;AAkBA,SAASC,cAAcA,CAAC;EACpBC,WAAW;EACXC,KAAK;EACLC,IAAI;EACJC,SAAS;EACTC;AACa,CAAC,EAAE;EAChB,oBACIN,IAAA,CAACH,SAAS;IACNU,OAAO,EAAEL,WAAW,CAACK,OAAQ;IAC7BC,iBAAiB,EAAC,QAAQ;IAC1BC,kBAAkB,EAAEP,WAAW,CAACO,kBAAkB,IAAI,OAAQ;IAC9DH,MAAM,EAAEA,MAAO;IACfD,SAAS,EAAEA,SAAU;IACrBK,UAAU,EAAC,QAAQ;IACnBC,cAAc,EAAC,QAAQ;IAAAC,QAAA,EAEtBV,WAAW,CAACW,IAAI,gBACbb,IAAA,CAACF,IAAI;MAACK,KAAK,EAAEA,KAAM;MAAAS,QAAA,EAAEV,WAAW,CAACW;IAAI,CAAO,CAAC,gBAE7Cb,IAAA,CAACJ,CAAC;MAACQ,IAAI,EAAEA,IAAK;MAACD,KAAK,EAAEA;IAAM,CAAE;EACjC,CACM,CAAC;AAEpB;AAEA,OAAO,MAAMW,UAAU,gBAAGnB,IAAI,CAACM,cAAc,CAAC;AAC9Ca,UAAU,CAACC,WAAW,GAAG,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { Block } from "../../primitives/Block.js";
|
|
5
|
+
import { Text } from "../../primitives/Text.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The heading and description block of an `Alert`.
|
|
9
|
+
*
|
|
10
|
+
* `flexShrink` is explicit because Yoga defaults it to 0 where CSS defaults it
|
|
11
|
+
* to 1 — without it this box sizes to its text and a long description runs off
|
|
12
|
+
* the edge instead of wrapping.
|
|
13
|
+
*/
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
function AlertTextImpl({
|
|
16
|
+
heading,
|
|
17
|
+
description,
|
|
18
|
+
type,
|
|
19
|
+
tokens
|
|
20
|
+
}) {
|
|
21
|
+
if (!heading && !description) return null;
|
|
22
|
+
return /*#__PURE__*/_jsxs(Block, {
|
|
23
|
+
flexGrow: 1,
|
|
24
|
+
flexShrink: 1,
|
|
25
|
+
flexDirection: "column",
|
|
26
|
+
gap: tokens.gap,
|
|
27
|
+
children: [heading ? /*#__PURE__*/_jsx(Text, {
|
|
28
|
+
accessibilityRole: "header",
|
|
29
|
+
fontSize: tokens.heading.fontSize,
|
|
30
|
+
fontWeight: tokens.heading.fontWeight,
|
|
31
|
+
lineHeight: tokens.heading.lineHeight,
|
|
32
|
+
color: String(tokens.heading.color[type]),
|
|
33
|
+
children: heading
|
|
34
|
+
}) : null, description ? /*#__PURE__*/_jsx(Text, {
|
|
35
|
+
fontSize: tokens.description.fontSize,
|
|
36
|
+
fontWeight: tokens.description.fontWeight,
|
|
37
|
+
lineHeight: tokens.description.lineHeight,
|
|
38
|
+
color: String(tokens.description.color[type]),
|
|
39
|
+
children: description
|
|
40
|
+
}) : null]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export const AlertText = /*#__PURE__*/memo(AlertTextImpl);
|
|
44
|
+
AlertText.displayName = 'AlertText';
|
|
45
|
+
//# sourceMappingURL=AlertText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","Block","Text","jsx","_jsx","jsxs","_jsxs","AlertTextImpl","heading","description","type","tokens","flexGrow","flexShrink","flexDirection","gap","children","accessibilityRole","fontSize","fontWeight","lineHeight","color","String","AlertText","displayName"],"sourceRoot":"../../../../src","sources":["components/Alert/AlertText.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAE5B,SAASC,KAAK,QAAQ,2BAAwB;AAC9C,SAASC,IAAI,QAAQ,0BAAuB;;AAG5C;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAeA,SAASC,aAAaA,CAAC;EAAEC,OAAO;EAAEC,WAAW;EAAEC,IAAI;EAAEC;AAAuB,CAAC,EAAE;EAC3E,IAAI,CAACH,OAAO,IAAI,CAACC,WAAW,EAAE,OAAO,IAAI;EAEzC,oBACIH,KAAA,CAACL,KAAK;IACFW,QAAQ,EAAE,CAAE;IACZC,UAAU,EAAE,CAAE;IACdC,aAAa,EAAC,QAAQ;IACtBC,GAAG,EAAEJ,MAAM,CAACI,GAAI;IAAAC,QAAA,GAEfR,OAAO,gBACJJ,IAAA,CAACF,IAAI;MACDe,iBAAiB,EAAC,QAAQ;MAC1BC,QAAQ,EAAEP,MAAM,CAACH,OAAO,CAACU,QAAS;MAClCC,UAAU,EAAER,MAAM,CAACH,OAAO,CAACW,UAAW;MACtCC,UAAU,EAAET,MAAM,CAACH,OAAO,CAACY,UAAW;MACtCC,KAAK,EAAEC,MAAM,CAACX,MAAM,CAACH,OAAO,CAACa,KAAK,CAACX,IAAI,CAAC,CAAE;MAAAM,QAAA,EAEzCR;IAAO,CACN,CAAC,GACP,IAAI,EACPC,WAAW,gBACRL,IAAA,CAACF,IAAI;MACDgB,QAAQ,EAAEP,MAAM,CAACF,WAAW,CAACS,QAAS;MACtCC,UAAU,EAAER,MAAM,CAACF,WAAW,CAACU,UAAW;MAC1CC,UAAU,EAAET,MAAM,CAACF,WAAW,CAACW,UAAW;MAC1CC,KAAK,EAAEC,MAAM,CAACX,MAAM,CAACF,WAAW,CAACY,KAAK,CAACX,IAAI,CAAC,CAAE;MAAAM,QAAA,EAE7CP;IAAW,CACV,CAAC,GACP,IAAI;EAAA,CACL,CAAC;AAEhB;AAEA,OAAO,MAAMc,SAAS,gBAAGvB,IAAI,CAACO,aAAa,CAAC;AAC5CgB,SAAS,CAACC,WAAW,GAAG,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Alert/alert.tokens.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Alert/alert.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { AlertV2ActionPosition } from '@juspay/blend-design-system/node';
|
|
4
|
+
/**
|
|
5
|
+
* Native Alert layout helpers.
|
|
6
|
+
*
|
|
7
|
+
* Web computes these inline in the JSX of `AlertV2.tsx`. Pulling them out
|
|
8
|
+
* makes the branching testable, and keeps the component readable given that
|
|
9
|
+
* one prop reshapes four layout values at once.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Flex sizing shared by every box in Alert's row chain.
|
|
14
|
+
*
|
|
15
|
+
* `flexShrink` is explicit because **Yoga defaults it to 0 where CSS defaults
|
|
16
|
+
* it to 1**. Without it a flex child sizes to its content and refuses to
|
|
17
|
+
* narrow, so a long description runs off the right edge instead of wrapping.
|
|
18
|
+
*
|
|
19
|
+
* Exported as a constant rather than repeated inline so the invariant has one
|
|
20
|
+
* definition and can be asserted directly in tests.
|
|
21
|
+
*/
|
|
22
|
+
export const ALERT_FLEX_BOX = {
|
|
23
|
+
flexGrow: 1,
|
|
24
|
+
flexShrink: 1
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Fallback icon size when the close-button token cannot be parsed. */
|
|
28
|
+
export const FALLBACK_CLOSE_ICON_SIZE = 16;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the layout for an action position.
|
|
31
|
+
*
|
|
32
|
+
* `BOTTOM` stacks the actions beneath the text and pins the close button to
|
|
33
|
+
* the top; `RIGHT` runs everything on one line, vertically centred. Mirrors
|
|
34
|
+
* the `actionPlacementBottom` branches in web `AlertV2.tsx`.
|
|
35
|
+
*/
|
|
36
|
+
export function getAlertLayout(position) {
|
|
37
|
+
const isBottom = position === AlertV2ActionPosition.BOTTOM;
|
|
38
|
+
return {
|
|
39
|
+
contentDirection: isBottom ? 'column' : 'row',
|
|
40
|
+
contentJustify: isBottom ? 'space-between' : 'flex-start',
|
|
41
|
+
contentAlign: isBottom ? 'flex-start' : 'center',
|
|
42
|
+
closeAlign: isBottom ? 'flex-start' : 'center'
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Whether to render the divider between the actions and the close button.
|
|
48
|
+
*
|
|
49
|
+
* Web's condition is `position === RIGHT && closeButton.show` — the separator
|
|
50
|
+
* only makes sense when both sit on the same line. Extracted because the
|
|
51
|
+
* two-term condition is easy to get subtly wrong, and it has a truth table
|
|
52
|
+
* in the tests.
|
|
53
|
+
*/
|
|
54
|
+
export function shouldShowSeparator(position, closeButtonShown) {
|
|
55
|
+
return position === AlertV2ActionPosition.RIGHT && closeButtonShown;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Resolve the accessible name for an action.
|
|
60
|
+
* Mirrors web's `aria-label={`${action.text} action`}`.
|
|
61
|
+
*/
|
|
62
|
+
export function getActionAccessibilityLabel(text, override) {
|
|
63
|
+
return override ?? `${text} action`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Numeric size for the close icon, from the same token web uses. */
|
|
67
|
+
export function getCloseIconSize(tokens) {
|
|
68
|
+
const raw = tokens.mainContainer.closeButton.height;
|
|
69
|
+
const parsed = typeof raw === 'number' ? raw : Number.parseFloat(String(raw));
|
|
70
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : FALLBACK_CLOSE_ICON_SIZE;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=alert.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AlertV2ActionPosition","ALERT_FLEX_BOX","flexGrow","flexShrink","FALLBACK_CLOSE_ICON_SIZE","getAlertLayout","position","isBottom","BOTTOM","contentDirection","contentJustify","contentAlign","closeAlign","shouldShowSeparator","closeButtonShown","RIGHT","getActionAccessibilityLabel","text","override","getCloseIconSize","tokens","raw","mainContainer","closeButton","height","parsed","Number","parseFloat","String","isFinite"],"sourceRoot":"../../../../src","sources":["components/Alert/alert.utils.ts"],"mappings":";;AAAA,SACIA,qBAAqB,QAElB,kCAAkC;AAGzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG;EAC1BC,QAAQ,EAAE,CAAC;EACXC,UAAU,EAAE;AAChB,CAAU;;AAEV;AACA,OAAO,MAAMC,wBAAwB,GAAG,EAAE;AAW1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,QAA+B,EAAe;EACzE,MAAMC,QAAQ,GAAGD,QAAQ,KAAKN,qBAAqB,CAACQ,MAAM;EAE1D,OAAO;IACHC,gBAAgB,EAAEF,QAAQ,GAAG,QAAQ,GAAG,KAAK;IAC7CG,cAAc,EAAEH,QAAQ,GAAG,eAAe,GAAG,YAAY;IACzDI,YAAY,EAAEJ,QAAQ,GAAG,YAAY,GAAG,QAAQ;IAChDK,UAAU,EAAEL,QAAQ,GAAG,YAAY,GAAG;EAC1C,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,mBAAmBA,CAC/BP,QAA+B,EAC/BQ,gBAAyB,EAClB;EACP,OAAOR,QAAQ,KAAKN,qBAAqB,CAACe,KAAK,IAAID,gBAAgB;AACvE;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,2BAA2BA,CACvCC,IAAY,EACZC,QAAiB,EACX;EACN,OAAOA,QAAQ,IAAI,GAAGD,IAAI,SAAS;AACvC;;AAEA;AACA,OAAO,SAASE,gBAAgBA,CAACC,MAAyB,EAAU;EAChE,MAAMC,GAAG,GAAGD,MAAM,CAACE,aAAa,CAACC,WAAW,CAACC,MAAM;EACnD,MAAMC,MAAM,GACR,OAAOJ,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAGK,MAAM,CAACC,UAAU,CAACC,MAAM,CAACP,GAAG,CAAC,CAAC;EAClE,OAAOK,MAAM,CAACG,QAAQ,CAACJ,MAAM,CAAC,IAAIA,MAAM,GAAG,CAAC,GACtCA,MAAM,GACNrB,wBAAwB;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { default as Alert } from "./Alert.js";
|
|
4
|
+
export { getAlertLayout, shouldShowSeparator, getActionAccessibilityLabel, getCloseIconSize } from "./alert.utils.js";
|
|
5
|
+
export { ALERT_FLEX_BOX, FALLBACK_CLOSE_ICON_SIZE } from "./alert.utils.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","Alert","getAlertLayout","shouldShowSeparator","getActionAccessibilityLabel","getCloseIconSize","ALERT_FLEX_BOX","FALLBACK_CLOSE_ICON_SIZE"],"sourceRoot":"../../../../src","sources":["components/Alert/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,KAAK,QAAQ,YAAS;AAQ1C,SACIC,cAAc,EACdC,mBAAmB,EACnBC,2BAA2B,EAC3BC,gBAAgB,QACb,kBAAe;AAEtB,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,kBAAe","ignoreList":[]}
|