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,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { TagV2Color, TagV2Size, TagV2SubType, TagV2Type } from '@juspay/blend-design-system/node';
|
|
5
|
+
import { useNativeTokens } from "../../theme/useNativeTokens.js";
|
|
6
|
+
import { Block } from "../../primitives/Block.js";
|
|
7
|
+
import { Pressable } from "../../primitives/Pressable.js";
|
|
8
|
+
import { Slot } from "../../primitives/Slot.js";
|
|
9
|
+
import { Text } from "../../primitives/Text.js";
|
|
10
|
+
import { getAccessibleName, getTagBorderRadius, getTagAccessibilityState } from "./tag.utils.js";
|
|
11
|
+
import { getGroupedBorderWidths } from "../shared/group.js";
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* Layout that never varies with tokens or props.
|
|
15
|
+
*
|
|
16
|
+
* Hoisted to module scope so it is allocated once rather than per render.
|
|
17
|
+
* `alignSelf: 'flex-start'` is RN's equivalent of web's `width: fit-content`
|
|
18
|
+
* on an inline-flex element — shrink-to-fit inside a column parent.
|
|
19
|
+
*/
|
|
20
|
+
const TAG_LAYOUT = {
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
alignSelf: 'flex-start'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Tag — React Native implementation of web's `TagV2`.
|
|
29
|
+
*
|
|
30
|
+
* Tokens resolve through `useNativeTokens('TAGV2')`, the native counterpart
|
|
31
|
+
* of web's `useResponsiveTokens('TAGV2')`, so theme and per-slot overrides
|
|
32
|
+
* come from `BlendNativeProvider` rather than a per-component prop.
|
|
33
|
+
*
|
|
34
|
+
* Like web, the rendered element depends on interactivity: web picks
|
|
35
|
+
* `PrimitiveButton` when `onClick` is supplied and `Block` otherwise; native
|
|
36
|
+
* picks `Pressable` vs `Block`. Both branches resolve their styles through
|
|
37
|
+
* the same `resolveSurfaceStyle`, so the two render identically apart from
|
|
38
|
+
* press feedback.
|
|
39
|
+
*
|
|
40
|
+
* TagV2's tokens contain no gradients, shadows, or state matrix, so this
|
|
41
|
+
* component needs no native module — it is pure JS.
|
|
42
|
+
*/
|
|
43
|
+
const Tag = /*#__PURE__*/forwardRef(function Tag({
|
|
44
|
+
text,
|
|
45
|
+
size = TagV2Size.SM,
|
|
46
|
+
type = TagV2Type.SUBTLE,
|
|
47
|
+
subType = TagV2SubType.SQUARICAL,
|
|
48
|
+
color = TagV2Color.PRIMARY,
|
|
49
|
+
leftSlot,
|
|
50
|
+
rightSlot,
|
|
51
|
+
tagGroupPosition,
|
|
52
|
+
onPress,
|
|
53
|
+
pressed,
|
|
54
|
+
accessibilityLabel,
|
|
55
|
+
testID,
|
|
56
|
+
style
|
|
57
|
+
}, ref) {
|
|
58
|
+
const tokens = useNativeTokens('TAGV2');
|
|
59
|
+
const isInteractive = typeof onPress === 'function';
|
|
60
|
+
|
|
61
|
+
// Grouped members drop their shared edges so a seam is one line wide.
|
|
62
|
+
const groupBorderWidths = useMemo(() => getGroupedBorderWidths(tagGroupPosition), [tagGroupPosition]);
|
|
63
|
+
const borderRadius = useMemo(() => getTagBorderRadius(size, subType, tagGroupPosition, tokens), [size, subType, tagGroupPosition, tokens]);
|
|
64
|
+
const backgroundColor = String(tokens.backgroundColor[type][color]);
|
|
65
|
+
const border = String(tokens.border[type][color]);
|
|
66
|
+
const textColor = String(tokens.text.color[type][color]);
|
|
67
|
+
|
|
68
|
+
// Slot icons are tinted to match the label. On web this happens
|
|
69
|
+
// implicitly — `Block`'s `color` becomes CSS `color` and SVGs inherit it
|
|
70
|
+
// through `currentColor`. RN has no such inheritance, so `Slot` hands the
|
|
71
|
+
// colour to the icon element explicitly.
|
|
72
|
+
const accessibleName = accessibilityLabel ?? getAccessibleName(text, isInteractive, pressed);
|
|
73
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
74
|
+
children: [leftSlot?.slot ? /*#__PURE__*/_jsx(Slot, {
|
|
75
|
+
color: textColor,
|
|
76
|
+
maxHeight: leftSlot.maxHeight ?? tokens.leftSlot.maxHeight[size]
|
|
77
|
+
// Matches web's `aria-hidden` on slots accompanying text:
|
|
78
|
+
// the label already carries the accessible name.
|
|
79
|
+
,
|
|
80
|
+
hidden: Boolean(text),
|
|
81
|
+
testID: testID ? `${testID}-left-slot` : undefined,
|
|
82
|
+
children: leftSlot.slot
|
|
83
|
+
}) : null, /*#__PURE__*/_jsx(Text, {
|
|
84
|
+
fontSize: tokens.text.fontSize[size],
|
|
85
|
+
fontWeight: tokens.text.fontWeight[size],
|
|
86
|
+
lineHeight: tokens.text.lineHeight[size],
|
|
87
|
+
color: textColor,
|
|
88
|
+
children: text
|
|
89
|
+
}), rightSlot?.slot ? /*#__PURE__*/_jsx(Slot, {
|
|
90
|
+
color: textColor,
|
|
91
|
+
maxHeight: rightSlot.maxHeight ?? tokens.rightSlot.maxHeight[size],
|
|
92
|
+
hidden: Boolean(text),
|
|
93
|
+
testID: testID ? `${testID}-right-slot` : undefined,
|
|
94
|
+
children: rightSlot.slot
|
|
95
|
+
}) : null]
|
|
96
|
+
});
|
|
97
|
+
const surface = useMemo(() => ({
|
|
98
|
+
...TAG_LAYOUT,
|
|
99
|
+
backgroundColor,
|
|
100
|
+
border,
|
|
101
|
+
borderRadius,
|
|
102
|
+
// The height token is applied as `minHeight`, not `height`.
|
|
103
|
+
//
|
|
104
|
+
// At the default font scale the result is identical to web: the
|
|
105
|
+
// line height is shorter than the token height, so the box renders
|
|
106
|
+
// at exactly `minHeight` with the line centred. But RN respects OS
|
|
107
|
+
// font scaling (Dynamic Type), and a fixed `height` clips scaled
|
|
108
|
+
// text — the package policy is to let controls grow instead
|
|
109
|
+
// (see `primitives/Text.tsx`).
|
|
110
|
+
//
|
|
111
|
+
// Vertical padding is still deliberately NOT applied. The tokens
|
|
112
|
+
// define both a height and vertical padding, and the padding
|
|
113
|
+
// leaves a content box shorter than the text's own line height
|
|
114
|
+
// (sm: 14px box vs 18px line). On web that is harmless — the line
|
|
115
|
+
// box overflows the padding box and `overflow: visible` shows it.
|
|
116
|
+
// RN clips instead: descenders ("p" in primary, "g" in warning)
|
|
117
|
+
// were sheared off on iOS while react-native-web rendered fine.
|
|
118
|
+
// With a centred single line the padding is visually inert on web
|
|
119
|
+
// anyway, so dropping it reproduces web's result exactly.
|
|
120
|
+
minHeight: tokens.height[size],
|
|
121
|
+
paddingLeft: tokens.padding.left[size],
|
|
122
|
+
paddingRight: tokens.padding.right[size],
|
|
123
|
+
gap: tokens.gap
|
|
124
|
+
}), [backgroundColor, border, borderRadius, tokens, size]);
|
|
125
|
+
if (isInteractive) {
|
|
126
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
127
|
+
ref: ref,
|
|
128
|
+
...surface,
|
|
129
|
+
onPress: onPress,
|
|
130
|
+
accessibilityRole: "button",
|
|
131
|
+
accessibilityLabel: accessibleName,
|
|
132
|
+
accessibilityState: getTagAccessibilityState(true, pressed),
|
|
133
|
+
testID: testID,
|
|
134
|
+
style: {
|
|
135
|
+
...groupBorderWidths,
|
|
136
|
+
...style
|
|
137
|
+
},
|
|
138
|
+
children: content
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return /*#__PURE__*/_jsx(Block, {
|
|
142
|
+
ref: ref,
|
|
143
|
+
...surface,
|
|
144
|
+
accessible: true,
|
|
145
|
+
accessibilityRole: "text",
|
|
146
|
+
accessibilityLabel: accessibilityLabel,
|
|
147
|
+
testID: testID,
|
|
148
|
+
style: {
|
|
149
|
+
...groupBorderWidths,
|
|
150
|
+
...style
|
|
151
|
+
},
|
|
152
|
+
children: content
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
Tag.displayName = 'Tag';
|
|
156
|
+
export default Tag;
|
|
157
|
+
//# sourceMappingURL=Tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","TagV2Color","TagV2Size","TagV2SubType","TagV2Type","useNativeTokens","Block","Pressable","Slot","Text","getAccessibleName","getTagBorderRadius","getTagAccessibilityState","getGroupedBorderWidths","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TAG_LAYOUT","flexDirection","alignItems","justifyContent","alignSelf","Tag","text","size","SM","type","SUBTLE","subType","SQUARICAL","color","PRIMARY","leftSlot","rightSlot","tagGroupPosition","onPress","pressed","accessibilityLabel","testID","style","ref","tokens","isInteractive","groupBorderWidths","borderRadius","backgroundColor","String","border","textColor","accessibleName","content","children","slot","maxHeight","hidden","Boolean","undefined","fontSize","fontWeight","lineHeight","surface","minHeight","height","paddingLeft","padding","left","paddingRight","right","gap","accessibilityRole","accessibilityState","accessible","displayName"],"sourceRoot":"../../../../src","sources":["components/Tag/Tag.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAE3C,SACIC,UAAU,EACVC,SAAS,EACTC,YAAY,EACZC,SAAS,QAEN,kCAAkC;AACzC,SAASC,eAAe,QAAQ,gCAA6B;AAC7D,SAASC,KAAK,QAAQ,2BAAwB;AAC9C,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SACIC,iBAAiB,EACjBC,kBAAkB,EAClBC,wBAAwB,QACrB,gBAAa;AACpB,SAASC,sBAAsB,QAAQ,oBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAG;EACfC,aAAa,EAAE,KAAK;EACpBC,UAAU,EAAE,QAAQ;EACpBC,cAAc,EAAE,QAAQ;EACxBC,SAAS,EAAE;AACf,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,GAAG,gBAAG1B,UAAU,CAAyB,SAAS0B,GAAGA,CACvD;EACIC,IAAI;EACJC,IAAI,GAAGzB,SAAS,CAAC0B,EAAE;EACnBC,IAAI,GAAGzB,SAAS,CAAC0B,MAAM;EACvBC,OAAO,GAAG5B,YAAY,CAAC6B,SAAS;EAChCC,KAAK,GAAGhC,UAAU,CAACiC,OAAO;EAC1BC,QAAQ;EACRC,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AAC3C,IAAI,CAAC;IACxC4C,GAAG,EAAE3B,MAAM,CAAC2B;EAChB,CAAC,CAAC,EACF,CAACvB,eAAe,EAAEE,MAAM,EAAEH,YAAY,EAAEH,MAAM,EAAEjB,IAAI,CACxD,CAAC;EAED,IAAIkB,aAAa,EAAE;IACf,oBACI9B,IAAA,CAACR,SAAS;MACNoC,GAAG,EAAEA,GAAI;MAAA,GACLoB,OAAO;MACXzB,OAAO,EAAEA,OAAQ;MACjBkC,iBAAiB,EAAC,QAAQ;MAC1BhC,kBAAkB,EAAEY,cAAe;MACnCqB,kBAAkB,EAAE7D,wBAAwB,CAAC,IAAI,EAAE2B,OAAO,CAAE;MAC5DE,MAAM,EAAEA,MAAO;MACfC,KAAK,EAAE;QAAE,GAAGI,iBAAiB;QAAE,GAAGJ;MAAM,CAAE;MAAAY,QAAA,EAEzCD;IAAO,CACD,CAAC;EAEpB;EAEA,oBACItC,IAAA,CAACT,KAAK;IACFqC,GAAG,EAAEA,GAAI;IAAA,GACLoB,OAAO;IACXW,UAAU;IACVF,iBAAiB,EAAC,MAAM;IACxBhC,kBAAkB,EAAEA,kBAAmB;IACvCC,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAE;MAAE,GAAGI,iBAAiB;MAAE,GAAGJ;IAAM,CAAE;IAAAY,QAAA,EAEzCD;EAAO,CACL,CAAC;AAEhB,CAAC,CAAC;AAEF5B,GAAG,CAACkD,WAAW,GAAG,KAAK;AAEvB,eAAelD,GAAG","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","Tag","getTagBorderRadius","getAccessibleName","getTagAccessibilityState"],"sourceRoot":"../../../../src","sources":["components/Tag/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,GAAG,QAAQ,UAAO;AAEtC,SACIC,kBAAkB,EAClBC,iBAAiB,EACjBC,wBAAwB,QACrB,gBAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Tag/tag.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getGroupedBorderRadius } from "../shared/group.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Native Tag style helpers.
|
|
7
|
+
*
|
|
8
|
+
* Ported from `packages/blend/lib/components/TagV2/utils.ts`. Both functions
|
|
9
|
+
* below are pure string/logic helpers with no DOM dependency, so they are
|
|
10
|
+
* reproduced verbatim in behaviour — keeping web and native visually and
|
|
11
|
+
* semantically identical is the whole point.
|
|
12
|
+
*
|
|
13
|
+
* Web's third helper, `createKeyboardHandler` (Enter/Space → click), has no
|
|
14
|
+
* native counterpart: RN's `Pressable` handles activation itself, including
|
|
15
|
+
* for switch-control and keyboard users.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the border radius for a tag, collapsing the joined edges when the
|
|
20
|
+
* tag sits inside a group.
|
|
21
|
+
*
|
|
22
|
+
* Mirrors `getTagBorderRadius` in web `utils.ts`. The collapsing itself lives
|
|
23
|
+
* in `shared/group` because Button needs exactly the same algorithm.
|
|
24
|
+
*/
|
|
25
|
+
export function getTagBorderRadius(size, subType, tagGroupPosition, tokens) {
|
|
26
|
+
return getGroupedBorderRadius(tokens.borderRadius[size][subType], tagGroupPosition);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Build the accessible name for a tag.
|
|
31
|
+
*
|
|
32
|
+
* Mirrors `getAccessibleName` in web `utils.ts`: non-interactive tags get no
|
|
33
|
+
* explicit name (the text content is announced instead), and interactive
|
|
34
|
+
* tags fold their toggle state into the label.
|
|
35
|
+
*/
|
|
36
|
+
export function getAccessibleName(text, isInteractive, pressed) {
|
|
37
|
+
if (!isInteractive) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
let accessibleName = text;
|
|
41
|
+
if (pressed !== undefined) {
|
|
42
|
+
if (pressed === true) {
|
|
43
|
+
accessibleName = `${text}, pressed`;
|
|
44
|
+
} else if (pressed === 'mixed') {
|
|
45
|
+
accessibleName = `${text}, mixed state`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return accessibleName;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the accessibility state for a tag.
|
|
53
|
+
*
|
|
54
|
+
* `'mixed'` has no RN equivalent — RN's `selected` is a boolean — so it is
|
|
55
|
+
* reported as unselected and carried in the accessible name instead, which
|
|
56
|
+
* is what `getAccessibleName` already appends.
|
|
57
|
+
*/
|
|
58
|
+
export function getTagAccessibilityState(isInteractive, pressed) {
|
|
59
|
+
if (!isInteractive || pressed === undefined) return undefined;
|
|
60
|
+
return {
|
|
61
|
+
selected: pressed === true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=tag.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getGroupedBorderRadius","getTagBorderRadius","size","subType","tagGroupPosition","tokens","borderRadius","getAccessibleName","text","isInteractive","pressed","undefined","accessibleName","getTagAccessibilityState","selected"],"sourceRoot":"../../../../src","sources":["components/Tag/tag.utils.ts"],"mappings":";;AAKA,SAASA,sBAAsB,QAA4B,oBAAiB;;AAE5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAC9BC,IAAe,EACfC,OAAqB,EACrBC,gBAA2C,EAC3CC,MAAuB,EACjB;EACN,OAAOL,sBAAsB,CACzBK,MAAM,CAACC,YAAY,CAACJ,IAAI,CAAC,CAACC,OAAO,CAAC,EAClCC,gBACJ,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,iBAAiBA,CAC7BC,IAAY,EACZC,aAAsB,EACtBC,OAAsC,EACpB;EAClB,IAAI,CAACD,aAAa,EAAE;IAChB,OAAOE,SAAS;EACpB;EAEA,IAAIC,cAAc,GAAGJ,IAAI;EAEzB,IAAIE,OAAO,KAAKC,SAAS,EAAE;IACvB,IAAID,OAAO,KAAK,IAAI,EAAE;MAClBE,cAAc,GAAG,GAAGJ,IAAI,WAAW;IACvC,CAAC,MAAM,IAAIE,OAAO,KAAK,OAAO,EAAE;MAC5BE,cAAc,GAAG,GAAGJ,IAAI,eAAe;IAC3C;EACJ;EAEA,OAAOI,cAAc;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CACpCJ,aAAsB,EACtBC,OAAsC,EACL;EACjC,IAAI,CAACD,aAAa,IAAIC,OAAO,KAAKC,SAAS,EAAE,OAAOA,SAAS;EAC7D,OAAO;IAAEG,QAAQ,EAAEJ,OAAO,KAAK;EAAK,CAAC;AACzC","ignoreList":[]}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import { InputSizeV2 } from '@juspay/blend-design-system/node';
|
|
5
|
+
import { useNativeTokens } from "../../theme/useNativeTokens.js";
|
|
6
|
+
import { Block } from "../../primitives/Block.js";
|
|
7
|
+
import { PrimitiveInput } from "../../primitives/PrimitiveInput.js";
|
|
8
|
+
import { Slot } from "../../primitives/Slot.js";
|
|
9
|
+
import { FieldLabels } from "../shared/field/FieldLabels.js";
|
|
10
|
+
import { FieldFooter } from "../shared/field/FieldFooter.js";
|
|
11
|
+
import { getFieldState, getFieldVisualState } from "../shared/field/fieldState.js";
|
|
12
|
+
import { getTextInputNativeStyles } from "./textInput.utils.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
/**
|
|
15
|
+
* TextInput — React Native implementation of web's `TextInputV2`, and the
|
|
16
|
+
* reference consumer of the shared field chrome (`FieldLabels`,
|
|
17
|
+
* `FieldFooter`, `PrimitiveInput`) the rest of the InputsV2 family will
|
|
18
|
+
* reuse.
|
|
19
|
+
*
|
|
20
|
+
* Anatomy matches web: a column of label row, bordered field row (left
|
|
21
|
+
* slot / input / right slot), and footer — all resolved from the
|
|
22
|
+
* `TEXT_INPUTV2` token slot. Focus is component state re-resolving the
|
|
23
|
+
* container against the FOCUS tokens, replacing web's `_focus` pseudo
|
|
24
|
+
* object; the spread-only focus ring has no RN equivalent and is dropped.
|
|
25
|
+
*/
|
|
26
|
+
const TextInput = /*#__PURE__*/forwardRef(function TextInput({
|
|
27
|
+
value,
|
|
28
|
+
onChangeText,
|
|
29
|
+
label,
|
|
30
|
+
subLabel,
|
|
31
|
+
size = InputSizeV2.SM,
|
|
32
|
+
error,
|
|
33
|
+
hintText,
|
|
34
|
+
required = false,
|
|
35
|
+
disabled = false,
|
|
36
|
+
leftSlot,
|
|
37
|
+
rightSlot,
|
|
38
|
+
testID,
|
|
39
|
+
accessibilityLabel,
|
|
40
|
+
style,
|
|
41
|
+
inputRef,
|
|
42
|
+
onFocus,
|
|
43
|
+
onBlur,
|
|
44
|
+
...rest
|
|
45
|
+
}, ref) {
|
|
46
|
+
const tokens = useNativeTokens('TEXT_INPUTV2');
|
|
47
|
+
const [focused, setFocused] = useState(false);
|
|
48
|
+
|
|
49
|
+
// Labels/footer track error+disabled; the container also tracks focus.
|
|
50
|
+
const fieldState = getFieldState(error, disabled);
|
|
51
|
+
const visualState = getFieldVisualState(error, disabled, focused);
|
|
52
|
+
const styles = useMemo(() => getTextInputNativeStyles(tokens, size, visualState), [tokens, size, visualState]);
|
|
53
|
+
|
|
54
|
+
// Event types come from RN's own prop signatures — they changed shape
|
|
55
|
+
// across RN versions (FocusEvent/BlurEvent), so deriving keeps us
|
|
56
|
+
// correct on every supported peer.
|
|
57
|
+
const handleFocus = useCallback(event => {
|
|
58
|
+
setFocused(true);
|
|
59
|
+
onFocus?.(event);
|
|
60
|
+
}, [onFocus]);
|
|
61
|
+
const handleBlur = useCallback(event => {
|
|
62
|
+
setFocused(false);
|
|
63
|
+
onBlur?.(event);
|
|
64
|
+
}, [onBlur]);
|
|
65
|
+
return /*#__PURE__*/_jsxs(Block, {
|
|
66
|
+
ref: ref,
|
|
67
|
+
gap: styles.gap,
|
|
68
|
+
style: style,
|
|
69
|
+
testID: testID,
|
|
70
|
+
children: [/*#__PURE__*/_jsx(FieldLabels, {
|
|
71
|
+
label: label,
|
|
72
|
+
sublabel: subLabel,
|
|
73
|
+
required: required,
|
|
74
|
+
size: size,
|
|
75
|
+
state: fieldState,
|
|
76
|
+
tokens: tokens.topContainer,
|
|
77
|
+
testID: testID ? `${testID}-labels` : undefined
|
|
78
|
+
}), /*#__PURE__*/_jsxs(Block, {
|
|
79
|
+
flexDirection: "row",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
width: "100%",
|
|
82
|
+
testID: testID ? `${testID}-container` : undefined,
|
|
83
|
+
border: styles.container.border,
|
|
84
|
+
backgroundColor: styles.container.backgroundColor,
|
|
85
|
+
borderRadius: styles.container.borderRadius,
|
|
86
|
+
gap: styles.container.gap,
|
|
87
|
+
paddingTop: styles.container.paddingTop,
|
|
88
|
+
paddingRight: styles.container.paddingRight,
|
|
89
|
+
paddingBottom: styles.container.paddingBottom,
|
|
90
|
+
paddingLeft: styles.container.paddingLeft,
|
|
91
|
+
children: [leftSlot?.slot ? /*#__PURE__*/_jsx(Slot, {
|
|
92
|
+
maxHeight: leftSlot.maxHeight
|
|
93
|
+
// Decorative next to the labelled input, matching
|
|
94
|
+
// web's aria-hidden on input slots.
|
|
95
|
+
,
|
|
96
|
+
hidden: true,
|
|
97
|
+
testID: testID ? `${testID}-left-slot` : undefined,
|
|
98
|
+
children: leftSlot.slot
|
|
99
|
+
}) : null, /*#__PURE__*/_jsx(PrimitiveInput, {
|
|
100
|
+
ref: inputRef,
|
|
101
|
+
value: value,
|
|
102
|
+
onChangeText: onChangeText,
|
|
103
|
+
editable: !disabled,
|
|
104
|
+
fontSize: styles.text.fontSize,
|
|
105
|
+
fontWeight: styles.text.fontWeight,
|
|
106
|
+
lineHeight: styles.text.lineHeight,
|
|
107
|
+
color: styles.text.color,
|
|
108
|
+
placeholderColor: styles.placeholderColor,
|
|
109
|
+
onFocus: handleFocus,
|
|
110
|
+
onBlur: handleBlur,
|
|
111
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
112
|
+
accessibilityState: {
|
|
113
|
+
disabled
|
|
114
|
+
},
|
|
115
|
+
testID: testID ? `${testID}-input` : undefined,
|
|
116
|
+
...rest
|
|
117
|
+
}), rightSlot?.slot ? /*#__PURE__*/_jsx(Slot, {
|
|
118
|
+
maxHeight: rightSlot.maxHeight,
|
|
119
|
+
hidden: true,
|
|
120
|
+
testID: testID ? `${testID}-right-slot` : undefined,
|
|
121
|
+
children: rightSlot.slot
|
|
122
|
+
}) : null]
|
|
123
|
+
}), /*#__PURE__*/_jsx(FieldFooter, {
|
|
124
|
+
error: error,
|
|
125
|
+
hintText: hintText,
|
|
126
|
+
size: size,
|
|
127
|
+
tokens: tokens.bottomContainer,
|
|
128
|
+
testID: testID ? `${testID}-footer` : undefined
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
TextInput.displayName = 'TextInput';
|
|
133
|
+
export default TextInput;
|
|
134
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useMemo","useState","InputSizeV2","useNativeTokens","Block","PrimitiveInput","Slot","FieldLabels","FieldFooter","getFieldState","getFieldVisualState","getTextInputNativeStyles","jsx","_jsx","jsxs","_jsxs","TextInput","value","onChangeText","label","subLabel","size","SM","error","hintText","required","disabled","leftSlot","rightSlot","testID","accessibilityLabel","style","inputRef","onFocus","onBlur","rest","ref","tokens","focused","setFocused","fieldState","visualState","styles","handleFocus","event","handleBlur","gap","children","sublabel","state","topContainer","undefined","flexDirection","alignItems","width","border","container","backgroundColor","borderRadius","paddingTop","paddingRight","paddingBottom","paddingLeft","slot","maxHeight","hidden","editable","fontSize","text","fontWeight","lineHeight","color","placeholderColor","accessibilityState","bottomContainer","displayName"],"sourceRoot":"../../../../src","sources":["components/TextInput/TextInput.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAKlE,SACIC,WAAW,QAER,kCAAkC;AACzC,SAASC,eAAe,QAAQ,gCAA6B;AAC7D,SAASC,KAAK,QAAQ,2BAAwB;AAC9C,SAASC,cAAc,QAAQ,oCAAiC;AAChE,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SAASC,WAAW,QAAQ,gCAA6B;AACzD,SAASC,WAAW,QAAQ,gCAA6B;AACzD,SAASC,aAAa,EAAEC,mBAAmB,QAAQ,+BAA4B;AAC/E,SAASC,wBAAwB,QAAQ,sBAAmB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,gBAAGlB,UAAU,CAA+B,SAASkB,SAASA,CACzE;EACIC,KAAK;EACLC,YAAY;EACZC,KAAK;EACLC,QAAQ;EACRC,IAAI,GAAGnB,WAAW,CAACoB,EAAE;EACrBC,KAAK;EACLC,QAAQ;EACRC,QAAQ,GAAG,KAAK;EAChBC,QAAQ,GAAG,KAAK;EAChBC,QAAQ;EACRC,SAAS;EACTC,MAAM;EACNC,kBAAkB;EAClBC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,MAAM;EACN,GAAGC;AACP,CAAC,EACDC,GAAG,EACL;EACE,MAAMC,MAAM,GAAGlC,eAAe,CAAwB,cAAc,CAAC;EACrE,MAAM,CAACmC,OAAO,EAAEC,UAAU,CAAC,GAAGtC,QAAQ,CAAC,KAAK,CAAC;;EAE7C;EACA,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UAAE/C;QAAS,CAAE;QACjCG,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,QAAQ,GAAGsB,SAAU;QAAA,GAC3ChB;MAAI,CACX,CAAC,EAEDP,SAAS,EAAEmC,IAAI,gBACZlD,IAAA,CAACP,IAAI;QACD0D,SAAS,EAAEpC,SAAS,CAACoC,SAAU;QAC/BC,MAAM;QACNpC,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,aAAa,GAAGsB,SAAU;QAAAJ,QAAA,EAEnDnB,SAAS,CAACmC;MAAI,CACb,CAAC,GACP,IAAI;IAAA,CACL,CAAC,eAERlD,IAAA,CAACL,WAAW;MACRe,KAAK,EAAEA,KAAM;MACbC,QAAQ,EAAEA,QAAS;MACnBH,IAAI,EAAEA,IAAK;MACXgB,MAAM,EAAEA,MAAM,CAACqC,eAAgB;MAC/B7C,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,SAAS,GAAGsB;IAAU,CACnD,CAAC;EAAA,CACC,CAAC;AAEhB,CAAC,CAAC;AAEFnC,SAAS,CAAC2D,WAAW,GAAG,WAAW;AAEnC,eAAe3D,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","TextInput"],"sourceRoot":"../../../../src","sources":["components/TextInput/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,SAAS,QAAQ,gBAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/TextInput/textInput.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native TextInputV2 style resolver.
|
|
5
|
+
*
|
|
6
|
+
* Reimplements the inline resolution `TextInputV2.tsx` performs for RN. Web
|
|
7
|
+
* expresses hover/focus through styled-components pseudo-state objects; on
|
|
8
|
+
* native the field re-resolves against the current visual state (focus
|
|
9
|
+
* tracked in component state), so this returns plain token strings for one
|
|
10
|
+
* state at a time — the pattern `getButtonNativeStyles` set.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export function getTextInputNativeStyles(tokens, size, visualState) {
|
|
14
|
+
const container = tokens.inputContainer;
|
|
15
|
+
return {
|
|
16
|
+
gap: String(tokens.gap),
|
|
17
|
+
container: {
|
|
18
|
+
border: String(container.border[visualState]),
|
|
19
|
+
backgroundColor: String(container.backgroundColor[visualState]),
|
|
20
|
+
borderRadius: String(container.borderRadius[size]),
|
|
21
|
+
gap: String(container.gap),
|
|
22
|
+
paddingTop: String(container.padding.top[size]),
|
|
23
|
+
paddingRight: String(container.padding.right[size]),
|
|
24
|
+
paddingBottom: String(container.padding.bottom[size]),
|
|
25
|
+
paddingLeft: String(container.padding.left[size])
|
|
26
|
+
},
|
|
27
|
+
text: {
|
|
28
|
+
fontSize: String(container.inputText.fontSize[size]),
|
|
29
|
+
fontWeight: String(container.inputText.fontWeight[size]),
|
|
30
|
+
lineHeight: String(container.inputText.lineHeight[size]),
|
|
31
|
+
color: String(container.inputText.color[visualState])
|
|
32
|
+
},
|
|
33
|
+
placeholderColor: String(container.placeholder.color[visualState])
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=textInput.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getTextInputNativeStyles","tokens","size","visualState","container","inputContainer","gap","String","border","backgroundColor","borderRadius","paddingTop","padding","top","paddingRight","right","paddingBottom","bottom","paddingLeft","left","text","fontSize","inputText","fontWeight","lineHeight","color","placeholderColor","placeholder"],"sourceRoot":"../../../../src","sources":["components/TextInput/textInput.utils.ts"],"mappings":";;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA,OAAO,SAASA,wBAAwBA,CACpCC,MAA6B,EAC7BC,IAAiB,EACjBC,WAAyB,EACJ;EACrB,MAAMC,SAAS,GAAGH,MAA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AACL","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { InputSizeV2 } from '@juspay/blend-design-system/node';
|
|
4
|
+
import { Block } from "../../../primitives/Block.js";
|
|
5
|
+
import { Text } from "../../../primitives/Text.js";
|
|
6
|
+
import { useLiveRegionAnnounce } from "../../../a11y/useLiveRegion.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Footer under a field: the error message when erroring, else the hint.
|
|
10
|
+
*
|
|
11
|
+
* Ports web's `InputFooterV2` against the same `bottomContainer` token
|
|
12
|
+
* shape. Web marks the error `role="alert"` + `aria-live="polite"`; the
|
|
13
|
+
* native split is the Alert pattern — `accessibilityLiveRegion` for
|
|
14
|
+
* Android, an imperative announcement for iOS.
|
|
15
|
+
*/
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
export function FieldFooter({
|
|
18
|
+
error,
|
|
19
|
+
hintText,
|
|
20
|
+
size = InputSizeV2.SM,
|
|
21
|
+
tokens,
|
|
22
|
+
testID
|
|
23
|
+
}) {
|
|
24
|
+
const showError = Boolean(error?.show && error.message);
|
|
25
|
+
useLiveRegionAnnounce(showError ? error?.message : undefined, showError);
|
|
26
|
+
if (!showError && !hintText) return null;
|
|
27
|
+
return /*#__PURE__*/_jsx(Block, {
|
|
28
|
+
width: "100%",
|
|
29
|
+
testID: testID,
|
|
30
|
+
children: showError ? /*#__PURE__*/_jsx(Text, {
|
|
31
|
+
accessibilityLiveRegion: "polite",
|
|
32
|
+
color: String(tokens.errorMessage.color),
|
|
33
|
+
fontSize: tokens.errorMessage.fontSize[size],
|
|
34
|
+
fontWeight: tokens.errorMessage.fontWeight[size],
|
|
35
|
+
lineHeight: tokens.errorMessage.lineHeight[size],
|
|
36
|
+
children: error?.message
|
|
37
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
38
|
+
color: String(tokens.hintText.color.default),
|
|
39
|
+
fontSize: tokens.hintText.fontSize[size],
|
|
40
|
+
fontWeight: tokens.hintText.fontWeight[size],
|
|
41
|
+
lineHeight: tokens.hintText.lineHeight[size],
|
|
42
|
+
children: hintText
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
FieldFooter.displayName = 'FieldFooter';
|
|
47
|
+
//# sourceMappingURL=FieldFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["InputSizeV2","Block","Text","useLiveRegionAnnounce","jsx","_jsx","FieldFooter","error","hintText","size","SM","tokens","testID","showError","Boolean","show","message","undefined","width","children","accessibilityLiveRegion","color","String","errorMessage","fontSize","fontWeight","lineHeight","default","displayName"],"sourceRoot":"../../../../../src","sources":["components/shared/field/FieldFooter.tsx"],"mappings":";;AAAA,SACIA,WAAW,QAER,kCAAkC;AACzC,SAASC,KAAK,QAAQ,8BAA2B;AACjD,SAASC,IAAI,QAAQ,6BAA0B;AAC/C,SAASC,qBAAqB,QAAQ,gCAA6B;;AAGnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAiBA,OAAO,SAASC,WAAWA,CAAC;EACxBC,KAAK;EACLC,QAAQ;EACRC,IAAI,GAAGT,WAAW,CAACU,EAAE;EACrBC,MAAM;EACNC;AACc,CAAC,EAAE;EACjB,MAAMC,SAAS,GAAGC,OAAO,CAACP,KAAK,EAAEQ,IAAI,IAAIR,KAAK,CAACS,OAAO,CAAC;EAEvDb,qBAAqB,CAACU,SAAS,GAAGN,KAAK,EAAES,OAAO,GAAGC,SAAS,EAAEJ,SAAS,CAAC;EAExE,IAAI,CAACA,SAAS,IAAI,CAACL,QAAQ,EAAE,OAAO,IAAI;EAExC,oBACIH,IAAA,CAACJ,KAAK;IAACiB,KAAK,EAAC,MAAM;IAACN,MAAM,EAAEA,MAAO;IAAAO,QAAA,EAC9BN,SAAS,gBACNR,IAAA,CAACH,IAAI;MACDkB,uBAAuB,EAAC,QAAQ;MAChCC,KAAK,EAAEC,MAAM,CAACX,MAAM,CAACY,YAAY,CAACF,KAAK,CAAE;MACzCG,QAAQ,EAAEb,MAAM,CAACY,YAAY,CAACC,QAAQ,CAACf,IAAI,CAAE;MAC7CgB,UAAU,EAAEd,MAAM,CAACY,YAAY,CAACE,UAAU,CAAChB,IAAI,CAAE;MACjDiB,UAAU,EAAEf,MAAM,CAACY,YAAY,CAACG,UAAU,CAACjB,IAAI,CAAE;MAAAU,QAAA,EAEhDZ,KAAK,EAAES;IAAO,CACb,CAAC,gBAEPX,IAAA,CAACH,IAAI;MACDmB,KAAK,EAAEC,MAAM,CAACX,MAAM,CAACH,QAAQ,CAACa,KAAK,CAACM,OAAO,CAAE;MAC7CH,QAAQ,EAAEb,MAAM,CAACH,QAAQ,CAACgB,QAAQ,CAACf,IAAI,CAAE;MACzCgB,UAAU,EAAEd,MAAM,CAACH,QAAQ,CAACiB,UAAU,CAAChB,IAAI,CAAE;MAC7CiB,UAAU,EAAEf,MAAM,CAACH,QAAQ,CAACkB,UAAU,CAACjB,IAAI,CAAE;MAAAU,QAAA,EAE5CX;IAAQ,CACP;EACT,CACE,CAAC;AAEhB;AAEAF,WAAW,CAACsB,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { InputSizeV2, InputStateV2 } from '@juspay/blend-design-system/node';
|
|
4
|
+
import { Block } from "../../../primitives/Block.js";
|
|
5
|
+
import { Text } from "../../../primitives/Text.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Label row above a field: label, required marker, sublabel.
|
|
9
|
+
*
|
|
10
|
+
* Ports web's `InputLabelsV2` against the same `topContainer` token shape,
|
|
11
|
+
* with two deliberate omissions:
|
|
12
|
+
*
|
|
13
|
+
* - `helpIconText` — web wraps a help icon in `Tooltip`; native has no
|
|
14
|
+
* tooltip yet, so the prop does not exist rather than silently doing
|
|
15
|
+
* nothing (the `skeleton` precedent).
|
|
16
|
+
* - `as="label"`/`htmlFor` — no DOM. The field component instead puts the
|
|
17
|
+
* label text into the input's `accessibilityLabel`.
|
|
18
|
+
*/
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
export function FieldLabels({
|
|
21
|
+
label,
|
|
22
|
+
sublabel,
|
|
23
|
+
required = false,
|
|
24
|
+
size = InputSizeV2.SM,
|
|
25
|
+
state = InputStateV2.DEFAULT,
|
|
26
|
+
tokens,
|
|
27
|
+
testID
|
|
28
|
+
}) {
|
|
29
|
+
if (!label) return null;
|
|
30
|
+
return /*#__PURE__*/_jsxs(Block, {
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
gap: 4,
|
|
34
|
+
width: "100%",
|
|
35
|
+
testID: testID,
|
|
36
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
37
|
+
fontWeight: tokens.label.fontWeight[size],
|
|
38
|
+
fontSize: tokens.label.fontSize[size],
|
|
39
|
+
color: String(tokens.label.color[state]),
|
|
40
|
+
lineHeight: tokens.label.lineHeight[size],
|
|
41
|
+
children: label
|
|
42
|
+
}), required ?
|
|
43
|
+
/*#__PURE__*/
|
|
44
|
+
// Web renders <sup aria-hidden>*</sup>; the accessible
|
|
45
|
+
// "required" semantics live on the input's a11y props, so
|
|
46
|
+
// the marker stays visual-only here too.
|
|
47
|
+
_jsx(Text, {
|
|
48
|
+
color: String(tokens.required.color),
|
|
49
|
+
fontSize: tokens.label.fontSize[size],
|
|
50
|
+
accessibilityElementsHidden: true,
|
|
51
|
+
importantForAccessibility: "no-hide-descendants",
|
|
52
|
+
children: "*"
|
|
53
|
+
}) : null, sublabel ? /*#__PURE__*/_jsxs(Text, {
|
|
54
|
+
fontWeight: tokens.subLabel.fontWeight[size],
|
|
55
|
+
fontSize: tokens.subLabel.fontSize[size],
|
|
56
|
+
color: String(tokens.subLabel.color[state]),
|
|
57
|
+
lineHeight: tokens.subLabel.lineHeight[size],
|
|
58
|
+
children: ["(", sublabel, ")"]
|
|
59
|
+
}) : null]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
FieldLabels.displayName = 'FieldLabels';
|
|
63
|
+
//# sourceMappingURL=FieldLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["InputSizeV2","InputStateV2","Block","Text","jsx","_jsx","jsxs","_jsxs","FieldLabels","label","sublabel","required","size","SM","state","DEFAULT","tokens","testID","flexDirection","alignItems","gap","width","children","fontWeight","fontSize","color","String","lineHeight","accessibilityElementsHidden","importantForAccessibility","subLabel","displayName"],"sourceRoot":"../../../../../src","sources":["components/shared/field/FieldLabels.tsx"],"mappings":";;AAAA,SACIA,WAAW,EACXC,YAAY,QAET,kCAAkC;AACzC,SAASC,KAAK,QAAQ,8BAA2B;AACjD,SAASC,IAAI,QAAQ,6BAA0B;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAuBA,OAAO,SAASC,WAAWA,CAAC;EACxBC,KAAK;EACLC,QAAQ;EACRC,QAAQ,GAAG,KAAK;EAChBC,IAAI,GAAGZ,WAAW,CAACa,EAAE;EACrBC,KAAK,GAAGb,YAAY,CAACc,OAAO;EAC5BC,MAAM;EACNC;AACc,CAAC,EAAE;EACjB,IAAI,CAACR,KAAK,EAAE,OAAO,IAAI;EAEvB,oBACIF,KAAA,CAACL,KAAK;IACFgB,aAAa,EAAC,KAAK;IACnBC,UAAU,EAAC,QAAQ;IACnBC,GAAG,EAAE,CAAE;IACPC,KAAK,EAAC,MAAM;IACZJ,MAAM,EAAEA,MAAO;IAAAK,QAAA,gBAEfjB,IAAA,CAACF,IAAI;MACDoB,UAAU,EAAEP,MAAM,CAACP,KAAK,CAACc,UAAU,CAACX,IAAI,CAAE;MAC1CY,QAAQ,EAAER,MAAM,CAACP,KAAK,CAACe,QAAQ,CAACZ,IAAI,CAAE;MACtCa,KAAK,EAAEC,MAAM,CAACV,MAAM,CAACP,KAAK,CAACgB,KAAK,CAACX,KAAK,CAAC,CAAE;MACzCa,UAAU,EAAEX,MAAM,CAACP,KAAK,CAACkB,UAAU,CAACf,IAAI,CAAE;MAAAU,QAAA,EAEzCb;IAAK,CACJ,CAAC,EACNE,QAAQ;IAAA;IACL;IACA;IACA;IACAN,IAAA,CAACF,IAAI;MACDsB,KAAK,EAAEC,MAAM,CAACV,MAAM,CAACL,QAAQ,CAACc,KAAK,CAAE;MACrCD,QAAQ,EAAER,MAAM,CAACP,KAAK,CAACe,QAAQ,CAACZ,IAAI,CAAE;MACtCgB,2BAA2B;MAC3BC,yBAAyB,EAAC,qBAAqB;MAAAP,QAAA,EAClD;IAED,CAAM,CAAC,GACP,IAAI,EACPZ,QAAQ,gBACLH,KAAA,CAACJ,IAAI;MACDoB,UAAU,EAAEP,MAAM,CAACc,QAAQ,CAACP,UAAU,CAACX,IAAI,CAAE;MAC7CY,QAAQ,EAAER,MAAM,CAACc,QAAQ,CAACN,QAAQ,CAACZ,IAAI,CAAE;MACzCa,KAAK,EAAEC,MAAM,CAACV,MAAM,CAACc,QAAQ,CAACL,KAAK,CAACX,KAAK,CAAC,CAAE;MAC5Ca,UAAU,EAAEX,MAAM,CAACc,QAAQ,CAACH,UAAU,CAACf,IAAI,CAAE;MAAAU,QAAA,GAChD,GACI,EAACZ,QAAQ,EAAC,GACf;IAAA,CAAM,CAAC,GACP,IAAI;EAAA,CACL,CAAC;AAEhB;AAEAF,WAAW,CAACuB,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { InputStateV2 } from '@juspay/blend-design-system/node';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Input state derivation, shared by every field component.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors web's `getInputState` (`InputsV2/TextInputV2/utils.ts`) and the
|
|
9
|
+
* per-variant resolution `TextInputV2.tsx` performs inline: error always
|
|
10
|
+
* wins, then disabled, and focus applies only when nothing stronger does.
|
|
11
|
+
* `HOVER` exists in the enum but has no touch counterpart.
|
|
12
|
+
*
|
|
13
|
+
* Pure and RN-free so the whole truth table unit-tests under vitest.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** The state driving label/footer colours — web's `getInputState`. */
|
|
17
|
+
export function getFieldState(error, disabled) {
|
|
18
|
+
if (error?.show) return InputStateV2.ERROR;
|
|
19
|
+
if (disabled) return InputStateV2.DISABLED;
|
|
20
|
+
return InputStateV2.DEFAULT;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The state driving the input container's border/background/text, which
|
|
25
|
+
* unlike the label state also reflects focus.
|
|
26
|
+
*/
|
|
27
|
+
export function getFieldVisualState(error, disabled, focused) {
|
|
28
|
+
if (error?.show) return InputStateV2.ERROR;
|
|
29
|
+
if (disabled) return InputStateV2.DISABLED;
|
|
30
|
+
if (focused) return InputStateV2.FOCUS;
|
|
31
|
+
return InputStateV2.DEFAULT;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=fieldState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["InputStateV2","getFieldState","error","disabled","show","ERROR","DISABLED","DEFAULT","getFieldVisualState","focused","FOCUS"],"sourceRoot":"../../../../../src","sources":["components/shared/field/fieldState.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,kCAAkC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,OAAO,SAASC,aAAaA,CACzBC,KAAiB,EACjBC,QAAkB,EACN;EACZ,IAAID,KAAK,EAAEE,IAAI,EAAE,OAAOJ,YAAY,CAACK,KAAK;EAC1C,IAAIF,QAAQ,EAAE,OAAOH,YAAY,CAACM,QAAQ;EAC1C,OAAON,YAAY,CAACO,OAAO;AAC/B;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAC/BN,KAAiB,EACjBC,QAA6B,EAC7BM,OAAgB,EACJ;EACZ,IAAIP,KAAK,EAAEE,IAAI,EAAE,OAAOJ,YAAY,CAACK,KAAK;EAC1C,IAAIF,QAAQ,EAAE,OAAOH,YAAY,CAACM,QAAQ;EAC1C,IAAIG,OAAO,EAAE,OAAOT,YAAY,CAACU,KAAK;EACtC,OAAOV,YAAY,CAACO,OAAO;AAC/B","ignoreList":[]}
|