@endfield-ui/react 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/package.json +17 -11
- package/src/components/accordion/Accordion.tsx +13 -5
- package/src/components/avatar/AvatarSwitcher.tsx +7 -5
- package/src/components/carousel/Carousel.tsx +6 -5
- package/src/components/context-menu/ContextMenu.tsx +5 -2
- package/src/components/data-row/DataRow.tsx +10 -4
- package/src/components/date-picker/DateField.tsx +1 -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/image-viewer/ImageViewer.tsx +6 -5
- package/src/components/list/List.tsx +7 -5
- package/src/components/nav-action/NavAction.tsx +4 -3
- package/src/components/nav-menu/NavMenu.tsx +13 -7
- package/src/components/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/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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
2
2
|
import {
|
|
3
|
-
createContext,
|
|
4
3
|
useContext,
|
|
5
4
|
useRef,
|
|
6
5
|
type ComponentProps,
|
|
@@ -18,10 +17,13 @@ import { firstFocusableIn } from "../dialog/initial-focus";
|
|
|
18
17
|
import { GhostText } from "../ghost-text/GhostText";
|
|
19
18
|
import { IconButton } from "../icon-button/IconButton";
|
|
20
19
|
import { LinkElement, type LinkRender } from "../link-element/LinkElement";
|
|
21
|
-
import {
|
|
20
|
+
import { getNavActionContext } from "../nav-action/NavAction";
|
|
21
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
22
22
|
|
|
23
23
|
/** 导航项点了之后要把菜单关上 */
|
|
24
|
-
const
|
|
24
|
+
const getNavMenuContext = /* @__PURE__ */ createLazyContext<() => void>(
|
|
25
|
+
() => {},
|
|
26
|
+
);
|
|
25
27
|
|
|
26
28
|
export type NavMenuProps = {
|
|
27
29
|
/** 菜单钮,通常是顶栏最右边的 `<IconButton>`。不传就用 `open` / `onOpenChange` 自己控制 */
|
|
@@ -68,6 +70,8 @@ export function NavMenu({
|
|
|
68
70
|
className,
|
|
69
71
|
children,
|
|
70
72
|
}: NavMenuProps) {
|
|
73
|
+
const NavMenuContext = getNavMenuContext();
|
|
74
|
+
const NavActionContext = getNavActionContext();
|
|
71
75
|
const [isOpen, setOpen] = useControllableState({
|
|
72
76
|
value: open,
|
|
73
77
|
defaultValue: defaultOpen,
|
|
@@ -114,11 +118,11 @@ export function NavMenu({
|
|
|
114
118
|
ref={bodyRef}
|
|
115
119
|
className="flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain"
|
|
116
120
|
>
|
|
117
|
-
<NavMenuContext value={() => setOpen(false)}>
|
|
121
|
+
<NavMenuContext.Provider value={() => setOpen(false)}>
|
|
118
122
|
<nav aria-label={navLabel}>
|
|
119
123
|
<ul className="flex flex-col gap-1 p-4">{children}</ul>
|
|
120
124
|
</nav>
|
|
121
|
-
</NavMenuContext>
|
|
125
|
+
</NavMenuContext.Provider>
|
|
122
126
|
|
|
123
127
|
{tools && (
|
|
124
128
|
<div className="mx-4 flex flex-wrap gap-1 bg-surface-muted p-1">
|
|
@@ -146,7 +150,9 @@ export function NavMenu({
|
|
|
146
150
|
|
|
147
151
|
{footer && (
|
|
148
152
|
<div className="flex shrink-0 flex-col gap-2 p-4">
|
|
149
|
-
<NavActionContext value="block">
|
|
153
|
+
<NavActionContext.Provider value="block">
|
|
154
|
+
{footer}
|
|
155
|
+
</NavActionContext.Provider>
|
|
150
156
|
</div>
|
|
151
157
|
)}
|
|
152
158
|
</div>
|
|
@@ -204,7 +210,7 @@ export function NavMenuItem({
|
|
|
204
210
|
children,
|
|
205
211
|
...props
|
|
206
212
|
}: NavMenuItemProps) {
|
|
207
|
-
const close = useContext(
|
|
213
|
+
const close = useContext(getNavMenuContext());
|
|
208
214
|
const isLink = href !== undefined || render !== undefined;
|
|
209
215
|
|
|
210
216
|
const handleClick = (event: MouseEvent<HTMLElement>) => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createContext,
|
|
3
2
|
useContext,
|
|
4
3
|
useId,
|
|
5
4
|
useMemo,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
choiceMark,
|
|
19
18
|
} from "../checkbox/choice-style";
|
|
20
19
|
import { useFieldContext } from "../field/Field";
|
|
20
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
21
21
|
|
|
22
22
|
type RadioGroupContextValue = {
|
|
23
23
|
name: string;
|
|
@@ -28,7 +28,8 @@ type RadioGroupContextValue = {
|
|
|
28
28
|
invalid: boolean;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const getRadioGroupContext =
|
|
32
|
+
/* @__PURE__ */ createLazyContext<RadioGroupContextValue | null>(null);
|
|
32
33
|
|
|
33
34
|
export type RadioGroupOrientation = "vertical" | "horizontal";
|
|
34
35
|
|
|
@@ -64,6 +65,7 @@ export function RadioGroup({
|
|
|
64
65
|
className,
|
|
65
66
|
...props
|
|
66
67
|
}: RadioGroupProps) {
|
|
68
|
+
const RadioGroupContext = getRadioGroupContext();
|
|
67
69
|
const field = useFieldContext();
|
|
68
70
|
const autoName = useId();
|
|
69
71
|
const [current, setCurrent] = useControllableState<string | undefined>({
|
|
@@ -92,7 +94,7 @@ export function RadioGroup({
|
|
|
92
94
|
);
|
|
93
95
|
|
|
94
96
|
return (
|
|
95
|
-
<RadioGroupContext value={context}>
|
|
97
|
+
<RadioGroupContext.Provider value={context}>
|
|
96
98
|
<div
|
|
97
99
|
role="radiogroup"
|
|
98
100
|
// 字段是 <fieldset> 时名称由 <legend> 给;否则指向字段的标签
|
|
@@ -109,7 +111,7 @@ export function RadioGroup({
|
|
|
109
111
|
className,
|
|
110
112
|
)}
|
|
111
113
|
/>
|
|
112
|
-
</RadioGroupContext>
|
|
114
|
+
</RadioGroupContext.Provider>
|
|
113
115
|
);
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -134,7 +136,7 @@ export function Radio({
|
|
|
134
136
|
children,
|
|
135
137
|
...props
|
|
136
138
|
}: RadioProps) {
|
|
137
|
-
const group = useContext(
|
|
139
|
+
const group = useContext(getRadioGroupContext());
|
|
138
140
|
|
|
139
141
|
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
140
142
|
onChange?.(event);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createContext,
|
|
3
2
|
useContext,
|
|
4
3
|
useMemo,
|
|
5
4
|
type ComponentProps,
|
|
@@ -14,6 +13,7 @@ import { decor } from "../../lib/decor";
|
|
|
14
13
|
import { focusRingInset } from "../../lib/focus-ring";
|
|
15
14
|
import { LinkElement, type LinkRender } from "../link-element/LinkElement";
|
|
16
15
|
import { Tag } from "../tag/Tag";
|
|
16
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
17
17
|
|
|
18
18
|
type ScheduleContextValue = {
|
|
19
19
|
start: string;
|
|
@@ -23,10 +23,11 @@ type ScheduleContextValue = {
|
|
|
23
23
|
describe: (start: string, end: string) => string;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const getScheduleContext =
|
|
27
|
+
/* @__PURE__ */ createLazyContext<ScheduleContextValue | null>(null);
|
|
27
28
|
|
|
28
29
|
function useSchedule(part: string) {
|
|
29
|
-
const context = useContext(
|
|
30
|
+
const context = useContext(getScheduleContext());
|
|
30
31
|
if (!context) throw new Error(`${part} 要放在 Schedule 里面`);
|
|
31
32
|
return context;
|
|
32
33
|
}
|
|
@@ -86,6 +87,7 @@ export function Schedule({
|
|
|
86
87
|
children,
|
|
87
88
|
...props
|
|
88
89
|
}: ScheduleProps) {
|
|
90
|
+
const ScheduleContext = getScheduleContext();
|
|
89
91
|
const [scrollerRef, overflowing] = useOverflowing();
|
|
90
92
|
const dates = useMemo(() => eachDay(start, end), [start, end]);
|
|
91
93
|
const days = dates.length;
|
|
@@ -125,7 +127,7 @@ export function Schedule({
|
|
|
125
127
|
: null;
|
|
126
128
|
|
|
127
129
|
return (
|
|
128
|
-
<ScheduleContext value={context}>
|
|
130
|
+
<ScheduleContext.Provider value={context}>
|
|
129
131
|
<div
|
|
130
132
|
ref={scrollerRef}
|
|
131
133
|
{...props}
|
|
@@ -257,7 +259,7 @@ export function Schedule({
|
|
|
257
259
|
)}
|
|
258
260
|
</div>
|
|
259
261
|
</div>
|
|
260
|
-
</ScheduleContext>
|
|
262
|
+
</ScheduleContext.Provider>
|
|
261
263
|
);
|
|
262
264
|
}
|
|
263
265
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createContext,
|
|
3
2
|
useContext,
|
|
4
3
|
useId,
|
|
5
4
|
useMemo,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
type ControlSize,
|
|
19
18
|
type ControlVariant,
|
|
20
19
|
} from "../input/control-box";
|
|
20
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
21
21
|
|
|
22
22
|
export type SegmentedControlSize = ControlSize;
|
|
23
23
|
export type SegmentedControlVariant = ControlVariant;
|
|
@@ -32,7 +32,8 @@ type SegmentedContextValue = {
|
|
|
32
32
|
invalid: boolean;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const getSegmentedContext =
|
|
36
|
+
/* @__PURE__ */ createLazyContext<SegmentedContextValue | null>(null);
|
|
36
37
|
|
|
37
38
|
export type SegmentedControlProps = Omit<
|
|
38
39
|
ComponentProps<"div">,
|
|
@@ -85,6 +86,7 @@ export function SegmentedControl({
|
|
|
85
86
|
ref,
|
|
86
87
|
...props
|
|
87
88
|
}: SegmentedControlProps) {
|
|
89
|
+
const SegmentedContext = getSegmentedContext();
|
|
88
90
|
const field = useFieldContext();
|
|
89
91
|
// 选中的那块底画在轨道上:换一段时是同一块滑过去
|
|
90
92
|
const trackRef = useIndicator<HTMLDivElement>("[data-selected]");
|
|
@@ -116,7 +118,7 @@ export function SegmentedControl({
|
|
|
116
118
|
);
|
|
117
119
|
|
|
118
120
|
return (
|
|
119
|
-
<SegmentedContext value={context}>
|
|
121
|
+
<SegmentedContext.Provider value={context}>
|
|
120
122
|
<div
|
|
121
123
|
role="radiogroup"
|
|
122
124
|
// 字段是 <fieldset> 时名称由 <legend> 给;否则指向字段的标签
|
|
@@ -149,7 +151,7 @@ export function SegmentedControl({
|
|
|
149
151
|
className,
|
|
150
152
|
)}
|
|
151
153
|
/>
|
|
152
|
-
</SegmentedContext>
|
|
154
|
+
</SegmentedContext.Provider>
|
|
153
155
|
);
|
|
154
156
|
}
|
|
155
157
|
|
|
@@ -182,7 +184,7 @@ export function Segment({
|
|
|
182
184
|
children,
|
|
183
185
|
...props
|
|
184
186
|
}: SegmentProps) {
|
|
185
|
-
const context = useContext(
|
|
187
|
+
const context = useContext(getSegmentedContext());
|
|
186
188
|
if (!context) {
|
|
187
189
|
throw new Error("<Segment> 必须放在 <SegmentedControl> 里");
|
|
188
190
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Select as BaseSelect } from "@base-ui/react/select";
|
|
2
2
|
import {
|
|
3
|
-
createContext,
|
|
4
3
|
Fragment,
|
|
5
4
|
useContext,
|
|
6
5
|
useRef,
|
|
@@ -13,7 +12,7 @@ import { StatusDanger } from "../../icons/StatusDanger";
|
|
|
13
12
|
import { TriangleRight } from "../../icons/TriangleRight";
|
|
14
13
|
import { cn } from "../../lib/cn";
|
|
15
14
|
import {
|
|
16
|
-
|
|
15
|
+
getMenuVariantContext,
|
|
17
16
|
menuGroupLabel,
|
|
18
17
|
menuItem,
|
|
19
18
|
menuItemCurrent,
|
|
@@ -31,6 +30,7 @@ import {
|
|
|
31
30
|
type ControlSize,
|
|
32
31
|
type ControlVariant,
|
|
33
32
|
} from "../input/control-box";
|
|
33
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
34
34
|
|
|
35
35
|
export type SelectSize = ControlSize;
|
|
36
36
|
export type SelectVariant = ControlVariant;
|
|
@@ -107,7 +107,7 @@ export type SelectMultipleProps = SelectCommonProps & {
|
|
|
107
107
|
export type SelectProps = SelectSingleProps | SelectMultipleProps;
|
|
108
108
|
|
|
109
109
|
/** 面板里的选项要知道自己在不在多选的下拉里 */
|
|
110
|
-
const
|
|
110
|
+
const getSelectMultipleContext = /* @__PURE__ */ createLazyContext(false);
|
|
111
111
|
|
|
112
112
|
function joinedLabels(selected: SelectOption[]) {
|
|
113
113
|
return (
|
|
@@ -137,6 +137,8 @@ function joinedLabels(selected: SelectOption[]) {
|
|
|
137
137
|
* 选项只有两三个、又都该一眼看到时,用单选或页签,不用它。
|
|
138
138
|
*/
|
|
139
139
|
export function Select(props: SelectProps) {
|
|
140
|
+
const MenuVariantContext = getMenuVariantContext();
|
|
141
|
+
const SelectMultipleContext = getSelectMultipleContext();
|
|
140
142
|
const {
|
|
141
143
|
items,
|
|
142
144
|
placeholder,
|
|
@@ -253,8 +255,8 @@ export function Select(props: SelectProps) {
|
|
|
253
255
|
className={cn(menuPanel, "min-w-(--anchor-width)")}
|
|
254
256
|
>
|
|
255
257
|
<BaseSelect.List className="max-h-[min(var(--available-height),20rem)] overflow-y-auto overscroll-contain">
|
|
256
|
-
<MenuVariantContext value={panelVariant}>
|
|
257
|
-
<SelectMultipleContext value={multiple}>
|
|
258
|
+
<MenuVariantContext.Provider value={panelVariant}>
|
|
259
|
+
<SelectMultipleContext.Provider value={multiple}>
|
|
258
260
|
{children ??
|
|
259
261
|
items.map((item) => (
|
|
260
262
|
<SelectItem
|
|
@@ -265,8 +267,8 @@ export function Select(props: SelectProps) {
|
|
|
265
267
|
{item.label}
|
|
266
268
|
</SelectItem>
|
|
267
269
|
))}
|
|
268
|
-
</SelectMultipleContext>
|
|
269
|
-
</MenuVariantContext>
|
|
270
|
+
</SelectMultipleContext.Provider>
|
|
271
|
+
</MenuVariantContext.Provider>
|
|
270
272
|
</BaseSelect.List>
|
|
271
273
|
</BaseSelect.Popup>
|
|
272
274
|
</BaseSelect.Positioner>
|
|
@@ -320,8 +322,8 @@ export function SelectItem({
|
|
|
320
322
|
children,
|
|
321
323
|
...props
|
|
322
324
|
}: SelectItemProps) {
|
|
323
|
-
const variant = useContext(
|
|
324
|
-
const multiple = useContext(
|
|
325
|
+
const variant = useContext(getMenuVariantContext());
|
|
326
|
+
const multiple = useContext(getSelectMultipleContext());
|
|
325
327
|
|
|
326
328
|
return (
|
|
327
329
|
<BaseSelect.Item
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
2
2
|
import {
|
|
3
|
-
createContext,
|
|
4
3
|
useContext,
|
|
5
4
|
useMemo,
|
|
6
5
|
type ComponentProps,
|
|
@@ -11,9 +10,14 @@ import { usePortalScope } from "../../hooks/usePortalScope";
|
|
|
11
10
|
import { cn } from "../../lib/cn";
|
|
12
11
|
import { focusRingInset } from "../../lib/focus-ring";
|
|
13
12
|
import { LinkElement, type LinkRender } from "../link-element/LinkElement";
|
|
14
|
-
import {
|
|
13
|
+
import { getNavActionContext } from "../nav-action/NavAction";
|
|
14
|
+
import { createLazyContext } from "../../lib/create-lazy-context";
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const getSideRailContext = /* @__PURE__ */ createLazyContext<{
|
|
17
|
+
collapsed: boolean;
|
|
18
|
+
}>({
|
|
19
|
+
collapsed: false,
|
|
20
|
+
});
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* 一行栏目的样子:普通栏目和二级的父项共用。
|
|
@@ -92,10 +96,12 @@ export function SideRail({
|
|
|
92
96
|
children,
|
|
93
97
|
...props
|
|
94
98
|
}: SideRailProps) {
|
|
99
|
+
const SideRailContext = getSideRailContext();
|
|
100
|
+
const NavActionContext = getNavActionContext();
|
|
95
101
|
const context = useMemo(() => ({ collapsed }), [collapsed]);
|
|
96
102
|
|
|
97
103
|
return (
|
|
98
|
-
<SideRailContext value={context}>
|
|
104
|
+
<SideRailContext.Provider value={context}>
|
|
99
105
|
<nav
|
|
100
106
|
{...props}
|
|
101
107
|
data-collapsed={collapsed ? "" : undefined}
|
|
@@ -137,9 +143,9 @@ export function SideRail({
|
|
|
137
143
|
<div
|
|
138
144
|
className={cn("flex shrink-0 p-3", collapsed && "justify-center")}
|
|
139
145
|
>
|
|
140
|
-
<NavActionContext value={collapsed ? "stacked" : "block"}>
|
|
146
|
+
<NavActionContext.Provider value={collapsed ? "stacked" : "block"}>
|
|
141
147
|
{action}
|
|
142
|
-
</NavActionContext>
|
|
148
|
+
</NavActionContext.Provider>
|
|
143
149
|
</div>
|
|
144
150
|
)}
|
|
145
151
|
|
|
@@ -154,7 +160,7 @@ export function SideRail({
|
|
|
154
160
|
</div>
|
|
155
161
|
)}
|
|
156
162
|
</nav>
|
|
157
|
-
</SideRailContext>
|
|
163
|
+
</SideRailContext.Provider>
|
|
158
164
|
);
|
|
159
165
|
}
|
|
160
166
|
|
|
@@ -195,7 +201,7 @@ export function SideRailItem({
|
|
|
195
201
|
children,
|
|
196
202
|
...props
|
|
197
203
|
}: SideRailItemProps) {
|
|
198
|
-
const { collapsed } = useContext(
|
|
204
|
+
const { collapsed } = useContext(getSideRailContext());
|
|
199
205
|
const { anchorRef, portalRef } = usePortalScope();
|
|
200
206
|
const isLink = href !== undefined || render !== undefined;
|
|
201
207
|
|
|
@@ -294,7 +300,7 @@ export function SideRailGroup({
|
|
|
294
300
|
children,
|
|
295
301
|
...props
|
|
296
302
|
}: SideRailGroupProps) {
|
|
297
|
-
const { collapsed } = useContext(
|
|
303
|
+
const { collapsed } = useContext(getSideRailContext());
|
|
298
304
|
|
|
299
305
|
return (
|
|
300
306
|
<li {...props} className={cn("not-first:mt-2", className)}>
|
|
@@ -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 (
|