@endfield-ui/react 1.2.0 → 1.3.0
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/README.md +8 -3
- 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/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/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.d.ts +29 -383
- package/dist/game.js +1 -2068
- 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 -3546
- package/dist/index.js +1 -9848
- 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/avatar/AvatarSwitcher.tsx +7 -5
- package/src/components/button/Button.tsx +77 -90
- 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 -1
- package/src/components/dropdown-menu/DropdownMenu.tsx +7 -4
- package/src/components/dropdown-menu/menu-style.ts +3 -2
- package/src/components/field/Field.tsx +10 -6
- package/src/components/flyout-bar/FlyoutBar.tsx +1 -1
- package/src/components/icon-button/IconButton.tsx +5 -5
- package/src/components/image-viewer/ImageViewer.tsx +6 -5
- package/src/components/list/List.tsx +7 -5
- package/src/components/nav-action/NavAction.tsx +6 -4
- package/src/components/nav-menu/NavMenu.tsx +13 -7
- package/src/components/page-header/PageHeader.tsx +1 -1
- package/src/components/play-button/PlayButton.tsx +1 -1
- package/src/components/radio/Radio.tsx +7 -5
- package/src/components/schedule/Schedule.tsx +7 -5
- package/src/components/segmented-control/SegmentedControl.tsx +7 -5
- package/src/components/select/Select.tsx +11 -9
- package/src/components/side-rail/SideRail.tsx +15 -9
- package/src/components/side-rail/SideRailSub.tsx +12 -7
- 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/toast/Toast.tsx +8 -5
- 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/lib/cn.ts +1 -1
- package/src/lib/create-lazy-context.ts +6 -0
- package/src/styles/theme.css +37 -0
- package/src/components/README.md +0 -191
- 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 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endfield-ui/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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",
|
|
@@ -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
|
}
|
|
@@ -12,20 +12,20 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
12
12
|
|
|
13
13
|
type OwnProps = {
|
|
14
14
|
/**
|
|
15
|
-
* - `control`
|
|
15
|
+
* - `control` 深灰底,默认;暗色主题下是半透明的白;
|
|
16
16
|
* - `action` 信号黄底,一屏只用一个;
|
|
17
|
-
* - `light`
|
|
17
|
+
* - `light` 浅灰底加一层点阵,用在深色底上或作次要项;
|
|
18
18
|
* - `back` 深灰斜纹底 + 左箭头,返回上一级;
|
|
19
19
|
* - `text` 无底、下划线、斜箭头,低强调;
|
|
20
|
-
* - `danger`
|
|
20
|
+
* - `danger` 红底白字,用于不可逆操作。
|
|
21
21
|
*/
|
|
22
22
|
variant?: ButtonVariant;
|
|
23
23
|
size?: ButtonSize;
|
|
24
|
-
/**
|
|
24
|
+
/** 文字左侧的图标,和文字之间隔一条细竖线 */
|
|
25
25
|
iconStart?: ReactNode;
|
|
26
26
|
/** 文字右侧的图标;`text` 变体默认是斜箭头,传 `null` 去掉 */
|
|
27
27
|
iconEnd?: ReactNode;
|
|
28
|
-
/**
|
|
28
|
+
/** 提交中:显示旋转指示,尺寸不变,不响应点击 */
|
|
29
29
|
loading?: boolean;
|
|
30
30
|
/** 提交中显示的文字,如"处理中"。传了之后按钮按两段文字里较宽的一段定宽 */
|
|
31
31
|
loadingText?: ReactNode;
|
|
@@ -57,12 +57,12 @@ type ButtonAsRendered = OwnProps &
|
|
|
57
57
|
|
|
58
58
|
export type ButtonProps = ButtonAsButton | ButtonAsLink | ButtonAsRendered;
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
const
|
|
62
|
-
control
|
|
63
|
-
light
|
|
64
|
-
danger
|
|
65
|
-
|
|
60
|
+
/** 没有记号的三种:左右留白对称,悬停只换底色 */
|
|
61
|
+
const plainVariants: ReadonlySet<ButtonVariant> = new Set([
|
|
62
|
+
"control",
|
|
63
|
+
"light",
|
|
64
|
+
"danger",
|
|
65
|
+
]);
|
|
66
66
|
|
|
67
67
|
const sizeClass: Record<ButtonSize, string> = {
|
|
68
68
|
sm: "h-8 gap-1.5 text-sm",
|
|
@@ -70,32 +70,24 @@ const sizeClass: Record<ButtonSize, string> = {
|
|
|
70
70
|
lg: "h-14 gap-2.5 text-lg",
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const markerPadding: Record<ButtonSize, string> = {
|
|
78
|
-
sm: "min-w-16 px-7",
|
|
79
|
-
md: "min-w-24 px-10",
|
|
80
|
-
lg: "min-w-40 px-13",
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const markerBox: Record<ButtonSize, string> = {
|
|
84
|
-
sm: "left-3 h-4 w-2 [--marker-bar:2px]",
|
|
85
|
-
md: "left-4 h-5 w-2.5",
|
|
86
|
-
lg: "left-6 h-7 w-3",
|
|
73
|
+
const plainPadding: Record<ButtonSize, string> = {
|
|
74
|
+
sm: "min-w-16 px-4",
|
|
75
|
+
md: "min-w-24 px-6",
|
|
76
|
+
lg: "min-w-40 px-8",
|
|
87
77
|
};
|
|
88
78
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
79
|
+
/* 没有图标时,加载中的旋转方块放在左侧留白的正中:不挤文字,宽度也不变 */
|
|
80
|
+
const paddingSpinner: Record<ButtonSize, string> = {
|
|
81
|
+
sm: "left-[5px] size-1.5",
|
|
82
|
+
md: "left-2 size-2",
|
|
83
|
+
lg: "left-[11px] size-2.5",
|
|
93
84
|
};
|
|
94
85
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
/* 图标和文字之间的细竖线(官网 /cloud 顶栏的按钮);两边的空由 gap 给 */
|
|
87
|
+
const dividerSize: Record<ButtonSize, string> = {
|
|
88
|
+
sm: "h-3",
|
|
89
|
+
md: "h-3.5",
|
|
90
|
+
lg: "h-4",
|
|
99
91
|
};
|
|
100
92
|
|
|
101
93
|
/* action:文字在分隔线左侧的区域里居中,分隔线右侧留一窄条 */
|
|
@@ -127,12 +119,13 @@ const inlineIconSize: Record<ButtonSize, number> = { sm: 14, md: 16, lg: 20 };
|
|
|
127
119
|
|
|
128
120
|
const enabledClass: Record<ButtonVariant, string> = {
|
|
129
121
|
control:
|
|
130
|
-
"bg-
|
|
122
|
+
"bg-button text-on-button shadow-xs hover:bg-button-hover hover:text-white active:bg-button-pressed active:text-white",
|
|
123
|
+
// 两个主题下是同一个红:暗色主题的 danger 是文字色,配白字不到 4.5:1
|
|
131
124
|
danger:
|
|
132
|
-
"bg-
|
|
133
|
-
//
|
|
125
|
+
"bg-alert-fill text-white shadow-xs hover:bg-alert-fill-hover active:bg-alert-fill-pressed",
|
|
126
|
+
// 有意不随主题翻转:它本来就是给深色底用的。点阵也写成固定的墨色比例,悬停、按下只换底色
|
|
134
127
|
light:
|
|
135
|
-
"bg-neutral-
|
|
128
|
+
"dot-grid bg-neutral-100 text-neutral-900 shadow-xs [--dot-color:color-mix(in_srgb,var(--color-neutral-900)_8%,transparent)] [--dot-gap:4px] [--dot-size:0.5px] hover:bg-neutral-50 active:bg-neutral-200",
|
|
136
129
|
// 黄色按钮悬停时底色不变,只有分隔线加深
|
|
137
130
|
action: "bg-action text-on-action shadow-md active:bg-action-pressed",
|
|
138
131
|
back: "hatch hatch-mid bg-control text-white shadow-xs hover:bg-neutral-600 active:bg-control-pressed",
|
|
@@ -141,7 +134,7 @@ const enabledClass: Record<ButtonVariant, string> = {
|
|
|
141
134
|
|
|
142
135
|
/*
|
|
143
136
|
* 高对比模式(forced-colors)下底色被系统换成页面色,带底色的变体只剩一行字:
|
|
144
|
-
*
|
|
137
|
+
* 补一圈线,细竖线、分隔线、加载中的方块这些底色画的记号改用按钮的字色。
|
|
145
138
|
* 禁用的线、字、记号都是灰字色——链接形态禁用时是一个去掉了地址的 <a>,
|
|
146
139
|
* 系统不会替它把字换灰,所以字色也写明
|
|
147
140
|
*/
|
|
@@ -149,6 +142,8 @@ const forcedOutline = "forced-colors:border";
|
|
|
149
142
|
const forcedEnabled = "forced-colors:border-[ButtonText]";
|
|
150
143
|
const forcedDisabled =
|
|
151
144
|
"forced-colors:border-[GrayText] forced-colors:text-[GrayText]";
|
|
145
|
+
const forcedHover =
|
|
146
|
+
"forced-colors:hover:underline forced-colors:hover:underline-offset-3";
|
|
152
147
|
|
|
153
148
|
export function Button(props: ButtonProps) {
|
|
154
149
|
const {
|
|
@@ -167,9 +162,9 @@ export function Button(props: ButtonProps) {
|
|
|
167
162
|
|
|
168
163
|
const inert = disabled || loading;
|
|
169
164
|
const isText = variant === "text";
|
|
170
|
-
const
|
|
165
|
+
const plain = plainVariants.has(variant);
|
|
171
166
|
const iconSize = inlineIconSize[size];
|
|
172
|
-
//
|
|
167
|
+
// 记号在高对比模式下的颜色:细竖线、分隔线、旋转方块共用
|
|
173
168
|
const forcedMark = disabled
|
|
174
169
|
? "forced-colors:bg-[GrayText]"
|
|
175
170
|
: "forced-colors:bg-[ButtonText]";
|
|
@@ -179,10 +174,10 @@ export function Button(props: ButtonProps) {
|
|
|
179
174
|
"transition-colors duration-(--duration-fast) ease-standard",
|
|
180
175
|
focusRing,
|
|
181
176
|
sizeClass[size],
|
|
182
|
-
|
|
177
|
+
plain && plainPadding[size],
|
|
183
178
|
variant === "action" && actionPadding[size],
|
|
184
179
|
variant === "back" && backPadding[size],
|
|
185
|
-
isText
|
|
180
|
+
isText ? "h-auto border-b border-current py-1" : "rounded-sm",
|
|
186
181
|
disabled
|
|
187
182
|
? isText
|
|
188
183
|
? "cursor-not-allowed text-ink-disabled"
|
|
@@ -191,6 +186,8 @@ export function Button(props: ButtonProps) {
|
|
|
191
186
|
// text 变体靠下划线成形,不补线;它的下划线跟着字色走,禁用时一起写明
|
|
192
187
|
!isText && forcedOutline,
|
|
193
188
|
disabled ? forcedDisabled : !isText && forcedEnabled,
|
|
189
|
+
// 底色的变化系统不画,悬停就没有反馈了:字加一条下划线(不用"选中"色,那是留给选中的)
|
|
190
|
+
!disabled && !isText && forcedHover,
|
|
194
191
|
// 加载中不是禁用:线和字照旧。链接形态这时候同样去掉了地址,字色写明,和线一个颜色
|
|
195
192
|
loading && !disabled && "forced-colors:text-[ButtonText]",
|
|
196
193
|
loading && "pointer-events-none",
|
|
@@ -198,29 +195,28 @@ export function Button(props: ButtonProps) {
|
|
|
198
195
|
className,
|
|
199
196
|
);
|
|
200
197
|
|
|
201
|
-
//
|
|
198
|
+
// 加载时旋转指示占一个已经有的位置(图标、留白、分隔线右侧的窄条),所以按钮的宽度不会变
|
|
199
|
+
const spinnerBox = (
|
|
200
|
+
<span
|
|
201
|
+
className="inline-flex items-center justify-center"
|
|
202
|
+
style={{ width: iconSize, height: iconSize }}
|
|
203
|
+
>
|
|
204
|
+
<Spinner label={null} className={cn("size-2", forcedMark)} />
|
|
205
|
+
</span>
|
|
206
|
+
);
|
|
202
207
|
let start = iconStart;
|
|
203
208
|
let end = iconEnd;
|
|
204
209
|
if (variant === "back" && start === undefined) {
|
|
205
|
-
start =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
</span>
|
|
212
|
-
) : (
|
|
213
|
-
<ChevronLeft size={iconSize} />
|
|
214
|
-
);
|
|
210
|
+
start = <ChevronLeft size={iconSize} />;
|
|
211
|
+
}
|
|
212
|
+
const hasStart = start !== undefined && start !== null && start !== false;
|
|
213
|
+
// action 的旋转方块在分隔线右边,text 的在末尾:它们的图标照旧
|
|
214
|
+
if (loading && hasStart && !isText && variant !== "action") {
|
|
215
|
+
start = spinnerBox;
|
|
215
216
|
}
|
|
216
217
|
if (isText && end === undefined) {
|
|
217
218
|
end = loading ? (
|
|
218
|
-
|
|
219
|
-
className="inline-flex items-center justify-center"
|
|
220
|
-
style={{ width: iconSize, height: iconSize }}
|
|
221
|
-
>
|
|
222
|
-
<Spinner label={null} className={cn("size-2", forcedMark)} />
|
|
223
|
-
</span>
|
|
219
|
+
spinnerBox
|
|
224
220
|
) : (
|
|
225
221
|
<ArrowCorner
|
|
226
222
|
size={iconSize}
|
|
@@ -256,38 +252,29 @@ export function Button(props: ButtonProps) {
|
|
|
256
252
|
|
|
257
253
|
const content = (
|
|
258
254
|
<>
|
|
259
|
-
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
className={cn("block size-full", marker, forcedMark)}
|
|
270
|
-
/>
|
|
271
|
-
</span>
|
|
272
|
-
) : (
|
|
273
|
-
<span
|
|
274
|
-
aria-hidden="true"
|
|
275
|
-
className={cn(
|
|
276
|
-
"marker-bar pointer-events-none absolute top-1/2 -translate-y-1/2",
|
|
277
|
-
"transition-[clip-path,translate] duration-(--duration-base) ease-standard",
|
|
278
|
-
markerBox[size],
|
|
279
|
-
forcedMark,
|
|
280
|
-
disabled
|
|
281
|
-
? "bg-on-disabled"
|
|
282
|
-
: [
|
|
283
|
-
marker,
|
|
284
|
-
"group-hover:marker-arrow group-active:marker-arrow",
|
|
285
|
-
markerShift[size],
|
|
286
|
-
],
|
|
287
|
-
)}
|
|
288
|
-
/>
|
|
289
|
-
))}
|
|
255
|
+
{plain && loading && !hasStart && (
|
|
256
|
+
<span
|
|
257
|
+
className={cn(
|
|
258
|
+
"pointer-events-none absolute top-1/2 -translate-y-1/2",
|
|
259
|
+
paddingSpinner[size],
|
|
260
|
+
)}
|
|
261
|
+
>
|
|
262
|
+
<Spinner label={null} className={cn("block size-full", forcedMark)} />
|
|
263
|
+
</span>
|
|
264
|
+
)}
|
|
290
265
|
{start}
|
|
266
|
+
{hasStart && !isText && (
|
|
267
|
+
<span
|
|
268
|
+
aria-hidden="true"
|
|
269
|
+
data-button-divider=""
|
|
270
|
+
className={cn(
|
|
271
|
+
// 高对比模式下是实色的一条:底色画的线系统会换掉,半透明也看不清
|
|
272
|
+
"w-px shrink-0 bg-current opacity-30 forced-colors:opacity-100",
|
|
273
|
+
dividerSize[size],
|
|
274
|
+
forcedMark,
|
|
275
|
+
)}
|
|
276
|
+
/>
|
|
277
|
+
)}
|
|
291
278
|
{label}
|
|
292
279
|
{end}
|
|
293
280
|
{variant === "action" && (
|
|
@@ -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,
|
|
@@ -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,7 +11,8 @@ 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 伸到一半宽。
|