@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endfield-ui/react",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "终末地风格的 React 基础控件库(非官方)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"!src/**/*.test.*",
|
|
34
34
|
"!src/test",
|
|
35
35
|
"!src/game",
|
|
36
|
+
"!src/**/*.md",
|
|
36
37
|
"NOTICE.md"
|
|
37
38
|
],
|
|
38
39
|
"exports": {
|
|
@@ -62,31 +63,36 @@
|
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
|
-
"@base-ui/react": "^1.
|
|
66
|
+
"@base-ui/react": "^1.9.0",
|
|
66
67
|
"clsx": "^2.1.1",
|
|
67
68
|
"tailwind-merge": "^3.7.0"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
|
-
"@
|
|
71
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
72
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
73
|
+
"@tailwindcss/node": "^4.3.3",
|
|
74
|
+
"@tailwindcss/oxide": "^4.3.3",
|
|
71
75
|
"@testing-library/dom": "^10.4.2",
|
|
72
76
|
"@testing-library/jest-dom": "^7.0.1",
|
|
73
77
|
"@testing-library/react": "^16.3.3",
|
|
74
|
-
"@testing-library/user-event": "^14.6.
|
|
78
|
+
"@testing-library/user-event": "^14.6.8",
|
|
75
79
|
"@types/react": "^19.3.0",
|
|
76
80
|
"@types/react-dom": "^19.3.0",
|
|
77
|
-
"jsdom": "^30.1.
|
|
78
|
-
"react": "^19.3.
|
|
79
|
-
"react-dom": "^19.3.
|
|
81
|
+
"jsdom": "^30.1.3",
|
|
82
|
+
"react": "^19.3.1",
|
|
83
|
+
"react-dom": "^19.3.1",
|
|
84
|
+
"rollup": "^4.64.12",
|
|
80
85
|
"tailwindcss": "^4.3.3",
|
|
81
|
-
"tsdown": "^0.23.
|
|
86
|
+
"tsdown": "^0.23.1",
|
|
82
87
|
"typescript": "^7.0.2",
|
|
83
|
-
"vitest": "^5.0.
|
|
88
|
+
"vitest": "^5.0.5"
|
|
84
89
|
},
|
|
85
90
|
"scripts": {
|
|
86
91
|
"build": "tsdown && pnpm build:css && pnpm build:game",
|
|
87
|
-
"build:css": "
|
|
88
|
-
"build:game": "
|
|
92
|
+
"build:css": "node scripts/build-css.mjs src/styles/index.css dist/styles.css",
|
|
93
|
+
"build:game": "node scripts/build-css.mjs src/game/styles.css dist/game/styles.css && node scripts/copy-game-assets.mjs",
|
|
89
94
|
"test": "vitest run",
|
|
95
|
+
"test:package": "node --test scripts/package.test.mjs",
|
|
90
96
|
"test:watch": "vitest",
|
|
91
97
|
"typecheck": "tsc --noEmit"
|
|
92
98
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Accordion as BaseAccordion } from "@base-ui/react/accordion";
|
|
2
2
|
import {
|
|
3
|
-
createContext,
|
|
4
3
|
useContext,
|
|
5
4
|
useMemo,
|
|
6
5
|
type ComponentProps,
|
|
@@ -9,11 +8,12 @@ import {
|
|
|
9
8
|
import { Minus } from "../../icons/Minus";
|
|
10
9
|
import { cn } from "../../lib/cn";
|
|
11
10
|
import { focusRingInset } from "../../lib/focus-ring";
|
|
11
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
12
12
|
|
|
13
13
|
export type AccordionSize = "sm" | "md";
|
|
14
14
|
export type AccordionLevel = 2 | 3 | 4 | 5 | 6;
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const getAccordionContext = /* @__PURE__ */ createLazyContext<{
|
|
17
17
|
size: AccordionSize;
|
|
18
18
|
level: AccordionLevel;
|
|
19
19
|
}>({ size: "md", level: 3 });
|
|
@@ -59,10 +59,11 @@ export function Accordion({
|
|
|
59
59
|
children,
|
|
60
60
|
...props
|
|
61
61
|
}: AccordionProps) {
|
|
62
|
+
const AccordionContext = getAccordionContext();
|
|
62
63
|
const context = useMemo(() => ({ size, level }), [size, level]);
|
|
63
64
|
|
|
64
65
|
return (
|
|
65
|
-
<AccordionContext value={context}>
|
|
66
|
+
<AccordionContext.Provider value={context}>
|
|
66
67
|
<BaseAccordion.Root
|
|
67
68
|
{...props}
|
|
68
69
|
multiple={multiple}
|
|
@@ -78,7 +79,7 @@ export function Accordion({
|
|
|
78
79
|
>
|
|
79
80
|
{children}
|
|
80
81
|
</BaseAccordion.Root>
|
|
81
|
-
</AccordionContext>
|
|
82
|
+
</AccordionContext.Provider>
|
|
82
83
|
);
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -112,7 +113,7 @@ export function AccordionItem({
|
|
|
112
113
|
children,
|
|
113
114
|
...props
|
|
114
115
|
}: AccordionItemProps) {
|
|
115
|
-
const { size, level } = useContext(
|
|
116
|
+
const { size, level } = useContext(getAccordionContext());
|
|
116
117
|
const Heading = `h${level}` as const;
|
|
117
118
|
|
|
118
119
|
return (
|
|
@@ -124,6 +125,13 @@ export function AccordionItem({
|
|
|
124
125
|
>
|
|
125
126
|
<BaseAccordion.Header render={<Heading />} className="flex">
|
|
126
127
|
<BaseAccordion.Trigger
|
|
128
|
+
render={(props, state) => (
|
|
129
|
+
<button
|
|
130
|
+
{...props}
|
|
131
|
+
disabled={false}
|
|
132
|
+
aria-disabled={state.disabled || undefined}
|
|
133
|
+
/>
|
|
134
|
+
)}
|
|
127
135
|
className={cn(
|
|
128
136
|
"group/trigger flex w-full items-center gap-3 px-4 text-left font-medium",
|
|
129
137
|
"transition-colors duration-(--duration-fast) ease-standard",
|
|
@@ -126,7 +126,7 @@ export function Alert({
|
|
|
126
126
|
// 正在收起的提示条点不到、Tab 不进去
|
|
127
127
|
inert={leaving}
|
|
128
128
|
className={cn(
|
|
129
|
-
"flex items-start gap-3 border
|
|
129
|
+
"flex items-start gap-3 border-l-4 bg-surface-raised py-3 pr-3 pl-3 text-sm text-ink",
|
|
130
130
|
toneBar[tone],
|
|
131
131
|
leaving && [
|
|
132
132
|
"pointer-events-none overflow-hidden",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
|
-
createContext,
|
|
4
3
|
isValidElement,
|
|
5
4
|
useContext,
|
|
6
5
|
useEffect,
|
|
@@ -17,6 +16,7 @@ import { ChevronRight } from "../../icons/ChevronRight";
|
|
|
17
16
|
import { cn } from "../../lib/cn";
|
|
18
17
|
import { IconButton } from "../icon-button/IconButton";
|
|
19
18
|
import { Avatar, type AvatarSize } from "./Avatar";
|
|
19
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
20
20
|
|
|
21
21
|
export type AvatarSwitcherOrientation = "vertical" | "horizontal";
|
|
22
22
|
|
|
@@ -27,7 +27,8 @@ type SwitcherContextValue = {
|
|
|
27
27
|
select: (value: string) => void;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const getSwitcherContext =
|
|
31
|
+
/* @__PURE__ */ createLazyContext<SwitcherContextValue | null>(null);
|
|
31
32
|
|
|
32
33
|
export type AvatarSwitcherProps = Omit<
|
|
33
34
|
ComponentProps<"div">,
|
|
@@ -74,6 +75,7 @@ export function AvatarSwitcher({
|
|
|
74
75
|
children,
|
|
75
76
|
...props
|
|
76
77
|
}: AvatarSwitcherProps) {
|
|
78
|
+
const SwitcherContext = getSwitcherContext();
|
|
77
79
|
const generatedName = useId();
|
|
78
80
|
const name = nameProp ?? generatedName;
|
|
79
81
|
const vertical = orientation === "vertical";
|
|
@@ -138,7 +140,7 @@ export function AvatarSwitcher({
|
|
|
138
140
|
const Next = vertical ? ChevronDown : ChevronRight;
|
|
139
141
|
|
|
140
142
|
return (
|
|
141
|
-
<SwitcherContext value={context}>
|
|
143
|
+
<SwitcherContext.Provider value={context}>
|
|
142
144
|
<div
|
|
143
145
|
{...props}
|
|
144
146
|
role="radiogroup"
|
|
@@ -185,7 +187,7 @@ export function AvatarSwitcher({
|
|
|
185
187
|
<Next />
|
|
186
188
|
</IconButton>
|
|
187
189
|
</div>
|
|
188
|
-
</SwitcherContext>
|
|
190
|
+
</SwitcherContext.Provider>
|
|
189
191
|
);
|
|
190
192
|
}
|
|
191
193
|
|
|
@@ -213,7 +215,7 @@ export function AvatarSwitcherItem({
|
|
|
213
215
|
children,
|
|
214
216
|
...props
|
|
215
217
|
}: AvatarSwitcherItemProps) {
|
|
216
|
-
const context = useContext(
|
|
218
|
+
const context = useContext(getSwitcherContext());
|
|
217
219
|
if (!context) {
|
|
218
220
|
throw new Error("AvatarSwitcherItem 要放在 AvatarSwitcher 里面");
|
|
219
221
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
|
-
createContext,
|
|
4
3
|
isValidElement,
|
|
5
4
|
useContext,
|
|
6
5
|
type ComponentProps,
|
|
@@ -15,6 +14,7 @@ import { focusRing } from "../../lib/focus-ring";
|
|
|
15
14
|
import { DashIndicator } from "../dash-indicator/DashIndicator";
|
|
16
15
|
import { IconButton } from "../icon-button/IconButton";
|
|
17
16
|
import { useSnapTrack } from "./snap-track";
|
|
17
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
18
18
|
|
|
19
19
|
export type CarouselRatio = "16/9" | "4/3" | "1/1" | "3/4" | "21/9";
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ const ratioClass: Record<CarouselRatio, string> = {
|
|
|
26
26
|
"21/9": "aspect-21/9",
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const getSlideContext = /* @__PURE__ */ createLazyContext<{
|
|
30
30
|
position: number;
|
|
31
31
|
count: number;
|
|
32
32
|
current: boolean;
|
|
@@ -73,6 +73,7 @@ export function Carousel({
|
|
|
73
73
|
children,
|
|
74
74
|
...props
|
|
75
75
|
}: CarouselProps) {
|
|
76
|
+
const SlideContext = getSlideContext();
|
|
76
77
|
// 标题和说明从子元素上读,所以子元素必须直接是 CarouselSlide
|
|
77
78
|
const slides = Children.toArray(children).filter((child) =>
|
|
78
79
|
isValidElement<SlideLike>(child),
|
|
@@ -151,12 +152,12 @@ export function Carousel({
|
|
|
151
152
|
)}
|
|
152
153
|
>
|
|
153
154
|
{slides.map((slide, position) => (
|
|
154
|
-
<SlideContext
|
|
155
|
+
<SlideContext.Provider
|
|
155
156
|
key={position}
|
|
156
157
|
value={{ position, count, current: position === index }}
|
|
157
158
|
>
|
|
158
159
|
{slide}
|
|
159
|
-
</SlideContext>
|
|
160
|
+
</SlideContext.Provider>
|
|
160
161
|
))}
|
|
161
162
|
</div>
|
|
162
163
|
{/* 压在媒体左下角的一对圆钮。它们在轨道外面:轨道滚的时候不跟着走 */}
|
|
@@ -228,7 +229,7 @@ export function CarouselSlide({
|
|
|
228
229
|
children,
|
|
229
230
|
...props
|
|
230
231
|
}: CarouselSlideProps) {
|
|
231
|
-
const slide = useContext(
|
|
232
|
+
const slide = useContext(getSlideContext());
|
|
232
233
|
if (!slide) {
|
|
233
234
|
throw new Error("CarouselSlide 要直接放在 Carousel 里面");
|
|
234
235
|
}
|
|
@@ -3,7 +3,7 @@ import type { ReactElement, ReactNode } from "react";
|
|
|
3
3
|
import { usePortalScope } from "../../hooks/usePortalScope";
|
|
4
4
|
import { cn } from "../../lib/cn";
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
getMenuVariantContext,
|
|
7
7
|
menuPanel,
|
|
8
8
|
type MenuVariant,
|
|
9
9
|
} from "../dropdown-menu/menu-style";
|
|
@@ -42,6 +42,7 @@ export function ContextMenu({
|
|
|
42
42
|
disabled,
|
|
43
43
|
className,
|
|
44
44
|
}: ContextMenuProps) {
|
|
45
|
+
const MenuVariantContext = getMenuVariantContext();
|
|
45
46
|
const { anchorRef, portalRef } = usePortalScope();
|
|
46
47
|
|
|
47
48
|
return (
|
|
@@ -61,7 +62,9 @@ export function ContextMenu({
|
|
|
61
62
|
className,
|
|
62
63
|
)}
|
|
63
64
|
>
|
|
64
|
-
<MenuVariantContext value={variant}>
|
|
65
|
+
<MenuVariantContext.Provider value={variant}>
|
|
66
|
+
{menu}
|
|
67
|
+
</MenuVariantContext.Provider>
|
|
65
68
|
</BaseContextMenu.Popup>
|
|
66
69
|
</BaseContextMenu.Positioner>
|
|
67
70
|
</BaseContextMenu.Portal>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createContext,
|
|
3
2
|
useContext,
|
|
4
3
|
type ComponentProps,
|
|
5
4
|
type CSSProperties,
|
|
@@ -9,6 +8,7 @@ import { cn } from "../../lib/cn";
|
|
|
9
8
|
import { focusRing } from "../../lib/focus-ring";
|
|
10
9
|
import { bandCanvas, bandGap, bandRow } from "../list/band-style";
|
|
11
10
|
import { Sparkline } from "../sparkline/Sparkline";
|
|
11
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
12
12
|
|
|
13
13
|
export type DataRowColumns = {
|
|
14
14
|
/** 名称那一列的列名 */
|
|
@@ -32,7 +32,10 @@ export type DataRowListProps = Omit<ComponentProps<"div">, "children"> & {
|
|
|
32
32
|
|
|
33
33
|
type Layout = { trend: boolean; reference: boolean };
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const getLayoutContext = /* @__PURE__ */ createLazyContext<Layout>({
|
|
36
|
+
trend: false,
|
|
37
|
+
reference: false,
|
|
38
|
+
});
|
|
36
39
|
|
|
37
40
|
/*
|
|
38
41
|
* 列的模板。容器变窄时先收起走势列(@lg 以下),再收起参考值列(@sm 以下);
|
|
@@ -87,6 +90,7 @@ export function DataRowList({
|
|
|
87
90
|
children,
|
|
88
91
|
...props
|
|
89
92
|
}: DataRowListProps) {
|
|
93
|
+
const LayoutContext = getLayoutContext();
|
|
90
94
|
const layout: Layout = {
|
|
91
95
|
trend: columns.trend !== undefined,
|
|
92
96
|
reference: columns.reference !== undefined,
|
|
@@ -121,7 +125,9 @@ export function DataRowList({
|
|
|
121
125
|
</HeaderCell>
|
|
122
126
|
)}
|
|
123
127
|
</div>
|
|
124
|
-
<LayoutContext value={layout}>
|
|
128
|
+
<LayoutContext.Provider value={layout}>
|
|
129
|
+
{children}
|
|
130
|
+
</LayoutContext.Provider>
|
|
125
131
|
</div>
|
|
126
132
|
</div>
|
|
127
133
|
);
|
|
@@ -187,7 +193,7 @@ export function DataRow({
|
|
|
187
193
|
style,
|
|
188
194
|
...props
|
|
189
195
|
}: DataRowProps) {
|
|
190
|
-
const layout = useContext(
|
|
196
|
+
const layout = useContext(getLayoutContext());
|
|
191
197
|
const hasFavorite = favorite !== undefined || onFavoriteChange !== undefined;
|
|
192
198
|
const dotClass = cn(favoriteDot, favorite ? favoriteOn : favoriteOff);
|
|
193
199
|
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
export const dottedDate = (date: string) => date.replaceAll("-", ".");
|
|
24
24
|
|
|
25
25
|
/** 面板底下那一行里的文字钮 */
|
|
26
|
-
export const dateFooterButton = cn(
|
|
26
|
+
export const dateFooterButton = /* @__PURE__ */ cn(
|
|
27
27
|
"px-2 py-1 text-sm font-medium text-ink underline underline-offset-4 hover:text-ink-secondary",
|
|
28
28
|
"disabled:cursor-not-allowed disabled:text-ink-disabled disabled:no-underline",
|
|
29
29
|
focusRing,
|
|
@@ -91,8 +91,6 @@ export function DateField({
|
|
|
91
91
|
data-invalid={invalid ? "" : undefined}
|
|
92
92
|
className={cn(
|
|
93
93
|
controlBox({ variant, invalid, disabled, readOnly: false }),
|
|
94
|
-
// 面板开着的时候边线保持聚焦的墨色
|
|
95
|
-
!disabled && !invalid && "has-data-popup-open:border-ink",
|
|
96
94
|
controlSize[size],
|
|
97
95
|
className,
|
|
98
96
|
)}
|
|
@@ -13,7 +13,7 @@ import { defined } from "../../lib/defined";
|
|
|
13
13
|
import type { LinkRender } from "../link-element/LinkElement";
|
|
14
14
|
import { MenuCheck } from "./MenuCheck";
|
|
15
15
|
import {
|
|
16
|
-
|
|
16
|
+
getMenuVariantContext,
|
|
17
17
|
menuGroupLabel,
|
|
18
18
|
menuItem,
|
|
19
19
|
menuItemCurrent,
|
|
@@ -66,6 +66,7 @@ export function DropdownMenu({
|
|
|
66
66
|
className,
|
|
67
67
|
children,
|
|
68
68
|
}: DropdownMenuProps) {
|
|
69
|
+
const MenuVariantContext = getMenuVariantContext();
|
|
69
70
|
const { anchorRef, portalRef } = usePortalScope();
|
|
70
71
|
|
|
71
72
|
return (
|
|
@@ -91,7 +92,9 @@ export function DropdownMenu({
|
|
|
91
92
|
className,
|
|
92
93
|
)}
|
|
93
94
|
>
|
|
94
|
-
<MenuVariantContext value={variant}>
|
|
95
|
+
<MenuVariantContext.Provider value={variant}>
|
|
96
|
+
{children}
|
|
97
|
+
</MenuVariantContext.Provider>
|
|
95
98
|
</BaseMenu.Popup>
|
|
96
99
|
</BaseMenu.Positioner>
|
|
97
100
|
</BaseMenu.Portal>
|
|
@@ -296,7 +299,7 @@ export function DropdownMenuRadioItem({
|
|
|
296
299
|
children,
|
|
297
300
|
...props
|
|
298
301
|
}: DropdownMenuRadioItemProps) {
|
|
299
|
-
const variant = useContext(
|
|
302
|
+
const variant = useContext(getMenuVariantContext());
|
|
300
303
|
|
|
301
304
|
return (
|
|
302
305
|
<BaseMenu.RadioItem
|
|
@@ -385,7 +388,7 @@ export function DropdownMenuSub({
|
|
|
385
388
|
className,
|
|
386
389
|
children,
|
|
387
390
|
}: DropdownMenuSubProps) {
|
|
388
|
-
const variant = useContext(
|
|
391
|
+
const variant = useContext(getMenuVariantContext());
|
|
389
392
|
// 子面板也挂在 <body> 下:从这一行往上找,能找到主面板带着的主题
|
|
390
393
|
const { anchorRef, portalRef } = usePortalScope();
|
|
391
394
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createContext } from "react";
|
|
2
1
|
import { focusRingInset } from "../../lib/focus-ring";
|
|
3
2
|
import { enterFromSide } from "../../lib/motion";
|
|
3
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* 下拉菜单与下拉选择共用的面板和选项。
|
|
@@ -11,11 +11,16 @@ import { enterFromSide } from "../../lib/motion";
|
|
|
11
11
|
export type MenuVariant = "plain" | "strong";
|
|
12
12
|
|
|
13
13
|
/** 选项要知道自己在哪种面板里,才知道"当前项"怎么画 */
|
|
14
|
-
export const
|
|
14
|
+
export const getMenuVariantContext =
|
|
15
|
+
/* @__PURE__ */ createLazyContext<MenuVariant>("plain");
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* 面板:直角、1px 线、环境阴影;顶部一条半宽的行动色细条,展开时从 0 伸到一半宽。
|
|
18
19
|
*
|
|
20
|
+
* 细条上挂一个朝下的小三角,和它是同一个伪元素裁出来的:条高 3px,三角露出 8×4px,
|
|
21
|
+
* 中心距条的左端 32px(实机风格弹窗分隔条的一半大)。它是条上的记号,不指向触发处——
|
|
22
|
+
* 面板翻到上面、在侧边时照旧在顶上、朝下。三角探进第一行 2px,所以压在各行的底色之上
|
|
23
|
+
*
|
|
19
24
|
* 进场:淡入(200ms),同时从触发处那一侧挪过来 4px(300ms,和细条同一拍)。
|
|
20
25
|
* 退场只淡出——位移只写在起点上。两个时长、两条缓动按属性一一对应
|
|
21
26
|
*/
|
|
@@ -24,7 +29,8 @@ export const menuPanel = [
|
|
|
24
29
|
"origin-(--transform-origin) transition-[opacity,translate] duration-[var(--duration-fast),var(--duration-base)] ease-[var(--ease-standard),var(--ease-exit)]",
|
|
25
30
|
"data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
26
31
|
enterFromSide,
|
|
27
|
-
"before:pointer-events-none before:absolute before:-top-px before:-left-px before:h-[
|
|
32
|
+
"before:pointer-events-none before:absolute before:-top-px before:-left-px before:z-1 before:h-[7px] before:w-1/2 before:origin-left before:bg-action before:content-['']",
|
|
33
|
+
"before:[clip-path:polygon(0_0,100%_0,100%_3px,36px_3px,32px_100%,28px_3px,0_3px)]",
|
|
28
34
|
"before:transition-transform before:duration-(--duration-base) before:ease-exit data-starting-style:before:scale-x-0",
|
|
29
35
|
"forced-colors:before:hidden",
|
|
30
36
|
].join(" ");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createContext,
|
|
3
2
|
useContext,
|
|
4
3
|
useId,
|
|
5
4
|
useMemo,
|
|
@@ -11,6 +10,7 @@ import { usePresence } from "../../hooks/usePresence";
|
|
|
11
10
|
import { StatusDanger } from "../../icons/StatusDanger";
|
|
12
11
|
import { cn } from "../../lib/cn";
|
|
13
12
|
import { collapse, collapseEnter, collapseInner } from "../../lib/motion";
|
|
13
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
14
14
|
|
|
15
15
|
type FieldContextValue = {
|
|
16
16
|
/** 单个控件的 id;`group` 字段里有多个控件,不提供 */
|
|
@@ -23,11 +23,12 @@ type FieldContextValue = {
|
|
|
23
23
|
group: boolean;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const getFieldContext =
|
|
27
|
+
/* @__PURE__ */ createLazyContext<FieldContextValue | null>(null);
|
|
27
28
|
|
|
28
29
|
/** 给成组的控件(单选组)读取所在字段的状态。不在 `Field` 里时返回 `null`。 */
|
|
29
30
|
export function useFieldContext(): FieldContextValue | null {
|
|
30
|
-
return useContext(
|
|
31
|
+
return useContext(getFieldContext());
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
type ControlProps = {
|
|
@@ -50,7 +51,7 @@ export function useFieldControl({
|
|
|
50
51
|
invalid,
|
|
51
52
|
"aria-describedby": describedBy,
|
|
52
53
|
}: ControlProps) {
|
|
53
|
-
const field = useContext(
|
|
54
|
+
const field = useContext(getFieldContext());
|
|
54
55
|
const mergedDescribedBy =
|
|
55
56
|
[describedBy, field?.describedBy].filter(Boolean).join(" ") || undefined;
|
|
56
57
|
|
|
@@ -97,6 +98,7 @@ export function Field({
|
|
|
97
98
|
children,
|
|
98
99
|
...props
|
|
99
100
|
}: FieldProps) {
|
|
101
|
+
const FieldContext = getFieldContext();
|
|
100
102
|
const baseId = useId();
|
|
101
103
|
const id = controlId ?? `${baseId}-control`;
|
|
102
104
|
const labelId = `${baseId}-label`;
|
|
@@ -212,7 +214,9 @@ export function Field({
|
|
|
212
214
|
</legend>
|
|
213
215
|
{/* 组里的控件默认竖排;要横排就自己包一层,作为这里唯一的子元素 */}
|
|
214
216
|
<div className="flex flex-col items-start">
|
|
215
|
-
<FieldContext value={context}>
|
|
217
|
+
<FieldContext.Provider value={context}>
|
|
218
|
+
{children}
|
|
219
|
+
</FieldContext.Provider>
|
|
216
220
|
</div>
|
|
217
221
|
{messages}
|
|
218
222
|
</fieldset>
|
|
@@ -228,7 +232,7 @@ export function Field({
|
|
|
228
232
|
<label id={labelId} htmlFor={id} className={cn(labelClass, "mb-1.5")}>
|
|
229
233
|
{labelContent}
|
|
230
234
|
</label>
|
|
231
|
-
<FieldContext value={context}>{children}</FieldContext>
|
|
235
|
+
<FieldContext.Provider value={context}>{children}</FieldContext.Provider>
|
|
232
236
|
{messages}
|
|
233
237
|
</div>
|
|
234
238
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useEffect,
|
|
3
|
+
useLayoutEffect,
|
|
3
4
|
useRef,
|
|
4
5
|
useState,
|
|
5
6
|
type ChangeEvent,
|
|
@@ -235,9 +236,11 @@ export function FileUpload({
|
|
|
235
236
|
}
|
|
236
237
|
}, [files, revision]);
|
|
237
238
|
|
|
238
|
-
//
|
|
239
|
+
// 移除之后焦点落到哪:等这一次渲染落到页面上,当场交出去。
|
|
240
|
+
// 不用 useEffect:它晚一拍,上一次渲染留下的那一份可能在这次移除之后才补跑——
|
|
241
|
+
// 看到的还是移除之前的页面,焦点留在马上要收起的那一行上,随后掉到 body
|
|
239
242
|
const pendingFocus = useRef<number | null>(null);
|
|
240
|
-
|
|
243
|
+
useLayoutEffect(() => {
|
|
241
244
|
const index = pendingFocus.current;
|
|
242
245
|
if (index === null) return;
|
|
243
246
|
pendingFocus.current = null;
|
|
@@ -101,7 +101,7 @@ type ItemOwnProps = {
|
|
|
101
101
|
export type FlyoutBarItemProps = ItemOwnProps &
|
|
102
102
|
Omit<ComponentProps<"div">, keyof ItemOwnProps | "id" | "style">;
|
|
103
103
|
|
|
104
|
-
const itemClass = cn(
|
|
104
|
+
const itemClass = /* @__PURE__ */ cn(
|
|
105
105
|
"flex min-w-10 cursor-default items-center justify-center gap-2 px-2.5 text-sm select-none",
|
|
106
106
|
"transition-colors duration-(--duration-fast) ease-standard",
|
|
107
107
|
"data-disabled:text-ink-disabled data-highlighted:text-ink",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
2
2
|
import {
|
|
3
3
|
Children,
|
|
4
|
-
createContext,
|
|
5
4
|
isValidElement,
|
|
6
5
|
useContext,
|
|
7
6
|
useRef,
|
|
@@ -22,6 +21,7 @@ import { useSnapTrack } from "../carousel/snap-track";
|
|
|
22
21
|
import { overlayClose, overlayHeader } from "../dialog/overlay-style";
|
|
23
22
|
import { IconButton } from "../icon-button/IconButton";
|
|
24
23
|
import { Viewfinder } from "../viewfinder/Viewfinder";
|
|
24
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
25
25
|
|
|
26
26
|
export type ImageViewerRatio = "16/9" | "4/3" | "1/1" | "3/4";
|
|
27
27
|
|
|
@@ -38,7 +38,7 @@ type ItemLike = {
|
|
|
38
38
|
children?: ReactNode;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
const
|
|
41
|
+
const getItemContext = /* @__PURE__ */ createLazyContext<{
|
|
42
42
|
position: number;
|
|
43
43
|
count: number;
|
|
44
44
|
ratio: ImageViewerRatio;
|
|
@@ -93,6 +93,7 @@ export function ImageViewer({
|
|
|
93
93
|
children,
|
|
94
94
|
...props
|
|
95
95
|
}: ImageViewerProps) {
|
|
96
|
+
const ItemContext = getItemContext();
|
|
96
97
|
// 标题、说明和大图都从子元素上读,所以子元素必须直接是 ImageViewerItem
|
|
97
98
|
const items = Children.toArray(children).filter((child) =>
|
|
98
99
|
isValidElement<ItemLike>(child),
|
|
@@ -133,7 +134,7 @@ export function ImageViewer({
|
|
|
133
134
|
)}
|
|
134
135
|
>
|
|
135
136
|
{items.map((item, position) => (
|
|
136
|
-
<ItemContext
|
|
137
|
+
<ItemContext.Provider
|
|
137
138
|
key={position}
|
|
138
139
|
value={{
|
|
139
140
|
position,
|
|
@@ -145,7 +146,7 @@ export function ImageViewer({
|
|
|
145
146
|
}}
|
|
146
147
|
>
|
|
147
148
|
{item}
|
|
148
|
-
</ItemContext>
|
|
149
|
+
</ItemContext.Provider>
|
|
149
150
|
))}
|
|
150
151
|
</ul>
|
|
151
152
|
<BaseDialog.Root open={open} onOpenChange={(next) => setOpen(next)}>
|
|
@@ -427,7 +428,7 @@ export function ImageViewerItem({
|
|
|
427
428
|
children,
|
|
428
429
|
...props
|
|
429
430
|
}: ImageViewerItemProps) {
|
|
430
|
-
const item = useContext(
|
|
431
|
+
const item = useContext(getItemContext());
|
|
431
432
|
if (!item) {
|
|
432
433
|
throw new Error("ImageViewerItem 要直接放在 ImageViewer 里面");
|
|
433
434
|
}
|
|
@@ -5,7 +5,7 @@ import { focusRingWithin } from "../../lib/focus-ring";
|
|
|
5
5
|
* 输入框与多行文本共用的外框,直角,两种画法:
|
|
6
6
|
* - `sunken` 凹陷的底 + 一条 2px 的底边线,默认;
|
|
7
7
|
* - `outline` 四边 1px 的描边 + 页面底色,放在凹陷底色的区域里时用。
|
|
8
|
-
*
|
|
8
|
+
* 状态靠边线说:默认灰 → 悬停深一档 → 错误红;聚焦另画一条墨线。
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export type ControlVariant = "sunken" | "outline";
|
|
@@ -41,11 +41,29 @@ const fill: Record<ControlVariant, string> = {
|
|
|
41
41
|
outline: "bg-surface",
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
/* 画在 `::before` 上:分段选择的 `::after` 是选中的那块底 */
|
|
45
|
+
const lineFrame: Record<ControlVariant, string> = {
|
|
46
|
+
sunken:
|
|
47
|
+
"before:pointer-events-none before:absolute before:inset-x-0 before:-bottom-[2px] before:h-[2px] before:origin-left before:scale-x-0 before:bg-ink before:content-[''] forced-colors:before:bg-[Highlight]",
|
|
48
|
+
outline:
|
|
49
|
+
"before:pointer-events-none before:absolute before:-inset-px before:border before:border-ink before:[clip-path:inset(0_100%_0_0)] before:content-['']",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const lineOpen: Record<ControlVariant, string> = {
|
|
53
|
+
sunken:
|
|
54
|
+
"focus-within:before:scale-x-100 has-data-popup-open:before:scale-x-100",
|
|
55
|
+
outline:
|
|
56
|
+
"focus-within:before:[clip-path:inset(0)] has-data-popup-open:before:[clip-path:inset(0)]",
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/* 擦出 300ms、收回 200ms */
|
|
60
|
+
const lineMotion =
|
|
61
|
+
"before:transition-[scale,clip-path] before:duration-(--duration-fast) before:ease-standard focus-within:before:duration-(--duration-base) focus-within:before:ease-exit has-data-popup-open:before:duration-(--duration-base) has-data-popup-open:before:ease-exit";
|
|
62
|
+
|
|
63
|
+
/** 聚焦的墨线,接在带 `relative` 的外框上用 */
|
|
64
|
+
export function controlLine(variant: ControlVariant = "sunken") {
|
|
65
|
+
return cn(lineFrame[variant], lineOpen[variant], lineMotion);
|
|
66
|
+
}
|
|
49
67
|
|
|
50
68
|
export function controlBox({
|
|
51
69
|
variant = "sunken",
|
|
@@ -54,7 +72,7 @@ export function controlBox({
|
|
|
54
72
|
readOnly,
|
|
55
73
|
}: BoxState) {
|
|
56
74
|
return cn(
|
|
57
|
-
"flex w-full min-w-0 text-ink",
|
|
75
|
+
"relative flex w-full min-w-0 text-ink",
|
|
58
76
|
frame[variant],
|
|
59
77
|
"transition-colors duration-(--duration-fast) ease-standard",
|
|
60
78
|
focusRingWithin,
|
|
@@ -62,15 +80,17 @@ export function controlBox({
|
|
|
62
80
|
? // 只读:没有边线、底变透明。边线留透明的,尺寸不跳
|
|
63
81
|
"border-transparent bg-transparent"
|
|
64
82
|
: fill[variant],
|
|
65
|
-
//
|
|
66
|
-
|
|
83
|
+
// 高对比模式下系统会把透明的边线也换成字色显出来,而底色本来就都没了:
|
|
84
|
+
// 只读的写成页面色,不然和能填的一个样
|
|
85
|
+
readOnly && !disabled && !invalid && "forced-colors:border-[Canvas]",
|
|
67
86
|
disabled
|
|
68
87
|
? "cursor-not-allowed border-line text-ink-disabled"
|
|
69
88
|
: invalid
|
|
70
89
|
? "border-danger"
|
|
71
90
|
: !readOnly &&
|
|
72
91
|
// 悬停只在没聚焦时生效:生成的 CSS 里 hover 排在 focus-within 之后,会盖掉聚焦的墨色
|
|
73
|
-
"border-line-strong hover:not-focus-within:border-ink-secondary
|
|
92
|
+
"border-line-strong hover:not-focus-within:border-ink-secondary",
|
|
93
|
+
!disabled && !invalid && !readOnly && controlLine(variant),
|
|
74
94
|
);
|
|
75
95
|
}
|
|
76
96
|
|