@donotdev/components 0.3.0 → 0.3.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,4 +1,5 @@
1
1
  import type { ReactElement } from 'react';
2
+ import type { MediaBackground } from '../../types';
2
3
  import './ImageGallery.css';
3
4
  /** Image source data for ImageGallery. */
4
5
  export interface ImageData {
@@ -7,7 +8,7 @@ export interface ImageData {
7
8
  /** Per-image override of the gallery `fit` (e.g. `'contain'` for a cut-out packshot). */
8
9
  fit?: ImageFit;
9
10
  }
10
- /** `'cover'` crops to fill the frame; `'contain'` shows the whole image on the muted frame. */
11
+ /** `'cover'` crops to fill the frame; `'contain'` shows the whole image on the frame (see `background`). */
11
12
  export type ImageFit = 'cover' | 'contain';
12
13
  /** Props for the ImageGallery component -- thumbnail strip with main image preview. */
13
14
  export interface ImageGalleryProps {
@@ -29,6 +30,15 @@ export interface ImageGalleryProps {
29
30
  * @default 'cover'
30
31
  */
31
32
  fit?: ImageFit;
33
+ /**
34
+ * Opt-in background behind the main stage and the contained thumbnails, visible
35
+ * where an image does not fill its frame (`fit: 'contain'`, transparent cut-outs).
36
+ * `'transparent'` paints nothing; `'muted'`, `'primary'`, `'secondary'` and
37
+ * `'accent'` fill with the theme token of the same name. The reserved space
38
+ * (`aspectRatio`) is unaffected.
39
+ * @default 'transparent'
40
+ */
41
+ background?: MediaBackground;
32
42
  }
33
43
  /**
34
44
  * ImageGallery - Full-featured image gallery component
@@ -53,6 +63,6 @@ export interface ImageGalleryProps {
53
63
  * />
54
64
  * ```
55
65
  */
56
- export declare function ImageGallery({ images, aspectRatio, altPrefix, onImageChange, nobox, fit, }: ImageGalleryProps): ReactElement;
66
+ export declare function ImageGallery({ images, aspectRatio, altPrefix, onImageChange, nobox, fit, background, }: ImageGalleryProps): ReactElement;
57
67
  export default ImageGallery;
58
68
  //# sourceMappingURL=ImageGallery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImageGallery.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/ImageGallery.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,OAAO,CAAC;AAerE,OAAO,oBAAoB,CAAC;AAE5B,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,+FAA+F;AAC/F,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3C,uFAAuF;AACvF,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;IAClC,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAqCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,WAAoB,EACpB,SAAmB,EACnB,aAAa,EACb,KAAK,EACL,GAAa,GACd,EAAE,iBAAiB,GAAG,YAAY,CAqOlC;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"ImageGallery.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/ImageGallery.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAYnD,OAAO,oBAAoB,CAAC;AAE5B,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,4GAA4G;AAC5G,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3C,uFAAuF;AACvF,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;IAClC,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAqCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,WAAoB,EACpB,SAAmB,EACnB,aAAa,EACb,KAAK,EACL,GAAa,EACb,UAA0B,GAC3B,EAAE,iBAAiB,GAAG,YAAY,CAuOlC;AAED,eAAe,YAAY,CAAC"}
@@ -66,7 +66,7 @@ function normalizeImage(img, fit) {
66
66
  * />
67
67
  * ```
68
68
  */
69
- export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image', onImageChange, nobox, fit = 'cover', }) {
69
+ export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image', onImageChange, nobox, fit = 'cover', background = 'transparent', }) {
70
70
  const [selectedIndex, setSelectedIndex] = useState(0);
71
71
  const [lightboxOpen, setLightboxOpen] = useState(false);
72
72
  const stripRef = useRef(null);
@@ -168,7 +168,7 @@ export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image'
168
168
  if (count === 0) {
169
169
  return (_jsx("div", { className: "image-gallery image-gallery--empty", style: { aspectRatio }, children: _jsx("span", { className: "image-gallery__placeholder", children: "No images" }) }));
170
170
  }
171
- return (_jsxs("div", { className: "image-gallery", onKeyDown: handleKeyDown, onContextMenu: blockContextMenu, tabIndex: 0, role: "region", "aria-label": "Image gallery", "aria-roledescription": "carousel", children: [_jsxs("div", { className: `image-gallery__main${nobox ? '' : ' image-gallery__main--lightbox'}`, style: { aspectRatio }, onClick: handleMainAreaClick, children: [_jsx("div", { ref: stripRef, className: "image-gallery__strip", children: normalizedImages.map((img, index) => {
171
+ return (_jsxs("div", { className: "image-gallery", onKeyDown: handleKeyDown, onContextMenu: blockContextMenu, tabIndex: 0, role: "region", "aria-label": "Image gallery", "aria-roledescription": "carousel", children: [_jsxs("div", { className: `image-gallery__main${nobox ? '' : ' image-gallery__main--lightbox'}`, style: { aspectRatio }, "data-background": background, onClick: handleMainAreaClick, children: [_jsx("div", { ref: stripRef, className: "image-gallery__strip", children: normalizedImages.map((img, index) => {
172
172
  // Current and neighbours load now, so a swipe never reveals an empty slide.
173
173
  const loading = isNearSlide(index, clampedIndex, count)
174
174
  ? 'eager'
@@ -176,6 +176,6 @@ export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image'
176
176
  return (_jsxs("div", { className: "image-gallery__slide", "aria-hidden": index === clampedIndex ? undefined : true, children: [img.fit === 'cover' && img.full !== img.thumb && (_jsx("img", { src: img.thumb, alt: "", className: "image-gallery__slide-img image-gallery__slide-placeholder", loading: loading, decoding: "async", draggable: false, onError: handleImageError })), _jsx(ResponsiveImg, { image: { fullUrl: img.full, thumbUrl: img.thumb }, alt: `${altPrefix} ${index + 1} of ${count}`, className: "image-gallery__slide-img", "data-fit": img.fit, loading: loading, decoding: "async", draggable: false, onError: handleImageError })] }, index));
177
177
  }) }), hasMultiple && (_jsx(GalleryArrows, { onPrev: () => goToImage(clampedIndex - 1), onNext: () => goToImage(clampedIndex + 1) }))] }), hasMultiple && (_jsx("div", { ref: thumbnailsRef, className: "image-gallery__thumbnails", role: "tablist", "aria-label": "Image thumbnails", children: normalizedImages.map((img, index) => (_jsx("button", { type: "button", role: "tab", "aria-selected": index === clampedIndex, "aria-label": `View image ${index + 1}`, className: `image-gallery__thumbnail ${index === clampedIndex
178
178
  ? 'image-gallery__thumbnail--selected'
179
- : ''}`, onClick: () => goToImage(index), children: _jsx("img", { src: img.thumb, alt: "", className: "image-gallery__thumbnail-image", "data-fit": img.fit, draggable: false, onError: handleImageError }) }, index))) })), !nobox && (_jsx(Dialog, { open: lightboxOpen, onOpenChange: setLightbox, showClose: true, noSwipe: true, className: "image-gallery__lightbox", children: _jsx(LightboxViewer, { images: normalizedImages, index: clampedIndex, onIndexChange: (index) => goToImage(index, true), onClose: () => setLightbox(false), altPrefix: altPrefix, frameRef: lightboxFrameRef }) }))] }));
179
+ : ''}`, onClick: () => goToImage(index), children: _jsx("img", { src: img.thumb, alt: "", className: "image-gallery__thumbnail-image", "data-fit": img.fit, "data-background": background, draggable: false, onError: handleImageError }) }, index))) })), !nobox && (_jsx(Dialog, { open: lightboxOpen, onOpenChange: setLightbox, showClose: true, noSwipe: true, className: "image-gallery__lightbox", children: _jsx(LightboxViewer, { images: normalizedImages, index: clampedIndex, onIndexChange: (index) => goToImage(index, true), onClose: () => setLightbox(false), altPrefix: altPrefix, frameRef: lightboxFrameRef }) }))] }));
180
180
  }
