UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

66 lines (62 loc) 3.05 kB
"use client"; const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs'); const require_ref = require('../../utils/ref.cjs'); const require_factory = require('../../core/system/factory.cjs'); const require_create_component = require('../../core/components/create-component.cjs'); const require_hooks_use_value_index = require('../../hooks/use-value/index.cjs'); const require_infinite_scroll_area_style = require('./infinite-scroll-area.style.cjs'); const require_use_infinite_scroll = require('./use-infinite-scroll.cjs'); let react = require("react"); react = require_rolldown_runtime.__toESM(react); let react_jsx_runtime = require("react/jsx-runtime"); react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime); //#region src/components/infinite-scroll-area/infinite-scroll-area.tsx const { PropsContext: InfiniteScrollAreaPropsContext, usePropsContext: useInfiniteScrollAreaPropsContext, withContext, withProvider } = require_create_component.createSlotComponent("infinite-scroll-area", require_infinite_scroll_area_style.infiniteScrollAreaStyle); /** * `InfiniteScrollArea` is for providing infinite scroll functionality. * This feature provides a smooth scrolling experience by automatically loading and displaying the next dataset when the user reaches the end of the page. * * @see https://yamada-ui.com/docs/components/infinite-scroll-area */ const InfiniteScrollArea = withProvider(({ ref, children, disabled, finish: finishProp, indexRef, initialLoad, loading, orientation: orientationProp, resetRef, reverse, rootMargin, rootRef: rootRefProp, startIndex, threshold, triggerProps, onLoad,...rest }) => { const rootRef = (0, react.useRef)(null); const { ref: triggerRef, finish } = require_use_infinite_scroll.useInfiniteScroll({ disabled, indexRef, initialLoad, orientation: require_hooks_use_value_index.useValue(orientationProp), resetRef, reverse, rootMargin, rootRef: rootRefProp ?? rootRef, startIndex, threshold, onLoad }); const showTrigger = !disabled && (!!finishProp || !finish); return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.div, { ref: require_ref.mergeRefs(rootRef, ref), "aria-busy": "false", role: "feed", ...rest, children: [ reverse && showTrigger ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InfiniteScrollTrigger, { ref: triggerRef, ...triggerProps, children: finish ? finishProp : loading }) : null, children, !reverse && showTrigger ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InfiniteScrollTrigger, { ref: triggerRef, ...triggerProps, children: finish ? finishProp : loading }) : null ] }); }, "root", { transferProps: ["orientation"] })(); const InfiniteScrollTrigger = withContext("div", "trigger")(); //#endregion exports.InfiniteScrollArea = InfiniteScrollArea; exports.InfiniteScrollAreaPropsContext = InfiniteScrollAreaPropsContext; exports.useInfiniteScrollAreaPropsContext = useInfiniteScrollAreaPropsContext; //# sourceMappingURL=infinite-scroll-area.cjs.map