@coze-arch/cli 0.0.10 → 0.0.11
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/lib/__templates__/expo/AGENTS.md +3 -3
- package/lib/__templates__/expo/README.md +3 -3
- package/lib/__templates__/expo/client/components/Provider.tsx +4 -1
- package/lib/__templates__/expo/client/components/Screen.tsx +4 -1
- package/lib/__templates__/expo/client/eslint.config.mjs +2 -0
- package/lib/__templates__/expo/client/global.css +1 -0
- package/lib/__templates__/expo/client/heroui/components/accordion/accordion.animation.ts +178 -0
- package/lib/__templates__/expo/client/heroui/components/accordion/accordion.constants.ts +62 -0
- package/lib/__templates__/expo/client/heroui/components/accordion/accordion.md +437 -0
- package/lib/__templates__/expo/client/heroui/components/accordion/accordion.styles.ts +95 -0
- package/lib/__templates__/expo/client/heroui/components/accordion/accordion.tsx +340 -0
- package/lib/__templates__/expo/client/heroui/components/accordion/accordion.types.ts +267 -0
- package/lib/__templates__/expo/client/heroui/components/accordion/index.ts +17 -0
- package/lib/__templates__/expo/client/heroui/components/alert/alert.constants.ts +13 -0
- package/lib/__templates__/expo/client/heroui/components/alert/alert.hooks.ts +28 -0
- package/lib/__templates__/expo/client/heroui/components/alert/alert.md +263 -0
- package/lib/__templates__/expo/client/heroui/components/alert/alert.styles.ts +65 -0
- package/lib/__templates__/expo/client/heroui/components/alert/alert.tsx +181 -0
- package/lib/__templates__/expo/client/heroui/components/alert/alert.types.ts +99 -0
- package/lib/__templates__/expo/client/heroui/components/alert/alert.utils.tsx +25 -0
- package/lib/__templates__/expo/client/heroui/components/alert/default-icon.tsx +28 -0
- package/lib/__templates__/expo/client/heroui/components/alert/index.ts +15 -0
- package/lib/__templates__/expo/client/heroui/components/alert/success-icon.tsx +28 -0
- package/lib/__templates__/expo/client/heroui/components/alert/warning-icon.tsx +28 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/avatar.animation.ts +123 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/avatar.constants.ts +19 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/avatar.context.ts +11 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/avatar.md +386 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/avatar.styles.ts +145 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/avatar.tsx +307 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/avatar.types.ts +239 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/index.ts +13 -0
- package/lib/__templates__/expo/client/heroui/components/avatar/person-icon.tsx +23 -0
- package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.animation.ts +42 -0
- package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.constants.ts +13 -0
- package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.md +349 -0
- package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.styles.ts +66 -0
- package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.tsx +351 -0
- package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.types.ts +150 -0
- package/lib/__templates__/expo/client/heroui/components/bottom-sheet/index.ts +16 -0
- package/lib/__templates__/expo/client/heroui/components/button/button.constants.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/button/button.md +381 -0
- package/lib/__templates__/expo/client/heroui/components/button/button.styles.ts +89 -0
- package/lib/__templates__/expo/client/heroui/components/button/button.tsx +284 -0
- package/lib/__templates__/expo/client/heroui/components/button/button.types.ts +175 -0
- package/lib/__templates__/expo/client/heroui/components/button/button.utils.ts +34 -0
- package/lib/__templates__/expo/client/heroui/components/button/index.ts +9 -0
- package/lib/__templates__/expo/client/heroui/components/card/card.constants.ts +11 -0
- package/lib/__templates__/expo/client/heroui/components/card/card.md +186 -0
- package/lib/__templates__/expo/client/heroui/components/card/card.styles.ts +35 -0
- package/lib/__templates__/expo/client/heroui/components/card/card.tsx +153 -0
- package/lib/__templates__/expo/client/heroui/components/card/card.types.ts +77 -0
- package/lib/__templates__/expo/client/heroui/components/card/index.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.animation.ts +202 -0
- package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.md +311 -0
- package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.styles.ts +105 -0
- package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.tsx +251 -0
- package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.types.ts +216 -0
- package/lib/__templates__/expo/client/heroui/components/checkbox/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/chip/chip.animation.ts +18 -0
- package/lib/__templates__/expo/client/heroui/components/chip/chip.constants.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/chip/chip.md +190 -0
- package/lib/__templates__/expo/client/heroui/components/chip/chip.styles.ts +234 -0
- package/lib/__templates__/expo/client/heroui/components/chip/chip.tsx +125 -0
- package/lib/__templates__/expo/client/heroui/components/chip/chip.types.ts +69 -0
- package/lib/__templates__/expo/client/heroui/components/chip/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/close-button/close-button.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/close-button/close-button.md +109 -0
- package/lib/__templates__/expo/client/heroui/components/close-button/close-button.styles.ts +13 -0
- package/lib/__templates__/expo/client/heroui/components/close-button/close-button.tsx +57 -0
- package/lib/__templates__/expo/client/heroui/components/close-button/close-button.types.ts +30 -0
- package/lib/__templates__/expo/client/heroui/components/close-button/index.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/control-field.animation.ts +18 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/control-field.constants.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/control-field.context.ts +14 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/control-field.md +241 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/control-field.styles.ts +15 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/control-field.tsx +245 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/control-field.types.ts +67 -0
- package/lib/__templates__/expo/client/heroui/components/control-field/index.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/description/description.animation.ts +53 -0
- package/lib/__templates__/expo/client/heroui/components/description/description.constants.ts +30 -0
- package/lib/__templates__/expo/client/heroui/components/description/description.md +129 -0
- package/lib/__templates__/expo/client/heroui/components/description/description.styles.ts +25 -0
- package/lib/__templates__/expo/client/heroui/components/description/description.tsx +81 -0
- package/lib/__templates__/expo/client/heroui/components/description/description.types.ts +77 -0
- package/lib/__templates__/expo/client/heroui/components/description/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/dialog/dialog.animation.ts +9 -0
- package/lib/__templates__/expo/client/heroui/components/dialog/dialog.constants.ts +13 -0
- package/lib/__templates__/expo/client/heroui/components/dialog/dialog.md +288 -0
- package/lib/__templates__/expo/client/heroui/components/dialog/dialog.styles.ts +77 -0
- package/lib/__templates__/expo/client/heroui/components/dialog/dialog.tsx +379 -0
- package/lib/__templates__/expo/client/heroui/components/dialog/dialog.types.ts +199 -0
- package/lib/__templates__/expo/client/heroui/components/dialog/index.ts +12 -0
- package/lib/__templates__/expo/client/heroui/components/field-error/field-error.animation.ts +50 -0
- package/lib/__templates__/expo/client/heroui/components/field-error/field-error.constants.ts +31 -0
- package/lib/__templates__/expo/client/heroui/components/field-error/field-error.md +204 -0
- package/lib/__templates__/expo/client/heroui/components/field-error/field-error.styles.ts +23 -0
- package/lib/__templates__/expo/client/heroui/components/field-error/field-error.tsx +91 -0
- package/lib/__templates__/expo/client/heroui/components/field-error/field-error.types.ts +79 -0
- package/lib/__templates__/expo/client/heroui/components/field-error/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/input/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/input/input.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/input/input.md +193 -0
- package/lib/__templates__/expo/client/heroui/components/input/input.styles.ts +51 -0
- package/lib/__templates__/expo/client/heroui/components/input/input.tsx +96 -0
- package/lib/__templates__/expo/client/heroui/components/input/input.types.ts +44 -0
- package/lib/__templates__/expo/client/heroui/components/input-group/index.ts +9 -0
- package/lib/__templates__/expo/client/heroui/components/input-group/input-group.animation.ts +14 -0
- package/lib/__templates__/expo/client/heroui/components/input-group/input-group.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/input-group/input-group.md +197 -0
- package/lib/__templates__/expo/client/heroui/components/input-group/input-group.styles.ts +31 -0
- package/lib/__templates__/expo/client/heroui/components/input-group/input-group.tsx +239 -0
- package/lib/__templates__/expo/client/heroui/components/input-group/input-group.types.ts +98 -0
- package/lib/__templates__/expo/client/heroui/components/input-otp/index.ts +9 -0
- package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.animation.ts +199 -0
- package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.constants.ts +12 -0
- package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.md +376 -0
- package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.styles.ts +68 -0
- package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.tsx +414 -0
- package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.types.ts +275 -0
- package/lib/__templates__/expo/client/heroui/components/label/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/label/label.animation.ts +18 -0
- package/lib/__templates__/expo/client/heroui/components/label/label.constants.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/label/label.md +187 -0
- package/lib/__templates__/expo/client/heroui/components/label/label.styles.ts +44 -0
- package/lib/__templates__/expo/client/heroui/components/label/label.tsx +172 -0
- package/lib/__templates__/expo/client/heroui/components/label/label.types.ts +86 -0
- package/lib/__templates__/expo/client/heroui/components/list-group/index.ts +17 -0
- package/lib/__templates__/expo/client/heroui/components/list-group/list-group.constants.ts +17 -0
- package/lib/__templates__/expo/client/heroui/components/list-group/list-group.md +387 -0
- package/lib/__templates__/expo/client/heroui/components/list-group/list-group.styles.ts +40 -0
- package/lib/__templates__/expo/client/heroui/components/list-group/list-group.tsx +206 -0
- package/lib/__templates__/expo/client/heroui/components/list-group/list-group.types.ts +132 -0
- package/lib/__templates__/expo/client/heroui/components/menu/index.ts +38 -0
- package/lib/__templates__/expo/client/heroui/components/menu/menu.animation.ts +121 -0
- package/lib/__templates__/expo/client/heroui/components/menu/menu.constants.ts +37 -0
- package/lib/__templates__/expo/client/heroui/components/menu/menu.md +620 -0
- package/lib/__templates__/expo/client/heroui/components/menu/menu.styles.ts +107 -0
- package/lib/__templates__/expo/client/heroui/components/menu/menu.tsx +664 -0
- package/lib/__templates__/expo/client/heroui/components/menu/menu.types.ts +394 -0
- package/lib/__templates__/expo/client/heroui/components/popover/arrow-svg.tsx +180 -0
- package/lib/__templates__/expo/client/heroui/components/popover/index.ts +18 -0
- package/lib/__templates__/expo/client/heroui/components/popover/popover.animation.ts +9 -0
- package/lib/__templates__/expo/client/heroui/components/popover/popover.constants.ts +34 -0
- package/lib/__templates__/expo/client/heroui/components/popover/popover.md +508 -0
- package/lib/__templates__/expo/client/heroui/components/popover/popover.styles.ts +98 -0
- package/lib/__templates__/expo/client/heroui/components/popover/popover.tsx +624 -0
- package/lib/__templates__/expo/client/heroui/components/popover/popover.types.ts +290 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.animation.ts +450 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.constants.ts +12 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.md +328 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.styles.ts +84 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.tsx +330 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.types.ts +386 -0
- package/lib/__templates__/expo/client/heroui/components/radio/index.ts +9 -0
- package/lib/__templates__/expo/client/heroui/components/radio/radio.animation.ts +92 -0
- package/lib/__templates__/expo/client/heroui/components/radio/radio.constants.ts +11 -0
- package/lib/__templates__/expo/client/heroui/components/radio/radio.md +339 -0
- package/lib/__templates__/expo/client/heroui/components/radio/radio.styles.ts +80 -0
- package/lib/__templates__/expo/client/heroui/components/radio/radio.tsx +217 -0
- package/lib/__templates__/expo/client/heroui/components/radio/radio.types.ts +106 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/index.ts +9 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.animation.ts +20 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.constants.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.context.ts +14 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.md +273 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.styles.ts +15 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.tsx +220 -0
- package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.types.ts +64 -0
- package/lib/__templates__/expo/client/heroui/components/scroll-shadow/index.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.animation.ts +132 -0
- package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.constants.ts +21 -0
- package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.md +206 -0
- package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.styles.ts +52 -0
- package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.tsx +262 -0
- package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.types.ts +121 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/index.ts +17 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/search-field.animation.ts +18 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/search-field.constants.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/search-field.md +231 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/search-field.styles.ts +35 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/search-field.tsx +253 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/search-field.types.ts +160 -0
- package/lib/__templates__/expo/client/heroui/components/search-field/search-icon.tsx +37 -0
- package/lib/__templates__/expo/client/heroui/components/select/index.ts +28 -0
- package/lib/__templates__/expo/client/heroui/components/select/select.animation.ts +92 -0
- package/lib/__templates__/expo/client/heroui/components/select/select.constants.ts +53 -0
- package/lib/__templates__/expo/client/heroui/components/select/select.md +796 -0
- package/lib/__templates__/expo/client/heroui/components/select/select.styles.ts +149 -0
- package/lib/__templates__/expo/client/heroui/components/select/select.tsx +828 -0
- package/lib/__templates__/expo/client/heroui/components/select/select.types.ts +438 -0
- package/lib/__templates__/expo/client/heroui/components/separator/index.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/separator/separator.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/separator/separator.md +106 -0
- package/lib/__templates__/expo/client/heroui/components/separator/separator.styles.ts +50 -0
- package/lib/__templates__/expo/client/heroui/components/separator/separator.tsx +62 -0
- package/lib/__templates__/expo/client/heroui/components/separator/separator.types.ts +40 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/index.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/linear-gradient.tsx +45 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.animation.ts +351 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.constants.ts +39 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.md +208 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.styles.ts +49 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.tsx +183 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.types.ts +191 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton-group/index.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.constants.ts +7 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.md +247 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.styles.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.tsx +94 -0
- package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.types.ts +28 -0
- package/lib/__templates__/expo/client/heroui/components/slider/index.ts +23 -0
- package/lib/__templates__/expo/client/heroui/components/slider/slider.animation.ts +87 -0
- package/lib/__templates__/expo/client/heroui/components/slider/slider.constants.ts +24 -0
- package/lib/__templates__/expo/client/heroui/components/slider/slider.md +348 -0
- package/lib/__templates__/expo/client/heroui/components/slider/slider.styles.ts +85 -0
- package/lib/__templates__/expo/client/heroui/components/slider/slider.tsx +413 -0
- package/lib/__templates__/expo/client/heroui/components/slider/slider.types.ts +120 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/index.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/spinner-icon.tsx +49 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/spinner.animation.ts +150 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/spinner.constants.ts +36 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/spinner.md +199 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/spinner.styles.ts +44 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/spinner.tsx +198 -0
- package/lib/__templates__/expo/client/heroui/components/spinner/spinner.types.ts +158 -0
- package/lib/__templates__/expo/client/heroui/components/surface/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/surface/surface.animation.ts +18 -0
- package/lib/__templates__/expo/client/heroui/components/surface/surface.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/surface/surface.md +136 -0
- package/lib/__templates__/expo/client/heroui/components/surface/surface.styles.ts +28 -0
- package/lib/__templates__/expo/client/heroui/components/surface/surface.tsx +66 -0
- package/lib/__templates__/expo/client/heroui/components/surface/surface.types.ts +46 -0
- package/lib/__templates__/expo/client/heroui/components/switch/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/switch/switch.animation.ts +243 -0
- package/lib/__templates__/expo/client/heroui/components/switch/switch.constants.ts +26 -0
- package/lib/__templates__/expo/client/heroui/components/switch/switch.md +334 -0
- package/lib/__templates__/expo/client/heroui/components/switch/switch.styles.ts +83 -0
- package/lib/__templates__/expo/client/heroui/components/switch/switch.tsx +280 -0
- package/lib/__templates__/expo/client/heroui/components/switch/switch.types.ts +208 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/index.ts +8 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/tabs.animation.ts +246 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/tabs.constants.ts +17 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/tabs.context.ts +28 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/tabs.md +565 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/tabs.styles.ts +168 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/tabs.tsx +445 -0
- package/lib/__templates__/expo/client/heroui/components/tabs/tabs.types.ts +341 -0
- package/lib/__templates__/expo/client/heroui/components/tag-group/index.ts +15 -0
- package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.animation.ts +17 -0
- package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.constants.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.md +404 -0
- package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.styles.ts +74 -0
- package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.tsx +325 -0
- package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.types.ts +125 -0
- package/lib/__templates__/expo/client/heroui/components/text-area/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/text-area/text-area.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/text-area/text-area.md +133 -0
- package/lib/__templates__/expo/client/heroui/components/text-area/text-area.styles.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/text-area/text-area.tsx +44 -0
- package/lib/__templates__/expo/client/heroui/components/text-area/text-area.types.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/text-field/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/components/text-field/text-field.animation.ts +20 -0
- package/lib/__templates__/expo/client/heroui/components/text-field/text-field.constants.ts +6 -0
- package/lib/__templates__/expo/client/heroui/components/text-field/text-field.md +256 -0
- package/lib/__templates__/expo/client/heroui/components/text-field/text-field.styles.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/text-field/text-field.tsx +82 -0
- package/lib/__templates__/expo/client/heroui/components/text-field/text-field.types.ts +56 -0
- package/lib/__templates__/expo/client/heroui/components/toast/index.ts +4 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.animation.ts +381 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.constants.ts +10 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.hooks.ts +73 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.md +420 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.styles.ts +89 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.tsx +472 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.types.ts +320 -0
- package/lib/__templates__/expo/client/heroui/docs.md +47 -0
- package/lib/__templates__/expo/client/heroui/helpers/external/hooks/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/helpers/external/hooks/use-is-on-surface.ts +8 -0
- package/lib/__templates__/expo/client/heroui/helpers/external/hooks/use-theme-color.ts +137 -0
- package/lib/__templates__/expo/client/heroui/helpers/external/utils/cn.ts +12 -0
- package/lib/__templates__/expo/client/heroui/helpers/external/utils/color-kit/index.ts +2395 -0
- package/lib/__templates__/expo/client/heroui/helpers/external/utils/color-kit/types.ts +212 -0
- package/lib/__templates__/expo/client/heroui/helpers/external/utils/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/animated-check-icon.tsx +78 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/bottom-sheet-content-container.tsx +97 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/bottom-sheet-content.tsx +158 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/check-icon.tsx +28 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/chevron-down-icon.tsx +28 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/chevron-right-icon.tsx +29 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/close-icon.tsx +29 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/full-window-overlay.tsx +48 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/hero-text.tsx +71 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/components/index.ts +9 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/animation-settings-context.ts +19 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/bottom-sheet-is-dragging-context.ts +11 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/form-field-context.ts +36 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/index.ts +14 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-augmented-ref.ts +32 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-bottom-sheet-aware-handlers.ts +94 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-bottom-sheet-gesture-handlers.ts +52 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-combined-animation-disabled-state.ts +49 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts +124 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-dev-info.ts +38 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-keyboard-status.ts +22 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-bottom-sheet-content-animation.ts +67 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-dialog-content-animation.ts +296 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-overlay-animation.ts +91 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-popover-content-animation.ts +199 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-root-animation.ts +26 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-relative-position.ts +353 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-resolved-style-property.ts +118 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/types/animation.ts +131 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/types/bottom-sheet.ts +99 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/types/index.ts +5 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/types/misc.ts +10 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/types/primitives.ts +146 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/types/theme.ts +18 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/animation.ts +266 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/children-to-string.ts +117 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/combine-styles.ts +17 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/create-context.ts +60 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/ease-gradient/create-interpolation.ts +35 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/ease-gradient/index.ts +97 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/get-element-by-display-name.ts +15 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/get-element-with-default.ts +17 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/has-prop.ts +18 -0
- package/lib/__templates__/expo/client/heroui/helpers/internal/utils/index.ts +8 -0
- package/lib/__templates__/expo/client/heroui/index.tsx +51 -0
- package/lib/__templates__/expo/client/heroui/primitives/README.md +27 -0
- package/lib/__templates__/expo/client/heroui/primitives/accordion/accordion.tsx +270 -0
- package/lib/__templates__/expo/client/heroui/primitives/accordion/accordion.types.ts +117 -0
- package/lib/__templates__/expo/client/heroui/primitives/accordion/accordion.utils.ts +12 -0
- package/lib/__templates__/expo/client/heroui/primitives/accordion/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/activity-indicator/activity-indicator.tsx +50 -0
- package/lib/__templates__/expo/client/heroui/primitives/activity-indicator/activity-indicator.types.ts +24 -0
- package/lib/__templates__/expo/client/heroui/primitives/activity-indicator/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/alert/alert.tsx +124 -0
- package/lib/__templates__/expo/client/heroui/primitives/alert/alert.types.ts +87 -0
- package/lib/__templates__/expo/client/heroui/primitives/alert/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/avatar/avatar.tsx +171 -0
- package/lib/__templates__/expo/client/heroui/primitives/avatar/avatar.types.ts +62 -0
- package/lib/__templates__/expo/client/heroui/primitives/avatar/avatar.utils.ts +102 -0
- package/lib/__templates__/expo/client/heroui/primitives/avatar/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/bottom-sheet/bottom-sheet.tsx +235 -0
- package/lib/__templates__/expo/client/heroui/primitives/bottom-sheet/bottom-sheet.types.ts +127 -0
- package/lib/__templates__/expo/client/heroui/primitives/bottom-sheet/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/checkbox/checkbox.tsx +119 -0
- package/lib/__templates__/expo/client/heroui/primitives/checkbox/checkbox.types.ts +37 -0
- package/lib/__templates__/expo/client/heroui/primitives/checkbox/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/dialog/dialog.tsx +274 -0
- package/lib/__templates__/expo/client/heroui/primitives/dialog/dialog.types.ts +129 -0
- package/lib/__templates__/expo/client/heroui/primitives/dialog/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/input-otp/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/primitives/input-otp/input-otp.tsx +431 -0
- package/lib/__templates__/expo/client/heroui/primitives/input-otp/input-otp.types.ts +169 -0
- package/lib/__templates__/expo/client/heroui/primitives/input-otp/input-otp.utils.ts +31 -0
- package/lib/__templates__/expo/client/heroui/primitives/label/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/label/label.tsx +24 -0
- package/lib/__templates__/expo/client/heroui/primitives/label/label.types.ts +39 -0
- package/lib/__templates__/expo/client/heroui/primitives/menu/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/menu/menu.tsx +765 -0
- package/lib/__templates__/expo/client/heroui/primitives/menu/menu.types.ts +401 -0
- package/lib/__templates__/expo/client/heroui/primitives/popover/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/popover/popover.tsx +382 -0
- package/lib/__templates__/expo/client/heroui/primitives/popover/popover.types.ts +201 -0
- package/lib/__templates__/expo/client/heroui/primitives/portal/index.ts +1 -0
- package/lib/__templates__/expo/client/heroui/primitives/portal/portal.tsx +126 -0
- package/lib/__templates__/expo/client/heroui/primitives/radio/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/radio/radio.tsx +133 -0
- package/lib/__templates__/expo/client/heroui/primitives/radio/radio.types.ts +47 -0
- package/lib/__templates__/expo/client/heroui/primitives/radio-group/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/radio-group/radio-group.tsx +114 -0
- package/lib/__templates__/expo/client/heroui/primitives/radio-group/radio-group.types.ts +65 -0
- package/lib/__templates__/expo/client/heroui/primitives/select/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/select/select.tsx +705 -0
- package/lib/__templates__/expo/client/heroui/primitives/select/select.types.ts +409 -0
- package/lib/__templates__/expo/client/heroui/primitives/select/select.utils.ts +35 -0
- package/lib/__templates__/expo/client/heroui/primitives/slider/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/primitives/slider/slider.tsx +464 -0
- package/lib/__templates__/expo/client/heroui/primitives/slider/slider.types.ts +208 -0
- package/lib/__templates__/expo/client/heroui/primitives/slider/slider.utils.ts +93 -0
- package/lib/__templates__/expo/client/heroui/primitives/slot/index.ts +1 -0
- package/lib/__templates__/expo/client/heroui/primitives/slot/slot.tsx +122 -0
- package/lib/__templates__/expo/client/heroui/primitives/slot/types.ts +19 -0
- package/lib/__templates__/expo/client/heroui/primitives/slot/utils.ts +96 -0
- package/lib/__templates__/expo/client/heroui/primitives/switch/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/switch/switch.tsx +61 -0
- package/lib/__templates__/expo/client/heroui/primitives/switch/switch.types.ts +55 -0
- package/lib/__templates__/expo/client/heroui/primitives/tabs/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/tabs/tabs.tsx +202 -0
- package/lib/__templates__/expo/client/heroui/primitives/tabs/tabs.types.ts +77 -0
- package/lib/__templates__/expo/client/heroui/primitives/tag-group/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/tag-group/tag-group.tsx +324 -0
- package/lib/__templates__/expo/client/heroui/primitives/tag-group/tag-group.types.ts +119 -0
- package/lib/__templates__/expo/client/heroui/primitives/toast/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/primitives/toast/toast.tsx +138 -0
- package/lib/__templates__/expo/client/heroui/primitives/toast/toast.types.ts +86 -0
- package/lib/__templates__/expo/client/heroui/providers/animation-settings/index.ts +8 -0
- package/lib/__templates__/expo/client/heroui/providers/animation-settings/provider.tsx +47 -0
- package/lib/__templates__/expo/client/heroui/providers/animation-settings/types.ts +27 -0
- package/lib/__templates__/expo/client/heroui/providers/hero-ui-native/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/providers/hero-ui-native/provider.tsx +67 -0
- package/lib/__templates__/expo/client/heroui/providers/hero-ui-native/types.ts +114 -0
- package/lib/__templates__/expo/client/heroui/providers/hero-ui-native-raw/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/providers/hero-ui-native-raw/provider.tsx +50 -0
- package/lib/__templates__/expo/client/heroui/providers/hero-ui-native-raw/types.ts +39 -0
- package/lib/__templates__/expo/client/heroui/providers/text-component/index.ts +2 -0
- package/lib/__templates__/expo/client/heroui/providers/text-component/provider.tsx +9 -0
- package/lib/__templates__/expo/client/heroui/providers/text-component/types.ts +52 -0
- package/lib/__templates__/expo/client/heroui/providers/toast/index.ts +3 -0
- package/lib/__templates__/expo/client/heroui/providers/toast/insets-container.tsx +87 -0
- package/lib/__templates__/expo/client/heroui/providers/toast/provider.tsx +431 -0
- package/lib/__templates__/expo/client/heroui/providers/toast/reducer.ts +34 -0
- package/lib/__templates__/expo/client/heroui/providers/toast/toast-config.context.ts +27 -0
- package/lib/__templates__/expo/client/heroui/providers/toast/toast-item-renderer.tsx +45 -0
- package/lib/__templates__/expo/client/heroui/providers/toast/types.ts +373 -0
- package/lib/__templates__/expo/client/heroui/styles/index.css +3 -0
- package/lib/__templates__/expo/client/heroui/styles/theme.css +112 -0
- package/lib/__templates__/expo/client/heroui/styles/utilities.css +8 -0
- package/lib/__templates__/expo/client/heroui/styles/variables.css +146 -0
- package/lib/__templates__/expo/client/package.json +4 -1
- package/lib/__templates__/expo/package.json +1 -1
- package/lib/__templates__/expo/pnpm-lock.yaml +68 -0
- package/lib/__templates__/nextjs/AGENTS.md +6 -4
- package/lib/__templates__/nextjs/eslint.config.mjs +9 -0
- package/lib/__templates__/taro/.coze +2 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -2
- package/lib/__templates__/taro/config/index.ts +1 -1
- package/lib/__templates__/taro/package.json +1 -0
- package/lib/__templates__/taro/project.config.json +1 -1
- package/lib/cli.js +246 -252
- package/package.json +3 -2
package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.tsx
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
View,
|
|
5
|
+
type GestureResponderEvent,
|
|
6
|
+
type LayoutChangeEvent,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
import Animated from 'react-native-reanimated';
|
|
10
|
+
import { AnimationSettingsProvider } from '../../helpers/internal/contexts';
|
|
11
|
+
import type { PressableRef, ViewRef } from '../../helpers/internal/types';
|
|
12
|
+
import {
|
|
13
|
+
PressableFeedbackRootAnimationProvider,
|
|
14
|
+
usePressableFeedbackHighlightAnimation,
|
|
15
|
+
usePressableFeedbackRippleAnimation,
|
|
16
|
+
usePressableFeedbackRootAnimation,
|
|
17
|
+
usePressableFeedbackScaleAnimation,
|
|
18
|
+
} from './pressable-feedback.animation';
|
|
19
|
+
import { DISPLAY_NAME } from './pressable-feedback.constants';
|
|
20
|
+
import {
|
|
21
|
+
pressableFeedbackClassNames,
|
|
22
|
+
pressableFeedbackStyleSheet,
|
|
23
|
+
} from './pressable-feedback.styles';
|
|
24
|
+
import type {
|
|
25
|
+
PressableFeedbackHighlightProps,
|
|
26
|
+
PressableFeedbackProps,
|
|
27
|
+
PressableFeedbackRippleProps,
|
|
28
|
+
PressableFeedbackScaleProps,
|
|
29
|
+
} from './pressable-feedback.types';
|
|
30
|
+
|
|
31
|
+
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
32
|
+
|
|
33
|
+
// --------------------------------------------------
|
|
34
|
+
|
|
35
|
+
const PressableFeedback = forwardRef<PressableRef, PressableFeedbackProps>(
|
|
36
|
+
(props, ref) => {
|
|
37
|
+
const {
|
|
38
|
+
isDisabled = false,
|
|
39
|
+
isAnimatedStyleActive = true,
|
|
40
|
+
className,
|
|
41
|
+
style,
|
|
42
|
+
animation,
|
|
43
|
+
children,
|
|
44
|
+
onLayout,
|
|
45
|
+
onPressIn,
|
|
46
|
+
onPressOut,
|
|
47
|
+
...restProps
|
|
48
|
+
} = props;
|
|
49
|
+
|
|
50
|
+
const {
|
|
51
|
+
isPressed,
|
|
52
|
+
containerWidth,
|
|
53
|
+
containerHeight,
|
|
54
|
+
isAllAnimationsDisabled,
|
|
55
|
+
animationOnPressIn,
|
|
56
|
+
animationOnPressOut,
|
|
57
|
+
rScaleStyle,
|
|
58
|
+
} = usePressableFeedbackRootAnimation({
|
|
59
|
+
animation,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const rootClassName = pressableFeedbackClassNames.root({ className });
|
|
63
|
+
|
|
64
|
+
const rootStyle = isAnimatedStyleActive
|
|
65
|
+
? [pressableFeedbackStyleSheet.root, rScaleStyle, style]
|
|
66
|
+
: [pressableFeedbackStyleSheet.root, style];
|
|
67
|
+
|
|
68
|
+
const handleLayout = useCallback(
|
|
69
|
+
(event: LayoutChangeEvent) => {
|
|
70
|
+
containerWidth.set(event.nativeEvent.layout.width);
|
|
71
|
+
containerHeight.set(event.nativeEvent.layout.height);
|
|
72
|
+
if (onLayout && typeof onLayout === 'function') {
|
|
73
|
+
onLayout(event);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[containerWidth, containerHeight, onLayout]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const handlePressIn = useCallback(
|
|
80
|
+
(event: GestureResponderEvent) => {
|
|
81
|
+
animationOnPressIn();
|
|
82
|
+
if (onPressIn && typeof onPressIn === 'function') {
|
|
83
|
+
onPressIn(event);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
[animationOnPressIn, onPressIn]
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const handlePressOut = useCallback(
|
|
90
|
+
(event: GestureResponderEvent) => {
|
|
91
|
+
animationOnPressOut();
|
|
92
|
+
if (onPressOut && typeof onPressOut === 'function') {
|
|
93
|
+
onPressOut(event);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
[animationOnPressOut, onPressOut]
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const animationContextValue = useMemo(
|
|
100
|
+
() => ({
|
|
101
|
+
isPressed,
|
|
102
|
+
containerWidth,
|
|
103
|
+
containerHeight,
|
|
104
|
+
}),
|
|
105
|
+
[isPressed, containerWidth, containerHeight]
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const animationSettingsContextValue = useMemo(
|
|
109
|
+
() => ({
|
|
110
|
+
isAllAnimationsDisabled,
|
|
111
|
+
}),
|
|
112
|
+
[isAllAnimationsDisabled]
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<AnimationSettingsProvider value={animationSettingsContextValue}>
|
|
117
|
+
<PressableFeedbackRootAnimationProvider value={animationContextValue}>
|
|
118
|
+
<AnimatedPressable
|
|
119
|
+
ref={ref}
|
|
120
|
+
disabled={isDisabled}
|
|
121
|
+
className={rootClassName}
|
|
122
|
+
style={rootStyle}
|
|
123
|
+
onLayout={handleLayout}
|
|
124
|
+
onPressIn={handlePressIn}
|
|
125
|
+
onPressOut={handlePressOut}
|
|
126
|
+
{...restProps}
|
|
127
|
+
>
|
|
128
|
+
{children}
|
|
129
|
+
</AnimatedPressable>
|
|
130
|
+
</PressableFeedbackRootAnimationProvider>
|
|
131
|
+
</AnimationSettingsProvider>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// --------------------------------------------------
|
|
137
|
+
|
|
138
|
+
const PressableFeedbackScale = forwardRef<ViewRef, PressableFeedbackScaleProps>(
|
|
139
|
+
(props, ref) => {
|
|
140
|
+
const {
|
|
141
|
+
animation,
|
|
142
|
+
isAnimatedStyleActive = true,
|
|
143
|
+
style,
|
|
144
|
+
children,
|
|
145
|
+
...restProps
|
|
146
|
+
} = props;
|
|
147
|
+
|
|
148
|
+
const { rContainerStyle } = usePressableFeedbackScaleAnimation({
|
|
149
|
+
animation,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const scaleStyle = isAnimatedStyleActive ? [rContainerStyle, style] : style;
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<Animated.View ref={ref} style={scaleStyle} {...restProps}>
|
|
156
|
+
{children}
|
|
157
|
+
</Animated.View>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
// --------------------------------------------------
|
|
163
|
+
|
|
164
|
+
const PressableFeedbackHighlight = forwardRef<
|
|
165
|
+
ViewRef,
|
|
166
|
+
PressableFeedbackHighlightProps
|
|
167
|
+
>((props, ref) => {
|
|
168
|
+
const {
|
|
169
|
+
animation,
|
|
170
|
+
className,
|
|
171
|
+
isAnimatedStyleActive = true,
|
|
172
|
+
style,
|
|
173
|
+
...restProps
|
|
174
|
+
} = props;
|
|
175
|
+
|
|
176
|
+
const { rContainerStyle } = usePressableFeedbackHighlightAnimation({
|
|
177
|
+
animation,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const highlightClassName = pressableFeedbackClassNames.highlight({
|
|
181
|
+
className,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const highlightStyle = isAnimatedStyleActive
|
|
185
|
+
? [rContainerStyle, style]
|
|
186
|
+
: style;
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<Animated.View
|
|
190
|
+
ref={ref}
|
|
191
|
+
pointerEvents="none"
|
|
192
|
+
className={highlightClassName}
|
|
193
|
+
style={highlightStyle}
|
|
194
|
+
{...restProps}
|
|
195
|
+
/>
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// --------------------------------------------------
|
|
200
|
+
|
|
201
|
+
const PressableFeedbackRipple = forwardRef<
|
|
202
|
+
ViewRef,
|
|
203
|
+
PressableFeedbackRippleProps
|
|
204
|
+
>((props, ref) => {
|
|
205
|
+
const {
|
|
206
|
+
animation,
|
|
207
|
+
className,
|
|
208
|
+
classNames,
|
|
209
|
+
style,
|
|
210
|
+
styles,
|
|
211
|
+
isAnimatedStyleActive = true,
|
|
212
|
+
onTouchStart,
|
|
213
|
+
onTouchEnd,
|
|
214
|
+
onTouchCancel,
|
|
215
|
+
...restProps
|
|
216
|
+
} = props;
|
|
217
|
+
|
|
218
|
+
const {
|
|
219
|
+
rContainerStyle,
|
|
220
|
+
backgroundColor,
|
|
221
|
+
animationOnTouchEnd,
|
|
222
|
+
animationOnTouchStart,
|
|
223
|
+
} = usePressableFeedbackRippleAnimation({ animation });
|
|
224
|
+
|
|
225
|
+
const { container, ripple } = pressableFeedbackClassNames.ripple();
|
|
226
|
+
|
|
227
|
+
const containerClassName = container({
|
|
228
|
+
className: [className, classNames?.container],
|
|
229
|
+
});
|
|
230
|
+
const rippleClassName = ripple({ className: classNames?.ripple });
|
|
231
|
+
|
|
232
|
+
const rippleStyle = isAnimatedStyleActive
|
|
233
|
+
? [rContainerStyle, styles?.ripple]
|
|
234
|
+
: styles?.ripple;
|
|
235
|
+
|
|
236
|
+
const handleTouchStart = useCallback(
|
|
237
|
+
(event: GestureResponderEvent) => {
|
|
238
|
+
animationOnTouchStart(event);
|
|
239
|
+
onTouchStart?.(event);
|
|
240
|
+
},
|
|
241
|
+
[animationOnTouchStart, onTouchStart]
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
const handleTouchEnd = useCallback(
|
|
245
|
+
(event: GestureResponderEvent) => {
|
|
246
|
+
animationOnTouchEnd();
|
|
247
|
+
onTouchEnd?.(event);
|
|
248
|
+
},
|
|
249
|
+
[animationOnTouchEnd, onTouchEnd]
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
const handleTouchCancel = useCallback(
|
|
253
|
+
(event: GestureResponderEvent) => {
|
|
254
|
+
animationOnTouchEnd();
|
|
255
|
+
onTouchCancel?.(event);
|
|
256
|
+
},
|
|
257
|
+
[animationOnTouchEnd, onTouchCancel]
|
|
258
|
+
);
|
|
259
|
+
return (
|
|
260
|
+
<View
|
|
261
|
+
ref={ref}
|
|
262
|
+
className={containerClassName}
|
|
263
|
+
style={[style, styles?.container]}
|
|
264
|
+
onTouchStart={handleTouchStart}
|
|
265
|
+
onTouchEnd={handleTouchEnd}
|
|
266
|
+
onTouchCancel={handleTouchCancel}
|
|
267
|
+
{...restProps}
|
|
268
|
+
>
|
|
269
|
+
<Animated.View
|
|
270
|
+
pointerEvents="none"
|
|
271
|
+
className={rippleClassName}
|
|
272
|
+
style={[
|
|
273
|
+
rippleStyle,
|
|
274
|
+
{
|
|
275
|
+
experimental_backgroundImage: `radial-gradient(circle at center, ${backgroundColor} 30%, transparent 70%)`,
|
|
276
|
+
},
|
|
277
|
+
]}
|
|
278
|
+
/>
|
|
279
|
+
</View>
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// --------------------------------------------------
|
|
284
|
+
|
|
285
|
+
PressableFeedback.displayName = DISPLAY_NAME.ROOT;
|
|
286
|
+
PressableFeedbackScale.displayName = DISPLAY_NAME.SCALE;
|
|
287
|
+
PressableFeedbackHighlight.displayName = DISPLAY_NAME.HIGHLIGHT;
|
|
288
|
+
PressableFeedbackRipple.displayName = DISPLAY_NAME.RIPPLE;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Pressable container with built-in scale animation and composable feedback compound parts.
|
|
292
|
+
*
|
|
293
|
+
* @component PressableFeedback
|
|
294
|
+
* @description Wraps content to provide consistent press feedback across the app. Provides built-in
|
|
295
|
+
* scale animation by default. Manages press state and container dimensions, providing them to child
|
|
296
|
+
* compound parts via context. Supports `asChild` for rendering as a Slot (polymorphic).
|
|
297
|
+
* Use `animation={{ scale: ... }}` to customize the built-in scale, `animation={false}` to disable
|
|
298
|
+
* it (when using PressableFeedback.Scale on a specific child instead), or `animation="disable-all"`
|
|
299
|
+
* to cascade-disable all animations.
|
|
300
|
+
* @features
|
|
301
|
+
* - Built-in scale animation enabled by default
|
|
302
|
+
* - Composable compound parts: Scale, Highlight, Ripple
|
|
303
|
+
* - Full gesture handling with press, long press, and disabled states
|
|
304
|
+
* - Polymorphic via `asChild` prop (Slot pattern)
|
|
305
|
+
* - Used as foundation for interactive components like Button, Card, and Accordion
|
|
306
|
+
*
|
|
307
|
+
* @component PressableFeedback.Scale
|
|
308
|
+
* @description Scale animation wrapper for applying scale to a specific child element. Use this
|
|
309
|
+
* instead of the root's built-in scale when you need control over which element scales or need
|
|
310
|
+
* to apply className/style to the scale wrapper. Set `animation={false}` on the root to disable
|
|
311
|
+
* its built-in scale when using this component.
|
|
312
|
+
*
|
|
313
|
+
* @component PressableFeedback.Highlight
|
|
314
|
+
* @description Highlight overlay for iOS-style press feedback. Renders an absolute-positioned
|
|
315
|
+
* layer that fades in on press. Must be used within PressableFeedback.
|
|
316
|
+
*
|
|
317
|
+
* @component PressableFeedback.Ripple
|
|
318
|
+
* @description Ripple overlay for Android-style press feedback. Renders a radial gradient circle
|
|
319
|
+
* that expands from the touch point. Must be used within PressableFeedback.
|
|
320
|
+
*/
|
|
321
|
+
const PressableFeedbackCompound = Object.assign(PressableFeedback, {
|
|
322
|
+
/** Scale animation wrapper for applying scale to a specific child element */
|
|
323
|
+
Scale: PressableFeedbackScale,
|
|
324
|
+
/** Highlight overlay for iOS-style press feedback */
|
|
325
|
+
Highlight: PressableFeedbackHighlight,
|
|
326
|
+
/** Ripple overlay for Android-style press feedback */
|
|
327
|
+
Ripple: PressableFeedbackRipple,
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
export default PressableFeedbackCompound;
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import type { PressableProps, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
AnimatedProps,
|
|
4
|
+
SharedValue,
|
|
5
|
+
WithTimingConfig,
|
|
6
|
+
} from 'react-native-reanimated';
|
|
7
|
+
import type {
|
|
8
|
+
Animation,
|
|
9
|
+
AnimationRoot,
|
|
10
|
+
AnimationValue,
|
|
11
|
+
ElementSlots,
|
|
12
|
+
} from '../../helpers/internal/types';
|
|
13
|
+
import type { RippleSlots } from './pressable-feedback.styles';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Scale animation configuration shared by the root's built-in scale and the PressableFeedback.Scale compound part.
|
|
17
|
+
*
|
|
18
|
+
* Supports the standard Animation control flow:
|
|
19
|
+
* - `true` or `undefined`: Use default scale animation
|
|
20
|
+
* - `false` or `"disabled"`: Disable scale animation
|
|
21
|
+
* - `object`: Custom scale configuration (value, timingConfig, ignoreScaleCoefficient)
|
|
22
|
+
*/
|
|
23
|
+
export type PressableFeedbackScaleAnimation = Animation<{
|
|
24
|
+
/**
|
|
25
|
+
* Scale value when pressed
|
|
26
|
+
* @default 0.985
|
|
27
|
+
*
|
|
28
|
+
* Note: The actual scale is automatically adjusted based on the container's width
|
|
29
|
+
* using a scale coefficient. This ensures the scale effect feels consistent across different
|
|
30
|
+
* container sizes:
|
|
31
|
+
* - Base width: 300px
|
|
32
|
+
* - If container width > 300px: scale adjustment decreases (less noticeable scale down)
|
|
33
|
+
* - If container width < 300px: scale adjustment increases (more noticeable scale down)
|
|
34
|
+
* - Example: 600px width → 0.5x coefficient → adjustedScale = 1 - (1 - 0.98) * 0.5 = 0.99
|
|
35
|
+
* - Example: 150px width → 2x coefficient → adjustedScale = 1 - (1 - 0.98) * 2 = 0.96
|
|
36
|
+
*
|
|
37
|
+
* This automatic scaling creates the same visual feel on different sized containers
|
|
38
|
+
* by adjusting the scale effect relative to the container size.
|
|
39
|
+
*/
|
|
40
|
+
value?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Animation timing configuration
|
|
43
|
+
* @default { duration: 300, easing: Easing.out(Easing.ease) }
|
|
44
|
+
*/
|
|
45
|
+
timingConfig?: WithTimingConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Ignore the scale coefficient and use the scale value directly
|
|
48
|
+
*
|
|
49
|
+
* When set to true, the scale coefficient will return 1, meaning the actual scale
|
|
50
|
+
* will always equal the value regardless of the container's width.
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
ignoreScaleCoefficient?: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Animation configuration for PressableFeedback highlight overlay
|
|
59
|
+
*/
|
|
60
|
+
export type PressableFeedbackHighlightAnimation = Animation<{
|
|
61
|
+
/**
|
|
62
|
+
* Opacity animation for the highlight overlay
|
|
63
|
+
*/
|
|
64
|
+
opacity?: AnimationValue<{
|
|
65
|
+
/**
|
|
66
|
+
* Opacity values [unpressed, pressed]
|
|
67
|
+
* @default [0, 0.1]
|
|
68
|
+
*/
|
|
69
|
+
value?: [number, number];
|
|
70
|
+
/**
|
|
71
|
+
* Animation timing configuration
|
|
72
|
+
* @default { duration: 200 }
|
|
73
|
+
*/
|
|
74
|
+
timingConfig?: WithTimingConfig;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Background color of the highlight overlay
|
|
78
|
+
*/
|
|
79
|
+
backgroundColor?: AnimationValue<{
|
|
80
|
+
/**
|
|
81
|
+
* Background color value
|
|
82
|
+
* @default Computed based on theme (brighten for dark, darken for light)
|
|
83
|
+
*/
|
|
84
|
+
value?: string;
|
|
85
|
+
}>;
|
|
86
|
+
}>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Animation configuration for PressableFeedback ripple effect
|
|
90
|
+
*/
|
|
91
|
+
export type PressableFeedbackRippleAnimation = Animation<{
|
|
92
|
+
/**
|
|
93
|
+
* Background color of the ripple effect
|
|
94
|
+
*/
|
|
95
|
+
backgroundColor?: AnimationValue<{
|
|
96
|
+
/**
|
|
97
|
+
* Background color value
|
|
98
|
+
* @default Computed based on theme (brighten for dark, darken for light)
|
|
99
|
+
*/
|
|
100
|
+
value?: string;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Progress animation configuration for the ripple effect
|
|
104
|
+
*
|
|
105
|
+
* This controls how the ripple progresses over time from the center to the edges.
|
|
106
|
+
* The progress is represented as a shared value that animates from 0 to 2:
|
|
107
|
+
* - 0 to 1: Initial expansion phase (press begins)
|
|
108
|
+
* - 1 to 2: Final expansion and fade out phase (press ends)
|
|
109
|
+
*/
|
|
110
|
+
progress?: AnimationValue<{
|
|
111
|
+
/**
|
|
112
|
+
* Base duration for the ripple progress animation in milliseconds
|
|
113
|
+
*
|
|
114
|
+
* This value controls how fast the ripple progresses across the container.
|
|
115
|
+
* Lower values mean faster ripple expansion, higher values mean slower expansion.
|
|
116
|
+
*
|
|
117
|
+
* @default 750
|
|
118
|
+
*
|
|
119
|
+
* Note: The actual duration is automatically adjusted based on the container's diagonal size
|
|
120
|
+
* using a durationCoefficient. This ensures the ripple feels consistent across different
|
|
121
|
+
* container sizes:
|
|
122
|
+
* - Base diagonal: 450px
|
|
123
|
+
* - If container diagonal > 450px: duration increases proportionally (max 2x baseDuration)
|
|
124
|
+
* - If container diagonal < 450px: duration decreases proportionally
|
|
125
|
+
* - Example: 900px diagonal → 2x coefficient → duration = baseDuration * 2 (capped at 2x)
|
|
126
|
+
* - Example: 225px diagonal → 0.5x coefficient → duration = baseDuration * 0.5
|
|
127
|
+
*
|
|
128
|
+
* This automatic scaling creates the same visual feel on different sized containers
|
|
129
|
+
* by making the ripple travel at a consistent speed relative to the container size.
|
|
130
|
+
*/
|
|
131
|
+
baseDuration?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Minimum base duration for the ripple progress animation in milliseconds
|
|
134
|
+
*
|
|
135
|
+
* This sets a lower bound for the calculated duration after applying the duration coefficient.
|
|
136
|
+
* Useful for preventing the ripple animation from being too fast on small containers.
|
|
137
|
+
*
|
|
138
|
+
* @default undefined (no minimum)
|
|
139
|
+
*/
|
|
140
|
+
minBaseDuration?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Ignore the duration coefficient and use the base duration directly
|
|
143
|
+
*
|
|
144
|
+
* When set to true, the durationCoefficient will return 1, meaning the actual duration
|
|
145
|
+
* will always equal baseDuration regardless of the container's diagonal size.
|
|
146
|
+
*
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
149
|
+
ignoreDurationCoefficient?: boolean;
|
|
150
|
+
}>;
|
|
151
|
+
/**
|
|
152
|
+
* Opacity animation for the ripple effect
|
|
153
|
+
*/
|
|
154
|
+
opacity?: AnimationValue<{
|
|
155
|
+
/**
|
|
156
|
+
* Opacity values [start, peak, end] for ripple animation
|
|
157
|
+
* @default [0, 0.1, 0]
|
|
158
|
+
*/
|
|
159
|
+
value?: [number, number, number];
|
|
160
|
+
/**
|
|
161
|
+
* Animation timing configuration
|
|
162
|
+
* Note: Timing configs are applied to interpolated values. It's not recommended
|
|
163
|
+
* to keep duration higher than 80ms as the ripple effect will be weak.
|
|
164
|
+
* @default { duration: 30 }
|
|
165
|
+
*/
|
|
166
|
+
timingConfig?: WithTimingConfig;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Scale animation for the ripple effect
|
|
170
|
+
*/
|
|
171
|
+
scale?: AnimationValue<{
|
|
172
|
+
/**
|
|
173
|
+
* Scale values [start, peak, end] for ripple animation
|
|
174
|
+
* @default [0, 1, 1]
|
|
175
|
+
*/
|
|
176
|
+
value?: [number, number, number];
|
|
177
|
+
/**
|
|
178
|
+
* Animation timing configuration
|
|
179
|
+
* Note: Timing configs are applied to interpolated values. It's not recommended
|
|
180
|
+
* to keep duration higher than 80ms as the ripple effect will be weak.
|
|
181
|
+
* @default { duration: 30 }
|
|
182
|
+
*/
|
|
183
|
+
timingConfig?: WithTimingConfig;
|
|
184
|
+
}>;
|
|
185
|
+
}>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Animation configuration for PressableFeedback root component.
|
|
189
|
+
*
|
|
190
|
+
* Supports the standard AnimationRoot control flow:
|
|
191
|
+
* - `true` or `undefined`: Use the default built-in scale animation
|
|
192
|
+
* - `false` or `"disabled"`: Disable the root's built-in scale (use this when applying scale
|
|
193
|
+
* via PressableFeedback.Scale instead)
|
|
194
|
+
* - `"disable-all"`: Cascade-disable all animations including the built-in scale and children
|
|
195
|
+
* (Scale, Highlight, Ripple)
|
|
196
|
+
* - `object`: Custom configuration for the built-in scale
|
|
197
|
+
* - `scale`: Customize the built-in scale animation (value, timingConfig, etc.)
|
|
198
|
+
* - `state`: Control animation state while keeping configuration (e.g. for runtime toggling)
|
|
199
|
+
*/
|
|
200
|
+
export type PressableFeedbackRootAnimation = AnimationRoot<{
|
|
201
|
+
/**
|
|
202
|
+
* Customize the built-in scale animation on the root component.
|
|
203
|
+
* Accepts the same `PressableFeedbackScaleAnimation` configuration as the Scale compound part.
|
|
204
|
+
*/
|
|
205
|
+
scale?: PressableFeedbackScaleAnimation;
|
|
206
|
+
}>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Props for PressableFeedback root component
|
|
210
|
+
*/
|
|
211
|
+
export interface PressableFeedbackProps
|
|
212
|
+
extends Omit<AnimatedProps<PressableProps>, 'disabled'> {
|
|
213
|
+
/**
|
|
214
|
+
* Whether the pressable component is disabled
|
|
215
|
+
* @default false
|
|
216
|
+
*/
|
|
217
|
+
isDisabled?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Children elements
|
|
220
|
+
*/
|
|
221
|
+
children?: React.ReactNode;
|
|
222
|
+
/**
|
|
223
|
+
* Additional CSS classes
|
|
224
|
+
*/
|
|
225
|
+
className?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Animation configuration for the root component.
|
|
228
|
+
*
|
|
229
|
+
* - Leave `undefined` or `true` for the default built-in scale animation.
|
|
230
|
+
* - Provide an object with `scale` to customize the built-in scale:
|
|
231
|
+
* ```tsx
|
|
232
|
+
* <PressableFeedback animation={{ scale: { value: 0.97 } }}>
|
|
233
|
+
* {content}
|
|
234
|
+
* </PressableFeedback>
|
|
235
|
+
* ```
|
|
236
|
+
* - Set to `false` or `"disabled"` to disable the built-in scale (use when applying
|
|
237
|
+
* scale via `PressableFeedback.Scale` on a specific child instead).
|
|
238
|
+
* - Set to `'disable-all'` to cascade-disable all animations including children.
|
|
239
|
+
*/
|
|
240
|
+
animation?: PressableFeedbackRootAnimation;
|
|
241
|
+
/**
|
|
242
|
+
* Whether the root's built-in animated styles (react-native-reanimated) are active.
|
|
243
|
+
* When `false`, the animated scale style is not applied and you can implement custom logic.
|
|
244
|
+
* @default true
|
|
245
|
+
*/
|
|
246
|
+
isAnimatedStyleActive?: boolean;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Props for PressableFeedback.Scale compound part
|
|
251
|
+
*/
|
|
252
|
+
export interface PressableFeedbackScaleProps extends AnimatedProps<ViewProps> {
|
|
253
|
+
/**
|
|
254
|
+
* Additional CSS classes
|
|
255
|
+
*
|
|
256
|
+
* @note The following style properties are occupied by animations and cannot be set via className:
|
|
257
|
+
* - `transform` (specifically `scale`) - Animated for press feedback transitions
|
|
258
|
+
* (unpressed: 1, pressed: adjusted scale based on container width, default: 0.985)
|
|
259
|
+
*
|
|
260
|
+
* To customize this property, use the `animation` prop:
|
|
261
|
+
* ```tsx
|
|
262
|
+
* <PressableFeedback.Scale
|
|
263
|
+
* animation={{ value: 0.985, timingConfig: { duration: 300, easing: Easing.out(Easing.ease) } }}
|
|
264
|
+
* />
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* To completely disable animated styles and use your own via className or style prop,
|
|
268
|
+
* set `isAnimatedStyleActive={false}`.
|
|
269
|
+
*/
|
|
270
|
+
className?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Animation configuration for the scale effect
|
|
273
|
+
*/
|
|
274
|
+
animation?: PressableFeedbackScaleAnimation;
|
|
275
|
+
/**
|
|
276
|
+
* Whether animated styles (react-native-reanimated) are active
|
|
277
|
+
* When `false`, the animated style is removed and you can implement custom logic
|
|
278
|
+
* @default true
|
|
279
|
+
*/
|
|
280
|
+
isAnimatedStyleActive?: boolean;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Props for PressableFeedback highlight component
|
|
285
|
+
*/
|
|
286
|
+
export interface PressableFeedbackHighlightProps
|
|
287
|
+
extends AnimatedProps<ViewProps> {
|
|
288
|
+
/**
|
|
289
|
+
* Additional CSS classes
|
|
290
|
+
*
|
|
291
|
+
* @note The following style properties are occupied by animations and cannot be set via className:
|
|
292
|
+
* - `backgroundColor` - Animated for highlight background color transitions (default: theme-aware gray)
|
|
293
|
+
* - `opacity` - Animated for highlight visibility transitions (unpressed: 0, pressed: 0.1, default duration: 200ms)
|
|
294
|
+
*
|
|
295
|
+
* To customize these properties, use the `animation` prop:
|
|
296
|
+
* ```tsx
|
|
297
|
+
* <PressableFeedback.Highlight
|
|
298
|
+
* animation={{
|
|
299
|
+
* backgroundColor: { value: '#3f3f46' },
|
|
300
|
+
* opacity: { value: [0, 0.2], timingConfig: { duration: 300 } }
|
|
301
|
+
* }}
|
|
302
|
+
* />
|
|
303
|
+
* ```
|
|
304
|
+
*
|
|
305
|
+
* To completely disable animated styles and use your own via className or style prop, set `isAnimatedStyleActive={false}`.
|
|
306
|
+
*/
|
|
307
|
+
className?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Animation configuration for the highlight overlay
|
|
310
|
+
*/
|
|
311
|
+
animation?: PressableFeedbackHighlightAnimation;
|
|
312
|
+
/**
|
|
313
|
+
* Whether animated styles (react-native-reanimated) are active
|
|
314
|
+
* When `false`, the animated style is removed and you can implement custom logic
|
|
315
|
+
* This prop should only be used when you want to write custom styling logic instead of the default animated styles
|
|
316
|
+
* @default true
|
|
317
|
+
*/
|
|
318
|
+
isAnimatedStyleActive?: boolean;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Props for PressableFeedback ripple component
|
|
323
|
+
*/
|
|
324
|
+
export interface PressableFeedbackRippleProps extends ViewProps {
|
|
325
|
+
/**
|
|
326
|
+
* Additional CSS classes for the container slot
|
|
327
|
+
*
|
|
328
|
+
* Applied to the container slot (`absolute inset-0`). The container handles touch events and positioning.
|
|
329
|
+
* Container styles can be fully customized via className or the `classNames.container` prop.
|
|
330
|
+
*/
|
|
331
|
+
className?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Additional CSS classes for the slots
|
|
334
|
+
*
|
|
335
|
+
* - `container`: Outer container slot (`absolute inset-0`) - styles can be fully customized
|
|
336
|
+
* - `ripple`: Inner ripple slot (`absolute top-0 left-0 rounded-full`) - has animated properties that cannot be set via className
|
|
337
|
+
*
|
|
338
|
+
* @note The following style properties on the `ripple` slot are occupied by animations and cannot be set via className:
|
|
339
|
+
* - `width`, `height`, `borderRadius` - Animated for ripple circle size calculations (based on container diagonal)
|
|
340
|
+
* - `opacity` - Animated for ripple visibility transitions (unpressed: 0, expanding: 0.1, fading: 0)
|
|
341
|
+
* - `transform` (specifically `translateX`, `translateY`, `scale`) - Animated for ripple position and expansion from touch point
|
|
342
|
+
*
|
|
343
|
+
* To customize these properties, use the `animation` prop:
|
|
344
|
+
* ```tsx
|
|
345
|
+
* <PressableFeedback.Ripple
|
|
346
|
+
* animation={{
|
|
347
|
+
* opacity: { value: [0, 0.1, 0], timingConfig: { duration: 400 } },
|
|
348
|
+
* scale: { value: [0, 1, 1] },
|
|
349
|
+
* backgroundColor: { value: '#3f3f46' }
|
|
350
|
+
* }}
|
|
351
|
+
* />
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* Touch handlers (`onTouchStart`, `onTouchEnd`, `onTouchCancel`) can be customized via props and will be called alongside animation handlers.
|
|
355
|
+
*
|
|
356
|
+
* To completely disable animated styles and use your own via className or style prop, set `isAnimatedStyleActive={false}`.
|
|
357
|
+
*/
|
|
358
|
+
classNames?: ElementSlots<RippleSlots>;
|
|
359
|
+
/**
|
|
360
|
+
* Styles for different parts of the ripple overlay
|
|
361
|
+
*/
|
|
362
|
+
styles?: Partial<Record<RippleSlots, ViewStyle>>;
|
|
363
|
+
/**
|
|
364
|
+
* Animation configuration for the ripple overlay
|
|
365
|
+
*/
|
|
366
|
+
animation?: PressableFeedbackRippleAnimation;
|
|
367
|
+
/**
|
|
368
|
+
* Whether animated styles (react-native-reanimated) are active
|
|
369
|
+
* When `false`, the animated style is removed and you can implement custom logic
|
|
370
|
+
* This prop should only be used when you want to write custom styling logic instead of the default animated styles
|
|
371
|
+
* @default true
|
|
372
|
+
*/
|
|
373
|
+
isAnimatedStyleActive?: boolean;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Context value for PressableFeedback root animation state
|
|
378
|
+
*/
|
|
379
|
+
export interface PressableFeedbackRootAnimationContextValue {
|
|
380
|
+
/** Shared value tracking if component is pressed (for scale animation) */
|
|
381
|
+
isPressed: SharedValue<boolean>;
|
|
382
|
+
/** Shared value tracking the container width (for scale coefficient calculation) */
|
|
383
|
+
containerWidth: SharedValue<number>;
|
|
384
|
+
/** Shared value tracking the container height (for scale coefficient calculation) */
|
|
385
|
+
containerHeight: SharedValue<number>;
|
|
386
|
+
}
|