@endfield-ui/react 1.1.0 → 1.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/NOTICE.md +4 -3
- package/README.md +32 -5
- package/dist/components/accordion/Accordion.d.ts +46 -0
- package/dist/components/accordion/Accordion.js +2 -0
- package/dist/components/accordion/index.d.ts +3 -0
- package/dist/components/alert/Alert.d.ts +28 -0
- package/dist/components/alert/Alert.js +2 -0
- package/dist/components/alert/index.d.ts +3 -0
- package/dist/components/avatar/Avatar.d.ts +24 -0
- package/dist/components/avatar/Avatar.js +2 -0
- package/dist/components/avatar/AvatarSwitcher.d.ts +46 -0
- package/dist/components/avatar/AvatarSwitcher.js +2 -0
- package/dist/components/avatar/index.d.ts +4 -0
- package/dist/components/back-to-top/BackToTop.d.ts +21 -0
- package/dist/components/back-to-top/BackToTop.js +2 -0
- package/dist/components/back-to-top/index.d.ts +3 -0
- package/dist/components/badge/Badge.d.ts +20 -0
- package/dist/components/badge/Badge.js +2 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/bracket-title/BracketTitle.d.ts +17 -0
- package/dist/components/bracket-title/BracketTitle.js +2 -0
- package/dist/components/bracket-title/index.d.ts +3 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +26 -0
- package/dist/components/breadcrumb/Breadcrumb.js +2 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/button/Button.d.ts +50 -0
- package/dist/components/button/Button.js +2 -0
- package/dist/components/button/ButtonGroup.d.ts +21 -0
- package/dist/components/button/ButtonGroup.js +2 -0
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/calendar/Calendar.d.ts +57 -0
- package/dist/components/calendar/Calendar.js +2 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/carousel/Carousel.d.ts +38 -0
- package/dist/components/carousel/Carousel.js +2 -0
- package/dist/components/carousel/index.d.ts +3 -0
- package/dist/components/carousel/snap-track.js +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +18 -0
- package/dist/components/checkbox/Checkbox.js +2 -0
- package/dist/components/checkbox/choice-style.js +2 -0
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/chip/FilterChip.d.ts +18 -0
- package/dist/components/chip/FilterChip.js +2 -0
- package/dist/components/chip/ResourceChip.d.ts +16 -0
- package/dist/components/chip/ResourceChip.js +2 -0
- package/dist/components/chip/capsule-style.d.ts +4 -0
- package/dist/components/chip/capsule-style.js +2 -0
- package/dist/components/chip/index.d.ts +4 -0
- package/dist/components/combobox/Combobox.d.ts +105 -0
- package/dist/components/combobox/Combobox.js +2 -0
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/completion-banner/CompletionBanner.d.ts +26 -0
- package/dist/components/completion-banner/CompletionBanner.js +2 -0
- package/dist/components/completion-banner/index.d.ts +3 -0
- package/dist/components/context-menu/ContextMenu.d.ts +30 -0
- package/dist/components/context-menu/ContextMenu.js +2 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/corner-brackets/CornerBrackets.d.ts +20 -0
- package/dist/components/corner-brackets/CornerBrackets.js +2 -0
- package/dist/components/corner-brackets/index.d.ts +3 -0
- package/dist/components/countdown/Countdown.d.ts +26 -0
- package/dist/components/countdown/Countdown.js +2 -0
- package/dist/components/countdown/index.d.ts +3 -0
- package/dist/components/dash-indicator/DashIndicator.d.ts +15 -0
- package/dist/components/dash-indicator/DashIndicator.js +2 -0
- package/dist/components/dash-indicator/index.d.ts +3 -0
- package/dist/components/data-row/DataRow.d.ts +58 -0
- package/dist/components/data-row/DataRow.js +2 -0
- package/dist/components/data-row/index.d.ts +3 -0
- package/dist/components/date-picker/DateField.js +2 -0
- package/dist/components/date-picker/DatePicker.d.ts +56 -0
- package/dist/components/date-picker/DatePicker.js +2 -0
- package/dist/components/date-picker/DateRangePicker.d.ts +57 -0
- package/dist/components/date-picker/DateRangePicker.js +2 -0
- package/dist/components/date-picker/index.d.ts +4 -0
- package/dist/components/dialog/Dialog.d.ts +55 -0
- package/dist/components/dialog/Dialog.js +2 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/dialog/initial-focus.js +2 -0
- package/dist/components/dialog/overlay-style.js +2 -0
- package/dist/components/drawer/Drawer.d.ts +48 -0
- package/dist/components/drawer/Drawer.js +2 -0
- package/dist/components/drawer/index.d.ts +3 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +115 -0
- package/dist/components/dropdown-menu/DropdownMenu.js +2 -0
- package/dist/components/dropdown-menu/MenuCheck.js +2 -0
- package/dist/components/dropdown-menu/index.d.ts +3 -0
- package/dist/components/dropdown-menu/menu-style.d.ts +4 -0
- package/dist/components/dropdown-menu/menu-style.js +2 -0
- package/dist/components/empty-state/EmptyState.d.ts +22 -0
- package/dist/components/empty-state/EmptyState.js +2 -0
- package/dist/components/empty-state/index.d.ts +3 -0
- package/dist/components/field/Field.d.ts +58 -0
- package/dist/components/field/Field.js +2 -0
- package/dist/components/field/index.d.ts +3 -0
- package/dist/components/file-upload/FileItem.d.ts +50 -0
- package/dist/components/file-upload/FileItem.js +2 -0
- package/dist/components/file-upload/FileUpload.d.ts +82 -0
- package/dist/components/file-upload/FileUpload.js +2 -0
- package/dist/components/file-upload/index.d.ts +4 -0
- package/dist/components/flyout-bar/FlyoutBar.d.ts +46 -0
- package/dist/components/flyout-bar/FlyoutBar.js +2 -0
- package/dist/components/flyout-bar/index.d.ts +3 -0
- package/dist/components/ghost-text/GhostText.d.ts +21 -0
- package/dist/components/ghost-text/GhostText.js +2 -0
- package/dist/components/ghost-text/index.d.ts +3 -0
- package/dist/components/hatch/Hatch.d.ts +18 -0
- package/dist/components/hatch/Hatch.js +2 -0
- package/dist/components/hatch/index.d.ts +3 -0
- package/dist/components/hazard-stripe/HazardStripe.d.ts +15 -0
- package/dist/components/hazard-stripe/HazardStripe.js +2 -0
- package/dist/components/hazard-stripe/index.d.ts +3 -0
- package/dist/components/hover-card/HoverCard.d.ts +35 -0
- package/dist/components/hover-card/HoverCard.js +2 -0
- package/dist/components/hover-card/index.d.ts +3 -0
- package/dist/components/icon-button/IconButton.d.ts +21 -0
- package/dist/components/icon-button/IconButton.js +2 -0
- package/dist/components/icon-button/index.d.ts +3 -0
- package/dist/components/image-viewer/ImageViewer.d.ts +48 -0
- package/dist/components/image-viewer/ImageViewer.js +2 -0
- package/dist/components/image-viewer/index.d.ts +3 -0
- package/dist/components/input/Input.d.ts +27 -0
- package/dist/components/input/Input.js +2 -0
- package/dist/components/input/control-box.d.ts +5 -0
- package/dist/components/input/control-box.js +2 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/value-chip.js +2 -0
- package/dist/components/item-slot/ItemGrid.d.ts +12 -0
- package/dist/components/item-slot/ItemGrid.js +2 -0
- package/dist/components/item-slot/ItemSlot.d.ts +54 -0
- package/dist/components/item-slot/ItemSlot.js +2 -0
- package/dist/components/item-slot/index.d.ts +4 -0
- package/dist/components/kbd/Kbd.d.ts +15 -0
- package/dist/components/kbd/Kbd.js +2 -0
- package/dist/components/kbd/index.d.ts +3 -0
- package/dist/components/link-element/LinkElement.d.ts +6 -0
- package/dist/components/link-element/LinkElement.js +2 -0
- package/dist/components/list/List.d.ts +46 -0
- package/dist/components/list/List.js +2 -0
- package/dist/components/list/band-style.js +2 -0
- package/dist/components/list/index.d.ts +3 -0
- package/dist/components/loader/Loader.d.ts +23 -0
- package/dist/components/loader/Loader.js +2 -0
- package/dist/components/loader/index.d.ts +3 -0
- package/dist/components/marquee/Marquee.d.ts +22 -0
- package/dist/components/marquee/Marquee.js +2 -0
- package/dist/components/marquee/index.d.ts +3 -0
- package/dist/components/media-card/MediaCard.d.ts +36 -0
- package/dist/components/media-card/MediaCard.js +2 -0
- package/dist/components/media-card/index.d.ts +3 -0
- package/dist/components/nav-action/NavAction.d.ts +34 -0
- package/dist/components/nav-action/NavAction.js +2 -0
- package/dist/components/nav-action/index.d.ts +3 -0
- package/dist/components/nav-menu/NavMenu.d.ts +57 -0
- package/dist/components/nav-menu/NavMenu.js +2 -0
- package/dist/components/nav-menu/index.d.ts +3 -0
- package/dist/components/navigator/Navigator.d.ts +27 -0
- package/dist/components/navigator/Navigator.js +2 -0
- package/dist/components/navigator/index.d.ts +3 -0
- package/dist/components/otp-input/OtpInput.d.ts +52 -0
- package/dist/components/otp-input/OtpInput.js +2 -0
- package/dist/components/otp-input/index.d.ts +3 -0
- package/dist/components/page-header/PageHeader.d.ts +56 -0
- package/dist/components/page-header/PageHeader.js +2 -0
- package/dist/components/page-header/index.d.ts +3 -0
- package/dist/components/pagination/Pagination.d.ts +29 -0
- package/dist/components/pagination/Pagination.js +2 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/panel/Panel.d.ts +36 -0
- package/dist/components/panel/Panel.js +2 -0
- package/dist/components/panel/index.d.ts +3 -0
- package/dist/components/play-button/PlayButton.d.ts +20 -0
- package/dist/components/play-button/PlayButton.js +2 -0
- package/dist/components/play-button/index.d.ts +3 -0
- package/dist/components/popover/Popover.d.ts +36 -0
- package/dist/components/popover/Popover.js +2 -0
- package/dist/components/popover/index.d.ts +3 -0
- package/dist/components/popover/panel-style.js +2 -0
- package/dist/components/progress/Progress.d.ts +27 -0
- package/dist/components/progress/Progress.js +2 -0
- package/dist/components/progress/ProgressRing.d.ts +23 -0
- package/dist/components/progress/ProgressRing.js +2 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/radio/Radio.d.ts +33 -0
- package/dist/components/radio/Radio.js +2 -0
- package/dist/components/radio/index.d.ts +3 -0
- package/dist/components/rec-indicator/RecIndicator.d.ts +16 -0
- package/dist/components/rec-indicator/RecIndicator.js +2 -0
- package/dist/components/rec-indicator/index.d.ts +3 -0
- package/dist/components/registration-strip/RegistrationStrip.d.ts +16 -0
- package/dist/components/registration-strip/RegistrationStrip.js +2 -0
- package/dist/components/registration-strip/index.d.ts +3 -0
- package/dist/components/rolling-number/RollingNumber.d.ts +25 -0
- package/dist/components/rolling-number/RollingNumber.js +2 -0
- package/dist/components/rolling-number/index.d.ts +3 -0
- package/dist/components/schedule/Schedule.d.ts +78 -0
- package/dist/components/schedule/Schedule.js +2 -0
- package/dist/components/schedule/index.d.ts +3 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +26 -0
- package/dist/components/scroll-area/ScrollArea.js +2 -0
- package/dist/components/scroll-area/index.d.ts +3 -0
- package/dist/components/scroll-hint/ScrollHint.d.ts +23 -0
- package/dist/components/scroll-hint/ScrollHint.js +2 -0
- package/dist/components/scroll-hint/index.d.ts +3 -0
- package/dist/components/section-title/SectionTitle.d.ts +33 -0
- package/dist/components/section-title/SectionTitle.js +2 -0
- package/dist/components/section-title/index.d.ts +3 -0
- package/dist/components/segmented-control/SegmentedControl.d.ts +49 -0
- package/dist/components/segmented-control/SegmentedControl.js +2 -0
- package/dist/components/segmented-control/index.d.ts +3 -0
- package/dist/components/select/Select.d.ts +95 -0
- package/dist/components/select/Select.js +2 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/side-rail/SideRail.d.ts +62 -0
- package/dist/components/side-rail/SideRail.js +2 -0
- package/dist/components/side-rail/SideRailSub.d.ts +47 -0
- package/dist/components/side-rail/SideRailSub.js +2 -0
- package/dist/components/side-rail/index.d.ts +4 -0
- package/dist/components/skeleton/Skeleton.d.ts +22 -0
- package/dist/components/skeleton/Skeleton.js +2 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/slider/Slider.d.ts +63 -0
- package/dist/components/slider/Slider.js +2 -0
- package/dist/components/slider/index.d.ts +3 -0
- package/dist/components/sparkline/Sparkline.d.ts +32 -0
- package/dist/components/sparkline/Sparkline.js +2 -0
- package/dist/components/sparkline/index.d.ts +3 -0
- package/dist/components/spinner/Spinner.d.ts +19 -0
- package/dist/components/spinner/Spinner.js +2 -0
- package/dist/components/spinner/index.d.ts +3 -0
- package/dist/components/splash-screen/SplashScreen.d.ts +43 -0
- package/dist/components/splash-screen/SplashScreen.js +2 -0
- package/dist/components/splash-screen/index.d.ts +3 -0
- package/dist/components/stat/Stat.d.ts +22 -0
- package/dist/components/stat/Stat.js +2 -0
- package/dist/components/stat/index.d.ts +3 -0
- package/dist/components/stepper/Stepper.d.ts +29 -0
- package/dist/components/stepper/Stepper.js +2 -0
- package/dist/components/stepper/index.d.ts +3 -0
- package/dist/components/steps/Steps.d.ts +55 -0
- package/dist/components/steps/Steps.js +2 -0
- package/dist/components/steps/index.d.ts +3 -0
- package/dist/components/switch/Switch.d.ts +28 -0
- package/dist/components/switch/Switch.js +2 -0
- package/dist/components/switch/index.d.ts +3 -0
- package/dist/components/table/Table.d.ts +96 -0
- package/dist/components/table/Table.js +2 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/tabs/Tabs.d.ts +39 -0
- package/dist/components/tabs/Tabs.js +2 -0
- package/dist/components/tabs/index.d.ts +3 -0
- package/dist/components/tag/Tag.d.ts +25 -0
- package/dist/components/tag/Tag.js +2 -0
- package/dist/components/tag/TagPair.d.ts +16 -0
- package/dist/components/tag/TagPair.js +2 -0
- package/dist/components/tag/index.d.ts +4 -0
- package/dist/components/tag-input/TagInput.d.ts +66 -0
- package/dist/components/tag-input/TagInput.js +3 -0
- package/dist/components/tag-input/index.d.ts +3 -0
- package/dist/components/term/Term.d.ts +19 -0
- package/dist/components/term/Term.js +2 -0
- package/dist/components/term/index.d.ts +3 -0
- package/dist/components/textarea/Textarea.d.ts +17 -0
- package/dist/components/textarea/Textarea.js +2 -0
- package/dist/components/textarea/index.d.ts +3 -0
- package/dist/components/texture/Texture.d.ts +19 -0
- package/dist/components/texture/Texture.js +2 -0
- package/dist/components/texture/index.d.ts +3 -0
- package/dist/components/tick-ring/TickRing.d.ts +22 -0
- package/dist/components/tick-ring/TickRing.js +2 -0
- package/dist/components/tick-ring/index.d.ts +3 -0
- package/dist/components/timeline/Timeline.d.ts +22 -0
- package/dist/components/timeline/Timeline.js +2 -0
- package/dist/components/timeline/index.d.ts +3 -0
- package/dist/components/toast/Toast.d.ts +45 -0
- package/dist/components/toast/Toast.js +2 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toc/Toc.d.ts +46 -0
- package/dist/components/toc/Toc.js +2 -0
- package/dist/components/toc/index.d.ts +3 -0
- package/dist/components/toolbar/Toolbar.d.ts +97 -0
- package/dist/components/toolbar/Toolbar.js +2 -0
- package/dist/components/toolbar/index.d.ts +3 -0
- package/dist/components/tooltip/Tooltip.d.ts +47 -0
- package/dist/components/tooltip/Tooltip.js +2 -0
- package/dist/components/tooltip/index.d.ts +3 -0
- package/dist/components/top-bar/TopBar.d.ts +21 -0
- package/dist/components/top-bar/TopBar.js +2 -0
- package/dist/components/top-bar/index.d.ts +3 -0
- package/dist/components/viewfinder/Viewfinder.d.ts +35 -0
- package/dist/components/viewfinder/Viewfinder.js +2 -0
- package/dist/components/viewfinder/index.d.ts +3 -0
- package/dist/game/animated-dialog/AnimatedDialog.d.ts +53 -0
- package/dist/game/animated-dialog/AnimatedDialog.js +2 -0
- package/dist/game/animated-dialog/index.d.ts +3 -0
- package/dist/game/assets/splash_bg.jpg +0 -0
- package/dist/game/assets/splash_bg_portrait.jpg +0 -0
- package/dist/game/assets/splash_deco.svg +4 -0
- package/dist/game/assets/splash_logo.svg +1 -0
- package/dist/game/assets/splash_triangles.svg +4 -0
- package/dist/game/banner-alert/AlertIcons.js +2 -0
- package/dist/game/banner-alert/AlertModal.js +2 -0
- package/dist/game/banner-alert/BannerAlert.d.ts +6 -0
- package/dist/game/banner-alert/BannerAlert.js +2 -0
- package/dist/game/banner-alert/index.d.ts +3 -0
- package/dist/game/banner-alert/types.d.ts +48 -0
- package/dist/game/banner-alert/types.js +2 -0
- package/dist/game/banner-alert/useAlertActions.js +2 -0
- package/dist/game/banner-alert/useAlertGlitch.js +2 -0
- package/dist/game/full-width-alert/FullWidthAlert.d.ts +7 -0
- package/dist/game/full-width-alert/FullWidthAlert.js +2 -0
- package/dist/game/full-width-alert/index.d.ts +3 -0
- package/dist/game/item-card/ItemCard.d.ts +48 -0
- package/dist/game/item-card/ItemCard.js +2 -0
- package/dist/game/item-card/index.d.ts +3 -0
- package/dist/game/item-hover-card/ItemHoverCard.d.ts +31 -0
- package/dist/game/item-hover-card/ItemHoverCard.js +2 -0
- package/dist/game/item-hover-card/events.js +2 -0
- package/dist/game/item-hover-card/index.d.ts +3 -0
- package/dist/game/item-icon/ItemIcon.d.ts +5 -0
- package/dist/game/item-icon/ItemIcon.js +2 -0
- package/dist/game/item-icon/helpers.d.ts +22 -0
- package/dist/game/item-icon/helpers.js +2 -0
- package/dist/game/item-icon/index.d.ts +5 -0
- package/dist/game/item-icon/types.d.ts +32 -0
- package/dist/game/item-tooltip-card/ItemTooltipCard.d.ts +6 -0
- package/dist/game/item-tooltip-card/ItemTooltipCard.js +2 -0
- package/dist/game/item-tooltip-card/icons.js +2 -0
- package/dist/game/item-tooltip-card/index.d.ts +4 -0
- package/dist/game/item-tooltip-card/types.d.ts +40 -0
- package/dist/game/lib/core.d.ts +8 -0
- package/dist/game/lib/first-focusable.js +2 -0
- package/dist/game/resource-provenance.json +70 -1
- package/dist/game/rounded-button/RoundedButton.d.ts +22 -0
- package/dist/game/rounded-button/RoundedButton.js +2 -0
- package/dist/game/rounded-button/RoundedIconButton.d.ts +10 -0
- package/dist/game/rounded-button/RoundedIconButton.js +2 -0
- package/dist/game/rounded-button/index.d.ts +4 -0
- package/dist/game/rounded-select/RoundedSelect.d.ts +43 -0
- package/dist/game/rounded-select/RoundedSelect.js +2 -0
- package/dist/game/rounded-select/index.d.ts +3 -0
- package/dist/game/rounded-switch/RoundedSwitch.d.ts +16 -0
- package/dist/game/rounded-switch/RoundedSwitch.js +2 -0
- package/dist/game/rounded-switch/index.d.ts +3 -0
- package/dist/game/rounded-toggle/RoundedToggle.d.ts +23 -0
- package/dist/game/rounded-toggle/RoundedToggle.js +2 -0
- package/dist/game/rounded-toggle/index.d.ts +3 -0
- package/dist/game/rounded-toggle/keyboard.js +2 -0
- package/dist/game/rounded-toggle/spring-highlight.js +2 -0
- package/dist/game/splash-screen/EndfieldSplashScreen.d.ts +14 -0
- package/dist/game/splash-screen/EndfieldSplashScreen.js +2 -0
- package/dist/game/splash-screen/index.d.ts +3 -0
- package/dist/game/styles.css +1 -1
- package/dist/game.d.ts +29 -371
- package/dist/game.js +1 -2041
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useAddedKeys.js +2 -0
- package/dist/hooks/useControllableState.d.ts +12 -0
- package/dist/hooks/useControllableState.js +2 -0
- package/dist/hooks/useFlip.js +2 -0
- package/dist/hooks/useInView.d.ts +15 -0
- package/dist/hooks/useInView.js +2 -0
- package/dist/hooks/useIndicator.js +2 -0
- package/dist/hooks/useLingering.js +2 -0
- package/dist/hooks/useOverflowing.js +2 -0
- package/dist/hooks/usePortalScope.d.ts +26 -0
- package/dist/hooks/usePortalScope.js +2 -0
- package/dist/hooks/usePresence.js +2 -0
- package/dist/hooks/useReducedMotion.d.ts +10 -0
- package/dist/hooks/useReducedMotion.js +2 -0
- package/dist/hooks/useScrollPosition.js +2 -0
- package/dist/hooks/useTheme.d.ts +21 -0
- package/dist/hooks/useTheme.js +2 -0
- package/dist/icons/ArrowCorner.d.ts +9 -0
- package/dist/icons/ArrowCorner.js +2 -0
- package/dist/icons/ArrowLeft.d.ts +8 -0
- package/dist/icons/ArrowLeft.js +2 -0
- package/dist/icons/ArrowRight.d.ts +8 -0
- package/dist/icons/ArrowRight.js +2 -0
- package/dist/icons/CalendarIcon.d.ts +12 -0
- package/dist/icons/CalendarIcon.js +2 -0
- package/dist/icons/Check.d.ts +9 -0
- package/dist/icons/Check.js +2 -0
- package/dist/icons/ChevronDown.d.ts +8 -0
- package/dist/icons/ChevronDown.js +2 -0
- package/dist/icons/ChevronLeft.d.ts +8 -0
- package/dist/icons/ChevronLeft.js +2 -0
- package/dist/icons/ChevronRight.d.ts +8 -0
- package/dist/icons/ChevronRight.js +2 -0
- package/dist/icons/Close.d.ts +8 -0
- package/dist/icons/Close.js +2 -0
- package/dist/icons/Crosshair.d.ts +9 -0
- package/dist/icons/Crosshair.js +2 -0
- package/dist/icons/Lock.d.ts +8 -0
- package/dist/icons/Lock.js +2 -0
- package/dist/icons/Menu.d.ts +9 -0
- package/dist/icons/Menu.js +2 -0
- package/dist/icons/Minus.d.ts +9 -0
- package/dist/icons/Minus.js +2 -0
- package/dist/icons/Plus.d.ts +8 -0
- package/dist/icons/Plus.js +2 -0
- package/dist/icons/StatusDanger.d.ts +9 -0
- package/dist/icons/StatusDanger.js +2 -0
- package/dist/icons/StatusInfo.d.ts +9 -0
- package/dist/icons/StatusInfo.js +2 -0
- package/dist/icons/StatusSuccess.d.ts +9 -0
- package/dist/icons/StatusSuccess.js +2 -0
- package/dist/icons/StatusWarning.d.ts +9 -0
- package/dist/icons/StatusWarning.js +2 -0
- package/dist/icons/TriangleRight.d.ts +9 -0
- package/dist/icons/TriangleRight.js +2 -0
- package/dist/icons/Upload.d.ts +9 -0
- package/dist/icons/Upload.js +2 -0
- package/dist/icons/createIcon.d.ts +16 -0
- package/dist/icons/createIcon.js +2 -0
- package/dist/icons/index.d.ts +23 -0
- package/dist/index.d.ts +209 -3505
- package/dist/index.js +1 -9625
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +2 -0
- package/dist/lib/create-lazy-context.js +2 -0
- package/dist/lib/date.js +2 -0
- package/dist/lib/decor.js +2 -0
- package/dist/lib/defined.js +2 -0
- package/dist/lib/file.js +2 -0
- package/dist/lib/focus-ring.js +2 -0
- package/dist/lib/inline-style.js +2 -0
- package/dist/lib/merge-refs.js +2 -0
- package/dist/lib/motion.js +2 -0
- package/dist/styles.css +1 -1
- package/package.json +17 -11
- package/src/components/accordion/Accordion.tsx +13 -5
- package/src/components/alert/Alert.tsx +1 -1
- package/src/components/avatar/AvatarSwitcher.tsx +7 -5
- package/src/components/carousel/Carousel.tsx +6 -5
- package/src/components/context-menu/ContextMenu.tsx +5 -2
- package/src/components/data-row/DataRow.tsx +10 -4
- package/src/components/date-picker/DateField.tsx +1 -3
- package/src/components/dropdown-menu/DropdownMenu.tsx +7 -4
- package/src/components/dropdown-menu/menu-style.ts +9 -3
- package/src/components/field/Field.tsx +10 -6
- package/src/components/file-upload/FileUpload.tsx +5 -2
- package/src/components/flyout-bar/FlyoutBar.tsx +1 -1
- package/src/components/image-viewer/ImageViewer.tsx +6 -5
- package/src/components/input/control-box.ts +30 -10
- package/src/components/list/List.tsx +7 -5
- package/src/components/nav-action/NavAction.tsx +4 -3
- package/src/components/nav-menu/NavMenu.tsx +13 -7
- package/src/components/otp-input/OtpInput.tsx +35 -43
- package/src/components/radio/Radio.tsx +7 -5
- package/src/components/schedule/Schedule.tsx +7 -5
- package/src/components/segmented-control/SegmentedControl.tsx +9 -7
- package/src/components/select/Select.tsx +11 -11
- package/src/components/side-rail/SideRail.tsx +15 -9
- package/src/components/side-rail/SideRailSub.tsx +12 -7
- package/src/components/splash-screen/SplashScreen.tsx +340 -0
- package/src/components/splash-screen/index.ts +1 -0
- package/src/components/steps/Steps.tsx +7 -5
- package/src/components/table/Table.tsx +23 -17
- package/src/components/tabs/Tabs.tsx +7 -5
- package/src/components/tag-input/TagInput.tsx +5 -2
- package/src/components/toast/Toast.tsx +12 -8
- package/src/components/toc/Toc.tsx +5 -4
- package/src/components/toolbar/Toolbar.tsx +7 -6
- package/src/components/tooltip/Tooltip.tsx +7 -4
- package/src/components/top-bar/TopBar.tsx +7 -2
- package/src/icons/ArrowCorner.tsx +1 -1
- package/src/icons/ArrowLeft.tsx +1 -1
- package/src/icons/ArrowRight.tsx +1 -1
- package/src/icons/CalendarIcon.tsx +1 -1
- package/src/icons/Check.tsx +4 -1
- package/src/icons/ChevronDown.tsx +4 -1
- package/src/icons/ChevronLeft.tsx +1 -1
- package/src/icons/ChevronRight.tsx +1 -1
- package/src/icons/Close.tsx +4 -1
- package/src/icons/Crosshair.tsx +1 -1
- package/src/icons/Lock.tsx +1 -1
- package/src/icons/Menu.tsx +4 -1
- package/src/icons/Minus.tsx +1 -1
- package/src/icons/Plus.tsx +4 -1
- package/src/icons/StatusDanger.tsx +1 -1
- package/src/icons/StatusInfo.tsx +1 -1
- package/src/icons/StatusSuccess.tsx +1 -1
- package/src/icons/StatusWarning.tsx +1 -1
- package/src/icons/TriangleRight.tsx +1 -1
- package/src/icons/Upload.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/lib/cn.ts +1 -1
- package/src/lib/create-lazy-context.ts +6 -0
- package/src/styles/theme.css +33 -0
- package/src/styles/utilities.css +8 -0
- package/src/components/README.md +0 -190
- package/src/hooks/README.md +0 -20
- package/src/icons/README.md +0 -31
- package/src/lib/README.md +0 -19
- package/src/styles/README.md +0 -74
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/components/toast/Toast.d.ts
|
|
4
|
+
export type ToastTone = "neutral" | "info" | "success" | "warning" | "danger";
|
|
5
|
+
export type ToastPlacement = "bottom" | "center";
|
|
6
|
+
export type ToastAction = {
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/** 点了之后这条提示随即关掉 */
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
};
|
|
11
|
+
export type ToastOptions = {
|
|
12
|
+
/** 一句话 */
|
|
13
|
+
message: ReactNode;
|
|
14
|
+
/** 文字前的小图形,区分成功与失败。底色不变。默认 `neutral`:没有图形 */
|
|
15
|
+
tone?: ToastTone;
|
|
16
|
+
/** 一个操作,比如"撤销"。带操作的提示多停一会儿,并出现关闭图标 */
|
|
17
|
+
action?: ToastAction;
|
|
18
|
+
/** 停留多久,毫秒。`0` 是一直留着,直到被关掉或被下一条替换 */
|
|
19
|
+
duration?: number;
|
|
20
|
+
};
|
|
21
|
+
export type ToastApi = {
|
|
22
|
+
/** 弹出一条,返回它的 id。上一条还在的话会被它替换 */
|
|
23
|
+
(input: ReactNode | ToastOptions): string;
|
|
24
|
+
/** 关掉指定的一条;不传 id 就关掉当前这条 */
|
|
25
|
+
dismiss: (id?: string) => void;
|
|
26
|
+
};
|
|
27
|
+
/** 弹出轻提示。要在 `ToastProvider` 里面用。 */
|
|
28
|
+
export declare function useToast(): ToastApi;
|
|
29
|
+
export type ToastProviderProps = {
|
|
30
|
+
/** 出现在哪:视口底部居中(默认),或者视口正中(官网的做法) */
|
|
31
|
+
placement?: ToastPlacement;
|
|
32
|
+
/** 默认停留多久,毫秒。规范是 2 – 4 秒 */
|
|
33
|
+
duration?: number;
|
|
34
|
+
/** 提示区域的可访问名称(按 `F6` 可以把焦点移进来) */
|
|
35
|
+
label?: string;
|
|
36
|
+
/** 关闭图标的可访问名称 */
|
|
37
|
+
closeLabel?: string;
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 轻提示的容器,包在应用的最外层。里面的任何地方用 `useToast()` 弹出。
|
|
42
|
+
* 重要的、需要用户处理的信息不要用轻提示,用提示条或弹窗。
|
|
43
|
+
*/
|
|
44
|
+
export declare function ToastProvider({ placement, duration, label, closeLabel, children }: ToastProviderProps): import("react").JSX.Element;
|
|
45
|
+
//#endregion
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{focusRingInset as t}from"../../lib/focus-ring.js";import{createLazyContext as n}from"../../lib/create-lazy-context.js";import{Close as r}from"../../icons/Close.js";import{StatusDanger as i}from"../../icons/StatusDanger.js";import{StatusInfo as a}from"../../icons/StatusInfo.js";import{StatusSuccess as o}from"../../icons/StatusSuccess.js";import{StatusWarning as s}from"../../icons/StatusWarning.js";import{isValidElement as c,useContext as l,useMemo as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{Toast as p}from"@base-ui/react/toast";const m=/* @__PURE__ */ n(null);function h(){let e=l(m());if(!e)throw Error(`useToast 要在 <ToastProvider> 里面用`);return e}const g={info:a,success:o,warning:s,danger:i},_={info:`text-info`,success:`text-success`,warning:`text-warning`,danger:`text-danger`},v={bottom:{viewport:`bottom-6`,root:`bottom-0 transform-[translate(calc(-50%+var(--toast-swipe-movement-x,0px)),var(--toast-swipe-movement-y,0px))] data-starting-style:translate-y-(--motion-shift-lg)`},center:{viewport:`top-1/2`,root:`top-0 transform-[translate(calc(-50%+var(--toast-swipe-movement-x,0px)),calc(-50%+var(--toast-swipe-movement-y,0px)))]`}};function y(e){return typeof e==`object`&&!!e&&!c(e)&&`message`in e}let b=0;function x({placement:n,label:i,closeLabel:a,children:o}){let s=m(),{toasts:c,add:l,close:h}=p.useToastManager(),x=u(()=>{let e=e=>{let{message:t,tone:n=`neutral`,action:r,duration:i}=y(e)?e:{message:e},a=`ef-toast-${++b}`;return h(),l({id:a,title:t,type:n,priority:n===`danger`||n===`warning`?`high`:`low`,timeout:i??(r?8e3:void 0),actionProps:r&&{children:r.label,onClick:()=>{r.onClick(),h(a)}},data:{tone:n,dismissible:r!==void 0||i===0}})};return e.dismiss=e=>h(e),e},[l,h]);return/* @__PURE__ */ f(s.Provider,{value:x,children:[o,/* @__PURE__ */ d(p.Portal,{children:/* @__PURE__ */ d(p.Viewport,{"aria-label":i,className:e(`pointer-events-none fixed inset-x-4 z-(--z-toast) h-0`,v[n].viewport),children:c.map(i=>{let o=i.data?.tone??`neutral`,s=o===`neutral`?null:g[o];return/* @__PURE__ */ d(p.Root,{toast:i,"data-theme":`dark`,className:e(`pointer-events-auto absolute left-1/2 w-max max-w-full`,`bg-black/80 shadow-sm text-base leading-[1.4] text-white`,`forced-colors:border forced-colors:border-[CanvasText]`,`transition-[opacity,translate,transform] duration-[var(--duration-fast),var(--duration-base),var(--duration-fast)] ease-[var(--ease-standard),var(--ease-exit),var(--ease-standard)]`,`data-ending-style:opacity-0 data-starting-style:opacity-0`,`data-swiping:select-none`,t,v[n].root),children:/* @__PURE__ */ f(p.Content,{className:e(`flex items-center gap-3 py-2.5 pl-5`,i.data?.dismissible?`pr-2`:`pr-5`),children:[s&&o!==`neutral`&&/* @__PURE__ */ d(s,{size:16,className:e(`shrink-0`,_[o])}),/* @__PURE__ */ d(p.Title,{render:/* @__PURE__ */ d(`p`,{}),className:`min-w-0 wrap-anywhere`}),i.actionProps&&/* @__PURE__ */ d(p.Action,{className:e(`shrink-0 border-b border-current text-sm font-medium text-accent-ink active:opacity-80`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`)}),i.data?.dismissible&&/* @__PURE__ */ d(p.Close,{"aria-label":a,className:e(`inline-flex size-8 shrink-0 items-center justify-center text-ink-secondary hover:text-ink`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`),children:/* @__PURE__ */ d(r,{size:16})})]})},i.id)})})})]})}function S({placement:e=`bottom`,duration:t=3e3,label:n=`通知`,closeLabel:r=`关闭`,children:i}){return/* @__PURE__ */ d(p.Provider,{timeout:t,limit:1,children:/* @__PURE__ */ d(x,{placement:e,label:n,closeLabel:r,children:i})})}export{S as ToastProvider,h as useToast};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToastAction, ToastApi, ToastOptions, ToastPlacement, ToastProvider, ToastProviderProps, ToastTone, useToast } from "./Toast.js";
|
|
3
|
+
export { type ToastAction, type ToastApi, type ToastOptions, type ToastPlacement, ToastProvider, type ToastProviderProps, type ToastTone, useToast };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
import { LinkRender } from "../link-element/LinkElement.js";
|
|
3
|
+
import { ComponentProps, MouseEvent, ReactNode, RefObject } from "react";
|
|
4
|
+
//#region src/components/toc/Toc.d.ts
|
|
5
|
+
export type TocLevel = 1 | 2 | 3;
|
|
6
|
+
type TocOwnProps = {
|
|
7
|
+
/** 列表上面的一行小标。有它时目录以它命名 */
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* 视口上沿往下让多少像素才算"到了"。页面有吸顶的页头时传页头的高度,
|
|
11
|
+
* 并给各节的标题加同样大小的 `scroll-mt-*`
|
|
12
|
+
*/
|
|
13
|
+
offset?: number;
|
|
14
|
+
/** 内容在哪个滚动容器里。不传就是整个页面 */
|
|
15
|
+
target?: RefObject<HTMLElement | null>;
|
|
16
|
+
/** 当前的小节变了:拿到它的 `id`,一节都还没到时是 `null` */
|
|
17
|
+
onActiveChange?: (section: string | null) => void;
|
|
18
|
+
/** `TocItem` */
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export type TocProps = TocOwnProps & Omit<ComponentProps<"nav">, keyof TocOwnProps>;
|
|
22
|
+
/**
|
|
23
|
+
* 页内目录:这一页有哪几节、现在看到了哪一节。里面放 `TocItem`。
|
|
24
|
+
*
|
|
25
|
+
* 位置由使用方给,通常是 `className="sticky top-6"`。点一项仍然是点一个锚点链接——
|
|
26
|
+
* 地址、后退、`scroll-mt` 都是浏览器原生的那一套;它只让这一次跳转滚得平滑
|
|
27
|
+
* (系统开了"减少动态效果"时照旧直接跳)。
|
|
28
|
+
*/
|
|
29
|
+
export declare function Toc({ title, offset, target, onActiveChange, "aria-label": ariaLabel, className, ref, children, ...props }: TocProps): import("react").JSX.Element;
|
|
30
|
+
type TocItemOwnProps = {
|
|
31
|
+
/** `#小节的 id`。小节就是按 `#` 后面这一段找的 */
|
|
32
|
+
href?: string;
|
|
33
|
+
/** 小节的 `id`。地址在 `render` 那个元素手里时用它 */
|
|
34
|
+
section?: string;
|
|
35
|
+
/** 第几级,只影响缩进。默认 1 */
|
|
36
|
+
level?: TocLevel;
|
|
37
|
+
/** 用这个元素代替 `<a>`(路由库的链接组件) */
|
|
38
|
+
render?: LinkRender;
|
|
39
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
export type TocItemProps = TocItemOwnProps & Omit<ComponentProps<"li">, keyof TocItemOwnProps>;
|
|
43
|
+
/** 目录里的一项:一个指向小节的锚点链接。 */
|
|
44
|
+
export declare function TocItem({ href, section, level, render, onClick, children, ...props }: TocItemProps): import("react").JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{focusRingInset as t}from"../../lib/focus-ring.js";import{createLazyContext as n}from"../../lib/create-lazy-context.js";import{mergeRefs as r}from"../../lib/merge-refs.js";import{useScrollPosition as i}from"../../hooks/useScrollPosition.js";import{LinkElement as a}from"../link-element/LinkElement.js";import{indicator as o}from"../../lib/motion.js";import{useIndicator as s}from"../../hooks/useIndicator.js";import{dropEmptyStyle as c}from"../../lib/inline-style.js";import{Children as l,useCallback as u,useContext as d,useEffect as f,useId as p,useMemo as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=/* @__PURE__ */ n({active:null,pick:()=>{}});function b(e){let t=e.map(e=>e.style.getPropertyValue(`scroll-behavior`));for(let t of e)t.style.setProperty(`scroll-behavior`,`smooth`);let n=e.map(e=>e===document.documentElement?window:e),r,i=()=>{clearTimeout(r);for(let e of n)e.removeEventListener(`scroll`,a);e.forEach((e,n)=>{e.style.setProperty(`scroll-behavior`,t[n]),c(e)})};function a(){clearTimeout(r),r=setTimeout(i,150)}for(let e of n)e.addEventListener(`scroll`,a,{passive:!0});return a(),i}function x({title:t,offset:n=0,target:a,onActiveChange:c,"aria-label":d,className:x,ref:S,children:C,...w}){let T=y(),E=h(null),D=s(`[aria-current]`),O=p(),k=l.count(C),A=u(({scrolled:e,room:t})=>{let r=E.current;if(!r)return null;let i=a?.current,o=i?i.getBoundingClientRect().top:0,s=null,c=null;for(let e of r.querySelectorAll(`[data-toc-section]`)){let t=e.dataset.tocSection,r=document.getElementById(t);r&&(c=t,r.getBoundingClientRect().top-o<=n+1&&(s=t))}return t>0&&e>=t-1?c:s},[a,n,k]),j=i(a,A,null),[M,N]=g(null);f(()=>{if(M===null)return;let e=a?.current??window,t=!1,n=setTimeout(()=>{t=!0},150),r=()=>{t?N(null):(clearTimeout(n),n=setTimeout(()=>{t=!0},150))};return e.addEventListener(`scroll`,r,{passive:!0}),()=>{clearTimeout(n),e.removeEventListener(`scroll`,r)}},[M,a]);let P=M??j,F=h(null);f(()=>()=>F.current?.(),[]);let I=u(e=>{if(N(e),F.current?.(),F.current=null,!document.getElementById(e)||typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=a?.current;F.current=b(t?[t,document.documentElement]:[document.documentElement])},[a]),L=h(c);L.current=c;let R=h(null);f(()=>{R.current!==P&&(R.current=P,L.current?.(P))},[P]),f(()=>{let e=E.current;if(!e||P===null||e.scrollHeight<=e.clientHeight+1)return;let t=e.querySelector(`[aria-current]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.top<n.top?e.scrollTop-=n.top-r.top+8:r.bottom>n.bottom&&(e.scrollTop+=r.bottom-n.bottom+8)},[P]);let z=m(()=>({active:P,pick:I}),[P,I]),B=t!=null&&t!==!1;return/* @__PURE__ */ v(`nav`,{...w,ref:r(E,S),"aria-label":d??(B?void 0:`本页目录`),"aria-labelledby":d===void 0&&B?O:void 0,className:e(`text-sm text-ink`,x),children:[B&&/* @__PURE__ */ _(`p`,{id:O,className:`mb-2 pl-4 font-tech text-xs text-ink-secondary`,children:t}),/* @__PURE__ */ _(`ul`,{ref:D,className:e(`before:absolute before:inset-y-0 before:left-0 before:-z-1 before:w-px before:bg-line before:content-['']`,o,`after:top-1 after:h-[calc(var(--indicator-h)-0.5rem)] after:w-[3px] after:translate-y-(--indicator-y) after:bg-ink`,`forced-colors:after:bg-[Highlight]`),children:/* @__PURE__ */ _(T.Provider,{value:z,children:C})})]})}const S={1:`pl-4`,2:`pl-7`,3:`pl-10`},C=e=>{let t=e?.split(`#`)[1];if(t)try{return decodeURIComponent(t)}catch{return t}};function w({href:n,section:r=C(n),level:i=1,render:o,onClick:s,children:c,...l}){let{active:u,pick:f}=d(y()),p=r!==void 0&&r===u;return/* @__PURE__ */ _(`li`,{...l,children:/* @__PURE__ */ _(a,{render:o,href:n,"data-toc-section":r,"data-level":i,"aria-current":p?`location`:void 0,onClick:e=>{s?.(e),!e.defaultPrevented&&r!==void 0&&f(r)},className:e(`relative block py-2 pr-2 leading-snug wrap-anywhere`,`transition-colors duration-(--duration-fast) ease-standard`,t,S[i],p?`text-ink before:absolute before:inset-y-1 before:left-0 before:w-[3px] before:bg-ink before:content-[''] in-data-indicator:before:hidden forced-colors:before:bg-[Highlight]`:`text-ink-secondary hover:text-ink`),children:c})})}export{x as Toc,w as TocItem};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
|
|
2
|
+
import { LinkRender } from "../link-element/LinkElement.js";
|
|
3
|
+
import { ComponentProps, MouseEvent, ReactNode } from "react";
|
|
4
|
+
//#region src/components/toolbar/Toolbar.d.ts
|
|
5
|
+
export type ToolbarSize = "sm" | "md";
|
|
6
|
+
export type ToolbarVariant = "sunken" | "outline";
|
|
7
|
+
export type ToolbarOrientation = "horizontal" | "vertical";
|
|
8
|
+
export type ToolbarProps = Omit<ComponentProps<"div">, "aria-label" | "style"> & {
|
|
9
|
+
/** 这条工具栏管的是什么:"表格工具" */
|
|
10
|
+
"aria-label": string;
|
|
11
|
+
/** 带子高 32 / 40px(里面的钮 28 / 36px),默认 `md`。触屏上用 `md` */
|
|
12
|
+
size?: ToolbarSize;
|
|
13
|
+
/**
|
|
14
|
+
* - `sunken` 凹陷的底,默认;
|
|
15
|
+
* - `outline` 四边描边,放在凹陷底色的区域里时用。
|
|
16
|
+
*/
|
|
17
|
+
variant?: ToolbarVariant;
|
|
18
|
+
/** 竖排时方向键换成上下 */
|
|
19
|
+
orientation?: ToolbarOrientation;
|
|
20
|
+
/** 整条禁用 */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 工具栏:一排作用于同一个对象的小工具,收在一条带子里。整条只占一个 Tab 停靠点,
|
|
25
|
+
* 方向键在各项之间走。里面放 `ToolbarButton`、`ToolbarToggle`、`ToolbarToggleGroup`、
|
|
26
|
+
* `ToolbarGroup`、`ToolbarSeparator`。
|
|
27
|
+
*
|
|
28
|
+
* 不在里面放输入框:左右方向键在输入框里是移光标。
|
|
29
|
+
*/
|
|
30
|
+
export declare function Toolbar({ size, variant, orientation, disabled, className, onKeyDown, ...props }: ToolbarProps): import("react").JSX.Element;
|
|
31
|
+
/** 有字的钮名称就是字;只有图标的必须另给名称 */
|
|
32
|
+
type ItemContentProps = {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
"aria-label"?: string;
|
|
35
|
+
} | {
|
|
36
|
+
children?: undefined;
|
|
37
|
+
"aria-label": string;
|
|
38
|
+
};
|
|
39
|
+
type ButtonOwnProps = {
|
|
40
|
+
/** 图标,在文字左边 */
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/** 传了就渲染成链接 */
|
|
44
|
+
href?: string;
|
|
45
|
+
target?: string;
|
|
46
|
+
rel?: string;
|
|
47
|
+
/** 用这个元素代替 `<a>`(路由库的链接组件)。传了就按链接处理 */
|
|
48
|
+
render?: LinkRender;
|
|
49
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
50
|
+
};
|
|
51
|
+
export type ToolbarButtonProps = ButtonOwnProps & ItemContentProps & Omit<ComponentProps<"button">, keyof ButtonOwnProps | "children" | "aria-label" | "style">;
|
|
52
|
+
/**
|
|
53
|
+
* 工具栏里的一个钮。只有图标时是方的,必须有 `aria-label`。
|
|
54
|
+
* 可以交给 `Menu` / `Popover` 的 `trigger`,也可以用 `Tooltip` 包住。
|
|
55
|
+
*/
|
|
56
|
+
export declare function ToolbarButton({ icon, disabled, href, target, rel, render, onClick, type, className, children, ...props }: ToolbarButtonProps): import("react").JSX.Element;
|
|
57
|
+
type ToggleOwnProps = {
|
|
58
|
+
/** 图标,在文字左边 */
|
|
59
|
+
icon?: ReactNode;
|
|
60
|
+
/** 受控的按下状态。放在 `ToolbarToggleGroup` 里时不用它,用 `value` */
|
|
61
|
+
pressed?: boolean;
|
|
62
|
+
/** 非受控时一开始是不是按下的 */
|
|
63
|
+
defaultPressed?: boolean;
|
|
64
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
65
|
+
/** 在 `ToolbarToggleGroup` 里是这一个钮的标识:组的 `value` 里放的就是它 */
|
|
66
|
+
value?: string;
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
};
|
|
69
|
+
export type ToolbarToggleProps = ToggleOwnProps & ItemContentProps & Omit<ComponentProps<"button">, keyof ToggleOwnProps | "children" | "aria-label" | "aria-pressed" | "style">;
|
|
70
|
+
/** 开关钮:按下是墨底黄记号。单独用,或者几个放进 `ToolbarToggleGroup`。 */
|
|
71
|
+
export declare function ToolbarToggle({ icon, pressed, defaultPressed, onPressedChange, value, disabled, type, className, children, ...props }: ToolbarToggleProps): import("react").JSX.Element;
|
|
72
|
+
export type ToolbarToggleGroupProps = Omit<ComponentProps<"div">, "aria-label" | "defaultValue" | "onChange" | "style"> & {
|
|
73
|
+
/** 这一组管的是什么:"行高" */
|
|
74
|
+
"aria-label": string;
|
|
75
|
+
/** 按下的那几个钮的 `value` */
|
|
76
|
+
value?: string[];
|
|
77
|
+
defaultValue?: string[];
|
|
78
|
+
onValueChange?: (value: string[]) => void;
|
|
79
|
+
/** 可以同时按下几个。默认按下这个,那个就弹起来;一个都不按也可以 */
|
|
80
|
+
multiple?: boolean;
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
};
|
|
83
|
+
/** 一组开关钮。值是数组:没有按下的就是空的。 */
|
|
84
|
+
export declare function ToolbarToggleGroup({ value, defaultValue, onValueChange, multiple, disabled, className, ...props }: ToolbarToggleGroupProps): import("react").JSX.Element;
|
|
85
|
+
export type ToolbarGroupProps = Omit<ComponentProps<"div">, "aria-label" | "style"> & {
|
|
86
|
+
/** 这一组管的是什么 */
|
|
87
|
+
"aria-label": string;
|
|
88
|
+
/** 整组禁用 */
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
};
|
|
91
|
+
/** 把几个钮在读屏里算成一组。看上去没有区别;要分开看,中间放 `ToolbarSeparator`。 */
|
|
92
|
+
export declare function ToolbarGroup({ className, ...props }: ToolbarGroupProps): import("react").JSX.Element;
|
|
93
|
+
export type ToolbarSeparatorProps = Omit<ComponentProps<"div">, "style">;
|
|
94
|
+
/** 分隔:一条短线,方向和工具栏垂直。 */
|
|
95
|
+
export declare function ToolbarSeparator({ className, ...props }: ToolbarSeparatorProps): import("react").JSX.Element;
|
|
96
|
+
//#endregion
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{focusRing as t}from"../../lib/focus-ring.js";import{createLazyContext as n}from"../../lib/create-lazy-context.js";import{useContext as r,useMemo as i}from"react";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";import{Toggle as c}from"@base-ui/react/toggle";import{ToggleGroup as l}from"@base-ui/react/toggle-group";import{Toolbar as u}from"@base-ui/react/toolbar";const d=/* @__PURE__ */ n({size:`md`,orientation:`horizontal`}),f={sunken:`bg-surface-sunken p-0.5`,outline:`border border-line-strong bg-surface p-px`},p={sunken:`forced-colors:outline forced-colors:-outline-offset-1 forced-colors:outline-[ButtonText] forced-colors:data-disabled:outline-[GrayText]`,outline:`forced-colors:border-[ButtonText] forced-colors:data-disabled:border-[GrayText]`};function m({size:t=`md`,variant:n=`sunken`,orientation:r=`horizontal`,disabled:a=!1,className:s,onKeyDown:c,...l}){let m=d(),h=i(()=>({size:t,orientation:r}),[t,r]),g=e=>{let t=e.defaultPrevented;if(c?.(e),!t&&e.defaultPrevented||e.key!==`Home`&&e.key!==`End`)return;let n=e.currentTarget.querySelectorAll(`button[tabindex], a[tabindex]`),r=e.key===`Home`?n[0]:n[n.length-1];r&&(e.preventDefault(),r.focus())};return/* @__PURE__ */ o(m.Provider,{value:h,children:/* @__PURE__ */ o(u.Root,{...l,orientation:r,disabled:a,onKeyDown:g,"data-size":t,"data-variant":n,className:e(`inline-flex max-w-full gap-0.5 text-ink`,r===`vertical`?`flex-col`:`flex-wrap items-center`,f[n],p[n],s)})})}const h={sm:`h-7 min-w-7 after:absolute after:-inset-x-0.5 after:-inset-y-1.5 after:content-['']`,md:`h-9 min-w-9 after:absolute after:-inset-0.5 after:content-['']`},g={sm:`px-2`,md:`px-2.5`},_={sm:`[&_svg]:size-4`,md:`[&_svg]:size-5`},v=[`group/item relative inline-flex shrink-0 items-center justify-center gap-1.5`,`text-sm leading-none font-medium whitespace-nowrap text-ink-secondary select-none`,`transition-colors duration-(--duration-fast) ease-standard`,`hover:bg-ink/5 hover:text-ink active:bg-ink/10`,`data-pressed:bg-surface-inverse data-pressed:text-ink-inverse`,`data-popup-open:bg-surface-inverse data-popup-open:text-ink-inverse`,`data-disabled:cursor-not-allowed data-disabled:bg-transparent data-disabled:text-ink-disabled`,`data-disabled:data-pressed:bg-disabled data-disabled:data-pressed:text-on-disabled`,`forced-colors:data-pressed:forced-color-adjust-none forced-colors:data-pressed:outline-[Highlight]`,`forced-colors:data-pressed:bg-[Highlight] forced-colors:data-pressed:text-[HighlightText]`,`forced-colors:data-disabled:data-pressed:bg-[GrayText] forced-colors:data-disabled:data-pressed:text-[Canvas]`,`forced-colors:data-disabled:text-[GrayText]`,`focus-visible:z-1`,t].join(` `),y=[`flex shrink-0`,`group-data-pressed/item:text-accent-ink-inverse`,`group-data-popup-open/item:text-accent-ink-inverse`,`group-data-disabled/item:group-data-pressed/item:text-on-disabled`,`forced-colors:group-data-pressed/item:text-[HighlightText]`,`forced-colors:group-data-disabled/item:group-data-pressed/item:text-[Canvas]`].join(` `);function b(t,n){let{size:i}=r(d());return e(v,h[i],t?_[i]:[g[i],`[&_svg]:size-4`],n)}function x({icon:e,children:t}){return/* @__PURE__ */ s(a,{children:[e&&/* @__PURE__ */ o(`span`,{className:y,children:e}),t]})}const S=e=>e!=null&&e!==!1;function C({icon:e,disabled:t=!1,href:n,target:r,rel:i,render:a,onClick:s,type:c=`button`,className:l,children:d,...f}){let p=b(!S(d),l),m=/* @__PURE__ */ o(x,{icon:e,children:d});return n!==void 0||a!==void 0?/* @__PURE__ */ o(u.Link,{...f,render:a,href:t?void 0:n,target:r,rel:i,role:t&&a===void 0?`link`:void 0,"aria-disabled":t||void 0,"data-disabled":t?``:void 0,onClick:t?e=>e.preventDefault():s,className:p,children:m}):/* @__PURE__ */ o(u.Button,{...f,type:c,disabled:t,onClick:s,className:p,children:m})}function w({icon:e,pressed:t,defaultPressed:n,onPressedChange:r,value:i,disabled:a=!1,type:s=`button`,className:l,children:d,...f}){let p=b(!S(d),l);return/* @__PURE__ */ o(u.Button,{...f,type:s,disabled:a,render:/* @__PURE__ */ o(c,{pressed:t,defaultPressed:n,onPressedChange:r&&(e=>r(e)),value:i}),className:p,children:/* @__PURE__ */ o(x,{icon:e,children:d})})}const T=`flex gap-0.5 data-[orientation=horizontal]:flex-wrap data-[orientation=horizontal]:items-center data-[orientation=vertical]:flex-col`;function E({value:t,defaultValue:n,onValueChange:i,multiple:a=!1,disabled:s,className:c,...u}){let{orientation:f}=r(d());return/* @__PURE__ */ o(l,{...u,value:t,defaultValue:n,onValueChange:i&&(e=>i(e)),multiple:a,disabled:s,orientation:f,className:e(T,c)})}function D({className:t,...n}){return/* @__PURE__ */ o(u.Group,{...n,className:e(T,t)})}function O({className:t,...n}){return/* @__PURE__ */ o(u.Separator,{...n,className:e(`shrink-0 self-center bg-line-strong`,`forced-colors:bg-[ButtonText] forced-colors:in-data-disabled:bg-[GrayText]`,`data-[orientation=vertical]:mx-1 data-[orientation=vertical]:h-4 data-[orientation=vertical]:w-px`,`data-[orientation=horizontal]:my-1 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-4`,t)})}export{m as Toolbar,C as ToolbarButton,D as ToolbarGroup,O as ToolbarSeparator,w as ToolbarToggle,E as ToolbarToggleGroup};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { Toolbar, ToolbarButton, ToolbarButtonProps, ToolbarGroup, ToolbarGroupProps, ToolbarOrientation, ToolbarProps, ToolbarSeparator, ToolbarSeparatorProps, ToolbarSize, ToolbarToggle, ToolbarToggleGroup, ToolbarToggleGroupProps, ToolbarToggleProps, ToolbarVariant } from "./Toolbar.js";
|
|
3
|
+
export { Toolbar, ToolbarButton, type ToolbarButtonProps, ToolbarGroup, type ToolbarGroupProps, type ToolbarOrientation, type ToolbarProps, ToolbarSeparator, type ToolbarSeparatorProps, type ToolbarSize, ToolbarToggle, ToolbarToggleGroup, type ToolbarToggleGroupProps, type ToolbarToggleProps, type ToolbarVariant };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/components/tooltip/Tooltip.d.ts
|
|
4
|
+
export type TooltipSide = "top" | "bottom" | "left" | "right";
|
|
5
|
+
export type TooltipAlign = "start" | "center" | "end";
|
|
6
|
+
export type TooltipProviderProps = {
|
|
7
|
+
/** 这一组提示统一的延迟,毫秒 */
|
|
8
|
+
delay?: number;
|
|
9
|
+
/** 一个提示消失后多久之内,旁边的提示不用再等延迟,毫秒。默认 400 */
|
|
10
|
+
timeout?: number;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 可选。包住一组相邻的提示(工具栏):第一个出现之后,移到旁边的不用再等延迟。
|
|
15
|
+
*/
|
|
16
|
+
export declare function TooltipProvider({ delay, timeout, children }: TooltipProviderProps): import("react").JSX.Element;
|
|
17
|
+
export type TooltipProps = {
|
|
18
|
+
/** 提示的内容:一句话,不放交互元素 */
|
|
19
|
+
content: ReactNode;
|
|
20
|
+
/** 触发元素:一个能接收 `ref` 与事件的元素(按钮、链接) */
|
|
21
|
+
children: ReactElement<Record<string, unknown>>;
|
|
22
|
+
/** 出现在触发元素的哪一侧,放不下时自动翻到对面。默认 `top` */
|
|
23
|
+
side?: TooltipSide;
|
|
24
|
+
align?: TooltipAlign;
|
|
25
|
+
/**
|
|
26
|
+
* 悬停多久后出现,毫秒,默认 300。键盘聚焦时立刻出现;消失不延迟。
|
|
27
|
+
* 在 `TooltipProvider` 里不传时跟随它的 `delay`。
|
|
28
|
+
*/
|
|
29
|
+
delay?: number;
|
|
30
|
+
/** 指向触发元素的小三角,默认有。关掉后提示贴着触发元素 */
|
|
31
|
+
arrow?: boolean;
|
|
32
|
+
open?: boolean;
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
/** 不再出现 */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** 给提示本身 */
|
|
38
|
+
className?: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 悬停或键盘聚焦时出现的一句说明。触屏上不出现:必要的信息不要只放在这里。
|
|
42
|
+
*
|
|
43
|
+
* 触发元素要有自己的可访问名称(图标按钮的 `aria-label`)。提示的内容会作为
|
|
44
|
+
* 补充说明关联给读屏;它和 `aria-label` 一字不差时不再重复关联。
|
|
45
|
+
*/
|
|
46
|
+
export declare function Tooltip({ content, children, side, align, delay, arrow, open, defaultOpen, onOpenChange, disabled, className }: TooltipProps): import("react").JSX.Element;
|
|
47
|
+
//#endregion
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{createLazyContext as t}from"../../lib/create-lazy-context.js";import{usePortalScope as n}from"../../hooks/usePortalScope.js";import{enterFromSide as r}from"../../lib/motion.js";import{cloneElement as i,useContext as a,useId as o,useSyncExternalStore as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{Tooltip as u}from"@base-ui/react/tooltip";import{createPortal as d}from"react-dom";const f=/* @__PURE__ */ t(!1);function p({delay:e=300,timeout:t,children:n}){let r=f();return/* @__PURE__ */ c(u.Provider,{delay:e,timeout:t,children:/* @__PURE__ */ c(r.Provider,{value:!0,children:n})})}const m=()=>()=>{};function h({id:e,children:t}){return s(m,()=>!0,()=>!1)?d(/* @__PURE__ */ c(`span`,{id:e,hidden:!0,children:t}),document.body):null}function g({content:t,children:s,side:d=`top`,align:p=`center`,delay:m,arrow:g=!0,open:_,defaultOpen:v,onOpenChange:y,disabled:b=!1,className:x}){let S=o(),C=a(f()),{anchorRef:w,portalRef:T}=n({invertTheme:!0}),E=s.props[`aria-label`],D=typeof t==`string`&&typeof E==`string`&&t.trim()===E.trim(),O=!b&&!D,k=s.props[`aria-describedby`],A=O?i(s,{"aria-describedby":typeof k==`string`?`${k} ${S}`:S}):s;return/* @__PURE__ */ l(u.Root,{open:_,defaultOpen:v,onOpenChange:y&&(e=>y(e)),disabled:b,children:[/* @__PURE__ */ c(u.Trigger,{ref:w,render:A,delay:m??(C?void 0:300)}),O&&/* @__PURE__ */ c(h,{id:S,children:t}),/* @__PURE__ */ c(u.Portal,{ref:T,children:/* @__PURE__ */ c(u.Positioner,{side:d,align:p,sideOffset:g?8:2,className:`z-(--z-overlay)`,children:/* @__PURE__ */ l(u.Popup,{className:e(`relative max-w-64 border border-transparent bg-surface-raised px-2.5 py-1.5 text-sm wrap-anywhere text-ink`,`origin-(--transform-origin) transition-[opacity,translate] duration-(--duration-fast) ease-standard`,`data-ending-style:opacity-0 data-instant:transition-none data-starting-style:opacity-0`,r,x),children:[g&&/* @__PURE__ */ c(u.Arrow,{"aria-hidden":`true`,className:e(`size-2 rotate-45 bg-surface-raised forced-colors:hidden`,`data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1 data-[side=top]:-bottom-1`)}),t]})})})]})}export{g as Tooltip,p as TooltipProvider};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
//#region src/components/top-bar/TopBar.d.ts
|
|
4
|
+
export type TopBarProps = ComponentProps<"header"> & {
|
|
5
|
+
/** 最左边的标志。本库不带标志,传你自己的 */
|
|
6
|
+
brand?: ReactNode;
|
|
7
|
+
/** 工具图标钮:几个 `IconButton` */
|
|
8
|
+
tools?: ReactNode;
|
|
9
|
+
/** 主行动:放一个 `NavAction` */
|
|
10
|
+
action?: ReactNode;
|
|
11
|
+
/** 最右边的菜单钮:放一个 `NavMenu`(它自己带着触发按钮) */
|
|
12
|
+
menu?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 顶栏:窄屏上的主导航。从左到右是标志、空白、工具图标钮、主行动、菜单钮;
|
|
16
|
+
* 栏目本身不排在这一条里,收进 `NavMenu`。
|
|
17
|
+
*
|
|
18
|
+
* 默认 `sticky` 贴在顶上。它只管排版,各格放什么由使用方给。
|
|
19
|
+
*/
|
|
20
|
+
export declare function TopBar({ brand, tools, action, menu, className, children, ...props }: TopBarProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{getNavActionContext as t}from"../nav-action/NavAction.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";function i({brand:i,tools:a,action:o,menu:s,className:c,children:l,...u}){let d=t();return/* @__PURE__ */ r(`header`,{...u,className:e(`sticky top-0 z-(--z-nav) flex h-14 shrink-0 items-center gap-2 border-b border-line bg-surface px-4 text-ink shadow-lg`,c),children:[i&&/* @__PURE__ */ n(`div`,{className:`flex min-w-0 items-center`,children:i}),/* @__PURE__ */ n(`div`,{className:`min-w-0 flex-1`,children:l}),a&&/* @__PURE__ */ n(`div`,{className:`flex shrink-0 items-center gap-1`,children:a}),o&&/* @__PURE__ */ n(d.Provider,{value:`inline`,children:o}),s]})}export{i as TopBar};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
//#region src/components/viewfinder/Viewfinder.d.ts
|
|
4
|
+
export type ViewfinderSize = "sm" | "md";
|
|
5
|
+
export type ViewfinderReadouts = {
|
|
6
|
+
topLeft?: ReactNode;
|
|
7
|
+
topRight?: ReactNode;
|
|
8
|
+
bottomLeft?: ReactNode;
|
|
9
|
+
bottomRight?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type ViewfinderProps = ComponentProps<"div"> & {
|
|
12
|
+
/** 取景角的臂长:16px 或 24px */
|
|
13
|
+
size?: ViewfinderSize;
|
|
14
|
+
/** 正中放一个小准星,标出焦点 */
|
|
15
|
+
crosshair?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 挂上的时候取景角落位:八段短线各自从角上伸出来,播一次。
|
|
18
|
+
* 默认不动——取景角平时是静态的装饰。要它晚一点再动(等外面那一层先淡入完),
|
|
19
|
+
* 在外层设 `--bracket-delay`
|
|
20
|
+
*/
|
|
21
|
+
animate?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 四个角上的读数:坐标、比例、版本、时间码。
|
|
24
|
+
* 必须是真实的数据;没有就不放。
|
|
25
|
+
*/
|
|
26
|
+
readouts?: ViewfinderReadouts;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 取景角:框住一张图、一片地图区域、一个焦点,标的是"范围",不是选中。
|
|
30
|
+
* 里面放被框住的内容;压在深色画面上时给它加 `data-theme="dark"`。
|
|
31
|
+
*
|
|
32
|
+
* 只用在展示性的画面上,一屏一处。取景角与准星是装饰,读数是真实信息、读屏读得到。
|
|
33
|
+
*/
|
|
34
|
+
export declare function Viewfinder({ size, crosshair, animate, readouts, className, children, ...props }: ViewfinderProps): import("react").JSX.Element;
|
|
35
|
+
//#endregion
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{decor as t}from"../../lib/decor.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";const i={sm:`[--bracket-arm:16px]`,md:`[--bracket-arm:24px]`},a={topLeft:`top-5 left-5`,topRight:`top-5 right-5 text-right`,bottomLeft:`bottom-5 left-5`,bottomRight:`right-5 bottom-5 text-right`};function o({size:o=`sm`,crosshair:s=!1,animate:c=!1,readouts:l,className:u,children:d,...f}){return/* @__PURE__ */ r(`div`,{...f,className:e(`relative text-ink`,u),children:[d,/* @__PURE__ */ n(`span`,{"aria-hidden":`true`,className:e(t,`corner-brackets absolute inset-3 [--bracket-color:currentColor] [--bracket-offset:0px] [--bracket-width:1.5px]`,i[o],c&&`after:animate-bracket-in after:[animation-delay:var(--bracket-delay,0s)]`)}),s&&/* @__PURE__ */ n(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,className:e(`pointer-events-none select-none forced-colors:hidden print:hidden`,`absolute top-1/2 left-1/2 size-3 -translate-1/2 text-accent-ink`),children:/* @__PURE__ */ n(`path`,{d:`M6 0v12M0 6h12`})}),l&&Object.keys(a).map(t=>l[t]!==void 0&&/* @__PURE__ */ n(`span`,{"data-corner":t,className:e(`pointer-events-none absolute font-tech text-xs leading-none text-ink-secondary tabular-nums`,a[t]),children:l[t]},t))]})}export{o as Viewfinder};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { CSSProperties, ComponentProps, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
4
|
+
//#region src/game/animated-dialog/AnimatedDialog.d.ts
|
|
5
|
+
type PopupProps = ComponentProps<typeof Dialog.Popup>;
|
|
6
|
+
type PortalProps = ComponentProps<typeof Dialog.Portal>;
|
|
7
|
+
type CloseAction = () => boolean | void | PromiseLike<boolean | void>;
|
|
8
|
+
type SlotClassName = string | ((open: boolean) => string);
|
|
9
|
+
export type AnimatedDialogClassNames = {
|
|
10
|
+
backdrop?: SlotClassName;
|
|
11
|
+
alert?: SlotClassName;
|
|
12
|
+
contentContainer?: SlotClassName;
|
|
13
|
+
header?: SlotClassName;
|
|
14
|
+
title?: SlotClassName;
|
|
15
|
+
footer?: SlotClassName;
|
|
16
|
+
close?: SlotClassName;
|
|
17
|
+
};
|
|
18
|
+
export type AnimatedDialogProps = Omit<ComponentProps<"div">, "title" | "children" | "onClose" | "className" | "style"> & {
|
|
19
|
+
trigger?: ReactElement<Record<string, unknown>>;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
title: ReactNode;
|
|
24
|
+
description?: ReactNode;
|
|
25
|
+
icon?: ReactNode;
|
|
26
|
+
width?: CSSProperties["width"];
|
|
27
|
+
height?: CSSProperties["height"];
|
|
28
|
+
className?: string;
|
|
29
|
+
classNames?: AnimatedDialogClassNames;
|
|
30
|
+
/** 点遮罩是否请求关闭。默认允许。 */
|
|
31
|
+
dismissible?: boolean;
|
|
32
|
+
/** Esc 是否请求关闭。未传时跟随 dismissible。 */
|
|
33
|
+
keyboardCloseable?: boolean;
|
|
34
|
+
/** 所有内部关闭请求都会执行;返回 false 或失败时保持打开。 */
|
|
35
|
+
onClose?: CloseAction;
|
|
36
|
+
/** 遮罩与 Esc 请求先执行此回调,再执行 onClose。 */
|
|
37
|
+
onDismiss?: CloseAction;
|
|
38
|
+
closeLabel?: string;
|
|
39
|
+
initialFocus?: PopupProps["initialFocus"];
|
|
40
|
+
finalFocus?: PopupProps["finalFocus"];
|
|
41
|
+
keepMounted?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 是不是模态。默认是。传 `false` 时不锁焦点、不锁页面滚动,页面的其余部分照常能用——
|
|
44
|
+
* 配上 `container` 可以把弹窗嵌在页面的一块区域里展示。
|
|
45
|
+
*/
|
|
46
|
+
modal?: boolean;
|
|
47
|
+
/** 弹层挂到哪个元素里。默认挂在 `<body>` 下 */
|
|
48
|
+
container?: PortalProps["container"];
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
};
|
|
51
|
+
export declare function AnimatedDialog({ trigger, open: controlledOpen, defaultOpen, onOpenChange, title, description, icon, width, height, className, classNames, dismissible, keyboardCloseable, onClose, onDismiss, closeLabel, initialFocus, finalFocus, keepMounted, modal, container, children, ...popupProps }: AnimatedDialogProps): import("react").JSX.Element;
|
|
52
|
+
//#endregion
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{usePortalScope as t}from"../../hooks/usePortalScope.js";import{firstFocusableIn as n}from"../lib/first-focusable.js";import{useCallback as r,useLayoutEffect as i,useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";function u(e,t){return typeof e==`function`?e(t):e}function d({trigger:d,open:f,defaultOpen:p=!1,onOpenChange:m,title:h,description:g,icon:_,width:v,height:y,className:b,classNames:x,dismissible:S=!0,keyboardCloseable:C,onClose:w,onDismiss:T,closeLabel:E=`关闭`,initialFocus:D,finalFocus:O,keepMounted:k=!1,modal:A,container:j,children:M,...N}){let[P,F]=o(p),I=f??P,[L,R]=o(!1),z=a({open:I,session:0,locked:!1,mounted:!0}),B=a(null),{anchorRef:V,portalRef:H}=t(),U=r(()=>n(B)(),[]);i(()=>{let e=z.current;return e.mounted=!0,()=>{e.mounted=!1,e.session+=1,e.locked=!1}},[]),i(()=>{z.current.open!==I&&(z.current.open=I,z.current.session+=1,z.current.locked=!1,R(!1))},[I]);let W=r(e=>{f===void 0&&F(e),m?.(e)},[f,m]),G=r(async e=>{let t=z.current;if(!t.open||t.locked||!t.mounted)return;t.locked=!0;let n=t.session;R(!0);let r=()=>z.current.mounted&&z.current.open&&z.current.session===n;try{if(e&&(await T?.()===!1||!r()))return;await w?.()!==!1&&r()&&W(!1)}catch{}finally{r()&&(z.current.locked=!1,R(!1))}},[w,T,W]);return/* @__PURE__ */ c(l.Root,{open:I,onOpenChange:(e,t)=>{if(e){W(!0);return}if(t.cancel(),t.reason===`escape-key`&&!(C??S))return;let n=t.reason===`escape-key`||t.reason===`outside-press`||t.reason===`focus-out`;(!n||t.reason===`escape-key`||S)&&G(n)},disablePointerDismissal:!S,modal:A,children:[d&&/* @__PURE__ */ s(l.Trigger,{ref:V,render:d}),/* @__PURE__ */ c(l.Portal,{ref:H,keepMounted:k,container:j,children:[/* @__PURE__ */ s(l.Backdrop,{className:e(`ef-animated-dialog-backdrop`,u(x?.backdrop,I))}),/* @__PURE__ */ s(l.Viewport,{className:`ef-animated-dialog-viewport`,children:/* @__PURE__ */ c(l.Popup,{...N,"aria-busy":L||void 0,initialFocus:D??U,finalFocus:O,style:{width:v,height:y},className:e(`ef-animated-dialog`,b,u(x?.alert,I)),children:[/* @__PURE__ */ c(`header`,{className:e(`ef-animated-dialog__header`,u(x?.header,I)),children:[/* @__PURE__ */ c(`div`,{"aria-hidden":`true`,className:`ef-animated-dialog__top-strip`,children:[/* @__PURE__ */ s(`span`,{className:`ef-animated-dialog__yellow-block`}),/* @__PURE__ */ c(`span`,{className:`ef-animated-dialog__top-deco`,children:[/* @__PURE__ */ c(`svg`,{viewBox:`0 0 120 10`,children:[/* @__PURE__ */ s(`polygon`,{points:`0,2 7,2 3.5,8`,fill:`currentColor`}),/* @__PURE__ */ s(`text`,{x:`7`,y:`7`,fontSize:`7`,fontStyle:`italic`,children:`//`}),/* @__PURE__ */ s(`text`,{x:`16`,y:`7`,fontSize:`7`,children:`ARKNIGHTS:ENDFIELD`})]}),/* @__PURE__ */ c(`svg`,{viewBox:`0 0 10 10`,className:`ef-animated-dialog__plus`,children:[/* @__PURE__ */ s(`rect`,{x:`0.5`,y:`0.5`,width:`9`,height:`9`,fill:`none`,stroke:`currentColor`}),/* @__PURE__ */ s(`path`,{d:`M5 2.5v5M2.5 5h5`,stroke:`currentColor`})]})]})]}),/* @__PURE__ */ c(`div`,{className:`ef-animated-dialog__title-band`,children:[/* @__PURE__ */ s(`div`,{"aria-hidden":`true`,className:`ef-animated-dialog__icon-slot`,children:/* @__PURE__ */ s(`span`,{className:`ef-animated-dialog__icon`,children:_})}),/* @__PURE__ */ s(l.Title,{className:e(`ef-animated-dialog__title`,u(x?.title,I)),children:/* @__PURE__ */ s(`span`,{children:h})}),/* @__PURE__ */ s(`span`,{"aria-hidden":`true`,className:`ef-animated-dialog__title-deco`,children:`ENDFIELD`})]}),/* @__PURE__ */ s(`div`,{className:`ef-animated-dialog__close-motion`,children:/* @__PURE__ */ s(l.Close,{"aria-label":E,"aria-disabled":L||void 0,className:e(`ef-animated-dialog__close`,u(x?.close,I)),children:/* @__PURE__ */ s(`svg`,{"aria-hidden":`true`,viewBox:`0 0 205 205`,fill:`currentColor`,fillRule:`evenodd`,children:/* @__PURE__ */ s(`path`,{d:`M0 25L25 0L205 180L180 205ZM25 205L0 180L180 0L205 25Z`})})})}),/* @__PURE__ */ s(`div`,{"aria-hidden":`true`,className:`ef-animated-dialog__separator`})]}),/* @__PURE__ */ c(`div`,{"data-theme":`light`,className:e(`ef-animated-dialog__content`,u(x?.contentContainer,I)),children:[/* @__PURE__ */ c(`div`,{ref:B,className:`ef-animated-dialog__body`,children:[g&&/* @__PURE__ */ s(l.Description,{className:`ef-animated-dialog__description`,children:g}),M]}),/* @__PURE__ */ s(`span`,{"aria-hidden":`true`,className:`ef-animated-dialog__registration`})]}),/* @__PURE__ */ c(`footer`,{"aria-hidden":`true`,className:e(`ef-animated-dialog__footer`,u(x?.footer,I)),children:[/* @__PURE__ */ s(`span`,{className:`ef-animated-dialog__footer-square`}),/* @__PURE__ */ s(`span`,{className:`ef-animated-dialog__footer-outline`}),/* @__PURE__ */ s(`span`,{className:`ef-animated-dialog__footer-hatch`})]})]})})]})]})}export{d as AnimatedDialog};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 141 64">
|
|
2
|
+
<path fill-rule="evenodd" fill="#666"
|
|
3
|
+
d="M63.679 63.167v-7.085h7.089v7.085h-7.089zm0-17.662h7.089v7.085h-7.089v-7.085zm-10.94 10.577h7.09v7.085h-7.09v-7.085zm0-10.577h7.09v7.085h-7.09v-7.085zM41.8 56.082h7.09v7.085H41.8v-7.085zm0-10.577h7.09v7.085H41.8v-7.085zM30.861 56.082h7.09v7.085h-7.09v-7.085zm0-10.577h7.09v7.085h-7.09v-7.085zM19.922 56.082h7.09v7.085h-7.09v-7.085zm0-10.577h7.09v7.085h-7.09v-7.085zM8.983 56.082h7.09v7.085h-7.09v-7.085zm0-10.577h7.09v7.085h-7.09v-7.085zM137.612 29.055h-2.427v-5.963h2.41c1.816 0 3.176 1.192 3.176 3.007 0 1.823-1.369 2.956-3.159 2.956zm-.086-4.864h-1.145v3.764h1.162c1.05 0 2.023-.553 2.023-1.856 0-1.295-.973-1.908-2.04-1.908zm-4.632 3.671h-2.711l-.456 1.193h-1.265l2.41-5.963h1.351l2.41 5.963h-1.282l-.457-1.193zm-.921-2.385c-.206-.511-.413-1.039-.421-1.048h-.026c-.009.009-.215.528-.422 1.048l-.508 1.312h1.877l-.5-1.312zm-6.654 3.688c-1.816 0-3.159-1.26-3.159-3.092 0-1.84 1.343-3.1 3.159-3.1 1.816 0 3.159 1.26 3.159 3.1 0 1.832-1.343 3.092-3.159 3.092zm0-5.077c-1.111 0-1.954.767-1.954 1.985 0 1.21.843 1.976 1.954 1.976 1.11 0 1.954-.758 1.954-1.976s-.844-1.985-1.954-1.985zm-7.417-.996h1.197v4.863h2.857v1.1h-4.054v-5.963zm-2.807 5.963h-1.205v-2.428l-2.272-3.535 1.386-.009 1.067 1.738c.249.4.439.724.447.732h.026c.009-.008.189-.332.439-.724l1.102-1.737h1.282l-2.272 3.535v2.428zm-4.051 0l-.456-1.193h-2.711l-.457 1.193h-1.265l2.41-5.963h1.351l2.41 5.963h-1.282zm-1.377-3.578c-.207-.511-.413-1.039-.422-1.048h-.026c-.008.009-.215.528-.421 1.048l-.508 1.312h1.876l-.499-1.312zm-5.541 1.593h-.912v1.985h-1.197v-5.963h2.109c1.446 0 2.324.724 2.324 1.993 0 1.227-.878 1.985-2.324 1.985zm.034-2.896h-.946v1.857h.946c.741 0 1.093-.35 1.093-.929 0-.596-.37-.928-1.093-.928zm-7.041 4.881h-1.197v-4.864h-1.919v-1.099h5.035v1.099h-1.919v4.864zm-7.831-3.987h-.026c0 .008.018.724.018 1.482v2.505h-1.197v-5.963h1.214l2.883 3.927h.026c0-.009-.017-.75-.017-1.406v-2.521h1.196v5.963h-1.213l-2.884-3.987zm-6.401-1.976h4.278v1.099h-3.081v1.252h2.315v1.107h-2.315v1.405H87.2v1.1h-4.313v-5.963zm.317 9.937c-.276-.46-.801-.895-1.653-.895-1.11 0-1.859.784-1.859 1.977 0 1.218.792 1.984 1.851 1.984.852 0 1.454-.443 1.738-1.039l1.179.307c-.464 1.149-1.558 1.848-2.857 1.848-1.782 0-3.116-1.244-3.116-3.109 0-1.832 1.334-3.084 3.116-3.084 1.394 0 2.393.75 2.788 1.687l-1.187.324zm-4.247-3.974H76.53v-5.963h2.41c1.816 0 3.176 1.192 3.176 3.007 0 1.823-1.368 2.956-3.159 2.956zm-.086-4.864h-1.144v3.764h1.162c1.05 0 2.022-.553 2.022-1.856 0-1.295-.972-1.908-2.04-1.908zM77.224 37.1l-.457-1.192h-2.711L73.6 37.1h-1.265l2.41-5.962h1.351l2.41 5.962h-1.282zm-1.378-3.577c-.206-.511-.413-1.039-.421-1.048h-.026c-.008.009-.215.528-.422 1.048l-.508 1.312h1.877l-.5-1.312zm-4.506-8.455h-.025c0 .008.017.724.017 1.482v2.505h-1.196v-5.963h1.213l2.884 3.927h.025c0-.009-.017-.75-.017-1.406v-2.521h1.197v5.963h-1.214l-2.884-3.987zm-6.4-1.976h4.277v1.099h-3.081v1.252h2.315v1.107h-2.315v1.405h3.116v1.1H64.94v-5.963zm-2.929 3.978h-.912v1.985h-1.197v-5.963h2.109c1.446 0 2.324.724 2.324 1.993 0 1.227-.878 1.985-2.324 1.985zm.034-2.896h-.946v1.857h.946c.741 0 1.093-.35 1.093-.929 0-.596-.37-.928-1.093-.928zm-7.339-1.082h4.278v1.099h-3.081v1.252h2.315v1.107h-2.315v1.405h3.115v1.1h-4.312v-5.963zm-3.93 5.963h-2.427v-5.963h2.41c1.816 0 3.176 1.192 3.176 3.007 0 1.823-1.368 2.956-3.159 2.956zm-.086-4.864h-1.144v3.764h1.162c1.05 0 2.022-.553 2.022-1.856 0-1.295-.972-1.908-2.04-1.908zm-.311 10.874c0-.009-.018-.75-.018-1.406v-2.521h1.197V37.1h-1.214l-2.883-3.986h-.026c0 .008.017.724.017 1.482V37.1h-1.196v-5.962h1.213l2.884 3.927h.026zm-6.514-9.554h3.425v.971h-3.425v-.971zm-5.244-.443h-.025c0 .008.017.724.017 1.482v2.505h-1.197v-5.963h1.214l2.883 3.927h.026c0-.009-.017-.75-.017-1.406v-2.521h1.196v5.963h-1.213l-2.884-3.987zm-5.154 4.097c-1.816 0-3.158-1.26-3.158-3.092 0-1.84 1.342-3.1 3.158-3.1 1.816 0 3.159 1.26 3.159 3.1 0 1.832-1.343 3.092-3.159 3.092zm0-5.077c-1.11 0-1.953.767-1.953 1.985 0 1.21.843 1.976 1.953 1.976 1.111 0 1.954-.758 1.954-1.976s-.843-1.985-1.954-1.985zm.456 8.149h-3.081v1.252h2.315v1.107h-2.315v1.405h3.116V37.1h-4.312v-5.962h4.277v1.099zm-5.591-9.145h1.197v5.963h-1.197v-5.963zM25.6 25.57c.895.171 1.911.512 1.911 1.815 0 1.184-.844 1.78-2.273 1.78-1.033 0-2.212-.315-2.505-1.627l1.145-.306c.095.587.62.894 1.36.894.654 0 1.059-.247 1.059-.741 0-.707-.809-.699-1.558-.878-.818-.187-1.842-.536-1.842-1.78 0-1.158.878-1.754 2.203-1.754 1.188 0 2.049.485 2.367 1.533l-1.144.298c-.155-.503-.551-.784-1.248-.784-.663 0-.956.256-.956.673 0 .597.637.707 1.481.877zm-5.608 3.595c-1.032 0-2.212-.315-2.504-1.627l1.144-.306c.095.587.62.894 1.36.894.654 0 1.059-.247 1.059-.741 0-.707-.809-.699-1.558-.878-.818-.187-1.842-.536-1.842-1.78 0-1.158.878-1.754 2.204-1.754 1.188 0 2.048.485 2.366 1.533l-1.144.298c-.155-.503-.551-.784-1.248-.784-.663 0-.956.256-.956.673 0 .597.637.707 1.481.877.895.171 1.911.512 1.911 1.815 0 1.184-.844 1.78-2.273 1.78zM8.489.789h13.776v13.633H8.489V.789zM9.56 13.362h11.633V1.849H9.56v11.513zm6.487-2.178h-1.341V8.269h-2.945V6.942h2.945V4.027h1.341v2.915h2.945v1.327h-2.945v2.915zm-5.792 23.369c-.818-.187-1.842-.536-1.842-1.78 0-1.158.878-1.755 2.203-1.755 1.188 0 2.049.486 2.367 1.533l-1.144.299c-.155-.503-.551-.784-1.248-.784-.663 0-.956.256-.956.673 0 .596.637.707 1.481.877.895.171 1.91.512 1.91 1.815 0 1.184-.843 1.78-2.272 1.78-1.033 0-2.212-.315-2.504-1.627l1.144-.306c.095.587.62.894 1.36.894.654 0 1.059-.247 1.059-.741 0-.707-.809-.699-1.558-.878zm-4.049-9.13l-.62.442-.542-.766-.542.766-.62-.442.56-.75-.887-.264.232-.716.878.282-.008-.929h.766v.929l.878-.282.232.716-.895.264.568.75zm-3.271 0l-.62.442-.542-.766-.542.766-.62-.442.56-.75-.887-.264.232-.716.878.282-.008-.929h.766v.929l.878-.282.232.716-.895.264.568.75zm6.795 3.632H8.534v-5.963h1.273l1.687 2.99h.026l1.696-2.99h1.222v5.963h-1.197v-1.866c0-1.244.018-2.121.018-2.13h-.018c-.008.009-.275.52-.654 1.185l-.757 1.337h-.68l-.757-1.32c-.388-.682-.646-1.193-.655-1.202h-.025c0 .009.017.886.017 2.13v1.866zm5.803-5.963h1.196v5.963h-1.196v-5.963zm-.04 9.775c.249.4.439.724.447.732h.026c.009-.008.19-.332.439-.724l1.102-1.737h1.282l-2.272 3.534V37.1h-1.205v-2.428l-2.272-3.534 1.386-.009 1.067 1.738zm5.805 3.305c.654 0 1.059-.247 1.059-.741 0-.707-.809-.699-1.558-.878-.818-.187-1.842-.536-1.842-1.78 0-1.158.878-1.755 2.203-1.755 1.188 0 2.049.486 2.367 1.533l-1.144.299c-.155-.503-.551-.784-1.248-.784-.663 0-.956.256-.956.673 0 .596.637.707 1.481.877.895.171 1.91.512 1.91 1.815 0 1.184-.843 1.78-2.272 1.78-1.033 0-2.212-.315-2.504-1.627l1.144-.306c.095.587.62.894 1.36.894zm7.73-3.935h-1.92V37.1h-1.196v-4.863h-1.919v-1.099h5.035v1.099zm8.774 1.891h.026l1.696-2.99h1.222V37.1h-1.197v-1.865c0-1.244.018-2.121.018-2.13h-.018c-.008.009-.275.52-.654 1.184l-.757 1.338h-.68l-.757-1.32c-.388-.682-.646-1.193-.655-1.202h-.025c0 .009.017.886.017 2.13V37.1h-1.197v-5.962h1.274l1.687 2.99zM45.18 37.1h-1.197v-5.962h1.197V37.1zm12.031-4.863h-1.92V37.1h-1.196v-4.863h-1.92v-1.099h5.036v1.099zm4.895 0h-3.081v1.252h2.315v1.107h-2.315v1.405h3.116V37.1h-4.313v-5.962h4.278v1.099zm5.411.86c0 .86-.448 1.439-1.222 1.678l1.42 2.325h-1.42l-1.214-2.095h-.86V37.1h-1.197v-5.962h2.135c1.489 0 2.358.749 2.358 1.959zm-3.296.954h1.024c.654 0 1.05-.273 1.05-.894 0-.614-.379-.937-1.067-.937h-1.007v1.831zm8.402-1.814h-3.021v1.422h2.367v1.107h-2.367V37.1h-1.196v-5.962h4.217v1.099zm16.822 0h-3.082v1.252h2.316v1.107h-2.316v1.405h3.116V37.1h-4.312v-5.962h4.278v1.099zm3.016 3.935c.654 0 1.059-.247 1.059-.741 0-.707-.809-.699-1.558-.878-.818-.187-1.842-.536-1.842-1.78 0-1.158.878-1.755 2.203-1.755 1.188 0 2.049.486 2.367 1.533l-1.144.299c-.155-.503-.551-.784-1.248-.784-.663 0-.956.256-.956.673 0 .596.637.707 1.481.877.895.171 1.91.512 1.91 1.815 0 1.184-.843 1.78-2.272 1.78-1.033 0-2.212-.315-2.505-1.627l1.145-.306c.095.587.62.894 1.36.894z" />
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 214 233" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="currentColor" d="M95.1 95.5V115L63.5 92.7 76.8 82.9 95.1 95.5ZM171.1 53.2V63.1H204.5V78.8H171.1V81.9L213.8 111.5V130.3H214.4V233.6H59.4L44.1 225.8V186.3L35.2 189.7V171.5H30V193.6L39.8 190V212.2L1.4 226.3V204.1L12.1 200.2V171.5H3.7V155.8H12.1V136H30V155.8H39.8V168.7L44.1 167V142.1H62V160.2L66.3 158.5V130.8H84.2V151.7L106.7 143.1V197.1L88.8 204.6V169.2L84.2 171V206L66.3 213.5V177.8L62 179.5V217.3H111.1V130.3H151.5V101.1L109.8 130.5H84.2L48.5 105.2 61.8 95.4 97 119.6 151.5 81.9V78.8H118V63.1H151.5V53.2H107.9V57.1L89.8 69.8 110.8 83.5V102.1L76.8 78.8 45.6 100.5 45.6 102.9 4.7 111.7V106.4L38.9 47.6H45.4L59.8 28.3H79.1L72.3 37.5H151.5V27.7H171.1V37.5H214.6V53.2H171.1ZM53.4 62.8 47.1 71.2H42.6L33.4 89 41.6 87V84.8L63.4 69.6 53.4 62.8ZM64.3 53.2 76.1 60.8 87.1 53.2H64.3ZM171.1 101.1V130.3H212.6L171.1 101.1ZM186 208V212.4H188.7V201.2H186V205.5H181.8V201.2H179.1V212.4H181.8V208H186ZM203.2 210.2C202 210.2 201.2 209.4 200.9 208.5L198.3 209.2C199.1 211.3 200.7 212.6 203 212.6 205.6 212.6 207.4 211.1 207.4 209.1 207.4 207.2 205.7 206.2 204 205.6 202.6 205.1 201.5 204.9 201.5 204.1 201.5 203.7 202 203.3 202.8 203.3 203.6 203.3 204.4 203.8 204.7 204.7L207.3 204C206.8 202.3 205.1 201 202.9 201 200.5 201 198.8 202.6 198.8 204.3 198.8 206.3 200.3 207 201.7 207.5 203.2 208.1 204.6 208.3 204.6 209.2 204.6 209.8 204.1 210.2 203.2 210.2ZM195.5 228.2H201.3C205.1 228.2 208.1 225.6 208.1 221.6 208.1 217.7 205.1 215 201.3 215H195.5V228.2ZM198.7 203.7V201.2H189.3V203.7H192.6V212.4H195.3V203.7H198.7ZM185.1 228.2H194.6V225.2H188.3V215H185.1V228.2ZM173.5 228.2H183.3V225.2H176.7V222.9H181.8V220.1H176.7V217.9H183.2V215H173.5V228.2ZM168.3 228.2H171.5V215H168.3V228.2ZM157.7 228.2H160.9V223.4H165.7V220.5H160.9V217.9H167.1V215H157.7V228.2ZM144 228.2H149.8C153.6 228.2 156.6 225.6 156.6 221.6 156.6 217.7 153.6 215 149.8 215H144V228.2ZM130.1 228.2H133.3V225.3C133.3 222.4 133.3 220.3 133.3 220.3H133.3C133.3 220.3 135.1 222.8 136.3 224.5L139 228.2H142V215H138.8V218C138.8 220.4 138.9 222.7 138.8 222.7H138.8C138.8 222.7 136.8 219.9 135.9 218.7L133.1 215H130.1V228.2ZM118.5 228.2H128.2V225.2H121.7V222.9H126.7V220.1H121.7V217.9H128.1V215H118.5V228.2ZM125.7 201.2H123.1L118.7 212.4H121.6L122.2 210.6H126.6L127.3 212.4H130.2L125.7 201.2ZM139 205C139 202.7 137.3 201.2 134.5 201.2H130.3V212.4H133V208.7H134.4L136.4 212.4H139.4L137 208.2C138.2 207.6 139 206.5 139 205ZM150.5 201.2H147.2L144.5 203.9C143.4 205 143.1 205.4 143 205.4H143C143 205.4 143.1 204.9 143.1 203V201.2H140.4V212.4H143.1V208.7L144 207.7 147.4 212.4H150.5L145.8 206 150.5 201.2ZM161.3 201.2H158.6V203.8C158.6 205.8 158.7 207.8 158.6 207.8H158.6C158.6 207.8 156.9 205.3 156.2 204.4L153.8 201.2H151.3V212.4H154V209.9C154 207.5 153.9 205.7 154 205.7H154C154 205.7 155.5 207.9 156.5 209.3L158.8 212.4H161.3V201.2ZM165.7 201.2H163V212.4H165.7V201.2ZM166.6 206.8C166.6 210.1 169.2 212.6 172.4 212.6 173.5 212.6 174.8 212.2 175.4 211.5H175.4C175.4 211.5 175.4 211.6 175.4 212.4H177.7V206H172.5V208.2H175.4V208.2C175.1 209 174.3 210 172.5 210 170.7 210 169.4 208.7 169.4 206.8 169.4 204.9 170.5 203.6 172.4 203.6 173.3 203.6 174.2 204 174.7 204.7L177.5 203.9C176.5 202.1 174.6 201 172.4 201 169.2 201 166.6 203.4 166.6 206.8ZM134.8 206.4H133V203.7H134.8C135.8 203.7 136.2 204.4 136.2 205 136.2 205.6 135.8 206.4 134.8 206.4ZM123.9 206.1C124.1 205.5 124.4 204.5 124.4 204.5H124.4C124.4 204.5 124.7 205.5 125 206.1L125.8 208.3H123.1L123.9 206.1ZM153.3 221.6C153.3 223.9 151.7 225.2 149.8 225.2H147.2V217.9H149.8C151.7 217.9 153.3 219.4 153.3 221.6ZM204.8 221.6C204.8 223.9 203.2 225.2 201.3 225.2H198.7V217.9H201.3C203.2 217.9 204.8 219.4 204.8 221.6ZM88.4 19.9C87.6 19 86 17.6 84.6 16.7L86.7 14.9C88.1 15.7 89.9 16.9 90.7 17.9L88.4 19.9ZM95.3 19.9C95.3 21.5 95 22.4 94.1 22.9 93.1 23.4 91.8 23.5 90.1 23.5 90 22.6 89.6 21.1 89.1 20.3A45.2 45.2 0 0091.4 20.3C91.7 20.3 91.8 20.2 91.8 19.9V14.6H83.4C83 17.9 81.9 21.3 79.2 23.6 78.7 22.9 77.3 21.7 76.6 21.3 78.8 19.5 79.7 17 80 14.6H77.1V11.5H80.2V4.2H85C85.3 3.3 85.6 2.3 85.8 1.5L90 1.8C89.6 2.7 89.1 3.5 88.6 4.2H95.3V11.5H98.2V14.6H95.3V19.9ZM83.6 7.2V11.5H87.8C87.1 10.7 85.8 9.7 84.8 8.9L86.8 7.2H83.6ZM91.8 7.2H87.1C88.2 8 89.6 9.1 90.3 9.9L88.4 11.5H91.8V7.2ZM65.5 10.7H75.5S75.4 11.7 75.4 12.1C75 18.3 74.5 20.9 73.5 22 72.7 22.8 71.9 23.1 70.7 23.2 69.7 23.3 68.2 23.3 66.7 23.2 66.6 22.3 66.1 20.9 65.4 20A48.4 48.4 0 0069.4 20.1C69.8 20.1 70.2 20.1 70.5 19.8 71.1 19.4 71.5 17.5 71.8 13.9H65C64.2 17.7 62.5 21.2 58.4 23.6 57.9 22.7 56.9 21.5 56 20.9 61.3 17.9 61.7 13.1 61.9 8.4H56.3V5.1H65.8C65.5 4.3 65 3.3 64.6 2.4L67.9 1.2C68 0 69.2 3.6 69.6 4.5L68 5.1H77.4V8.4H65.6A83.2 83.2 0 0165.5 10.7ZM50.8 21.7H41.2V23.2H37.8V2.9H54.4V23.2H50.8V21.7ZM50.8 6.3H41.2V10.5H50.8V6.3ZM50.8 13.8H41.2V18.3H50.8V13.8ZM34.1 22.9C33.1 23.4 31.7 23.5 29.8 23.5 29.7 22.6 29.1 21.1 28.7 20.3 29.8 20.3 31.2 20.3 31.5 20.3 32 20.3 32.1 20.2 32.1 19.8V16.3H28C27.5 19 26.4 21.8 24.1 23.6 23.6 23 22.2 21.9 21.5 21.5 24.9 18.7 25.2 14.3 25.2 10.9V2.5H35.4V19.8C35.4 21.5 35.1 22.4 34.1 22.9ZM32.1 5.6H28.5V7.9H32.1V5.6ZM32.1 10.9H28.5C28.5 11.7 28.4 12.5 28.4 13.3H32.1V10.9ZM18.3 19.1H15.2V2.8H23.3V17.2H18.3V19.1ZM20.2 5.8H18.3V8.4H20.2V5.8ZM20.2 14.1V11.4H18.3V14.1H20.2ZM43.1 27.7 16.8 77.3H4.7V61.4L23.5 27.7H43.1ZM47.5 121.8 4.6 130.5V115.5L47.5 106.8V121.8Z"></path></svg>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";function t(){return/* @__PURE__ */ e(`svg`,{viewBox:`0 0 24 24`,fill:`none`,width:`1em`,height:`1em`,"aria-hidden":`true`,children:/* @__PURE__ */ e(`path`,{d:`M4.89163 13.2687L9.16582 17.5427L18.7085 8`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function n(){return/* @__PURE__ */ e(`svg`,{viewBox:`0 0 1024 1024`,width:`1em`,height:`1em`,"aria-hidden":`true`,children:/* @__PURE__ */ e(`path`,{fill:`currentColor`,d:`M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z`})})}export{n as AlertCloseIcon,t as AlertTickIcon};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{usePortalScope as t}from"../../hooks/usePortalScope.js";import{alertSlotClass as n}from"./types.js";import{useAlertActions as r}from"./useAlertActions.js";import{useCallback as i,useLayoutEffect as a,useRef as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{Dialog as l}from"@base-ui/react/dialog";function u(e){let t=e.querySelectorAll(`a[href],button,input:not([type="hidden"]),select,textarea,[tabindex],[contenteditable="true"]`);return Array.from(t).some(e=>{if(e.matches(`:disabled`)||e.hasAttribute(`tabindex`)&&e.tabIndex<0||e.closest(`[hidden],[inert],[aria-hidden="true"]`))return!1;let t=getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}function d({trigger:d,open:f,defaultOpen:p,onOpenChange:m,title:h,description:g,dismissible:_=!0,keyboardCloseable:v,loading:y,hideCancel:b=!1,cancelText:x,confirmText:ee,showIcon:te,width:S,height:C,className:w,classNames:T,onConfirm:E,onCancel:D,onDismiss:O,onClose:k,initialFocus:A,finalFocus:j,keepMounted:M=!1,modal:N,container:P,popupClassName:F,backdropClassName:I,viewportClassName:L,children:R,ref:z,...B}){let{open:V,busy:H,updateOpen:U,run:W}=r({open:f,defaultOpen:p,onOpenChange:m,loading:y,onConfirm:E,onCancel:D,onDismiss:O,onClose:k}),{anchorRef:G,portalRef:K}=t(),q=o(null),J=o(null),Y=o(null),X=o(null),Z=o(!1),Q=i(()=>{let e=b?Y.current:J.current;return e&&!e.disabled?e:q.current??!0},[b]),$=i(e=>{if(q.current=e,typeof z==`function`)return z(e);z&&(z.current=e)},[z]);return a(()=>{let e=q.current,t=Z.current;if(Z.current=H,!V||!e)return;let n=e.ownerDocument.activeElement;if(H)(n===e.ownerDocument.body||n instanceof HTMLElement&&e.contains(n)&&n.matches(`:disabled`))&&e.focus({preventScroll:!0});else if(t&&n===e){let t=X.current;t&&e.contains(t)&&!t.matches(`:disabled`)&&t.focus({preventScroll:!0})}},[H,V]),/* @__PURE__ */ c(l.Root,{open:V,onOpenChange:(e,t)=>{if(e){U(!0);return}if(t.cancel(),t.reason===`escape-key`&&!(v??_))return;let n=t.reason===`escape-key`||t.reason===`outside-press`||t.reason===`focus-out`;(!n||t.reason===`escape-key`||_)&&W(n?`dismiss`:`close`)},disablePointerDismissal:!_||H,modal:N,children:[d&&/* @__PURE__ */ s(l.Trigger,{ref:G,render:d}),/* @__PURE__ */ c(l.Portal,{ref:K,keepMounted:M,container:P,children:[/* @__PURE__ */ s(l.Backdrop,{className:e(I,n(T?.backdrop,V))}),/* @__PURE__ */ s(l.Viewport,{className:e(`ef-alert-modal-viewport`,L),children:/* @__PURE__ */ c(l.Popup,{...B,onFocusCapture:e=>{B.onFocusCapture?.(e),e.target instanceof HTMLElement&&e.target!==e.currentTarget&&e.currentTarget.contains(e.target)&&(X.current=e.target)},onKeyDownCapture:e=>{B.onKeyDownCapture?.(e),V&&H&&e.key===`Tab`&&e.target instanceof Node&&e.currentTarget.contains(e.target)&&!u(e.currentTarget)&&(e.preventDefault(),e.currentTarget.focus({preventScroll:!0}))},ref:$,role:`alertdialog`,"aria-busy":H||void 0,"data-theme":`light`,initialFocus:A??Q,finalFocus:j,style:{width:S,height:C},className:e(F,w,n(T?.alert,V)),children:[/* @__PURE__ */ s(l.Title,{className:`ef-alert-modal-sr-only`,children:h}),g&&/* @__PURE__ */ s(l.Description,{className:`ef-alert-modal-sr-only`,children:g}),R({open:V,busy:H,cancelRef:J,confirmRef:Y,confirm:()=>{W(`confirm`)},cancel:()=>{W(`cancel`)}})]})})]})]})}export{d as AlertModal};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
import { AlertModalProps } from "./types.js";
|
|
3
|
+
//#region src/game/banner-alert/BannerAlert.d.ts
|
|
4
|
+
export type BannerAlertProps = AlertModalProps;
|
|
5
|
+
export declare function BannerAlert({ children, width, hideCancel, cancelText, confirmText, showIcon, classNames, ...props }: BannerAlertProps): import("react").JSX.Element;
|
|
6
|
+
//#endregion
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{cn as e}from"../../lib/cn.js";import{RoundedButton as t}from"../rounded-button/RoundedButton.js";import{AlertCloseIcon as n,AlertTickIcon as r}from"./AlertIcons.js";import{alertSlotClass as i}from"./types.js";import{AlertModal as a}from"./AlertModal.js";import{useAlertGlitch as o}from"./useAlertGlitch.js";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";function u({children:e,width:t=`30em`,hideCancel:n=!1,cancelText:r=`取消`,confirmText:i=`确认`,showIcon:o=!0,classNames:s,...l}){return/* @__PURE__ */ c(a,{...l,width:t,hideCancel:n,classNames:s,popupClassName:`ef-banner-alert`,backdropClassName:`ef-banner-alert-backdrop`,children:t=>/* @__PURE__ */ c(d,{...t,hideCancel:n,cancelText:r,confirmText:i,showIcon:o,classNames:s,children:e})})}function d({open:a,busy:u,cancelRef:d,confirmRef:f,cancel:p,confirm:m,hideCancel:h,cancelText:g,confirmText:_,showIcon:v,classNames:y,children:b}){let{contentRef:x,actionsRef:S}=o(a);return/* @__PURE__ */ l(s,{children:[/* @__PURE__ */ l(`div`,{"aria-hidden":`true`,className:`ef-banner-alert__banner`,children:[/* @__PURE__ */ c(`span`,{}),/* @__PURE__ */ c(`span`,{})]}),/* @__PURE__ */ c(`div`,{ref:x,className:e(`ef-banner-alert__content`,i(y?.content,a)),children:/* @__PURE__ */ c(`div`,{className:`ef-banner-alert__body`,children:b})}),/* @__PURE__ */ l(`div`,{ref:S,className:`ef-banner-alert__actions`,"data-hide-cancel":h?``:void 0,children:[!h&&/* @__PURE__ */ c(t,{ref:d,variant:`default`,text:g,showIcon:v,disabled:u,onClick:p,icon:/* @__PURE__ */ c(n,{}),className:`ef-banner-alert__button`}),/* @__PURE__ */ c(t,{ref:f,variant:`primary`,text:_,showIcon:v,disabled:u,loading:u,onClick:m,icon:/* @__PURE__ */ c(r,{}),className:`ef-banner-alert__button`})]})]})}export{u as BannerAlert};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
import { CSSProperties, ComponentProps, ReactElement, ReactNode, RefObject } from "react";
|
|
3
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
4
|
+
//#region src/game/banner-alert/types.d.ts
|
|
5
|
+
type PopupProps = ComponentProps<typeof Dialog.Popup>;
|
|
6
|
+
type PortalProps = ComponentProps<typeof Dialog.Portal>;
|
|
7
|
+
export type AlertAction = () => boolean | void | PromiseLike<boolean | void>;
|
|
8
|
+
export type AlertClassName = string | ((open: boolean) => string);
|
|
9
|
+
export type AlertClassNames = {
|
|
10
|
+
backdrop?: AlertClassName;
|
|
11
|
+
alert?: AlertClassName;
|
|
12
|
+
content?: AlertClassName;
|
|
13
|
+
};
|
|
14
|
+
export type AlertModalProps = Omit<ComponentProps<"div">, "title" | "children" | "onClose" | "onCancel" | "style"> & {
|
|
15
|
+
trigger?: ReactElement<Record<string, unknown>>;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
19
|
+
title: ReactNode;
|
|
20
|
+
description?: ReactNode;
|
|
21
|
+
dismissible?: boolean;
|
|
22
|
+
keyboardCloseable?: boolean;
|
|
23
|
+
hideCancel?: boolean;
|
|
24
|
+
cancelText?: string;
|
|
25
|
+
confirmText?: string;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
showIcon?: boolean;
|
|
28
|
+
width?: CSSProperties["width"];
|
|
29
|
+
height?: CSSProperties["height"];
|
|
30
|
+
classNames?: AlertClassNames;
|
|
31
|
+
onConfirm?: AlertAction;
|
|
32
|
+
onCancel?: AlertAction;
|
|
33
|
+
onDismiss?: AlertAction;
|
|
34
|
+
onClose?: AlertAction;
|
|
35
|
+
initialFocus?: PopupProps["initialFocus"];
|
|
36
|
+
finalFocus?: PopupProps["finalFocus"];
|
|
37
|
+
keepMounted?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 是不是模态。默认是。传 `false` 时不锁焦点、不锁页面滚动,页面的其余部分照常能用——
|
|
40
|
+
* 配上 `container` 可以把弹窗嵌在页面的一块区域里展示。
|
|
41
|
+
*/
|
|
42
|
+
modal?: boolean;
|
|
43
|
+
/** 弹层挂到哪个元素里。默认挂在 `<body>` 下 */
|
|
44
|
+
container?: PortalProps["container"];
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{useCallback as e,useLayoutEffect as t,useRef as n,useState as r}from"react";function i({open:i,defaultOpen:a=!1,onOpenChange:o,loading:s=!1,onConfirm:c,onCancel:l,onDismiss:u,onClose:d}){let[f,p]=r(a),[m,h]=r(!1),g=i??f,_=n({open:g,loading:s,mounted:!0,locked:!1,session:0});t(()=>{let e=_.current;return e.mounted=!0,()=>{e.mounted=!1,e.locked=!1,e.session+=1}},[]),t(()=>{_.current.loading=s,_.current.open!==g&&(_.current.open=g,_.current.session+=1,_.current.locked=!1,h(!1))},[g,s]);let v=e(e=>{i===void 0&&p(e),o?.(e)},[i,o]),y=e(async e=>{let t=_.current;if(!t.open||!t.mounted||t.loading||t.locked)return;t.locked=!0,h(!0);let n=t.session,r=()=>_.current.mounted&&_.current.open&&_.current.session===n;try{let t={confirm:c,cancel:l,dismiss:u,close:void 0}[e];if(await t?.()===!1||!r())return;await d?.()!==!1&&r()&&v(!1)}catch{}finally{r()&&(_.current.locked=!1,h(!1))}},[c,l,u,d,v]);return{open:g,busy:s||m,updateOpen:v,run:y}}export{i as useAlertActions};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{useLayoutEffect as e,useRef as t}from"react";const n=[0,1,1,0,0,1,1,0,0,1],r=[0,.48,.82,.85,.87,.9,.92,.95,.97,1],i=n.map((e,t)=>({opacity:e,offset:r[t]}));function a(n){let r=t(null),a=t(null);return e(()=>{if(!n)return;let e=[r.current,a.current].filter(e=>e!==null),t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`),o=e.flatMap(e=>{if(e.style.removeProperty(`--ef-game-alert-exit-opacity`),e.style.opacity=`1`,t?.matches||typeof e.animate!=`function`)return[];e.style.opacity=`0`;let n=e.animate(i,{duration:205,easing:`ease-out`,fill:`both`});return n.onfinish=()=>{e.style.opacity=`1`,n.cancel()},[{node:e,animation:n}]}),s=()=>{for(let{node:e,animation:t}of o)e.style.opacity=`1`,t.cancel()},c=()=>{t?.matches&&s()};return t?.addEventListener(`change`,c),()=>{t?.removeEventListener(`change`,c);for(let{node:e,animation:t}of o)e.style.setProperty(`--ef-game-alert-exit-opacity`,getComputedStyle(e).opacity),t.cancel(),e.style.opacity=`1`}},[n]),{contentRef:r,actionsRef:a}}export{a as useAlertGlitch};
|