@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
|
@@ -2,7 +2,6 @@ import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
|
|
|
2
2
|
import { Menu as BaseMenu } from "@base-ui/react/menu";
|
|
3
3
|
import {
|
|
4
4
|
Children,
|
|
5
|
-
createContext,
|
|
6
5
|
isValidElement,
|
|
7
6
|
useContext,
|
|
8
7
|
useEffect,
|
|
@@ -25,10 +24,13 @@ import {
|
|
|
25
24
|
menuPanel,
|
|
26
25
|
} from "../dropdown-menu/menu-style";
|
|
27
26
|
import { LinkElement, type LinkRender } from "../link-element/LinkElement";
|
|
28
|
-
import { RailIcon, railItemClass,
|
|
27
|
+
import { RailIcon, railItemClass, getSideRailContext } from "./SideRail";
|
|
28
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
29
29
|
|
|
30
30
|
/** 子项要知道自己是排在侧轨里,还是在收起时弹出的那块菜单里 */
|
|
31
|
-
const
|
|
31
|
+
const getSubContext = /* @__PURE__ */ createLazyContext<"list" | "menu">(
|
|
32
|
+
"list",
|
|
33
|
+
);
|
|
32
34
|
|
|
33
35
|
type SubOwnProps = {
|
|
34
36
|
/** 图标。收起时只剩它 */
|
|
@@ -63,7 +65,8 @@ export function SideRailSub({
|
|
|
63
65
|
children,
|
|
64
66
|
...props
|
|
65
67
|
}: SideRailSubProps) {
|
|
66
|
-
const
|
|
68
|
+
const SubContext = getSubContext();
|
|
69
|
+
const { collapsed } = useContext(getSideRailContext());
|
|
67
70
|
const { anchorRef, portalRef } = usePortalScope();
|
|
68
71
|
|
|
69
72
|
// 当前项在不在里面:从子元素上读,所以 SideRailSubItem 要直接放在这里
|
|
@@ -121,7 +124,9 @@ export function SideRailSub({
|
|
|
121
124
|
<BaseMenu.GroupLabel className={menuGroupLabel}>
|
|
122
125
|
{label}
|
|
123
126
|
</BaseMenu.GroupLabel>
|
|
124
|
-
<SubContext value="menu">
|
|
127
|
+
<SubContext.Provider value="menu">
|
|
128
|
+
{children}
|
|
129
|
+
</SubContext.Provider>
|
|
125
130
|
</BaseMenu.Group>
|
|
126
131
|
</BaseMenu.Popup>
|
|
127
132
|
</BaseMenu.Positioner>
|
|
@@ -167,7 +172,7 @@ export function SideRailSub({
|
|
|
167
172
|
aria-label={label}
|
|
168
173
|
className="relative before:absolute before:inset-y-0 before:left-8 before:w-px before:bg-line before:content-['']"
|
|
169
174
|
>
|
|
170
|
-
<SubContext value="list">{children}</SubContext>
|
|
175
|
+
<SubContext.Provider value="list">{children}</SubContext.Provider>
|
|
171
176
|
</ul>
|
|
172
177
|
</BaseCollapsible.Panel>
|
|
173
178
|
</BaseCollapsible.Root>
|
|
@@ -208,7 +213,7 @@ export function SideRailSubItem({
|
|
|
208
213
|
children,
|
|
209
214
|
...props
|
|
210
215
|
}: SideRailSubItemProps) {
|
|
211
|
-
const placement = useContext(
|
|
216
|
+
const placement = useContext(getSubContext());
|
|
212
217
|
const isLink = href !== undefined || render !== undefined;
|
|
213
218
|
|
|
214
219
|
const content = (
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
|
-
createContext,
|
|
4
3
|
useContext,
|
|
5
4
|
type ComponentProps,
|
|
6
5
|
type MouseEventHandler,
|
|
@@ -11,6 +10,7 @@ import { StatusDanger } from "../../icons/StatusDanger";
|
|
|
11
10
|
import { cn } from "../../lib/cn";
|
|
12
11
|
import { focusRingWithin } from "../../lib/focus-ring";
|
|
13
12
|
import { LinkElement, type LinkRender } from "../link-element/LinkElement";
|
|
13
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
14
14
|
|
|
15
15
|
export type StepsOrientation = "horizontal" | "vertical";
|
|
16
16
|
export type StepsSize = "sm" | "md";
|
|
@@ -37,7 +37,8 @@ type StepContextValue = {
|
|
|
37
37
|
labels: StepStatusLabels;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const getStepContext =
|
|
41
|
+
/* @__PURE__ */ createLazyContext<StepContextValue | null>(null);
|
|
41
42
|
|
|
42
43
|
export type StepsProps = Omit<ComponentProps<"ol">, "aria-label"> & {
|
|
43
44
|
/** 这是哪件事的步骤,比如"建站流程" */
|
|
@@ -107,6 +108,7 @@ export function Steps({
|
|
|
107
108
|
children,
|
|
108
109
|
...props
|
|
109
110
|
}: StepsProps) {
|
|
111
|
+
const StepContext = getStepContext();
|
|
110
112
|
const labels = { ...defaultLabels, ...statusLabels };
|
|
111
113
|
const steps = Children.toArray(children);
|
|
112
114
|
|
|
@@ -118,7 +120,7 @@ export function Steps({
|
|
|
118
120
|
>
|
|
119
121
|
<ol {...props} className={cn("flex", listLayout[orientation])}>
|
|
120
122
|
{steps.map((step, index) => (
|
|
121
|
-
<StepContext
|
|
123
|
+
<StepContext.Provider
|
|
122
124
|
// 步骤是按位置认的:序号、状态都从位置来
|
|
123
125
|
key={index}
|
|
124
126
|
value={{
|
|
@@ -135,7 +137,7 @@ export function Steps({
|
|
|
135
137
|
}}
|
|
136
138
|
>
|
|
137
139
|
{step}
|
|
138
|
-
</StepContext>
|
|
140
|
+
</StepContext.Provider>
|
|
139
141
|
))}
|
|
140
142
|
</ol>
|
|
141
143
|
</div>
|
|
@@ -203,7 +205,7 @@ export function Step({
|
|
|
203
205
|
className,
|
|
204
206
|
...props
|
|
205
207
|
}: StepProps) {
|
|
206
|
-
const context = useContext(
|
|
208
|
+
const context = useContext(getStepContext());
|
|
207
209
|
if (!context) {
|
|
208
210
|
throw new Error("<Step> 必须放在 <Steps> 里");
|
|
209
211
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
|
-
createContext,
|
|
4
3
|
isValidElement,
|
|
5
4
|
useContext,
|
|
6
5
|
useEffect,
|
|
@@ -22,6 +21,7 @@ import { cn } from "../../lib/cn";
|
|
|
22
21
|
import { focusRing, focusRingInset } from "../../lib/focus-ring";
|
|
23
22
|
import { mergeRefs } from "../../lib/merge-refs";
|
|
24
23
|
import { collapse, collapseEnter, collapseInner } from "../../lib/motion";
|
|
24
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
25
25
|
|
|
26
26
|
export type TableHeaderVariant = "band" | "muted";
|
|
27
27
|
export type TableSize = "sm" | "md";
|
|
@@ -36,7 +36,7 @@ type TableContextValue = {
|
|
|
36
36
|
ruled: boolean;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const getTableContext = /* @__PURE__ */ createLazyContext<TableContextValue>({
|
|
40
40
|
headerVariant: "band",
|
|
41
41
|
size: "md",
|
|
42
42
|
sticky: false,
|
|
@@ -45,10 +45,12 @@ const TableContext = createContext<TableContextValue>({
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
/** 单元格要知道自己在表头里还是表身里 */
|
|
48
|
-
const
|
|
48
|
+
const getSectionContext = /* @__PURE__ */ createLazyContext<"head" | "body">(
|
|
49
|
+
"body",
|
|
50
|
+
);
|
|
49
51
|
|
|
50
52
|
/** 能展开的行交给里面的展开钮 */
|
|
51
|
-
const
|
|
53
|
+
const getRowContext = /* @__PURE__ */ createLazyContext<{
|
|
52
54
|
expanded: boolean;
|
|
53
55
|
toggle: () => void;
|
|
54
56
|
detailId: string;
|
|
@@ -97,6 +99,7 @@ export function Table({
|
|
|
97
99
|
className,
|
|
98
100
|
...props
|
|
99
101
|
}: TableProps) {
|
|
102
|
+
const TableContext = getTableContext();
|
|
100
103
|
const [scrollerRef, overflowing] = useOverflowing();
|
|
101
104
|
const scrollable = overflowing.x || overflowing.y;
|
|
102
105
|
|
|
@@ -123,7 +126,7 @@ export function Table({
|
|
|
123
126
|
);
|
|
124
127
|
|
|
125
128
|
return (
|
|
126
|
-
<TableContext value={context}>
|
|
129
|
+
<TableContext.Provider value={context}>
|
|
127
130
|
<div
|
|
128
131
|
ref={scrollerRef}
|
|
129
132
|
// 冻结列右缘的那条线只看横向
|
|
@@ -151,23 +154,24 @@ export function Table({
|
|
|
151
154
|
className="w-full border-separate border-spacing-0 text-left text-sm text-ink"
|
|
152
155
|
/>
|
|
153
156
|
</div>
|
|
154
|
-
</TableContext>
|
|
157
|
+
</TableContext.Provider>
|
|
155
158
|
);
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
export type TableHeadProps = ComponentProps<"thead">;
|
|
159
162
|
|
|
160
163
|
export function TableHead(props: TableHeadProps) {
|
|
161
|
-
const
|
|
164
|
+
const SectionContext = getSectionContext();
|
|
165
|
+
const { headerVariant } = useContext(getTableContext());
|
|
162
166
|
return (
|
|
163
|
-
<SectionContext value="head">
|
|
167
|
+
<SectionContext.Provider value="head">
|
|
164
168
|
<thead
|
|
165
169
|
// 反转的标题带整个换成反转主题:列头的焦点环、排序的三角、
|
|
166
170
|
// 放在里面的复选框都按这条带子的底色取值
|
|
167
171
|
data-theme={headerVariant === "band" ? "inverse" : undefined}
|
|
168
172
|
{...props}
|
|
169
173
|
/>
|
|
170
|
-
</SectionContext>
|
|
174
|
+
</SectionContext.Provider>
|
|
171
175
|
);
|
|
172
176
|
}
|
|
173
177
|
|
|
@@ -184,11 +188,12 @@ const ruledLines = [
|
|
|
184
188
|
].join(" ");
|
|
185
189
|
|
|
186
190
|
export function TableBody({ className, ...props }: TableBodyProps) {
|
|
187
|
-
const
|
|
191
|
+
const SectionContext = getSectionContext();
|
|
192
|
+
const { ruled } = useContext(getTableContext());
|
|
188
193
|
return (
|
|
189
|
-
<SectionContext value="body">
|
|
194
|
+
<SectionContext.Provider value="body">
|
|
190
195
|
<tbody {...props} className={cn(ruled && ruledLines, className)} />
|
|
191
|
-
</SectionContext>
|
|
196
|
+
</SectionContext.Provider>
|
|
192
197
|
);
|
|
193
198
|
}
|
|
194
199
|
|
|
@@ -233,7 +238,8 @@ export function TableRow({
|
|
|
233
238
|
children,
|
|
234
239
|
...props
|
|
235
240
|
}: TableRowProps) {
|
|
236
|
-
const
|
|
241
|
+
const RowContext = getRowContext();
|
|
242
|
+
const section = useContext(getSectionContext());
|
|
237
243
|
const rowRef = useRef<HTMLTableRowElement>(null);
|
|
238
244
|
const detailId = useId();
|
|
239
245
|
const [expanded, setExpanded] = useControllableState({
|
|
@@ -279,7 +285,7 @@ export function TableRow({
|
|
|
279
285
|
className,
|
|
280
286
|
)}
|
|
281
287
|
>
|
|
282
|
-
<RowContext value={context}>{children}</RowContext>
|
|
288
|
+
<RowContext.Provider value={context}>{children}</RowContext.Provider>
|
|
283
289
|
</tr>
|
|
284
290
|
{detailPresence.mounted && (
|
|
285
291
|
<DetailRow
|
|
@@ -377,7 +383,7 @@ export function TableExpander({
|
|
|
377
383
|
onClick,
|
|
378
384
|
...props
|
|
379
385
|
}: TableExpanderProps) {
|
|
380
|
-
const row = useContext(
|
|
386
|
+
const row = useContext(getRowContext());
|
|
381
387
|
if (!row) return null;
|
|
382
388
|
|
|
383
389
|
return (
|
|
@@ -460,7 +466,7 @@ export function TableHeaderCell({
|
|
|
460
466
|
children,
|
|
461
467
|
...props
|
|
462
468
|
}: TableHeaderCellProps) {
|
|
463
|
-
const { headerVariant, sticky, stickyHeader } = useContext(
|
|
469
|
+
const { headerVariant, sticky, stickyHeader } = useContext(getTableContext());
|
|
464
470
|
|
|
465
471
|
return (
|
|
466
472
|
<th
|
|
@@ -542,7 +548,7 @@ export function TableCell({
|
|
|
542
548
|
children,
|
|
543
549
|
...props
|
|
544
550
|
}: TableCellProps) {
|
|
545
|
-
const { size, sticky } = useContext(
|
|
551
|
+
const { size, sticky } = useContext(getTableContext());
|
|
546
552
|
const Cell = rowHeader ? "th" : "td";
|
|
547
553
|
|
|
548
554
|
return (
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createContext,
|
|
3
2
|
useContext,
|
|
4
3
|
useId,
|
|
5
4
|
useMemo,
|
|
@@ -16,6 +15,7 @@ import { focusRing, focusRingInset } from "../../lib/focus-ring";
|
|
|
16
15
|
import { mergeRefs } from "../../lib/merge-refs";
|
|
17
16
|
import { fadeInFast, indicator, indicatorBox } from "../../lib/motion";
|
|
18
17
|
import { capsuleBase, capsuleSize, capsuleState } from "../chip/capsule-style";
|
|
18
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
19
19
|
|
|
20
20
|
export type TabsVariant = "block" | "capsule" | "wedge";
|
|
21
21
|
export type TabsSize = "sm" | "md";
|
|
@@ -30,10 +30,11 @@ type TabsContextValue = {
|
|
|
30
30
|
switched: boolean;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const getTabsContext =
|
|
34
|
+
/* @__PURE__ */ createLazyContext<TabsContextValue | null>(null);
|
|
34
35
|
|
|
35
36
|
function useTabsContext(component: string): TabsContextValue {
|
|
36
|
-
const context = useContext(
|
|
37
|
+
const context = useContext(getTabsContext());
|
|
37
38
|
if (!context) {
|
|
38
39
|
throw new Error(`<${component}> 必须放在 <Tabs> 里`);
|
|
39
40
|
}
|
|
@@ -70,6 +71,7 @@ export function Tabs({
|
|
|
70
71
|
size = "md",
|
|
71
72
|
...props
|
|
72
73
|
}: TabsProps) {
|
|
74
|
+
const TabsContext = getTabsContext();
|
|
73
75
|
const baseId = useId();
|
|
74
76
|
const [current, select] = useControllableState({
|
|
75
77
|
value,
|
|
@@ -87,9 +89,9 @@ export function Tabs({
|
|
|
87
89
|
);
|
|
88
90
|
|
|
89
91
|
return (
|
|
90
|
-
<TabsContext value={context}>
|
|
92
|
+
<TabsContext.Provider value={context}>
|
|
91
93
|
<div {...props} data-variant={variant} />
|
|
92
|
-
</TabsContext>
|
|
94
|
+
</TabsContext.Provider>
|
|
93
95
|
);
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Toast as BaseToast } from "@base-ui/react/toast";
|
|
2
2
|
import {
|
|
3
|
-
createContext,
|
|
4
3
|
isValidElement,
|
|
5
4
|
useContext,
|
|
6
5
|
useMemo,
|
|
@@ -15,6 +14,7 @@ import { StatusSuccess } from "../../icons/StatusSuccess";
|
|
|
15
14
|
import { StatusWarning } from "../../icons/StatusWarning";
|
|
16
15
|
import { cn } from "../../lib/cn";
|
|
17
16
|
import { focusRing, focusRingInset } from "../../lib/focus-ring";
|
|
17
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
18
18
|
|
|
19
19
|
export type ToastTone = "neutral" | "info" | "success" | "warning" | "danger";
|
|
20
20
|
export type ToastPlacement = "bottom" | "center";
|
|
@@ -51,11 +51,13 @@ type ToastData = {
|
|
|
51
51
|
/* 带操作的提示默认停留的时间:要留出读完再去点的工夫 */
|
|
52
52
|
const ACTION_DURATION = 8000;
|
|
53
53
|
|
|
54
|
-
const
|
|
54
|
+
const getToastContext = /* @__PURE__ */ createLazyContext<ToastApi | null>(
|
|
55
|
+
null,
|
|
56
|
+
);
|
|
55
57
|
|
|
56
58
|
/** 弹出轻提示。要在 `ToastProvider` 里面用。 */
|
|
57
59
|
export function useToast(): ToastApi {
|
|
58
|
-
const toast = useContext(
|
|
60
|
+
const toast = useContext(getToastContext());
|
|
59
61
|
if (!toast) {
|
|
60
62
|
throw new Error("useToast 要在 <ToastProvider> 里面用");
|
|
61
63
|
}
|
|
@@ -125,6 +127,7 @@ type ToastHostProps = {
|
|
|
125
127
|
};
|
|
126
128
|
|
|
127
129
|
function ToastHost({ placement, label, closeLabel, children }: ToastHostProps) {
|
|
130
|
+
const ToastContext = getToastContext();
|
|
128
131
|
const { toasts, add, close } = BaseToast.useToastManager<ToastData>();
|
|
129
132
|
|
|
130
133
|
const api = useMemo<ToastApi>(() => {
|
|
@@ -157,7 +160,7 @@ function ToastHost({ placement, label, closeLabel, children }: ToastHostProps) {
|
|
|
157
160
|
}, [add, close]);
|
|
158
161
|
|
|
159
162
|
return (
|
|
160
|
-
<ToastContext value={api}>
|
|
163
|
+
<ToastContext.Provider value={api}>
|
|
161
164
|
{children}
|
|
162
165
|
<BaseToast.Portal>
|
|
163
166
|
<BaseToast.Viewport
|
|
@@ -234,7 +237,7 @@ function ToastHost({ placement, label, closeLabel, children }: ToastHostProps) {
|
|
|
234
237
|
})}
|
|
235
238
|
</BaseToast.Viewport>
|
|
236
239
|
</BaseToast.Portal>
|
|
237
|
-
</ToastContext>
|
|
240
|
+
</ToastContext.Provider>
|
|
238
241
|
);
|
|
239
242
|
}
|
|
240
243
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
|
-
createContext,
|
|
4
3
|
useCallback,
|
|
5
4
|
useContext,
|
|
6
5
|
useEffect,
|
|
@@ -24,10 +23,11 @@ import { dropEmptyStyle } from "../../lib/inline-style";
|
|
|
24
23
|
import { mergeRefs } from "../../lib/merge-refs";
|
|
25
24
|
import { indicator } from "../../lib/motion";
|
|
26
25
|
import { LinkElement, type LinkRender } from "../link-element/LinkElement";
|
|
26
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
27
27
|
|
|
28
28
|
export type TocLevel = 1 | 2 | 3;
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const getTocContext = /* @__PURE__ */ createLazyContext<{
|
|
31
31
|
active: string | null;
|
|
32
32
|
pick: (section: string) => void;
|
|
33
33
|
}>({ active: null, pick: () => {} });
|
|
@@ -110,6 +110,7 @@ export function Toc({
|
|
|
110
110
|
children,
|
|
111
111
|
...props
|
|
112
112
|
}: TocProps) {
|
|
113
|
+
const TocContext = getTocContext();
|
|
113
114
|
const navRef = useRef<HTMLElement>(null);
|
|
114
115
|
// 当前项的粗条画在列表上:换一项时是同一段沿引线滑过去
|
|
115
116
|
const listRef = useIndicator<HTMLUListElement>("[aria-current]");
|
|
@@ -262,7 +263,7 @@ export function Toc({
|
|
|
262
263
|
"forced-colors:after:bg-[Highlight]",
|
|
263
264
|
)}
|
|
264
265
|
>
|
|
265
|
-
<TocContext value={context}>{children}</TocContext>
|
|
266
|
+
<TocContext.Provider value={context}>{children}</TocContext.Provider>
|
|
266
267
|
</ul>
|
|
267
268
|
</nav>
|
|
268
269
|
);
|
|
@@ -310,7 +311,7 @@ export function TocItem({
|
|
|
310
311
|
children,
|
|
311
312
|
...props
|
|
312
313
|
}: TocItemProps) {
|
|
313
|
-
const { active, pick } = useContext(
|
|
314
|
+
const { active, pick } = useContext(getTocContext());
|
|
314
315
|
const current = section !== undefined && section === active;
|
|
315
316
|
|
|
316
317
|
return (
|
|
@@ -2,7 +2,6 @@ import { Toggle as BaseToggle } from "@base-ui/react/toggle";
|
|
|
2
2
|
import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group";
|
|
3
3
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
4
4
|
import {
|
|
5
|
-
createContext,
|
|
6
5
|
useContext,
|
|
7
6
|
useMemo,
|
|
8
7
|
type ComponentProps,
|
|
@@ -13,12 +12,13 @@ import {
|
|
|
13
12
|
import { cn } from "../../lib/cn";
|
|
14
13
|
import { focusRing } from "../../lib/focus-ring";
|
|
15
14
|
import type { LinkRender } from "../link-element/LinkElement";
|
|
15
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
16
16
|
|
|
17
17
|
export type ToolbarSize = "sm" | "md";
|
|
18
18
|
export type ToolbarVariant = "sunken" | "outline";
|
|
19
19
|
export type ToolbarOrientation = "horizontal" | "vertical";
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const getToolbarContext = /* @__PURE__ */ createLazyContext<{
|
|
22
22
|
size: ToolbarSize;
|
|
23
23
|
orientation: ToolbarOrientation;
|
|
24
24
|
}>({ size: "md", orientation: "horizontal" });
|
|
@@ -76,6 +76,7 @@ export function Toolbar({
|
|
|
76
76
|
onKeyDown,
|
|
77
77
|
...props
|
|
78
78
|
}: ToolbarProps) {
|
|
79
|
+
const ToolbarContext = getToolbarContext();
|
|
79
80
|
const context = useMemo(() => ({ size, orientation }), [size, orientation]);
|
|
80
81
|
|
|
81
82
|
// 基元只管方向键,Home / End 在这里补上:到第一个、最后一个
|
|
@@ -97,7 +98,7 @@ export function Toolbar({
|
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
return (
|
|
100
|
-
<ToolbarContext value={context}>
|
|
101
|
+
<ToolbarContext.Provider value={context}>
|
|
101
102
|
<BaseToolbar.Root
|
|
102
103
|
{...props}
|
|
103
104
|
orientation={orientation}
|
|
@@ -114,7 +115,7 @@ export function Toolbar({
|
|
|
114
115
|
className,
|
|
115
116
|
)}
|
|
116
117
|
/>
|
|
117
|
-
</ToolbarContext>
|
|
118
|
+
</ToolbarContext.Provider>
|
|
118
119
|
);
|
|
119
120
|
}
|
|
120
121
|
|
|
@@ -171,7 +172,7 @@ const itemIcon = [
|
|
|
171
172
|
].join(" ");
|
|
172
173
|
|
|
173
174
|
function useItemClass(iconOnly: boolean, className: string | undefined) {
|
|
174
|
-
const { size } = useContext(
|
|
175
|
+
const { size } = useContext(getToolbarContext());
|
|
175
176
|
return cn(
|
|
176
177
|
itemBase,
|
|
177
178
|
itemSize[size],
|
|
@@ -359,7 +360,7 @@ export function ToolbarToggleGroup({
|
|
|
359
360
|
className,
|
|
360
361
|
...props
|
|
361
362
|
}: ToolbarToggleGroupProps) {
|
|
362
|
-
const { orientation } = useContext(
|
|
363
|
+
const { orientation } = useContext(getToolbarContext());
|
|
363
364
|
|
|
364
365
|
return (
|
|
365
366
|
<BaseToggleGroup
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
2
2
|
import {
|
|
3
3
|
cloneElement,
|
|
4
|
-
createContext,
|
|
5
4
|
useContext,
|
|
6
5
|
useId,
|
|
7
6
|
useSyncExternalStore,
|
|
@@ -12,6 +11,7 @@ import { createPortal } from "react-dom";
|
|
|
12
11
|
import { usePortalScope } from "../../hooks/usePortalScope";
|
|
13
12
|
import { cn } from "../../lib/cn";
|
|
14
13
|
import { enterFromSide } from "../../lib/motion";
|
|
14
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
15
15
|
|
|
16
16
|
export type TooltipSide = "top" | "bottom" | "left" | "right";
|
|
17
17
|
export type TooltipAlign = "start" | "center" | "end";
|
|
@@ -19,7 +19,7 @@ export type TooltipAlign = "start" | "center" | "end";
|
|
|
19
19
|
/* 规范:出现前约 300ms,消失不延迟 */
|
|
20
20
|
const DEFAULT_DELAY = 300;
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const getInProviderContext = /* @__PURE__ */ createLazyContext(false);
|
|
23
23
|
|
|
24
24
|
export type TooltipProviderProps = {
|
|
25
25
|
/** 这一组提示统一的延迟,毫秒 */
|
|
@@ -37,9 +37,12 @@ export function TooltipProvider({
|
|
|
37
37
|
timeout,
|
|
38
38
|
children,
|
|
39
39
|
}: TooltipProviderProps) {
|
|
40
|
+
const InProviderContext = getInProviderContext();
|
|
40
41
|
return (
|
|
41
42
|
<BaseTooltip.Provider delay={delay} timeout={timeout}>
|
|
42
|
-
<InProviderContext value={true}>
|
|
43
|
+
<InProviderContext.Provider value={true}>
|
|
44
|
+
{children}
|
|
45
|
+
</InProviderContext.Provider>
|
|
43
46
|
</BaseTooltip.Provider>
|
|
44
47
|
);
|
|
45
48
|
}
|
|
@@ -107,7 +110,7 @@ export function Tooltip({
|
|
|
107
110
|
className,
|
|
108
111
|
}: TooltipProps) {
|
|
109
112
|
const descriptionId = useId();
|
|
110
|
-
const inProvider = useContext(
|
|
113
|
+
const inProvider = useContext(getInProviderContext());
|
|
111
114
|
// 提示是一块和页面相反的颜色。做成相反主题的局部主题,而不是直接用反转色:
|
|
112
115
|
// 里面的键位提示、着色词因此也按这块底色取值,不会和底融在一起
|
|
113
116
|
const { anchorRef, portalRef } = usePortalScope({ invertTheme: true });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { cn } from "../../lib/cn";
|
|
3
|
-
import {
|
|
3
|
+
import { getNavActionContext } from "../nav-action/NavAction";
|
|
4
4
|
|
|
5
5
|
export type TopBarProps = ComponentProps<"header"> & {
|
|
6
6
|
/** 最左边的标志。本库不带标志,传你自己的 */
|
|
@@ -28,6 +28,7 @@ export function TopBar({
|
|
|
28
28
|
children,
|
|
29
29
|
...props
|
|
30
30
|
}: TopBarProps) {
|
|
31
|
+
const NavActionContext = getNavActionContext();
|
|
31
32
|
return (
|
|
32
33
|
<header
|
|
33
34
|
{...props}
|
|
@@ -40,7 +41,11 @@ export function TopBar({
|
|
|
40
41
|
{brand && <div className="flex min-w-0 items-center">{brand}</div>}
|
|
41
42
|
<div className="min-w-0 flex-1">{children}</div>
|
|
42
43
|
{tools && <div className="flex shrink-0 items-center gap-1">{tools}</div>}
|
|
43
|
-
{action &&
|
|
44
|
+
{action && (
|
|
45
|
+
<NavActionContext.Provider value="inline">
|
|
46
|
+
{action}
|
|
47
|
+
</NavActionContext.Provider>
|
|
48
|
+
)}
|
|
44
49
|
{menu}
|
|
45
50
|
</header>
|
|
46
51
|
);
|
package/src/icons/ArrowLeft.tsx
CHANGED
package/src/icons/ArrowRight.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { createIcon } from "./createIcon";
|
|
|
4
4
|
* 日历:日期字段右侧的记号。
|
|
5
5
|
* 名字带 `Icon` 是因为 `Calendar` 已经是月历控件了
|
|
6
6
|
*/
|
|
7
|
-
export const CalendarIcon = createIcon(
|
|
7
|
+
export const CalendarIcon = /* @__PURE__ */ createIcon(
|
|
8
8
|
"CalendarIcon",
|
|
9
9
|
<path d="M4 6h16v14H4zM4 11h16M8 3v5M16 3v5" />,
|
|
10
10
|
);
|
package/src/icons/Check.tsx
CHANGED
package/src/icons/Close.tsx
CHANGED
package/src/icons/Crosshair.tsx
CHANGED
package/src/icons/Lock.tsx
CHANGED
package/src/icons/Menu.tsx
CHANGED