@nascentdigital/funnel-ui 4.6.0 → 4.6.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.
@@ -1,6 +1,6 @@
1
1
  import { Callback, Duration, Transform } from '@nascentdigital/funnel-core';
2
2
  import { HTMLAttributes, ReactElement, ReactNode } from 'react';
3
- export declare function Carousel({ className, spacing, infinite, autoplay, autoplayInterval: autoplayIntervalRaw, disableClipping, renderIndicator, renderNavButton, renderPlayButton, onPageDrag, onPageChange, children }: Carousel.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare function Carousel({ className, spacing: spacingRaw, infinite, autoplay, autoplayInterval: autoplayIntervalRaw, disableClipping, renderIndicator, renderNavButton, renderPlayButton, onPageDrag, onPageChange, children }: Carousel.Props): import("react/jsx-runtime").JSX.Element;
4
4
  export declare namespace Carousel {
5
5
  export type State = 'initializing' | 'disabled' | 'ready' | 'dragging' | 'animating';
6
6
  export type Props = {
@@ -14,7 +14,7 @@ const rxjs_1 = require("rxjs");
14
14
  const app_1 = require("../app");
15
15
  const hooks_1 = require("../hooks");
16
16
  // component
17
- function Carousel({ className, spacing = 0, infinite = false, autoplay = false, autoplayInterval: autoplayIntervalRaw, disableClipping = false, renderIndicator, renderNavButton, renderPlayButton, onPageDrag = funnel_core_1.Fn.NoOp, onPageChange = funnel_core_1.Fn.NoOp, children = [] }) {
17
+ function Carousel({ className, spacing: spacingRaw, infinite = false, autoplay = false, autoplayInterval: autoplayIntervalRaw, disableClipping = false, renderIndicator, renderNavButton, renderPlayButton, onPageDrag = funnel_core_1.Fn.NoOp, onPageChange = funnel_core_1.Fn.NoOp, children = [] }) {
18
18
  var _a;
19
19
  // bind props + state + hooks
20
20
  const [state, setState] = (0, react_2.useState)('initializing');
@@ -37,18 +37,21 @@ function Carousel({ className, spacing = 0, infinite = false, autoplay = false,
37
37
  const playButtonFocused = !!playButton && keyboardFocusElement === playButton;
38
38
  const childCount = children.length;
39
39
  const gap = (0, react_2.useMemo)(() => {
40
+ // zero if no container
40
41
  if (!container) {
41
- return;
42
+ return 0;
42
43
  }
44
+ // get gap pixel value from css variable
43
45
  const rawValue = getComputedStyle(container).getPropertyValue('--nd-carousel-gap');
44
46
  if (rawValue.endsWith('px')) {
45
47
  return Number.parseInt(rawValue.substring(0, rawValue.length - 2));
46
48
  }
49
+ // otherwise zero
47
50
  else {
48
- return undefined;
51
+ return 0;
49
52
  }
50
53
  }, [container]);
51
- console.debug('>>> carousel', gap);
54
+ const spacing = spacingRaw !== null && spacingRaw !== void 0 ? spacingRaw : (gap / 2);
52
55
  const appConfig = (0, app_1.useAppConfig)();
53
56
  const autoplayInterval = (0, react_2.useMemo)(() => { var _a; return funnel_core_1.Duration.toMilliseconds((_a = autoplayIntervalRaw !== null && autoplayIntervalRaw !== void 0 ? autoplayIntervalRaw : appConfig.ui.carouselInterval) !== null && _a !== void 0 ? _a : '1s'); }, [autoplayIntervalRaw, appConfig]);
54
57
  const reduceMotion = (0, react_1.useReducedMotion)();
@@ -25,4 +25,9 @@
25
25
  object-position: var(--nd-visual-anchor);
26
26
  }
27
27
  }
28
+
29
+ img.nd-Visual-image {
30
+ object-fit: var(--nd-visual-object-fit, cover);
31
+ object-position: var(--nd-visual-anchor);
32
+ }
28
33
  }
@@ -10,6 +10,7 @@
10
10
  /* aspect ratios */
11
11
  .nd-VisualPanel-aspect-auto {
12
12
  --nd-visual-aspect: theme(aspectRatio.auto);
13
+ --nd-visual-height: auto;
13
14
  }
14
15
  .nd-VisualPanel-aspect-square {
15
16
  --nd-visual-aspect: theme(aspectRatio.square);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nascentdigital/funnel-ui",
3
3
  "description": "UI components for funnel",
4
- "version": "4.6.0",
4
+ "version": "4.6.1",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
7
7
  "access": "restricted"
@@ -69,5 +69,5 @@
69
69
  "react-dom": "^19",
70
70
  "ts-jest": "^29.3.2"
71
71
  },
72
- "gitHead": "7fba18243bc79f94b3bd665db21f37bc7f3afd4c"
72
+ "gitHead": "4a1d18f6f87148196b5e820c0ada8f2a8111b9f6"
73
73
  }