@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 from"react";import{View}from"react-native";import{useTheme}from"../../theme/index.js";import{AppIcon}from"../AppIcon/index.js";import{EmptyState}from"../EmptyState/index.js";import{Spinner}from"../Spinner/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const OFFLINE_HINT="Check your connection, then try again.";export const AsyncBlock=({loading:e=!1,error:t,errorVariant:r="default",empty:i=!1,onRetry:n,skeleton:o,emptyTitle:s="Nothing here yet",emptyDescription:c,emptyIcon:l,errorTitle:a="That didn't load",offlineTitle:p="You're offline",retryLabel:m="Try again",children:y,style:d,testID:x})=>{const f=useTheme();if(e)return _jsx(View,{style:d,testID:x,children:o??_jsx(View,{style:{paddingVertical:f.spacing["2xl"],alignItems:"center"},children:_jsx(Spinner,{})})});if(t){const e="offline"===r,i="string"==typeof t?t:e?OFFLINE_HINT:void 0;return _jsxs(View,{style:d,testID:x,children:[_jsx(EmptyState,{icon:e?_jsx(AppIcon,{name:"cloud-cross",size:"xl",color:f.colors.text.tertiary,testID:"async-block-offline-icon"}):void 0,title:e?p:a,description:i,action:n?{label:m,onPress:n}:void 0}),"string"==typeof t?null:t]})}return i?_jsx(View,{style:d,testID:x,children:_jsx(EmptyState,{icon:l,title:s,description:c})}):_jsx(_Fragment,{children:y})};export default AsyncBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AsyncBlock,default}from"./AsyncBlock.js";
|
|
1
|
+
"use strict";export{AsyncBlock,default}from"./AsyncBlock.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Image
|
|
1
|
+
"use strict";import{Image}from"expo-image";import{useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,Text,View}from"react-native";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{Spinner}from"../Spinner/index.js";import{acquireFetch,DEFAULT_TTL_MS,deriveCacheKey,isFresh,isPermanentRefusal,readEntry,releaseFetch,removeEntry,touchEntry}from"./authedImageCache.js";import{jsx as _jsx}from"react/jsx-runtime";const CONTENT_FIT={cover:"cover",contain:"contain",stretch:"fill",center:"scale-down",repeat:"cover"},toError=e=>e instanceof Error?e:new Error(String(e)),AuthedImage=e=>{const{uri:t,headers:r,client:o,authenticated:i=!0,ttlMs:a=DEFAULT_TTL_MS,placeholder:s,fallback:n,onLoadStart:c,onLoadEnd:l,onError:d,cacheKey:u,testID:m,accessibilityLabel:h,style:y,resizeMode:f,fadeDuration:g,contentFit:b,transition:p,cachePolicy:E="memory",...I}=e,S=useTheme(),x=useMemo(()=>buildStyles(S),[S]),[v,L]=useState({status:"loading"}),T=useRef({onLoadStart:c,onLoadEnd:l,onError:d});T.current={onLoadStart:c,onLoadEnd:l,onError:d};const j=JSON.stringify(r??{});return useEffect(()=>{let e=!1,r=null;const finish=t=>{e||(L(t),T.current.onLoadEnd?.())};return(async()=>{if(!t){const t=new Error("[@webority/mobile-ui] AuthedImage was given an empty `uri`. Pass the image URL, or render nothing while the URL is still unknown.");return void(e||(L({status:"error"}),T.current.onError?.(t)))}L({status:"loading"}),T.current.onLoadStart?.();const s=deriveCacheKey(t,u),n=await readEntry(s);if(e)return;if(n&&isFresh(n.meta,a))return touchEntry(s),void finish({status:"ready",fileUri:n.fileUri});const c=acquireFetch(s,{uri:t,headers:JSON.parse(j),authenticated:i,client:o});r={key:s,entry:c};try{const e=await c.promise;finish({status:"ready",fileUri:e.fileUri})}catch(t){if(e)return;if(n&&!isPermanentRefusal(t))return void finish({status:"ready",fileUri:n.fileUri});if(n&&(await removeEntry(s),e))return;L({status:"error"}),T.current.onError?.(toError(t)),T.current.onLoadEnd?.()}})(),()=>{e=!0,r&&releaseFetch(r.key,r.entry)}},[t,u,a,i,o,j]),"loading"===v.status?_jsx(View,void 0!==s?{style:y,testID:m,children:s}:{style:[x.placeholder,y],testID:m,children:_jsx(View,{style:x.stateFill,testID:m?`${m}-placeholder`:void 0,pointerEvents:"none",children:_jsx(Spinner,{size:"sm",accessibilityLabel:h??"Loading image"})})}):"error"===v.status?_jsx(View,void 0!==n?{style:y,testID:m,children:n}:{style:[x.fallback,y],testID:m,children:_jsx(View,{accessible:!0,accessibilityRole:"image",accessibilityLabel:h?`${h}, image unavailable`:"Image unavailable",testID:m?`${m}-fallback`:void 0,style:x.stateFill,children:_jsx(Text,{style:x.fallbackText,children:"!"})})}):_jsx(Image,{...I,accessible:!0,accessibilityRole:"image",accessibilityLabel:h,testID:m,style:y,contentFit:b??(f?CONTENT_FIT[f]:void 0),transition:p??g,cachePolicy:E,source:{uri:v.fileUri}})};AuthedImage.displayName="AuthedImage";const buildStyles=e=>StyleSheet.create({placeholder:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary,borderRadius:e.radius.md,...smoothCorners},fallback:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary,borderRadius:e.radius.md,...smoothCorners,borderWidth:e.colors.border.width,borderColor:e.colors.border.secondary,padding:e.spacing.sm},stateFill:{alignItems:"center",flex:1,justifyContent:"center"},fallbackText:{color:e.colors.text.tertiary,fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.bold}});export{AuthedImage};export default AuthedImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ACCESS_TOKEN_KEY
|
|
1
|
+
"use strict";import{ACCESS_TOKEN_KEY,getToken,isStorageAvailable,Logger,publicClient,Storage}from"@webority/mobile-core";import{Directory,File,Paths}from"expo-file-system";import{hashString}from"../../utils/hashString.js";const INDEX_KEY="@webority/authed-image/v2/index",LEGACY_PREFIX="@webority/authed-image/v1/",FOLDER="authed-images",DEFAULT_BYTE_CEILING=52428800,TOUCH_PERSIST_MS=36e5;export const DEFAULT_TTL_MS=6048e5;let byteCeiling=52428800;export const setAuthedImageCacheLimit=e=>{if(!Number.isFinite(e)||e<=0)throw new Error(`[@webority/mobile-ui] setAuthedImageCacheLimit() needs a positive number of bytes, received ${String(e)}. Pass e.g. 50 * 1024 * 1024 for 50 MB.`);byteCeiling=e};export const getAuthedImageCacheLimit=()=>byteCeiling;export const deriveCacheKey=(e,t)=>hashString(t??e);const imageFile=e=>new File(Paths.cache,FOLDER,e),toMeta=({fetchedAt:e,bytes:t,contentType:r,lastAccessedAt:s})=>({fetchedAt:e,bytes:t,contentType:r,lastAccessedAt:s});let index=null,indexLoad=null;const persistIndex=async e=>{if(!isStorageAvailable())return;const t={};for(const[r,s]of e)t[r]={...s,persistedAccessAt:s.lastAccessedAt};if(await Storage.setItem(INDEX_KEY,JSON.stringify(t)))for(const t of e.values())t.persistedAccessAt=t.lastAccessedAt},removeLegacyEntries=async()=>{const e=(await Storage.getAllKeys()).filter(e=>e.startsWith(LEGACY_PREFIX));e.length>0&&await Storage.multiRemove(e)},removeOrphanFiles=e=>{try{const t=new Directory(Paths.cache,FOLDER);if(!t.exists)return;const r=new Set([...e.values()].map(e=>imageFile(e.fileName).uri));for(const e of t.list())r.has(e.uri)||e.delete()}catch(e){Logger.warn("[AuthedImage] could not tidy the image cache folder",e)}},readStoredIndex=async()=>{const e=new Map;if(!isStorageAvailable())return e;const t=await Storage.getItem(INDEX_KEY);if(!t)return await removeLegacyEntries(),e;try{for(const[r,s]of Object.entries(JSON.parse(t)))e.set(r,s)}catch{}return e},loadIndex=()=>index?Promise.resolve(index):(indexLoad||(indexLoad=readStoredIndex().then(e=>(removeOrphanFiles(e),index=e,e)).finally(()=>{indexLoad=null})),indexLoad),deleteFile=e=>{try{const t=imageFile(e);t.exists&&t.delete()}catch(e){Logger.warn("[AuthedImage] could not delete a cached image file",e)}};export const readEntry=async e=>{const t=await loadIndex(),r=t.get(e);if(!r)return null;const s=imageFile(r.fileName);return s.exists?{fileUri:s.uri,meta:toMeta(r)}:(t.delete(e),await persistIndex(t),null)};export const removeEntry=async e=>{const t=await loadIndex(),r=t.get(e);r&&(t.delete(e),deleteFile(r.fileName),await persistIndex(t))};export class AuthedImageHttpError extends Error{constructor(e,t){super(e),this.name="AuthedImageHttpError",this.status=t}}export const isPermanentRefusal=e=>e instanceof AuthedImageHttpError&&e.status>=400&&e.status<500&&408!==e.status&&429!==e.status;export const isFresh=(e,t,r=Date.now())=>r-e.fetchedAt<t;export const touchEntry=async e=>{const t=await loadIndex(),r=t.get(e);r&&(r.lastAccessedAt=Date.now(),r.lastAccessedAt-r.persistedAccessAt>=36e5&&await persistIndex(t))};const evictIfNeeded=e=>{let t=0;for(const r of e.values())t+=r.bytes;if(t<=byteCeiling)return 0;const r=[...e].sort(([,e],[,t])=>e.lastAccessedAt-t.lastAccessedAt);let s=0;for(const[i,a]of r){if(t<=byteCeiling)break;e.delete(i),deleteFile(a.fileName),t-=a.bytes,s+=1}return s};export const clearAuthedImageCache=async()=>{(await loadIndex()).clear();const e=new Directory(Paths.cache,FOLDER);e.exists&&e.delete(),isStorageAvailable()&&await Storage.removeItem(INDEX_KEY)};export const authedImageCacheStats=async()=>{const e=await loadIndex();let t=0;for(const r of e.values())t+=r.bytes;return{entries:e.size,bytes:t}};const responseHeader=(e,t)=>{if(!e||"object"!=typeof e)return;const r=e.get,s="function"==typeof r?r.call(e,t):e[t];return"string"==typeof s?s:void 0},fetchAndStore=async(e,t,r)=>{const s={Accept:"image/*",...t.headers};if(!t.client&&t.authenticated){const e=await getToken(ACCESS_TOKEN_KEY);e?.token&&(s.Authorization=`Bearer ${e.token}`)}const i=t.client??publicClient;let a;try{a=await i.get(t.uri,{headers:s,responseType:"arraybuffer",signal:r})}catch(e){const r=e?.response?.status;if("number"!=typeof r)throw e;throw new AuthedImageHttpError(`[@webority/mobile-ui] AuthedImage could not load "${t.uri}": the server answered ${r}. Check the URL and whether the request needs to be signed in (pass the signed-in client as \`client\`, or authenticated={false} for public media).`,r)}const o=new Uint8Array(a.data??new ArrayBuffer(0)),n=responseHeader(a.headers,"content-type"),c=(n?n.split(";")[0].trim():"")||"image/jpeg",l=await loadIndex(),d=Date.now(),h=`${e}-${d.toString(36)}`,g=imageFile(h);try{g.create({intermediates:!0,overwrite:!0}),g.write(o)}catch(e){throw new Error(`[@webority/mobile-ui] AuthedImage fetched "${t.uri}" but could not write it to the app's cache folder: ${e instanceof Error?e.message:String(e)}. The device may be out of storage.`)}const u={fetchedAt:d,bytes:o.byteLength,contentType:c,lastAccessedAt:d,fileName:h,persistedAccessAt:d},m=l.get(e);l.set(e,u),m&&m.fileName!==h&&deleteFile(m.fileName);const f=evictIfNeeded(l);return await persistIndex(l),f>0&&Logger.info(`[AuthedImage] evicted ${f} cached image(s) over the byte ceiling`),{fileUri:g.uri,meta:toMeta(u)}},inFlight=new Map;export const acquireFetch=(e,t)=>{const r=inFlight.get(e);if(r)return r.waiters+=1,r;const s=new AbortController,i={controller:s,waiters:1,promise:Promise.resolve()};return i.promise=fetchAndStore(e,t,s.signal).finally(()=>{inFlight.get(e)===i&&inFlight.delete(e)}),inFlight.set(e,i),i};export const releaseFetch=(e,t)=>{t.waiters-=1,t.waiters>0||(inFlight.get(e)===t&&inFlight.delete(e),t.controller.abort())};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AuthedImage,default}from"./AuthedImage.js";export{authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./authedImageCache.js";
|
|
1
|
+
"use strict";export{AuthedImage,default}from"./AuthedImage.js";export{authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./authedImageCache.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{useCallback,useMemo,useRef,useState}from"react";import{Keyboard,Pressable,ScrollView,StyleSheet,Text,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{Input}from"../Input/index.js";import{Spinner}from"../Spinner/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const defaultGetLabel=e=>"string"==typeof e?e:String(e);function Autocomplete(e){const{options:t,value:o,defaultValue:r,onChangeText:i,onSelect:s,getOptionLabel:l,getOptionKey:n,filter:a,minChars:c=1,maxResults:d=8,emptyText:u="No matches",loading:p=!1,filterMode:m="client",loadingText:h="Searching…",placeholder:x,label:g,error:y,helperText:b,disabled:f=!1,size:S="md",variant:j,haptic:T,style:C,listStyle:w,optionTextStyle:_,testID:v}=e,z=useTheme(),V=useMemo(()=>buildStyles(z),[z]),[k,R]=useControllableState({value:o,defaultValue:r??"",onChange:i}),[I,L]=useState(!1),[H,P]=useState(0),A=useRef(null),F=useCallback(e=>l?l(e):defaultGetLabel(e),[l]),M=useMemo(()=>{if("none"===m)return t.slice(0,d);const e=k.trim();if(e.length<c)return[];const o=e.toLowerCase(),r=a?t=>a(t,e):e=>F(e).toLowerCase().includes(o);return t.filter(r).slice(0,d)},[t,k,c,d,a,F,m]),D=I&&(p||k.trim().length>=c),K=useCallback(e=>{const t=resolveHaptic(T,"selection");t&&triggerHaptic(t),A.current&&clearTimeout(A.current),R(F(e)),L(!1),Keyboard.dismiss(),s(e)},[T,R,F,s]);React.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const O=useCallback(e=>{P(e.nativeEvent.layout.height)},[]);return _jsxs(View,{style:[V.container,C],testID:v,children:[_jsx(View,{onLayout:O,children:_jsx(Input,{value:k,onChangeText:R,onFocus:()=>{A.current&&clearTimeout(A.current),L(!0)},onBlur:()=>{A.current=setTimeout(()=>L(!1),120)},placeholder:x,label:g,error:y,helperText:b,editable:!f,accessibilityState:{disabled:f},size:S,variant:j,autoCorrect:!1,autoCapitalize:"none"})}),D?_jsx(View,{style:[V.list,{top:H,backgroundColor:z.colors.background.elevated,borderColor:z.colors.border.primary,borderRadius:z.radius.md,...smoothCorners,...z.shadows.lg},w],children:p?_jsxs(View,{style:V.loadingRow,children:[_jsx(Spinner,{size:"sm"}),_jsx(Text,{style:[V.loadingText,{color:z.colors.text.secondary,fontSize:z.typography.fontSize.sm}],children:h})]}):0===M.length?_jsx(Text,{style:[V.empty,{color:z.colors.text.tertiary,fontSize:z.typography.fontSize.sm}],children:u}):_jsx(ScrollView,{keyboardShouldPersistTaps:"handled",style:V.scroll,children:M.map((e,t)=>_jsx(Pressable,{onPress:()=>K(e),android_ripple:{color:z.colors.surface.pressed},style:({pressed:e})=>[V.option,{paddingHorizontal:z.spacing.md,paddingVertical:z.spacing.sm,backgroundColor:e?z.colors.surface.pressed:"transparent"}],accessibilityRole:"button",accessibilityLabel:F(e),accessibilityState:{selected:F(e)===k},children:_jsx(Text,{style:[V.optionText,{color:z.colors.text.primary,fontSize:z.typography.fontSize.base},_],numberOfLines:1,children:F(e)})},n?n(e):`${F(e)}-${t}`))})}):null]})}Autocomplete.displayName="Autocomplete";const buildStyles=e=>StyleSheet.create({container:{width:"100%",position:"relative",zIndex:10},list:{position:"absolute",left:0,right:0,borderWidth:StyleSheet.hairlineWidth,overflow:"hidden",zIndex:20,maxHeight:240},scroll:{maxHeight:240},option:{width:"100%"},optionText:{includeFontPadding:!1},empty:{padding:e.spacing.md,textAlign:"center",includeFontPadding:!1},loadingRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm,padding:e.spacing.md},loadingText:{includeFontPadding:!1}});export{Autocomplete};export default Autocomplete;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Autocomplete}from"./Autocomplete.js";
|
|
1
|
+
"use strict";export{Autocomplete}from"./Autocomplete.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Image
|
|
1
|
+
"use strict";import{Image}from"expo-image";import React,{Children,cloneElement,forwardRef,isValidElement,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{AppIcon}from"../AppIcon/index.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const SOFT_FILL_OPACITY=.14;export const avatarToneColors=(e,r)=>{const soft=(e,r)=>tintOf(e,.14,r);switch(r){case"primary":return{background:soft(e.colors.primary,e.colors.primaryMuted),color:e.colors.primary};case"secondary":return{background:e.colors.secondary,color:e.colors.onSecondary};case"success":return{background:soft(e.colors.success,e.colors.background.secondary),color:e.colors.success};case"warning":return{background:soft(e.colors.warning,e.colors.background.secondary),color:e.colors.warning};case"error":return{background:soft(e.colors.error,e.colors.background.secondary),color:e.colors.error};case"info":return{background:soft(e.colors.info,e.colors.background.secondary),color:e.colors.info};default:return{background:e.colors.background.tertiary,color:e.colors.text.primary}}};const sizeMap={xs:24,sm:32,md:48,lg:64,xl:80},resolveSize=e=>"number"==typeof e?e:sizeMap[e],resolveRadius=(e,r)=>{switch(e){case"circle":return r/2;case"rounded":return Math.max(6,Math.round(.22*r));default:return 0}},initialsFromName=e=>{if(!e)return"";const r=e.trim().split(/\s+/u).filter(Boolean);return 0===r.length?"":1===r.length?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()},hashColor=(e,r)=>{if(!e)return r[0];let t=0;for(let r=0;r<e.length;r+=1)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r[Math.abs(t)%r.length]},RING_WIDTH=1.5,isRingStatus=e=>"verified"===e||"pending"===e,statusColor=(e,r)=>{switch(r){case"online":case"verified":return e.colors.success;case"busy":return e.colors.error;case"away":case"pending":return e.colors.warning;default:return e.colors.text.tertiary}},Avatar=forwardRef((e,r)=>{const{source:t,ImageComponent:o,name:s,size:a="md",shape:i="circle",status:n=null,statusPosition:l="bottomRight",tone:c,backgroundColor:d,color:u,fontSize:h,loading:m=!1,accessibilityLabel:g,style:b,textStyle:p,testID:y}=e,f=useTheme(),v=f.components.avatar,[x,C]=useState(!1),S=useMemo(()=>resolveSize(a),[a]),A=useMemo(()=>resolveRadius(i,S),[i,S]),w=v?.borderWidth??0,R=v?.borderColor??f.colors.border.primary,j=v?.statusBorderWidth??2,k=v?.statusBorderColor??f.colors.background.elevated,I=useMemo(()=>initialsFromName(s),[s]),M=useMemo(()=>c?avatarToneColors(f,c):null,[f,c]),_=useMemo(()=>d||(M?.background??hashColor(s??"",f.colors.avatarPalette)),[d,M,s,f.colors.avatarPalette]),T=u??M?.color??f.colors.onPrimary,W=!!t&&!x,E=v?.fontSizeRatio??.4,z=h??v?.fontSize??Math.max(10,Math.round(S*E)),G=Math.max(8,Math.round(.25*S)),V=isRingStatus(n),L=v?.ringWidth??1.5,F=S-2*(V?L+(v?.ringGap??L):0),N=V?resolveRadius(i,F):A,D=V?statusColor(f,n):"transparent",$=Math.max(12,Math.round(.32*S)),O=Math.max(10,$-4),B=W?f.colors.background.tertiary:_,P=y??"avatar",U=s?`${s}'s avatar`:"Avatar",H=g??("verified"===n?`${U}, verified`:"pending"===n?`${U}, pending verification`:U),Y=_jsxs(View,{ref:r,style:[styles.root,{width:S,height:S,borderRadius:A,...smoothCorners,borderWidth:V?0:w,borderColor:R,backgroundColor:V?"transparent":B},b],accessible:!0,accessibilityRole:"image",accessibilityLabel:H,testID:y,children:[V?_jsx(View,{style:[styles.ring,{borderRadius:A,...smoothCorners,borderWidth:L,borderColor:D}],accessible:!1,pointerEvents:"none",testID:`${P}-ring`}):null,_jsx(View,{style:[styles.picture,{width:F,height:F,borderRadius:N,...smoothCorners,borderWidth:V?w:0,borderColor:R,backgroundColor:V?B:"transparent"}],children:W?(()=>{const e={width:F,height:F,borderRadius:N,...smoothCorners},onError=()=>C(!0);return o?_jsx(o,{source:t,onError:onError,style:e,contentFit:"cover",resizeMode:"cover",accessibilityIgnoresInvertColors:!0}):_jsx(Image,{source:t,onError:onError,style:e,contentFit:"cover",accessibilityIgnoresInvertColors:!0})})():_jsx(Text,{style:[styles.initials,{color:T,fontSize:z,fontWeight:f.typography.fontWeight[v?.fontWeight??"semibold"]},p],numberOfLines:1,allowFontScaling:!1,children:I??" "})}),"verified"===n?_jsx(View,{style:[styles.status,"topRight"===l?styles.badgeTopRight:styles.badgeBottomRight,{width:$,height:$,borderRadius:$/2,...smoothCorners,backgroundColor:k}],accessible:!1,pointerEvents:"none",testID:`${P}-badge`,children:_jsx(AppIcon,{name:"verify",variant:"bold",size:O,color:D})}):null,n&&!V?_jsx(View,{style:[styles.status,"topRight"===l?styles.statusTopRight:styles.statusBottomRight,{width:G,height:G,borderRadius:G/2,...smoothCorners,backgroundColor:statusColor(f,n),borderWidth:j,borderColor:k}],accessible:!1,pointerEvents:"none"}):null]});return m?_jsx(AvatarSkeleton,{...e}):Y});Avatar.displayName="Avatar";const AvatarSkeleton=({size:e="md",shape:r="circle",style:t})=>{const o=resolveSize(e);return _jsx(Skeleton,{shape:"circle"===r?"circle":"rounded"===r?"rounded":"rect",width:o,height:o,style:t})};AvatarSkeleton.displayName="AvatarSkeleton",Avatar.Skeleton=AvatarSkeleton;const styles=StyleSheet.create({root:{alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},initials:{textAlign:"center"},ring:{position:"absolute",top:0,right:0,bottom:0,left:0},picture:{alignItems:"center",justifyContent:"center",overflow:"hidden"},status:{position:"absolute"},badgeTopRight:{top:-2,right:-2,alignItems:"center",justifyContent:"center"},badgeBottomRight:{bottom:-2,right:-2,alignItems:"center",justifyContent:"center"},statusTopRight:{top:0,right:0},statusBottomRight:{bottom:0,right:0}}),SPACING_OFFSET={tight:-16,normal:-12,loose:-8},STAGGER_MS=50,ENTRANCE_DURATION_MS=220,AvatarGroupItem=({delay:e,marginLeft:r,borderColor:t,borderWidth:o,children:s})=>{const a=useRef(createAnimatedValue(0)).current;return useEffect(()=>{const r=Animated.timing(a,{toValue:1,duration:220,delay:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0});return r.start(),()=>r.stop()},[e,a]),_jsx(Animated.View,{style:[groupStyles.item,{marginLeft:r,borderColor:t,borderWidth:o,opacity:a}],children:s})},AvatarGroup=e=>{const{children:r,max:t=4,size:o="md",spacing:s="normal",overflowVariant:a="count",accessibilityLabel:i,style:n,testID:l}=e,c=useTheme(),d=useMemo(()=>Children.toArray(r).filter(e=>isValidElement(e)),[r]),u=d.length,h=d.slice(0,t),m=Math.max(0,u-t),g=m>0,b=SPACING_OFFSET[s],p=c.colors.background.elevated,y=i??`Group of ${u} ${1===u?"person":"people"}`,f=useMemo(()=>resolveSize(o),[o]),v=Math.max(10,Math.round(.34*f));return _jsxs(View,{style:[groupStyles.row,n],accessible:!0,accessibilityLabel:y,accessibilityRole:"summary",testID:l,children:[h.map((e,r)=>{const t=e.key??`avatar-${r}`;return _jsx(AvatarGroupItem,{delay:50*r,marginLeft:0===r?0:b,borderColor:p,borderWidth:1.5,children:cloneElement(e,{size:o})},t)}),g?_jsx(AvatarGroupItem,{delay:50*h.length,marginLeft:0===h.length?0:b,borderColor:p,borderWidth:1.5,children:_jsx(View,{style:[groupStyles.overflow,{width:f,height:f,borderRadius:f/2,...smoothCorners,backgroundColor:c.colors.surface.disabled}],accessible:!0,accessibilityRole:"text",accessibilityLabel:"count"===a?`${m} more`:"More avatars",children:_jsx(Text,{style:{color:c.colors.text.secondary,fontSize:v,fontWeight:c.typography.fontWeight.semibold},numberOfLines:1,allowFontScaling:!1,children:"count"===a?`+${m}`:"+"})})},"avatar-overflow"):null]})},groupStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},item:{borderRadius:9999,...smoothCorners},overflow:{alignItems:"center",justifyContent:"center"}}),AvatarWithGroup=Avatar;AvatarWithGroup.Group=AvatarGroup;export{Avatar,AvatarGroup};export default AvatarWithGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Avatar,AvatarGroup,avatarToneColors,default}from"./Avatar.js";
|
|
1
|
+
"use strict";export{Avatar,AvatarGroup,avatarToneColors,default}from"./Avatar.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,setNativeValue,useTheme}from"../../theme/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 toneFor=(e,t)=>{switch(t){case"primary":return{background:e.colors.primary,text:e.colors.onPrimary};case"success":return{background:e.colors.success,text:e.colors.onSuccess};case"warning":return{background:e.colors.warning,text:e.colors.onWarning};case"info":return{background:e.colors.info,text:e.colors.onInfo};case"neutral":return{background:e.colors.background.tertiary,text:e.colors.text.primary};default:return{background:e.colors.error,text:e.colors.onError}}},sizeMap={sm:{fontSize:10,minWidth:16,height:16,paddingH:5,dot:8},md:{fontSize:11,minWidth:20,height:20,paddingH:6,dot:10}},anchorPosition=(e,t)=>{const o=-t;switch(e){case"topLeft":return{top:o,left:o};case"bottomRight":return{bottom:o,right:o};case"bottomLeft":return{bottom:o,left:o};default:return{top:o,right:o}}},formatValue=(e,t)=>{if(null==e)return null;if("number"==typeof e)return e<=0?null:e>t?`${t}+`:String(e);const o=String(e);return 0===o.length?null:o},Badge=forwardRef((e,t)=>{const{value:o,max:i=99,variant:r="standard",tone:n="error",size:s="sm",invisible:a=!1,loading:d=!1,children:l,anchor:c="topRight",pulse:h=!1,accessibilityLabel:u,style:g,badgeStyle:m,textStyle:f,testID:p}=e,b=useTheme(),x=useMemo(()=>toneFor(b,n),[b,n]),y=b.components.badge?.[s],S={fontSize:y?.fontSize??sizeMap[s].fontSize,minWidth:y?.minWidth??sizeMap[s].minWidth,height:y?.height??sizeMap[s].height,paddingH:y?.paddingHorizontal??sizeMap[s].paddingH,dot:y?.dotSize??sizeMap[s].dot},z=b.components.badge?.borderWidth??1.5,w=b.components.badge?.anchorOffset??4,k="dot"===r?null:formatValue(o,i),j=!a&&("dot"===r||null!==k),v=useRef(createAnimatedValue(1)).current;useEffect(()=>{if(!h||!j)return void setNativeValue(v,1);const e=Animated.loop(Animated.sequence([Animated.timing(v,{toValue:1.15,duration:b.motion.duration.slow,easing:Easing.bezier(...b.motion.easing.standard),useNativeDriver:!0}),Animated.timing(v,{toValue:1,duration:b.motion.duration.slow,easing:Easing.bezier(...b.motion.easing.standard),useNativeDriver:!0})]));return e.start(),()=>{e.stop()}},[h,j,v,b]);const V="dot"===r,W=V?"image":"text",_=u??(V?"Notification indicator":k?`${k} unread`:void 0),B=j?_jsx(Animated.View,{style:[styles.badge,V?{width:S.dot,height:S.dot,borderRadius:S.dot/2,...smoothCorners,paddingHorizontal:0}:{minWidth:S.minWidth,minHeight:S.height,borderRadius:b.radius.full,...smoothCorners,paddingHorizontal:S.paddingH},{backgroundColor:x.background,transform:[{scale:v}]},l?{position:"absolute",borderWidth:z,borderColor:b.colors.background.elevated,...anchorPosition(c,w)}:null,m],accessible:!0,accessibilityRole:W,accessibilityLabel:_,children:V||null===k?null:_jsx(Text,{style:[styles.text,{color:x.text,fontSize:S.fontSize,...fontFor(b,"bold")},f],numberOfLines:1,maxFontSizeMultiplier:b.maxFontSizeMultiplier,children:k??" "})}):null,H=l?_jsxs(View,{ref:t,style:[styles.wrapper,g],testID:p,children:[l,B]}):_jsx(View,{ref:t,style:g,testID:p,children:B});return d?_jsx(BadgeSkeleton,{...e}):H});Badge.displayName="Badge";const BadgeSkeleton=({variant:e="standard",size:t="md",children:o,anchor:i,style:r,badgeStyle:n})=>{const s=sizeMap[t];if("dot"===e)return _jsx(Skeleton,{shape:"circle",width:s.dot,height:s.dot,style:[n,r]});const a=s.height/2;if(void 0!==o){const e="topLeft"===i?{top:-s.height/2,left:-s.height/2}:"bottomRight"===i?{bottom:-s.height/2,right:-s.height/2}:"bottomLeft"===i?{bottom:-s.height/2,left:-s.height/2}:{top:-s.height/2,right:-s.height/2};return _jsxs(View,{style:[styles.wrapper,r],children:[o,_jsx(View,{style:[{position:"absolute"},e],children:_jsx(Skeleton,{width:s.minWidth+s.paddingH,height:s.height,radius:a,style:n})})]})}return _jsx(Skeleton,{width:s.minWidth+s.paddingH,height:s.height,radius:a,style:[n,r]})};BadgeSkeleton.displayName="BadgeSkeleton",Badge.Skeleton=BadgeSkeleton;const styles=StyleSheet.create({wrapper:{position:"relative",alignSelf:"flex-start"},badge:{alignItems:"center",justifyContent:"center",flexDirection:"row"},text:{textAlign:"center",includeFontPadding:!1}});export{Badge};export default Badge;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Badge,default}from"./Badge.js";
|
|
1
|
+
"use strict";export{Badge,default}from"./Badge.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Banner=forwardRef((e,t)=>{const{title:n,message:o,variant:r="info",icon:i,actions:s,dismissible:a=!1,onDismiss:l,haptic:c,visible:d=!0,animateMount:p=!0,loading:m=!1,accessibilityRole:u="alert",accessibilityLabel:g,style:h,containerStyle:y,iconCircleStyle:b,tintBarStyle:f,closeButtonStyle:x,actionButtonStyle:S,testID:j}=e,w=useTheme(),B=useMemo(()=>buildStyles(w),[w]),R=useMemo(()=>tintFor(w,r),[w,r]),C=useRef(createAnimatedValue(p&&d?-20:0)).current,k=useRef(createAnimatedValue(p&&d?0:d?1:0)).current,[_,v]=useState(d),V=useRef(!0);if(useEffect(()=>{if(V.current&&(V.current=!1,!p))return;let e;return d?(v(!0),e=Animated.parallel([Animated.timing(C,{toValue:0,duration:w.motion.duration.normal,useNativeDriver:!0}),Animated.timing(k,{toValue:1,duration:w.motion.duration.normal,useNativeDriver:!0})]),e.start()):_&&(e=Animated.parallel([Animated.timing(C,{toValue:-20,duration:w.motion.duration.fast,useNativeDriver:!0}),Animated.timing(k,{toValue:0,duration:w.motion.duration.fast,useNativeDriver:!0})]),e.start(()=>{v(!1)})),()=>e?.stop()},[d]),!_)return null;const z=n??" ",T="string"==typeof o?o??" ":"",H="alert"===u?"error"===r?"assertive":"polite":"none",L=_jsxs(Animated.View,{ref:t,accessibilityRole:u,accessibilityLiveRegion:H,accessibilityLabel:g,testID:j,style:[B.container,{backgroundColor:w.colors.background.secondary,borderRadius:w.radius.md,...smoothCorners,padding:w.spacing.md,opacity:k,transform:[{translateY:C}]},h,y],children:[_jsx(View,{style:[B.tintBar,{backgroundColor:R.bar},f]}),_jsxs(View,{style:B.row,children:[!1===i?null:_jsx(View,i?{style:B.iconWrap,children:i}:{style:[B.iconCircle,{backgroundColor:R.bar+"22"},b],children:_jsx(Text,{style:[B.iconGlyph,{color:R.glyphColor}],accessible:!1,children:R.glyph})}),_jsxs(View,{style:B.textBlock,children:[n||m?_jsx(Text,{style:{color:w.colors.text.primary,fontSize:w.typography.fontSize.base,...fontFor(w,"semibold"),lineHeight:20},numberOfLines:2,children:z}):null,"string"==typeof o||m?_jsx(Text,{style:{color:w.colors.text.secondary,fontSize:w.typography.fontSize.sm,...fontFor(w,"normal"),lineHeight:18,marginTop:n?2:0},children:T||" "}):_jsx(View,{style:{marginTop:n?2:0},children:o})]}),a?_jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:"Dismiss banner",onPress:()=>{const e=resolveHaptic(c,"selection");e&&triggerHaptic(e),l?.()},hitSlop:8,style:({pressed:e})=>[B.closeBtn,{backgroundColor:e?w.colors.surface.pressed:"transparent"},x],children:_jsx(Text,{style:{color:w.colors.text.secondary,fontSize:w.components.banner?.closeGlyphFontSize??18,fontWeight:w.typography.fontWeight.bold,lineHeight:18},accessible:!1,children:"×"})}):null]}),s&&s.length>0?_jsx(View,{style:B.actionsRow,children:s.map((e,t)=>{const n=e.tone??"primary",o=e.variant??"ghost",r="danger"===n?w.colors.error:"neutral"===n?w.colors.text.secondary:R.glyphColor,i="danger"===n?w.colors.onError:"neutral"===n?w.colors.text.inverse:R.on,s="solid"===o;return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{const t=resolveHaptic(c,"selection");t&&triggerHaptic(t),e.onPress()},style:({pressed:t})=>[B.actionBtn,"md"===e.size&&B.actionBtnMd,"outline"===o&&{borderWidth:1,borderColor:r},{backgroundColor:s?r:t?w.colors.surface.pressed:"transparent",opacity:s&&t?.85:1},S],children:_jsx(Text,{style:{color:s?i:r,fontSize:w.typography.fontSize.sm,...fontFor(w,"semibold")},numberOfLines:1,children:e.label})},`${e.label}-${t}`)})}):null]});return m?_jsx(BannerSkeleton,{...e}):L});Banner.displayName="Banner";const BannerSkeleton=({title:e,actions:t,icon:n,containerStyle:o,style:r})=>{const i=useTheme(),s=!1!==n;return _jsxs(View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:i.colors.background.elevated,borderRadius:i.radius.md,...smoothCorners,padding:i.spacing.md,borderWidth:1,borderColor:i.colors.border.primary},o,r],accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[s?_jsx(View,{style:{marginRight:i.spacing.sm},children:_jsx(Skeleton,{shape:"circle",width:32,height:32})}):null,_jsxs(View,{style:{flex:1},children:[void 0!==e?_jsx(Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:i.spacing.xs}}):null,_jsx(SkeletonText,{lines:2,fontSize:13,lastLineWidth:"70%"}),t&&t.length>0?_jsx(View,{style:{flexDirection:"row",marginTop:i.spacing.sm},children:t.map((e,t)=>_jsx(Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:i.spacing.sm}},`sk-banner-action-${t}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",Banner.Skeleton=BannerSkeleton;const tintFor=(e,t)=>{switch(t){case"success":return{bar:e.colors.success,glyphColor:e.colors.success,on:e.colors.onSuccess,glyph:"✓"};case"warning":return{bar:e.colors.warning,glyphColor:e.colors.warning,on:e.colors.onWarning,glyph:"⚠"};case"error":return{bar:e.colors.error,glyphColor:e.colors.error,on:e.colors.onError,glyph:"✗"};case"neutral":return{bar:e.colors.text.tertiary,glyphColor:e.colors.text.secondary,on:e.colors.text.inverse,glyph:"i"};default:return{bar:e.colors.primary,glyphColor:e.colors.primary,on:e.colors.onPrimary,glyph:"i"}}},buildStyles=e=>{const t=e.components.banner?.iconCircleSize??28,n=e.components.banner?.closeButtonSize??28;return StyleSheet.create({container:{overflow:"hidden",paddingLeft:e.components.banner?.containerPaddingLeft??e.spacing.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:e.components.banner?.tintBarWidth??4},row:{flexDirection:"row",alignItems:"flex-start"},iconWrap:{marginRight:e.components.banner?.iconGap??e.spacing.sm},iconCircle:{width:t,height:t,borderRadius:e.components.banner?.iconCircleRadius??t/2,...smoothCorners,alignItems:"center",justifyContent:"center",marginRight:e.components.banner?.iconGap??e.spacing.sm},iconGlyph:{fontSize:e.components.banner?.iconGlyphFontSize??15,fontWeight:"700",lineHeight:e.components.banner?.iconGlyphLineHeight??17},textBlock:{flex:1,paddingRight:e.components.banner?.textBlockPaddingRight??e.spacing.xs},closeBtn:{width:n,height:n,borderRadius:e.components.banner?.closeButtonRadius??n/2,...smoothCorners,alignItems:"center",justifyContent:"center",marginLeft:e.components.banner?.closeButtonMarginLeft??e.spacing.xxs??4},actionsRow:{flexDirection:"row",justifyContent:"flex-end",marginTop:e.components.banner?.actionsRowMarginTop??e.spacing.xs,gap:e.components.banner?.actionsRowGap??4},actionBtn:{paddingHorizontal:e.components.banner?.actionButtonPaddingHorizontal??e.spacing.sm,paddingVertical:e.components.banner?.actionButtonPaddingVertical??6,borderRadius:e.components.banner?.actionButtonRadius??e.radius.sm,...smoothCorners,alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.spacing.md}})};export{Banner};export default Banner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Banner,default}from"./Banner.js";
|
|
1
|
+
"use strict";export{Banner,default}from"./Banner.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t,{forwardRef as e,useEffect as i,useMemo as n,useRef as o}from"react";import{Animated as r,Pressable as a,StyleSheet as l,Text as s,View as d}from"react-native";import{useSafeAreaInsets as c}from"react-native-safe-area-context";import{createAnimatedValue as u,useTheme as p}from"../../theme/index.js";import{triggerHaptic as h}from"../../utils/index.js";import{smoothCorners as g}from"../../utils/corners.js";import{supportsBoxShadow as b,toBoxShadow as m}from"../../utils/shadows.js";import{renderSlotIcon as y}from"../AppIcon/index.js";import{jsx as f,jsxs as x,Fragment as v}from"react/jsx-runtime";const w=e((e,w)=>{const{tabs:k,centerAction:R,activeTab:z,onChange:C,haptic:S="selection",showLabels:M=!0,variant:V="pill",indicatorPosition:H="bottom",radius:D,indicatorRadius:I="auto",elevation:W,iconSize:P,marginHorizontal:j,marginVertical:T,paddingHorizontal:B,paddingVertical:L,border:E,style:$,indicatorStyle:N,labelStyle:F,testID:_}=e,A=p(),X=c(),O=n(()=>buildStyles(A),[A]),q=A.components.bottomNavigation,G=P??q?.iconSize??18,J=q?.pillHeight??G+4+8,K=q?.pillMaxWidth??64,Q=q?.pillInset??16,U=q?.floatingMargin??16,Y=q?.floatingRadius??28,Z=q?.bubbleSize??48,tt=q?.bubbleLift??14,et="tile"===V,it="floating"===V||et,nt="bubble"===V,ot="expand"===V,rt="solid"===V,at="pill"===V||it||rt,lt=Math.max(0,k.findIndex(t=>t.key===z)),[st,dt]=t.useState(0),[ct,ut]=t.useState(0),pt=R?Math.ceil(k.length/2):k.length,ht=k.length+(R?1:0),[gt,bt]=t.useState({width:0,height:0}),mt=R?.size??48,yt=void 0!==R?.gap,ft=Math.max(0,R?.gap??0),xt=yt?(gt.width||mt)+2*ft:0,vt=yt?k.length>0?Math.max(0,st-xt)/k.length:0:ht>0?st/ht:0,wt=yt?xt:vt,kt=o(u(lt)).current,Rt=o({}),zt=o({});k.forEach(t=>{Rt.current[t.key]||(Rt.current[t.key]=new r.Value(1)),zt.current[t.key]||(zt.current[t.key]=u(t.key===z?1:0))});const Ct=vt>0?et?Math.min(vt-4,96):Math.min(vt-Q,K):0,St=vt>0?(vt-Ct)/2:0,Mt=vt>0?(vt-Z)/2:0,hasLabel=t=>M&&!1!==t.showLabel&&t.label.trim().length>0,Vt=k[lt],Ht=Vt&&!hasLabel(Vt)&&ct>0?ct/2:6+(G+4)/2,Dt=Ht-tt-Z/2,It=Math.max(0,ct-4),Wt=et?2:Ht-J/2,Pt=o(lt);i(()=>{if(Pt.current===lt)return;Pt.current=lt;const t=r.spring(kt,{toValue:lt,tension:120,friction:14,useNativeDriver:!0});return t.start(),()=>t.stop()},[lt,kt]);const jt=Math.max(1,k.length-1),Tt=n(()=>{const t=[],e=[];for(let i=0;i<=jt;i++)t.push(i),e.push(i<pt?i*vt:i*vt+wt);return kt.interpolate({inputRange:t,outputRange:e})},[kt,jt,pt,vt,wt]),Bt=k.map(t=>t.key).join(" "),Lt=nt||ot;i(()=>{const t=Bt.split(" ").flatMap(t=>{const e=t===z?1:0,i=zt.current[t];return i?Lt?[r.spring(i,{toValue:e,tension:140,friction:13,useNativeDriver:!1})]:(i.setValue(e),[]):[]});if(0===t.length)return;const e=r.parallel(t);return e.start(),()=>e.stop()},[z,Bt,Lt]);const popIcon=t=>{r.sequence([r.timing(t,{toValue:1.15,duration:120,useNativeDriver:!0}),r.spring(t,{toValue:1,tension:200,friction:8,useNativeDriver:!0})]).start()},Et=o(new r.Value(1)).current,{colors:$t}=A,Nt=rt?$t.primary:$t.background.elevated,Ft=rt?$t.onPrimary:$t.primary,_t=rt?$t.onPrimary:et?$t.text.primary:$t.text.tertiary,At=rt?$t.onPrimary:$t.primaryMuted,Xt=rt?$t.primary:nt?$t.onPrimary:Ft,Ot=j??U,qt=T??(it?U:0),Gt=qt>0,Jt=L??(it?6:nt?8:6),Kt=B??(it?8:4),Qt=Gt?Jt:Math.max(Jt,X.bottom),Ut=Gt?Math.max(qt,X.bottom):0,Yt="full"===D,Zt=it?ct+2*Jt+2*l.hairlineWidth:ct+Jt+Qt,te=Yt?ct>0?Zt/2:A.radius.full:D??q?.borderRadius??(et?A.radius.full:it?Y:0),ee=void 0!==D||void 0!==q?.borderRadius,activeBgRadius=(t,e)=>"number"==typeof I?Math.max(0,Math.min(I,t/2)):"auto"===I&&ee?Math.min(te,t/2):e,ie="underline"===V?Math.max(Kt,Yt&&0===ct?0:te):Kt,ne=W??"none",oe=A.shadows[ne],re="none"===ne?null:b()?{boxShadow:m(oe)}:oe,ae=E?l.hairlineWidth:0,le=rt?$t.primary:$t.border.primary,se=R?.lift??0,de=Jt+ae,ce=R&&ct>0?Math.max(0,(gt.height||mt)/2+se-ct/2-de):0,ue=R?f(d,{style:[O.centerCell,yt?{flex:0,marginHorizontal:ft}:null],pointerEvents:"box-none",children:f(a,{onPress:()=>{if(!R)return;const t=R.haptic??S;!1!==t&&h(t),popIcon(Et),R.onPress()},onLayout:t=>{const{width:e,height:i}=t.nativeEvent.layout;bt(t=>t.width===e&&t.height===i?t:{width:e,height:i})},accessibilityRole:"button",accessibilityLabel:R.label,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:t})=>[{top:-se},t?{opacity:.85}:null],testID:R.testID??(_?`${_}-center`:void 0),children:R.content?f(r.View,{style:{transform:[{scale:Et}]},children:R.content}):f(d,{style:[O.centerCircle,{width:mt,height:mt,borderRadius:mt/2,...g,backgroundColor:R.color??$t.primary}],children:f(r.View,{style:{transform:[{scale:Et}]},children:y(R.icon??"add",{color:R.iconColor??$t.onPrimary,size:R.iconSize??24,disabled:!1})})})})},"__webority_center_action__"):null,pe=x(d,{style:O.tabRow,onLayout:t=>{const{width:e,height:i}=t.nativeEvent.layout;dt(e),ut(i)},children:[at&&Ct>0&&(!et||It>0)?f(r.View,{pointerEvents:"none",style:[O.pill,{width:Ct,height:et?It:J,left:St,top:Wt,backgroundColor:At,borderRadius:et?activeBgRadius(It,It/2):activeBgRadius(J,A.radius.full),...g,transform:[{translateX:Tt}]},N]}):null,nt&&vt>0?f(r.View,{pointerEvents:"none",style:[O.bubble,A.shadows.md,{width:Z,height:Z,borderRadius:Z/2,...g,left:Mt,top:Dt,backgroundColor:$t.primary,borderColor:$t.background.elevated,transform:[{translateX:Tt}]},N]}):null,(he=k.map(t=>{const e=t.key===z,i=e?Ft:_t,n=e?Xt:_t,o="string"==typeof t.icon?{name:t.icon,variant:"bold"}:t.icon,l=e?t.activeIcon??o:t.icon,c=Rt.current[t.key],u=zt.current[t.key],p=null==(b=t.badge??null)||!1===b?null:!0===b||"·"===b?{text:"",isDot:!0}:"number"==typeof b?b<=0?null:{text:b>99?"99+":String(b),isDot:!1}:"string"==typeof b?0===b.length?null:{text:b,isDot:!1}:null;var b;const m=(t=>null==t||!1===t?"":"number"==typeof t?t>0?`, ${t} unread`:"":!0===t||"·"===t?", new updates":"string"==typeof t&&t.length>0?`, ${t}`:"")(t.badge??null),w=rt&&!e?.7:1,k=nt&&e||rt?$t.primary:$t.background.elevated,R=hasLabel(t),M=R&&(!ot||e),V=x(r.View,{style:[O.iconWrap,{width:G+4,height:G+4,opacity:w,transform:[{scale:c}]}],children:[y(l,{color:n,size:G,focused:e,disabled:!1}),p?f(d,{style:[p.isDot?O.badgeDot:O.badgePill,{backgroundColor:$t.error,borderColor:k}],children:p.isDot?null:f(s,{style:[O.badgeText,{color:$t.onError}],numberOfLines:1,children:p.text})}):null]}),H=nt?f(r.View,{style:{top:u.interpolate({inputRange:[0,1],outputRange:[0,-tt]})},children:V}):V,D=M?f(r.Text,{numberOfLines:1,style:[O.label,ot?O.labelInline:null,{color:i,opacity:ot?u:w,fontWeight:e?A.typography.fontWeight.semibold:A.typography.fontWeight.normal},F],children:t.label}):null,I=f(a,{onPress:()=>(t=>{t.key!==z&&!1!==S&&h(S);const e=Rt.current[t.key];e&&popIcon(e),C(t.key)})(t),accessibilityRole:"tab",accessibilityState:{selected:e},accessibilityLabel:`${t.label}${m}`,accessibilityHint:`Switches to ${t.label}`,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:t})=>[O.tab,et?O.tabTile:null,t?{opacity:.85}:null],testID:_?`${_}-tab-${t.key}`:void 0,children:ot?x(d,{style:[O.expandPill,{height:J,paddingHorizontal:e&&R?A.spacing.md:Math.max(0,(J-(G+4))/2)}],children:[f(d,{pointerEvents:"none",style:[O.expandFill,{borderRadius:activeBgRadius(J,J/2),...g,backgroundColor:e?$t.primaryMuted:"transparent"},e?N:null]}),H,D]}):x(v,{children:[H,D]})},t.key);return ot?f(r.View,{style:{flex:u.interpolate({inputRange:[0,1],outputRange:[1,R?1.5:1]})},children:I},t.key):I}),ue?[...he.slice(0,pt),ue,...he.slice(pt)]:he),"underline"===V&&vt>0?f(r.View,{pointerEvents:"none",style:[O.underline,"top"===H?O.underlineTop:O.underlineBottom,"top"===H?{top:-Jt}:{bottom:-Jt},{width:vt,height:q?.underlineHeight??3,backgroundColor:$t.primary,transform:[{translateX:Tt}]},N]}):null]});var he;return f(d,{ref:w,testID:_,accessibilityRole:"tablist",style:[O.outer,{paddingHorizontal:Ot,paddingTop:Math.max(qt,ce),paddingBottom:Ut},$],children:f(d,{style:[it?O.floatingBar:O.dockedBar,re,{backgroundColor:Nt,borderColor:le,borderRadius:te,...g},it?{borderWidth:ae,paddingHorizontal:Kt,paddingVertical:Jt}:{borderTopWidth:ae,borderBottomWidth:ae,borderLeftWidth:ae,borderRightWidth:ae,paddingHorizontal:ie,paddingTop:Jt,paddingBottom:Qt}],children:pe})})});w.displayName="BottomNavigation";const buildStyles=t=>l.create({outer:{backgroundColor:"transparent"},dockedBar:{paddingHorizontal:4},floatingBar:{paddingVertical:6,paddingHorizontal:8},tabRow:{flexDirection:"row",alignItems:"stretch",position:"relative"},tab:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center",paddingVertical:6,gap:4},tabTile:{paddingVertical:8,gap:2},centerCell:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center"},centerCircle:{alignItems:"center",justifyContent:"center"},iconWrap:{alignItems:"center",justifyContent:"center",position:"relative"},label:{fontSize:t.typography.fontSize.xs,lineHeight:t.typography.fontSize.xs*t.typography.lineHeight.tight,textAlign:"center",includeFontPadding:!1},labelInline:{fontSize:t.typography.fontSize.sm,lineHeight:t.typography.fontSize.sm*t.typography.lineHeight.tight,flexShrink:1,includeFontPadding:!1},expandPill:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:t.spacing.xs},expandFill:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden"},pill:{position:"absolute",left:0},bubble:{position:"absolute",left:0,borderWidth:3},underline:{position:"absolute",left:0,height:3},underlineBottom:{borderTopLeftRadius:2,borderTopRightRadius:2,...g},underlineTop:{borderBottomLeftRadius:2,borderBottomRightRadius:2,...g},badgePill:{position:"absolute",top:-4,right:-8,minWidth:18,height:18,borderRadius:9,...g,paddingHorizontal:4,paddingVertical:2,alignItems:"center",justifyContent:"center",borderWidth:1.5},badgeDot:{position:"absolute",top:-2,right:-2,width:10,height:10,borderRadius:5,...g,borderWidth:1.5},badgeText:{fontSize:10,fontWeight:"700",lineHeight:12,textAlign:"center",includeFontPadding:!1}});export{w as BottomNavigation};export default w;
|
|
1
|
+
"use strict";import React,{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{supportsBoxShadow,toBoxShadow}from"../../utils/shadows.js";import{renderSlotIcon}from"../AppIcon/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const DEFAULT_ICON_SIZE=18,ICON_WRAP_AIR=4,PILL_AIR=8,DEFAULT_PILL_MAX_WIDTH=64,TILE_MAX_WIDTH=96,DEFAULT_PILL_INSET=16,DEFAULT_UNDERLINE_HEIGHT=3,DEFAULT_FLOATING_MARGIN=16,DEFAULT_FLOATING_RADIUS=28,DEFAULT_BUBBLE_SIZE=48,DEFAULT_BUBBLE_LIFT=14,DEFAULT_CENTER_SIZE=48,DEFAULT_CENTER_ICON_SIZE=24,CENTER_KEY="__webority_center_action__",TAB_PADDING_VERTICAL=6,BAR_PADDING_HORIZONTAL=4,BAR_PADDING_TOP=6,BAR_PADDING_TOP_BUBBLE=8,FLOATING_BAR_PADDING_VERTICAL=6,FLOATING_BAR_PADDING_HORIZONTAL=8,EXPANDED_FLEX=1.5,SOLID_INACTIVE_OPACITY=.7,TILE_INSET=2,TILE_LABEL_GAP=2,formatBadge=e=>null==e||!1===e?null:!0===e||"·"===e?{text:"",isDot:!0}:"number"==typeof e?e<=0?null:{text:e>99?"99+":String(e),isDot:!1}:"string"==typeof e?0===e.length?null:{text:e,isDot:!1}:null,badgeAccessibilitySuffix=e=>null==e||!1===e?"":"number"==typeof e?e>0?`, ${e} unread`:"":!0===e||"·"===e?", new updates":"string"==typeof e&&e.length>0?`, ${e}`:"",BottomNavigation=forwardRef((e,t)=>{const{tabs:i,centerAction:o,activeTab:n,onChange:r,haptic:a="selection",showLabels:l=!0,variant:s="pill",indicatorPosition:d="bottom",radius:c,indicatorRadius:u="auto",elevation:h,iconSize:p,marginHorizontal:g,marginVertical:m,paddingHorizontal:b,paddingVertical:y,border:f,style:x,indicatorStyle:_,labelStyle:A,testID:I}=e,R=useTheme(),E=useSafeAreaInsets(),T=useMemo(()=>buildStyles(R),[R]),S=R.components.bottomNavigation,w=p??S?.iconSize??18,L=S?.pillHeight??w+4+8,D=S?.pillMaxWidth??64,C=S?.pillInset??16,v=S?.floatingMargin??16,j=S?.floatingRadius??28,B=S?.bubbleSize??48,N=S?.bubbleLift??14,V="tile"===s,P="floating"===s||V,k="bubble"===s,H="expand"===s,M="solid"===s,z="pill"===s||P||M,F=Math.max(0,i.findIndex(e=>e.key===n)),[W,O]=React.useState(0),[U,G]=React.useState(0),$=o?Math.ceil(i.length/2):i.length,X=i.length+(o?1:0),[Z,Y]=React.useState({width:0,height:0}),K=o?.size??48,q=void 0!==o?.gap,J=Math.max(0,o?.gap??0),Q=q?(Z.width||K)+2*J:0,ee=q?i.length>0?Math.max(0,W-Q)/i.length:0:X>0?W/X:0,te=q?Q:ee,ie=useRef(createAnimatedValue(F)).current,oe=useRef({}),ne=useRef({});i.forEach(e=>{oe.current[e.key]||(oe.current[e.key]=new Animated.Value(1)),ne.current[e.key]||(ne.current[e.key]=createAnimatedValue(e.key===n?1:0))});const re=ee>0?V?Math.min(ee-4,96):Math.min(ee-C,D):0,ae=ee>0?(ee-re)/2:0,le=ee>0?(ee-B)/2:0,hasLabel=e=>l&&!1!==e.showLabel&&e.label.trim().length>0,se=i[F],de=se&&!hasLabel(se)&&U>0?U/2:6+(w+4)/2,ce=de-N-B/2,ue=Math.max(0,U-4),he=V?2:de-L/2,pe=useRef(F);useEffect(()=>{if(pe.current===F)return;pe.current=F;const e=Animated.spring(ie,{toValue:F,tension:120,friction:14,useNativeDriver:!0});return e.start(),()=>e.stop()},[F,ie]);const ge=Math.max(1,i.length-1),me=useMemo(()=>{const e=[],t=[];for(let i=0;i<=ge;i++)e.push(i),t.push(i<$?i*ee:i*ee+te);return ie.interpolate({inputRange:e,outputRange:t})},[ie,ge,$,ee,te]),be=i.map(e=>e.key).join(" "),ye=k||H;useEffect(()=>{const e=be.split(" ").flatMap(e=>{const t=e===n?1:0,i=ne.current[e];return i?ye?[Animated.spring(i,{toValue:t,tension:140,friction:13,useNativeDriver:!1})]:(i.setValue(t),[]):[]});if(0===e.length)return;const t=Animated.parallel(e);return t.start(),()=>t.stop()},[n,be,ye]);const popIcon=e=>{Animated.sequence([Animated.timing(e,{toValue:1.15,duration:120,useNativeDriver:!0}),Animated.spring(e,{toValue:1,tension:200,friction:8,useNativeDriver:!0})]).start()},fe=useRef(new Animated.Value(1)).current,{colors:xe}=R,_e=M?xe.primary:xe.background.elevated,Ae=M?xe.onPrimary:xe.primary,Ie=M?xe.onPrimary:V?xe.text.primary:xe.text.tertiary,Re=M?xe.onPrimary:xe.primaryMuted,Ee=M?xe.primary:k?xe.onPrimary:Ae,Te=g??v,Se=m??(P?v:0),we=Se>0,Le=y??(P?6:k?8:6),De=b??(P?8:4),Ce=we?Le:Math.max(Le,E.bottom),ve=we?Math.max(Se,E.bottom):0,je="full"===c,Be=P?U+2*Le+2*StyleSheet.hairlineWidth:U+Le+Ce,Ne=je?U>0?Be/2:R.radius.full:c??S?.borderRadius??(V?R.radius.full:P?j:0),Ve=void 0!==c||void 0!==S?.borderRadius,activeBgRadius=(e,t)=>"number"==typeof u?Math.max(0,Math.min(u,e/2)):"auto"===u&&Ve?Math.min(Ne,e/2):t,Pe="underline"===s?Math.max(De,je&&0===U?0:Ne):De,ke=h??"none",He=R.shadows[ke],Me="none"===ke?null:supportsBoxShadow()?{boxShadow:toBoxShadow(He)}:He,ze=f?StyleSheet.hairlineWidth:0,Fe=M?xe.primary:xe.border.primary,We=o?.lift??0,Oe=Le+ze,Ue=o&&U>0?Math.max(0,(Z.height||K)/2+We-U/2-Oe):0,Ge=o?_jsx(View,{style:[T.centerCell,q?{flex:0,marginHorizontal:J}:null],pointerEvents:"box-none",children:_jsx(Pressable,{onPress:()=>{if(!o)return;const e=o.haptic??a;!1!==e&&triggerHaptic(e),popIcon(fe),o.onPress()},onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;Y(e=>e.width===t&&e.height===i?e:{width:t,height:i})},accessibilityRole:"button",accessibilityLabel:o.label,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:e})=>[{top:-We},e?{opacity:.85}:null],testID:o.testID??(I?`${I}-center`:void 0),children:o.content?_jsx(Animated.View,{style:{transform:[{scale:fe}]},children:o.content}):_jsx(View,{style:[T.centerCircle,{width:K,height:K,borderRadius:K/2,...smoothCorners,backgroundColor:o.color??xe.primary}],children:_jsx(Animated.View,{style:{transform:[{scale:fe}]},children:renderSlotIcon(o.icon??"add",{color:o.iconColor??xe.onPrimary,size:o.iconSize??24,disabled:!1})})})})},CENTER_KEY):null,$e=_jsxs(View,{style:T.tabRow,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;O(t),G(i)},children:[z&&re>0&&(!V||ue>0)?_jsx(Animated.View,{pointerEvents:"none",style:[T.pill,{width:re,height:V?ue:L,left:ae,top:he,backgroundColor:Re,borderRadius:V?activeBgRadius(ue,ue/2):activeBgRadius(L,R.radius.full),...smoothCorners,transform:[{translateX:me}]},_]}):null,k&&ee>0?_jsx(Animated.View,{pointerEvents:"none",style:[T.bubble,R.shadows.md,{width:B,height:B,borderRadius:B/2,...smoothCorners,left:le,top:ce,backgroundColor:xe.primary,borderColor:xe.background.elevated,transform:[{translateX:me}]},_]}):null,(Xe=i.map(e=>{const t=e.key===n,i=t?Ae:Ie,o=t?Ee:Ie,l="string"==typeof e.icon?{name:e.icon,variant:"bold"}:e.icon,s=t?e.activeIcon??l:e.icon,d=oe.current[e.key],c=ne.current[e.key],u=formatBadge(e.badge??null),h=badgeAccessibilitySuffix(e.badge??null),p=M&&!t?.7:1,g=k&&t||M?xe.primary:xe.background.elevated,m=hasLabel(e),b=m&&(!H||t),y=_jsxs(Animated.View,{style:[T.iconWrap,{width:w+4,height:w+4,opacity:p,transform:[{scale:d}]}],children:[renderSlotIcon(s,{color:o,size:w,focused:t,disabled:!1}),u?_jsx(View,{style:[u.isDot?T.badgeDot:T.badgePill,{backgroundColor:xe.error,borderColor:g}],children:u.isDot?null:_jsx(Text,{style:[T.badgeText,{color:xe.onError}],numberOfLines:1,children:u.text})}):null]}),f=k?_jsx(Animated.View,{style:{top:c.interpolate({inputRange:[0,1],outputRange:[0,-N]})},children:y}):y,x=b?_jsx(Animated.Text,{numberOfLines:1,style:[T.label,H?T.labelInline:null,{color:i,opacity:H?c:p,fontWeight:t?R.typography.fontWeight.semibold:R.typography.fontWeight.normal},A],children:e.label}):null,E=_jsx(Pressable,{onPress:()=>(e=>{e.key!==n&&!1!==a&&triggerHaptic(a);const t=oe.current[e.key];t&&popIcon(t),r(e.key)})(e),accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`${e.label}${h}`,accessibilityHint:`Switches to ${e.label}`,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:e})=>[T.tab,V?T.tabTile:null,e?{opacity:.85}:null],testID:I?`${I}-tab-${e.key}`:void 0,children:H?_jsxs(View,{style:[T.expandPill,{height:L,paddingHorizontal:t&&m?R.spacing.md:Math.max(0,(L-(w+4))/2)}],children:[_jsx(View,{pointerEvents:"none",style:[T.expandFill,{borderRadius:activeBgRadius(L,L/2),...smoothCorners,backgroundColor:t?xe.primaryMuted:"transparent"},t?_:null]}),f,x]}):_jsxs(_Fragment,{children:[f,x]})},e.key);return H?_jsx(Animated.View,{style:{flex:c.interpolate({inputRange:[0,1],outputRange:[1,m?1.5:1]})},children:E},e.key):E}),Ge?[...Xe.slice(0,$),Ge,...Xe.slice($)]:Xe),"underline"===s&&ee>0?_jsx(Animated.View,{pointerEvents:"none",style:[T.underline,"top"===d?T.underlineTop:T.underlineBottom,"top"===d?{top:-Le}:{bottom:-Le},{width:ee,height:S?.underlineHeight??3,backgroundColor:xe.primary,transform:[{translateX:me}]},_]}):null]});var Xe;return _jsx(View,{ref:t,testID:I,accessibilityRole:"tablist",style:[T.outer,{paddingHorizontal:Te,paddingTop:Math.max(Se,Ue),paddingBottom:ve},x],children:_jsx(View,{style:[P?T.floatingBar:T.dockedBar,Me,{backgroundColor:_e,borderColor:Fe,borderRadius:Ne,...smoothCorners},P?{borderWidth:ze,paddingHorizontal:De,paddingVertical:Le}:{borderTopWidth:ze,borderBottomWidth:ze,borderLeftWidth:ze,borderRightWidth:ze,paddingHorizontal:Pe,paddingTop:Le,paddingBottom:Ce}],children:$e})})});BottomNavigation.displayName="BottomNavigation";const buildStyles=e=>StyleSheet.create({outer:{backgroundColor:"transparent"},dockedBar:{paddingHorizontal:4},floatingBar:{paddingVertical:6,paddingHorizontal:8},tabRow:{flexDirection:"row",alignItems:"stretch",position:"relative"},tab:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center",paddingVertical:6,gap:4},tabTile:{paddingVertical:8,gap:2},centerCell:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center"},centerCircle:{alignItems:"center",justifyContent:"center"},iconWrap:{alignItems:"center",justifyContent:"center",position:"relative"},label:{fontSize:e.typography.fontSize.xs,lineHeight:e.typography.fontSize.xs*e.typography.lineHeight.tight,textAlign:"center",includeFontPadding:!1},labelInline:{fontSize:e.typography.fontSize.sm,lineHeight:e.typography.fontSize.sm*e.typography.lineHeight.tight,flexShrink:1,includeFontPadding:!1},expandPill:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:e.spacing.xs},expandFill:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden"},pill:{position:"absolute",left:0},bubble:{position:"absolute",left:0,borderWidth:3},underline:{position:"absolute",left:0,height:3},underlineBottom:{borderTopLeftRadius:2,borderTopRightRadius:2,...smoothCorners},underlineTop:{borderBottomLeftRadius:2,borderBottomRightRadius:2,...smoothCorners},badgePill:{position:"absolute",top:-4,right:-8,minWidth:18,height:18,borderRadius:9,...smoothCorners,paddingHorizontal:4,paddingVertical:2,alignItems:"center",justifyContent:"center",borderWidth:1.5},badgeDot:{position:"absolute",top:-2,right:-2,width:10,height:10,borderRadius:5,...smoothCorners,borderWidth:1.5},badgeText:{fontSize:10,fontWeight:"700",lineHeight:12,textAlign:"center",includeFontPadding:!1}});export{BottomNavigation};export default BottomNavigation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{BottomNavigation,default}from"./BottomNavigation.js";
|
|
1
|
+
"use strict";export{BottomNavigation,default}from"./BottomNavigation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{createContext,forwardRef,useCallback,useContext,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{Dimensions,Modal,Platform,ScrollView,StyleSheet,useWindowDimensions,View}from"react-native";import{Gesture,GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import{useReanimatedKeyboardAnimation}from"react-native-keyboard-controller";import Animated,{Easing,runOnJS,useAnimatedStyle,useDerivedValue,useSharedValue,withSpring,withTiming}from"react-native-reanimated";import{SafeAreaProvider,useSafeAreaInsets}from"react-native-safe-area-context";import{useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{ToastHost}from"../Toast/ToastProvider.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const TABLET_MIN_SHORT_SIDE=600,DIALOG_MAX_WIDTH=560,BottomSheetContext=createContext(null);export const useBottomSheet=()=>{const e=useContext(BottomSheetContext);if(!e)throw new Error("useBottomSheet must be used inside a <BottomSheet>.");return e};const SPRING_CONFIG={damping:20,stiffness:240,mass:1},CLOSE_VELOCITY_THRESHOLD=1e3,DRAG_ACTIVATION_OFFSET=10,BottomSheet=forwardRef((e,t)=>{const{snapPoints:o,index:s,onChange:n,onAnimate:a,onAfterClose:r,enablePanDownToClose:i=!0,enableBackdropPress:l=!0,scrollable:u=!1,scrollRef:c,onScroll:d,onContentSizeChange:h,onScrollLayout:m,scrollEventThrottle:b,keyboardBehavior:f="shift",mode:S="modal",presentation:g="sheet",handleIndicatorStyle:p,containerStyle:v,header:y,footer:w,headerStyle:x,footerStyle:C,children:k,accessibilityLabel:_,accessibilityViewIsModal:I,testID:R}=e,j=useTheme(),T=useSafeAreaInsets(),[M,O]=useState(()=>Dimensions.get("window").height),[V,D]=useState(()=>Dimensions.get("window").width),A=useCallback(e=>{const{height:t,width:o}=e.nativeEvent.layout;t>0&&O(e=>e===t?e:t),o>0&&D(e=>e===o?e:o)},[]),H=useWindowDimensions(),B="dialog"===g||"auto"===g&&Math.min(H.width,H.height)>=600,E=Math.min(560,V-2*j.spacing.xl),[P,G]=useState({top:T.top,bottom:T.bottom}),L="modal"===S?P.top:T.top,N="modal"===S?P.bottom:T.bottom,J=o.includes("content"),[F,z]=useMeasuredHeight(),[Y,$]=useMeasuredHeight(),[W,K,X]=useMeasuredHeight(),[q,U]=useMeasuredHeight(),Q=B?j.spacing.md:F,Z=J?Math.min(Q+(null!=y?Y:0)+W+(null!=w?q:0)+N,M-L):0,ee=useCallback((e,t)=>{J&&X(t),h?.(e,t)},[J,h,X]),te=useMemo(()=>resolveSnapPoints(o,M,Z),[o,M,Z]),oe=M,se=te[te.length-1]??0,ne=useSharedValue(oe),ae=useSharedValue(oe),re=useSharedValue(-1),[ie,le]=useState(-1),ue=useRef(!1),[ce,de]=useState(!1),[he,me]=useState(!1),be=useRef(!1),fe=useRef(r);fe.current=r;const[Se,ge]=useState(!1),pe=useCallback(e=>{if(e<0||e>=te.length)return oe;const t=te[e];return B?(M-t)/2:M-t},[te,M,oe,B]),ve=useCallback(e=>{ie!==e&&(le(e),re.value=e,n?.(e))},[ie,re,n]),ye=useCallback(()=>{ue.current=!1,re.value<0&&(be.current=!0,"modal"===S?(de(!1),"ios"!==Platform.OS&&me(!1)):ge(!1))},[S,re]),we=useCallback(()=>{be.current&&me(!1)},[]);useEffect(()=>{("modal"===S?!he:!Se)&&be.current&&(be.current=!1,fe.current?.())},[S,he,Se]);const xe=useCallback((e,t,o)=>{ue.current=!0,a?.(t,o),ne.value=withSpring(e,SPRING_CONFIG,e=>{"worklet";e&&runOnJS(ye)()})},[a,ne,ye]),Ce=useCallback(e=>{const t="number"==typeof e?clamp(e,0,te.length-1):ie>=0?ie:0,o=re.value,s=pe(t);be.current=!1,"modal"===S?(me(!0),de(!0)):ge(!0),o<0&&(ne.value=oe),ve(t),xe(s,o,t)},[xe,oe,ie,re,S,te.length,ve,ne,pe]),ke=useCallback(()=>{if(0===te.length)return;const e=re.value,t=pe(0);ve(0),xe(t,e,0)},[xe,re,te.length,ve,pe]),_e=useCallback(()=>{const e=re.value;ve(-1),ue.current=!0,a?.(e,-1),ne.value=withTiming(oe,{duration:j.motion.duration.fast,easing:Easing.bezier(...j.motion.easing.accelerate)},e=>{"worklet";e&&runOnJS(ye)()})},[oe,re,ye,a,ve,ne,j.motion.duration.fast,j.motion.easing.accelerate]);useImperativeHandle(t,()=>({expand:Ce,collapse:ke,close:_e}),[Ce,ke,_e]),useEffect(()=>{"number"==typeof s&&s!==ie&&(-1===s?_e():Ce(s))},[s]);const Ie=useRef({hostHeight:M,contentSnap:Z});useEffect(()=>{const e=Ie.current;e.hostHeight===M&&e.contentSnap===Z||(Ie.current={hostHeight:M,contentSnap:Z},e.hostHeight===M&&re.value<0||(ne.value=withSpring(pe(re.value),SPRING_CONFIG)))},[M,Z]);const Re=M-se,je=useMemo(()=>te.map(e=>M-e),[te,M]),Te=useCallback((e,t)=>{const o=re.value;if(-1===e)return triggerHaptic("selection"),ve(-1),ue.current=!0,a?.(o,-1),void(ne.value=withTiming(oe,{duration:j.motion.duration.fast,easing:Easing.bezier(...j.motion.easing.accelerate)},e=>{"worklet";e&&runOnJS(ye)()}));ve(e),xe(t,o,e)},[xe,oe,re,ye,a,ve,ne,j.motion.duration.fast,j.motion.easing.accelerate]),Me=useMemo(()=>Gesture.Native().withTestId(R?`${R}-content-gesture`:"bottom-sheet-content-gesture"),[R]),Oe=useMemo(()=>{const e=je,t=oe,o=Re,s=i;return Gesture.Pan().withTestId(R?`${R}-pan-gesture`:"bottom-sheet-pan-gesture").activeOffsetY([-10,10]).failOffsetX([-15,15]).onStart(()=>{"worklet";ae.value=ne.value}).onUpdate(e=>{"worklet";const t=ae.value+e.translationY;ne.value=t<o?o+.25*(t-o):t}).onEnd(o=>{"worklet";const n=ne.value;if(o.velocityY>1e3)return s?void runOnJS(Te)(-1,t):void runOnJS(Te)(0,e[0]);let a=0,r=Math.abs(n-e[0]);for(let t=1;t<e.length;t++){const o=Math.abs(n-e[t]);o<r&&(r=o,a=t)}const i=e[0];s&&n-i>80?runOnJS(Te)(-1,t):runOnJS(Te)(a,e[a])})},[oe,ae,i,Te,Re,je,R,ne]),{height:Ve}=useReanimatedKeyboardAnimation(),De="shift"===f,Ae=useDerivedValue(()=>De?Ve.value:0),He=te[ie>=0?ie:0]??se,Be=j.spacing.md,Ee=useAnimatedStyle(()=>{if(B){const e=Ae.value,t=M+e-He-Be,o=e<0&&ne.value>t?t:ne.value;return{top:o<L?L:o}}const e=ne.value+Ae.value,t=Ae.value<0?L:Re;return{top:e<t?t:e}}),Pe=useAnimatedStyle(()=>{const e=Ae.value;if(B){const t=M+e-He-Be,o=e<0&&ne.value>t?t:ne.value,s=M+e-Be-(o<L?L:o);return{height:s<0?0:s>He?He:s}}const t=e<0?L:Re,o=ne.value+e,s=M+e-(o<t?t:o);return{height:s<0?0:s>se?se:s}}),Ge=ie>=0,Le=useMemo(()=>buildStyles(j),[j]),Ne=useCallback(()=>{l&&(triggerHaptic("selection"),_e())},[l,_e]),Je=useMemo(()=>Gesture.Tap().withTestId(R?`${R}-backdrop-gesture`:"bottom-sheet-backdrop-gesture").maxDuration(250).onEnd((e,t)=>{"worklet";t&&runOnJS(Ne)()}),[Ne,R]),Fe=useMemo(()=>({snapIndex:ie,snapPoints:te,expand:Ce,collapse:ke,close:_e}),[ie,te,Ce,ke,_e]);if("inline"===S&&!Se)return null;if("modal"===S&&!he)return null;const ze=_jsxs(View,{collapsable:!1,style:["modal"===S?Le.backdropModal:Le.backdropInline,{backgroundColor:j.colors.background.overlay}],onLayout:A,testID:R,accessibilityViewIsModal:I??Ge,children:[_jsx(GestureDetector,{gesture:Je,children:_jsx(Animated.View,{style:StyleSheet.absoluteFill,accessibilityRole:"button",accessibilityLabel:"Close bottom sheet"})}),_jsx(Animated.View,{accessibilityRole:"alert",accessibilityLabel:_,accessibilityViewIsModal:I??Ge,style:[Le.sheet,{height:se,backgroundColor:j.colors.background.elevated,borderTopLeftRadius:j.radius["2xl"],borderTopRightRadius:j.radius["2xl"],...smoothCorners,...j.shadows.xl},B?{height:He,left:(V-E)/2,right:void 0,width:E,borderBottomLeftRadius:j.radius["2xl"],borderBottomRightRadius:j.radius["2xl"]}:null,v,Ee],children:_jsxs(SheetBody,{style:[Le.body,Pe],keyboardOffset:Ae,children:[B?_jsx(View,{style:{height:j.spacing.md}}):_jsx(GestureDetector,{gesture:Oe,children:_jsx(View,{style:Le.handleRow,onLayout:J?z:void 0,accessible:!0,accessibilityLabel:"Drag handle",accessibilityHint:"Drag up or down to resize the sheet, or swipe down to close it",testID:R?`${R}-handle`:"bottom-sheet-handle",children:_jsx(View,{style:[Le.handle,{backgroundColor:j.components.bottomSheet?.handleColor??j.colors.border.primary},p]})})}),null!=y&&_jsx(View,{style:[Le.header,x],onLayout:J?$:void 0,children:y}),u?_jsx(GestureDetector,{gesture:Me,children:_jsx(ScrollView,{ref:c,style:Le.content,onScroll:d,onContentSizeChange:ee,onLayout:m,scrollEventThrottle:b,keyboardShouldPersistTaps:"always",keyboardDismissMode:"none",children:k})}):_jsx(View,{style:Le.content,children:J?_jsx(View,{onLayout:K,children:k}):k}),null!=w&&_jsx(View,{style:[Le.footer,C],onLayout:J?U:void 0,children:w})]})})]}),Ye=_jsx(BottomSheetContext.Provider,{value:Fe,children:ze});return"modal"===S?_jsx(Modal,{transparent:!0,visible:ce,onRequestClose:_e,onDismiss:"ios"===Platform.OS?we:void 0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",supportedOrientations:["portrait","landscape"],children:_jsxs(SafeAreaProvider,{style:Le.modalRoot,children:[_jsx(InsetsProbe,{onChange:G}),"android"===Platform.OS?_jsx(GestureHandlerRootView,{style:Le.modalRoot,children:Ye}):Ye,_jsx(ToastHost,{})]})}):Ye}),InsetsProbe=({onChange:e})=>{const{top:t,bottom:o}=useSafeAreaInsets();return useEffect(()=>{e(e=>e.top===t&&e.bottom===o?e:{top:t,bottom:o})},[t,o,e]),null},SheetBody=({style:e,keyboardOffset:t,children:o})=>{const s=useSafeAreaInsets().bottom,n=useAnimatedStyle(()=>{const e=s+t.value;return{paddingBottom:e>0?e:0}});return _jsx(Animated.View,{style:[e,n],children:o})};BottomSheet.displayName="BottomSheet";const useMeasuredHeight=()=>{const[e,t]=useState(0),o=useCallback(e=>{t(t=>t===e?t:e)},[]);return[e,useCallback(e=>o(e.nativeEvent.layout.height),[o]),o]},resolveSnapPoints=(e,t,o)=>[...e.map(e=>{if("number"==typeof e)return e;if("content"===e)return o;const s=parseFloat(e);return Number.isNaN(s)?0:s/100*t})].sort((e,t)=>e-t),clamp=(e,t,o)=>Math.min(Math.max(e,t),o),buildStyles=e=>StyleSheet.create({backdropModal:{flex:1},backdropInline:{...StyleSheet.absoluteFill},sheet:{position:"absolute",left:0,right:0,overflow:"hidden"},body:{overflow:"hidden"},handleRow:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingTop:12,paddingBottom:24},header:{},footer:{},handle:{width:36,height:4,borderRadius:2,...smoothCorners},content:{flex:1,overflow:"hidden"},modalRoot:{flex:1}});export{BottomSheet};export default BottomSheet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{BottomSheet,default,useBottomSheet}from"./BottomSheet.js";
|
|
1
|
+
"use strict";export{BottomSheet,default,useBottomSheet}from"./BottomSheet.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef}from"react";import{View}from"react-native";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const space=(r,e)=>null==e?void 0:r.spacing[e];export const resolveBoxStyle=(r,e)=>{const l={};if(null!=e.p&&(l.padding=space(r,e.p)),null!=e.px&&(l.paddingHorizontal=space(r,e.px)),null!=e.py&&(l.paddingVertical=space(r,e.py)),null!=e.pt&&(l.paddingTop=space(r,e.pt)),null!=e.pr&&(l.paddingRight=space(r,e.pr)),null!=e.pb&&(l.paddingBottom=space(r,e.pb)),null!=e.pl&&(l.paddingLeft=space(r,e.pl)),null!=e.m&&(l.margin=space(r,e.m)),null!=e.mx&&(l.marginHorizontal=space(r,e.mx)),null!=e.my&&(l.marginVertical=space(r,e.my)),null!=e.mt&&(l.marginTop=space(r,e.mt)),null!=e.mr&&(l.marginRight=space(r,e.mr)),null!=e.mb&&(l.marginBottom=space(r,e.mb)),null!=e.ml&&(l.marginLeft=space(r,e.ml)),null!=e.gap&&(l.gap=space(r,e.gap)),null!=e.bg){const o=r.colors.background;l.backgroundColor=o[e.bg]??e.bg}return null!=e.radius&&(l.borderRadius=r.radius[e.radius],l.borderCurve=smoothCorners.borderCurve),e.border&&(l.borderWidth=r.colors.border.width,l.borderColor=r.colors.border.primary),null!=e.flex&&(l.flex=e.flex),null!=e.align&&(l.alignItems=e.align),null!=e.justify&&(l.justifyContent=e.justify),null!=e.direction&&(l.flexDirection=e.direction),e.wrap&&(l.flexWrap="wrap"),l};const Box=forwardRef((r,e)=>{const l=useTheme(),{p:o,px:t,py:a,pt:i,pr:s,pb:n,pl:p,m:c,mx:d,my:u,mt:m,mr:g,mb:x,ml:f,gap:b,bg:y,radius:h,border:w,flex:j,align:S,justify:R,direction:B,wrap:C,style:k,children:v,..._}=r,q=resolveBoxStyle(l,{p:o,px:t,py:a,pt:i,pr:s,pb:n,pl:p,m:c,mx:d,my:u,mt:m,mr:g,mb:x,ml:f,gap:b,bg:y,radius:h,border:w,flex:j,align:S,justify:R,direction:B,wrap:C}),z=useSquircle(null!=h&&(null!=y||Boolean(w)),q.borderRadius,_.onLayout),V=z.active?{...q,backgroundColor:"transparent",borderColor:"transparent"}:q;return _jsxs(View,{ref:e,..._,onLayout:z.onLayout,style:[V,k],children:[z.active&&z.size?_jsx(SquircleFill,{width:z.size.width,height:z.size.height,radius:q.borderRadius,fill:q.backgroundColor??"transparent",stroke:q.borderColor,strokeWidth:q.borderWidth??0,outset:q.borderWidth??0}):null,v]})});Box.displayName="Box";const Stack=forwardRef(({gap:r="md",...e},l)=>_jsx(Box,{ref:l,direction:"column",gap:r,...e}));Stack.displayName="Stack";const Row=forwardRef(({gap:r="sm",align:e="center",...l},o)=>_jsx(Box,{ref:o,direction:"row",gap:r,align:e,...l}));Row.displayName="Row";const Spacer=({size:r,style:e,testID:l})=>{const o=useTheme();if(null!=r){const t=o.spacing[r];return _jsx(View,{testID:l,style:[{width:t,height:t},e]})}return _jsx(View,{testID:l,style:[{flex:1},e]})};Spacer.displayName="Spacer";export{Box,Row,Spacer,Stack};export default Box;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Box,Row,resolveBoxStyle,Spacer,Stack}from"./Box.js";
|
|
1
|
+
"use strict";export{Box,Row,resolveBoxStyle,Spacer,Stack}from"./Box.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
"use strict";import React,{forwardRef,useMemo,useRef,useState}from"react";import{Animated,Easing,Pressable,StyleSheet,Text,View}from"react-native";import{useFlickGuard}from"../../hooks/useFlickGuard.js";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,Gradient,useTheme}from"../../theme/index.js";import{createAnimatedValue}from"../../theme/animatedValue.js";import{ACCENT_PRESSED_TINT,tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Spinner}from"../Spinner/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const Button=forwardRef((e,r)=>{const{title:o,children:t,variant:s="solid",tone:i="primary",size:n="md",loading:l=!1,disabled:a=!1,fullWidth:d=!1,leftIcon:c,rightIcon:u,iconVariant:b,leftIconBadge:g=!1,haptic:p="selection",rounded:m=!1,gradient:f,style:h,textStyle:y,pressAnimation:S,onPress:x,accessibilityLabel:C,accessibilityHint:I,testID:_,onLayout:k,...w}=e;if(__DEV__&&hasTextChild(t))throw new Error('[@webority/mobile-ui] Button was given its label as text children. Pass it as `title` (<Button title="Save" />): text children draw a blank button with no accessible name.');const z=useTheme(),j=!a&&!l,T="link"===s,R=S??(!T&&"scale"),v=usePressAnimation({preset:R||"scale",enabled:!1!==R&&j}),F=useFlickGuard(),V=useMemo(()=>buildStyles(z),[z]),E={...sizeMap[n],...z.components.button?.[n]??{}},A=useMemo(()=>toneFor(z,i),[z,i]),H=useMemo(()=>variantFor(z,s,A,a),[z,s,A,a]),L=useMemo(()=>!f||a||"solid"!==s?null:"string"==typeof f?z.gradients[f]??null:f,[f,a,s,z.gradients]),W=StyleSheet.flatten(h)?.borderRadius,D=T?0:"number"==typeof W?W:m?z.radius.full:E.borderRadius,P=useSquircle(!L&&"link"!==s,D,k),B=useRef(createAnimatedValue(0)).current,[O,N]=useState(0),G=T?e=>N(e.nativeEvent.layout.width):void 0,M=C??o,q="outline"===s||"ghost"===s,U=!q&&!T,K={color:H.textColor,size:E.iconSize,disabled:a},X=g&&!T&&Boolean(c),Y=E.minHeight-2*BADGE_INSET-2*H.borderWidth,J={color:H.badgeInk,size:E.badgeIconSize??E.iconSize,disabled:a},Q=_jsx(View,{style:V.contentRow,children:l?_jsx(Spinner,{variant:"circular",size:"sm",color:H.textColor,accessibilityLabel:"Loading"}):_jsxs(_Fragment,{children:[X?_jsx(View,{testID:"button-icon-badge",style:[V.iconLeft,V.iconBadge,{width:Y,height:Y,borderRadius:Y/2,backgroundColor:H.badgeFill}],children:renderSlotIcon(c,J,b)}):c?_jsx(View,{style:V.iconLeft,children:renderSlotIcon(c,K,b)}):null,o?_jsxs(View,{onLayout:G,children:[_jsx(Text,{style:[V.label,{color:H.textColor,fontSize:E.fontSize,...fontFor(z,"semibold")},y],numberOfLines:1,children:o}),T?_jsx(Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[V.linkUnderline,{backgroundColor:H.textColor,transform:[{translateX:B.interpolate({inputRange:[0,1],outputRange:[-O/2,0]})},{scaleX:B.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}):t,u?_jsx(View,{style:V.iconRight,children:renderSlotIcon(u,K,b)}):null]})});return _jsx(Animated.View,{style:[v.style,d?V.fullWidth:null],children:_jsx(Pressable,{ref:r,onPress:e=>{j&&!F.isFlick(e)&&(v.press(),!1!==p&&triggerHaptic(p),x?.(e))},onPressIn:e=>{F.onPressIn(e),v.pressIn(),T&&j&&(B.stopAnimation(),B.setValue(0),Animated.timing(B,{toValue:1,duration:z.motion.duration.slower,easing:Easing.bezier(...z.motion.easing.decelerate),useNativeDriver:!0}).start())},onPressOut:()=>{v.pressOut()},disabled:!j,hitSlop:T?LINK_HIT_SLOP:void 0,accessibilityRole:"button",accessibilityLabel:M,accessibilityHint:I,accessibilityState:{disabled:!j,busy:l},testID:_,onLayout:P.onLayout,style:({pressed:e})=>[V.base,{paddingHorizontal:T?0:E.paddingHorizontal,paddingVertical:T?0:X?BADGE_INSET:E.paddingVertical,paddingLeft:X?BADGE_INSET:void 0,minHeight:T?void 0:E.minHeight,borderRadius:D,...smoothCorners,backgroundColor:L||P.active?"transparent":H.backgroundColor,borderWidth:H.borderWidth,borderColor:P.active?"transparent":H.borderColor,opacity:l?.55:1,overflow:P.active||T?"visible":"hidden"},e&&q&&!P.active?{backgroundColor:z.colors.surface.pressed}:null,d?V.fullWidth:null,h],...w,children:({pressed:e})=>_jsxs(_Fragment,{children:[P.active&&P.size?_jsx(SquircleFill,{width:P.size.width,height:P.size.height,radius:D,fill:e&&q?z.colors.surface.pressed:H.backgroundColor,stroke:H.borderColor,strokeWidth:H.borderWidth,outset:H.borderWidth}):null,L?_jsx(Gradient,{gradient:L,style:[StyleSheet.absoluteFill,{borderRadius:D,...smoothCorners}]}):null,e&&U?P.active&&P.size?_jsx(SquircleFill,{width:P.size.width,height:P.size.height,radius:D,fill:H.pressedTint,outset:H.borderWidth,testID:"button-pressed"}):_jsx(View,{pointerEvents:"none",style:[V.pressedOverlay,{borderRadius:D,backgroundColor:H.pressedTint,...smoothCorners}],testID:"button-pressed"}):null,Q]})})})});Button.displayName="Button";const hasTextChild=e=>React.Children.toArray(e).some(e=>"string"==typeof e||"number"==typeof e),sizeMap={xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8,iconSize:14,badgeIconSize:11},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10,iconSize:16},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12,iconSize:18},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14,iconSize:20},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16,iconSize:22}},SOFT_FILL_OPACITY=.14,toneFor=(e,r)=>{switch(r){case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,fg:e.colors.primary,soft:tintOf(e.colors.primary,.14,e.colors.primaryMuted)};case"secondary":return{base:e.colors.secondary,on:e.colors.onSecondary,fg:e.colors.onSecondary,soft:e.colors.secondary};case"success":return{base:e.colors.success,on:e.colors.onSuccess,fg:e.colors.success,soft:tintOf(e.colors.success,.14,e.colors.background.secondary)};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,fg:e.colors.warning,soft:tintOf(e.colors.warning,.14,e.colors.background.secondary)};case"error":return{base:e.colors.error,on:e.colors.onError,fg:e.colors.error,soft:tintOf(e.colors.error,.14,e.colors.background.secondary)};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,fg:e.colors.text.primary,soft:e.colors.background.secondary}}},BADGE_INSET=4,BUTTON_BORDER_WIDTH=1,LINK_HIT_SLOP={top:8,bottom:8,left:8,right:8},variantFor=(e,r,o,t)=>{const s=t?e.colors.text.disabled:o.fg,i={badgeFill:e.colors.surface.disabled,badgeInk:e.colors.text.disabled},n=t?i:{badgeFill:o.on,badgeInk:o.base},l=t?i:{badgeFill:o.base,badgeInk:o.on};switch(r){case"solid":return{backgroundColor:t?e.colors.surface.disabled:o.base,borderColor:"transparent",borderWidth:1,textColor:t?e.colors.text.disabled:o.on,pressedTint:e.colors.surface.pressed,...n};case"soft":return{backgroundColor:t?e.colors.surface.disabled:o.soft,borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"outline":return{backgroundColor:"transparent",borderColor:t?e.colors.border.primary:o.base,borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:t?e.colors.text.disabled:e.colors.text.link,pressedTint:e.colors.surface.pressed,...l};case"glass":return{backgroundColor:e.colors.glass.fill,borderColor:e.colors.glass.border,borderWidth:1,textColor:t?e.colors.text.disabled:e.colors.glass.on,pressedTint:ACCENT_PRESSED_TINT,badgeFill:e.colors.glass.badge,badgeInk:t?e.colors.text.disabled:o.base};default:return{backgroundColor:o.base,borderColor:"transparent",borderWidth:1,textColor:o.on,pressedTint:e.colors.surface.pressed,...n}}},buildStyles=e=>StyleSheet.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:1},iconLeft:{marginRight:8},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:8},fullWidth:{alignSelf:"stretch"}});export{Button};export default Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Button,default}from"./Button.js";
|
|
1
|
+
"use strict";export{Button,default}from"./Button.js";
|