181
181
  export default ImageGallery;
@@ -3,6 +3,7 @@
3
3
  * @description Cover media for Card: fit, alt, hover view and loading priority.
4
4
  */
5
5
  import type { CSSProperties, ReactNode } from 'react';
6
+ import type { MediaBackground } from '../../types';
6
7
  import type { ResponsiveImage } from '../../utils/responsiveImage';
7
8
  /** An image cover: a URL, or a full + thumbnail pair (CRUD `Picture`). */
8
9
  export type CardCoverImage = string | ResponsiveImage;
@@ -13,7 +14,8 @@ export type CardCoverImage = string | ResponsiveImage;
13
14
  export interface CardCoverMedia {
14
15
  /**
15
16
  * `'cover'` fills the region and crops (photography). `'contain'` shows the whole
16
- * image on the muted cover background (cut-out packshots, logos).
17
+ * image inside the cover frame (cut-out packshots, logos); pair with
18
+ * `background` for a fill behind it.
17
19
  * @default 'cover'
18
20
  */
19
21
  fit?: 'cover' | 'contain';
@@ -23,6 +25,11 @@ export interface CardCoverMedia {
23
25
  hover?: CardCoverImage;
24
26
  /** Load eagerly with high fetch priority (above-the-fold covers). @default false */
25
27
  eager?: boolean;
28
+ /**
29
+ * Opt-in background behind the media. `'transparent'` paints nothing.
30
+ * @default 'transparent'
31
+ */
32
+ background?: MediaBackground;
26
33
  }
27
34
  /**
28
35
  * Renders the card cover region with optional overlay.
@@ -1 +1 @@
1
- {"version":3,"file":"cover.d.ts","sourceRoot":"","sources":["../../../src/atomic/Card/cover.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,eAAe,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,oFAAoF;IACpF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAOD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,SAAS,EAC7C,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,SAAS,EACrD,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,cAAmB,GACzB,SAAS,CAgDX"}
1
+ {"version":3,"file":"cover.d.ts","sourceRoot":"","sources":["../../../src/atomic/Card/cover.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,eAAe,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,oFAAoF;IACpF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAOD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,SAAS,EAC7C,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,SAAS,EACrD,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,cAAmB,GACzB,SAAS,CAuDX"}
@@ -27,13 +27,13 @@ export function renderCardCover(cover, coverAspect, hasBody, media = {}) {
27
27
  if (!cover)
28
28
  return null;
29
29
  const image = typeof cover === 'string' || isResponsiveImage(cover) ? cover : null;
30
- const { fit = 'cover', alt = '', hover, eager = false } = media;
30
+ const { fit = 'cover', alt = '', hover, eager = false, background = 'transparent', } = media;
31
31
  // When body is present the cover owns the top region sized by coverAspect.
32
32
  // When body is absent the cover fills the card (card owns the aspect-ratio).
33
33
  const coverStyle = hasBody
34
34
  ? { aspectRatio: coverAspect ?? '4 / 5' }
35
35
  : {};
36
- return (_jsxs("div", { className: "dndev-card-cover", "data-has-body": hasBody ? 'true' : undefined, "data-fit": fit, "data-has-hover": image && hover ? 'true' : undefined, style: coverStyle, children: [image ? (_jsx(ResponsiveImg, { image: toImage(image), alt: alt, loading: eager ? 'eager' : 'lazy', fetchPriority: eager ? 'high' : undefined, decoding: "async", referrerPolicy: "no-referrer" })) : (_jsx("div", { className: "dndev-card-cover-media", children: cover })), image && hover && (
36
+ return (_jsxs("div", { className: "dndev-card-cover", "data-has-body": hasBody ? 'true' : undefined, "data-fit": fit, "data-background": background, "data-has-hover": image && hover ? 'true' : undefined, style: coverStyle, children: [image ? (_jsx(ResponsiveImg, { image: toImage(image), alt: alt, loading: eager ? 'eager' : 'lazy', fetchPriority: eager ? 'high' : undefined, decoding: "async", referrerPolicy: "no-referrer" })) : (_jsx("div", { className: "dndev-card-cover-media", children: cover })), image && hover && (
37
37
  // Decorative second view (e.g. lifestyle shot behind a packshot):
38
38
  // revealed on hover / keyboard focus, hidden from assistive tech.
39
39
  _jsx(ResponsiveImg, { className: "dndev-card-cover-hover", image: toImage(hover), alt: "", "aria-hidden": "true", loading: "lazy", decoding: "async", referrerPolicy: "no-referrer" }))] }));
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import type { VariantProps } from 'class-variance-authority';
10
10
  import type { CSSProperties, HTMLAttributes, ReactNode, Ref } from 'react';
11
- import type { IconType } from '../../types';
11
+ import type { IconType, MediaBackground } from '../../types';
12
12
  import { surfaceVariants } from '../../utils/variants';
13
13
  import type { CardCoverImage, CardCoverMedia } from './cover';
14
14
  export { renderCardCover } from './cover';
@@ -159,6 +159,15 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
159
159
  * @default 'cover'
160
160
  */
161
161
  coverFit?: CardCoverMedia['fit'];
162
+ /**
163
+ * Opt-in background behind the cover media, visible where the image does not
164
+ * fill the frame (`coverFit="contain"`, transparent PNG/WebP cut-outs).
165
+ * `'transparent'` paints nothing; `'muted'`, `'primary'`, `'secondary'` and
166
+ * `'accent'` fill with the theme token of the same name. The reserved space
167
+ * (`coverAspect`) is unaffected. String / image covers only.
168
+ * @default 'transparent'
169
+ */
170
+ coverBackground?: MediaBackground;
162
171
  /** Alt text for a string `cover`. Omit for a decorative cover. */
163
172
  coverAlt?: string;
164
173
  /**
@@ -265,6 +274,6 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
265
274
  * @param {CardProps} props - The props for the card
266
275
  * @returns {JSX.Element} The rendered card
267
276
  */
268
- declare const Card: ({ className, variant, asChild, icon, title, subtitle, content, footer, children, tooltip, onClick, onKeyDown, href, clickable, elevated, cover, coverAspect, coverFit, coverAlt, coverHover, coverEager, overlay, overlayPosition, fullOverlay, bodyBackground, style, ref, ...props }: CardProps) => import("react").JSX.Element;
277
+ declare const Card: ({ className, variant, asChild, icon, title, subtitle, content, footer, children, tooltip, onClick, onKeyDown, href, clickable, elevated, cover, coverAspect, coverFit, coverBackground, coverAlt, coverHover, coverEager, overlay, overlayPosition, fullOverlay, bodyBackground, style, ref, ...props }: CardProps) => import("react").JSX.Element;
269
278
  export default Card;
270
279
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Card/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAEd,SAAS,EACT,GAAG,EACJ,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAOvD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,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,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,QAAA,MAAM,IAAI,GAAI,ySA8BX,SAAS,gCA8HX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -124,7 +124,7 @@ export const CARD_VARIANT = SURFACE_VARIANT;
124
124
  * @param {CardProps} props - The props for the card
125
125
  * @returns {JSX.Element} The rendered card
126
126
  */
127
- const Card = ({ className, variant, asChild = false, icon, title, subtitle, content, footer, children, tooltip, onClick, onKeyDown, href, clickable, elevated, cover, coverAspect, coverFit, coverAlt, coverHover, coverEager, overlay, overlayPosition = 'top-left', fullOverlay, bodyBackground = 'transparent', style, ref, ...props }) => {
127
+ const Card = ({ className, variant, asChild = false, icon, title, subtitle, content, footer, children, tooltip, onClick, onKeyDown, href, clickable, elevated, cover, coverAspect, coverFit, coverBackground = 'transparent', coverAlt, coverHover, coverEager, overlay, overlayPosition = 'top-left', fullOverlay, bodyBackground = 'transparent', style, ref, ...props }) => {
128
128
  const Comp = asChild ? Slot : 'div';
129
129
  const variantAttrs = getVariantDataAttrs({ variant });
130
130
  const isClickable = clickable !== undefined ? clickable : !!onClick || !!href;
@@ -152,6 +152,7 @@ const Card = ({ className, variant, asChild = false, icon, title, subtitle, cont
152
152
  const hasBody = Boolean(header || hasContent || footer);
153
153
  const coverNode = renderCardCover(cover, coverAspect, hasBody, {
154
154
  fit: coverFit,
155
+ background: coverBackground,
155
156
  alt: coverAlt,
156
157
  hover: coverHover,
157
158
  eager: coverEager,
@@ -21,7 +21,7 @@ export interface StepperStep {
21
21
  content: ReactNode;
22
22
  }
23
23
  declare const stepperVariants: (props?: ({
24
- variant?: "default" | "muted" | "primary" | "secondary" | "accent" | "success" | "warning" | "destructive" | null | undefined;
24
+ variant?: "muted" | "primary" | "secondary" | "accent" | "default" | "success" | "warning" | "destructive" | null | undefined;
25
25
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
26
26
  /** Union of available Stepper variant values. */
27
27
  export type StepperVariant = VariantProps<typeof stepperVariants>['variant'];
@@ -1,14 +1,12 @@
1
1
  import type { HTMLAttributes, ReactNode } from 'react';
2
2
  import './SwipeAction.css';
3
- /** Localized, non-destructive reveal controls for a trailing destructive action. */
3
+ /** A trailing destructive action revealed by a touch swipe. */
4
4
  export interface SwipeActionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onAction'> {
5
5
  children: ReactNode;
6
6
  onAction: () => void;
7
7
  actionLabel: string;
8
- revealLabel: string;
9
- closeLabel: string;
10
8
  disabled?: boolean;
11
9
  }
12
10
  /** Native scrolling only reveals; destruction requires explicit button activation. */
13
- export default function SwipeAction({ children, onAction, actionLabel, revealLabel, closeLabel, disabled, className, onKeyDown, ...props }: SwipeActionProps): import("react").JSX.Element;
11
+ export default function SwipeAction({ children, onAction, actionLabel, disabled, className, onKeyDown, ...props }: SwipeActionProps): import("react").JSX.Element;
14
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/SwipeAction/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,mBAAmB,CAAC;AAE3B,oFAAoF;AACpF,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxF,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,sFAAsF;AACtF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,QAAgB,EAC1E,SAAS,EAAE,SAAS,EAAE,GAAG,KAAK,EAC/B,EAAE,gBAAgB,+BAyGlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/SwipeAction/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,mBAAmB,CAAC;AAE3B,+DAA+D;AAC/D,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxF,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,sFAAsF;AACtF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAgB,EACjD,SAAS,EAAE,SAAS,EAAE,GAAG,KAAK,EAC/B,EAAE,gBAAgB,+BAuFlB"}
@@ -1,22 +1,19 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Ellipsis, Trash2 } from 'lucide-react';
4
- import { useEffect, useId, useRef, useState } from 'react';
3
+ import { Trash2 } from 'lucide-react';
4
+ import { useEffect, useRef, useState } from 'react';
5
5
  import { cn } from '../../utils/helpers';
6
6
  import './SwipeAction.css';
7
7
  /** Native scrolling only reveals; destruction requires explicit button activation. */
8
- export default function SwipeAction({ children, onAction, actionLabel, revealLabel, closeLabel, disabled = false, className, onKeyDown, ...props }) {
8
+ export default function SwipeAction({ children, onAction, actionLabel, disabled = false, className, onKeyDown, ...props }) {
9
9
  const [open, setOpen] = useState(false);
10
- const actionId = useId();
11
10
  const viewport = useRef(null);
12
- const toggle = useRef(null);
13
11
  const revealed = open && !disabled;
14
12
  function reveal(next) {
15
13
  const element = viewport.current;
16
14
  if (!element)
17
15
  return;
18
- // Instant programmatic scrolling keeps the explicit trash action immediately
19
- // usable, independent of motion preferences and native snap animations.
16
+ // Instant programmatic scrolling, independent of motion preferences and native snap animations.
20
17
  element.scrollLeft = next
21
18
  ? (getComputedStyle(element).direction === 'rtl' ? -1 : 1) * (element.scrollWidth - element.clientWidth)
22
19
  : 0;
@@ -39,29 +36,27 @@ export default function SwipeAction({ children, onAction, actionLabel, revealLab
39
36
  if (disabled)
40
37
  reveal(false);
41
38
  }, [disabled]);
42
- return (_jsxs("div", { ...props, className: cn('dndev-swipe-action', className), "data-open": revealed ? '' : undefined, "data-disabled": disabled ? '' : undefined, onKeyDown: (event) => {
39
+ return (_jsx("div", { ...props, className: cn('dndev-swipe-action', className), "data-open": revealed ? '' : undefined, "data-disabled": disabled ? '' : undefined, onKeyDown: (event) => {
43
40
  onKeyDown?.(event);
44
41
  if (!event.defaultPrevented && event.key === 'Escape') {
45
42
  const element = viewport.current;
46
43
  if (revealed || (element && element.scrollLeft !== 0)) {
47
44
  event.preventDefault();
48
45
  reveal(false);
49
- toggle.current?.focus();
50
46
  }
51
47
  }
52
- }, children: [_jsxs("div", { ref: viewport, className: "dndev-swipe-action-viewport", onPointerDown: (event) => {
53
- // Native mouse selection must not turn into a drag-to-reveal. Pen
54
- // panning is excluded too; actual touch still works on hybrid devices.
55
- event.currentTarget.toggleAttribute('data-input-blocked', event.pointerType !== 'touch');
56
- }, onScroll: (event) => {
57
- const element = event.currentTarget;
58
- const end = element.scrollWidth - element.clientWidth;
59
- setOpen(!disabled && end > 0 && Math.abs(element.scrollLeft) >= end - 1);
60
- }, children: [_jsx("div", { className: "dndev-swipe-action-content", onFocusCapture: () => reveal(false), children: children }), _jsxs("button", { id: actionId, type: "button", className: "dndev-swipe-action-delete", "aria-hidden": !revealed, inert: !revealed, tabIndex: revealed ? 0 : -1, disabled: disabled || !revealed, onClick: () => {
61
- if (!revealed || disabled)
62
- return;
63
- reveal(false);
64
- toggle.current?.focus();
65
- onAction();
66
- }, children: [_jsx(Trash2, { "aria-hidden": "true", focusable: "false" }), _jsx("span", { children: actionLabel })] })] }), _jsx("button", { ref: toggle, type: "button", className: "dndev-swipe-action-toggle", "aria-label": revealed ? closeLabel : revealLabel, "aria-expanded": revealed, "aria-controls": actionId, disabled: disabled, onClick: () => reveal(!revealed), children: _jsx(Ellipsis, { "aria-hidden": "true", focusable: "false" }) })] }));
48
+ }, children: _jsxs("div", { ref: viewport, className: "dndev-swipe-action-viewport", onPointerDown: (event) => {
49
+ // Native mouse selection must not turn into a drag-to-reveal. Pen
50
+ // panning is excluded too; actual touch still works on hybrid devices.
51
+ event.currentTarget.toggleAttribute('data-input-blocked', event.pointerType !== 'touch');
52
+ }, onScroll: (event) => {
53
+ const element = event.currentTarget;
54
+ const end = element.scrollWidth - element.clientWidth;
55
+ setOpen(!disabled && end > 0 && Math.abs(element.scrollLeft) >= end - 1);
56
+ }, children: [_jsx("div", { className: "dndev-swipe-action-content", onFocusCapture: () => reveal(false), children: children }), _jsxs("button", { type: "button", className: "dndev-swipe-action-delete", "aria-hidden": !revealed, inert: !revealed, tabIndex: revealed ? 0 : -1, disabled: disabled || !revealed, onClick: () => {
57
+ if (!revealed || disabled)
58
+ return;
59
+ reveal(false);
60
+ onAction();
61
+ }, children: [_jsx(Trash2, { "aria-hidden": "true", focusable: "false" }), _jsx("span", { children: actionLabel })] })] }) }));
67
62
  }