@mantine-vue/hooks 3.0.0 → 3.2.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/cjs/index.cjs CHANGED
@@ -1006,7 +1006,7 @@ function range$1(start, end) {
1006
1006
  }
1007
1007
  function usePagination({ total, siblings = 1, boundaries = 1, page, initialPage, onChange, startValue = 1 }) {
1008
1008
  const start = (0, vue.computed)(() => Math.max(Math.trunc(startValue), 1));
1009
- const end = (0, vue.computed)(() => Math.max(Math.trunc(total), start.value));
1009
+ const end = (0, vue.computed)(() => Math.max(Math.trunc((0, vue.toValue)(total)), start.value));
1010
1010
  const totalPages = (0, vue.computed)(() => end.value - start.value + 1);
1011
1011
  const firstPage = (0, vue.computed)(() => initialPage ?? start.value);
1012
1012
  const [active, setActive] = useUncontrolled({
@@ -3042,6 +3042,8 @@ function getCssSize(size) {
3042
3042
  }
3043
3043
  function createCollapse({ dimension, getElementSize, expanded, transitionDuration, transitionTimingFunction = "ease", onTransitionEnd, onTransitionStart, keepMounted }) {
3044
3044
  const isExpanded = () => (0, vue.toValue)(expanded);
3045
+ const getTransitionDuration = () => (0, vue.toValue)(transitionDuration);
3046
+ const getTransitionTimingFunction = () => (0, vue.toValue)(transitionTimingFunction) ?? "ease";
3045
3047
  const collapsedStyles = {
3046
3048
  [dimension]: 0,
3047
3049
  overflow: "hidden",
@@ -3070,12 +3072,12 @@ function createCollapse({ dimension, getElementSize, expanded, transitionDuratio
3070
3072
  });
3071
3073
  };
3072
3074
  const getTransitionStyles = (size) => {
3073
- const duration = transitionDuration ?? getAutoSizeDuration(size);
3074
- return { transition: `${dimension} ${duration}ms ${transitionTimingFunction}, opacity ${duration}ms ${transitionTimingFunction}` };
3075
+ const duration = getTransitionDuration() ?? getAutoSizeDuration(size);
3076
+ return { transition: `${dimension} ${duration}ms ${getTransitionTimingFunction()}, opacity ${duration}ms ${getTransitionTimingFunction()}` };
3075
3077
  };
3076
3078
  (0, vue.watch)(() => isExpanded(), (value, oldValue) => {
3077
3079
  if (value === oldValue) return;
3078
- if (transitionDuration !== 0) onTransitionStart?.();
3080
+ if (getTransitionDuration() !== 0) onTransitionStart?.();
3079
3081
  if (value) raf(() => {
3080
3082
  state.value = "entering";
3081
3083
  mergeStyles({