Private
Public Access
1
0
Files
power-apps-codeapps-blog-part2/node_modules/@fluentui/react-teaching-popover/lib-commonjs/components/TeachingPopoverCarouselPageCount/useTeachingPopoverCarouselPageCount.js

39 lines
1.6 KiB
JavaScript

'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useTeachingPopoverCarouselPageCount_unstable", {
enumerable: true,
get: function() {
return useTeachingPopoverCarouselPageCount_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _useCarouselValues = require("../TeachingPopoverCarousel/Carousel/useCarouselValues");
const _CarouselContext = require("../TeachingPopoverCarousel/Carousel/CarouselContext");
const useTeachingPopoverCarouselPageCount_unstable = (props, ref)=>{
const values = (0, _useCarouselValues.useCarouselValues_unstable)((snapshot)=>snapshot);
var _useCarouselContext_unstable;
const selectedValue = (_useCarouselContext_unstable = (0, _CarouselContext.useCarouselContext_unstable)((c)=>c.value)) !== null && _useCarouselContext_unstable !== void 0 ? _useCarouselContext_unstable : values[0];
const currentIndex = values.indexOf(selectedValue);
const totalPages = values.length;
return {
currentIndex,
totalPages,
renderPageCount: props.children,
components: {
root: 'div'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
ref,
...props,
children: props.children(currentIndex + 1, totalPages)
}), {
elementType: 'div'
})
};
};