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,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getButtonHeight = getButtonHeight;
|
|
7
|
+
exports.getButtonNativeStyles = getButtonNativeStyles;
|
|
8
|
+
exports.getButtonPadding = getButtonPadding;
|
|
9
|
+
exports.getButtonV2BorderRadius = getButtonV2BorderRadius;
|
|
10
|
+
exports.getIconMaxHeight = getIconMaxHeight;
|
|
11
|
+
exports.getLoaderSize = getLoaderSize;
|
|
12
|
+
exports.getTextColor = getTextColor;
|
|
13
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
14
|
+
var _group = require("../shared/group.js");
|
|
15
|
+
/**
|
|
16
|
+
* Native ButtonV2 style resolver.
|
|
17
|
+
*
|
|
18
|
+
* Reimplements `packages/blend/lib/components/ButtonV2/utils.ts` for RN. Web
|
|
19
|
+
* builds a `ButtonStylesReturn` carrying `_active` / `_hover` /
|
|
20
|
+
* `_focusVisible` / `_disabled` pseudo-state maps; RN has no pseudo-selectors,
|
|
21
|
+
* so this returns the token strings per state and lets `Pressable` compose
|
|
22
|
+
* them against `{ pressed }`.
|
|
23
|
+
*
|
|
24
|
+
* `_hover` and `_focusVisible` have no native counterpart and are dropped.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Resolve padding tokens per direction.
|
|
29
|
+
* Mirrors `getButtonPadding` in web `utils.ts`.
|
|
30
|
+
*/
|
|
31
|
+
function getButtonPadding(size, buttonType, subType, tokens) {
|
|
32
|
+
return {
|
|
33
|
+
top: String(tokens.padding[_node.PaddingDirection.TOP][size][buttonType][subType]),
|
|
34
|
+
right: String(tokens.padding[_node.PaddingDirection.RIGHT][size][buttonType][subType]),
|
|
35
|
+
bottom: String(tokens.padding[_node.PaddingDirection.BOTTOM][size][buttonType][subType]),
|
|
36
|
+
left: String(tokens.padding[_node.PaddingDirection.LEFT][size][buttonType][subType])
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the border radius, collapsing joined edges inside a button group.
|
|
42
|
+
*
|
|
43
|
+
* Mirrors `getButtonV2BorderRadius` in web `utils.ts`. The collapsing itself
|
|
44
|
+
* lives in `shared/group` because Tag needs the same algorithm.
|
|
45
|
+
*/
|
|
46
|
+
function getButtonV2BorderRadius(size, buttonType, subType, buttonGroupPosition, tokens) {
|
|
47
|
+
return (0, _group.getGroupedBorderRadius)(tokens.borderRadius[size][buttonType][subType], buttonGroupPosition);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the max height for each icon slot.
|
|
52
|
+
*
|
|
53
|
+
* Mirrors `getIconMaxHeight` in web `utils.ts`, including both behaviours
|
|
54
|
+
* that were previously missing on native: the inline subType stretches slots
|
|
55
|
+
* to `100%`, and a per-slot `maxHeight` overrides the size-derived default.
|
|
56
|
+
*/
|
|
57
|
+
function getIconMaxHeight(subType, leftSlotMaxHeight, rightSlotMaxHeight, defaultMaxHeight) {
|
|
58
|
+
if (subType === _node.ButtonV2SubType.INLINE) {
|
|
59
|
+
return {
|
|
60
|
+
left: '100%',
|
|
61
|
+
right: '100%'
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
left: leftSlotMaxHeight ?? defaultMaxHeight,
|
|
66
|
+
right: rightSlotMaxHeight ?? defaultMaxHeight
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Height override for the inline subType.
|
|
72
|
+
* Mirrors `getButtonHeight` in web `utils.ts` (`fit-content` → RN `auto`).
|
|
73
|
+
*/
|
|
74
|
+
function getButtonHeight(subType) {
|
|
75
|
+
return subType === _node.ButtonV2SubType.INLINE ? 'auto' : undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Spinner size for the current button size.
|
|
80
|
+
*
|
|
81
|
+
* Web maps these to explicit pixel sizes (16/18/20 for sm/md/lg) so the
|
|
82
|
+
* loader never overflows a small button; RN's `ActivityIndicator` accepts a
|
|
83
|
+
* number on both platforms.
|
|
84
|
+
*/
|
|
85
|
+
function getLoaderSize(size) {
|
|
86
|
+
const loaderSizeMap = {
|
|
87
|
+
[_node.ButtonV2Size.SMALL]: 16,
|
|
88
|
+
[_node.ButtonV2Size.MEDIUM]: 18,
|
|
89
|
+
[_node.ButtonV2Size.LARGE]: 20
|
|
90
|
+
};
|
|
91
|
+
return loaderSizeMap[size] ?? 16;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Resolve the text/icon colour for the current state.
|
|
96
|
+
* Mirrors `getTextColor` in web `utils.ts`.
|
|
97
|
+
*/
|
|
98
|
+
function getTextColor(disabled, state, buttonType, subType, tokens) {
|
|
99
|
+
const color = tokens.text.color[buttonType][subType][disabled ? _node.ButtonV2State.DISABLED : state];
|
|
100
|
+
return color ? String(color) : 'transparent';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Compute the full native style set for a button.
|
|
105
|
+
*
|
|
106
|
+
* The native equivalent of `getButtonStyles` in web `utils.ts`.
|
|
107
|
+
*/
|
|
108
|
+
function getButtonNativeStyles(isDisabled, buttonType, subType, size, state, tokens, buttonGroupPosition) {
|
|
109
|
+
const bg = tokens.backgroundColor[buttonType][subType];
|
|
110
|
+
const borders = tokens.border[buttonType][subType];
|
|
111
|
+
const shadows = tokens.shadow[buttonType][subType];
|
|
112
|
+
return {
|
|
113
|
+
background: String(bg.default),
|
|
114
|
+
activeBackground: String(bg.active),
|
|
115
|
+
disabledBackground: String(bg.disabled),
|
|
116
|
+
border: String(borders.default),
|
|
117
|
+
activeBorder: String(borders?.active ?? ''),
|
|
118
|
+
disabledBorder: String(borders?.disabled ?? ''),
|
|
119
|
+
boxShadow: String(shadows.default),
|
|
120
|
+
activeBoxShadow: String(shadows?.active ?? 'none'),
|
|
121
|
+
textColor: getTextColor(isDisabled, state, buttonType, subType, tokens),
|
|
122
|
+
padding: getButtonPadding(size, buttonType, subType, tokens),
|
|
123
|
+
gap: String(tokens.gap),
|
|
124
|
+
groupBorderWidths: (0, _group.getGroupedBorderWidths)(buttonGroupPosition),
|
|
125
|
+
borderRadius: getButtonV2BorderRadius(size, buttonType, subType, buttonGroupPosition, tokens),
|
|
126
|
+
height: getButtonHeight(subType)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=button.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_node","require","_group","getButtonPadding","size","buttonType","subType","tokens","top","String","padding","PaddingDirection","TOP","right","RIGHT","bottom","BOTTOM","left","LEFT","getButtonV2BorderRadius","buttonGroupPosition","getGroupedBorderRadius","borderRadius","getIconMaxHeight","leftSlotMaxHeight","rightSlotMaxHeight","defaultMaxHeight","ButtonV2SubType","INLINE","getButtonHeight","undefined","getLoaderSize","loaderSizeMap","ButtonV2Size","SMALL","MEDIUM","LARGE","getTextColor","disabled","state","color","text","ButtonV2State","DISABLED","getButtonNativeStyles","isDisabled","bg","backgroundColor","borders","border","shadows","shadow","background","default","activeBackground","active","disabledBackground","activeBorder","disabledBorder","boxShadow","activeBoxShadow","textColor","gap","groupBorderWidths","getGroupedBorderWidths","height"],"sourceRoot":"../../../../src","sources":["components/Button/button.utils.ts"],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAC5BC,IAAkB,EAClBC,UAAwB,EACxBC,OAAwB,EACxBC,MAA0B,EACkC;EAC5D,OAAO;IACHC,GAAG,EAAEC,MAAM,CACPF,MAAM,CAACG,OAAO,CAACC,sBAAgB,CAACC,GAAG,CAAC,CAACR,IAAI,CAAC,CAACC,UAAU,CAAC,CAACC,OAAO,CAClE,CAAC;IACDO,KAAK,EAAEJ,MAAM,CACTF,MAAM,CAACG,OAAO,CAACC,sBAAgB,CAACG,KAAK,CAAC,CAACV,IAAI,CAAC,CAACC,UAAU,CAAC,CAACC,OAAO,CACpE,CAAC;IACDS,MAAM,EAAEN,MAAM,CACVF,MAAM,CAACG,OAAO,CAACC,sBAAgB,CAACK,MAAM,CAAC,CAACZ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IAE/CqB,SAAS,EAAElD,MAAM,CAACyC,OAAO,CAACG,OAAO,CAAC;IAClCO,eAAe,EAAEnD,MAAM,CAACyC,OAAO,EAAEK,MAAM,IAAI,MAAM,CAAC;IAElDM,SAAS,EAAExB,YAAY,CAACQ,UAAU,EAAEN,KAAK,EAAElC,UAAU,EAAEC,OAAO,EAAEC,MAAM,CAAC;IAEvEG,OAAO,EAAEP,gBAAgB,CAACC,IAAI,EAAEC,UAAU,EAAEC,OAAO,EAAEC,MAAM,CAAC;IAC5DuD,GAAG,EAAErD,MAAM,CAACF,MAAM,CAACuD,GAAG,CAAC;IACvBC,iBAAiB,EAAE,IAAAC,6BAAsB,EAAC5C,mBAAmB,CAAC;IAC9DE,YAAY,EAAEH,uBAAuB,CACjCf,IAAI,EACJC,UAAU,EACVC,OAAO,EACPc,mBAAmB,EACnBb,MACJ,CAAC;IACD0D,MAAM,EAAEpC,eAAe,CAACvB,OAAO;EACnC,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Button", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Button.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getButtonHeight", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _buttonUtils.getButtonHeight;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getButtonNativeStyles", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _buttonUtils.getButtonNativeStyles;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getButtonPadding", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _buttonUtils.getButtonPadding;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "getButtonV2BorderRadius", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _buttonUtils.getButtonV2BorderRadius;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "getIconMaxHeight", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _buttonUtils.getIconMaxHeight;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "getLoaderSize", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _buttonUtils.getLoaderSize;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "getTextColor", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _buttonUtils.getTextColor;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var _Button = _interopRequireDefault(require("./Button.js"));
|
|
55
|
+
var _buttonUtils = require("./button.utils.js");
|
|
56
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Button","_interopRequireDefault","require","_buttonUtils","e","__esModule","default"],"sourceRoot":"../../../../src","sources":["components/Button/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAQuB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Skeleton = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
|
+
var _useNativeTokens = require("../../theme/useNativeTokens.js");
|
|
11
|
+
var _useReduceMotion = require("../../motion/useReduceMotion.js");
|
|
12
|
+
var _optionalGradient = require("../../adapters/optionalGradient.js");
|
|
13
|
+
var _cssStringAdapter = require("../../adapters/cssStringAdapter.js");
|
|
14
|
+
var _skeletonUtils = require("./skeleton.utils.js");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
+
/**
|
|
18
|
+
* Skeleton — React Native implementation of web's `Skeleton`, resolving the
|
|
19
|
+
* same themed `SKELETON` token slot (base/highlight colours, duration).
|
|
20
|
+
*
|
|
21
|
+
* Two usages, matching web:
|
|
22
|
+
*
|
|
23
|
+
* - **Block**: `<Skeleton width={120} height={16} />` — a placeholder box.
|
|
24
|
+
* - **Wrap**: `<Skeleton>{content}</Skeleton>` — the content keeps its
|
|
25
|
+
* layout but renders invisible, with the skeleton surface painted over
|
|
26
|
+
* it. This is what restores the `skeleton` prop parity on Button and Tag.
|
|
27
|
+
*
|
|
28
|
+
* Variants: `pulse` animates opacity between highlight and base; `wave` and
|
|
29
|
+
* `shimmer` sweep a highlight gradient across the box (requiring the
|
|
30
|
+
* optional `expo-linear-gradient` — absent, they degrade to pulse; web's
|
|
31
|
+
* `::after` sweep has no other RN expression). OS reduce-motion renders a
|
|
32
|
+
* static base-coloured box.
|
|
33
|
+
*
|
|
34
|
+
* Hidden from assistive tech: a skeleton is a visual placeholder, and the
|
|
35
|
+
* owning component announces its loading state (the Button/Alert pattern).
|
|
36
|
+
*/
|
|
37
|
+
const SkeletonImpl = ({
|
|
38
|
+
variant = 'pulse',
|
|
39
|
+
shape = 'rectangle',
|
|
40
|
+
width,
|
|
41
|
+
height,
|
|
42
|
+
borderRadius,
|
|
43
|
+
children,
|
|
44
|
+
style,
|
|
45
|
+
testID
|
|
46
|
+
}) => {
|
|
47
|
+
const tokens = (0, _useNativeTokens.useNativeTokens)('SKELETON');
|
|
48
|
+
const reduceMotion = (0, _useReduceMotion.useReduceMotion)();
|
|
49
|
+
const duration = (0, _skeletonUtils.resolveSkeletonDuration)(tokens);
|
|
50
|
+
const baseColor = String(tokens.colors.base);
|
|
51
|
+
const highlightColor = String(tokens.colors.highlight);
|
|
52
|
+
const radius = borderRadius ?? (0, _skeletonUtils.resolveSkeletonRadius)(shape, tokens, width, height);
|
|
53
|
+
|
|
54
|
+
// Sweep needs the measured box; pulse does not.
|
|
55
|
+
const [measuredWidth, setMeasuredWidth] = (0, _react.useState)(0);
|
|
56
|
+
const onLayout = (0, _react.useCallback)(event => {
|
|
57
|
+
setMeasuredWidth(event.nativeEvent.layout.width);
|
|
58
|
+
}, []);
|
|
59
|
+
const canSweep = (variant === 'wave' || variant === 'shimmer') && _optionalGradient.LinearGradient !== null && !reduceMotion;
|
|
60
|
+
const pulses = !reduceMotion && !canSweep;
|
|
61
|
+
const progress = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
62
|
+
(0, _react.useEffect)(() => {
|
|
63
|
+
if (reduceMotion) {
|
|
64
|
+
(0, _reactNativeReanimated.cancelAnimation)(progress);
|
|
65
|
+
progress.value = 0;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
progress.value = 0;
|
|
69
|
+
progress.value = (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withTiming)(1, {
|
|
70
|
+
duration,
|
|
71
|
+
easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease)
|
|
72
|
+
}), -1,
|
|
73
|
+
// Pulse breathes in and out; the sweep restarts from the left.
|
|
74
|
+
!canSweep);
|
|
75
|
+
return () => (0, _reactNativeReanimated.cancelAnimation)(progress);
|
|
76
|
+
}, [progress, duration, reduceMotion, canSweep]);
|
|
77
|
+
const pulseStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
78
|
+
opacity: pulses ? 1 - progress.value * 0.5 : 1
|
|
79
|
+
}), [pulses]);
|
|
80
|
+
const sweepStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
81
|
+
transform: [{
|
|
82
|
+
translateX: canSweep ? -measuredWidth + progress.value * 2 * measuredWidth : 0
|
|
83
|
+
}]
|
|
84
|
+
}), [canSweep, measuredWidth]);
|
|
85
|
+
const boxStyle = (0, _react.useMemo)(() => ({
|
|
86
|
+
backgroundColor: baseColor,
|
|
87
|
+
borderRadius: radius,
|
|
88
|
+
overflow: 'hidden',
|
|
89
|
+
...(children ? null : {
|
|
90
|
+
width: (0, _cssStringAdapter.parseSize)(width) ?? undefined,
|
|
91
|
+
height: (0, _cssStringAdapter.parseSize)(height) ?? undefined
|
|
92
|
+
})
|
|
93
|
+
}), [baseColor, radius, children, width, height]);
|
|
94
|
+
const surface = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
95
|
+
pointerEvents: "none",
|
|
96
|
+
onLayout: canSweep ? onLayout : undefined,
|
|
97
|
+
style: [children ? styles.fill : null, boxStyle, pulseStyle],
|
|
98
|
+
testID: testID ? `${testID}-surface` : undefined,
|
|
99
|
+
children: canSweep && measuredWidth > 0 && _optionalGradient.LinearGradient ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
100
|
+
style: [_reactNative.StyleSheet.absoluteFill, sweepStyle],
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_optionalGradient.LinearGradient, {
|
|
102
|
+
colors: [baseColor, highlightColor, baseColor],
|
|
103
|
+
locations: [0.2, 0.5, 0.8],
|
|
104
|
+
start: {
|
|
105
|
+
x: 0,
|
|
106
|
+
y: 0.5
|
|
107
|
+
},
|
|
108
|
+
end: {
|
|
109
|
+
x: 1,
|
|
110
|
+
y: 0.5
|
|
111
|
+
},
|
|
112
|
+
style: styles.fill
|
|
113
|
+
})
|
|
114
|
+
}) : null
|
|
115
|
+
});
|
|
116
|
+
if (!children) {
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
118
|
+
testID: testID,
|
|
119
|
+
style: style,
|
|
120
|
+
accessible: false,
|
|
121
|
+
importantForAccessibility: "no-hide-descendants",
|
|
122
|
+
accessibilityElementsHidden: true,
|
|
123
|
+
children: surface
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
127
|
+
testID: testID,
|
|
128
|
+
style: style,
|
|
129
|
+
pointerEvents: "none",
|
|
130
|
+
accessible: false,
|
|
131
|
+
importantForAccessibility: "no-hide-descendants",
|
|
132
|
+
accessibilityElementsHidden: true,
|
|
133
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
134
|
+
style: styles.hiddenContent,
|
|
135
|
+
children: children
|
|
136
|
+
}), surface]
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
const Skeleton = exports.Skeleton = /*#__PURE__*/_react.default.memo(SkeletonImpl);
|
|
140
|
+
Skeleton.displayName = 'Skeleton';
|
|
141
|
+
const styles = _reactNative.StyleSheet.create({
|
|
142
|
+
hiddenContent: {
|
|
143
|
+
opacity: 0
|
|
144
|
+
},
|
|
145
|
+
fill: {
|
|
146
|
+
position: 'absolute',
|
|
147
|
+
top: 0,
|
|
148
|
+
right: 0,
|
|
149
|
+
bottom: 0,
|
|
150
|
+
left: 0
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
var _default = exports.default = Skeleton;
|
|
154
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_useNativeTokens","_useReduceMotion","_optionalGradient","_cssStringAdapter","_skeletonUtils","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SkeletonImpl","variant","shape","width","height","borderRadius","children","style","testID","tokens","useNativeTokens","reduceMotion","useReduceMotion","duration","resolveSkeletonDuration","baseColor","String","colors","base","highlightColor","highlight","radius","resolveSkeletonRadius","measuredWidth","setMeasuredWidth","useState","onLayout","useCallback","event","nativeEvent","layout","canSweep","LinearGradient","pulses","progress","useSharedValue","useEffect","cancelAnimation","value","withRepeat","withTiming","easing","Easing","inOut","ease","pulseStyle","useAnimatedStyle","opacity","sweepStyle","transform","translateX","boxStyle","useMemo","backgroundColor","overflow","parseSize","undefined","surface","jsx","View","pointerEvents","styles","fill","StyleSheet","absoluteFill","locations","start","x","y","end","accessible","importantForAccessibility","accessibilityElementsHidden","jsxs","hiddenContent","Skeleton","exports","React","memo","displayName","create","position","top","right","bottom","left","_default"],"sourceRoot":"../../../../src","sources":["components/Skeleton/Skeleton.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,O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KAAK,EAAEA,KAAM;MACb+D,UAAU,EAAE,KAAM;MAClBC,yBAAyB,EAAC,qBAAqB;MAC/CC,2BAA2B;MAAAlE,QAAA,EAE1BmD;IAAO,CACN,CAAC;EAEf;EAEA,oBACI,IAAA7E,WAAA,CAAA6F,IAAA,EAACpG,YAAA,CAAAsF,IAAI;IACDnD,MAAM,EAAEA,MAAO;IACfD,KAAK,EAAEA,KAAM;IACbqD,aAAa,EAAC,MAAM;IACpBU,UAAU,EAAE,KAAM;IAClBC,yBAAyB,EAAC,qBAAqB;IAC/CC,2BAA2B;IAAAlE,QAAA,gBAG3B,IAAA1B,WAAA,CAAA8E,GAAA,EAACrF,YAAA,CAAAsF,IAAI;MAACpD,KAAK,EAAEsD,MAAM,CAACa,aAAc;MAAApE,QAAA,EAAEA;IAAQ,CAAO,CAAC,EACnDmD,OAAO;EAAA,CACN,CAAC;AAEf,CAAC;AAEM,MAAMkB,QAAQ,GAAAC,OAAA,CAAAD,QAAA,gBAAGE,cAAK,CAACC,IAAI,CAAC9E,YAAY,CAAC;AAChD2E,QAAQ,CAACI,WAAW,GAAG,UAAU;AAEjC,MAAMlB,MAAM,GAAGE,uBAAU,CAACiB,MAAM,CAAC;EAC7BN,aAAa,EAAE;IAAE3B,OAAO,EAAE;EAAE,CAAC;EAC7Be,IAAI,EAAE;IAAEmB,QAAQ,EAAE,UAAU;IAAEC,GAAG,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE,CAAC;IAAEC,IAAI,EAAE;EAAE;AACvE,CAAC,CAAC;AAAA,IAAAC,QAAA,GAAAV,OAAA,CAAArF,OAAA,GAEaoF,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Skeleton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Skeleton.Skeleton;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Skeleton.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _Skeleton = _interopRequireWildcard(require("./Skeleton.js"));
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Skeleton","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sourceRoot":"../../../../src","sources":["components/Skeleton/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8C,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Skeleton/skeleton.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SKELETON_FALLBACK_DURATION = void 0;
|
|
7
|
+
exports.resolveSkeletonDuration = resolveSkeletonDuration;
|
|
8
|
+
exports.resolveSkeletonRadius = resolveSkeletonRadius;
|
|
9
|
+
var _cssStringAdapter = require("../../adapters/cssStringAdapter.js");
|
|
10
|
+
/**
|
|
11
|
+
* Pure resolution for the native Skeleton — vitest-testable, worklet-free.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Default when the token duration cannot be parsed. */
|
|
15
|
+
const SKELETON_FALLBACK_DURATION = exports.SKELETON_FALLBACK_DURATION = 1500;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Animation cycle length in milliseconds, from the token's CSS duration
|
|
19
|
+
* string (`"1.5s"`).
|
|
20
|
+
*/
|
|
21
|
+
function resolveSkeletonDuration(tokens) {
|
|
22
|
+
return (0, _cssStringAdapter.parseDuration)(tokens.animation.duration) ?? SKELETON_FALLBACK_DURATION;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Border radius for a shape.
|
|
27
|
+
*
|
|
28
|
+
* The `circle` token is CSS `"50%"`, which RN cannot express — a circle
|
|
29
|
+
* needs a numeric radius of half the box. When the box size is unknown
|
|
30
|
+
* (string sizes, wrap mode) a large radius produces the same pill/circle
|
|
31
|
+
* silhouette, the same trick web's `radius.full` relies on.
|
|
32
|
+
*/
|
|
33
|
+
function resolveSkeletonRadius(shape, tokens, width, height) {
|
|
34
|
+
if (shape === 'circle') {
|
|
35
|
+
const w = typeof width === 'number' ? width : (0, _cssStringAdapter.parseSize)(String(width));
|
|
36
|
+
const h = typeof height === 'number' ? height : (0, _cssStringAdapter.parseSize)(String(height));
|
|
37
|
+
if (typeof w === 'number' && typeof h === 'number') {
|
|
38
|
+
return Math.min(w, h) / 2;
|
|
39
|
+
}
|
|
40
|
+
return 9999;
|
|
41
|
+
}
|
|
42
|
+
const parsed = (0, _cssStringAdapter.parseBorderRadius)(tokens.borderRadius[shape]);
|
|
43
|
+
return typeof parsed === 'number' ? parsed : 0;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=skeleton.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_cssStringAdapter","require","SKELETON_FALLBACK_DURATION","exports","resolveSkeletonDuration","tokens","parseDuration","animation","duration","resolveSkeletonRadius","shape","width","height","w","parseSize","String","h","Math","min","parsed","parseBorderRadius","borderRadius"],"sourceRoot":"../../../../src","sources":["components/Skeleton/skeleton.utils.ts"],"mappings":";;;;;;;;AAIA,IAAAA,iBAAA,GAAAC,OAAA;AAMA;AACA;AACA;;AAEA;AACO,MAAMC,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAG,IAAI;;AAE9C;AACA;AACA;AACA;AACO,SAASE,uBAAuBA,CAACC,MAA0B,EAAU;EACxE,OACI,IAAAC,+BAAa,EAACD,MAAM,CAACE,SAAS,CAACC,QAA2B,CAAC,IAC3DN,0BAA0B;AAElC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,qBAAqBA,CACjCC,KAAoB,EACpBL,MAA0B,EAC1BM,KAAuB,EACvBC,MAAwB,EAClB;EACN,IAAIF,KAAK,KAAK,QAAQ,EAAE;IACpB,MAAMG,CAAC,GAAG,OAAOF,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,IAAAG,2BAAS,EAACC,MAAM,CAACJ,KAAK,CAAC,CAAC;IACtE,MAAMK,CAAC,GACH,OAAOJ,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,IAAAE,2BAAS,EAACC,MAAM,CAACH,MAAM,CAAC,CAAC;IACnE,IAAI,OAAOC,CAAC,KAAK,QAAQ,IAAI,OAAOG,CAAC,KAAK,QAAQ,EAAE;MAChD,OAAOC,IAAI,CAACC,GAAG,CAACL,CAAC,EAAEG,CAAC,CAAC,GAAG,CAAC;IAC7B;IACA,OAAO,IAAI;EACf;EACA,MAAMG,MAAM,GAAG,IAAAC,mCAAiB,EAC5Bf,MAAM,CAACgB,YAAY,CAACX,KAAK,CAC7B,CAAC;EACD,OAAO,OAAOS,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,CAAC;AAClD","ignoreList":[]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _node = require("@juspay/blend-design-system/node");
|
|
9
|
+
var _useNativeTokens = require("../../theme/useNativeTokens.js");
|
|
10
|
+
var _Block = require("../../primitives/Block.js");
|
|
11
|
+
var _Pressable = require("../../primitives/Pressable.js");
|
|
12
|
+
var _Slot = require("../../primitives/Slot.js");
|
|
13
|
+
var _Text = require("../../primitives/Text.js");
|
|
14
|
+
var _tagUtils = require("./tag.utils.js");
|
|
15
|
+
var _group = require("../shared/group.js");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* Layout that never varies with tokens or props.
|
|
19
|
+
*
|
|
20
|
+
* Hoisted to module scope so it is allocated once rather than per render.
|
|
21
|
+
* `alignSelf: 'flex-start'` is RN's equivalent of web's `width: fit-content`
|
|
22
|
+
* on an inline-flex element — shrink-to-fit inside a column parent.
|
|
23
|
+
*/
|
|
24
|
+
const TAG_LAYOUT = {
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
alignSelf: 'flex-start'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Tag — React Native implementation of web's `TagV2`.
|
|
33
|
+
*
|
|
34
|
+
* Tokens resolve through `useNativeTokens('TAGV2')`, the native counterpart
|
|
35
|
+
* of web's `useResponsiveTokens('TAGV2')`, so theme and per-slot overrides
|
|
36
|
+
* come from `BlendNativeProvider` rather than a per-component prop.
|
|
37
|
+
*
|
|
38
|
+
* Like web, the rendered element depends on interactivity: web picks
|
|
39
|
+
* `PrimitiveButton` when `onClick` is supplied and `Block` otherwise; native
|
|
40
|
+
* picks `Pressable` vs `Block`. Both branches resolve their styles through
|
|
41
|
+
* the same `resolveSurfaceStyle`, so the two render identically apart from
|
|
42
|
+
* press feedback.
|
|
43
|
+
*
|
|
44
|
+
* TagV2's tokens contain no gradients, shadows, or state matrix, so this
|
|
45
|
+
* component needs no native module — it is pure JS.
|
|
46
|
+
*/
|
|
47
|
+
const Tag = /*#__PURE__*/(0, _react.forwardRef)(function Tag({
|
|
48
|
+
text,
|
|
49
|
+
size = _node.TagV2Size.SM,
|
|
50
|
+
type = _node.TagV2Type.SUBTLE,
|
|
51
|
+
subType = _node.TagV2SubType.SQUARICAL,
|
|
52
|
+
color = _node.TagV2Color.PRIMARY,
|
|
53
|
+
leftSlot,
|
|
54
|
+
rightSlot,
|
|
55
|
+
tagGroupPosition,
|
|
56
|
+
onPress,
|
|
57
|
+
pressed,
|
|
58
|
+
accessibilityLabel,
|
|
59
|
+
testID,
|
|
60
|
+
style
|
|
61
|
+
}, ref) {
|
|
62
|
+
const tokens = (0, _useNativeTokens.useNativeTokens)('TAGV2');
|
|
63
|
+
const isInteractive = typeof onPress === 'function';
|
|
64
|
+
|
|
65
|
+
// Grouped members drop their shared edges so a seam is one line wide.
|
|
66
|
+
const groupBorderWidths = (0, _react.useMemo)(() => (0, _group.getGroupedBorderWidths)(tagGroupPosition), [tagGroupPosition]);
|
|
67
|
+
const borderRadius = (0, _react.useMemo)(() => (0, _tagUtils.getTagBorderRadius)(size, subType, tagGroupPosition, tokens), [size, subType, tagGroupPosition, tokens]);
|
|
68
|
+
const backgroundColor = String(tokens.backgroundColor[type][color]);
|
|
69
|
+
const border = String(tokens.border[type][color]);
|
|
70
|
+
const textColor = String(tokens.text.color[type][color]);
|
|
71
|
+
|
|
72
|
+
// Slot icons are tinted to match the label. On web this happens
|
|
73
|
+
// implicitly — `Block`'s `color` becomes CSS `color` and SVGs inherit it
|
|
74
|
+
// through `currentColor`. RN has no such inheritance, so `Slot` hands the
|
|
75
|
+
// colour to the icon element explicitly.
|
|
76
|
+
const accessibleName = accessibilityLabel ?? (0, _tagUtils.getAccessibleName)(text, isInteractive, pressed);
|
|
77
|
+
const content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
78
|
+
children: [leftSlot?.slot ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Slot.Slot, {
|
|
79
|
+
color: textColor,
|
|
80
|
+
maxHeight: leftSlot.maxHeight ?? tokens.leftSlot.maxHeight[size]
|
|
81
|
+
// Matches web's `aria-hidden` on slots accompanying text:
|
|
82
|
+
// the label already carries the accessible name.
|
|
83
|
+
,
|
|
84
|
+
hidden: Boolean(text),
|
|
85
|
+
testID: testID ? `${testID}-left-slot` : undefined,
|
|
86
|
+
children: leftSlot.slot
|
|
87
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
|
|
88
|
+
fontSize: tokens.text.fontSize[size],
|
|
89
|
+
fontWeight: tokens.text.fontWeight[size],
|
|
90
|
+
lineHeight: tokens.text.lineHeight[size],
|
|
91
|
+
color: textColor,
|
|
92
|
+
children: text
|
|
93
|
+
}), rightSlot?.slot ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Slot.Slot, {
|
|
94
|
+
color: textColor,
|
|
95
|
+
maxHeight: rightSlot.maxHeight ?? tokens.rightSlot.maxHeight[size],
|
|
96
|
+
hidden: Boolean(text),
|
|
97
|
+
testID: testID ? `${testID}-right-slot` : undefined,
|
|
98
|
+
children: rightSlot.slot
|
|
99
|
+
}) : null]
|
|
100
|
+
});
|
|
101
|
+
const surface = (0, _react.useMemo)(() => ({
|
|
102
|
+
...TAG_LAYOUT,
|
|
103
|
+
backgroundColor,
|
|
104
|
+
border,
|
|
105
|
+
borderRadius,
|
|
106
|
+
// The height token is applied as `minHeight`, not `height`.
|
|
107
|
+
//
|
|
108
|
+
// At the default font scale the result is identical to web: the
|
|
109
|
+
// line height is shorter than the token height, so the box renders
|
|
110
|
+
// at exactly `minHeight` with the line centred. But RN respects OS
|
|
111
|
+
// font scaling (Dynamic Type), and a fixed `height` clips scaled
|
|
112
|
+
// text — the package policy is to let controls grow instead
|
|
113
|
+
// (see `primitives/Text.tsx`).
|
|
114
|
+
//
|
|
115
|
+
// Vertical padding is still deliberately NOT applied. The tokens
|
|
116
|
+
// define both a height and vertical padding, and the padding
|
|
117
|
+
// leaves a content box shorter than the text's own line height
|
|
118
|
+
// (sm: 14px box vs 18px line). On web that is harmless — the line
|
|
119
|
+
// box overflows the padding box and `overflow: visible` shows it.
|
|
120
|
+
// RN clips instead: descenders ("p" in primary, "g" in warning)
|
|
121
|
+
// were sheared off on iOS while react-native-web rendered fine.
|
|
122
|
+
// With a centred single line the padding is visually inert on web
|
|
123
|
+
// anyway, so dropping it reproduces web's result exactly.
|
|
124
|
+
minHeight: tokens.height[size],
|
|
125
|
+
paddingLeft: tokens.padding.left[size],
|
|
126
|
+
paddingRight: tokens.padding.right[size],
|
|
127
|
+
gap: tokens.gap
|
|
128
|
+
}), [backgroundColor, border, borderRadius, tokens, size]);
|
|
129
|
+
if (isInteractive) {
|
|
130
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.Pressable, {
|
|
131
|
+
ref: ref,
|
|
132
|
+
...surface,
|
|
133
|
+
onPress: onPress,
|
|
134
|
+
accessibilityRole: "button",
|
|
135
|
+
accessibilityLabel: accessibleName,
|
|
136
|
+
accessibilityState: (0, _tagUtils.getTagAccessibilityState)(true, pressed),
|
|
137
|
+
testID: testID,
|
|
138
|
+
style: {
|
|
139
|
+
...groupBorderWidths,
|
|
140
|
+
...style
|
|
141
|
+
},
|
|
142
|
+
children: content
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Block.Block, {
|
|
146
|
+
ref: ref,
|
|
147
|
+
...surface,
|
|
148
|
+
accessible: true,
|
|
149
|
+
accessibilityRole: "text",
|
|
150
|
+
accessibilityLabel: accessibilityLabel,
|
|
151
|
+
testID: testID,
|
|
152
|
+
style: {
|
|
153
|
+
...groupBorderWidths,
|
|
154
|
+
...style
|
|
155
|
+
},
|
|
156
|
+
children: content
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
Tag.displayName = 'Tag';
|
|
160
|
+
var _default = exports.default = Tag;
|
|
161
|
+
//# sourceMappingURL=Tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_node","_useNativeTokens","_Block","_Pressable","_Slot","_Text","_tagUtils","_group","_jsxRuntime","TAG_LAYOUT","flexDirection","alignItems","justifyContent","alignSelf","Tag","forwardRef","text","size","TagV2Size","SM","type","TagV2Type","SUBTLE","subType","TagV2SubType","SQUARICAL","color","TagV2Color","PRIMARY","leftSlot","rightSlot","tagGroupPosition","onPress","pressed","accessibilityLabel","testID","style","ref","tokens","useNativeTokens","isInteractive","groupBorderWidths","useMemo","getGroupedBorderWidths","borderRadius","getTagBorderRadius","backgroundColor","String","border","textColor","accessibleName","getAccessibleName","content","jsxs","Fragment","children","slot","jsx","Slot","maxHeight","hidden","Boolean","undefined","Text","fontSize","fontWeight","lineHeight","surface","minHeight","height","paddingLeft","padding","left","paddingRight","right","gap","Pressable","accessibilityRole","accessibilityState","getTagAccessibilityState","Block","accessible","displayName","_default","exports","default"],"sourceRoot":"../../../../src","sources":["components/Tag/Tag.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAOA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AAAwD,IAAAS,WAAA,GAAAT,OAAA;AAGxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMU,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,G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