@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
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useMemo}from"react";import{Animated,Image,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/useControllableState.js";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{Gradient,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{supportsBoxShadow,toBoxShadow}from"../../utils/shadows.js";import{squircleHostRadius}from"../../utils/squircle.js";import{AppIcon}from"../AppIcon/AppIcon.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},Card=forwardRef((e,t)=>{const{children:o,variant:i="elevated",elevation:r="sm",radius:s="lg",padding:l="md",interactive:a=!1,bg:n,header:d,title:c,lead:u,action:h,headerActions:p,collapsible:m=!1,collapsed:g,defaultCollapsed:b=!1,onCollapsedChange:y,collapsedSummary:x,onRemove:S,removeLabel:f="Remove",separatorHeight:v=StyleSheet.hairlineWidth,footer:j,imageSource:C,imageHeight:_=160,imageAspectRatio:w,imageOverlay:k,loading:R=!1,gradient:A,onPress:T,haptic:B,accessibilityLabel:H,accessibilityHint:I,accessibilityRole:P,style:V,containerStyle:L,headerStyle:F,bodyStyle:z,footerStyle:q,borderRadius:M,testID:W,onLayout:D,...O}=e,N=useTheme(),E=a||"function"==typeof T,{scale:G,pressIn:$,pressOut:U}=usePressAnimation({enabled:E}),J=useMemo(()=>buildStyles(N),[N]),K=Boolean(C),Q=N.spacing[paddingMap[l]],X=useMemo(()=>A?"string"==typeof A?N.gradients[A]??null:A:null,[A,N.gradients]),Y="flat"===i,Z=Y?0:M??N.radius[s],ee=resolveBackground(N,n),[te,oe]=useControllableState({value:g,defaultValue:b,onChange:y}),ie=m&&te,re=hasBuiltInHeaderContent(e),se=Boolean(d)||re,le=useSquircle(!K&&!X&&!Y,Z,D),ae=StyleSheet.flatten([V,L])??{},ne=ae.backgroundColor,de=ae.borderColor,ce=ne??ee??("filled"===i?N.colors.background.secondary:N.colors.background.elevated),ue="outlined"===i?N.colors.border.width:0,he=de??N.colors.border.primary,pe="elevated"===i&&supportsBoxShadow()?toBoxShadow(N.shadows[r]):void 0,me=le.active&&"elevated"===i&&!pe,ge=le.active&&!me?{backgroundColor:"transparent",borderColor:"transparent"}:null,be=useMemo(()=>{const e={borderRadius:me&&le.size?squircleHostRadius(le.size.width,le.size.height,Z):Z,...smoothCorners,padding:K?0:Q,overflow:le.active?"visible":"hidden"};switch(i){case"flat":return{...e,backgroundColor:ee??N.colors.background.elevated,borderBottomWidth:v,borderBottomColor:N.colors.border.primary};case"outlined":return{...e,backgroundColor:le.active?"transparent":ee??N.colors.background.elevated,borderWidth:N.colors.border.width,borderColor:le.active?"transparent":N.colors.border.primary};case"filled":return{...e,backgroundColor:le.active?"transparent":ee??N.colors.background.secondary};default:return{...e,backgroundColor:ee??N.colors.background.elevated,...pe?{boxShadow:pe}:N.shadows[r]}}},[N,i,r,Z,K,Q,le.active,le.size,pe,me,ee,v]),ye=useMemo(()=>({..."number"==typeof w?{width:"100%",aspectRatio:w}:{width:"100%",height:_},borderTopLeftRadius:Z,borderTopRightRadius:Z,borderBottomLeftRadius:0,borderBottomRightRadius:0,...smoothCorners}),[Z,w,_]),xe="string"==typeof c?c:"",Se=_jsxs(_Fragment,{children:[_jsxs(View,{style:J.titleColumn,children:["string"==typeof c?_jsx(Text,{variant:"title",accessibilityRole:"header",children:c}):c,u?_jsx(Text,{variant:"bodySmall",style:J.lead,children:u}):null,ie&&x?_jsx(Text,{variant:"caption",style:J.lead,children:x}):null]}),isCardTextAction(h)?_jsx(CardTextActionButton,{action:h,haptic:B}):h?_jsx(View,{style:J.actionNode,children:h}):null,p,m?_jsx(CardIconAction,{icon:ie?"chevron-down":"chevron-up",label:`${ie?"Show":"Hide"} ${xe}`.trim(),expanded:!ie,onPress:()=>oe(!ie),haptic:B}):null,S?_jsx(CardIconAction,{icon:"trash",label:f,onPress:S,color:N.colors.error,haptic:B}):null]}),fe=_jsxs(_Fragment,{children:[se?_jsx(View,{style:[J.header,!d&&J.headerRow,ie&&J.headerFolded,F],children:d??Se}):null,ie?null:_jsx(View,{style:[se||j?J.body:null,z],children:o}),j&&!ie?_jsx(View,{style:[J.footer,q],children:j}):null]}),ve=K?_jsxs(_Fragment,{children:[_jsxs(View,{style:J.imageWrapper,children:[_jsx(Image,{source:C,resizeMode:"cover",style:ye,accessibilityLabel:"",accessible:!1}),k?_jsx(View,{pointerEvents:"box-none",style:J.imageOverlay,children:k}):null]}),_jsx(View,{style:{padding:Q},children:fe})]}):fe,je=X?_jsxs(_Fragment,{children:[_jsx(Gradient,{gradient:X,style:StyleSheet.absoluteFill}),ve]}):le.active&&le.size?_jsxs(_Fragment,{children:[_jsx(SquircleFill,{width:le.size.width,height:le.size.height,radius:Z,fill:ce,stroke:ue?he:void 0,strokeWidth:ue,outset:ue}),ve]}):ve;let Ce;if(E){const handlePress=e=>{const t=resolveHaptic(B,"selection");t&&triggerHaptic(t),T?.(e)};Ce=_jsx(Animated.View,{style:[{transform:[{scale:G}]}],children:_jsx(Pressable,{ref:t,onPress:handlePress,onPressIn:$,onPressOut:U,android_ripple:{color:N.colors.surface.pressed,borderless:!1},accessibilityRole:P??"button",accessibilityLabel:H,accessibilityHint:I,testID:W,onLayout:le.onLayout,style:[be,V,L,ge],...O,children:je})})}else Ce=_jsx(View,{ref:t,accessibilityLabel:H,accessibilityHint:I,accessibilityRole:P,testID:W,onLayout:le.onLayout,style:[be,V,L,ge],children:je});return R?_jsx(CardSkeleton,{...e}):Ce});Card.displayName="Card";const CardSkeleton=({variant:e="elevated",elevation:t,radius:o="lg",padding:i="md",bg:r,header:s,footer:l,imageSource:a,imageHeight:n=160,imageAspectRatio:d,borderRadius:c,containerStyle:u,headerStyle:h,bodyStyle:p,footerStyle:m,style:g,...b})=>{const y=useTheme(),x=paddingMap[i],S=y.spacing[x],f="flat"===e?0:c??y.radius[o],v=void 0!==s||hasBuiltInHeaderContent(b),j=resolveBackground(y,r)??y.colors.background.elevated,C="outlined"===e?1:0,_="outlined"===e?y.colors.border.primary:void 0;return _jsxs(View,{style:[{backgroundColor:j,borderRadius:f,...smoothCorners,borderWidth:C,borderColor:_,overflow:"hidden"},u,g],accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[void 0!==a?_jsx(Skeleton,{width:"100%",height:d?void 0:n,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,v?_jsx(View,{style:[{padding:S,paddingBottom:y.spacing.sm},h],children:_jsx(Skeleton,{shape:"text",width:"60%",height:18})}):null,_jsx(View,{style:[{padding:S},p],children:_jsx(SkeletonText,{lines:3,fontSize:14,lastLineWidth:"55%"})}),void 0!==l?_jsx(View,{style:[{padding:S,paddingTop:y.spacing.sm,flexDirection:"row"},m],children:_jsx(Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton",Card.Skeleton=CardSkeleton;const hasBuiltInHeaderContent=e=>Boolean(e.title||e.lead||e.action||e.headerActions||e.collapsible||e.onRemove),isCardTextAction=e=>"object"==typeof e&&null!==e&&!React.isValidElement(e)&&"label"in e&&"onPress"in e,HIT_TARGET=44,CardIconAction=({icon:e,label:t,onPress:o,expanded:i,color:r,haptic:s})=>{const l=useTheme();return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:t,accessibilityState:void 0===i?void 0:{expanded:i},onPress:()=>{const e=resolveHaptic(s,"selection");e&&triggerHaptic(e),o()},style:iconActionStyle,children:_jsx(AppIcon,{name:e,size:20,color:r??l.colors.text.primary})})},CardTextActionButton=({action:e,haptic:t})=>{const o=useTheme();return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,onPress:()=>{const o=resolveHaptic(t,"selection");o&&triggerHaptic(o),e.onPress()},style:textActionStyle,children:_jsx(Text,{variant:"label",weight:"semibold",color:o.colors.primary,children:e.label})})},iconActionStyle={width:44,height:44,alignItems:"center",justifyContent:"center"},textActionStyle={minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},resolveBackground=(e,t)=>{if(null==t)return;return e.colors.background[t]??t},buildStyles=e=>StyleSheet.create({header:{marginBottom:e.spacing.md},headerRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm},headerFolded:{marginBottom:0},titleColumn:{flex:1},lead:{marginTop:e.spacing.xs},actionNode:{flexShrink:0},body:{flexShrink:1},footer:{marginTop:e.spacing.md},imageWrapper:{position:"relative"},imageOverlay:{...StyleSheet.absoluteFill}});export{Card};export default Card;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Card,default}from"./Card.js";
|
|
1
|
+
"use strict";export{Card,default}from"./Card.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useCallback,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{Animated,Dimensions,FlatList,Image,Pressable,ScrollView,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const CarouselInner=forwardRef((e,t)=>{const{data:n,renderItem:r,keyExtractor:i,index:a,defaultIndex:l=0,onIndexChange:s,autoPlay:o=!1,autoPlayInterval:c=4e3,loop:u=!1,showPagination:m=!0,paginationStyle:d="dots",itemWidth:h="screen",spacing:g=0,containerStyle:y,accessibilityLabel:p,testID:b,showThumbnails:f=!1,haptic:x,renderThumbnail:S,loading:w=!1}=e,C=useTheme(),j="number"==typeof a,k=u||o,[v,I]=useState(()=>Dimensions.get("window").width),T="screen"===h?v:h,R=T+g,_=useRef(null),V=useRef(createAnimatedValue(0)).current,A=clamp(j?a:l,0,Math.max(0,n.length-1)),[E,H]=useState(A),z=useRef(null),M=useRef(null),D=useRef(!1),P=useRef(E);P.current=E;const W=useCallback(e=>{const t=clamp(e,0,Math.max(0,n.length-1));H(e=>e===t?e:(s?.(t),t))},[n.length,s]),L=useCallback((e,t=!0)=>{if(0===n.length)return;const r=clamp(e,0,n.length-1);_.current?.scrollToOffset({offset:r*R,animated:t}),W(r)},[n.length,R,W]),$=useCallback(()=>{if(0===n.length)return;const e=P.current+1;e>=n.length?k&&L(0,!1):L(e,!0)},[n.length,k,L]),N=useCallback(()=>{if(0===n.length)return;const e=P.current-1;e<0?k&&L(n.length-1,!1):L(e,!0)},[n.length,k,L]);useImperativeHandle(t,()=>({scrollTo:L,next:$,prev:N}),[L,$,N]),useEffect(()=>{j&&a!==E&&L(a,!0)},[a]);const F=useCallback(()=>{z.current&&(clearInterval(z.current),z.current=null)},[]),O=useCallback(()=>{!o||n.length<=1||(F(),z.current=setInterval(()=>{if(D.current)return;const e=P.current+1;e>=n.length?L(0,!1):L(e,!0)},c))},[o,c,n.length,L,F]);useEffect(()=>(O(),()=>{F(),M.current&&clearTimeout(M.current)}),[O,F]);const X=m&&n.length>1&&"numbers"!==d,B=useMemo(()=>Animated.event([{nativeEvent:{contentOffset:{x:V}}}],{useNativeDriver:!1}),[V]),G=useCallback(e=>{if(R<=0)return;const t=e.nativeEvent.contentOffset.x,n=Math.round(t/R);W(n)},[R,W]),q=useCallback(()=>{D.current=!0,F(),M.current&&(clearTimeout(M.current),M.current=null)},[F]),J=useCallback(()=>{D.current=!1,o&&(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{O()},1e3))},[o,O]),K=useCallback(e=>{switch(e.nativeEvent.actionName){case"increment":$();break;case"decrement":N()}},[$,N]),Q=useMemo(()=>buildStyles(C),[C]),U=useCallback(({item:e,index:t})=>_jsx(View,{style:{width:T,marginRight:t===n.length-1?0:g},accessibilityElementsHidden:t!==E,importantForAccessibility:t===E?"yes":"no-hide-descendants",children:r(e,t)}),[r,T,g,n.length,E]),Y=useCallback((e,t)=>String(t),[]),Z=useCallback((e,t)=>({length:R,offset:R*t,index:t}),[R]);return w?_jsx(CarouselSkeleton,{...e,containerWidth:v}):_jsxs(View,{style:[Q.container,y],onLayout:e=>I(e.nativeEvent.layout.width),accessibilityRole:"adjustable",accessibilityLabel:p??"Carousel",accessibilityValue:{min:0,max:Math.max(0,n.length-1),now:E,text:`Slide ${E+1} of ${n.length}`},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:K,testID:b,children:[_jsx(FlatList,{ref:_,data:n,keyExtractor:i??Y,renderItem:U,horizontal:!0,pagingEnabled:"screen"===h&&0===g,snapToInterval:R,snapToAlignment:"start",decelerationRate:"fast",showsHorizontalScrollIndicator:!1,onScroll:X?B:void 0,scrollEventThrottle:X?16:void 0,onMomentumScrollEnd:G,onScrollBeginDrag:q,onScrollEndDrag:J,getItemLayout:Z,initialScrollIndex:A,bounces:!1}),m&&n.length>1?_jsx(Pagination,{count:n.length,currentIndex:E,scrollX:V,slideStride:R,variant:d,theme:C}):null,f&&n.length>0?_jsx(ThumbnailStrip,{data:n,currentIndex:E,renderThumbnail:S,onSelect:e=>{const t=resolveHaptic(x,"selection");t&&triggerHaptic(t),L(e,!0)},theme:C}):null]})});CarouselInner.displayName="Carousel";const CarouselSkeleton=({itemWidth:e="screen",showPagination:t=!0,paginationStyle:n="dots",containerStyle:r,containerWidth:i})=>{const a="screen"===e?i||320:e;return _jsxs(View,{style:[carouselSkeletonStyles.container,r],children:[_jsx(Skeleton,{width:a,height:160,radius:"md"}),t?_jsx(View,{style:[carouselSkeletonStyles.paginationRow,{marginTop:12}],children:Array.from({length:3}).map((e,t)=>_jsx(Skeleton,"numbers"===n?{width:24,height:16,radius:"sm",style:{marginHorizontal:4}}:"bars"===n?{width:20,height:4,radius:2,style:{marginHorizontal:3}}:{shape:"circle",width:8,height:8,style:{marginHorizontal:4}},`sk-pg-${t}`))}):null]})};CarouselSkeleton.displayName="CarouselSkeleton";const carouselSkeletonStyles=StyleSheet.create({container:{alignItems:"center"},paginationRow:{flexDirection:"row",justifyContent:"center"}}),Carousel=CarouselInner;Carousel.Skeleton=CarouselSkeleton;const Pagination=({count:e,currentIndex:t,scrollX:n,slideStride:r,variant:i,theme:a})=>{if("numbers"===i)return _jsx(View,{style:paginationStyles.numbersWrap,children:_jsx(Text,{style:[paginationStyles.numbersText,{color:a.colors.text.secondary,fontSize:a.typography.fontSize.sm,fontWeight:a.typography.fontWeight.medium}],accessibilityLabel:`Slide ${t+1} of ${e}`,children:`${t+1} / ${e}`})});const l=Array.from({length:e},(e,t)=>t),s="bars"===i,o=s?24:6,c=s?36:16,u=s?3:6;return _jsx(View,{style:paginationStyles.dotRow,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:l.map(e=>{const i=[(e-1)*r,e*r,(e+1)*r],l=n.interpolate({inputRange:i,outputRange:[o,c,o],extrapolate:"clamp"}),s=n.interpolate({inputRange:i,outputRange:[.5,1,.5],extrapolate:"clamp"});return _jsx(Animated.View,{style:[{width:l,height:u,marginHorizontal:4,borderRadius:u/2,...smoothCorners,backgroundColor:e===t?a.colors.primary:a.colors.border.primary,opacity:s}]},e)})})},ThumbnailStrip=({data:e,currentIndex:t,renderThumbnail:n,onSelect:r,theme:i})=>_jsx(ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:thumbStyles.row,accessibilityRole:"tablist",children:e.map((e,a)=>_jsx(ThumbnailItem,{item:e,index:a,isActive:a===t,renderThumbnail:n,onPress:()=>r(a),theme:i},a))}),ThumbnailItem=({item:e,index:t,isActive:n,renderThumbnail:r,onPress:i,theme:a})=>{const l=useRef(createAnimatedValue(n?1.1:1)).current;useEffect(()=>{const e=Animated.spring(l,{toValue:n?1.1:1,useNativeDriver:!0,friction:6,tension:80});return e.start(),()=>e.stop()},[n,l]);const s=useMemo(()=>r?r(e,t):e&&"object"==typeof e&&"uri"in e&&"string"==typeof e.uri?_jsx(Image,{source:{uri:e.uri},style:thumbStyles.image,resizeMode:"cover"}):_jsx(View,{style:[thumbStyles.placeholder,{backgroundColor:a.colors.background.secondary}],children:_jsx(Text,{style:{color:a.colors.text.secondary,fontSize:a.typography.fontSize.xs,fontWeight:a.typography.fontWeight.semibold},children:t+1})}),[e,t,r,a]);return _jsx(Pressable,{onPress:i,accessibilityRole:"tab",accessibilityState:{selected:n},accessibilityLabel:`Go to slide ${t+1}`,children:_jsx(Animated.View,{style:[thumbStyles.thumb,{borderColor:n?a.colors.primary:"transparent",transform:[{scale:l}]}],children:s})})},thumbStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:8,paddingVertical:8},thumb:{width:40,height:40,marginHorizontal:4,borderRadius:6,...smoothCorners,borderWidth:2,overflow:"hidden"},image:{width:"100%",height:"100%"},placeholder:{flex:1,alignItems:"center",justifyContent:"center"}}),clamp=(e,t,n)=>Math.min(Math.max(e,t),n),buildStyles=e=>StyleSheet.create({container:{width:"100%"}}),paginationStyles=StyleSheet.create({dotRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12},numbersWrap:{alignItems:"center",justifyContent:"center",paddingVertical:12},numbersText:{textAlign:"center"}});export{Carousel};export default Carousel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Carousel,default}from"./Carousel.js";
|
|
1
|
+
"use strict";export{Carousel,default}from"./Carousel.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{forwardRef
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import Svg,{Path}from"react-native-svg";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{ChoiceText,hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{fieldTextAsString,hasFieldText}from"../FieldBase/FieldBase.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sizeMap={sm:16,md:20,lg:24},toneColor=(e,r)=>{switch(r){case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;default:return e.colors.primary}},toneOnColor=(e,r)=>{switch(r){case"success":return e.colors.onSuccess;case"warning":return e.colors.onWarning;case"error":return e.colors.onError;default:return e.colors.onPrimary}},Checkbox=forwardRef((e,r)=>{const{checked:t,defaultChecked:s,onChange:o,indeterminate:i=!1,disabled:n=!1,label:a,description:l,error:c,help:d,labelLines:h,size:p="md",tone:m="primary",accessibilityLabel:u,haptic:x,style:b,boxStyle:f,indeterminateBarStyle:g,containerStyle:y,labelStyle:w,testID:C,...S}=e,[j,k]=useControllableState({value:t,defaultValue:s??!1,onChange:o}),T=useTheme(),v=useMemo(()=>buildStyles(T),[T]),R=T.components.checkbox?.[p]?.boxSize??sizeMap[p],_=T.colors.border.width,L=T.components.checkbox?.labelGap??10,V=toneColor(T,m),M=j||i,A=useRef(createAnimatedValue(M?1:0)).current;useEffect(()=>{const e=Animated.spring(A,{toValue:M?1:0,damping:T.motion.spring.snappy.damping,stiffness:T.motion.spring.snappy.stiffness,mass:T.motion.spring.snappy.mass,useNativeDriver:!0});return e.start(),()=>e.stop()},[M,A,T.motion.spring.snappy]);const D=A.interpolate({inputRange:[0,1],outputRange:[0,1]}),F=u??fieldTextAsString(a),I=n?T.colors.border.primary:M?V:hasFieldText(c)?T.colors.field.borderError:T.colors.border.primary,P=n?T.colors.surface.disabled:M?V:"transparent",H=n?T.colors.text.disabled:toneOnColor(T,m),B=Math.round(.72*R),W=Math.round(.55*R),z=Math.max(2,Math.round(.12*R)),E=_jsxs(Pressable,{ref:r,onPress:e=>{if(n)return;const r=resolveHaptic(x,"selection");r&&triggerHaptic(r),k(!j),S.onPressOut?.(e)},disabled:n,accessibilityRole:"checkbox",accessibilityLabel:F,accessibilityHint:S.accessibilityHint??fieldTextAsString(l),accessibilityState:{checked:i?"mixed":j,disabled:n},testID:C,hitSlop:6,...S,style:({pressed:e})=>[v.row,hasChoiceDetail(l,c)?v.rowTop:null,hasFieldText(d)?v.rowShrink:null,{opacity:n?.55:e?.85:1},y,b],children:[_jsx(View,{style:[v.box,{width:R,height:R,borderWidth:_,borderRadius:T.radius.xs,...smoothCorners,borderColor:I,backgroundColor:P},f],children:_jsx(Animated.View,{style:[v.glyphWrap,{opacity:A,transform:[{scale:D}]}],children:i?_jsx(View,{style:[{width:W,height:z,borderRadius:z/2,...smoothCorners,backgroundColor:H},g]}):_jsx(Svg,{width:B,height:B,viewBox:"0 0 24 24",children:_jsx(Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:H,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})})}),_jsx(ChoiceText,{label:a,description:l,error:c,disabled:n,labelLines:h||void 0,descriptionLines:h||void 0,style:{marginLeft:L},labelStyle:w})]});return hasFieldText(d)?_jsxs(View,{style:[v.helpRow,hasChoiceDetail(l,c)?v.rowTop:null],children:[E,_jsx(View,{style:[v.help,{marginLeft:T.spacing.xs}],children:d})]}):E});Checkbox.displayName="Checkbox";const buildStyles=e=>StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},rowTop:{alignItems:"flex-start"},rowShrink:{flexShrink:1},helpRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0},box:{alignItems:"center",justifyContent:"center"},glyphWrap:{alignItems:"center",justifyContent:"center"}});export{Checkbox};export default Checkbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Checkbox,default}from"./Checkbox.js";
|
|
1
|
+
"use strict";export{Checkbox,default}from"./Checkbox.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const toneFor=(e,r)=>{switch(r){case"primary":return{base:e.colors.primaryMuted,on:e.colors.primary,border:e.colors.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"success":return{base:e.colors.background.tertiary,on:e.colors.success,border:e.colors.success,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"warning":return{base:e.colors.background.tertiary,on:e.colors.warning,border:e.colors.warning,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"error":return{base:e.colors.background.tertiary,on:e.colors.error,border:e.colors.error,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"info":return{base:e.colors.background.tertiary,on:e.colors.info,border:e.colors.info,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,border:e.colors.border.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,sizeMap={sm:{paddingH:10,paddingV:4,fontSize:12,minHeight:26,closeSize:16,closeFont:12,gap:6,iconSize:14},md:{paddingH:12,paddingV:6,fontSize:13,minHeight:32,closeSize:18,closeFont:13,gap:8,iconSize:16}},Chip=forwardRef((e,r)=>{const{label:o,selected:s=!1,selectionMode:t="single",onPress:i,onClose:l,leftIcon:n,iconVariant:c,variant:a="filled",tone:d="neutral",size:p="md",disabled:m=!1,loading:g=!1,accessibilityLabel:b,haptic:u,style:y,textStyle:f,containerStyle:h,closeButtonStyle:S,closeIconStyle:z,testID:x}=e,C=useTheme(),j=!!i&&!m,{scale:H,pressIn:M,pressOut:k}=usePressAnimation({enabled:j}),w=useMemo(()=>toneFor(C,d),[C,d]),I=C.components.chip?.[p],_={paddingH:I?.paddingHorizontal??sizeMap[p].paddingH,paddingV:I?.paddingVertical??sizeMap[p].paddingV,fontSize:I?.fontSize??sizeMap[p].fontSize,minHeight:I?.minHeight??sizeMap[p].minHeight,closeSize:I?.closeSize??sizeMap[p].closeSize,closeFont:I?.closeFontSize??sizeMap[p].closeFont,gap:I?.gap??sizeMap[p].gap,iconSize:I?.iconSize??sizeMap[p].iconSize},F="filled"===a,O="soft"===a,B=(()=>{if(O){const e=s?w.selectedOn:w.on;return tintOf(e,s?.24:.14,s?w.selectedBg:w.base)}return s?F?w.selectedBg:"transparent":F?w.base:"transparent"})(),P=O?"transparent":s?w.selectedBorder:F?"transparent":w.border,V=m?C.colors.text.disabled:s?w.selectedOn:w.on,L=F||O?0:C.colors.border.width,handlePress=()=>{if(!j)return;const e=resolveHaptic(u,"selection");e&&triggerHaptic(e),i?.()},R=b??o,T=_jsxs(View,{style:styles.row,children:[n?_jsx(View,{style:{marginRight:_.gap},children:renderSlotIcon(n,{color:V,size:_.iconSize,disabled:m},c)}):null,_jsx(Text,{style:[styles.label,{color:V,fontSize:_.fontSize,...fontFor(C,"medium")},f],numberOfLines:1,children:o??" "}),l?_jsx(Pressable,{onPress:()=>{m||(!1!==u&&triggerHaptic("impactLight"),l?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:`Remove ${o}`,accessibilityState:{disabled:m},hitSlop:6,style:({pressed:e})=>[styles.close,{width:_.closeSize,height:_.closeSize,borderRadius:_.closeSize/2,...smoothCorners,marginLeft:_.gap,backgroundColor:e?C.colors.surface.pressed:C.colors.surface.hovered},S],children:_jsx(Text,{style:[{color:V,fontSize:_.closeFont,...fontFor(C,"bold"),lineHeight:_.closeFont+2},z],allowFontScaling:!1,children:"×"})}):null]}),A={paddingHorizontal:_.paddingH,paddingVertical:_.paddingV,minHeight:_.minHeight,borderRadius:C.radius.full,...smoothCorners,backgroundColor:B,borderWidth:L,borderColor:P,opacity:m?.55:1};let v;return v=j?_jsx(Animated.View,{style:{transform:[{scale:H}],alignSelf:"flex-start"},children:_jsx(Pressable,{ref:r,onPress:handlePress,onPressIn:M,onPressOut:k,disabled:!j,accessibilityRole:"multiple"===t?"checkbox":"button",accessibilityLabel:R,accessibilityState:"multiple"===t?{checked:s,disabled:m}:{selected:s,disabled:m},android_ripple:{color:C.colors.surface.pressed,borderless:!1},testID:x,style:({pressed:e})=>[styles.base,A,e&&"outlined"===a?{backgroundColor:C.colors.surface.pressed}:null,h,y],children:T})}):_jsx(View,{ref:r,style:[styles.base,A,h,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:R,accessibilityState:{selected:s,disabled:m},testID:x,children:T}),g?_jsx(ChipSkeleton,{...e}):v});Chip.displayName="Chip";const ChipSkeleton=({label:e,size:r="md",leftIcon:o,onClose:s,style:t,containerStyle:i})=>{const l=sizeMap[r],n=Math.max(40,Math.min(120,7*(e??"").length)),c=l.minHeight,a=c/2,d=n+2*l.paddingH+(void 0!==o?l.gap+14:0)+(void 0!==s?l.gap+l.closeSize:0);return _jsx(Skeleton,{width:d,height:c,radius:a,style:[{alignSelf:"flex-start"},i,t]})};ChipSkeleton.displayName="ChipSkeleton",Chip.Skeleton=ChipSkeleton;const styles=StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{textAlign:"center"},close:{alignItems:"center",justifyContent:"center"}});export{Chip};export default Chip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Chip,default}from"./Chip.js";
|
|
1
|
+
"use strict";export{Chip,default}from"./Chip.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useCallback,useMemo}from"react";import{Pressable,StyleSheet,Text,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{fontFor,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{RadioDot}from"../Radio/RadioDot.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const sizeTokens={sm:{paddingHorizontal:10,chipPaddingHorizontal:12,paddingVertical:6,fontSize:13,minHeight:32,iconSize:14},md:{paddingHorizontal:12,chipPaddingHorizontal:16,paddingVertical:8,fontSize:15,minHeight:40,iconSize:16},lg:{paddingHorizontal:16,chipPaddingHorizontal:20,paddingVertical:11,fontSize:16,minHeight:48,iconSize:18}},ChoiceGroup=forwardRef((e,i)=>{const{options:o,getOptionLabel:r,getOptionValue:t,getOptionDisabled:l,getOptionDescription:n,getOptionIcon:s,getOptionColor:a,renderOption:c,variant:d="card",indicatorPosition:p="trailing",direction:u="row",gap:m,wrap:g=!1,fullWidth:b,disabled:h=!1,size:f="md",haptic:x,accessibilityLabel:y,style:z,optionStyle:S,testID:C}=e,j=useTheme(),H=useMemo(()=>buildStyles(j),[j]),w=sizeTokens[f],V=useCallback(e=>r?r(e):e.label??"",[r]),k=useCallback(e=>t?t(e):e.value,[t]),_=useCallback(e=>l?l(e):!0===e.disabled,[l]),O=useCallback(e=>n?n(e):e.description,[n]),v=useCallback(e=>s?s(e):e.icon,[s]),D=useCallback(e=>a?a(e):e.color,[a]),R="multiple"===e.selectionMode,{min:T,max:L}=e,[P,F]=useControllableState({value:e.value,defaultValue:e.defaultValue??(R?[]:void 0),onChange:e.onChange}),G=Array.isArray(P)?P:[],I=useCallback(e=>{const i=k(e);if(R){const e=G.includes(i);if(e&&null!=T&&G.length<=T)return;if(!e&&null!=L&&G.length>=L)return;const o=resolveHaptic(x,"selection");return o&&triggerHaptic(o),void F(e?G.filter(e=>e!==i):[...G,i])}const o=resolveHaptic(x,"selection");o&&triggerHaptic(o),F(i)},[x,R,T,L,G,F,k]),W=b??("card"===d&&"row"===u&&!g),A=j.components.choiceGroup?.selectedFillOpacity??.12,M=j.components.choiceGroup?.borderRadius??j.radius.md,surfaceFor=(e,i,o)=>i?{borderColor:j.colors.border.primary,backgroundColor:j.colors.surface.disabled}:{borderColor:e?o:j.colors.border.primary,backgroundColor:e?tintOf(o,A,j.colors.surface.selected):j.colors.background.primary},renderIcon=(e,i,o,r)=>{const t=v(e);if(null==t)return null;return renderSlotIcon("string"==typeof t&&i?{name:t,variant:"bold"}:t,{color:o,size:w.iconSize,disabled:r})},renderChip=e=>{const{option:i,selected:o,disabled:r,color:t}=e,l=r?j.colors.text.disabled:o?t:j.colors.text.primary,n=renderIcon(i,o,l,r);return _jsxs(View,{style:[H.chip,{minHeight:w.minHeight,paddingHorizontal:w.chipPaddingHorizontal,paddingVertical:w.paddingVertical,borderRadius:j.radius.full,...smoothCorners,borderWidth:j.colors.border.width,...surfaceFor(o,r,t),columnGap:j.spacing.xs}],children:[n?_jsx(View,{children:n}):null,_jsx(Text,{style:[H.cardLabel,{color:l,fontSize:w.fontSize,...fontFor(j,"medium")}],numberOfLines:1,children:V(i)})]})},renderDefaultCard=e=>{const{option:i,selected:o,disabled:r,color:t}=e,l=D(i),n=r?j.colors.text.disabled:l??j.colors.text.primary,s=O(i),a=renderIcon(i,o,n,r),c=_jsx(RadioDot,{selected:o,color:t,disabled:r,size:f});return _jsxs(View,{style:[H.card,{minHeight:w.minHeight,paddingHorizontal:w.paddingHorizontal,paddingVertical:w.paddingVertical,borderRadius:M,...smoothCorners,borderWidth:j.colors.border.width,...surfaceFor(o,r,t),columnGap:j.spacing.sm}],children:["leading"===p?c:null,a?_jsx(View,{children:a}):null,_jsxs(View,{style:H.cardTextWrap,children:[_jsx(Text,{style:[H.cardLabel,{color:n,fontSize:w.fontSize,...fontFor(j,"medium")}],numberOfLines:1,children:V(i)}),s?_jsx(Text,{style:[H.cardDescription,{color:j.colors.text.tertiary,fontSize:j.typography.fontSize.xs}],numberOfLines:2,children:s}):null]}),"trailing"===p?c:null]})};return _jsx(View,{ref:i,accessibilityRole:R?void 0:"radiogroup",accessibilityLabel:y,accessibilityState:{disabled:h},testID:C,style:[{flexDirection:u,gap:m??j.spacing.sm,flexWrap:g?"wrap":"nowrap"},z],children:o.map((e,i)=>{const o=k(e),r=R?G.includes(o):P===o,t=R&&null!=L&&!r&&G.length>=L,l=h||t||_(e),n=D(e)??j.colors.primary;return _jsx(Pressable,{onPress:()=>{l||I(e)},disabled:l,accessibilityRole:R?"checkbox":"radio",accessibilityLabel:V(e),accessibilityState:{checked:r,disabled:l},style:[W?H.stretchOption:null,{opacity:l&&c?.55:1},S],children:({pressed:o})=>{const t={option:e,index:i,selected:r,pressed:o&&!l,disabled:l,color:n};return _jsx(_Fragment,{children:c?c(t):"chip"===d?renderChip(t):renderDefaultCard(t)})}},String(o))})})});ChoiceGroup.displayName="ChoiceGroup";const buildStyles=e=>StyleSheet.create({stretchOption:{flex:1},card:{flexDirection:"row",alignItems:"center"},chip:{flexDirection:"row",alignItems:"center",justifyContent:"center"},cardTextWrap:{flex:1},cardLabel:{includeFontPadding:!1},cardDescription:{includeFontPadding:!1,marginTop:2}});export{ChoiceGroup};export default ChoiceGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ChoiceGroup,default}from"./ChoiceGroup.js";
|
|
1
|
+
"use strict";export{ChoiceGroup,default}from"./ChoiceGroup.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useCallback,useEffect,useImperativeHandle,useMemo,useState}from"react";import{StyleSheet,useWindowDimensions,View}from"react-native";import Animated,{cancelAnimation,Easing,runOnJS,useAnimatedStyle,useSharedValue,withRepeat,withTiming}from"react-native-reanimated";import Svg,{Path,Polygon}from"react-native-svg";import{useReducedMotion}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";const TAU=2*Math.PI,DEG=Math.PI/180,SPEED_FACTOR={slow:1.6,normal:1,fast:.6};export const DEFAULT_PHYSICS={velocity:1,drag:1,fallSpeed:1,spread:0};const 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 r=e.physics.spread>0?e.physics.spread/2:100,t=(-90+rand(-r,r))*DEG,s=rand(1.8,4.2)*e.physics.velocity;return{...commonPiece(e,a),x0Frac:e.originXFrac,y0Frac:e.originYFrac,vxFrac:Math.cos(t)*s*.7,vyFrac:Math.sin(t)*s,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 r=Math.max(1,Math.round(e/4)),t=a.physics.spread>0?a.physics.spread/2:180,s=[];for(let i=0;i<4&&s.length<e;i+=1){const o=rand(.18,.82),n=rand(.18,.52),c=i/4*.5+rand(0,.06);for(let i=0;i<r&&s.length<e;i+=1){const e=rand(-t,t)*DEG,r=rand(1.4,3.4)*a.physics.velocity;s.push({...commonPiece(a,s.length),x0Frac:o,y0Frac:n,vxFrac:Math.cos(e)*r*.7,vyFrac:Math.sin(e)*r,drag:rand(6.5,8.5)*a.physics.drag,terminalFrac:rand(.18,.38)*a.physics.fallSpeed,delay:c,swayAmp:rand(3,12),swayFreq:rand(1,3)})}}return s};export const buildPieces=(e,a,r)=>{if("fireworks"===a)return buildFireworks(e,r);const t="rain"===a?rainPiece:popPiece;return Array.from({length:e},(e,a)=>t(r,a))};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?_jsx(Svg,{width:"100%",height:"100%",viewBox:"0 0 100 100",children:_jsx(Polygon,{points:"star"===e?STAR_POINTS:TRIANGLE_POINTS,fill:a})}):"streamer"===e?_jsx(Svg,{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:_jsx(Path,{d:STREAMER_PATH,stroke:a,strokeWidth:22,strokeLinecap:"round",fill:"none"})}):null,ConfettiPiece=({piece:e,progress:a,width:r,height:t,fadeOut:s})=>{const i=useAnimatedStyle(()=>{const i=1-e.delay,o=i<=0?0:Math.min(1,Math.max(0,(a.value-e.delay)/i)),n=(1-Math.exp(-e.drag*o))/e.drag,c=e.x0Frac*r+e.vxFrac*r*n,l=e.y0Frac*t+e.terminalFrac*t*o+(e.vyFrac-e.terminalFrac)*t*n,h=Math.sin(o*e.swayFreq*TAU)*e.swayAmp,d=e.rotateDir*e.rotations*360*o,p=.35+.65*Math.abs(Math.cos(o*e.flutterFreq*TAU));return{opacity:s?Math.max(0,1-Math.max(0,o-.75)/.25):1,transform:[{translateX:c+h},{translateY:l},{rotate:`${d}deg`},{scaleY:p}]}}),o=SHAPE_BOX[e.shape],n="triangle"===e.shape||"star"===e.shape||"streamer"===e.shape;return _jsx(Animated.View,{style:[{position:"absolute",width:e.size*o.w,height:e.size*o.h,borderRadius:"circle"===e.shape?e.size*o.h/2:1,backgroundColor:n?"transparent":e.color},i],children:_jsx(ShapeBody,{shape:e.shape,color:e.color})})},Confetti=forwardRef(({count:e=80,colors:a,preset:r="pop",shapes:t,speed:s="normal",physics:i,origin:o,duration:n=2800,fadeOut:c=!0,autoStart:l=!1,recycle:h=!1,size:d=10,onComplete:p,style:m,testID:u},y)=>{const g=useTheme(),S=useReducedMotion(),w=useWindowDimensions(),[f,F]=useState({width:w.width,height:w.height}),[x,P]=useState(!1),[A,v]=useState([]),E=useMemo(()=>a??[g.colors.primary,g.colors.secondary,g.colors.success,g.colors.warning,g.colors.error,g.colors.info],[a,g.colors]),M=useSharedValue(0),T=n*SPEED_FACTOR[s],R=useCallback(()=>{P(!1),p?.()},[p]),_=useCallback(()=>{if(S)return void p?.();cancelAnimation(M),M.value=0,v(buildPieces(e,r,{colors:E,baseSize:d,originXFrac:o?o.x/Math.max(1,f.width):.5,originYFrac:o?o.y/Math.max(1,f.height):.5,physics:{...DEFAULT_PHYSICS,...i},shapes:t??PRESET_SHAPES[r]})),P(!0);const a=withTiming(1,{duration:T,easing:Easing.linear},e=>{"worklet";e&&!h&&runOnJS(R)()});M.value=h?withRepeat(a,-1,!1):a},[S,M,T,h,R,p,e,E,r,t,i,d,o,f.width,f.height]),C=useCallback(()=>{cancelAnimation(M),P(!1)},[M]);useImperativeHandle(y,()=>({start:_,stop:C}),[_,C]),useEffect(()=>(l&&_(),()=>cancelAnimation(M)),[]);const k=useCallback(e=>{const{width:a,height:r}=e.nativeEvent.layout;a>0&&r>0&&F({width:a,height:r})},[]);return _jsx(View,{style:[StyleSheet.absoluteFill,m],pointerEvents:"none",onLayout:k,testID:u,children:x?A.map((e,a)=>_jsx(ConfettiPiece,{piece:e,progress:M,width:f.width,height:f.height,fadeOut:c},a)):null})});Confetti.displayName="Confetti";export{Confetti};export default Confetti;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Confetti}from"./Confetti.js";
|
|
1
|
+
"use strict";export{Confetti}from"./Confetti.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useCallback as t,useEffect as r,useMemo as a,useRef as o,useState as n}from"react";import{AccessibilityInfo as i,Animated as s,Easing as l,Modal as c,Pressable as d,StyleSheet as g,Text as y,View as u}from"react-native";import{GestureDetector as m,GestureHandlerRootView as p}from"react-native-gesture-handler";import{useSafeAreaInsets as h}from"react-native-safe-area-context";import{useDragToDismiss as f}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue as b,setNativeValue as v,useTheme as w}from"../../theme/index.js";import{resolveHaptic as x,triggerHaptic as D}from"../../utils/index.js";import{smoothCorners as C}from"../../utils/corners.js";import{defaultIcons as P}from"../AppIcon/defaultIcons.js";import{PickerTrigger as S}from"../PickerTrigger/index.js";import{ToastHost as k}from"../Toast/ToastProvider.js";import{jsx as R,jsxs as T,Fragment as I}from"react/jsx-runtime";const B=12,F=10,startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),decadeStartFor=e=>Math.floor(e/F)*F,DatePicker=e=>{const{value:C,onChange:z,onClose:L,minDate:V,maxDate:$,disabledDates:M,mode:W="modal",locale:Y="en-IN",weekStartsOn:j=0,title:N="Select Date",confirmLabel:A="Confirm",cancelLabel:q="Cancel",style:H,containerStyle:O,headerLabelStyle:G,navButtonStyle:E,footerButtonStyle:X,haptic:J,testID:K,label:Q,placeholder:U,helperText:Z,error:_,required:ee,disabled:te,size:re,variant:ae,clearable:oe,onClear:ne,formatValue:ie,triggerStyle:se}=e,le=void 0!==e.visible,[ce,de]=n(!1),ge=le?e.visible:ce,ye=le?K:K?`${K}-calendar`:void 0,ue=w(),me=h(),pe=a(()=>buildStyles(ue),[ue]),[he,fe]=n(()=>startOfDay(new Date));r(()=>{ge&&fe(startOfDay(new Date))},[ge]);const be=C?startOfDay(C):he,[ve,we]=n(be),[xe,De]=n(C?startOfDay(C):null),[Ce,Pe]=n("days"),Se=o(b(0)).current,ke=o(b(0)).current,Re=o(b(0)).current,Te=o(0),Ie=o(b(0)).current,Be=o(b(1)).current,Fe=o(b(1)).current,ze=o(b(1)).current,Le=o(b(1)).current,Ve=o(b(1)).current;r(()=>{if(C){const e=startOfDay(C);De(e),we(e)}else De(null)},[C]),r(()=>{if("modal"===W&&ge){Se.setValue(0),v(ke,0),v(Re,0);const e=s.parallel([s.timing(Se,{toValue:1,duration:ue.motion.duration.normal,easing:l.out(l.cubic),useNativeDriver:!1}),s.spring(ke,{toValue:1,damping:ue.motion.spring.gentle.damping,stiffness:ue.motion.spring.gentle.stiffness,mass:ue.motion.spring.gentle.mass,useNativeDriver:!0})]);return e.start(),()=>e.stop()}},[ge,W,Se,ke,Re,ue.motion]);const $e=a(()=>{const e=new Set;return M?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[M]),Me=a(()=>V?startOfDay(V):null,[V]),We=a(()=>$?startOfDay($):null,[$]),Ye=t(e=>!!(Me&&e.getTime()<Me.getTime())||(!!(We&&e.getTime()>We.getTime())||!!$e.has(toIso(e))),[Me,We,$e]),je=a(()=>((e,t)=>{const r=e.getFullYear(),a=e.getMonth(),o=(new Date(r,a,1).getDay()-t+7)%7,n=[];for(let e=0;e<42;e+=1){const t=new Date(r,a,1-o+e);n.push({date:t,inMonth:t.getMonth()===a,iso:toIso(t)})}return n})(ve,j),[ve,j]),Ne=a(()=>(e=>{const t=e-4;return Array.from({length:B},(e,r)=>t+r)})(ve.getFullYear()),[ve]),Ae=a(()=>(e=>{const t=decadeStartFor(e)-40;return Array.from({length:B},(e,r)=>t+r*F)})(ve.getFullYear()),[ve]),qe=a(()=>((e,t)=>{const r=new Intl.DateTimeFormat(e,{weekday:"short"}),a=[];for(let e=0;e<7;e+=1){const o=new Date(1970,0,4+(t+e)%7);a.push(r.format(o))}return a})(Y,j),[Y,j]),He=a(()=>{if("days"===Ce)return formatMonthYear(ve,Y);if("years"===Ce){return`${Ne[0]} - ${Ne[Ne.length-1]}`}return`${Ae[0]} - ${Ae[Ae.length-1]+9}`},[ve,Ae,Y,Ce,Ne]),Oe=t(e=>!!(Me&&e<Me.getFullYear())||!!(We&&e>We.getFullYear()),[Me,We]),Ge=t(e=>!!(Me&&e+F-1<Me.getFullYear())||!!(We&&e>We.getFullYear()),[Me,We]),Ee=t(e=>{!1!==J&&D("impactLight");const t=e>0?1:-1,r=ue.components.datePicker?.monthSlideDistance??32,a=ue.components.datePicker?.monthSlideOutDuration??ue.motion.duration.fast??140,o=ue.components.datePicker?.monthSlideInDuration??ue.motion.duration.fast??160;s.sequence([s.parallel([s.timing(Ie,{toValue:-t*r,duration:a,easing:l.out(l.quad),useNativeDriver:!0}),s.timing(Be,{toValue:0,duration:a,useNativeDriver:!0})]),s.timing(Ie,{toValue:t*r,duration:0,useNativeDriver:!0}),s.parallel([s.timing(Ie,{toValue:0,duration:o,easing:l.out(l.cubic),useNativeDriver:!0}),s.timing(Be,{toValue:1,duration:o,useNativeDriver:!0})])]).start();const n=((e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1))(ve,e);we(n),i.announceForAccessibility(formatMonthYear(n,Y))},[ve,J,Y,Be,Ie,ue.components.datePicker,ue.motion.duration.fast]),Xe=t(()=>{"days"!==Ce?(!1!==J&&D("impactLight"),we("years"===Ce?e=>new Date(e.getFullYear()-B,e.getMonth(),1):e=>new Date(e.getFullYear()-120,e.getMonth(),1))):Ee(-1)},[Ee,Ce,J]),Je=t(()=>{"days"!==Ce?(!1!==J&&D("impactLight"),we("years"===Ce?e=>new Date(e.getFullYear()+B,e.getMonth(),1):e=>new Date(e.getFullYear()+120,e.getMonth(),1))):Ee(1)},[Ee,Ce,J]),Ke=t(()=>{const e=ue.components.datePicker?.viewTransitionDuration??ue.motion.duration.normal??200;v(ze,0),v(Le,.9),s.parallel([s.timing(ze,{toValue:1,duration:e,easing:l.out(l.cubic),useNativeDriver:!0}),s.timing(Le,{toValue:1,duration:e,easing:l.out(l.cubic),useNativeDriver:!0})]).start()},[ze,Le,ue.components.datePicker,ue.motion.duration.normal]),Qe=t(()=>{const e=x(J,"selection");e&&D(e);const t=ue.components.datePicker?.headerPressDuration??80,r=ue.components.datePicker?.headerReleaseDuration??100;s.sequence([s.timing(Ve,{toValue:.96,duration:t,useNativeDriver:!0}),s.timing(Ve,{toValue:1,duration:r,useNativeDriver:!0})]).start(),Pe(e=>"days"===e?"years":"years"===e?"decades":"years"),Ke()},[Ke,Ve,J,ue.components.datePicker]),Ue=t(e=>{const t=x(J,"selection");t&&D(t),we(t=>new Date(e,t.getMonth(),1)),Pe("days"),Ke()},[Ke,J]),Ze=t(e=>{const t=x(J,"selection");t&&D(t),we(t=>new Date(e+4,t.getMonth(),1)),Pe("years"),Ke()},[Ke,J]),_e=t(e=>{if(Ye(e.date))return;const t=x(J,"selection");t&&D(t),De(e.date),e.inMonth||we(new Date(e.date.getFullYear(),e.date.getMonth(),1)),v(Fe,.7),s.spring(Fe,{toValue:1,damping:ue.motion.spring.bouncy.damping,stiffness:ue.motion.spring.bouncy.stiffness,mass:ue.motion.spring.bouncy.mass,useNativeDriver:!0}).start()},[Ye,Fe,ue.motion.spring.bouncy,J]),et=t(()=>{le||de(!1),L?.()},[le,L]),tt=t(()=>{"modal"===W?s.parallel([s.timing(Se,{toValue:0,duration:ue.motion.duration.fast,easing:l.bezier(...ue.motion.easing.accelerate),useNativeDriver:!1}),s.timing(ke,{toValue:0,duration:ue.motion.duration.fast,easing:l.bezier(...ue.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{et()}):et()},[Se,W,et,ke,ue.motion.duration.fast,ue.motion.easing.accelerate]),{handleGesture:rt}=f({drag:Re,travel:()=>Te.current||320,onDismiss:tt}),at=t(()=>{!1!==J&&D("selection"),tt()},[tt,J]),ot=t(()=>{xe&&(!1!==J&&D("notificationSuccess"),z?.(xe),tt())},[tt,z,xe,J]),nt=ke.interpolate({inputRange:[0,1],outputRange:[320,0]}),it=R(u,{style:pe.titleRow,children:R(y,{style:pe.title,accessibilityRole:"header",children:N})}),st=T(u,{style:[pe.card,H,O],accessibilityRole:"modal"===W?void 0:"none",accessible:!1,testID:ye,children:["modal"===W?R(m,{gesture:rt,children:T(u,{style:pe.grabArea,children:[R(u,{style:pe.handle}),it]})}):it,T(u,{style:pe.headerRow,children:[R(d,{onPress:Xe,style:({pressed:e})=>[pe.navBtn,e&&pe.navBtnPressed,E],accessibilityRole:"button",accessibilityLabel:"days"===Ce?"Previous month":"years"===Ce?"Previous years":"Previous decades",hitSlop:8,children:R(y,{style:pe.navText,children:"‹"})}),R(d,{onPress:Qe,style:[pe.headerLabelWrap,G],accessibilityRole:"button",accessibilityLabel:"days"===Ce?`${He}, switch to year selection`:"years"===Ce?`${He}, switch to decade selection`:`${He}, switch to year selection`,hitSlop:8,children:T(s.View,{style:[pe.headerLabelInner,{transform:[{scale:Ve}],opacity:"days"===Ce?Be:1}],children:[R(s.Text,{style:[pe.headerLabel,{transform:[{translateX:"days"===Ce?Ie:0}]}],accessibilityLiveRegion:"polite",children:He}),R(u,{style:pe.headerCaret,children:(ue.icons?.chevronDown??P.chevronDown)({size:ue.typography.fontSize.sm,color:ue.colors.text.secondary})})]})}),R(d,{onPress:Je,style:({pressed:e})=>[pe.navBtn,e&&pe.navBtnPressed,E],accessibilityRole:"button",accessibilityLabel:"days"===Ce?"Next month":"years"===Ce?"Next years":"Next decades",hitSlop:8,children:R(y,{style:pe.navText,children:"›"})})]}),"days"===Ce?T(I,{children:[R(u,{style:pe.weekdayRow,children:qe.map((e,t)=>R(u,{style:pe.weekdayCell,children:R(y,{style:pe.weekdayText,children:e})},`${e}-${t}`))}),R(s.View,{style:[pe.grid,{opacity:Be,transform:[{translateX:Ie}]}],children:Array.from({length:6}).map((e,t)=>R(u,{style:pe.gridRow,children:je.slice(7*t,7*t+7).map(e=>{const t=Ye(e.date),r=!!xe&&isSameDay(e.date,xe),a=isSameDay(e.date,he),o=r?ue.colors.primary:"transparent",n=a&&!r?ue.colors.primary:"transparent",i=r?ue.colors.onPrimary:e.inMonth?t?ue.colors.text.disabled:ue.colors.text.primary:ue.colors.text.tertiary,l=t?.3:e.inMonth?1:.4;return R(d,{disabled:t,onPress:()=>_e(e),accessibilityRole:"button",accessibilityLabel:formatLongDate(e.date,Y),accessibilityState:{selected:r,disabled:t},style:pe.dayCell,children:R(s.View,{style:[pe.dayInner,{backgroundColor:o,borderColor:n,borderWidth:a&&!r?1.5:0,opacity:l},r?{transform:[{scale:Fe}]}:null],children:R(y,{style:[pe.dayText,{color:i}],children:e.date.getDate()})})},e.iso)})},`r-${t}`))})]}):R(s.View,"years"===Ce?{style:[pe.yearGrid,{opacity:ze,transform:[{scale:Le}]}],children:Array.from({length:3}).map((e,t)=>R(u,{style:pe.gridRow,children:Ne.slice(4*t,4*t+4).map(e=>{const t=Oe(e),r=!!xe&&xe.getFullYear()===e,a=he.getFullYear()===e,o=r?ue.colors.primary:"transparent",n=a&&!r?ue.colors.primary:"transparent",i=r?ue.colors.onPrimary:t?ue.colors.text.disabled:ue.colors.text.primary,s=t?.3:1;return R(d,{disabled:t,onPress:()=>Ue(e),accessibilityRole:"button",accessibilityLabel:`Year ${e}`,accessibilityState:{selected:r,disabled:t},style:pe.yearCell,children:R(u,{style:[pe.yearInner,{backgroundColor:o,borderColor:n,borderWidth:a&&!r?1.5:0,opacity:s}],children:R(y,{style:[pe.yearText,{color:i}],children:e})})},`year-${e}`)})},`yr-${t}`))}:{style:[pe.yearGrid,{opacity:ze,transform:[{scale:Le}]}],children:Array.from({length:3}).map((e,t)=>R(u,{style:pe.gridRow,children:Ae.slice(4*t,4*t+4).map(e=>{const t=e+F-1,r=Ge(e),a=!!xe&&decadeStartFor(xe.getFullYear())===e,o=decadeStartFor(he.getFullYear())===e,n=a?ue.colors.primary:"transparent",i=o&&!a?ue.colors.primary:"transparent",s=a?ue.colors.onPrimary:r?ue.colors.text.disabled:ue.colors.text.primary,l=r?.3:1;return R(d,{disabled:r,onPress:()=>Ze(e),accessibilityRole:"button",accessibilityLabel:`Decade ${e} to ${t}`,accessibilityState:{selected:a,disabled:r},style:pe.yearCell,children:T(u,{style:[pe.yearInner,{backgroundColor:n,borderColor:i,borderWidth:o&&!a?1.5:0,opacity:l}],children:[R(y,{style:[pe.yearText,{color:s}],children:`${e}s`}),R(y,{style:[pe.decadeRangeText,{color:a?ue.colors.onPrimary:ue.colors.text.tertiary}],children:`${e}-${t}`})]})},`decade-${e}`)})},`dec-${t}`))}),T(u,{style:pe.footer,children:[R(d,{onPress:at,style:({pressed:e})=>[pe.footerBtn,pe.footerCancel,e&&pe.footerBtnPressed,X],accessibilityRole:"button",accessibilityLabel:q,children:R(y,{style:[pe.footerBtnText,{color:ue.colors.text.secondary}],children:q})}),R(d,{onPress:ot,disabled:!xe,style:({pressed:e})=>[pe.footerBtn,pe.footerConfirm,{backgroundColor:ue.colors.primary,opacity:xe?1:.5},e&&{backgroundColor:ue.colors.primaryHover},X],accessibilityRole:"button",accessibilityLabel:A,accessibilityState:{disabled:!xe},children:R(y,{style:[pe.footerBtnText,{color:ue.colors.onPrimary}],children:A})})]})]}),lt=C?(ie??(e=>e.toLocaleDateString()))(C):void 0,ct=!le;if("inline"===W)return ge||ct?ct?T(I,{children:[R(S,{label:Q,value:lt,placeholder:U,helperText:Z,error:_,required:ee,disabled:te,size:re,variant:ae,clearable:oe,onClear:ne,onPress:()=>de(!0),triggerStyle:se,testID:K}),ge?st:null]}):st:null;const dt=R(c,{visible:ge,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:tt,children:T(p,{collapsable:!1,style:[pe.backdrop,{backgroundColor:ue.colors.background.overlay}],children:[R(d,{style:g.absoluteFill,onPress:tt,accessibilityLabel:"Dismiss"}),R(s.View,{style:[pe.sheetWrap,{paddingBottom:Math.max(me.bottom,ue.spacing.lg),opacity:ke,transform:[{translateY:s.add(nt,Re)}]}],onLayout:e=>{Te.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:st}),R(k,{})]})});return ct?T(I,{children:[R(S,{label:Q,value:lt,placeholder:U,helperText:Z,error:_,required:ee,disabled:te,size:re,variant:ae,clearable:oe,onClear:ne,onPress:()=>de(!0),triggerStyle:se,testID:K}),dt]}):dt},buildStyles=e=>{const t=e.shadows.lg;return g.create({backdrop:{...g.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...C,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...C,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.datePicker?.navButtonSize??36,height:e.components.datePicker?.navButtonSize??36,borderRadius:e.radius.full,...C,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.datePicker?.navTextFontSize??22,lineHeight:e.components.datePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabelInner:{flexDirection:"row",alignItems:"center",justifyContent:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerCaret:{marginLeft:e.spacing.xs,alignItems:"center",justifyContent:"center"},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.dayCellPadding??2},dayInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.dayInnerBorderRadius??e.radius.full,...C,alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},yearGrid:{},yearCell:{flex:1,aspectRatio:1.6,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.yearCellPadding??4},yearInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.yearInnerBorderRadius??e.radius.lg,...C,alignItems:"center",justifyContent:"center"},yearText:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold},decadeRangeText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,marginTop:e.components.datePicker?.decadeRangeMarginTop??2},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...C,minHeight:e.components.datePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{DatePicker};export default DatePicker;
|
|
1
|
+
"use strict";import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import{AccessibilityInfo,Animated,Easing,Modal,Pressable,StyleSheet,Text,View}from"react-native";import{GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useDragToDismiss}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{PickerTrigger}from"../PickerTrigger/index.js";import{ToastHost}from"../Toast/ToastProvider.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const GRID_SIZE=12,DECADE_SPAN=10,startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,addMonths=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),buildMonthMatrix=(e,t)=>{const a=e.getFullYear(),r=e.getMonth(),i=(new Date(a,r,1).getDay()-t+7)%7,o=[];for(let e=0;e<42;e+=1){const t=new Date(a,r,1-i+e);o.push({date:t,inMonth:t.getMonth()===r,iso:toIso(t)})}return o},weekdayLabels=(e,t)=>{const a=new Intl.DateTimeFormat(e,{weekday:"short"}),r=[];for(let e=0;e<7;e+=1){const i=new Date(1970,0,4+(t+e)%7);r.push(a.format(i))}return r},formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),decadeStartFor=e=>10*Math.floor(e/10),buildYearCells=e=>{const t=e-4;return Array.from({length:12},(e,a)=>t+a)},buildDecadeCells=e=>{const t=decadeStartFor(e)-40;return Array.from({length:12},(e,a)=>t+10*a)},DatePicker=e=>{const{value:t,onChange:a,onClose:r,minDate:i,maxDate:o,disabledDates:s,mode:n="modal",locale:l="en-IN",weekStartsOn:c=0,title:d="Select Date",confirmLabel:u="Confirm",cancelLabel:g="Cancel",style:m,containerStyle:y,headerLabelStyle:p,navButtonStyle:h,footerButtonStyle:f,haptic:b,testID:x,label:D,placeholder:w,helperText:v,error:C,required:S,disabled:j,size:k,variant:P,clearable:T,onClear:V,formatValue:R,triggerStyle:_}=e,A=void 0!==e.visible,[I,M]=useState(!1),F=A?e.visible:I,L=A?x:x?`${x}-calendar`:void 0,B=useTheme(),Y=useSafeAreaInsets(),z=useMemo(()=>buildStyles(B),[B]),[H,N]=useState(()=>startOfDay(new Date));useEffect(()=>{F&&N(startOfDay(new Date))},[F]);const $=t?startOfDay(t):H,[W,E]=useState($),[O,G]=useState(t?startOfDay(t):null),[q,X]=useState("days"),Z=useRef(createAnimatedValue(0)).current,J=useRef(createAnimatedValue(0)).current,K=useRef(createAnimatedValue(0)).current,Q=useRef(0),U=useRef(createAnimatedValue(0)).current,ee=useRef(createAnimatedValue(1)).current,te=useRef(createAnimatedValue(1)).current,ae=useRef(createAnimatedValue(1)).current,re=useRef(createAnimatedValue(1)).current,ie=useRef(createAnimatedValue(1)).current;useEffect(()=>{if(t){const e=startOfDay(t);G(e),E(e)}else G(null)},[t]),useEffect(()=>{if("modal"===n&&F){Z.setValue(0),setNativeValue(J,0),setNativeValue(K,0);const e=Animated.parallel([Animated.timing(Z,{toValue:1,duration:B.motion.duration.normal,easing:Easing.out(Easing.cubic),useNativeDriver:!1}),Animated.spring(J,{toValue:1,damping:B.motion.spring.gentle.damping,stiffness:B.motion.spring.gentle.stiffness,mass:B.motion.spring.gentle.mass,useNativeDriver:!0})]);return e.start(),()=>e.stop()}},[F,n,Z,J,K,B.motion]);const oe=useMemo(()=>{const e=new Set;return s?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[s]),se=useMemo(()=>i?startOfDay(i):null,[i]),ne=useMemo(()=>o?startOfDay(o):null,[o]),le=useCallback(e=>!!(se&&e.getTime()<se.getTime())||(!!(ne&&e.getTime()>ne.getTime())||!!oe.has(toIso(e))),[se,ne,oe]),ce=useMemo(()=>buildMonthMatrix(W,c),[W,c]),de=useMemo(()=>buildYearCells(W.getFullYear()),[W]),ue=useMemo(()=>buildDecadeCells(W.getFullYear()),[W]),ge=useMemo(()=>weekdayLabels(l,c),[l,c]),me=useMemo(()=>{if("days"===q)return formatMonthYear(W,l);if("years"===q){return`${de[0]} - ${de[de.length-1]}`}return`${ue[0]} - ${ue[ue.length-1]+9}`},[W,ue,l,q,de]),ye=useCallback(e=>!!(se&&e<se.getFullYear())||!!(ne&&e>ne.getFullYear()),[se,ne]),pe=useCallback(e=>!!(se&&e+10-1<se.getFullYear())||!!(ne&&e>ne.getFullYear()),[se,ne]),he=useCallback(e=>{!1!==b&&triggerHaptic("impactLight");const t=e>0?1:-1,a=B.components.datePicker?.monthSlideDistance??32,r=B.components.datePicker?.monthSlideOutDuration??B.motion.duration.fast??140,i=B.components.datePicker?.monthSlideInDuration??B.motion.duration.fast??160;Animated.sequence([Animated.parallel([Animated.timing(U,{toValue:-t*a,duration:r,easing:Easing.out(Easing.quad),useNativeDriver:!0}),Animated.timing(ee,{toValue:0,duration:r,useNativeDriver:!0})]),Animated.timing(U,{toValue:t*a,duration:0,useNativeDriver:!0}),Animated.parallel([Animated.timing(U,{toValue:0,duration:i,easing:Easing.out(Easing.cubic),useNativeDriver:!0}),Animated.timing(ee,{toValue:1,duration:i,useNativeDriver:!0})])]).start();const o=addMonths(W,e);E(o),AccessibilityInfo.announceForAccessibility(formatMonthYear(o,l))},[W,b,l,ee,U,B.components.datePicker,B.motion.duration.fast]),fe=useCallback(()=>{"days"!==q?(!1!==b&&triggerHaptic("impactLight"),E("years"===q?e=>new Date(e.getFullYear()-12,e.getMonth(),1):e=>new Date(e.getFullYear()-120,e.getMonth(),1))):he(-1)},[he,q,b]),be=useCallback(()=>{"days"!==q?(!1!==b&&triggerHaptic("impactLight"),E("years"===q?e=>new Date(e.getFullYear()+12,e.getMonth(),1):e=>new Date(e.getFullYear()+120,e.getMonth(),1))):he(1)},[he,q,b]),xe=useCallback(()=>{const e=B.components.datePicker?.viewTransitionDuration??B.motion.duration.normal??200;setNativeValue(ae,0),setNativeValue(re,.9),Animated.parallel([Animated.timing(ae,{toValue:1,duration:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0}),Animated.timing(re,{toValue:1,duration:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0})]).start()},[ae,re,B.components.datePicker,B.motion.duration.normal]),De=useCallback(()=>{const e=resolveHaptic(b,"selection");e&&triggerHaptic(e);const t=B.components.datePicker?.headerPressDuration??80,a=B.components.datePicker?.headerReleaseDuration??100;Animated.sequence([Animated.timing(ie,{toValue:.96,duration:t,useNativeDriver:!0}),Animated.timing(ie,{toValue:1,duration:a,useNativeDriver:!0})]).start(),X(e=>"days"===e?"years":"years"===e?"decades":"years"),xe()},[xe,ie,b,B.components.datePicker]),we=useCallback(e=>{const t=resolveHaptic(b,"selection");t&&triggerHaptic(t),E(t=>new Date(e,t.getMonth(),1)),X("days"),xe()},[xe,b]),ve=useCallback(e=>{const t=resolveHaptic(b,"selection");t&&triggerHaptic(t),E(t=>new Date(e+4,t.getMonth(),1)),X("years"),xe()},[xe,b]),Ce=useCallback(e=>{if(le(e.date))return;const t=resolveHaptic(b,"selection");t&&triggerHaptic(t),G(e.date),e.inMonth||E(new Date(e.date.getFullYear(),e.date.getMonth(),1)),setNativeValue(te,.7),Animated.spring(te,{toValue:1,damping:B.motion.spring.bouncy.damping,stiffness:B.motion.spring.bouncy.stiffness,mass:B.motion.spring.bouncy.mass,useNativeDriver:!0}).start()},[le,te,B.motion.spring.bouncy,b]),Se=useCallback(()=>{A||M(!1),r?.()},[A,r]),je=useCallback(()=>{"modal"===n?Animated.parallel([Animated.timing(Z,{toValue:0,duration:B.motion.duration.fast,easing:Easing.bezier(...B.motion.easing.accelerate),useNativeDriver:!1}),Animated.timing(J,{toValue:0,duration:B.motion.duration.fast,easing:Easing.bezier(...B.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{Se()}):Se()},[Z,n,Se,J,B.motion.duration.fast,B.motion.easing.accelerate]),{handleGesture:ke}=useDragToDismiss({drag:K,travel:()=>Q.current||320,onDismiss:je}),Pe=useCallback(()=>{!1!==b&&triggerHaptic("selection"),je()},[je,b]),Te=useCallback(()=>{O&&(!1!==b&&triggerHaptic("notificationSuccess"),a?.(O),je())},[je,a,O,b]),Ve=J.interpolate({inputRange:[0,1],outputRange:[320,0]}),Re=_jsx(View,{style:z.titleRow,children:_jsx(Text,{style:z.title,accessibilityRole:"header",children:d})}),_e=_jsxs(View,{style:[z.card,m,y],accessibilityRole:"modal"===n?void 0:"none",accessible:!1,testID:L,children:["modal"===n?_jsx(GestureDetector,{gesture:ke,children:_jsxs(View,{style:z.grabArea,children:[_jsx(View,{style:z.handle}),Re]})}):Re,_jsxs(View,{style:z.headerRow,children:[_jsx(Pressable,{onPress:fe,style:({pressed:e})=>[z.navBtn,e&&z.navBtnPressed,h],accessibilityRole:"button",accessibilityLabel:"days"===q?"Previous month":"years"===q?"Previous years":"Previous decades",hitSlop:8,children:_jsx(Text,{style:z.navText,children:"‹"})}),_jsx(Pressable,{onPress:De,style:[z.headerLabelWrap,p],accessibilityRole:"button",accessibilityLabel:"days"===q?`${me}, switch to year selection`:"years"===q?`${me}, switch to decade selection`:`${me}, switch to year selection`,hitSlop:8,children:_jsxs(Animated.View,{style:[z.headerLabelInner,{transform:[{scale:ie}],opacity:"days"===q?ee:1}],children:[_jsx(Animated.Text,{style:[z.headerLabel,{transform:[{translateX:"days"===q?U:0}]}],accessibilityLiveRegion:"polite",children:me}),_jsx(View,{style:z.headerCaret,children:(B.icons?.chevronDown??defaultIcons.chevronDown)({size:B.typography.fontSize.sm,color:B.colors.text.secondary})})]})}),_jsx(Pressable,{onPress:be,style:({pressed:e})=>[z.navBtn,e&&z.navBtnPressed,h],accessibilityRole:"button",accessibilityLabel:"days"===q?"Next month":"years"===q?"Next years":"Next decades",hitSlop:8,children:_jsx(Text,{style:z.navText,children:"›"})})]}),"days"===q?_jsxs(_Fragment,{children:[_jsx(View,{style:z.weekdayRow,children:ge.map((e,t)=>_jsx(View,{style:z.weekdayCell,children:_jsx(Text,{style:z.weekdayText,children:e})},`${e}-${t}`))}),_jsx(Animated.View,{style:[z.grid,{opacity:ee,transform:[{translateX:U}]}],children:Array.from({length:6}).map((e,t)=>_jsx(View,{style:z.gridRow,children:ce.slice(7*t,7*t+7).map(e=>{const t=le(e.date),a=!!O&&isSameDay(e.date,O),r=isSameDay(e.date,H),i=a?B.colors.primary:"transparent",o=r&&!a?B.colors.primary:"transparent",s=a?B.colors.onPrimary:e.inMonth?t?B.colors.text.disabled:B.colors.text.primary:B.colors.text.tertiary,n=t?.3:e.inMonth?1:.4;return _jsx(Pressable,{disabled:t,onPress:()=>Ce(e),accessibilityRole:"button",accessibilityLabel:formatLongDate(e.date,l),accessibilityState:{selected:a,disabled:t},style:z.dayCell,children:_jsx(Animated.View,{style:[z.dayInner,{backgroundColor:i,borderColor:o,borderWidth:r&&!a?1.5:0,opacity:n},a?{transform:[{scale:te}]}:null],children:_jsx(Text,{style:[z.dayText,{color:s}],children:e.date.getDate()})})},e.iso)})},`r-${t}`))})]}):_jsx(Animated.View,"years"===q?{style:[z.yearGrid,{opacity:ae,transform:[{scale:re}]}],children:Array.from({length:3}).map((e,t)=>_jsx(View,{style:z.gridRow,children:de.slice(4*t,4*t+4).map(e=>{const t=ye(e),a=!!O&&O.getFullYear()===e,r=H.getFullYear()===e,i=a?B.colors.primary:"transparent",o=r&&!a?B.colors.primary:"transparent",s=a?B.colors.onPrimary:t?B.colors.text.disabled:B.colors.text.primary,n=t?.3:1;return _jsx(Pressable,{disabled:t,onPress:()=>we(e),accessibilityRole:"button",accessibilityLabel:`Year ${e}`,accessibilityState:{selected:a,disabled:t},style:z.yearCell,children:_jsx(View,{style:[z.yearInner,{backgroundColor:i,borderColor:o,borderWidth:r&&!a?1.5:0,opacity:n}],children:_jsx(Text,{style:[z.yearText,{color:s}],children:e})})},`year-${e}`)})},`yr-${t}`))}:{style:[z.yearGrid,{opacity:ae,transform:[{scale:re}]}],children:Array.from({length:3}).map((e,t)=>_jsx(View,{style:z.gridRow,children:ue.slice(4*t,4*t+4).map(e=>{const t=e+10-1,a=pe(e),r=!!O&&decadeStartFor(O.getFullYear())===e,i=decadeStartFor(H.getFullYear())===e,o=r?B.colors.primary:"transparent",s=i&&!r?B.colors.primary:"transparent",n=r?B.colors.onPrimary:a?B.colors.text.disabled:B.colors.text.primary,l=a?.3:1;return _jsx(Pressable,{disabled:a,onPress:()=>ve(e),accessibilityRole:"button",accessibilityLabel:`Decade ${e} to ${t}`,accessibilityState:{selected:r,disabled:a},style:z.yearCell,children:_jsxs(View,{style:[z.yearInner,{backgroundColor:o,borderColor:s,borderWidth:i&&!r?1.5:0,opacity:l}],children:[_jsx(Text,{style:[z.yearText,{color:n}],children:`${e}s`}),_jsx(Text,{style:[z.decadeRangeText,{color:r?B.colors.onPrimary:B.colors.text.tertiary}],children:`${e}-${t}`})]})},`decade-${e}`)})},`dec-${t}`))}),_jsxs(View,{style:z.footer,children:[_jsx(Pressable,{onPress:Pe,style:({pressed:e})=>[z.footerBtn,z.footerCancel,e&&z.footerBtnPressed,f],accessibilityRole:"button",accessibilityLabel:g,children:_jsx(Text,{style:[z.footerBtnText,{color:B.colors.text.secondary}],children:g})}),_jsx(Pressable,{onPress:Te,disabled:!O,style:({pressed:e})=>[z.footerBtn,z.footerConfirm,{backgroundColor:B.colors.primary,opacity:O?1:.5},e&&{backgroundColor:B.colors.primaryHover},f],accessibilityRole:"button",accessibilityLabel:u,accessibilityState:{disabled:!O},children:_jsx(Text,{style:[z.footerBtnText,{color:B.colors.onPrimary}],children:u})})]})]}),Ae=t?(R??(e=>e.toLocaleDateString()))(t):void 0,Ie=!A;if("inline"===n)return F||Ie?Ie?_jsxs(_Fragment,{children:[_jsx(PickerTrigger,{label:D,value:Ae,placeholder:w,helperText:v,error:C,required:S,disabled:j,size:k,variant:P,clearable:T,onClear:V,onPress:()=>M(!0),triggerStyle:_,testID:x}),F?_e:null]}):_e:null;const Me=_jsx(Modal,{visible:F,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:je,children:_jsxs(GestureHandlerRootView,{collapsable:!1,style:[z.backdrop,{backgroundColor:B.colors.background.overlay}],children:[_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:je,accessibilityLabel:"Dismiss"}),_jsx(Animated.View,{style:[z.sheetWrap,{paddingBottom:Math.max(Y.bottom,B.spacing.lg),opacity:J,transform:[{translateY:Animated.add(Ve,K)}]}],onLayout:e=>{Q.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:_e}),_jsx(ToastHost,{})]})});return Ie?_jsxs(_Fragment,{children:[_jsx(PickerTrigger,{label:D,value:Ae,placeholder:w,helperText:v,error:C,required:S,disabled:j,size:k,variant:P,clearable:T,onClear:V,onPress:()=>M(!0),triggerStyle:_,testID:x}),Me]}):Me},buildStyles=e=>{const t=e.shadows.lg;return StyleSheet.create({backdrop:{...StyleSheet.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...smoothCorners,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...smoothCorners,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.datePicker?.navButtonSize??36,height:e.components.datePicker?.navButtonSize??36,borderRadius:e.radius.full,...smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.datePicker?.navTextFontSize??22,lineHeight:e.components.datePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabelInner:{flexDirection:"row",alignItems:"center",justifyContent:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerCaret:{marginLeft:e.spacing.xs,alignItems:"center",justifyContent:"center"},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.dayCellPadding??2},dayInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.dayInnerBorderRadius??e.radius.full,...smoothCorners,alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},yearGrid:{},yearCell:{flex:1,aspectRatio:1.6,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.yearCellPadding??4},yearInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.yearInnerBorderRadius??e.radius.lg,...smoothCorners,alignItems:"center",justifyContent:"center"},yearText:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold},decadeRangeText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,marginTop:e.components.datePicker?.decadeRangeMarginTop??2},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...smoothCorners,minHeight:e.components.datePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{DatePicker};export default DatePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DatePicker,default}from"./DatePicker.js";
|
|
1
|
+
"use strict";export{DatePicker,default}from"./DatePicker.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{forwardRef as e,useCallback as t,useEffect as o,useMemo as n,useRef as r,useState as a}from"react";import{AccessibilityInfo as i,Animated as s,Easing as l,Modal as c,Pressable as d,StyleSheet as g,Text as u,View as m}from"react-native";import{GestureDetector as p,GestureHandlerRootView as h}from"react-native-gesture-handler";import{useSafeAreaInsets as y}from"react-native-safe-area-context";import{useDragToDismiss as f}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue as b,setNativeValue as v,useTheme as w}from"../../theme/index.js";import{resolveHaptic as x,triggerHaptic as D}from"../../utils/index.js";import{smoothCorners as R}from"../../utils/corners.js";import{PickerTrigger as S}from"../PickerTrigger/index.js";import{ToastHost as T}from"../Toast/ToastProvider.js";import{jsx as k,jsxs as C,Fragment as B}from"react/jsx-runtime";const startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatRangePart=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"short",day:"numeric",month:"short"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),P=e((e,P)=>{const{visible:z,value:L,onChange:I,onClose:W,label:M,placeholder:V,helperText:F,error:j,required:$,disabled:N,size:Y,variant:H,clearable:O,onClear:q,formatValue:A,triggerStyle:E,minDate:X,maxDate:G,disabledDates:J,locale:K="en-IN",weekStartsOn:Q=0,title:U="Select Date Range",confirmLabel:Z="Confirm",cancelLabel:_="Cancel",maxRange:ee,haptic:te,style:oe,containerStyle:ne,headerLabelStyle:re,navButtonStyle:ae,footerButtonStyle:ie,testID:se}=e,le=void 0!==z,[ce,de]=a(!1),ge=le?z:ce,ue=le?se:se?`${se}-calendar`:void 0,me=w(),pe=y(),he=n(()=>buildStyles(me),[me]),[ye,fe]=a(()=>startOfDay(new Date));o(()=>{ge&&fe(startOfDay(new Date))},[ge]);const be=L.start?startOfDay(L.start):ye,[ve,we]=a(be),[xe,De]=a(L.start?startOfDay(L.start):null),[Re,Se]=a(L.end?startOfDay(L.end):null),Te=r(b(0)).current,ke=r(b(0)).current,Ce=r(b(0)).current,Be=r(0),Pe=r(b(0)).current,ze=r(b(1)).current;o(()=>{if(L.start){const e=startOfDay(L.start);De(e),we(e)}else De(null);L.end?Se(startOfDay(L.end)):Se(null)},[L.start,L.end]),o(()=>{let e;return ge&&(Te.setValue(0),v(ke,0),v(Ce,0),e=s.parallel([s.timing(Te,{toValue:1,duration:me.motion.duration.normal,easing:l.out(l.cubic),useNativeDriver:!1}),s.spring(ke,{toValue:1,damping:me.motion.spring.gentle.damping,stiffness:me.motion.spring.gentle.stiffness,mass:me.motion.spring.gentle.mass,useNativeDriver:!0})]),e.start()),()=>e?.stop()},[ge,Te,ke,Ce,me.motion]);const Le=n(()=>{const e=new Set;return J?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[J]),Ie=n(()=>X?startOfDay(X):null,[X]),We=n(()=>G?startOfDay(G):null,[G]),Me=t(e=>!!(Ie&&e.getTime()<Ie.getTime())||(!!(We&&e.getTime()>We.getTime())||!!Le.has(toIso(e))),[Ie,We,Le]),Ve=n(()=>((e,t)=>{const o=e.getFullYear(),n=e.getMonth(),r=(new Date(o,n,1).getDay()-t+7)%7,a=[];for(let e=0;e<42;e+=1){const t=new Date(o,n,1-r+e);a.push({date:t,inMonth:t.getMonth()===n,iso:toIso(t)})}return a})(ve,Q),[ve,Q]),Fe=n(()=>formatMonthYear(ve,K),[ve,K]),je=n(()=>((e,t)=>{const o=new Intl.DateTimeFormat(e,{weekday:"short"}),n=[];for(let e=0;e<7;e+=1){const r=new Date(1970,0,4+(t+e)%7);n.push(o.format(r))}return n})(K,Q),[K,Q]),$e=t(e=>{!1!==te&&D("impactLight");const t=e>0?1:-1,o=me.components.dateRangePicker?.monthSlideDistance??32,n=me.components.dateRangePicker?.monthSlideOutDuration??me.motion.duration.fast??140,r=me.components.dateRangePicker?.monthSlideInDuration??me.motion.duration.fast??160;s.sequence([s.parallel([s.timing(Pe,{toValue:-t*o,duration:n,easing:l.out(l.quad),useNativeDriver:!0}),s.timing(ze,{toValue:0,duration:n,useNativeDriver:!0})]),s.timing(Pe,{toValue:t*o,duration:0,useNativeDriver:!0}),s.parallel([s.timing(Pe,{toValue:0,duration:r,easing:l.out(l.cubic),useNativeDriver:!0}),s.timing(ze,{toValue:1,duration:r,useNativeDriver:!0})])]).start();const a=((e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1))(ve,e);we(a),i.announceForAccessibility(formatMonthYear(a,K))},[ve,te,K,ze,Pe,me.components.dateRangePicker,me.motion.duration.fast]),Ne=t(()=>$e(-1),[$e]),Ye=t(()=>$e(1),[$e]),He=t(e=>{if(Me(e.date))return;const t=x(te,"selection");t&&D(t);const o=e.date;if(!xe||xe&&Re)De(o),Se(null);else if(o.getTime()<xe.getTime())De(o),Se(null);else if(isSameDay(o,xe))Se(o);else{if(ee&&((e,t)=>{const o=startOfDay(t).getTime()-startOfDay(e).getTime();return Math.round(o/864e5)})(xe,o)+1>ee)return!1!==te&&D("notificationWarning"),De(o),void Se(null);Se(o)}e.inMonth||we(new Date(e.date.getFullYear(),e.date.getMonth(),1))},[Me,xe,Re,ee,te]),Oe=t(()=>{le?W?.():de(!1)},[le,W]),qe=t(()=>{s.parallel([s.timing(Te,{toValue:0,duration:me.motion.duration.fast,easing:l.bezier(...me.motion.easing.accelerate),useNativeDriver:!1}),s.timing(ke,{toValue:0,duration:me.motion.duration.fast,easing:l.bezier(...me.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{Oe()})},[Te,Oe,ke,me.motion.duration.fast,me.motion.easing.accelerate]),{handleGesture:Ae}=f({drag:Ce,travel:()=>Be.current||320,onDismiss:qe}),Ee=t(()=>{!1!==te&&D("selection"),qe()},[qe,te]),Xe=t(()=>{xe&&Re&&(!1!==te&&D("notificationSuccess"),I?.({start:xe,end:Re}),qe())},[qe,I,xe,Re,te]),Ge=ke.interpolate({inputRange:[0,1],outputRange:[320,0]}),Je=n(()=>xe&&Re?`${formatRangePart(xe,K)} — ${formatRangePart(Re,K)}`:xe?`${formatRangePart(xe,K)} — …`:"—",[xe,Re,K]),Ke=t(e=>{if(!xe||!Re)return!1;const t=startOfDay(e).getTime();return t>=xe.getTime()&&t<=Re.getTime()},[xe,Re]),Qe=!xe||!Re,Ue=C(m,{style:[he.card,oe,ne],ref:P,accessible:!1,testID:ue,children:[k(p,{gesture:Ae,children:C(m,{style:he.grabArea,children:[k(m,{style:he.handle}),C(m,{style:he.titleRow,children:[k(u,{style:he.title,accessibilityRole:"header",children:U}),k(u,{style:he.subtitle,accessibilityLiveRegion:"polite",children:Je})]})]})}),C(m,{style:he.headerRow,children:[k(d,{onPress:Ne,style:({pressed:e})=>[he.navBtn,e&&he.navBtnPressed,ae],accessibilityRole:"button",accessibilityLabel:"Previous month",hitSlop:8,children:k(u,{style:he.navText,children:"‹"})}),k(s.View,{style:[he.headerLabelWrap,{opacity:ze,transform:[{translateX:Pe}]},re],children:k(u,{style:he.headerLabel,accessibilityLiveRegion:"polite",children:Fe})}),k(d,{onPress:Ye,style:({pressed:e})=>[he.navBtn,e&&he.navBtnPressed,ae],accessibilityRole:"button",accessibilityLabel:"Next month",hitSlop:8,children:k(u,{style:he.navText,children:"›"})})]}),k(m,{style:he.weekdayRow,children:je.map((e,t)=>k(m,{style:he.weekdayCell,children:k(u,{style:he.weekdayText,children:e})},`${e}-${t}`))}),k(s.View,{style:[he.grid,{opacity:ze,transform:[{translateX:Pe}]}],children:Array.from({length:6}).map((e,t)=>k(m,{style:he.gridRow,children:Ve.slice(7*t,7*t+7).map(e=>{const t=Me(e.date),o=!!xe&&isSameDay(e.date,xe),n=!!Re&&isSameDay(e.date,Re),r=Ke(e.date),a=r&&!o&&!n,i=isSameDay(e.date,ye),s=me.colors.primary,l=me.colors.primaryMuted,c=o||n?me.colors.onPrimary:e.inMonth?t?me.colors.text.disabled:me.colors.text.primary:me.colors.text.tertiary,g=t?.3:e.inMonth?1:.4,p=r&&!!xe&&!!Re&&(n||a),h=r&&!!xe&&!!Re&&(o||a),y=o?", start of range":n?", end of range":a?", in selected range":"";return C(d,{disabled:t,onPress:()=>He(e),accessibilityRole:"button",accessibilityLabel:`${formatLongDate(e.date,K)}${y}`,accessibilityState:{selected:o||n,disabled:t,busy:a},style:he.dayCell,children:[p?k(m,{style:[he.barLeft,{backgroundColor:l}],pointerEvents:"none"}):null,h?k(m,{style:[he.barRight,{backgroundColor:l}],pointerEvents:"none"}):null,k(m,{style:[he.dayInner,{backgroundColor:o||n?s:a?l:"transparent",borderColor:!i||o||n?"transparent":s,borderWidth:!i||o||n?0:1.5,borderRadius:a?me.radius.none:me.radius.full,...R,opacity:g}],children:k(u,{style:[he.dayText,{color:c}],children:e.date.getDate()})})]},e.iso)})},`r-${t}`))}),C(m,{style:he.footer,children:[k(d,{onPress:Ee,style:({pressed:e})=>[he.footerBtn,he.footerCancel,e&&he.footerBtnPressed,ie],accessibilityRole:"button",accessibilityLabel:_,children:k(u,{style:[he.footerBtnText,{color:me.colors.text.secondary}],children:_})}),k(d,{onPress:Xe,disabled:Qe,style:({pressed:e})=>[he.footerBtn,he.footerConfirm,{backgroundColor:me.colors.primary,opacity:Qe?.5:1},e&&{backgroundColor:me.colors.primaryHover},ie],accessibilityRole:"button",accessibilityLabel:Z,accessibilityState:{disabled:Qe},children:k(u,{style:[he.footerBtnText,{color:me.colors.onPrimary}],children:Z})})]})]}),Ze=n(()=>{if(!L.start||!L.end)return"";const e={start:L.start,end:L.end};return A?A(e):`${e.start.toLocaleDateString()} – ${e.end.toLocaleDateString()}`},[L.start,L.end,A]);return C(B,{children:[le?null:k(S,{label:M,placeholder:V,helperText:F,error:j,required:$,disabled:N,size:Y,variant:H,clearable:O,onClear:q,value:Ze,onPress:()=>de(!0),triggerStyle:E,testID:se}),k(c,{visible:ge,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:qe,children:C(h,{collapsable:!1,style:[he.backdrop,{backgroundColor:me.colors.background.overlay}],children:[k(d,{style:g.absoluteFill,onPress:qe,accessibilityLabel:"Dismiss"}),k(s.View,{style:[he.sheetWrap,{paddingBottom:Math.max(pe.bottom,me.spacing.lg),opacity:ke,transform:[{translateY:s.add(Ge,Ce)}]}],onLayout:e=>{Be.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:Ue}),k(T,{})]})})]})});P.displayName="DateRangePicker";const buildStyles=e=>{const t=e.shadows.lg;return g.create({backdrop:{...g.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...R,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...R,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},subtitle:{marginTop:e.spacing.xxs,fontSize:e.typography.fontSize.sm,color:e.colors.text.secondary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.dateRangePicker?.navButtonSize??36,height:e.components.dateRangePicker?.navButtonSize??36,borderRadius:e.radius.full,...R,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.dateRangePicker?.navTextFontSize??22,lineHeight:e.components.dateRangePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:0,position:"relative"},barLeft:{position:"absolute",left:0,right:"50%",top:"5%",bottom:"5%"},barRight:{position:"absolute",left:"50%",right:0,top:"5%",bottom:"5%"},dayInner:{width:"90%",height:"90%",alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...R,minHeight:e.components.dateRangePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{P as DateRangePicker};export default P;
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{AccessibilityInfo,Animated,Easing,Modal,Pressable,StyleSheet,Text,View}from"react-native";import{GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useDragToDismiss}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{PickerTrigger}from"../PickerTrigger/index.js";import{ToastHost}from"../Toast/ToastProvider.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const DAY_MS=864e5,startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,addMonths=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),daysBetween=(e,t)=>{const a=startOfDay(t).getTime()-startOfDay(e).getTime();return Math.round(a/DAY_MS)},buildMonthMatrix=(e,t)=>{const a=e.getFullYear(),r=e.getMonth(),o=(new Date(a,r,1).getDay()-t+7)%7,i=[];for(let e=0;e<42;e+=1){const t=new Date(a,r,1-o+e);i.push({date:t,inMonth:t.getMonth()===r,iso:toIso(t)})}return i},weekdayLabels=(e,t)=>{const a=new Intl.DateTimeFormat(e,{weekday:"short"}),r=[];for(let e=0;e<7;e+=1){const o=new Date(1970,0,4+(t+e)%7);r.push(a.format(o))}return r},formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatRangePart=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"short",day:"numeric",month:"short"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),DateRangePicker=forwardRef((e,t)=>{const{visible:a,value:r,onChange:o,onClose:i,label:n,placeholder:s,helperText:l,error:c,required:d,disabled:g,size:u,variant:m,clearable:y,onClear:f,formatValue:p,triggerStyle:h,minDate:b,maxDate:x,disabledDates:D,locale:w="en-IN",weekStartsOn:S=0,title:v="Select Date Range",confirmLabel:R="Confirm",cancelLabel:T="Cancel",maxRange:k,haptic:j,style:C,containerStyle:P,headerLabelStyle:_,navButtonStyle:V,footerButtonStyle:M,testID:A}=e,B=void 0!==a,[I,L]=useState(!1),z=B?a:I,O=B?A:A?`${A}-calendar`:void 0,H=useTheme(),F=useSafeAreaInsets(),W=useMemo(()=>buildStyles(H),[H]),[E,N]=useState(()=>startOfDay(new Date));useEffect(()=>{z&&N(startOfDay(new Date))},[z]);const $=r.start?startOfDay(r.start):E,[Y,q]=useState($),[G,X]=useState(r.start?startOfDay(r.start):null),[J,K]=useState(r.end?startOfDay(r.end):null),Q=useRef(createAnimatedValue(0)).current,U=useRef(createAnimatedValue(0)).current,Z=useRef(createAnimatedValue(0)).current,ee=useRef(0),te=useRef(createAnimatedValue(0)).current,ae=useRef(createAnimatedValue(1)).current;useEffect(()=>{if(r.start){const e=startOfDay(r.start);X(e),q(e)}else X(null);r.end?K(startOfDay(r.end)):K(null)},[r.start,r.end]),useEffect(()=>{let e;return z&&(Q.setValue(0),setNativeValue(U,0),setNativeValue(Z,0),e=Animated.parallel([Animated.timing(Q,{toValue:1,duration:H.motion.duration.normal,easing:Easing.out(Easing.cubic),useNativeDriver:!1}),Animated.spring(U,{toValue:1,damping:H.motion.spring.gentle.damping,stiffness:H.motion.spring.gentle.stiffness,mass:H.motion.spring.gentle.mass,useNativeDriver:!0})]),e.start()),()=>e?.stop()},[z,Q,U,Z,H.motion]);const re=useMemo(()=>{const e=new Set;return D?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[D]),oe=useMemo(()=>b?startOfDay(b):null,[b]),ie=useMemo(()=>x?startOfDay(x):null,[x]),ne=useCallback(e=>!!(oe&&e.getTime()<oe.getTime())||(!!(ie&&e.getTime()>ie.getTime())||!!re.has(toIso(e))),[oe,ie,re]),se=useMemo(()=>buildMonthMatrix(Y,S),[Y,S]),le=useMemo(()=>formatMonthYear(Y,w),[Y,w]),ce=useMemo(()=>weekdayLabels(w,S),[w,S]),de=useCallback(e=>{!1!==j&&triggerHaptic("impactLight");const t=e>0?1:-1,a=H.components.dateRangePicker?.monthSlideDistance??32,r=H.components.dateRangePicker?.monthSlideOutDuration??H.motion.duration.fast??140,o=H.components.dateRangePicker?.monthSlideInDuration??H.motion.duration.fast??160;Animated.sequence([Animated.parallel([Animated.timing(te,{toValue:-t*a,duration:r,easing:Easing.out(Easing.quad),useNativeDriver:!0}),Animated.timing(ae,{toValue:0,duration:r,useNativeDriver:!0})]),Animated.timing(te,{toValue:t*a,duration:0,useNativeDriver:!0}),Animated.parallel([Animated.timing(te,{toValue:0,duration:o,easing:Easing.out(Easing.cubic),useNativeDriver:!0}),Animated.timing(ae,{toValue:1,duration:o,useNativeDriver:!0})])]).start();const i=addMonths(Y,e);q(i),AccessibilityInfo.announceForAccessibility(formatMonthYear(i,w))},[Y,j,w,ae,te,H.components.dateRangePicker,H.motion.duration.fast]),ge=useCallback(()=>de(-1),[de]),ue=useCallback(()=>de(1),[de]),me=useCallback(e=>{if(ne(e.date))return;const t=resolveHaptic(j,"selection");t&&triggerHaptic(t);const a=e.date;if(!G||G&&J)X(a),K(null);else if(a.getTime()<G.getTime())X(a),K(null);else if(isSameDay(a,G))K(a);else{if(k&&daysBetween(G,a)+1>k)return!1!==j&&triggerHaptic("notificationWarning"),X(a),void K(null);K(a)}e.inMonth||q(new Date(e.date.getFullYear(),e.date.getMonth(),1))},[ne,G,J,k,j]),ye=useCallback(()=>{B?i?.():L(!1)},[B,i]),fe=useCallback(()=>{Animated.parallel([Animated.timing(Q,{toValue:0,duration:H.motion.duration.fast,easing:Easing.bezier(...H.motion.easing.accelerate),useNativeDriver:!1}),Animated.timing(U,{toValue:0,duration:H.motion.duration.fast,easing:Easing.bezier(...H.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{ye()})},[Q,ye,U,H.motion.duration.fast,H.motion.easing.accelerate]),{handleGesture:pe}=useDragToDismiss({drag:Z,travel:()=>ee.current||320,onDismiss:fe}),he=useCallback(()=>{!1!==j&&triggerHaptic("selection"),fe()},[fe,j]),be=useCallback(()=>{G&&J&&(!1!==j&&triggerHaptic("notificationSuccess"),o?.({start:G,end:J}),fe())},[fe,o,G,J,j]),xe=U.interpolate({inputRange:[0,1],outputRange:[320,0]}),De=useMemo(()=>G&&J?`${formatRangePart(G,w)} — ${formatRangePart(J,w)}`:G?`${formatRangePart(G,w)} — …`:"—",[G,J,w]),we=useCallback(e=>{if(!G||!J)return!1;const t=startOfDay(e).getTime();return t>=G.getTime()&&t<=J.getTime()},[G,J]),Se=!G||!J,ve=_jsxs(View,{style:[W.card,C,P],ref:t,accessible:!1,testID:O,children:[_jsx(GestureDetector,{gesture:pe,children:_jsxs(View,{style:W.grabArea,children:[_jsx(View,{style:W.handle}),_jsxs(View,{style:W.titleRow,children:[_jsx(Text,{style:W.title,accessibilityRole:"header",children:v}),_jsx(Text,{style:W.subtitle,accessibilityLiveRegion:"polite",children:De})]})]})}),_jsxs(View,{style:W.headerRow,children:[_jsx(Pressable,{onPress:ge,style:({pressed:e})=>[W.navBtn,e&&W.navBtnPressed,V],accessibilityRole:"button",accessibilityLabel:"Previous month",hitSlop:8,children:_jsx(Text,{style:W.navText,children:"‹"})}),_jsx(Animated.View,{style:[W.headerLabelWrap,{opacity:ae,transform:[{translateX:te}]},_],children:_jsx(Text,{style:W.headerLabel,accessibilityLiveRegion:"polite",children:le})}),_jsx(Pressable,{onPress:ue,style:({pressed:e})=>[W.navBtn,e&&W.navBtnPressed,V],accessibilityRole:"button",accessibilityLabel:"Next month",hitSlop:8,children:_jsx(Text,{style:W.navText,children:"›"})})]}),_jsx(View,{style:W.weekdayRow,children:ce.map((e,t)=>_jsx(View,{style:W.weekdayCell,children:_jsx(Text,{style:W.weekdayText,children:e})},`${e}-${t}`))}),_jsx(Animated.View,{style:[W.grid,{opacity:ae,transform:[{translateX:te}]}],children:Array.from({length:6}).map((e,t)=>_jsx(View,{style:W.gridRow,children:se.slice(7*t,7*t+7).map(e=>{const t=ne(e.date),a=!!G&&isSameDay(e.date,G),r=!!J&&isSameDay(e.date,J),o=we(e.date),i=o&&!a&&!r,n=isSameDay(e.date,E),s=H.colors.primary,l=H.colors.primaryMuted,c=a||r?H.colors.onPrimary:e.inMonth?t?H.colors.text.disabled:H.colors.text.primary:H.colors.text.tertiary,d=t?.3:e.inMonth?1:.4,g=o&&!!G&&!!J&&(r||i),u=o&&!!G&&!!J&&(a||i),m=a?", start of range":r?", end of range":i?", in selected range":"";return _jsxs(Pressable,{disabled:t,onPress:()=>me(e),accessibilityRole:"button",accessibilityLabel:`${formatLongDate(e.date,w)}${m}`,accessibilityState:{selected:a||r,disabled:t,busy:i},style:W.dayCell,children:[g?_jsx(View,{style:[W.barLeft,{backgroundColor:l}],pointerEvents:"none"}):null,u?_jsx(View,{style:[W.barRight,{backgroundColor:l}],pointerEvents:"none"}):null,_jsx(View,{style:[W.dayInner,{backgroundColor:a||r?s:i?l:"transparent",borderColor:!n||a||r?"transparent":s,borderWidth:!n||a||r?0:1.5,borderRadius:i?H.radius.none:H.radius.full,...smoothCorners,opacity:d}],children:_jsx(Text,{style:[W.dayText,{color:c}],children:e.date.getDate()})})]},e.iso)})},`r-${t}`))}),_jsxs(View,{style:W.footer,children:[_jsx(Pressable,{onPress:he,style:({pressed:e})=>[W.footerBtn,W.footerCancel,e&&W.footerBtnPressed,M],accessibilityRole:"button",accessibilityLabel:T,children:_jsx(Text,{style:[W.footerBtnText,{color:H.colors.text.secondary}],children:T})}),_jsx(Pressable,{onPress:be,disabled:Se,style:({pressed:e})=>[W.footerBtn,W.footerConfirm,{backgroundColor:H.colors.primary,opacity:Se?.5:1},e&&{backgroundColor:H.colors.primaryHover},M],accessibilityRole:"button",accessibilityLabel:R,accessibilityState:{disabled:Se},children:_jsx(Text,{style:[W.footerBtnText,{color:H.colors.onPrimary}],children:R})})]})]}),Re=useMemo(()=>{if(!r.start||!r.end)return"";const e={start:r.start,end:r.end};return p?p(e):`${e.start.toLocaleDateString()} – ${e.end.toLocaleDateString()}`},[r.start,r.end,p]);return _jsxs(_Fragment,{children:[B?null:_jsx(PickerTrigger,{label:n,placeholder:s,helperText:l,error:c,required:d,disabled:g,size:u,variant:m,clearable:y,onClear:f,value:Re,onPress:()=>L(!0),triggerStyle:h,testID:A}),_jsx(Modal,{visible:z,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:fe,children:_jsxs(GestureHandlerRootView,{collapsable:!1,style:[W.backdrop,{backgroundColor:H.colors.background.overlay}],children:[_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:fe,accessibilityLabel:"Dismiss"}),_jsx(Animated.View,{style:[W.sheetWrap,{paddingBottom:Math.max(F.bottom,H.spacing.lg),opacity:U,transform:[{translateY:Animated.add(xe,Z)}]}],onLayout:e=>{ee.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:ve}),_jsx(ToastHost,{})]})})]})});DateRangePicker.displayName="DateRangePicker";const buildStyles=e=>{const t=e.shadows.lg;return StyleSheet.create({backdrop:{...StyleSheet.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...smoothCorners,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...smoothCorners,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},subtitle:{marginTop:e.spacing.xxs,fontSize:e.typography.fontSize.sm,color:e.colors.text.secondary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.dateRangePicker?.navButtonSize??36,height:e.components.dateRangePicker?.navButtonSize??36,borderRadius:e.radius.full,...smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.dateRangePicker?.navTextFontSize??22,lineHeight:e.components.dateRangePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:0,position:"relative"},barLeft:{position:"absolute",left:0,right:"50%",top:"5%",bottom:"5%"},barRight:{position:"absolute",left:"50%",right:0,top:"5%",bottom:"5%"},dayInner:{width:"90%",height:"90%",alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...smoothCorners,minHeight:e.components.dateRangePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{DateRangePicker};export default DateRangePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DateRangePicker,default}from"./DateRangePicker.js";
|
|
1
|
+
"use strict";export{DateRangePicker,default}from"./DateRangePicker.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{forwardRef
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useState}from"react";import{Platform}from"react-native";import{Input}from"../Input/index.js";import{jsx as _jsx}from"react/jsx-runtime";export function cleanDecimalText(e,{whole:t,signed:n,decimals:r,allowExponent:a}={}){const l=String(e??"");if(a)return l.replace(/[^\d.eE+-]/g,"");const o=Boolean(n)&&l.replace(/[^\d.-]/g,"").startsWith("-");let i=l.replace(t?/\D/g:/[^\d.]/g,"");const c=i.indexOf(".");if(-1!==c){const e=i.slice(c+1).replace(/\./g,"");i=i.slice(0,c+1)+(null==r?e:e.slice(0,r))}return(o?"-":"")+i}export function parseDecimalText(e){if(""===e||"-"===e||"."===e||"-."===e)return"";const t=Number(e);return Number.isFinite(t)?t:""}const textOf=e=>null==e||""===e?"":String(e);function keyboardFor({whole:e,signed:t,allowExponent:n}){return n?"ios"===Platform.OS?"numbers-and-punctuation":"default":t?"numeric":e?"number-pad":"decimal-pad"}const DecimalInput=forwardRef((e,t)=>{const{symbol:n,value:r,onChange:a,onBlur:l,min:o,max:i,whole:c=!1,signed:s=!1,decimals:u,allowExponent:m=!1,numeric:p=!1,readOnly:d=!1,disabled:f=!1,...x}=e,[g,b]=useState(textOf(r));useEffect(()=>{p&&b(e=>parseDecimalText(e)===r?e:textOf(r))},[p,r]);const D=d||f,w={whole:c,signed:s,decimals:u,allowExponent:m};return _jsx(Input,{prefix:n,keyboardType:keyboardFor(w),autoCapitalize:"none",autoCorrect:!1,readOnly:d,disabled:f,...x,ref:t,value:p?g:textOf(r),onChangeText:D?void 0:e=>{const t=cleanDecimalText(e,w),n=m?""===t?"":Number(t):parseDecimalText(t);""!==n&&Number.isFinite(n)&&(null!=i&&n>i||null!=o&&n<o)||(p?(b(t),a?.(parseDecimalText(t))):a?.(t))},onBlur:D?void 0:l})});DecimalInput.displayName="DecimalInput";export{DecimalInput};export default DecimalInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{cleanDecimalText,DecimalInput,default,parseDecimalText}from"./DecimalInput.js";
|
|
1
|
+
"use strict";export{cleanDecimalText,DecimalInput,default,parseDecimalText}from"./DecimalInput.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{useMemo}from"react";import{StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{resolveColor}from"../Text/Text.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const EMPTY_VALUE="-",rowKey=(e,t)=>e.key??("string"==typeof e.label?`${e.label}-${t}`:`row-${t}`),isEmptyValue=e=>null==e||""===e||Array.isArray(e)&&!e.length;export const Descriptions=({items:e,columns:t=1,size:l="md",bordered:r=!1,title:o,variant:s="list",style:i,testID:a})=>{const n=useTheme(),m=useMemo(()=>buildStyles(n),[n]),d="sm"===l?n.typography.fontSize.xs:n.typography.fontSize.sm,y="sm"===l?n.typography.fontSize.sm:n.typography.fontSize.base,c="sm"===l?n.spacing.xs:n.spacing.sm,u="summary"===s;return _jsxs(View,{style:[u?null:{gap:c},i],testID:a,children:[o?_jsx(Text,{style:[m.title,{fontSize:n.typography.fontSize.lg,color:n.colors.text.primary}],children:o}):null,e.map((e,l)=>{const o=isEmptyValue(e.value),s=2===t&&!e.full,i=o?n.colors.text.tertiary:resolveColor(n,e.tone??"primary"),a=fontFor(n,e.strong?"semibold":"normal");return _jsxs(View,u?{style:[m.summaryRow,{paddingVertical:c,borderBottomColor:n.colors.border.secondary}],children:[_jsx(Text,{style:[m.summaryLabel,{fontSize:y,color:n.colors.text.secondary}],children:e.label}),"string"==typeof e.value||o?_jsx(Text,{style:[m.summaryValue,{fontSize:y,color:i},a],children:o?"-":e.value}):_jsx(View,{children:e.value})]}:{style:[s?m.rowSide:m.rowStack,{paddingVertical:c},r&&l>0?m.bordered:null,r&&l>0?{borderTopColor:n.colors.border.secondary}:null],children:["string"==typeof e.label?_jsx(Text,{style:[m.label,{fontSize:d,color:n.colors.text.tertiary},s?m.labelSide:null],children:e.label}):_jsx(View,{style:s?m.labelSide:null,children:e.label}),"string"==typeof e.value||o?_jsx(Text,{style:[m.value,{fontSize:y,color:i},e.strong?a:null,s?m.valueSide:null],children:o?"-":e.value}):_jsx(View,{style:s?m.valueSide:null,children:e.value})]},rowKey(e,l))})]})};const buildStyles=e=>StyleSheet.create({title:{...fontFor(e,"semibold")},rowStack:{gap:2},rowSide:{flexDirection:"row",alignItems:"flex-start",gap:e.spacing.md},bordered:{borderTopWidth:StyleSheet.hairlineWidth},label:{...fontFor(e,"semibold")},labelSide:{flex:4},value:{...fontFor(e,"normal")},valueSide:{flex:6},summaryRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.md,borderBottomWidth:StyleSheet.hairlineWidth},summaryLabel:{flex:1,...fontFor(e,"normal")},summaryValue:{textAlign:"right"}});export default Descriptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Descriptions,default}from"./Descriptions.js";
|
|
1
|
+
"use strict";export{Descriptions,default}from"./Descriptions.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{useCallback,useMemo}from"react";import{ActivityIndicator,Pressable,StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{MODAL_DISMISS_GRACE_MS,Modal}from"../Modal/Modal.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Dialog=e=>{const{visible:o,onClose:t,title:r,message:n,children:i,icon:s,variant:l="default",actions:a,dismissOnAction:c=!0,accessibilityLabel:d,contentStyle:u,containerStyle:m,titleStyle:g,messageStyle:b,iconWrapperStyle:p,actionsRowStyle:y,actionButtonStyle:h,actionTextStyle:x,haptic:S,testID:f}=e,C=useTheme(),j=useMemo(()=>buildStyles(C),[C]),_=useMemo(()=>tintForVariant(C,l),[C,l]),M=C.components.dialog,w=M?.iconWrapperSize??48,R=M?.iconWrapperBorderRadius??24,I=M?.actionButtonMinHeight??44,B=Boolean(a&&a.length>0),D=useCallback(e=>{if(e.loading||e.disabled)return;const o=resolveHaptic(S,"selection");o&&triggerHaptic(o),c?(t(),setTimeout(e.onPress,MODAL_DISMISS_GRACE_MS)):e.onPress()},[c,t,S]);return _jsx(Modal,{visible:o,onRequestClose:t,haptic:S,presentation:"centered",accessibilityLabel:d??r,contentStyle:u,testID:f,children:_jsxs(View,{accessibilityRole:"alert",accessibilityLabel:d??r,style:[j.container,m],children:[s?_jsx(View,{style:[j.iconWrapper,{width:w,height:w,borderRadius:R,...smoothCorners,backgroundColor:_.muted,marginBottom:C.spacing.md},p],children:s}):null,r?_jsx(Text,{style:[j.title,{color:C.colors.text.primary,fontSize:C.typography.fontSize.xl,...fontFor(C,"semibold"),marginBottom:n||null!=i?C.spacing.sm:C.spacing.md},g],accessibilityRole:"header",children:r}):null,n?_jsx(Text,{style:[j.message,{color:C.colors.text.secondary,fontSize:C.typography.fontSize.base,lineHeight:C.typography.fontSize.base*C.typography.lineHeight.normal,marginBottom:null!=i?C.spacing.md:B?C.spacing.lg:0},b],children:n}):null,null!=i?_jsx(View,{style:{marginBottom:B?C.spacing.lg:0},children:i}):null,a&&a.length>0?_jsx(View,{style:[j.actionsRow,y],children:a.map((e,o)=>{const t=e.tone??"primary",r=Boolean(e.disabled),n=actionStyleFor(C,t,l,r),i=o===a.length-1;return _jsx(Pressable,{onPress:()=>D(e),disabled:e.loading||r,accessibilityRole:"button",accessibilityLabel:e.label,accessibilityState:{busy:e.loading,disabled:Boolean(e.loading)||r},style:({pressed:o})=>[j.actionButton,{minHeight:I,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:n.borderWidth,borderRadius:C.radius.md,...smoothCorners,paddingVertical:C.spacing.md-2,paddingHorizontal:C.spacing.lg,marginRight:i?0:C.spacing.sm,opacity:e.loading?.7:o&&!r?.85:1},h],children:e.loading?_jsx(ActivityIndicator,{size:"small",color:n.textColor}):_jsx(Text,{style:[{color:n.textColor,fontSize:C.typography.fontSize.base,...fontFor(C,"semibold"),textAlign:"center"},x],numberOfLines:1,children:e.label})},`${e.label}-${o}`)})}):null]})})};Dialog.displayName="Dialog";const tintForVariant=(e,o)=>{const t=e.colors.background.secondary;switch(o){case"success":return{base:e.colors.success,on:e.colors.onSuccess,muted:t};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,muted:t};case"error":return{base:e.colors.error,on:e.colors.onError,muted:t};case"info":return{base:e.colors.info,on:e.colors.onInfo,muted:t};default:return{base:e.colors.primary,on:e.colors.onPrimary,muted:e.colors.primaryMuted}}},actionStyleFor=(e,o,t,r)=>{if(r)return{backgroundColor:"neutral"===o?"transparent":e.colors.surface.disabled,borderColor:"neutral"===o?e.colors.border.primary:"transparent",borderWidth:"neutral"===o?1:0,textColor:e.colors.text.disabled};switch(o){case"primary":{const o=tintForVariant(e,t);return{backgroundColor:o.base,borderColor:"transparent",borderWidth:0,textColor:o.on}}case"error":return{backgroundColor:e.colors.error,borderColor:"transparent",borderWidth:0,textColor:e.colors.onError};default:return{backgroundColor:"transparent",borderColor:e.colors.border.primary,borderWidth:1,textColor:e.colors.text.primary}}},buildStyles=e=>StyleSheet.create({container:{alignItems:"stretch"},iconWrapper:{alignItems:"center",justifyContent:"center",alignSelf:"center"},title:{textAlign:"center"},message:{textAlign:"center"},actionsRow:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},actionButton:{flex:1,alignItems:"center",justifyContent:"center"}});export{Dialog};export default Dialog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Dialog,default}from"./Dialog.js";
|
|
1
|
+
"use strict";export{Dialog,default}from"./Dialog.js";
|