@webority/mobile-ui 0.1.0 → 0.2.1
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/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Confetti/Confetti.js +1 -1
- package/lib/commonjs/components/Drawer/Drawer.js +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/commonjs/components/SlideToConfirm/SlideToConfirm.js +1 -1
- package/lib/commonjs/components/Slider/Slider.js +1 -1
- package/lib/commonjs/components/Swipeable/Swipeable.js +1 -1
- package/lib/commonjs/components/ZoomableImage/ZoomableImage.js +1 -1
- package/lib/module/components/Accordion/Accordion.js +1 -1
- package/lib/module/components/Accordion/index.js +1 -1
- package/lib/module/components/AmountSlider/AmountSlider.js +1 -1
- package/lib/module/components/AmountSlider/index.js +1 -1
- package/lib/module/components/AnimatePresence/AnimatePresence.js +1 -1
- package/lib/module/components/AnimatePresence/index.js +1 -1
- package/lib/module/components/AppBar/AppBar.js +1 -1
- package/lib/module/components/AppBar/index.js +1 -1
- package/lib/module/components/AppIcon/AppIcon.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/a.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/b.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/c.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/d.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/e.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/f.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/g.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/h.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/i.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/j.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/k.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/l.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/m.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/n.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/o.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/p.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/q.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/r.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/s.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/t.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/u.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/v.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/w.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/x.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/y.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bold/z.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/a.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/b.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/c.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/d.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/e.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/f.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/g.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/h.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/i.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/j.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/k.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/l.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/m.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/n.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/o.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/p.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/q.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/r.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/s.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/t.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/u.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/v.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/w.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/x.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/y.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/broken/z.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/a.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/b.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/c.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/d.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/e.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/f.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/g.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/h.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/i.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/j.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/k.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/l.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/m.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/n.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/o.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/p.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/q.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/r.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/s.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/t.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/u.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/v.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/w.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/x.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/y.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/bulk/z.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/a.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/b.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/c.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/d.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/e.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/f.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/g.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/h.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/i.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/j.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/k.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/l.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/m.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/n.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/o.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/p.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/q.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/r.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/s.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/t.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/u.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/v.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/w.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/x.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/y.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/linear/z.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/a.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/b.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/c.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/d.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/e.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/f.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/g.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/h.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/i.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/j.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/k.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/l.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/m.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/n.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/o.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/p.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/q.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/r.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/s.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/t.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/u.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/v.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/w.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/x.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/y.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/outline/z.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/a.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/b.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/c.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/d.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/e.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/f.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/g.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/h.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/i.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/j.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/k.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/l.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/m.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/n.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/o.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/p.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/q.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/r.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/s.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/t.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/u.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/v.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/w.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/x.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/y.g.js +1 -1
- package/lib/module/components/AppIcon/catalog/twotone/z.g.js +1 -1
- package/lib/module/components/AppIcon/catalog.g.js +1 -1
- package/lib/module/components/AppIcon/defaultIcons.js +1 -1
- package/lib/module/components/AppIcon/glyphs.g.js +1 -1
- package/lib/module/components/AppIcon/index.js +1 -1
- package/lib/module/components/AppIcon/slotIcon.js +1 -1
- package/lib/module/components/AppIcon/variants.g.js +1 -1
- package/lib/module/components/AsyncBlock/AsyncBlock.js +1 -1
- package/lib/module/components/AsyncBlock/index.js +1 -1
- package/lib/module/components/AuthedImage/AuthedImage.js +1 -1
- package/lib/module/components/AuthedImage/authedImageCache.js +1 -1
- package/lib/module/components/AuthedImage/index.js +1 -1
- package/lib/module/components/Autocomplete/Autocomplete.js +1 -1
- package/lib/module/components/Autocomplete/index.js +1 -1
- package/lib/module/components/Avatar/Avatar.js +1 -1
- package/lib/module/components/Avatar/index.js +1 -1
- package/lib/module/components/Badge/Badge.js +1 -1
- package/lib/module/components/Badge/index.js +1 -1
- package/lib/module/components/Banner/Banner.js +1 -1
- package/lib/module/components/Banner/index.js +1 -1
- package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/module/components/BottomNavigation/index.js +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/module/components/BottomSheet/index.js +1 -1
- package/lib/module/components/Box/Box.js +1 -1
- package/lib/module/components/Box/index.js +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Button/index.js +1 -1
- package/lib/module/components/Card/Card.js +1 -1
- package/lib/module/components/Card/index.js +1 -1
- package/lib/module/components/Carousel/Carousel.js +1 -1
- package/lib/module/components/Carousel/index.js +1 -1
- package/lib/module/components/Checkbox/Checkbox.js +1 -1
- package/lib/module/components/Checkbox/index.js +1 -1
- package/lib/module/components/Chip/Chip.js +1 -1
- package/lib/module/components/Chip/index.js +1 -1
- package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/module/components/ChoiceGroup/index.js +1 -1
- package/lib/module/components/Confetti/Confetti.js +1 -1
- package/lib/module/components/Confetti/index.js +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +1 -1
- package/lib/module/components/DatePicker/index.js +1 -1
- package/lib/module/components/DateRangePicker/DateRangePicker.js +1 -1
- package/lib/module/components/DateRangePicker/index.js +1 -1
- package/lib/module/components/DecimalInput/DecimalInput.js +1 -1
- package/lib/module/components/DecimalInput/index.js +1 -1
- package/lib/module/components/Descriptions/Descriptions.js +1 -1
- package/lib/module/components/Descriptions/index.js +1 -1
- package/lib/module/components/Dialog/Dialog.js +1 -1
- package/lib/module/components/Dialog/index.js +1 -1
- package/lib/module/components/Divider/Divider.js +1 -1
- package/lib/module/components/Divider/index.js +1 -1
- package/lib/module/components/Drawer/Drawer.js +1 -1
- package/lib/module/components/Drawer/index.js +1 -1
- package/lib/module/components/EmptyState/EmptyState.js +1 -1
- package/lib/module/components/EmptyState/index.js +1 -1
- package/lib/module/components/ErrorBoundary/ErrorBoundary.js +1 -1
- package/lib/module/components/ErrorBoundary/index.js +1 -1
- package/lib/module/components/ErrorBoundary/useErrorHandler.js +1 -1
- package/lib/module/components/ErrorBoundary/withErrorBoundary.js +1 -1
- package/lib/module/components/FieldBase/Chevron.js +1 -1
- package/lib/module/components/FieldBase/ChoiceText.js +1 -1
- package/lib/module/components/FieldBase/FieldBase.js +1 -1
- package/lib/module/components/FieldBase/index.js +1 -1
- package/lib/module/components/FieldBase/useFloatingLabel.js +1 -1
- package/lib/module/components/FilePicker/FilePicker.js +1 -1
- package/lib/module/components/FilePicker/index.js +1 -1
- package/lib/module/components/FileViewer/FileViewer.js +1 -1
- package/lib/module/components/FileViewer/index.js +1 -1
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/module/components/FloatingActionButton/index.js +1 -1
- package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +1 -1
- package/lib/module/components/ForceUpdateDialog/index.js +1 -1
- package/lib/module/components/FormField/FormField.js +1 -1
- package/lib/module/components/FormField/index.js +1 -1
- package/lib/module/components/IconBadge/IconBadge.js +1 -1
- package/lib/module/components/IconBadge/index.js +1 -1
- package/lib/module/components/IconButton/IconButton.js +1 -1
- package/lib/module/components/IconButton/index.js +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/module/components/ImageGallery/index.js +1 -1
- package/lib/module/components/InlineSelect/InlineSelect.js +1 -1
- package/lib/module/components/InlineSelect/index.js +1 -1
- package/lib/module/components/Input/Input.js +1 -1
- package/lib/module/components/Input/index.js +1 -1
- package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +1 -1
- package/lib/module/components/KeyboardToolbar/KeyboardToolbar.js +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +1 -1
- package/lib/module/components/ListItem/ListItem.js +1 -1
- package/lib/module/components/ListItem/index.js +1 -1
- package/lib/module/components/LoaderOverlay/LoaderOverlay.js +1 -1
- package/lib/module/components/LoaderOverlay/index.js +1 -1
- package/lib/module/components/Markdown/Markdown.js +1 -1
- package/lib/module/components/Markdown/index.js +1 -1
- package/lib/module/components/Markdown/parse.js +1 -1
- package/lib/module/components/Modal/Modal.js +1 -1
- package/lib/module/components/Modal/index.js +1 -1
- package/lib/module/components/Notation/Notation.js +1 -1
- package/lib/module/components/Notation/index.js +1 -1
- package/lib/module/components/NumberInput/NumberInput.js +1 -1
- package/lib/module/components/NumberInput/index.js +1 -1
- package/lib/module/components/OTPInput/OTPInput.js +1 -1
- package/lib/module/components/OTPInput/index.js +1 -1
- package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
- package/lib/module/components/OptionSheet/index.js +1 -1
- package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/module/components/PhoneNumberInput/index.js +1 -1
- package/lib/module/components/PickerTrigger/PickerTrigger.js +1 -1
- package/lib/module/components/PickerTrigger/index.js +1 -1
- package/lib/module/components/ProfileCompletion/ProfileCompletion.js +1 -1
- package/lib/module/components/ProfileCompletion/index.js +1 -1
- package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/module/components/ProfilePicker/index.js +1 -1
- package/lib/module/components/ProgressBar/ProgressBar.js +1 -1
- package/lib/module/components/ProgressBar/index.js +1 -1
- package/lib/module/components/ProgressRing/ProgressRing.js +1 -1
- package/lib/module/components/ProgressRing/index.js +1 -1
- package/lib/module/components/Radio/Radio.js +1 -1
- package/lib/module/components/Radio/RadioDot.js +1 -1
- package/lib/module/components/Radio/RadioGroup.js +1 -1
- package/lib/module/components/Radio/index.js +1 -1
- package/lib/module/components/Rating/Rating.js +1 -1
- package/lib/module/components/Rating/index.js +1 -1
- package/lib/module/components/Repeater/Repeater.js +1 -1
- package/lib/module/components/Repeater/index.js +1 -1
- package/lib/module/components/RichTextEditor/RichTextEditor.js +1 -1
- package/lib/module/components/RichTextEditor/index.js +1 -1
- package/lib/module/components/RichTextEditor/markdownActions.js +1 -1
- package/lib/module/components/SearchBar/SearchBar.js +1 -1
- package/lib/module/components/SearchBar/index.js +1 -1
- package/lib/module/components/SectionHeader/SectionHeader.js +1 -1
- package/lib/module/components/SectionHeader/index.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/SegmentedControl/index.js +1 -1
- package/lib/module/components/Select/Select.js +1 -1
- package/lib/module/components/Select/index.js +1 -1
- package/lib/module/components/Skeleton/Skeleton.js +1 -1
- package/lib/module/components/Skeleton/SkeletonClock.js +1 -1
- package/lib/module/components/Skeleton/SkeletonContent.js +1 -1
- package/lib/module/components/Skeleton/SkeletonList.js +1 -1
- package/lib/module/components/Skeleton/SkeletonProvider.js +1 -1
- package/lib/module/components/Skeleton/SkeletonSkip.js +1 -1
- package/lib/module/components/Skeleton/index.js +1 -1
- package/lib/module/components/SlideToConfirm/SlideToConfirm.js +1 -1
- package/lib/module/components/SlideToConfirm/index.js +1 -1
- package/lib/module/components/Slider/Slider.js +1 -1
- package/lib/module/components/Slider/index.js +1 -1
- package/lib/module/components/Slider/valueText.js +1 -1
- package/lib/module/components/SliderField/SliderField.js +1 -1
- package/lib/module/components/SliderField/index.js +1 -1
- package/lib/module/components/Spinner/Spinner.js +1 -1
- package/lib/module/components/Spinner/index.js +1 -1
- package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
- package/lib/module/components/StatTile/StatTile.js +1 -1
- package/lib/module/components/StatTile/index.js +1 -1
- package/lib/module/components/StatusBadge/StatusBadge.js +1 -1
- package/lib/module/components/StatusBadge/index.js +1 -1
- package/lib/module/components/Stepper/Stepper.js +1 -1
- package/lib/module/components/Stepper/index.js +1 -1
- package/lib/module/components/Swipeable/Swipeable.js +1 -1
- package/lib/module/components/Swipeable/index.js +1 -1
- package/lib/module/components/Switch/Switch.js +1 -1
- package/lib/module/components/Switch/index.js +1 -1
- package/lib/module/components/Tabs/Tabs.js +1 -1
- package/lib/module/components/Tabs/index.js +1 -1
- package/lib/module/components/TagInput/TagInput.js +1 -1
- package/lib/module/components/TagInput/index.js +1 -1
- package/lib/module/components/Text/Text.js +1 -1
- package/lib/module/components/Text/index.js +1 -1
- package/lib/module/components/TimePicker/TimePicker.js +1 -1
- package/lib/module/components/TimePicker/index.js +1 -1
- package/lib/module/components/Timeline/Timeline.js +1 -1
- package/lib/module/components/Timeline/index.js +1 -1
- package/lib/module/components/Toast/Toast.js +1 -1
- package/lib/module/components/Toast/ToastProvider.js +1 -1
- package/lib/module/components/Toast/index.js +1 -1
- package/lib/module/components/Tooltip/Tooltip.js +1 -1
- package/lib/module/components/Tooltip/index.js +1 -1
- package/lib/module/components/Tour/Tour.js +1 -1
- package/lib/module/components/Tour/index.js +1 -1
- package/lib/module/components/ZoomableImage/ZoomableImage.js +1 -1
- package/lib/module/components/ZoomableImage/index.js +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/form/FormContext.js +1 -1
- package/lib/module/form/HookFormField.js +1 -1
- package/lib/module/form/equal.js +1 -1
- package/lib/module/form/index.js +1 -1
- package/lib/module/form/path.js +1 -1
- package/lib/module/form/rules.js +1 -1
- package/lib/module/form/types.js +1 -0
- package/lib/module/form/useField.js +1 -1
- package/lib/module/form/useForm.js +1 -1
- package/lib/module/form/useFormCompletion.js +1 -1
- package/lib/module/form/useHookFormField.js +1 -1
- package/lib/module/hooks/index.js +1 -1
- package/lib/module/hooks/useControllableState.js +1 -1
- package/lib/module/hooks/useDebounce.js +1 -1
- package/lib/module/hooks/useDragToDismiss.js +1 -1
- package/lib/module/hooks/useFlickGuard.js +1 -1
- package/lib/module/hooks/usePressAnimation.js +1 -1
- package/lib/module/hooks/useReducedMotion.js +1 -1
- package/lib/module/hooks/useToggle.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/initUI.js +1 -1
- package/lib/module/network/NetworkStatusBanner.js +1 -1
- package/lib/module/network/index.js +1 -1
- package/lib/module/specs/NativePdfRasterizer.js +1 -1
- package/lib/module/theme/Gradient.js +1 -1
- package/lib/module/theme/ThemeContext.js +1 -1
- package/lib/module/theme/animatedValue.js +1 -1
- package/lib/module/theme/index.js +1 -1
- package/lib/module/theme/merge.js +1 -1
- package/lib/module/theme/textStyle.js +1 -1
- package/lib/module/theme/tokens.js +1 -1
- package/lib/module/theme/types.js +1 -1
- package/lib/module/utils/color.js +1 -1
- package/lib/module/utils/corners.js +1 -1
- package/lib/module/utils/dimensions.js +1 -1
- package/lib/module/utils/feedback.js +1 -1
- package/lib/module/utils/hapticUtils.js +1 -1
- package/lib/module/utils/hashString.js +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/mergeRefs.js +1 -1
- package/lib/module/utils/responsive.js +1 -1
- package/lib/module/utils/shadows.js +1 -1
- package/lib/module/utils/spacing.js +1 -1
- package/lib/module/utils/squircle.js +1 -1
- package/lib/module/utils/warnUnknownProps.js +1 -1
- package/lib/typescript/commonjs/components/Button/Button.d.ts +5 -0
- package/lib/typescript/module/components/Button/Button.d.ts +5 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useBottomSheet=exports.default=exports.BottomSheet=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,o,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(n=t?r:a){if(n.has(e))return n.get(e);n.set(e,i)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(o.get||o.set)?n(i,t,o):i[t]=e[t]);return i})(e,t)}const TABLET_MIN_SHORT_SIDE=600,DIALOG_MAX_WIDTH=560,BottomSheetContext=(0,_react.createContext)(null),useBottomSheet=()=>{const e=(0,_react.useContext)(BottomSheetContext);if(!e)throw new Error("useBottomSheet must be used inside a <BottomSheet>.");return e};exports.useBottomSheet=useBottomSheet;const SPRING_CONFIG={damping:20,stiffness:240,mass:1},CLOSE_VELOCITY_THRESHOLD=1e3,DRAG_ACTIVATION_OFFSET=10,BottomSheet=exports.BottomSheet=(0,_react.forwardRef)((e,t)=>{const{snapPoints:a,index:r,onChange:n,onAnimate:o,onAfterClose:i,enablePanDownToClose:s=!0,enableBackdropPress:l=!0,scrollable:c=!1,scrollRef:u,onScroll:d,onContentSizeChange:_,onScrollLayout:m,scrollEventThrottle:h,keyboardBehavior:v="shift",mode:f="modal",presentation:b="sheet",handleIndicatorStyle:p,containerStyle:S,header:g,footer:x,headerStyle:R,footerStyle:y,children:N,accessibilityLabel:j,accessibilityViewIsModal:w,testID:C}=e,k=(0,_index.useTheme)(),I=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[M,O]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").height),[T,H]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").width),B=(0,_react.useCallback)(e=>{const{height:t,width:a}=e.nativeEvent.layout;t>0&&O(e=>e===t?e:t),a>0&&H(e=>e===a?e:a)},[]),P=(0,_reactNative.useWindowDimensions)(),G="dialog"===b||"auto"===b&&Math.min(P.width,P.height)>=600,D=Math.min(560,T-2*k.spacing.xl),[V,A]=(0,_react.useState)({top:I.top,bottom:I.bottom}),E="modal"===f?V.top:I.top,L="modal"===f?V.bottom:I.bottom,q=a.includes("content"),[W,F]=useMeasuredHeight(),[J,z]=useMeasuredHeight(),[Y,$,K]=useMeasuredHeight(),[X,U]=useMeasuredHeight(),Q=G?k.spacing.md:W,Z=q?Math.min(Q+(null!=g?J:0)+Y+(null!=x?X:0)+L,M-E):0,ee=(0,_react.useCallback)((e,t)=>{q&&K(t),_?.(e,t)},[q,_,K]),te=(0,_react.useMemo)(()=>resolveSnapPoints(a,M,Z),[a,M,Z]),ae=M,re=te[te.length-1]??0,ne=(0,_reactNativeReanimated.useSharedValue)(ae),oe=(0,_reactNativeReanimated.useSharedValue)(ae),ie=(0,_reactNativeReanimated.useSharedValue)(-1),[se,le]=(0,_react.useState)(-1),ce=(0,_react.useRef)(!1),[ue,de]=(0,_react.useState)(!1),[_e,me]=(0,_react.useState)(!1),he=(0,_react.useRef)(!1),ve=(0,_react.useRef)(i);ve.current=i;const[fe,be]=(0,_react.useState)(!1),pe=(0,_react.useCallback)(e=>{if(e<0||e>=te.length)return ae;const t=te[e];return G?(M-t)/2:M-t},[te,M,ae,G]),Se=(0,_react.useCallback)(e=>{se!==e&&(le(e),ie.value=e,n?.(e))},[se,ie,n]),ge=(0,_react.useCallback)(()=>{ce.current=!1,ie.value<0&&(he.current=!0,"modal"===f?(de(!1),"ios"!==_reactNative.Platform.OS&&me(!1)):be(!1))},[f,ie]),xe=(0,_react.useCallback)(()=>{he.current&&me(!1)},[]);(0,_react.useEffect)(()=>{("modal"===f?!_e:!fe)&&he.current&&(he.current=!1,ve.current?.())},[f,_e,fe]);const Re=(0,_react.useCallback)((e,t,a)=>{ce.current=!0,o?.(t,a),ne.value=(0,_reactNativeReanimated.withSpring)(e,SPRING_CONFIG,e=>{e&&(0,_reactNativeReanimated.runOnJS)(ge)()})},[o,ne,ge]),ye=(0,_react.useCallback)(e=>{const t="number"==typeof e?clamp(e,0,te.length-1):se>=0?se:0,a=ie.value,r=pe(t);he.current=!1,"modal"===f?(me(!0),de(!0)):be(!0),a<0&&(ne.value=ae),Se(t),Re(r,a,t)},[Re,ae,se,ie,f,te.length,Se,ne,pe]),Ne=(0,_react.useCallback)(()=>{if(0===te.length)return;const e=ie.value,t=pe(0);Se(0),Re(t,e,0)},[Re,ie,te.length,Se,pe]),je=(0,_react.useCallback)(()=>{const e=ie.value;Se(-1),ce.current=!0,o?.(e,-1),ne.value=(0,_reactNativeReanimated.withTiming)(ae,{duration:k.motion.duration.fast,easing:_reactNativeReanimated.Easing.bezier(...k.motion.easing.accelerate)},e=>{e&&(0,_reactNativeReanimated.runOnJS)(ge)()})},[ae,ie,ge,o,Se,ne,k.motion.duration.fast,k.motion.easing.accelerate]);(0,_react.useImperativeHandle)(t,()=>({expand:ye,collapse:Ne,close:je}),[ye,Ne,je]),(0,_react.useEffect)(()=>{"number"==typeof r&&r!==se&&(-1===r?je():ye(r))},[r]);const we=(0,_react.useRef)({hostHeight:M,contentSnap:Z});(0,_react.useEffect)(()=>{const e=we.current;e.hostHeight===M&&e.contentSnap===Z||(we.current={hostHeight:M,contentSnap:Z},e.hostHeight===M&&ie.value<0||(ne.value=(0,_reactNativeReanimated.withSpring)(pe(ie.value),SPRING_CONFIG)))},[M,Z]);const Ce=M-re,ke=(0,_react.useMemo)(()=>te.map(e=>M-e),[te,M]),Ie=(0,_react.useCallback)((e,t)=>{const a=ie.value;if(-1===e)return(0,_index2.triggerHaptic)("selection"),Se(-1),ce.current=!0,o?.(a,-1),void(ne.value=(0,_reactNativeReanimated.withTiming)(ae,{duration:k.motion.duration.fast,easing:_reactNativeReanimated.Easing.bezier(...k.motion.easing.accelerate)},e=>{e&&(0,_reactNativeReanimated.runOnJS)(ge)()}));Se(e),Re(t,a,e)},[Re,ae,ie,ge,o,Se,ne,k.motion.duration.fast,k.motion.easing.accelerate]),Me=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Native().withTestId(C?`${C}-content-gesture`:"bottom-sheet-content-gesture"),[C]),Oe=(0,_react.useMemo)(()=>{const e=ke,t=ae,a=Ce,r=s;return _reactNativeGestureHandler.Gesture.Pan().withTestId(C?`${C}-pan-gesture`:"bottom-sheet-pan-gesture").activeOffsetY([-10,10]).failOffsetX([-15,15]).onStart(()=>{oe.value=ne.value}).onUpdate(e=>{const t=oe.value+e.translationY;ne.value=t<a?a+.25*(t-a):t}).onEnd(a=>{const n=ne.value;if(a.velocityY>1e3)return r?void(0,_reactNativeReanimated.runOnJS)(Ie)(-1,t):void(0,_reactNativeReanimated.runOnJS)(Ie)(0,e[0]);let o=0,i=Math.abs(n-e[0]);for(let t=1;t<e.length;t++){const a=Math.abs(n-e[t]);a<i&&(i=a,o=t)}const s=e[0];r&&n-s>80?(0,_reactNativeReanimated.runOnJS)(Ie)(-1,t):(0,_reactNativeReanimated.runOnJS)(Ie)(o,e[o])})},[ae,oe,s,Ie,Ce,ke,C,ne]),{height:Te}=(0,_reactNativeKeyboardController.useReanimatedKeyboardAnimation)(),He="shift"===v,Be=(0,_reactNativeReanimated.useDerivedValue)(()=>He?Te.value:0),Pe=te[se>=0?se:0]??re,Ge=k.spacing.md,De=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{if(G){const e=Be.value,t=M+e-Pe-Ge,a=e<0&&ne.value>t?t:ne.value;return{top:a<E?E:a}}const e=ne.value+Be.value,t=Be.value<0?E:Ce;return{top:e<t?t:e}}),Ve=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=Be.value;if(G){const t=M+e-Pe-Ge,a=e<0&&ne.value>t?t:ne.value,r=M+e-Ge-(a<E?E:a);return{height:r<0?0:r>Pe?Pe:r}}const t=e<0?E:Ce,a=ne.value+e,r=M+e-(a<t?t:a);return{height:r<0?0:r>re?re:r}}),Ae=se>=0,Ee=(0,_react.useMemo)(()=>buildStyles(k),[k]),Le=(0,_react.useCallback)(()=>{l&&((0,_index2.triggerHaptic)("selection"),je())},[l,je]),qe=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Tap().withTestId(C?`${C}-backdrop-gesture`:"bottom-sheet-backdrop-gesture").maxDuration(250).onEnd((e,t)=>{t&&(0,_reactNativeReanimated.runOnJS)(Le)()}),[Le,C]),We=(0,_react.useMemo)(()=>({snapIndex:se,snapPoints:te,expand:ye,collapse:Ne,close:je}),[se,te,ye,Ne,je]);if("inline"===f&&!fe)return null;if("modal"===f&&!_e)return null;const Fe=(0,_jsxRuntime.jsxs)(_reactNative.View,{collapsable:!1,style:["modal"===f?Ee.backdropModal:Ee.backdropInline,{backgroundColor:k.colors.background.overlay}],onLayout:B,testID:C,accessibilityViewIsModal:w??Ae,children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:qe,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:_reactNative.StyleSheet.absoluteFill,accessibilityRole:"button",accessibilityLabel:"Close bottom sheet"})}),(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{accessibilityRole:"alert",accessibilityLabel:j,accessibilityViewIsModal:w??Ae,style:[Ee.sheet,{height:re,backgroundColor:k.colors.background.elevated,borderTopLeftRadius:k.radius["2xl"],borderTopRightRadius:k.radius["2xl"],..._corners.smoothCorners,...k.shadows.xl},G?{height:Pe,left:(T-D)/2,right:void 0,width:D,borderBottomLeftRadius:k.radius["2xl"],borderBottomRightRadius:k.radius["2xl"]}:null,S,De],children:(0,_jsxRuntime.jsxs)(SheetBody,{style:[Ee.body,Ve],keyboardOffset:Be,children:[G?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:k.spacing.md}}):(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Oe,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:Ee.handleRow,onLayout:q?F:void 0,accessible:!0,accessibilityLabel:"Drag handle",accessibilityHint:"Drag up or down to resize the sheet, or swipe down to close it",testID:C?`${C}-handle`:"bottom-sheet-handle",children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ee.handle,{backgroundColor:k.components.bottomSheet?.handleColor??k.colors.border.primary},p]})})}),null!=g&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ee.header,R],onLayout:q?z:void 0,children:g}),c?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Me,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{ref:u,style:Ee.content,onScroll:d,onContentSizeChange:ee,onLayout:m,scrollEventThrottle:h,keyboardShouldPersistTaps:"always",keyboardDismissMode:"none",children:N})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:Ee.content,children:q?(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:$,children:N}):N}),null!=x&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ee.footer,y],onLayout:q?U:void 0,children:x})]})})]}),Je=(0,_jsxRuntime.jsx)(BottomSheetContext.Provider,{value:We,children:Fe});return"modal"===f?(0,_jsxRuntime.jsx)(_reactNative.Modal,{transparent:!0,visible:ue,onRequestClose:je,onDismiss:"ios"===_reactNative.Platform.OS?xe:void 0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",supportedOrientations:["portrait","landscape"],children:(0,_jsxRuntime.jsxs)(_reactNativeSafeAreaContext.SafeAreaProvider,{style:Ee.modalRoot,children:[(0,_jsxRuntime.jsx)(InsetsProbe,{onChange:A}),"android"===_reactNative.Platform.OS?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:Ee.modalRoot,children:Je}):Je,(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})}):Je}),InsetsProbe=({onChange:e})=>{const{top:t,bottom:a}=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();return(0,_react.useEffect)(()=>{e(e=>e.top===t&&e.bottom===a?e:{top:t,bottom:a})},[t,a,e]),null},SheetBody=({style:e,keyboardOffset:t,children:a})=>{const r=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)().bottom,n=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=r+t.value;return{paddingBottom:e>0?e:0}});return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[e,n],children:a})};BottomSheet.displayName="BottomSheet";const useMeasuredHeight=()=>{const[e,t]=(0,_react.useState)(0),a=(0,_react.useCallback)(e=>{t(t=>t===e?t:e)},[]);return[e,(0,_react.useCallback)(e=>a(e.nativeEvent.layout.height),[a]),a]},resolveSnapPoints=(e,t,a)=>[...e.map(e=>{if("number"==typeof e)return e;if("content"===e)return a;const r=parseFloat(e);return Number.isNaN(r)?0:r/100*t})].sort((e,t)=>e-t),clamp=(e,t,a)=>Math.min(Math.max(e,t),a),buildStyles=e=>_reactNative.StyleSheet.create({backdropModal:{flex:1},backdropInline:{..._reactNative.StyleSheet.absoluteFill},sheet:{position:"absolute",left:0,right:0,overflow:"hidden"},body:{overflow:"hidden"},handleRow:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingTop:12,paddingBottom:24},header:{},footer:{},handle:{width:36,height:4,borderRadius:2,..._corners.smoothCorners},content:{flex:1,overflow:"hidden"},modalRoot:{flex:1}});var _default=exports.default=BottomSheet;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useBottomSheet=exports.default=exports.BottomSheet=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var o,n,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(o=t?r:a){if(o.has(e))return o.get(e);o.set(e,i)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?o(i,t,n):i[t]=e[t]);return i})(e,t)}const TABLET_MIN_SHORT_SIDE=600,DIALOG_MAX_WIDTH=560,BottomSheetContext=(0,_react.createContext)(null),useBottomSheet=()=>{const e=(0,_react.useContext)(BottomSheetContext);if(!e)throw new Error("useBottomSheet must be used inside a <BottomSheet>.");return e};exports.useBottomSheet=useBottomSheet;const SPRING_CONFIG={damping:20,stiffness:240,mass:1},CLOSE_VELOCITY_THRESHOLD=1e3,DRAG_ACTIVATION_OFFSET=10,BottomSheet=exports.BottomSheet=(0,_react.forwardRef)((e,t)=>{const{snapPoints:a,index:r,onChange:o,onAnimate:n,onAfterClose:i,enablePanDownToClose:s=!0,enableBackdropPress:l=!0,scrollable:c=!1,scrollRef:u,onScroll:d,onContentSizeChange:_,onScrollLayout:m,scrollEventThrottle:h,keyboardBehavior:v="shift",mode:f="modal",presentation:b="sheet",handleIndicatorStyle:p,containerStyle:S,header:g,footer:x,headerStyle:R,footerStyle:y,children:N,accessibilityLabel:w,accessibilityViewIsModal:j,testID:C}=e,k=(0,_index.useTheme)(),I=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[M,O]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").height),[T,H]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").width),B=(0,_react.useCallback)(e=>{const{height:t,width:a}=e.nativeEvent.layout;t>0&&O(e=>e===t?e:t),a>0&&H(e=>e===a?e:a)},[]),P=(0,_reactNative.useWindowDimensions)(),G="dialog"===b||"auto"===b&&Math.min(P.width,P.height)>=600,D=Math.min(560,T-2*k.spacing.xl),[V,A]=(0,_react.useState)({top:I.top,bottom:I.bottom}),E="modal"===f?V.top:I.top,L="modal"===f?V.bottom:I.bottom,q=a.includes("content"),[W,F]=useMeasuredHeight(),[J,z]=useMeasuredHeight(),[Y,$,K]=useMeasuredHeight(),[X,U]=useMeasuredHeight(),Q=G?k.spacing.md:W,Z=q?Math.min(Q+(null!=g?J:0)+Y+(null!=x?X:0)+L,M-E):0,ee=(0,_react.useCallback)((e,t)=>{q&&K(t),_?.(e,t)},[q,_,K]),te=(0,_react.useMemo)(()=>resolveSnapPoints(a,M,Z),[a,M,Z]),ae=M,re=te[te.length-1]??0,oe=(0,_reactNativeReanimated.useSharedValue)(ae),ne=(0,_reactNativeReanimated.useSharedValue)(ae),ie=(0,_reactNativeReanimated.useSharedValue)(-1),[se,le]=(0,_react.useState)(-1),ce=(0,_react.useRef)(!1),[ue,de]=(0,_react.useState)(!1),[_e,me]=(0,_react.useState)(!1),he=(0,_react.useRef)(!1),ve=(0,_react.useRef)(i);ve.current=i;const[fe,be]=(0,_react.useState)(!1),pe=(0,_react.useCallback)(e=>{if(e<0||e>=te.length)return ae;const t=te[e];return G?(M-t)/2:M-t},[te,M,ae,G]),Se=(0,_react.useCallback)(e=>{se!==e&&(le(e),ie.value=e,o?.(e))},[se,ie,o]),ge=(0,_react.useCallback)(()=>{ce.current=!1,ie.value<0&&(he.current=!0,"modal"===f?(de(!1),"ios"!==_reactNative.Platform.OS&&me(!1)):be(!1))},[f,ie]),xe=(0,_react.useCallback)(()=>{he.current&&me(!1)},[]);(0,_react.useEffect)(()=>{("modal"===f?!_e:!fe)&&he.current&&(he.current=!1,ve.current?.())},[f,_e,fe]);const Re=(0,_react.useCallback)((e,t,a)=>{ce.current=!0,n?.(t,a),oe.value=(0,_reactNativeReanimated.withSpring)(e,SPRING_CONFIG,e=>{"worklet";e&&(0,_reactNativeReanimated.runOnJS)(ge)()})},[n,oe,ge]),ye=(0,_react.useCallback)(e=>{const t="number"==typeof e?clamp(e,0,te.length-1):se>=0?se:0,a=ie.value,r=pe(t);he.current=!1,"modal"===f?(me(!0),de(!0)):be(!0),a<0&&(oe.value=ae),Se(t),Re(r,a,t)},[Re,ae,se,ie,f,te.length,Se,oe,pe]),Ne=(0,_react.useCallback)(()=>{if(0===te.length)return;const e=ie.value,t=pe(0);Se(0),Re(t,e,0)},[Re,ie,te.length,Se,pe]),we=(0,_react.useCallback)(()=>{const e=ie.value;Se(-1),ce.current=!0,n?.(e,-1),oe.value=(0,_reactNativeReanimated.withTiming)(ae,{duration:k.motion.duration.fast,easing:_reactNativeReanimated.Easing.bezier(...k.motion.easing.accelerate)},e=>{"worklet";e&&(0,_reactNativeReanimated.runOnJS)(ge)()})},[ae,ie,ge,n,Se,oe,k.motion.duration.fast,k.motion.easing.accelerate]);(0,_react.useImperativeHandle)(t,()=>({expand:ye,collapse:Ne,close:we}),[ye,Ne,we]),(0,_react.useEffect)(()=>{"number"==typeof r&&r!==se&&(-1===r?we():ye(r))},[r]);const je=(0,_react.useRef)({hostHeight:M,contentSnap:Z});(0,_react.useEffect)(()=>{const e=je.current;e.hostHeight===M&&e.contentSnap===Z||(je.current={hostHeight:M,contentSnap:Z},e.hostHeight===M&&ie.value<0||(oe.value=(0,_reactNativeReanimated.withSpring)(pe(ie.value),SPRING_CONFIG)))},[M,Z]);const Ce=M-re,ke=(0,_react.useMemo)(()=>te.map(e=>M-e),[te,M]),Ie=(0,_react.useCallback)((e,t)=>{const a=ie.value;if(-1===e)return(0,_index2.triggerHaptic)("selection"),Se(-1),ce.current=!0,n?.(a,-1),void(oe.value=(0,_reactNativeReanimated.withTiming)(ae,{duration:k.motion.duration.fast,easing:_reactNativeReanimated.Easing.bezier(...k.motion.easing.accelerate)},e=>{"worklet";e&&(0,_reactNativeReanimated.runOnJS)(ge)()}));Se(e),Re(t,a,e)},[Re,ae,ie,ge,n,Se,oe,k.motion.duration.fast,k.motion.easing.accelerate]),Me=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Native().withTestId(C?`${C}-content-gesture`:"bottom-sheet-content-gesture"),[C]),Oe=(0,_react.useMemo)(()=>{const e=ke,t=ae,a=Ce,r=s;return _reactNativeGestureHandler.Gesture.Pan().withTestId(C?`${C}-pan-gesture`:"bottom-sheet-pan-gesture").activeOffsetY([-10,10]).failOffsetX([-15,15]).onStart(()=>{"worklet";ne.value=oe.value}).onUpdate(e=>{"worklet";const t=ne.value+e.translationY;oe.value=t<a?a+.25*(t-a):t}).onEnd(a=>{"worklet";const o=oe.value;if(a.velocityY>1e3)return r?void(0,_reactNativeReanimated.runOnJS)(Ie)(-1,t):void(0,_reactNativeReanimated.runOnJS)(Ie)(0,e[0]);let n=0,i=Math.abs(o-e[0]);for(let t=1;t<e.length;t++){const a=Math.abs(o-e[t]);a<i&&(i=a,n=t)}const s=e[0];r&&o-s>80?(0,_reactNativeReanimated.runOnJS)(Ie)(-1,t):(0,_reactNativeReanimated.runOnJS)(Ie)(n,e[n])})},[ae,ne,s,Ie,Ce,ke,C,oe]),{height:Te}=(0,_reactNativeKeyboardController.useReanimatedKeyboardAnimation)(),He="shift"===v,Be=(0,_reactNativeReanimated.useDerivedValue)(()=>He?Te.value:0),Pe=te[se>=0?se:0]??re,Ge=k.spacing.md,De=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{if(G){const e=Be.value,t=M+e-Pe-Ge,a=e<0&&oe.value>t?t:oe.value;return{top:a<E?E:a}}const e=oe.value+Be.value,t=Be.value<0?E:Ce;return{top:e<t?t:e}}),Ve=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=Be.value;if(G){const t=M+e-Pe-Ge,a=e<0&&oe.value>t?t:oe.value,r=M+e-Ge-(a<E?E:a);return{height:r<0?0:r>Pe?Pe:r}}const t=e<0?E:Ce,a=oe.value+e,r=M+e-(a<t?t:a);return{height:r<0?0:r>re?re:r}}),Ae=se>=0,Ee=(0,_react.useMemo)(()=>buildStyles(k),[k]),Le=(0,_react.useCallback)(()=>{l&&((0,_index2.triggerHaptic)("selection"),we())},[l,we]),qe=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Tap().withTestId(C?`${C}-backdrop-gesture`:"bottom-sheet-backdrop-gesture").maxDuration(250).onEnd((e,t)=>{"worklet";t&&(0,_reactNativeReanimated.runOnJS)(Le)()}),[Le,C]),We=(0,_react.useMemo)(()=>({snapIndex:se,snapPoints:te,expand:ye,collapse:Ne,close:we}),[se,te,ye,Ne,we]);if("inline"===f&&!fe)return null;if("modal"===f&&!_e)return null;const Fe=(0,_jsxRuntime.jsxs)(_reactNative.View,{collapsable:!1,style:["modal"===f?Ee.backdropModal:Ee.backdropInline,{backgroundColor:k.colors.background.overlay}],onLayout:B,testID:C,accessibilityViewIsModal:j??Ae,children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:qe,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:_reactNative.StyleSheet.absoluteFill,accessibilityRole:"button",accessibilityLabel:"Close bottom sheet"})}),(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{accessibilityRole:"alert",accessibilityLabel:w,accessibilityViewIsModal:j??Ae,style:[Ee.sheet,{height:re,backgroundColor:k.colors.background.elevated,borderTopLeftRadius:k.radius["2xl"],borderTopRightRadius:k.radius["2xl"],..._corners.smoothCorners,...k.shadows.xl},G?{height:Pe,left:(T-D)/2,right:void 0,width:D,borderBottomLeftRadius:k.radius["2xl"],borderBottomRightRadius:k.radius["2xl"]}:null,S,De],children:(0,_jsxRuntime.jsxs)(SheetBody,{style:[Ee.body,Ve],keyboardOffset:Be,children:[G?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:k.spacing.md}}):(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Oe,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:Ee.handleRow,onLayout:q?F:void 0,accessible:!0,accessibilityLabel:"Drag handle",accessibilityHint:"Drag up or down to resize the sheet, or swipe down to close it",testID:C?`${C}-handle`:"bottom-sheet-handle",children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ee.handle,{backgroundColor:k.components.bottomSheet?.handleColor??k.colors.border.primary},p]})})}),null!=g&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ee.header,R],onLayout:q?z:void 0,children:g}),c?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Me,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{ref:u,style:Ee.content,onScroll:d,onContentSizeChange:ee,onLayout:m,scrollEventThrottle:h,keyboardShouldPersistTaps:"always",keyboardDismissMode:"none",children:N})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:Ee.content,children:q?(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:$,children:N}):N}),null!=x&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ee.footer,y],onLayout:q?U:void 0,children:x})]})})]}),Je=(0,_jsxRuntime.jsx)(BottomSheetContext.Provider,{value:We,children:Fe});return"modal"===f?(0,_jsxRuntime.jsx)(_reactNative.Modal,{transparent:!0,visible:ue,onRequestClose:we,onDismiss:"ios"===_reactNative.Platform.OS?xe:void 0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",supportedOrientations:["portrait","landscape"],children:(0,_jsxRuntime.jsxs)(_reactNativeSafeAreaContext.SafeAreaProvider,{style:Ee.modalRoot,children:[(0,_jsxRuntime.jsx)(InsetsProbe,{onChange:A}),"android"===_reactNative.Platform.OS?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:Ee.modalRoot,children:Je}):Je,(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})}):Je}),InsetsProbe=({onChange:e})=>{const{top:t,bottom:a}=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();return(0,_react.useEffect)(()=>{e(e=>e.top===t&&e.bottom===a?e:{top:t,bottom:a})},[t,a,e]),null},SheetBody=({style:e,keyboardOffset:t,children:a})=>{const r=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)().bottom,o=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=r+t.value;return{paddingBottom:e>0?e:0}});return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[e,o],children:a})};BottomSheet.displayName="BottomSheet";const useMeasuredHeight=()=>{const[e,t]=(0,_react.useState)(0),a=(0,_react.useCallback)(e=>{t(t=>t===e?t:e)},[]);return[e,(0,_react.useCallback)(e=>a(e.nativeEvent.layout.height),[a]),a]},resolveSnapPoints=(e,t,a)=>[...e.map(e=>{if("number"==typeof e)return e;if("content"===e)return a;const r=parseFloat(e);return Number.isNaN(r)?0:r/100*t})].sort((e,t)=>e-t),clamp=(e,t,a)=>Math.min(Math.max(e,t),a),buildStyles=e=>_reactNative.StyleSheet.create({backdropModal:{flex:1},backdropInline:{..._reactNative.StyleSheet.absoluteFill},sheet:{position:"absolute",left:0,right:0,overflow:"hidden"},body:{overflow:"hidden"},handleRow:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingTop:12,paddingBottom:24},header:{},footer:{},handle:{width:36,height:4,borderRadius:2,..._corners.smoothCorners},content:{flex:1,overflow:"hidden"},modalRoot:{flex:1}});var _default=exports.default=BottomSheet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Button=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var i,s,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(i=r?o:t){if(i.has(e))return i.get(e);i.set(e,n)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((s=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(s.get||s.set)?i(n,r,s):n[r]=e[r]);return n})(e,r)}const Button=exports.Button=(0,_react.forwardRef)((e,r)=>{const{title:t,children:o,variant:i="solid",tone:s="primary",size:n="md",loading:a=!1,disabled:l=!1,fullWidth:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Button=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var i,s,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(i=r?o:t){if(i.has(e))return i.get(e);i.set(e,n)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((s=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(s.get||s.set)?i(n,r,s):n[r]=e[r]);return n})(e,r)}const Button=exports.Button=(0,_react.forwardRef)((e,r)=>{const{title:t,children:o,variant:i="solid",tone:s="primary",size:n="md",loading:a=!1,disabled:l=!1,fullWidth:d=!1,leftIcon:c,rightIcon:u,iconVariant:b,leftIconBadge:g=!1,haptic:p="selection",rounded:_=!1,gradient:f,style:h,textStyle:m,pressAnimation:x,onPress:y,accessibilityLabel:S,accessibilityHint:j,testID:v,onLayout:R,...C}=e;if(__DEV__&&hasTextChild(o))throw new Error('[@webority/mobile-ui] Button was given its label as text children. Pass it as `title` (<Button title="Save" />): text children draw a blank button with no accessible name.');const k=(0,_index.useTheme)(),I=!l&&!a,w="link"===i,z=x??(!w&&"scale"),F=(0,_usePressAnimation.usePressAnimation)({preset:z||"scale",enabled:!1!==z&&I}),T=(0,_useFlickGuard.useFlickGuard)(),N=(0,_react.useMemo)(()=>buildStyles(k),[k]),W={...sizeMap[n],...k.components.button?.[n]??{}},q=(0,_react.useMemo)(()=>toneFor(k,s),[k,s]),V=(0,_react.useMemo)(()=>variantFor(k,i,q,l),[k,i,q,l]),H=(0,_react.useMemo)(()=>!f||l||"solid"!==i?null:"string"==typeof f?k.gradients[f]??null:f,[f,l,i,k.gradients]),P=_reactNative.StyleSheet.flatten(h)?.borderRadius,A=w?0:"number"==typeof P?P:_?k.radius.full:W.borderRadius,L=(0,_SquircleFill.useSquircle)(!H&&"link"!==i,A,R),O=(0,_react.useRef)((0,_animatedValue.createAnimatedValue)(0)).current,[E,B]=(0,_react.useState)(0),D=w?e=>B(e.nativeEvent.layout.width):void 0,M=S??t,G="outline"===i||"ghost"===i,U=!G&&!w,K={color:V.textColor,size:W.iconSize,disabled:l},X=g&&!w&&Boolean(c),Y=W.minHeight-2*BADGE_INSET-2*V.borderWidth,J={color:V.badgeInk,size:W.badgeIconSize??W.iconSize,disabled:l},Q=(0,_jsxRuntime.jsx)(_reactNative.View,{style:N.contentRow,children:a?(0,_jsxRuntime.jsx)(_index2.Spinner,{variant:"circular",size:"sm",color:V.textColor,accessibilityLabel:"Loading"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[X?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"button-icon-badge",style:[N.iconLeft,N.iconBadge,{width:Y,height:Y,borderRadius:Y/2,backgroundColor:V.badgeFill}],children:(0,_slotIcon.renderSlotIcon)(c,J,b)}):c?(0,_jsxRuntime.jsx)(_reactNative.View,{style:N.iconLeft,children:(0,_slotIcon.renderSlotIcon)(c,K,b)}):null,t?(0,_jsxRuntime.jsxs)(_reactNative.View,{onLayout:D,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[N.label,{color:V.textColor,fontSize:W.fontSize,...(0,_index.fontFor)(k,"semibold")},m],numberOfLines:1,children:t}),w?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[N.linkUnderline,{backgroundColor:V.textColor,transform:[{translateX:O.interpolate({inputRange:[0,1],outputRange:[-E/2,0]})},{scaleX:O.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}):o,u?(0,_jsxRuntime.jsx)(_reactNative.View,{style:N.iconRight,children:(0,_slotIcon.renderSlotIcon)(u,K,b)}):null]})});return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[F.style,d?N.fullWidth:null],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:r,onPress:e=>{I&&!T.isFlick(e)&&(F.press(),!1!==p&&(0,_hapticUtils.triggerHaptic)(p),y?.(e))},onPressIn:e=>{T.onPressIn(e),F.pressIn(),w&&I&&(O.stopAnimation(),O.setValue(0),_reactNative.Animated.timing(O,{toValue:1,duration:k.motion.duration.slower,easing:_reactNative.Easing.bezier(...k.motion.easing.decelerate),useNativeDriver:!0}).start())},onPressOut:()=>{F.pressOut()},disabled:!I,hitSlop:w?LINK_HIT_SLOP:void 0,accessibilityRole:"button",accessibilityLabel:M,accessibilityHint:j,accessibilityState:{disabled:!I,busy:a},testID:v,onLayout:L.onLayout,style:({pressed:e})=>[N.base,{paddingHorizontal:w?0:W.paddingHorizontal,paddingVertical:w?0:X?BADGE_INSET:W.paddingVertical,paddingLeft:X?BADGE_INSET:void 0,minHeight:w?void 0:W.minHeight,borderRadius:A,..._corners.smoothCorners,backgroundColor:H||L.active?"transparent":V.backgroundColor,borderWidth:V.borderWidth,borderColor:L.active?"transparent":V.borderColor,opacity:a?.55:1,overflow:L.active||w?"visible":"hidden"},e&&G&&!L.active?{backgroundColor:k.colors.surface.pressed}:null,d?N.fullWidth:null,h],...C,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[L.active&&L.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:L.size.width,height:L.size.height,radius:A,fill:e&&G?k.colors.surface.pressed:V.backgroundColor,stroke:V.borderColor,strokeWidth:V.borderWidth,outset:V.borderWidth}):null,H?(0,_jsxRuntime.jsx)(_index.Gradient,{gradient:H,style:[_reactNative.StyleSheet.absoluteFill,{borderRadius:A,..._corners.smoothCorners}]}):null,e&&U?L.active&&L.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:L.size.width,height:L.size.height,radius:A,fill:V.pressedTint,outset:V.borderWidth,testID:"button-pressed"}):(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[N.pressedOverlay,{borderRadius:A,backgroundColor:V.pressedTint,..._corners.smoothCorners}],testID:"button-pressed"}):null,Q]})})})});Button.displayName="Button";const hasTextChild=e=>_react.default.Children.toArray(e).some(e=>"string"==typeof e||"number"==typeof e),sizeMap={xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8,iconSize:14,badgeIconSize:11},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10,iconSize:16},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12,iconSize:18},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14,iconSize:20},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16,iconSize:22}},SOFT_FILL_OPACITY=.14,toneFor=(e,r)=>{switch(r){case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,fg:e.colors.primary,soft:(0,_color.tintOf)(e.colors.primary,.14,e.colors.primaryMuted)};case"secondary":return{base:e.colors.secondary,on:e.colors.onSecondary,fg:e.colors.onSecondary,soft:e.colors.secondary};case"success":return{base:e.colors.success,on:e.colors.onSuccess,fg:e.colors.success,soft:(0,_color.tintOf)(e.colors.success,.14,e.colors.background.secondary)};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,fg:e.colors.warning,soft:(0,_color.tintOf)(e.colors.warning,.14,e.colors.background.secondary)};case"error":return{base:e.colors.error,on:e.colors.onError,fg:e.colors.error,soft:(0,_color.tintOf)(e.colors.error,.14,e.colors.background.secondary)};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,fg:e.colors.text.primary,soft:e.colors.background.secondary}}},BADGE_INSET=4,BUTTON_BORDER_WIDTH=1,LINK_HIT_SLOP={top:8,bottom:8,left:8,right:8},variantFor=(e,r,t,o)=>{const i=o?e.colors.text.disabled:t.fg,s={badgeFill:e.colors.surface.disabled,badgeInk:e.colors.text.disabled},n=o?s:{badgeFill:t.on,badgeInk:t.base},a=o?s:{badgeFill:t.base,badgeInk:t.on};switch(r){case"solid":return{backgroundColor:o?e.colors.surface.disabled:t.base,borderColor:"transparent",borderWidth:1,textColor:o?e.colors.text.disabled:t.on,pressedTint:e.colors.surface.pressed,...n};case"soft":return{backgroundColor:o?e.colors.surface.disabled:t.soft,borderColor:"transparent",borderWidth:1,textColor:i,pressedTint:e.colors.surface.pressed,...a};case"outline":return{backgroundColor:"transparent",borderColor:o?e.colors.border.primary:t.base,borderWidth:1,textColor:i,pressedTint:e.colors.surface.pressed,...a};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:i,pressedTint:e.colors.surface.pressed,...a};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:o?e.colors.text.disabled:e.colors.text.link,pressedTint:e.colors.surface.pressed,...a};case"glass":return{backgroundColor:e.colors.glass.fill,borderColor:e.colors.glass.border,borderWidth:1,textColor:o?e.colors.text.disabled:e.colors.glass.on,pressedTint:_color.ACCENT_PRESSED_TINT,badgeFill:e.colors.glass.badge,badgeInk:o?e.colors.text.disabled:t.base};default:return{backgroundColor:t.base,borderColor:"transparent",borderWidth:1,textColor:t.on,pressedTint:e.colors.surface.pressed,...n}}},buildStyles=e=>_reactNative.StyleSheet.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:1},iconLeft:{marginRight:8},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:8},fullWidth:{alignSelf:"stretch"}});var _default=exports.default=Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.buildPieces=exports.DEFAULT_PHYSICS=exports.Confetti=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if("function"==typeof WeakMap)var t=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,a){if(!a&&e&&e.__esModule)return e;var i,s,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(i=a?r:t){if(i.has(e))return i.get(e);i.set(e,n)}for(const a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((s=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,a))&&(s.get||s.set)?i(n,a,s):n[a]=e[a]);return n})(e,a)}const TAU=2*Math.PI,DEG=Math.PI/180,SPEED_FACTOR={slow:1.6,normal:1,fast:.6},DEFAULT_PHYSICS=exports.DEFAULT_PHYSICS={velocity:1,drag:1,fallSpeed:1,spread:0},PRESET_SHAPES={pop:["strip","strip","strip","square","circle","triangle","star","streamer"],rain:["strip","strip","strip","circle","square"],fireworks:["circle","circle","star","star","triangle","strip"]},rand=(e,a)=>e+Math.random()*(a-e),pick=e=>e[Math.floor(Math.random()*e.length)]??e[0],commonPiece=(e,a)=>({color:e.colors[a%e.colors.length]??e.colors[0],size:e.baseSize*rand(.6,1.4),shape:pick(e.shapes),rotations:rand(1,5),rotateDir:Math.random()<.5?1:-1,flutterFreq:rand(2,5)}),popPiece=(e,a)=>{const t=e.physics.spread>0?e.physics.spread/2:100,r=(-90+rand(-t,t))*DEG,i=rand(1.8,4.2)*e.physics.velocity;return{...commonPiece(e,a),x0Frac:e.originXFrac,y0Frac:e.originYFrac,vxFrac:Math.cos(r)*i*.7,vyFrac:Math.sin(r)*i,drag:rand(5.5,7.5)*e.physics.drag,terminalFrac:rand(.22,.44)*e.physics.fallSpeed,delay:rand(0,.05),swayAmp:rand(4,16),swayFreq:rand(1,3)}},rainPiece=(e,a)=>({...commonPiece(e,a),x0Frac:Math.random(),y0Frac:-.05,vxFrac:rand(-.12,.12)*e.physics.velocity,vyFrac:rand(.05,.25)*e.physics.velocity,drag:rand(2.5,4)*e.physics.drag,terminalFrac:rand(.95,1.35)*e.physics.fallSpeed,delay:rand(0,.35),swayAmp:rand(10,30),swayFreq:rand(1,3)}),FIREWORK_BURSTS=4,buildFireworks=(e,a)=>{const t=Math.max(1,Math.round(e/4)),r=a.physics.spread>0?a.physics.spread/2:180,i=[];for(let s=0;s<4&&i.length<e;s+=1){const n=rand(.18,.82),c=rand(.18,.52),o=s/4*.5+rand(0,.06);for(let s=0;s<t&&i.length<e;s+=1){const e=rand(-r,r)*DEG,t=rand(1.4,3.4)*a.physics.velocity;i.push({...commonPiece(a,i.length),x0Frac:n,y0Frac:c,vxFrac:Math.cos(e)*t*.7,vyFrac:Math.sin(e)*t,drag:rand(6.5,8.5)*a.physics.drag,terminalFrac:rand(.18,.38)*a.physics.fallSpeed,delay:o,swayAmp:rand(3,12),swayFreq:rand(1,3)})}}return i},buildPieces=(e,a,t)=>{if("fireworks"===a)return buildFireworks(e,t);const r="rain"===a?rainPiece:popPiece;return Array.from({length:e},(e,a)=>r(t,a))};exports.buildPieces=buildPieces;const SHAPE_BOX={strip:{w:1,h:.45},square:{w:1,h:1},circle:{w:1,h:1},triangle:{w:1,h:1},star:{w:1.2,h:1.2},streamer:{w:3,h:1.2}},TRIANGLE_POINTS="50,4 96,96 4,96",STAR_POINTS="50,2 61,36 97,36 68,58 79,94 50,72 21,94 32,58 3,36 39,36",STREAMER_PATH="M2,50 C20,6 44,94 62,50 S92,6 98,50",ShapeBody=({shape:e,color:a})=>"triangle"===e||"star"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Polygon,{points:"star"===e?STAR_POINTS:TRIANGLE_POINTS,fill:a})}):"streamer"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:STREAMER_PATH,stroke:a,strokeWidth:22,strokeLinecap:"round",fill:"none"})}):null,ConfettiPiece=({piece:e,progress:a,width:t,height:r,fadeOut:i})=>{const s=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const s=1-e.delay,n=s<=0?0:Math.min(1,Math.max(0,(a.value-e.delay)/s)),c=(1-Math.exp(-e.drag*n))/e.drag,o=e.x0Frac*t+e.vxFrac*t*c,d=e.y0Frac*r+e.terminalFrac*r*n+(e.vyFrac-e.terminalFrac)*r*c,l=Math.sin(n*e.swayFreq*TAU)*e.swayAmp,h=e.rotateDir*e.rotations*360*n,p=.35+.65*Math.abs(Math.cos(n*e.flutterFreq*TAU));return{opacity:i?Math.max(0,1-Math.max(0,n-.75)/.25):1,transform:[{translateX:o+l},{translateY:d},{rotate:`${h}deg`},{scaleY:p}]}}),n=SHAPE_BOX[e.shape],c="triangle"===e.shape||"star"===e.shape||"streamer"===e.shape;return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[{position:"absolute",width:e.size*n.w,height:e.size*n.h,borderRadius:"circle"===e.shape?e.size*n.h/2:1,backgroundColor:c?"transparent":e.color},s],children:(0,_jsxRuntime.jsx)(ShapeBody,{shape:e.shape,color:e.color})})},Confetti=exports.Confetti=(0,_react.forwardRef)(({count:e=80,colors:a,preset:t="pop",shapes:r,speed:i="normal",physics:s,origin:n,duration:c=2800,fadeOut:o=!0,autoStart:d=!1,recycle:l=!1,size:h=10,onComplete:p,style:u,testID:_},m)=>{const y=(0,_index2.useTheme)(),v=(0,_index.useReducedMotion)(),f=(0,_reactNative.useWindowDimensions)(),[g,x]=(0,_react.useState)({width:f.width,height:f.height}),[S,w]=(0,_react.useState)(!1),[R,F]=(0,_react.useState)([]),P=(0,_react.useMemo)(()=>a??[y.colors.primary,y.colors.secondary,y.colors.success,y.colors.warning,y.colors.error,y.colors.info],[a,y.colors]),M=(0,_reactNativeReanimated.useSharedValue)(0),A=c*SPEED_FACTOR[i],E=(0,_react.useCallback)(()=>{w(!1),p?.()},[p]),N=(0,_react.useCallback)(()=>{if(v)return void p?.();(0,_reactNativeReanimated.cancelAnimation)(M),M.value=0,F(buildPieces(e,t,{colors:P,baseSize:h,originXFrac:n?n.x/Math.max(1,g.width):.5,originYFrac:n?n.y/Math.max(1,g.height):.5,physics:{...DEFAULT_PHYSICS,...s},shapes:r??PRESET_SHAPES[t]})),w(!0);const a=(0,_reactNativeReanimated.withTiming)(1,{duration:A,easing:_reactNativeReanimated.Easing.linear},e=>{e&&!l&&(0,_reactNativeReanimated.runOnJS)(E)()});M.value=l?(0,_reactNativeReanimated.withRepeat)(a,-1,!1):a},[v,M,A,l,E,p,e,P,t,r,s,h,n,g.width,g.height]),T=(0,_react.useCallback)(()=>{(0,_reactNativeReanimated.cancelAnimation)(M),w(!1)},[M]);(0,_react.useImperativeHandle)(m,()=>({start:N,stop:T}),[N,T]),(0,_react.useEffect)(()=>(d&&N(),()=>(0,_reactNativeReanimated.cancelAnimation)(M)),[]);const j=(0,_react.useCallback)(e=>{const{width:a,height:t}=e.nativeEvent.layout;a>0&&t>0&&x({width:a,height:t})},[]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_reactNative.StyleSheet.absoluteFill,u],pointerEvents:"none",onLayout:j,testID:_,children:S?R.map((e,a)=>(0,_jsxRuntime.jsx)(ConfettiPiece,{piece:e,progress:M,width:g.width,height:g.height,fadeOut:o},a)):null})});Confetti.displayName="Confetti";var _default=exports.default=Confetti;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.buildPieces=exports.DEFAULT_PHYSICS=exports.Confetti=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if("function"==typeof WeakMap)var t=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,a){if(!a&&e&&e.__esModule)return e;var i,s,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(i=a?r:t){if(i.has(e))return i.get(e);i.set(e,n)}for(const a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((s=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,a))&&(s.get||s.set)?i(n,a,s):n[a]=e[a]);return n})(e,a)}const TAU=2*Math.PI,DEG=Math.PI/180,SPEED_FACTOR={slow:1.6,normal:1,fast:.6},DEFAULT_PHYSICS=exports.DEFAULT_PHYSICS={velocity:1,drag:1,fallSpeed:1,spread:0},PRESET_SHAPES={pop:["strip","strip","strip","square","circle","triangle","star","streamer"],rain:["strip","strip","strip","circle","square"],fireworks:["circle","circle","star","star","triangle","strip"]},rand=(e,a)=>e+Math.random()*(a-e),pick=e=>e[Math.floor(Math.random()*e.length)]??e[0],commonPiece=(e,a)=>({color:e.colors[a%e.colors.length]??e.colors[0],size:e.baseSize*rand(.6,1.4),shape:pick(e.shapes),rotations:rand(1,5),rotateDir:Math.random()<.5?1:-1,flutterFreq:rand(2,5)}),popPiece=(e,a)=>{const t=e.physics.spread>0?e.physics.spread/2:100,r=(-90+rand(-t,t))*DEG,i=rand(1.8,4.2)*e.physics.velocity;return{...commonPiece(e,a),x0Frac:e.originXFrac,y0Frac:e.originYFrac,vxFrac:Math.cos(r)*i*.7,vyFrac:Math.sin(r)*i,drag:rand(5.5,7.5)*e.physics.drag,terminalFrac:rand(.22,.44)*e.physics.fallSpeed,delay:rand(0,.05),swayAmp:rand(4,16),swayFreq:rand(1,3)}},rainPiece=(e,a)=>({...commonPiece(e,a),x0Frac:Math.random(),y0Frac:-.05,vxFrac:rand(-.12,.12)*e.physics.velocity,vyFrac:rand(.05,.25)*e.physics.velocity,drag:rand(2.5,4)*e.physics.drag,terminalFrac:rand(.95,1.35)*e.physics.fallSpeed,delay:rand(0,.35),swayAmp:rand(10,30),swayFreq:rand(1,3)}),FIREWORK_BURSTS=4,buildFireworks=(e,a)=>{const t=Math.max(1,Math.round(e/4)),r=a.physics.spread>0?a.physics.spread/2:180,i=[];for(let s=0;s<4&&i.length<e;s+=1){const n=rand(.18,.82),c=rand(.18,.52),o=s/4*.5+rand(0,.06);for(let s=0;s<t&&i.length<e;s+=1){const e=rand(-r,r)*DEG,t=rand(1.4,3.4)*a.physics.velocity;i.push({...commonPiece(a,i.length),x0Frac:n,y0Frac:c,vxFrac:Math.cos(e)*t*.7,vyFrac:Math.sin(e)*t,drag:rand(6.5,8.5)*a.physics.drag,terminalFrac:rand(.18,.38)*a.physics.fallSpeed,delay:o,swayAmp:rand(3,12),swayFreq:rand(1,3)})}}return i},buildPieces=(e,a,t)=>{if("fireworks"===a)return buildFireworks(e,t);const r="rain"===a?rainPiece:popPiece;return Array.from({length:e},(e,a)=>r(t,a))};exports.buildPieces=buildPieces;const SHAPE_BOX={strip:{w:1,h:.45},square:{w:1,h:1},circle:{w:1,h:1},triangle:{w:1,h:1},star:{w:1.2,h:1.2},streamer:{w:3,h:1.2}},TRIANGLE_POINTS="50,4 96,96 4,96",STAR_POINTS="50,2 61,36 97,36 68,58 79,94 50,72 21,94 32,58 3,36 39,36",STREAMER_PATH="M2,50 C20,6 44,94 62,50 S92,6 98,50",ShapeBody=({shape:e,color:a})=>"triangle"===e||"star"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Polygon,{points:"star"===e?STAR_POINTS:TRIANGLE_POINTS,fill:a})}):"streamer"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:STREAMER_PATH,stroke:a,strokeWidth:22,strokeLinecap:"round",fill:"none"})}):null,ConfettiPiece=({piece:e,progress:a,width:t,height:r,fadeOut:i})=>{const s=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const s=1-e.delay,n=s<=0?0:Math.min(1,Math.max(0,(a.value-e.delay)/s)),c=(1-Math.exp(-e.drag*n))/e.drag,o=e.x0Frac*t+e.vxFrac*t*c,d=e.y0Frac*r+e.terminalFrac*r*n+(e.vyFrac-e.terminalFrac)*r*c,l=Math.sin(n*e.swayFreq*TAU)*e.swayAmp,h=e.rotateDir*e.rotations*360*n,p=.35+.65*Math.abs(Math.cos(n*e.flutterFreq*TAU));return{opacity:i?Math.max(0,1-Math.max(0,n-.75)/.25):1,transform:[{translateX:o+l},{translateY:d},{rotate:`${h}deg`},{scaleY:p}]}}),n=SHAPE_BOX[e.shape],c="triangle"===e.shape||"star"===e.shape||"streamer"===e.shape;return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[{position:"absolute",width:e.size*n.w,height:e.size*n.h,borderRadius:"circle"===e.shape?e.size*n.h/2:1,backgroundColor:c?"transparent":e.color},s],children:(0,_jsxRuntime.jsx)(ShapeBody,{shape:e.shape,color:e.color})})},Confetti=exports.Confetti=(0,_react.forwardRef)(({count:e=80,colors:a,preset:t="pop",shapes:r,speed:i="normal",physics:s,origin:n,duration:c=2800,fadeOut:o=!0,autoStart:d=!1,recycle:l=!1,size:h=10,onComplete:p,style:u,testID:_},m)=>{const y=(0,_index2.useTheme)(),v=(0,_index.useReducedMotion)(),f=(0,_reactNative.useWindowDimensions)(),[g,x]=(0,_react.useState)({width:f.width,height:f.height}),[S,w]=(0,_react.useState)(!1),[R,F]=(0,_react.useState)([]),P=(0,_react.useMemo)(()=>a??[y.colors.primary,y.colors.secondary,y.colors.success,y.colors.warning,y.colors.error,y.colors.info],[a,y.colors]),M=(0,_reactNativeReanimated.useSharedValue)(0),A=c*SPEED_FACTOR[i],E=(0,_react.useCallback)(()=>{w(!1),p?.()},[p]),N=(0,_react.useCallback)(()=>{if(v)return void p?.();(0,_reactNativeReanimated.cancelAnimation)(M),M.value=0,F(buildPieces(e,t,{colors:P,baseSize:h,originXFrac:n?n.x/Math.max(1,g.width):.5,originYFrac:n?n.y/Math.max(1,g.height):.5,physics:{...DEFAULT_PHYSICS,...s},shapes:r??PRESET_SHAPES[t]})),w(!0);const a=(0,_reactNativeReanimated.withTiming)(1,{duration:A,easing:_reactNativeReanimated.Easing.linear},e=>{"worklet";e&&!l&&(0,_reactNativeReanimated.runOnJS)(E)()});M.value=l?(0,_reactNativeReanimated.withRepeat)(a,-1,!1):a},[v,M,A,l,E,p,e,P,t,r,s,h,n,g.width,g.height]),T=(0,_react.useCallback)(()=>{(0,_reactNativeReanimated.cancelAnimation)(M),w(!1)},[M]);(0,_react.useImperativeHandle)(m,()=>({start:N,stop:T}),[N,T]),(0,_react.useEffect)(()=>(d&&N(),()=>(0,_reactNativeReanimated.cancelAnimation)(M)),[]);const j=(0,_react.useCallback)(e=>{const{width:a,height:t}=e.nativeEvent.layout;a>0&&t>0&&x({width:a,height:t})},[]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_reactNative.StyleSheet.absoluteFill,u],pointerEvents:"none",onLayout:j,testID:_,children:S?R.map((e,a)=>(0,_jsxRuntime.jsx)(ConfettiPiece,{piece:e,progress:M,width:g.width,height:g.height,fadeOut:o},a)):null})});Confetti.displayName="Confetti";var _default=exports.default=Confetti;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Drawer=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,n,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:a){if(i.has(e))return i.get(e);i.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?i(o,t,n):o[t]=e[t]);return o})(e,t)}const DEFAULT_CLOSE_VELOCITY_THRESHOLD=1e3,DEFAULT_DRAG_ACTIVATION_OFFSET=10,Drawer=exports.Drawer=(0,_react.forwardRef)((e,t)=>{const{visible:a,defaultVisible:r=!1,onChange:i,side:n="left",width:o,enableSwipe:s=!0,enableBackdropPress:l=!0,backdropOpacity:c=.5,haptic:u,containerStyle:d,children:_,accessibilityLabel:p,testID:f}=e,v=(0,_index.useTheme)(),h=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),b="boolean"==typeof a,m=v.components.drawer,g=m?.closeVelocityThreshold??1e3,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Drawer=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,n,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:a){if(i.has(e))return i.get(e);i.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?i(o,t,n):o[t]=e[t]);return o})(e,t)}const DEFAULT_CLOSE_VELOCITY_THRESHOLD=1e3,DEFAULT_DRAG_ACTIVATION_OFFSET=10,Drawer=exports.Drawer=(0,_react.forwardRef)((e,t)=>{const{visible:a,defaultVisible:r=!1,onChange:i,side:n="left",width:o,enableSwipe:s=!0,enableBackdropPress:l=!0,backdropOpacity:c=.5,haptic:u,containerStyle:d,children:_,accessibilityLabel:p,testID:f}=e,v=(0,_index.useTheme)(),h=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),b="boolean"==typeof a,m=v.components.drawer,g=m?.closeVelocityThreshold??1e3,w=m?.dragActivationOffset??10,[y,N]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window"));(0,_react.useEffect)(()=>{const e=_reactNative.Dimensions.addEventListener("change",({window:e})=>N(e));return()=>e.remove()},[]);const R="left"===n||"right"===n,x=(0,_react.useMemo)(()=>resolveSize(o,R,y),[o,R,y]),S=(0,_react.useMemo)(()=>{switch(n){case"left":case"top":return-x;case"right":case"bottom":return x}},[n,x]),k=(0,_reactNativeReanimated.useSharedValue)(r?0:S),j=(0,_reactNativeReanimated.useSharedValue)(r?0:S),[M,O]=(0,_react.useState)(r),C=(0,_reactNativeReanimated.useSharedValue)(r);(0,_react.useEffect)(()=>{M||(k.value=S,j.value=S)},[S,M,k,j]);const D=v.motion.spring.snappy,E=(0,_react.useCallback)(()=>{k.value=(0,_reactNativeReanimated.withSpring)(0,D)},[k,D]),L=(0,_react.useCallback)(()=>{k.value=(0,_reactNativeReanimated.withSpring)(S,D)},[k,S,D]),q=(0,_react.useCallback)(e=>{O(t=>t===e?t:(i?.(e),e)),C.value=e},[i,C]),A=(0,_react.useCallback)(()=>{q(!0),E()},[q,E]),T=(0,_react.useCallback)(()=>{q(!1),L()},[q,L]),V=(0,_react.useCallback)(()=>{M?T():A()},[M,A,T]);(0,_react.useImperativeHandle)(t,()=>({open:A,close:T,toggle:V}),[A,T,V]),(0,_react.useEffect)(()=>{b&&a!==M&&(a?A():T())},[a]);const P=(0,_react.useMemo)(()=>{const e=S,t=n,a=s;let r=_reactNativeGestureHandler.Gesture.Pan();return r=R?r.activeOffsetX([-w,w]).failOffsetY([-15,15]):r.activeOffsetY([-w,w]).failOffsetX([-15,15]),r.onStart(()=>{"worklet";a&&(j.value=k.value)}).onUpdate(t=>{"worklet";if(!a)return;const r=R?t.translationX:t.translationY,i=j.value+r,n=Math.min(0,e),o=Math.max(0,e);k.value=i<n?n+.25*(i-n):i>o?o+.25*(i-o):i}).onEnd(r=>{"worklet";if(!a)return;const i=R?r.velocityX:r.velocityY,n=k.value;let o=!1;o="left"===t||"top"===t?i<-g:i>g;const s=Math.abs(e),l=Math.abs(n)/s;o||l>.5?((0,_reactNativeReanimated.runOnJS)(q)(!1),k.value=(0,_reactNativeReanimated.withSpring)(e,D)):((0,_reactNativeReanimated.runOnJS)(q)(!0),k.value=(0,_reactNativeReanimated.withSpring)(0,D))})},[S,j,s,R,k,q,n,D,g,w]),F=(0,_reactNativeReanimated.useAnimatedStyle)(()=>R?{transform:[{translateX:k.value}]}:{transform:[{translateY:k.value}]}),H=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:(0,_reactNativeReanimated.interpolate)(k.value,[S,0],[0,c],_reactNativeReanimated.Extrapolation.CLAMP),pointerEvents:Math.abs(k.value-S)<.5?"none":"auto"}),[S,c]),I=(0,_react.useMemo)(()=>buildStyles(v),[v]),W=(0,_react.useCallback)(()=>{if(!l)return;const e=(0,_index2.resolveHaptic)(u,"selection");e&&(0,_index2.triggerHaptic)(e),T()},[l,T,u]),G=(0,_react.useMemo)(()=>{switch(n){case"left":return{position:"absolute",top:0,bottom:0,left:0,width:x,paddingTop:h.top,paddingBottom:h.bottom,paddingLeft:h.left};case"right":return{position:"absolute",top:0,bottom:0,right:0,width:x,paddingTop:h.top,paddingBottom:h.bottom,paddingRight:h.right};case"top":return{position:"absolute",top:0,left:0,right:0,height:x,paddingTop:h.top,paddingLeft:h.left,paddingRight:h.right};case"bottom":return{position:"absolute",bottom:0,left:0,right:0,height:x,paddingBottom:h.bottom,paddingLeft:h.left,paddingRight:h.right}}},[n,x,h]),Y=(0,_react.useRef)(r);return M&&(Y.current=!0),Y.current?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_reactNative.StyleSheet.absoluteFill,pointerEvents:"box-none",testID:f,accessibilityViewIsModal:M,children:[(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[I.backdrop,{backgroundColor:v.colors.background.overlay},H],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:W,accessibilityRole:"button",accessibilityLabel:"Close drawer",disabled:!l||!M})}),(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:P,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{accessibilityRole:"alert",accessibilityLabel:p??"Drawer",style:[G,{backgroundColor:v.colors.background.elevated,...v.shadows.xl},d,F],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.content,children:_})})})]}):null});Drawer.displayName="Drawer";const resolveSize=(e,t,a)=>{if("number"==typeof e)return e;if("string"==typeof e){const r=parseFloat(e);if(Number.isNaN(r))return t?280:Math.round(.4*a.height);return r/100*(t?a.width:a.height)}return t?280:Math.round(.4*a.height)},buildStyles=e=>_reactNative.StyleSheet.create({backdrop:{..._reactNative.StyleSheet.absoluteFill},content:{flex:1}});var _default=exports.default=Drawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ImageGallery=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index3=require("../Carousel/index.js"),_index4=require("../Skeleton/index.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,r,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(n=t?i:a){if(n.has(e))return n.get(e);n.set(e,l)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((r=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(r.get||r.set)?n(l,t,r):l[t]=e[t]);return l})(e,t)}const MAX_SCALE_FALLBACK=4,MIN_SCALE_FALLBACK=1,DOUBLE_TAP_SCALE_FALLBACK=2,SPRING_CONFIG={damping:18,stiffness:220,mass:1},ImageGallery=({images:e,initialIndex:t=0,showThumbnails:a=!0,showCounter:i=!0,enableLightbox:n=!0,enablePinchZoom:r=!0,onIndexChange:l,haptic:s,loading:o=!1,accessibilityLabel:c,containerStyle:u,testID:d})=>{const m=(0,_index.useTheme)(),_=(0,_react.useMemo)(()=>buildStyles(m),[m]),[h,g]=(0,_react.useState)(clamp(t,0,Math.max(0,e.length-1))),[v,x]=(0,_react.useState)(!1),p=(0,_react.useCallback)(e=>{g(e),l?.(e)},[l]),b=(0,_react.useCallback)(()=>{if(!n)return;const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),x(!0)},[n,s]),y=(0,_react.useCallback)(()=>{const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),x(!1)},[s]),R=(0,_react.useCallback)((t,a)=>{const i=t.alt??`Image ${a+1} of ${e.length}`;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:b,accessibilityRole:"image",accessibilityLabel:i,accessibilityHint:n?"Tap to open fullscreen":void 0,style:_.imageWrap,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:t.source,style:_.image,resizeMode:"cover"})})},[n,e.length,b,_]),S=(0,_react.useCallback)(e=>(0,_jsxRuntime.jsx)(_reactNative.Image,{source:e.source,style:_.thumbnailImage,resizeMode:"cover"}),[_]),N=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_.container,u],testID:d,accessibilityLabel:c??"Image gallery",children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_.carouselWrap,children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{data:e,defaultIndex:t,onIndexChange:p,renderItem:R,showPagination:!1,showThumbnails:a,renderThumbnail:S,haptic:s}),i&&e.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:_.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_.counterText,{color:m.colors.onOverlay}],accessibilityLabel:`Image ${h+1} of ${e.length}`,children:`${h+1} / ${e.length}`})}):null]}),n?(0,_jsxRuntime.jsx)(Lightbox,{visible:v,images:e,initialIndex:h,enablePinchZoom:r,showCounter:i,onClose:y,onIndexChange:p,haptic:s}):null]});return o?(0,_jsxRuntime.jsx)(ImageGallerySkeleton,{images:e,showThumbnails:a,showCounter:i,containerStyle:u,testID:d}):N};exports.ImageGallery=ImageGallery,ImageGallery.displayName="ImageGallery";const ImageGallerySkeleton=({images:e,showThumbnails:t=!0,showCounter:a=!0,containerStyle:i,testID:n})=>{const r=Math.min(e?.length||4,6);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{width:"100%"},i],testID:n,accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:"relative"},children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:"100%",height:280,radius:"lg"}),a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:"absolute",top:12,right:12},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:44,height:22,radius:"full"})}):null]}),t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:12},children:Array.from({length:r}).map((e,t)=>(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:64,height:64,radius:"md",style:{marginRight:8}},`sk-thumb-${t}`))}):null]})};ImageGallerySkeleton.displayName="ImageGallerySkeleton",ImageGallery.Skeleton=ImageGallerySkeleton;const Lightbox=({visible:e,images:t,initialIndex:a,enablePinchZoom:i,showCounter:n,onClose:r,onIndexChange:l,haptic:s})=>{const o=(0,_index.useTheme)(),c=(0,_react.useMemo)(()=>buildLightboxStyles(o),[o]),u=o.components.imageGallery,d=u?.maxScale??4,m=u?.minScale??1,_=u?.doubleTapScale??2,h=(0,_react.useRef)(null),[g,v]=(0,_react.useState)(a),x=(0,_react.useCallback)(e=>{if(e!==g){const t=(0,_index2.resolveHaptic)(s,"selection");t&&(0,_index2.triggerHaptic)(t),v(e),l(e)}},[g,l,s]),p=(0,_react.useCallback)((e,a)=>(0,_jsxRuntime.jsx)(ZoomableImage,{image:e,index:a,total:t.length,active:a===g,enabled:i,maxScale:d,minScale:m,doubleTapScale:_,haptic:s}),[g,i,t.length,d,m,_,s]),b=t[g]?.caption;return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:e,transparent:!0,statusBarTranslucent:!0,presentationStyle:"overFullScreen",animationType:"fade",onRequestClose:r,accessibilityViewIsModal:!0,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.backdrop,accessibilityViewIsModal:!0,children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{ref:h,data:t,defaultIndex:a,onIndexChange:x,renderItem:p,showPagination:!1,haptic:s}),n&&t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:c.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[c.counterText,{color:o.colors.onOverlay}],accessibilityLabel:`Image ${g+1} of ${t.length}`,children:`${g+1} / ${t.length}`})}):null,(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:"Close gallery",style:c.closeButton,hitSlop:12,children:(o.icons?.close??_defaultIcons.defaultIcons.close)({size:24,color:o.colors.onOverlay})}),b?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:c.captionWrap,entering:void 0,accessibilityElementsHidden:!1,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:c.captionText,numberOfLines:3,children:b})}):null,(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})})},ZoomableImage=({image:e,index:t,total:a,active:i,enabled:n,maxScale:r,minScale:l,doubleTapScale:s,haptic:o})=>{const c=_reactNative.Dimensions.get("window"),u=(0,_reactNativeReanimated.useSharedValue)(1),d=(0,_reactNativeReanimated.useSharedValue)(1),m=(0,_reactNativeReanimated.useSharedValue)(0),_=(0,_reactNativeReanimated.useSharedValue)(0),h=(0,_reactNativeReanimated.useSharedValue)(0),g=(0,_reactNativeReanimated.useSharedValue)(0),v=(0,_react.useCallback)(()=>{u.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),d.value=1,m.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=0,g.value=0},[u,d,m,_,h,g]);_react.default.useEffect(()=>{i||(u.value=(0,_reactNativeReanimated.withTiming)(1,{duration:150}),m.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),_.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),d.value=1,h.value=0,g.value=0)},[i,u,m,_,d,h,g]);const x=(0,_react.useCallback)(()=>{!1!==o&&(0,_index2.triggerHaptic)("impactLight")},[o]),p=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pinch().enabled(n).onStart(()=>{d.value=u.value}).onUpdate(e=>{const t=d.value*e.scale;u.value=t<l?l+.3*(t-l):t>r?r+.2*(t-r):t}).onEnd(()=>u.value<l?(u.value=(0,_reactNativeReanimated.withSpring)(l,SPRING_CONFIG),m.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),d.value=l,h.value=0,void(g.value=0)):u.value>r?(u.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),void(d.value=r)):void(d.value=u.value)),[n,u,d,m,_,h,g,l,r]),b=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pan().minPointers(1).maxPointers(1).onStart(()=>{h.value=m.value,g.value=_.value}).onUpdate(e=>{u.value<=1||(m.value=h.value+e.translationX,_.value=g.value+e.translationY)}).onEnd(()=>{h.value=m.value,g.value=_.value}),[u,m,_,h,g]),y=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Tap().numberOfTaps(2).onEnd(()=>{(0,_reactNativeReanimated.runOnJS)(x)(),u.value>1?(u.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),m.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),d.value=1,h.value=0,g.value=0):(u.value=(0,_reactNativeReanimated.withSpring)(s,SPRING_CONFIG),d.value=s)}),[u,d,m,_,h,g,x,s]),R=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Race(p,b,y),[p,b,y]),S=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:m.value},{translateY:_.value},{scale:u.value}]}));_react.default.useEffect(()=>{i||v()},[i,v]);const N=e.alt??`Image ${t+1} of ${a}`;return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:R,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[lightboxImageStyles.container,{width:c.width}],children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.Image,{source:e.source,resizeMode:"contain",style:[lightboxImageStyles.image,S],accessibilityLabel:N,accessible:!0})})})},clamp=(e,t,a)=>Math.min(Math.max(e,t),a),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},carouselWrap:{width:"100%",position:"relative"},imageWrap:{width:"100%",aspectRatio:16/9,backgroundColor:e.colors.background.secondary,overflow:"hidden",borderRadius:e.radius.md,..._corners.smoothCorners},image:{width:"100%",height:"100%"},thumbnailImage:{width:"100%",height:"100%"},counterPill:{position:"absolute",top:12,alignSelf:"center",paddingHorizontal:12,paddingVertical:4,borderRadius:e.radius.full,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.55)"},counterText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}}),buildLightboxStyles=e=>_reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:"#000",justifyContent:"center"},counterPill:{position:"absolute",top:48,alignSelf:"center",paddingHorizontal:14,paddingVertical:6,borderRadius:e.radius.full,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.6)"},counterText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold},closeButton:{position:"absolute",top:44,right:16,width:40,height:40,borderRadius:20,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)"},captionWrap:{position:"absolute",left:0,right:0,bottom:32,paddingHorizontal:24},captionText:{color:"#FFFFFF",fontSize:14,lineHeight:20,textAlign:"center"}}),lightboxImageStyles=_reactNative.StyleSheet.create({container:{flex:1,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"}});var _default=exports.default=ImageGallery;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ImageGallery=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index3=require("../Carousel/index.js"),_index4=require("../Skeleton/index.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var r,n,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(r=t?i:a){if(r.has(e))return r.get(e);r.set(e,l)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?r(l,t,n):l[t]=e[t]);return l})(e,t)}const MAX_SCALE_FALLBACK=4,MIN_SCALE_FALLBACK=1,DOUBLE_TAP_SCALE_FALLBACK=2,SPRING_CONFIG={damping:18,stiffness:220,mass:1},ImageGallery=({images:e,initialIndex:t=0,showThumbnails:a=!0,showCounter:i=!0,enableLightbox:r=!0,enablePinchZoom:n=!0,onIndexChange:l,haptic:s,loading:o=!1,accessibilityLabel:c,containerStyle:u,testID:d})=>{const m=(0,_index.useTheme)(),_=(0,_react.useMemo)(()=>buildStyles(m),[m]),[h,g]=(0,_react.useState)(clamp(t,0,Math.max(0,e.length-1))),[v,x]=(0,_react.useState)(!1),p=(0,_react.useCallback)(e=>{g(e),l?.(e)},[l]),b=(0,_react.useCallback)(()=>{if(!r)return;const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),x(!0)},[r,s]),y=(0,_react.useCallback)(()=>{const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),x(!1)},[s]),R=(0,_react.useCallback)((t,a)=>{const i=t.alt??`Image ${a+1} of ${e.length}`;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:b,accessibilityRole:"image",accessibilityLabel:i,accessibilityHint:r?"Tap to open fullscreen":void 0,style:_.imageWrap,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:t.source,style:_.image,resizeMode:"cover"})})},[r,e.length,b,_]),S=(0,_react.useCallback)(e=>(0,_jsxRuntime.jsx)(_reactNative.Image,{source:e.source,style:_.thumbnailImage,resizeMode:"cover"}),[_]),N=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_.container,u],testID:d,accessibilityLabel:c??"Image gallery",children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_.carouselWrap,children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{data:e,defaultIndex:t,onIndexChange:p,renderItem:R,showPagination:!1,showThumbnails:a,renderThumbnail:S,haptic:s}),i&&e.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:_.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_.counterText,{color:m.colors.onOverlay}],accessibilityLabel:`Image ${h+1} of ${e.length}`,children:`${h+1} / ${e.length}`})}):null]}),r?(0,_jsxRuntime.jsx)(Lightbox,{visible:v,images:e,initialIndex:h,enablePinchZoom:n,showCounter:i,onClose:y,onIndexChange:p,haptic:s}):null]});return o?(0,_jsxRuntime.jsx)(ImageGallerySkeleton,{images:e,showThumbnails:a,showCounter:i,containerStyle:u,testID:d}):N};exports.ImageGallery=ImageGallery,ImageGallery.displayName="ImageGallery";const ImageGallerySkeleton=({images:e,showThumbnails:t=!0,showCounter:a=!0,containerStyle:i,testID:r})=>{const n=Math.min(e?.length||4,6);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{width:"100%"},i],testID:r,accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:"relative"},children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:"100%",height:280,radius:"lg"}),a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:"absolute",top:12,right:12},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:44,height:22,radius:"full"})}):null]}),t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:12},children:Array.from({length:n}).map((e,t)=>(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:64,height:64,radius:"md",style:{marginRight:8}},`sk-thumb-${t}`))}):null]})};ImageGallerySkeleton.displayName="ImageGallerySkeleton",ImageGallery.Skeleton=ImageGallerySkeleton;const Lightbox=({visible:e,images:t,initialIndex:a,enablePinchZoom:i,showCounter:r,onClose:n,onIndexChange:l,haptic:s})=>{const o=(0,_index.useTheme)(),c=(0,_react.useMemo)(()=>buildLightboxStyles(o),[o]),u=o.components.imageGallery,d=u?.maxScale??4,m=u?.minScale??1,_=u?.doubleTapScale??2,h=(0,_react.useRef)(null),[g,v]=(0,_react.useState)(a),x=(0,_react.useCallback)(e=>{if(e!==g){const t=(0,_index2.resolveHaptic)(s,"selection");t&&(0,_index2.triggerHaptic)(t),v(e),l(e)}},[g,l,s]),p=(0,_react.useCallback)((e,a)=>(0,_jsxRuntime.jsx)(ZoomableImage,{image:e,index:a,total:t.length,active:a===g,enabled:i,maxScale:d,minScale:m,doubleTapScale:_,haptic:s}),[g,i,t.length,d,m,_,s]),b=t[g]?.caption;return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:e,transparent:!0,statusBarTranslucent:!0,presentationStyle:"overFullScreen",animationType:"fade",onRequestClose:n,accessibilityViewIsModal:!0,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.backdrop,accessibilityViewIsModal:!0,children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{ref:h,data:t,defaultIndex:a,onIndexChange:x,renderItem:p,showPagination:!1,haptic:s}),r&&t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:c.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[c.counterText,{color:o.colors.onOverlay}],accessibilityLabel:`Image ${g+1} of ${t.length}`,children:`${g+1} / ${t.length}`})}):null,(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:n,accessibilityRole:"button",accessibilityLabel:"Close gallery",style:c.closeButton,hitSlop:12,children:(o.icons?.close??_defaultIcons.defaultIcons.close)({size:24,color:o.colors.onOverlay})}),b?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:c.captionWrap,entering:void 0,accessibilityElementsHidden:!1,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:c.captionText,numberOfLines:3,children:b})}):null,(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})})},ZoomableImage=({image:e,index:t,total:a,active:i,enabled:r,maxScale:n,minScale:l,doubleTapScale:s,haptic:o})=>{const c=_reactNative.Dimensions.get("window"),u=(0,_reactNativeReanimated.useSharedValue)(1),d=(0,_reactNativeReanimated.useSharedValue)(1),m=(0,_reactNativeReanimated.useSharedValue)(0),_=(0,_reactNativeReanimated.useSharedValue)(0),h=(0,_reactNativeReanimated.useSharedValue)(0),g=(0,_reactNativeReanimated.useSharedValue)(0),v=(0,_react.useCallback)(()=>{u.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),d.value=1,m.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=0,g.value=0},[u,d,m,_,h,g]);_react.default.useEffect(()=>{i||(u.value=(0,_reactNativeReanimated.withTiming)(1,{duration:150}),m.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),_.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),d.value=1,h.value=0,g.value=0)},[i,u,m,_,d,h,g]);const x=(0,_react.useCallback)(()=>{!1!==o&&(0,_index2.triggerHaptic)("impactLight")},[o]),p=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pinch().enabled(r).onStart(()=>{"worklet";d.value=u.value}).onUpdate(e=>{"worklet";const t=d.value*e.scale;u.value=t<l?l+.3*(t-l):t>n?n+.2*(t-n):t}).onEnd(()=>{"worklet";return u.value<l?(u.value=(0,_reactNativeReanimated.withSpring)(l,SPRING_CONFIG),m.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),d.value=l,h.value=0,void(g.value=0)):u.value>n?(u.value=(0,_reactNativeReanimated.withSpring)(n,SPRING_CONFIG),void(d.value=n)):void(d.value=u.value)}),[r,u,d,m,_,h,g,l,n]),b=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pan().minPointers(1).maxPointers(1).onStart(()=>{"worklet";h.value=m.value,g.value=_.value}).onUpdate(e=>{"worklet";u.value<=1||(m.value=h.value+e.translationX,_.value=g.value+e.translationY)}).onEnd(()=>{"worklet";h.value=m.value,g.value=_.value}),[u,m,_,h,g]),y=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Tap().numberOfTaps(2).onEnd(()=>{"worklet";(0,_reactNativeReanimated.runOnJS)(x)(),u.value>1?(u.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),m.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),d.value=1,h.value=0,g.value=0):(u.value=(0,_reactNativeReanimated.withSpring)(s,SPRING_CONFIG),d.value=s)}),[u,d,m,_,h,g,x,s]),R=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Race(p,b,y),[p,b,y]),S=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:m.value},{translateY:_.value},{scale:u.value}]}));_react.default.useEffect(()=>{i||v()},[i,v]);const N=e.alt??`Image ${t+1} of ${a}`;return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:R,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[lightboxImageStyles.container,{width:c.width}],children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.Image,{source:e.source,resizeMode:"contain",style:[lightboxImageStyles.image,S],accessibilityLabel:N,accessible:!0})})})},clamp=(e,t,a)=>Math.min(Math.max(e,t),a),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},carouselWrap:{width:"100%",position:"relative"},imageWrap:{width:"100%",aspectRatio:16/9,backgroundColor:e.colors.background.secondary,overflow:"hidden",borderRadius:e.radius.md,..._corners.smoothCorners},image:{width:"100%",height:"100%"},thumbnailImage:{width:"100%",height:"100%"},counterPill:{position:"absolute",top:12,alignSelf:"center",paddingHorizontal:12,paddingVertical:4,borderRadius:e.radius.full,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.55)"},counterText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}}),buildLightboxStyles=e=>_reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:"#000",justifyContent:"center"},counterPill:{position:"absolute",top:48,alignSelf:"center",paddingHorizontal:14,paddingVertical:6,borderRadius:e.radius.full,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.6)"},counterText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold},closeButton:{position:"absolute",top:44,right:16,width:40,height:40,borderRadius:20,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)"},captionWrap:{position:"absolute",left:0,right:0,bottom:32,paddingHorizontal:24},captionText:{color:"#FFFFFF",fontSize:14,lineHeight:20,textAlign:"center"}}),lightboxImageStyles=_reactNative.StyleSheet.create({container:{flex:1,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"}});var _default=exports.default=ImageGallery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SlideToConfirm=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,n,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:a){if(i.has(e))return i.get(e);i.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?i(o,t,n):o[t]=e[t]);return o})(e,t)}const SIZE_MAP={sm:{height:44,pad:4},md:{height:56,pad:5},lg:{height:64,pad:6}},Chevron=({color:e,size:t})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:0,height:0,borderTopWidth:.4*t,borderBottomWidth:.4*t,borderLeftWidth:.55*t,borderTopColor:"transparent",borderBottomColor:"transparent",borderLeftColor:e,marginLeft:.2*t}}),ACCESSIBILITY_ACTIONS=[{name:"activate",label:"Confirm"},{name:"increment",label:"Confirm"}],SlideToConfirm=exports.SlideToConfirm=(0,_react.forwardRef)((e,t)=>{const{onConfirm:a,label:r="Slide to confirm",confirmedLabel:i="Confirmed",tone:n="primary",size:o="md",disabled:s=!1,threshold:l=.9,resetAfter:c=!1,haptic:d,icon:u,style:m,trackStyle:_,handleStyle:h,labelStyle:f,testID:v}=e,p=(0,_index.useTheme)(),b=SIZE_MAP[o],y=b.height-2*b.pad,g=(0,_react.useMemo)(()=>buildStyles(p,b),[p,b]),S=p.colors[n],[x,R]=(0,_react.useState)(!1),C=(0,_reactNativeReanimated.useSharedValue)(0),N=(0,_reactNativeReanimated.useSharedValue)(0),j=(0,_reactNativeReanimated.useSharedValue)(0),w=(0,_react.useRef)(null),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SlideToConfirm=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,n,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:a){if(i.has(e))return i.get(e);i.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?i(o,t,n):o[t]=e[t]);return o})(e,t)}const SIZE_MAP={sm:{height:44,pad:4},md:{height:56,pad:5},lg:{height:64,pad:6}},Chevron=({color:e,size:t})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:0,height:0,borderTopWidth:.4*t,borderBottomWidth:.4*t,borderLeftWidth:.55*t,borderTopColor:"transparent",borderBottomColor:"transparent",borderLeftColor:e,marginLeft:.2*t}}),ACCESSIBILITY_ACTIONS=[{name:"activate",label:"Confirm"},{name:"increment",label:"Confirm"}],SlideToConfirm=exports.SlideToConfirm=(0,_react.forwardRef)((e,t)=>{const{onConfirm:a,label:r="Slide to confirm",confirmedLabel:i="Confirmed",tone:n="primary",size:o="md",disabled:s=!1,threshold:l=.9,resetAfter:c=!1,haptic:d,icon:u,style:m,trackStyle:_,handleStyle:h,labelStyle:f,testID:v}=e,p=(0,_index.useTheme)(),b=SIZE_MAP[o],y=b.height-2*b.pad,g=(0,_react.useMemo)(()=>buildStyles(p,b),[p,b]),S=p.colors[n],[x,R]=(0,_react.useState)(!1),C=(0,_reactNativeReanimated.useSharedValue)(0),N=(0,_reactNativeReanimated.useSharedValue)(0),j=(0,_reactNativeReanimated.useSharedValue)(0),w=(0,_react.useRef)(null),k=(0,_react.useCallback)(()=>{const e=(0,_index2.resolveHaptic)(d,"notificationSuccess");e&&(0,_index2.triggerHaptic)(e)},[d]),T=(0,_react.useCallback)(()=>{R(!1),C.value=(0,_reactNativeReanimated.withSpring)(0,{damping:18,stiffness:160,mass:1})},[C]),A=(0,_react.useCallback)(()=>{R(!0),k(),a(),!1!==c&&(w.current&&clearTimeout(w.current),w.current=setTimeout(T,c))},[k,a,c,T]),I=(0,_react.useCallback)(e=>{if(s||x)return;const{actionName:t}=e.nativeEvent;"activate"!==t&&"increment"!==t||A()},[s,x,A]);_react.default.useEffect(()=>()=>{(0,_reactNativeReanimated.cancelAnimation)(C),w.current&&clearTimeout(w.current)},[C]);const M=(0,_react.useCallback)(e=>{N.value=Math.max(0,e.nativeEvent.layout.width-y-2*b.pad)},[N,y,b.pad]),q=(0,_react.useMemo)(()=>{const e=l,t={damping:18,stiffness:160,mass:1},a={duration:p.motion.duration.fast,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)};return _reactNativeGestureHandler.Gesture.Pan().enabled(!s&&!x).minDistance(0).onStart(()=>{"worklet";j.value=C.value}).onUpdate(e=>{"worklet";C.value=Math.min(Math.max(j.value+e.translationX,0),N.value)}).onEnd(()=>{"worklet";N.value>0&&C.value>=N.value*e?(C.value=(0,_reactNativeReanimated.withTiming)(N.value,a),(0,_reactNativeReanimated.runOnJS)(A)()):C.value=(0,_reactNativeReanimated.withSpring)(0,t)})},[s,x,l,C,N,j,A,p.motion.duration.fast]),E=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:C.value}]})),W=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({width:C.value+y+b.pad})),L=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=N.value>0?N.value:1;return{opacity:Math.max(0,1-C.value/(.6*e))}});return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,style:[g.track,{backgroundColor:p.colors.background.secondary},_,m],onLayout:M,testID:v,accessibilityRole:"adjustable",accessibilityLabel:x?i:r,accessibilityState:{disabled:s},accessibilityActions:ACCESSIBILITY_ACTIONS,onAccessibilityAction:I,children:[(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[g.fill,{backgroundColor:S,opacity:s?.5:1},W],pointerEvents:"none"}),(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[g.labelWrap,L],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[g.label,{color:p.colors.text.secondary,fontSize:p.typography.fontSize.base},f],numberOfLines:1,children:x?i:r})}),(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:q,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[g.handle,{width:y,height:y,borderRadius:y/2,..._corners.smoothCorners,backgroundColor:p.colors.background.elevated,opacity:s?.5:1,...p.shadows.sm},h,E],children:u??(0,_jsxRuntime.jsx)(Chevron,{color:S,size:.5*y})})})]})});SlideToConfirm.displayName="SlideToConfirm";const buildStyles=(e,t)=>_reactNative.StyleSheet.create({track:{height:t.height,borderRadius:t.height/2,..._corners.smoothCorners,justifyContent:"center",overflow:"hidden",padding:t.pad},fill:{position:"absolute",left:0,top:0,bottom:0,borderRadius:t.height/2,..._corners.smoothCorners},labelWrap:{position:"absolute",left:t.height,right:t.height},label:{textAlign:"center",includeFontPadding:!1},handle:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=SlideToConfirm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Slider=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_valueText=require("./valueText.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,n,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=t?r:a){if(i.has(e))return i.get(e);i.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?i(s,t,n):s[t]=e[t]);return s})(e,t)}const SIZE_MAP={sm:{trackHeight:4,thumbDiameter:24},md:{trackHeight:6,thumbDiameter:28},lg:{trackHeight:8,thumbDiameter:32}},VARIANT_SIZE_MAP={inset:{sm:{trackHeight:14,thumbDiameter:10},md:{trackHeight:20,thumbDiameter:14},lg:{trackHeight:26,thumbDiameter:18}},minimal:{sm:{trackHeight:2,thumbDiameter:14},md:{trackHeight:3,thumbDiameter:18},lg:{trackHeight:4,thumbDiameter:22}},bar:{sm:{trackHeight:20,thumbDiameter:20},md:{trackHeight:28,thumbDiameter:28},lg:{trackHeight:36,thumbDiameter:36}}},INSET_RING_RATIO=.3,MIN_THUMB_TOUCH=44,TONE_TO_COLOR_KEY={primary:"primary",success:"success",warning:"warning",error:"error"},clamp=(e,t,a)=>Math.min(Math.max(e,t),a),snapToStep=(e,t,a,r)=>{if(r<=0)return clamp(e,t,a);const i=Math.round((e-t)/r)*r+t,n=String(r).split(".")[1]?.length??0,s=n>0?Number(i.toFixed(n)):i;return clamp(s,t,a)},BUBBLE_GAP=2,BUBBLE_CARET=8,BUBBLE_WRAP_WIDTH=160,NO_SHADOW={shadowOpacity:0,elevation:0},defaultFormatLabel=e=>String(e),Slider=exports.Slider=(0,_react.forwardRef)((e,t)=>{const{min:a=0,max:r=100,step:i=1,disabled:n=!1,tone:s="primary",size:o="md",variant:c="default",showLabel:l=!1,snapThumb:u=!1,formatLabel:d=defaultFormatLabel,renderLabel:m,accessibilityLabel:h,haptic:b,style:_,containerStyle:v,trackStyle:p,fillStyle:f,thumbStyle:g,labelStyle:R,thumbPressScale:y,labelShowDuration:x,labelOpacity:N,testID:w}=e,S=(0,_index2.useTheme)(),k=S.components.slider,j=k?.[o],C=(0,_react.useMemo)(()=>"default"===c?{trackHeight:j?.trackHeight??SIZE_MAP[o].trackHeight,thumbDiameter:j?.thumbDiameter??SIZE_MAP[o].thumbDiameter}:VARIANT_SIZE_MAP[c][o],[j,o,c]),M="inset"===c?C.trackHeight/2:0,O=k?.thumbPressAnimation??!1,H=y??k?.thumbPressScale??1.1,D=x??k?.labelShowDuration??S.motion.duration.fast,A=N??k?.labelOpacity??1,E=(0,_react.useMemo)(()=>buildStyles(S,C),[S,C]),T=(0,_react.useMemo)(()=>({damping:S.motion.spring.snappy.damping,stiffness:S.motion.spring.snappy.stiffness,mass:S.motion.spring.snappy.mass}),[S.motion.spring.snappy]),[V,W]=(0,_react.useState)(0),P=S.colors[TONE_TO_COLOR_KEY[s]],I=(0,_valueText.sliderToneInk)(S,s),L=!0===e.range,[q,X]=(0,_index.useControllableState)({value:e.value,defaultValue:e.defaultValue??(L?[a,r]:a),onChange:e.onChange}),B=(0,_reactNativeReanimated.useSharedValue)(0),G=(0,_reactNativeReanimated.useSharedValue)(0),F=(0,_reactNativeReanimated.useSharedValue)(L?q[0]:q),J=(0,_reactNativeReanimated.useSharedValue)(L?q[1]:q),U=(0,_reactNativeReanimated.useSharedValue)(0),z=(0,_reactNativeReanimated.useSharedValue)(0),Z=(0,_reactNativeReanimated.useSharedValue)(1),K=(0,_reactNativeReanimated.useSharedValue)(1),Y="always"===l,$=(0,_reactNativeReanimated.useSharedValue)(Y?1:0),Q=(0,_reactNativeReanimated.useSharedValue)(Y?1:0),ee=(0,_react.useMemo)(()=>{const e=String(i).split(".")[1]?.length??0;return Math.pow(10,e)},[i]);(0,_react.useEffect)(()=>()=>{(0,_reactNativeReanimated.cancelAnimation)(B),(0,_reactNativeReanimated.cancelAnimation)(G),(0,_reactNativeReanimated.cancelAnimation)(Z),(0,_reactNativeReanimated.cancelAnimation)(K),(0,_reactNativeReanimated.cancelAnimation)($),(0,_reactNativeReanimated.cancelAnimation)(Q)},[B,G,Z,K,$,Q]);const te=(0,_react.useCallback)((e,t)=>{const i=t-2*M;return r===a||i<=0?M:M+(e-a)/(r-a)*i},[a,r,M]),ae=(0,_react.useCallback)((e,t)=>{const n=t-2*M;if(n<=0)return a;const s=clamp((e-M)/n,0,1);return snapToStep(a+s*(r-a),a,r,i)},[a,r,i,M]),re=(0,_react.useRef)(!1),ie=S.motion.duration.fast,ne=(0,_react.useRef)(q);ne.current=q;const se=(0,_react.useRef)(V);se.current=V;const oe=(0,_react.useCallback)((e=!1)=>{const t=se.current;if(t<=0)return;const place=t=>e?(0,_reactNativeReanimated.withTiming)(t,{duration:ie,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)}):t,a=ne.current;if(L){const[e,r]=a,i=Math.min(e,r),n=Math.max(e,r);F.value=i,J.value=n,B.value=place(te(i,t)),G.value=place(te(n,t))}else{const e=a;F.value=e,J.value=e,B.value=place(te(e,t))}},[L,te,F,J,B,G,ie]),[ce,le]=(0,_react.useState)(0),ue=(0,_react.useRef)(!1),de=(0,_react.useCallback)(e=>{re.current=e,e||(ue.current=!0,le(e=>e+1))},[]);(0,_react.useEffect)(()=>{if(re.current)return;const e=ue.current;ue.current=!1,oe(e)},[JSON.stringify(q),V,ce,oe]);const me=(0,_react.useCallback)(e=>{const t=e.nativeEvent.layout.width;z.value=t,W(t)},[z]),he=(0,_react.useCallback)((e,t)=>{X(L?[e,t]:e)},[L,X]),be=(0,_react.useCallback)(()=>{const e=(0,_index3.resolveHaptic)(b,"selection");e&&(0,_index3.triggerHaptic)(e)},[b]),_e=(0,_react.useRef)(he);_e.current=he;const ve=(0,_react.useRef)(be);ve.current=be;const pe=(0,_react.useCallback)((e,t)=>_e.current(e,t),[]),fe=(0,_react.useCallback)(()=>ve.current(),[]),ge=Math.max(0,(44-C.thumbDiameter)/2),Re=ge>0?ge:void 0,ye=(0,_react.useCallback)(e=>{const t="low"===e?B:G,s="low"===e?F:J,o="low"===e?J:F,c="low"===e?Z:K,d="low"===e?$:Q,m="low"===e,h=a,b=r,_=i,v=ee,p=L,f=H,g=O,R=!0===l,y=u,x=A,N=D,w=T,S=M,follow=e=>{const a=z.value-2*S;if(a<=0||!Number.isFinite(e))return;const r=Math.min(Math.max(U.value+e,S),z.value-S);let i=h+(r-S)/a*(b-h);_>0&&(i=Math.round((i-h)/_)*_+h,i=Math.round(i*v)/v),i=Math.min(Math.max(i,h),b),p&&(m&&i>o.value&&(i=o.value),!m&&i<o.value&&(i=o.value)),t.value=y||b===h?b===h?S:S+(i-h)/(b-h)*a:p?m?Math.min(r,G.value):Math.max(r,B.value):r,i!==s.value&&(s.value=i,i!==h&&i!==b||(0,_reactNativeReanimated.runOnJS)(fe)(),(0,_reactNativeReanimated.runOnJS)(pe)(F.value,J.value))},k=_reactNativeGestureHandler.Gesture.Pan().enabled(!n).minDistance(0);return(void 0===Re?k:k.hitSlop(Re)).onStart(()=>{(0,_reactNativeReanimated.runOnJS)(de)(!0),U.value=t.value,g&&(c.value=(0,_reactNativeReanimated.withSpring)(f,w)),R&&(d.value=(0,_reactNativeReanimated.withTiming)(x,{duration:N,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)})),(0,_reactNativeReanimated.runOnJS)(fe)()}).onUpdate(e=>{follow(e.translationX)}).onEnd(e=>{follow(e.translationX),g&&(c.value=(0,_reactNativeReanimated.withSpring)(1,w)),R&&(d.value=(0,_reactNativeReanimated.withTiming)(0,{duration:N,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)}))}).onFinalize(()=>{(0,_reactNativeReanimated.runOnJS)(de)(!1)})},[n,a,r,i,ee,L,H,O,l,u,A,D,T,M,Re,pe,fe,de,B,G,F,J,Z,K,$,Q,U,z]),xe=(0,_react.useMemo)(()=>ye("low"),[ye]),Ne=(0,_react.useMemo)(()=>ye("high"),[ye]),we=(0,_react.useCallback)(e=>{if(n||L||V<=0)return;const t=clamp(e.nativeEvent.locationX,0,V),a=ae(t,V);a!==F.value&&(be(),F.value=a,B.value=(0,_reactNativeReanimated.withTiming)(te(a,V),{duration:S.motion.duration.fast,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)}),he(a,a))},[n,L,V,ae,te,he,be,B,F,S.motion.duration.fast]),Se=(0,_react.useCallback)(e=>{if(n)return;const t="increment"===e.nativeEvent.actionName?i:-i,s=i>0?Math.round(t*ee)/ee:t;if(L){const e=Math.round((F.value+s)*ee)/ee,t=clamp(e,a,J.value);t!==F.value&&(F.value=t,B.value=te(t,V),be(),he(t,J.value))}else{const e=Math.round((F.value+s)*ee)/ee,t=clamp(e,a,r);t!==F.value&&(F.value=t,B.value=te(t,V),be(),he(t,t))}},[n,i,ee,L,a,r,te,V,B,F,J,he,be]),ke=C.thumbDiameter/2,je=n?S.colors.surface.disabled:P,Ce="inset"===c?{backgroundColor:je,borderColor:S.colors.background.elevated,borderWidth:Math.max(2,Math.round(.3*C.thumbDiameter)),...NO_SHADOW}:"minimal"===c?{backgroundColor:je,borderWidth:0}:"bar"===c?{backgroundColor:"transparent",borderWidth:0,...NO_SHADOW}:{backgroundColor:S.colors.background.elevated,borderColor:je},Me=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=z.value;if(e<=0)return{opacity:0,transform:[{translateX:0},{scaleX:1}]};const t=n?.55:1;if(L){const a=Math.max(0,G.value-B.value+2*M);return{opacity:t,transform:[{translateX:B.value-M},{scaleX:a/e}]}}return{opacity:t,transform:[{translateX:B.value+M-e},{scaleX:1}]}}),Oe=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:B.value-ke},{scale:Z.value}]})),He=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:G.value-ke},{scale:K.value}]})),De=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:$.value})),Ae=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:Q.value})),clampDisplay=e=>clamp(e,a,r),Ee=clampDisplay(L?Math.min(...q):q),Te=clampDisplay(L?Math.max(...q):q);return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,style:[E.container,v,_],testID:w,accessibilityRole:"adjustable",accessibilityLabel:h,accessibilityState:{disabled:n},accessibilityValue:L?{min:a,max:r,now:Ee,text:`${Ee} to ${Te}`}:{min:a,max:r,now:Ee},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:Se,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:we,disabled:n||L,style:E.trackTouch,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:E.trackWrap,onLayout:me,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:E.trackClip,pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.track,{backgroundColor:n?S.colors.surface.disabled:S.colors.border.primary},p]}),(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[E.fill,{backgroundColor:n?S.colors.surface.disabled:P},f,Me]})]}),(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:xe,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[E.thumb,{width:C.thumbDiameter,height:C.thumbDiameter,borderRadius:ke,..._corners.smoothCorners,opacity:n?.55:1},Ce,g,Oe],accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:l?(0,_jsxRuntime.jsxs)(_reactNativeReanimated.default.View,{style:[E.bubbleWrap,De],pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubble,{backgroundColor:P}],children:m?m(Ee):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[E.bubbleText,{color:I},R],numberOfLines:1,children:d(Ee)})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubbleCaret,{backgroundColor:P}]})]}):null})}),L?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Ne,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[E.thumb,{width:C.thumbDiameter,height:C.thumbDiameter,borderRadius:ke,..._corners.smoothCorners,opacity:n?.55:1},Ce,g,He],accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:l?(0,_jsxRuntime.jsxs)(_reactNativeReanimated.default.View,{style:[E.bubbleWrap,Ae],pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubble,{backgroundColor:P}],children:m?m(Te):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[E.bubbleText,{color:I},R],numberOfLines:1,children:d(Te)})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubbleCaret,{backgroundColor:P}]})]}):null})}):null]})})})});Slider.displayName="Slider";const buildStyles=(e,t)=>{const a=e.shadows.md,r=Math.max(t.thumbDiameter,t.trackHeight),i=r/2+4;return _reactNative.StyleSheet.create({container:{width:"100%",paddingVertical:i,justifyContent:"center"},trackTouch:{width:"100%",justifyContent:"center"},trackWrap:{width:"100%",height:r,justifyContent:"center"},trackClip:{position:"absolute",left:0,right:0,height:t.trackHeight,top:(r-t.trackHeight)/2,borderRadius:t.trackHeight/2,..._corners.smoothCorners,overflow:"hidden"},track:{position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:t.trackHeight/2,..._corners.smoothCorners},fill:{position:"absolute",top:0,left:0,width:"100%",height:t.trackHeight,borderRadius:t.trackHeight/2,..._corners.smoothCorners,transformOrigin:"left"},thumb:{position:"absolute",top:(r-t.thumbDiameter)/2,left:0,borderWidth:2,shadowColor:a.shadowColor,shadowOffset:a.shadowOffset,shadowOpacity:a.shadowOpacity,shadowRadius:a.shadowRadius,elevation:a.elevation,alignItems:"center",justifyContent:"center"},bubbleWrap:{position:"absolute",bottom:t.thumbDiameter+2,left:t.thumbDiameter/2-80,width:160,alignItems:"center"},bubbleCaret:{width:8,height:8,marginTop:-5,borderRadius:1,..._corners.smoothCorners,transform:[{rotate:"45deg"}]},bubble:{paddingHorizontal:e.spacing.sm,paddingVertical:e.spacing.xxs,borderRadius:e.radius.md,..._corners.smoothCorners,minWidth:36,alignItems:"center",justifyContent:"center",..._reactNative.Platform.select({ios:{shadowColor:e.shadows.sm.shadowColor,shadowOffset:e.shadows.sm.shadowOffset,shadowOpacity:e.shadows.sm.shadowOpacity,shadowRadius:e.shadows.sm.shadowRadius},android:{elevation:e.shadows.sm.elevation},default:{}})},bubbleText:{color:e.colors.onPrimary,fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.semibold}})};var _default=exports.default=Slider;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Slider=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_valueText=require("./valueText.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,n,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=t?r:a){if(i.has(e))return i.get(e);i.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?i(s,t,n):s[t]=e[t]);return s})(e,t)}const SIZE_MAP={sm:{trackHeight:4,thumbDiameter:24},md:{trackHeight:6,thumbDiameter:28},lg:{trackHeight:8,thumbDiameter:32}},VARIANT_SIZE_MAP={inset:{sm:{trackHeight:14,thumbDiameter:10},md:{trackHeight:20,thumbDiameter:14},lg:{trackHeight:26,thumbDiameter:18}},minimal:{sm:{trackHeight:2,thumbDiameter:14},md:{trackHeight:3,thumbDiameter:18},lg:{trackHeight:4,thumbDiameter:22}},bar:{sm:{trackHeight:20,thumbDiameter:20},md:{trackHeight:28,thumbDiameter:28},lg:{trackHeight:36,thumbDiameter:36}}},INSET_RING_RATIO=.3,MIN_THUMB_TOUCH=44,TONE_TO_COLOR_KEY={primary:"primary",success:"success",warning:"warning",error:"error"},clamp=(e,t,a)=>Math.min(Math.max(e,t),a),snapToStep=(e,t,a,r)=>{if(r<=0)return clamp(e,t,a);const i=Math.round((e-t)/r)*r+t,n=String(r).split(".")[1]?.length??0,s=n>0?Number(i.toFixed(n)):i;return clamp(s,t,a)},BUBBLE_GAP=2,BUBBLE_CARET=8,BUBBLE_WRAP_WIDTH=160,NO_SHADOW={shadowOpacity:0,elevation:0},defaultFormatLabel=e=>String(e),Slider=exports.Slider=(0,_react.forwardRef)((e,t)=>{const{min:a=0,max:r=100,step:i=1,disabled:n=!1,tone:s="primary",size:o="md",variant:l="default",showLabel:c=!1,snapThumb:u=!1,formatLabel:d=defaultFormatLabel,renderLabel:m,accessibilityLabel:h,haptic:b,style:_,containerStyle:v,trackStyle:p,fillStyle:f,thumbStyle:g,labelStyle:R,thumbPressScale:y,labelShowDuration:x,labelOpacity:N,testID:w}=e,k=(0,_index2.useTheme)(),S=k.components.slider,j=S?.[o],C=(0,_react.useMemo)(()=>"default"===l?{trackHeight:j?.trackHeight??SIZE_MAP[o].trackHeight,thumbDiameter:j?.thumbDiameter??SIZE_MAP[o].thumbDiameter}:VARIANT_SIZE_MAP[l][o],[j,o,l]),M="inset"===l?C.trackHeight/2:0,O=S?.thumbPressAnimation??!1,H=y??S?.thumbPressScale??1.1,D=x??S?.labelShowDuration??k.motion.duration.fast,A=N??S?.labelOpacity??1,E=(0,_react.useMemo)(()=>buildStyles(k,C),[k,C]),T=(0,_react.useMemo)(()=>({damping:k.motion.spring.snappy.damping,stiffness:k.motion.spring.snappy.stiffness,mass:k.motion.spring.snappy.mass}),[k.motion.spring.snappy]),[V,W]=(0,_react.useState)(0),P=k.colors[TONE_TO_COLOR_KEY[s]],I=(0,_valueText.sliderToneInk)(k,s),L=!0===e.range,[q,X]=(0,_index.useControllableState)({value:e.value,defaultValue:e.defaultValue??(L?[a,r]:a),onChange:e.onChange}),B=(0,_reactNativeReanimated.useSharedValue)(0),G=(0,_reactNativeReanimated.useSharedValue)(0),F=(0,_reactNativeReanimated.useSharedValue)(L?q[0]:q),J=(0,_reactNativeReanimated.useSharedValue)(L?q[1]:q),U=(0,_reactNativeReanimated.useSharedValue)(0),z=(0,_reactNativeReanimated.useSharedValue)(0),Z=(0,_reactNativeReanimated.useSharedValue)(1),K=(0,_reactNativeReanimated.useSharedValue)(1),Y="always"===c,$=(0,_reactNativeReanimated.useSharedValue)(Y?1:0),Q=(0,_reactNativeReanimated.useSharedValue)(Y?1:0),ee=(0,_react.useMemo)(()=>{const e=String(i).split(".")[1]?.length??0;return Math.pow(10,e)},[i]);(0,_react.useEffect)(()=>()=>{(0,_reactNativeReanimated.cancelAnimation)(B),(0,_reactNativeReanimated.cancelAnimation)(G),(0,_reactNativeReanimated.cancelAnimation)(Z),(0,_reactNativeReanimated.cancelAnimation)(K),(0,_reactNativeReanimated.cancelAnimation)($),(0,_reactNativeReanimated.cancelAnimation)(Q)},[B,G,Z,K,$,Q]);const te=(0,_react.useCallback)((e,t)=>{const i=t-2*M;return r===a||i<=0?M:M+(e-a)/(r-a)*i},[a,r,M]),ae=(0,_react.useCallback)((e,t)=>{const n=t-2*M;if(n<=0)return a;const s=clamp((e-M)/n,0,1);return snapToStep(a+s*(r-a),a,r,i)},[a,r,i,M]),re=(0,_react.useRef)(!1),ie=k.motion.duration.fast,ne=(0,_react.useRef)(q);ne.current=q;const se=(0,_react.useRef)(V);se.current=V;const oe=(0,_react.useCallback)((e=!1)=>{const t=se.current;if(t<=0)return;const place=t=>e?(0,_reactNativeReanimated.withTiming)(t,{duration:ie,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)}):t,a=ne.current;if(L){const[e,r]=a,i=Math.min(e,r),n=Math.max(e,r);F.value=i,J.value=n,B.value=place(te(i,t)),G.value=place(te(n,t))}else{const e=a;F.value=e,J.value=e,B.value=place(te(e,t))}},[L,te,F,J,B,G,ie]),[le,ce]=(0,_react.useState)(0),ue=(0,_react.useRef)(!1),de=(0,_react.useCallback)(e=>{re.current=e,e||(ue.current=!0,ce(e=>e+1))},[]);(0,_react.useEffect)(()=>{if(re.current)return;const e=ue.current;ue.current=!1,oe(e)},[JSON.stringify(q),V,le,oe]);const me=(0,_react.useCallback)(e=>{const t=e.nativeEvent.layout.width;z.value=t,W(t)},[z]),he=(0,_react.useCallback)((e,t)=>{X(L?[e,t]:e)},[L,X]),be=(0,_react.useCallback)(()=>{const e=(0,_index3.resolveHaptic)(b,"selection");e&&(0,_index3.triggerHaptic)(e)},[b]),_e=(0,_react.useRef)(he);_e.current=he;const ve=(0,_react.useRef)(be);ve.current=be;const pe=(0,_react.useCallback)((e,t)=>_e.current(e,t),[]),fe=(0,_react.useCallback)(()=>ve.current(),[]),ge=Math.max(0,(44-C.thumbDiameter)/2),Re=ge>0?ge:void 0,ye=(0,_react.useCallback)(e=>{const t="low"===e?B:G,s="low"===e?F:J,o="low"===e?J:F,l="low"===e?Z:K,d="low"===e?$:Q,m="low"===e,h=a,b=r,_=i,v=ee,p=L,f=H,g=O,R=!0===c,y=u,x=A,N=D,w=T,k=M,follow=e=>{"worklet";const a=z.value-2*k;if(a<=0||!Number.isFinite(e))return;const r=Math.min(Math.max(U.value+e,k),z.value-k);let i=h+(r-k)/a*(b-h);_>0&&(i=Math.round((i-h)/_)*_+h,i=Math.round(i*v)/v),i=Math.min(Math.max(i,h),b),p&&(m&&i>o.value&&(i=o.value),!m&&i<o.value&&(i=o.value)),t.value=y||b===h?b===h?k:k+(i-h)/(b-h)*a:p?m?Math.min(r,G.value):Math.max(r,B.value):r,i!==s.value&&(s.value=i,i!==h&&i!==b||(0,_reactNativeReanimated.runOnJS)(fe)(),(0,_reactNativeReanimated.runOnJS)(pe)(F.value,J.value))},S=_reactNativeGestureHandler.Gesture.Pan().enabled(!n).minDistance(0);return(void 0===Re?S:S.hitSlop(Re)).onStart(()=>{"worklet";(0,_reactNativeReanimated.runOnJS)(de)(!0),U.value=t.value,g&&(l.value=(0,_reactNativeReanimated.withSpring)(f,w)),R&&(d.value=(0,_reactNativeReanimated.withTiming)(x,{duration:N,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)})),(0,_reactNativeReanimated.runOnJS)(fe)()}).onUpdate(e=>{"worklet";follow(e.translationX)}).onEnd(e=>{"worklet";follow(e.translationX),g&&(l.value=(0,_reactNativeReanimated.withSpring)(1,w)),R&&(d.value=(0,_reactNativeReanimated.withTiming)(0,{duration:N,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)}))}).onFinalize(()=>{"worklet";(0,_reactNativeReanimated.runOnJS)(de)(!1)})},[n,a,r,i,ee,L,H,O,c,u,A,D,T,M,Re,pe,fe,de,B,G,F,J,Z,K,$,Q,U,z]),xe=(0,_react.useMemo)(()=>ye("low"),[ye]),Ne=(0,_react.useMemo)(()=>ye("high"),[ye]),we=(0,_react.useCallback)(e=>{if(n||L||V<=0)return;const t=clamp(e.nativeEvent.locationX,0,V),a=ae(t,V);a!==F.value&&(be(),F.value=a,B.value=(0,_reactNativeReanimated.withTiming)(te(a,V),{duration:k.motion.duration.fast,easing:_reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)}),he(a,a))},[n,L,V,ae,te,he,be,B,F,k.motion.duration.fast]),ke=(0,_react.useCallback)(e=>{if(n)return;const t="increment"===e.nativeEvent.actionName?i:-i,s=i>0?Math.round(t*ee)/ee:t;if(L){const e=Math.round((F.value+s)*ee)/ee,t=clamp(e,a,J.value);t!==F.value&&(F.value=t,B.value=te(t,V),be(),he(t,J.value))}else{const e=Math.round((F.value+s)*ee)/ee,t=clamp(e,a,r);t!==F.value&&(F.value=t,B.value=te(t,V),be(),he(t,t))}},[n,i,ee,L,a,r,te,V,B,F,J,he,be]),Se=C.thumbDiameter/2,je=n?k.colors.surface.disabled:P,Ce="inset"===l?{backgroundColor:je,borderColor:k.colors.background.elevated,borderWidth:Math.max(2,Math.round(.3*C.thumbDiameter)),...NO_SHADOW}:"minimal"===l?{backgroundColor:je,borderWidth:0}:"bar"===l?{backgroundColor:"transparent",borderWidth:0,...NO_SHADOW}:{backgroundColor:k.colors.background.elevated,borderColor:je},Me=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=z.value;if(e<=0)return{opacity:0,transform:[{translateX:0},{scaleX:1}]};const t=n?.55:1;if(L){const a=Math.max(0,G.value-B.value+2*M);return{opacity:t,transform:[{translateX:B.value-M},{scaleX:a/e}]}}return{opacity:t,transform:[{translateX:B.value+M-e},{scaleX:1}]}}),Oe=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:B.value-Se},{scale:Z.value}]})),He=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:G.value-Se},{scale:K.value}]})),De=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:$.value})),Ae=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:Q.value})),clampDisplay=e=>clamp(e,a,r),Ee=clampDisplay(L?Math.min(...q):q),Te=clampDisplay(L?Math.max(...q):q);return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,style:[E.container,v,_],testID:w,accessibilityRole:"adjustable",accessibilityLabel:h,accessibilityState:{disabled:n},accessibilityValue:L?{min:a,max:r,now:Ee,text:`${Ee} to ${Te}`}:{min:a,max:r,now:Ee},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:ke,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:we,disabled:n||L,style:E.trackTouch,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:E.trackWrap,onLayout:me,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:E.trackClip,pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.track,{backgroundColor:n?k.colors.surface.disabled:k.colors.border.primary},p]}),(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[E.fill,{backgroundColor:n?k.colors.surface.disabled:P},f,Me]})]}),(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:xe,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[E.thumb,{width:C.thumbDiameter,height:C.thumbDiameter,borderRadius:Se,..._corners.smoothCorners,opacity:n?.55:1},Ce,g,Oe],accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:c?(0,_jsxRuntime.jsxs)(_reactNativeReanimated.default.View,{style:[E.bubbleWrap,De],pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubble,{backgroundColor:P}],children:m?m(Ee):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[E.bubbleText,{color:I},R],numberOfLines:1,children:d(Ee)})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubbleCaret,{backgroundColor:P}]})]}):null})}),L?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Ne,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[E.thumb,{width:C.thumbDiameter,height:C.thumbDiameter,borderRadius:Se,..._corners.smoothCorners,opacity:n?.55:1},Ce,g,He],accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:c?(0,_jsxRuntime.jsxs)(_reactNativeReanimated.default.View,{style:[E.bubbleWrap,Ae],pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubble,{backgroundColor:P}],children:m?m(Te):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[E.bubbleText,{color:I},R],numberOfLines:1,children:d(Te)})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[E.bubbleCaret,{backgroundColor:P}]})]}):null})}):null]})})})});Slider.displayName="Slider";const buildStyles=(e,t)=>{const a=e.shadows.md,r=Math.max(t.thumbDiameter,t.trackHeight),i=r/2+4;return _reactNative.StyleSheet.create({container:{width:"100%",paddingVertical:i,justifyContent:"center"},trackTouch:{width:"100%",justifyContent:"center"},trackWrap:{width:"100%",height:r,justifyContent:"center"},trackClip:{position:"absolute",left:0,right:0,height:t.trackHeight,top:(r-t.trackHeight)/2,borderRadius:t.trackHeight/2,..._corners.smoothCorners,overflow:"hidden"},track:{position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:t.trackHeight/2,..._corners.smoothCorners},fill:{position:"absolute",top:0,left:0,width:"100%",height:t.trackHeight,borderRadius:t.trackHeight/2,..._corners.smoothCorners,transformOrigin:"left"},thumb:{position:"absolute",top:(r-t.thumbDiameter)/2,left:0,borderWidth:2,shadowColor:a.shadowColor,shadowOffset:a.shadowOffset,shadowOpacity:a.shadowOpacity,shadowRadius:a.shadowRadius,elevation:a.elevation,alignItems:"center",justifyContent:"center"},bubbleWrap:{position:"absolute",bottom:t.thumbDiameter+2,left:t.thumbDiameter/2-80,width:160,alignItems:"center"},bubbleCaret:{width:8,height:8,marginTop:-5,borderRadius:1,..._corners.smoothCorners,transform:[{rotate:"45deg"}]},bubble:{paddingHorizontal:e.spacing.sm,paddingVertical:e.spacing.xxs,borderRadius:e.radius.md,..._corners.smoothCorners,minWidth:36,alignItems:"center",justifyContent:"center",..._reactNative.Platform.select({ios:{shadowColor:e.shadows.sm.shadowColor,shadowOffset:e.shadows.sm.shadowOffset,shadowOpacity:e.shadows.sm.shadowOpacity,shadowRadius:e.shadows.sm.shadowRadius},android:{elevation:e.shadows.sm.elevation},default:{}})},bubbleText:{color:e.colors.onPrimary,fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.semibold}})};var _default=exports.default=Slider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Swipeable=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?i:a){if(n.has(e))return n.get(e);n.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((r=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(r.get||r.set)?n(s,t,r):s[t]=e[t]);return s})(e,t)}const SPRING_CONFIG={damping:22,stiffness:260,mass:1},DRAG_ACTIVATION_OFFSET=10,RUBBER_BAND_FACTOR=.35,FAIL_OFFSET_Y=15,toneToBg=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;default:return e.colors.secondary}},toneToOnColor=(e,t)=>{switch(t){case"primary":return e.colors.onPrimary;case"success":return e.colors.onSuccess;case"warning":return e.colors.onWarning;case"error":return e.colors.onError;default:return e.colors.onSecondary}},Swipeable=e=>{const{children:t,leftActions:a,rightActions:i,threshold:n,fullSwipeThreshold:r,onSwipeOpen:s,onSwipeClose:o,disabled:c=!1,haptic:l,containerStyle:u,contentStyle:d,actionStyle:_,accessibilityLabel:m,testID:p}=e,v=(0,_index.useTheme)(),f=v.components.swipeable,h=n??f?.threshold??80,S=r??f?.fullSwipeThreshold??200,R=f?.dragActivationOffset??10,g=f?.rubberBandFactor??.35,y=f?.failOffsetY??15,N=(0,_react.useMemo)(()=>({damping:f?.springDamping??SPRING_CONFIG.damping,stiffness:f?.springStiffness??SPRING_CONFIG.stiffness,mass:f?.springMass??SPRING_CONFIG.mass}),[f]),b=(0,_react.useMemo)(()=>buildStyles(v),[v]),w=!!a&&a.length>0,x=!!i&&i.length>0,j=_reactNative.Dimensions.get("window").width,O=w?h*(a?.length??0):0,I=x?h*(i?.length??0):0,C=(0,_reactNativeReanimated.useSharedValue)(0),G=(0,_reactNativeReanimated.useSharedValue)(0),P=(0,_react.useRef)(null);(0,_react.useEffect)(()=>()=>{(0,_reactNativeReanimated.cancelAnimation)(C),(0,_reactNativeReanimated.cancelAnimation)(G)},[C,G]);const A=(0,_react.useCallback)(e=>{P.current!==e&&(P.current=e,s?.(e))},[s]),k=(0,_react.useCallback)(()=>{null!==P.current&&(P.current=null,o?.())},[o]),F=(0,_react.useCallback)(e=>{const t="left"===e?a:i,n=t?.[0];n&&(!1!==l&&(0,_index2.triggerHaptic)("notificationSuccess"),n.onPress(),C.value=(0,_reactNativeReanimated.withSpring)(0,N),P.current=null,o?.())},[a,i,C,o,N,l]),M=(0,_react.useCallback)(()=>{C.value=(0,_reactNativeReanimated.withSpring)(0,N),k()},[C,k,N]),T=(0,_react.useCallback)(e=>{const t=(0,_index2.resolveHaptic)(l,"selection");t&&(0,_index2.triggerHaptic)(t),e.onPress(),M()},[M,l]),q=(0,_react.useMemo)(()=>{const e=O,t=I,a=S,i=-S,n=j,r=-j,s=h,o=w,l=x;return _reactNativeGestureHandler.Gesture.Pan().enabled(!c).withTestId(p?`${p}-gesture`:"swipeable-gesture").activeOffsetX([-R,R]).failOffsetY([-y,y]).onStart(()=>{G.value=C.value}).onUpdate(a=>{const i=G.value+a.translationX;C.value=i>0&&!o||i<0&&!l?0:i>e&&o?e+(i-e)*g:i<-t&&l?(i+t)*g-t:i}).onEnd(()=>{const c=C.value;return o&&c>=a?(C.value=(0,_reactNativeReanimated.withSpring)(n,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(F)("left")):l&&c<=i?(C.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(F)("right")):o&&c>=s?(C.value=(0,_reactNativeReanimated.withSpring)(e,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(A)("left")):l&&c<=-s?(C.value=(0,_reactNativeReanimated.withSpring)(-t,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(A)("right")):(C.value=(0,_reactNativeReanimated.withSpring)(0,N),void(0,_reactNativeReanimated.runOnJS)(k)())})},[c,G,F,S,w,x,O,k,A,I,j,h,C,R,y,g,N,p]),E=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:C.value}]})),B=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:O>0?Math.min(1,Math.max(0,C.value/O)):0})),D=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:I>0?Math.min(1,Math.max(0,-C.value/I)):0})),W=(0,_react.useMemo)(()=>{const e=[];return a?.forEach(t=>e.push({name:t.key,label:t.label})),i?.forEach(t=>e.push({name:t.key,label:t.label})),e},[a,i]),V=(0,_react.useCallback)(e=>{const t=e.nativeEvent.actionName,n=[...a??[],...i??[]].find(e=>e.key===t);n&&(!1!==l&&(0,_index2.triggerHaptic)("selection"),n.onPress())},[a,i,l]);return w||x?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[b.root,u],testID:p,accessibilityLabel:m,accessibilityActions:W,onAccessibilityAction:V,children:[w?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.actionsRow,b.actionsLeft,{width:O},_,B],pointerEvents:"box-none",children:a?.map(e=>(0,_jsxRuntime.jsx)(ActionButton,{action:e,theme:v,width:h,onPress:T},e.key))}):null,x?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.actionsRow,b.actionsRight,{width:I},_,D],pointerEvents:"box-none",children:i?.map(e=>(0,_jsxRuntime.jsx)(ActionButton,{action:e,theme:v,width:h,onPress:T},e.key))}):null,(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:q,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.content,d,E],children:t})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u,testID:p,children:t})};exports.Swipeable=Swipeable,Swipeable.displayName="Swipeable";const ActionButton=({action:e,theme:t,width:a,onPress:i})=>{const n=e.tone??"neutral",r=toneToBg(t,n);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>i(e),accessibilityRole:"button",accessibilityLabel:e.label,style:[actionStyles.button,{width:a,backgroundColor:r,paddingHorizontal:t.spacing.sm}],children:[e.icon?(0,_jsxRuntime.jsx)(_reactNative.View,{style:actionStyles.icon,children:e.icon}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[actionStyles.label,{color:toneToOnColor(t,n),fontSize:t.typography.fontSize.sm,fontWeight:t.typography.fontWeight.semibold}],numberOfLines:1,children:e.label})]})},actionStyles=_reactNative.StyleSheet.create({button:{flexGrow:0,flexShrink:0,alignItems:"center",justifyContent:"center"},icon:{marginBottom:2},label:{textAlign:"center"}}),buildStyles=e=>_reactNative.StyleSheet.create({root:{position:"relative",overflow:"hidden"},content:{backgroundColor:"transparent"},actionsRow:{position:"absolute",top:0,bottom:0,flexDirection:"row"},actionsLeft:{left:0},actionsRight:{right:0,justifyContent:"flex-end"}});var _default=exports.default=Swipeable;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Swipeable=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?i:a){if(n.has(e))return n.get(e);n.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((r=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(r.get||r.set)?n(s,t,r):s[t]=e[t]);return s})(e,t)}const SPRING_CONFIG={damping:22,stiffness:260,mass:1},DRAG_ACTIVATION_OFFSET=10,RUBBER_BAND_FACTOR=.35,FAIL_OFFSET_Y=15,toneToBg=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;default:return e.colors.secondary}},toneToOnColor=(e,t)=>{switch(t){case"primary":return e.colors.onPrimary;case"success":return e.colors.onSuccess;case"warning":return e.colors.onWarning;case"error":return e.colors.onError;default:return e.colors.onSecondary}},Swipeable=e=>{const{children:t,leftActions:a,rightActions:i,threshold:n,fullSwipeThreshold:r,onSwipeOpen:s,onSwipeClose:o,disabled:c=!1,haptic:l,containerStyle:u,contentStyle:d,actionStyle:_,accessibilityLabel:m,testID:p}=e,v=(0,_index.useTheme)(),f=v.components.swipeable,h=n??f?.threshold??80,S=r??f?.fullSwipeThreshold??200,R=f?.dragActivationOffset??10,g=f?.rubberBandFactor??.35,y=f?.failOffsetY??15,N=(0,_react.useMemo)(()=>({damping:f?.springDamping??SPRING_CONFIG.damping,stiffness:f?.springStiffness??SPRING_CONFIG.stiffness,mass:f?.springMass??SPRING_CONFIG.mass}),[f]),b=(0,_react.useMemo)(()=>buildStyles(v),[v]),w=!!a&&a.length>0,x=!!i&&i.length>0,j=_reactNative.Dimensions.get("window").width,O=w?h*(a?.length??0):0,I=x?h*(i?.length??0):0,C=(0,_reactNativeReanimated.useSharedValue)(0),G=(0,_reactNativeReanimated.useSharedValue)(0),P=(0,_react.useRef)(null);(0,_react.useEffect)(()=>()=>{(0,_reactNativeReanimated.cancelAnimation)(C),(0,_reactNativeReanimated.cancelAnimation)(G)},[C,G]);const A=(0,_react.useCallback)(e=>{P.current!==e&&(P.current=e,s?.(e))},[s]),k=(0,_react.useCallback)(()=>{null!==P.current&&(P.current=null,o?.())},[o]),F=(0,_react.useCallback)(e=>{const t="left"===e?a:i,n=t?.[0];n&&(!1!==l&&(0,_index2.triggerHaptic)("notificationSuccess"),n.onPress(),C.value=(0,_reactNativeReanimated.withSpring)(0,N),P.current=null,o?.())},[a,i,C,o,N,l]),M=(0,_react.useCallback)(()=>{C.value=(0,_reactNativeReanimated.withSpring)(0,N),k()},[C,k,N]),T=(0,_react.useCallback)(e=>{const t=(0,_index2.resolveHaptic)(l,"selection");t&&(0,_index2.triggerHaptic)(t),e.onPress(),M()},[M,l]),q=(0,_react.useMemo)(()=>{const e=O,t=I,a=S,i=-S,n=j,r=-j,s=h,o=w,l=x;return _reactNativeGestureHandler.Gesture.Pan().enabled(!c).withTestId(p?`${p}-gesture`:"swipeable-gesture").activeOffsetX([-R,R]).failOffsetY([-y,y]).onStart(()=>{"worklet";G.value=C.value}).onUpdate(a=>{"worklet";const i=G.value+a.translationX;C.value=i>0&&!o||i<0&&!l?0:i>e&&o?e+(i-e)*g:i<-t&&l?(i+t)*g-t:i}).onEnd(()=>{"worklet";const c=C.value;return o&&c>=a?(C.value=(0,_reactNativeReanimated.withSpring)(n,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(F)("left")):l&&c<=i?(C.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(F)("right")):o&&c>=s?(C.value=(0,_reactNativeReanimated.withSpring)(e,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(A)("left")):l&&c<=-s?(C.value=(0,_reactNativeReanimated.withSpring)(-t,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(A)("right")):(C.value=(0,_reactNativeReanimated.withSpring)(0,N),void(0,_reactNativeReanimated.runOnJS)(k)())})},[c,G,F,S,w,x,O,k,A,I,j,h,C,R,y,g,N,p]),E=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:C.value}]})),B=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:O>0?Math.min(1,Math.max(0,C.value/O)):0})),D=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:I>0?Math.min(1,Math.max(0,-C.value/I)):0})),W=(0,_react.useMemo)(()=>{const e=[];return a?.forEach(t=>e.push({name:t.key,label:t.label})),i?.forEach(t=>e.push({name:t.key,label:t.label})),e},[a,i]),V=(0,_react.useCallback)(e=>{const t=e.nativeEvent.actionName,n=[...a??[],...i??[]].find(e=>e.key===t);n&&(!1!==l&&(0,_index2.triggerHaptic)("selection"),n.onPress())},[a,i,l]);return w||x?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[b.root,u],testID:p,accessibilityLabel:m,accessibilityActions:W,onAccessibilityAction:V,children:[w?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.actionsRow,b.actionsLeft,{width:O},_,B],pointerEvents:"box-none",children:a?.map(e=>(0,_jsxRuntime.jsx)(ActionButton,{action:e,theme:v,width:h,onPress:T},e.key))}):null,x?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.actionsRow,b.actionsRight,{width:I},_,D],pointerEvents:"box-none",children:i?.map(e=>(0,_jsxRuntime.jsx)(ActionButton,{action:e,theme:v,width:h,onPress:T},e.key))}):null,(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:q,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.content,d,E],children:t})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u,testID:p,children:t})};exports.Swipeable=Swipeable,Swipeable.displayName="Swipeable";const ActionButton=({action:e,theme:t,width:a,onPress:i})=>{const n=e.tone??"neutral",r=toneToBg(t,n);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>i(e),accessibilityRole:"button",accessibilityLabel:e.label,style:[actionStyles.button,{width:a,backgroundColor:r,paddingHorizontal:t.spacing.sm}],children:[e.icon?(0,_jsxRuntime.jsx)(_reactNative.View,{style:actionStyles.icon,children:e.icon}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[actionStyles.label,{color:toneToOnColor(t,n),fontSize:t.typography.fontSize.sm,fontWeight:t.typography.fontWeight.semibold}],numberOfLines:1,children:e.label})]})},actionStyles=_reactNative.StyleSheet.create({button:{flexGrow:0,flexShrink:0,alignItems:"center",justifyContent:"center"},icon:{marginBottom:2},label:{textAlign:"center"}}),buildStyles=e=>_reactNative.StyleSheet.create({root:{position:"relative",overflow:"hidden"},content:{backgroundColor:"transparent"},actionsRow:{position:"absolute",top:0,bottom:0,flexDirection:"row"},actionsLeft:{left:0},actionsRight:{right:0,justifyContent:"flex-end"}});var _default=exports.default=Swipeable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ZoomableImage=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../utils/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if("function"==typeof WeakMap)var t=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,a){if(!a&&e&&e.__esModule)return e;var i,n,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(i=a?r:t){if(i.has(e))return i.get(e);i.set(e,l)}for(const a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,a))&&(n.get||n.set)?i(l,a,n):l[a]=e[a]);return l})(e,a)}const DEFAULT_MAX_SCALE=4,DEFAULT_MIN_SCALE=1,DEFAULT_DOUBLE_TAP_SCALE=2,SPRING_CONFIG={damping:18,stiffness:220,mass:1},ZoomableImage=({children:e,maxScale:a=4,minScale:t=1,doubleTapScale:r=2,disabled:i=!1,haptic:n,style:l,accessibilityLabel:u,testID:c})=>{const s=(0,_reactNativeReanimated.useSharedValue)(1),v=(0,_reactNativeReanimated.useSharedValue)(1),d=(0,_reactNativeReanimated.useSharedValue)(0),o=(0,_reactNativeReanimated.useSharedValue)(0),_=(0,_reactNativeReanimated.useSharedValue)(0),m=(0,_reactNativeReanimated.useSharedValue)(0),N=(0,_react.useCallback)(()=>{s.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),v.value=1,d.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),o.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=0,m.value=0},[s,v,d,o,_,m]);(0,_react.useEffect)(()=>{i&&N()},[i,N]);const p=(0,_react.useCallback)(()=>{const e=(0,_index.resolveHaptic)(n,"impactLight");e&&(0,_index.triggerHaptic)(e)},[n]),R=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pinch().enabled(!i).onStart(()=>{v.value=s.value}).onUpdate(e=>{const r=v.value*e.scale;s.value=r<t?t+.3*(r-t):r>a?a+.2*(r-a):r}).onEnd(()=>s.value<t?(s.value=(0,_reactNativeReanimated.withSpring)(t,SPRING_CONFIG),d.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),o.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),v.value=t,_.value=0,void(m.value=0)):s.value>a?(s.value=(0,_reactNativeReanimated.withSpring)(a,SPRING_CONFIG),void(v.value=a)):void(v.value=s.value)),[i,s,v,d,o,_,m,t,a]),S=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pan().enabled(!i).minPointers(1).maxPointers(1).onStart(()=>{_.value=d.value,m.value=o.value}).onUpdate(e=>{s.value<=1||(d.value=_.value+e.translationX,o.value=m.value+e.translationY)}).onEnd(()=>{_.value=d.value,m.value=o.value}),[i,s,d,o,_,m]),I=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Tap().enabled(!i).numberOfTaps(2).onEnd(()=>{(0,_reactNativeReanimated.runOnJS)(p)(),s.value>1?(s.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),d.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),o.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),v.value=1,_.value=0,m.value=0):(s.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),v.value=r)}),[i,s,v,d,o,_,m,p,r]),G=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Race(R,S,I),[R,S,I]),f=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:d.value},{translateY:o.value},{scale:s.value}]}));return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:G,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[styles.container,l],testID:c,accessibilityLabel:u,accessibilityState:{disabled:i},children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[styles.content,f],children:e})})})};exports.ZoomableImage=ZoomableImage,ZoomableImage.displayName="ZoomableImage";const styles=_reactNative.StyleSheet.create({container:{flex:1,alignItems:"center",justifyContent:"center",overflow:"hidden"},content:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"}});var _default=exports.default=ZoomableImage;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ZoomableImage=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../utils/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if("function"==typeof WeakMap)var t=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,a){if(!a&&e&&e.__esModule)return e;var i,n,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(i=a?r:t){if(i.has(e))return i.get(e);i.set(e,l)}for(const a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((n=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,a))&&(n.get||n.set)?i(l,a,n):l[a]=e[a]);return l})(e,a)}const DEFAULT_MAX_SCALE=4,DEFAULT_MIN_SCALE=1,DEFAULT_DOUBLE_TAP_SCALE=2,SPRING_CONFIG={damping:18,stiffness:220,mass:1},ZoomableImage=({children:e,maxScale:a=4,minScale:t=1,doubleTapScale:r=2,disabled:i=!1,haptic:n,style:l,accessibilityLabel:u,testID:c})=>{const s=(0,_reactNativeReanimated.useSharedValue)(1),v=(0,_reactNativeReanimated.useSharedValue)(1),d=(0,_reactNativeReanimated.useSharedValue)(0),o=(0,_reactNativeReanimated.useSharedValue)(0),_=(0,_reactNativeReanimated.useSharedValue)(0),m=(0,_reactNativeReanimated.useSharedValue)(0),N=(0,_react.useCallback)(()=>{s.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),v.value=1,d.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),o.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),_.value=0,m.value=0},[s,v,d,o,_,m]);(0,_react.useEffect)(()=>{i&&N()},[i,N]);const p=(0,_react.useCallback)(()=>{const e=(0,_index.resolveHaptic)(n,"impactLight");e&&(0,_index.triggerHaptic)(e)},[n]),R=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pinch().enabled(!i).onStart(()=>{"worklet";v.value=s.value}).onUpdate(e=>{"worklet";const r=v.value*e.scale;s.value=r<t?t+.3*(r-t):r>a?a+.2*(r-a):r}).onEnd(()=>{"worklet";return s.value<t?(s.value=(0,_reactNativeReanimated.withSpring)(t,SPRING_CONFIG),d.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),o.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),v.value=t,_.value=0,void(m.value=0)):s.value>a?(s.value=(0,_reactNativeReanimated.withSpring)(a,SPRING_CONFIG),void(v.value=a)):void(v.value=s.value)}),[i,s,v,d,o,_,m,t,a]),S=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pan().enabled(!i).minPointers(1).maxPointers(1).onStart(()=>{"worklet";_.value=d.value,m.value=o.value}).onUpdate(e=>{"worklet";s.value<=1||(d.value=_.value+e.translationX,o.value=m.value+e.translationY)}).onEnd(()=>{"worklet";_.value=d.value,m.value=o.value}),[i,s,d,o,_,m]),I=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Tap().enabled(!i).numberOfTaps(2).onEnd(()=>{"worklet";(0,_reactNativeReanimated.runOnJS)(p)(),s.value>1?(s.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),d.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),o.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),v.value=1,_.value=0,m.value=0):(s.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),v.value=r)}),[i,s,v,d,o,_,m,p,r]),G=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Race(R,S,I),[R,S,I]),f=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:d.value},{translateY:o.value},{scale:s.value}]}));return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:G,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[styles.container,l],testID:c,accessibilityLabel:u,accessibilityState:{disabled:i},children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[styles.content,f],children:e})})})};exports.ZoomableImage=ZoomableImage,ZoomableImage.displayName="ZoomableImage";const styles=_reactNative.StyleSheet.create({container:{flex:1,alignItems:"center",justifyContent:"center",overflow:"hidden"},content:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"}});var _default=exports.default=ZoomableImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{createContext,useCallback,useContext,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,LayoutAnimation,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const AccordionGroupContext=createContext(null),useAccordionGroup=()=>useContext(AccordionGroupContext),AccordionGroup=({children:e,allowMultiple:t=!1,defaultExpandedKeys:o,expandedKeys:n,onChange:i,style:r,testID:s})=>{const a=void 0!==n,[l,c]=useState(o??[]),d=a?n:l,u=useCallback(e=>{a||c(e),i?.(e)},[a,i]),p=useCallback(e=>{let o;o=d.includes(e)?d.filter(t=>t!==e):t?[...d,e]:[e],u(o)},[d,t,u]),m=useCallback(e=>d.includes(e),[d]),g=useMemo(()=>({isExpanded:m,toggle:p,allowMultiple:t}),[m,p,t]);return _jsx(AccordionGroupContext.Provider,{value:g,children:_jsx(View,{style:r,testID:s,children:e})})};AccordionGroup.displayName="AccordionGroup";const Chevron=({rotate:e,color:t})=>{const o=useTheme();return _jsx(Animated.View,{style:[chevronStyles.icon,{transform:[{rotate:e}]}],accessible:!1,children:(o.icons?.chevronDown??defaultIcons.chevronDown)({size:16,color:t})})},chevronStyles=StyleSheet.create({icon:{width:16,height:16,alignItems:"center",justifyContent:"center"}}),Accordion=e=>{const{title:t,children:o,id:n,expanded:i,defaultExpanded:r=!1,onChange:s,icon:a,disabled:l=!1,variant:c="plain",accessibilityLabel:d,style:u,headerStyle:p,contentStyle:m,contentWrapperStyle:g,containerStyle:h,testID:y,loading:x=!1,haptic:f}=e,b=useTheme(),A=useMemo(()=>buildStyles(b),[b]),S=useAccordionGroup(),v=void 0!==i,[j,V]=useState(r),C=S&&n?S.isExpanded(n):null,w=null!==C?C:v?!!i:j,[k,_]=useState(null),R=useRef(createAnimatedValue(w?1:0)).current,E=useRef(createAnimatedValue(w?1:0)).current,I=useRef(createAnimatedValue(w?1:0)).current,D=useRef(w);useEffect(()=>{if(D.current===w)return;D.current=w;const e=Animated.parallel([Animated.timing(R,{toValue:w?1:0,duration:b.motion.duration.normal,easing:Easing.bezier(...b.motion.easing.standard),useNativeDriver:!1}),Animated.timing(E,{toValue:w?1:0,duration:b.motion.duration.normal,easing:Easing.bezier(...b.motion.easing.standard),useNativeDriver:!1}),Animated.timing(I,{toValue:w?1:0,duration:b.motion.duration.normal,easing:Easing.bezier(...b.motion.easing.standard),useNativeDriver:!1})]);return e.start(),()=>e.stop()},[w,R,E,I,b.motion]);const z=useCallback(e=>{const t=e.nativeEvent.layout.height;t>0&&t!==k&&_(t)},[k]),G=useCallback(()=>{if(l)return;const e=resolveHaptic(f,"selection");if(e&&triggerHaptic(e),S&&n)return S.toggle(n),void s?.(!w);v||V(!w),s?.(!w)},[l,S,n,w,v,s,f]),L=I.interpolate({inputRange:[0,1],outputRange:["0deg","180deg"]}),H=null===k?void 0:R.interpolate({inputRange:[0,1],outputRange:[0,k]}),N="card"===c?[A.card,b.shadows.sm,{backgroundColor:b.colors.background.elevated,borderRadius:b.radius.md,...smoothCorners}]:null;return x?_jsx(AccordionSkeleton,{...e}):_jsxs(View,{style:[N,u,h],testID:y,children:[_jsxs(Pressable,{onPress:G,disabled:l,accessibilityRole:"button",accessibilityLabel:d??t,accessibilityState:{expanded:w,disabled:l},style:({pressed:e})=>[A.header,p,{opacity:l?.55:e?.85:1}],children:[a?_jsx(View,{style:A.iconLeft,children:a}):null,_jsx(Text,{style:[A.title,{color:l?b.colors.text.disabled:b.colors.text.primary,fontSize:b.typography.fontSize.base,fontWeight:b.typography.fontWeight.semibold}],numberOfLines:2,children:t}),_jsx(Chevron,{rotate:L,color:l?b.colors.text.disabled:b.colors.text.secondary})]}),null===k?_jsx(View,{style:A.measurer,pointerEvents:"none",onLayout:z,children:_jsx(View,{style:[A.content,m],children:o})}):null,_jsx(Animated.View,{style:[A.contentWrapper,null===k?{height:0,opacity:0}:{height:H,opacity:E},g],children:_jsx(View,{onLayout:z,style:[A.content,m],children:o})})]})};Accordion.displayName="Accordion";const AccordionSkeleton=({variant:e="plain",style:t})=>{const o=useTheme();return _jsx(View,{style:["card"===e?{paddingHorizontal:o.spacing.md,paddingVertical:o.spacing.sm,backgroundColor:o.colors.background.elevated,borderRadius:o.radius.md,...smoothCorners}:{paddingVertical:o.spacing.sm},t],accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:_jsxs(View,{style:{flexDirection:"row",alignItems:"center"},children:[_jsx(Skeleton,{shape:"text",width:"60%",height:18,style:{flex:1}}),_jsx(Skeleton,{width:16,height:16,radius:"sm",style:{marginLeft:o.spacing.sm}})]})})};AccordionSkeleton.displayName="AccordionSkeleton",Accordion.Skeleton=AccordionSkeleton;const buildStyles=e=>StyleSheet.create({card:{paddingHorizontal:e.spacing.md,paddingVertical:e.components.accordion?.cardPaddingVertical??4,marginVertical:e.spacing.xs},header:{flexDirection:"row",alignItems:"center",paddingVertical:e.spacing.sm},iconLeft:{marginRight:e.spacing.sm},title:{flex:1},contentWrapper:{overflow:"hidden"},content:{paddingBottom:e.spacing.sm},measurer:{position:"absolute",opacity:0,left:0,right:0,top:0,zIndex:-1}});export{Accordion,AccordionGroup};export default Accordion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Accordion,AccordionGroup,default}from"./Accordion.js";
|
|
1
|
+
"use strict";export{Accordion,AccordionGroup,default}from"./Accordion.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatCurrency
|
|
1
|
+
"use strict";import{formatCurrency}from"@webority/mobile-core";import{forwardRef,useMemo,useRef}from"react";import{StyleSheet,Text,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{Input}from"../Input/index.js";import{Slider}from"../Slider/index.js";import{clampValue,RollingText,useValueDraft}from"../Slider/valueText.js";import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";const INDIAN_TIERS=[[1e7,"Crore"],[1e5,"Lakh"],[1e3,"Thousand"]];export const scaleAmount=(e,t)=>{if("indian"===t){const t=Math.abs(e);for(const[i,n]of INDIAN_TIERS)if(t>=i)return{amount:e/i,unit:n}}return{amount:e,unit:""}};const formatAmount=(e,t)=>{const i=Math.round(100*e)/100;return t?String(i):formatCurrency(Math.round(e),{stripSymbol:!0,maximumFractionDigits:0})},defaultFormatInput=e=>formatCurrency(e,{maximumFractionDigits:0}),AmountSlider=forwardRef((e,t)=>{const{min:i=0,max:n=100,step:o=1,disabled:r=!1,tone:a,size:l,variant:s="inset",prefix:u="₹",units:m="indian",formatInput:c=defaultFormatInput,animationDuration:d,haptic:p,accessibilityLabel:f,inputAccessibilityLabel:x="Amount",style:y,headerStyle:h,valueStyle:S,unitStyle:b,inputStyle:g,sliderStyle:v,testID:I}=e,j=useTheme(),w=useMemo(()=>buildStyles(j),[j]),D=d??j.motion.duration.normal,[T,A]=useControllableState({value:e.value,defaultValue:e.defaultValue??i,onChange:e.onChange}),C=clampValue(T,i,n),R=useValueDraft({value:C,min:i,max:n,step:o,format:c,onChange:A}),_=scaleAmount(C,m),V=""!==_.unit,$=useRef(C),z=useRef("up");C!==$.current&&(z.current=C>$.current?"up":"down",$.current=C);const F=z.current,L=`${u}${formatAmount(_.amount,V)}${V?` ${_.unit}`:""}`;return _jsxs(View,{ref:t,style:[w.container,y],testID:I,children:[_jsxs(View,{style:[w.header,h],children:[_jsxs(View,{style:w.valueRow,accessible:!0,accessibilityRole:"text",accessibilityLabel:L,children:[u?_jsxs(Text,{style:[w.value,S],children:[u," "]}):null,_jsx(RollingText,{text:formatAmount(_.amount,V),direction:F,duration:D,style:[w.value,S],testID:I?`${I}-value`:void 0}),V?_jsx(RollingText,{text:` ${_.unit}`,direction:F,duration:D,perCharacter:!1,style:[w.unit,b],testID:I?`${I}-unit`:void 0}):null]}),_jsx(Input,{size:"sm",value:R.text,onChangeText:R.onChangeText,onFocus:R.onFocus,onBlur:R.onBlur,onSubmitEditing:R.onBlur,keyboardType:"number-pad",returnKeyType:"done",disabled:r,accessibilityLabel:x,style:[w.input,g],testID:I?`${I}-input`:void 0})]}),_jsx(Slider,{value:C,onChange:A,min:i,max:n,step:o,disabled:r,tone:a,size:l,variant:s,haptic:p,accessibilityLabel:f,style:v,testID:I?`${I}-slider`:void 0})]})});AmountSlider.displayName="AmountSlider";const buildStyles=e=>StyleSheet.create({container:{width:"100%"},header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:e.spacing.md},valueRow:{flexDirection:"row",alignItems:"baseline",flexShrink:1},value:{color:e.colors.text.primary,fontSize:e.typography.fontSize["3xl"],fontWeight:e.typography.fontWeight.bold,fontVariant:["tabular-nums"]},unit:{color:e.colors.text.primary,fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold},input:{width:"45%",maxWidth:180}});export{AmountSlider};export default AmountSlider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AmountSlider,default}from"./AmountSlider.js";
|
|
1
|
+
"use strict";export{AmountSlider,default}from"./AmountSlider.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React from"react";import Animated,{FadeIn,FadeInDown,FadeInUp,FadeOut,FadeOutDown,FadeOutUp,ZoomIn,ZoomOut}from"react-native-reanimated";import{useReducedMotion}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";const AnimatePresence=({children:e,preset:t="fade",duration:n,style:a,testID:o})=>{const r=useTheme(),i=useReducedMotion();if(!(null!=e&&!1!==e))return null;const d=n??r.motion.duration.normal;let s,u;if(!i)switch(t){case"scale":s=ZoomIn.duration(d),u=ZoomOut.duration(d);break;case"slide-up":s=FadeInUp.duration(d),u=FadeOutDown.duration(d);break;case"slide-down":s=FadeInDown.duration(d),u=FadeOutUp.duration(d);break;default:s=FadeIn.duration(d),u=FadeOut.duration(d)}return _jsx(Animated.View,{entering:s,exiting:u,style:a,testID:o,children:e})};AnimatePresence.displayName="AnimatePresence";export{AnimatePresence};export default AnimatePresence;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AnimatePresence}from"./AnimatePresence.js";
|
|
1
|
+
"use strict";export{AnimatePresence}from"./AnimatePresence.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{AppIcon}from"../AppIcon/AppIcon.js";import{Text as ThemedText}from"../Text/Text.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const variantSize=(t,e)=>{switch(e){case"compact":return{height:44,titleSize:t.typography.fontSize.lg,titleWeight:"semibold",alignBottom:!1};case"large":return{height:96,titleSize:t.typography.fontSize["2xl"],titleWeight:"bold",alignBottom:!0};default:return{height:56,titleSize:t.typography.fontSize.lg,titleWeight:"semibold",alignBottom:!1}}},ActionButton=({action:t,side:e,badgeStyle:i,haptic:o,flush:n})=>{const r=useTheme(),{scale:a,pressIn:l,pressOut:s}=usePressAnimation({enabled:!0}),c=useMemo(()=>buildActionStyles(r),[r]),p=t.badge,d=void 0!==p&&0!==p,m=void 0!==t.text;return _jsx(Animated.View,{style:{transform:[{scale:a}]},children:_jsxs(Pressable,{onPress:()=>{const e=resolveHaptic(o,"selection");e&&triggerHaptic(e),t.onPress()},onPressIn:l,onPressOut:s,accessibilityRole:"button",accessibilityLabel:t.accessibilityLabel??t.text,testID:t.testID,android_ripple:{color:r.colors.surface.pressed,borderless:!m},style:({pressed:t})=>[m?c.textButton:c.actionButton,n?null:"left"===e?c.actionLeft:c.actionRight,t&&!m?c.actionPressed:null,t&&m?c.textPressed:null],children:[m?_jsx(Text,{style:c.actionText,numberOfLines:1,children:t.text}):_jsx(View,{style:c.iconWrap,children:t.icon}),d?_jsx(View,{style:[c.badge,i],pointerEvents:"none",children:_jsx(Text,{style:c.badgeText,numberOfLines:1,children:String(p)})}):null,t.dot?_jsx(View,{testID:t.testID?`${t.testID}-dot`:"appbar-action-dot",style:c.dot,pointerEvents:"none"}):null]})})},COLLAPSE_RANGE=60,LARGE_TITLE_SCALE_END=.71,AppBar=forwardRef((t,e)=>{const{title:i,subtitle:o,titleAlignment:n="left",leftAction:r,rightActions:a,leading:l,trailing:s,onBack:c,gutter:p,titleVariant:d,titleOffset:m,height:g,divider:u,variant:h="default",transparent:f=!1,scrollY:x,style:y,containerStyle:b,titleStyle:S,subtitleStyle:B,badgeStyle:A,haptic:j,testID:T}=t,w=useTheme(),z=useSafeAreaInsets(),C=useMemo(()=>variantSize(w,h),[w,h]),_=useMemo(()=>buildStyles(w),[w]),I="large"===h&&void 0!==x,R=w.components.appBar?.iconSize??24,v=w.components.appBar?.actionButtonSize??44,W=r??(c?{icon:_jsx(AppIcon,{name:"arrow-left",size:R,color:w.colors.text.primary}),onPress:c,accessibilityLabel:"Back"}:void 0),L=s?void 0:a?.[a.length-1],opticalInset=t=>void 0===t?0:void 0!==t.text?w.spacing.sm:Math.max((v-R)/2,0),V=void 0===p?null:{paddingLeft:Math.max(p-opticalInset(W),0),paddingRight:Math.max(p-opticalInset(L),0)},O=void 0!==m,P=Boolean(W)||Boolean(l),H=u??!f,D=w.components.appBar?.dividerWidth??StyleSheet.hairlineWidth,E=w.components.appBar?.collapseTranslateDistance??-20,M=useMemo(()=>{if(!x)return null;const t={inputRange:[0,60],extrapolate:"clamp"};return{titleScale:x.interpolate({...t,outputRange:[1,.71]}),titleTranslateY:x.interpolate({...t,outputRange:[0,E]}),titleTranslateX:x.interpolate({...t,outputRange:"center"===n?[0,0]:[0,8]}),subtitleOpacity:x.interpolate({inputRange:[0,30],outputRange:[1,0],extrapolate:"clamp"}),barHeight:x.interpolate({...t,outputRange:[96,56]}),borderOpacity:x.interpolate({...t,outputRange:[0,1]})}},[x,n,E]),k=I&&M?{transform:[{translateX:M.titleTranslateX},{translateY:M.titleTranslateY},{scale:M.titleScale}]}:null,F=i?d?_jsx(Animated.View,{style:k,children:_jsx(ThemedText,{variant:d,align:"center"===n?"center":"left",accessibilityRole:"header",numberOfLines:1,style:[_.titleVariant,S],children:i})}):_jsx(Animated.Text,{accessibilityRole:"header",style:[_.title,{fontSize:C.titleSize,fontWeight:w.typography.fontWeight[C.titleWeight],textAlign:"center"===n?"center":"left"},k,S],numberOfLines:1,children:i}):null,Y=o?_jsx(Animated.Text,{style:[_.subtitle,{textAlign:"center"===n?"center":"left"},I&&M?{opacity:M.subtitleOpacity}:null,B],numberOfLines:1,children:o}):null,N=_jsxs(View,{style:[_.titleColumn,"center"===n?_.titleColumnCenter:null,C.alignBottom?_.titleColumnBottom:null],children:[F,Y]}),X=I?Animated.View:View,G=I&&M?{height:Animated.add(M.barHeight,new Animated.Value(z.top))}:{height:(g??C.height)+z.top};return _jsxs(X,{ref:e,testID:T,style:[_.root,{paddingTop:z.top,backgroundColor:f?"transparent":w.colors.background.elevated},G,!I&&H?{borderBottomWidth:D,borderBottomColor:w.colors.border.primary}:null,y,b],children:[I&&M&&H?_jsx(Animated.View,{pointerEvents:"none",style:[_.animatedBorder,{backgroundColor:w.colors.border.primary,opacity:M.borderOpacity}]}):null,_jsxs(View,{style:[_.row,C.alignBottom?_.rowAlignBottom:null,V,{flex:1}],children:[_jsxs(View,{style:[_.sideSlot,O?_.sideSlotCompact:null],children:[W?_jsx(ActionButton,{action:W,side:"left",haptic:j,flush:O}):null,l]}),_jsx(View,{pointerEvents:"none",style:[_.center,"center"===n?_.centerAligned:_.centerLeft,O?{paddingLeft:P?m:0,paddingRight:0}:null],children:N}),_jsxs(View,{style:[_.sideSlot,_.sideSlotRight,O?_.sideSlotCompact:null],children:[a?.map((t,e)=>_jsx(ActionButton,{action:t,side:"right",badgeStyle:A,haptic:j,flush:O},`appbar-right-${e}`)),s]})]})]})});AppBar.displayName="AppBar";const buildStyles=t=>StyleSheet.create({root:{width:"100%"},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:t.spacing.xs},rowAlignBottom:{alignItems:"flex-end",paddingBottom:t.spacing.sm},sideSlot:{flexDirection:"row",alignItems:"center",minWidth:t.components.appBar?.sideSlotMinWidth??48},sideSlotRight:{justifyContent:"flex-end"},sideSlotCompact:{minWidth:0},center:{flex:1,paddingHorizontal:t.spacing.xs},centerAligned:{alignItems:"center"},centerLeft:{alignItems:"flex-start"},titleColumn:{flexDirection:"column"},titleColumnCenter:{alignItems:"center"},titleColumnBottom:{justifyContent:"flex-end"},title:{color:t.colors.text.primary},titleVariant:{includeFontPadding:!1,textAlignVertical:"center"},subtitle:{marginTop:t.components.appBar?.subtitleMarginTop??2,color:t.colors.text.tertiary,fontSize:t.typography.fontSize.sm,fontWeight:t.typography.fontWeight.normal},animatedBorder:{position:"absolute",left:0,right:0,bottom:0,height:StyleSheet.hairlineWidth}}),buildActionStyles=t=>StyleSheet.create({actionButton:{width:t.components.appBar?.actionButtonSize??44,height:t.components.appBar?.actionButtonSize??44,borderRadius:t.radius.full,...smoothCorners,alignItems:"center",justifyContent:"center"},actionLeft:{marginRight:t.spacing.xs},actionRight:{marginLeft:t.spacing.xs},actionPressed:{backgroundColor:t.colors.surface.pressed},textButton:{minWidth:44,minHeight:44,paddingHorizontal:t.spacing.sm,alignItems:"center",justifyContent:"center"},textPressed:{opacity:.6},actionText:{color:t.colors.text.link,fontSize:t.typography.fontSize.base,...fontFor(t,"semibold")},dot:{position:"absolute",top:t.components.appBar?.dotOffset??10,right:t.components.appBar?.dotOffset??10,width:t.components.appBar?.dotSize??8,height:t.components.appBar?.dotSize??8,borderRadius:t.radius.full,backgroundColor:t.colors.error},iconWrap:{alignItems:"center",justifyContent:"center"},badge:{position:"absolute",top:t.components.appBar?.badgeOffset??4,right:t.components.appBar?.badgeOffset??4,minWidth:t.components.appBar?.badgeMinWidth??16,height:t.components.appBar?.badgeHeight??16,paddingHorizontal:t.components.appBar?.badgePaddingHorizontal??4,borderRadius:t.radius.full,...smoothCorners,backgroundColor:t.colors.error,alignItems:"center",justifyContent:"center"},badgeText:{color:t.colors.onError,fontSize:t.components.appBar?.badgeFontSize??10,fontWeight:t.typography.fontWeight.semibold,lineHeight:t.components.appBar?.badgeLineHeight??12}});export{AppBar};export default AppBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AppBar,default}from"./AppBar.js";
|
|
1
|
+
"use strict";export{AppBar,default}from"./AppBar.js";
|