@donotdev/components 0.3.4 → 0.3.5
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/dist/advanced/ImageGallery/ImageGallery.d.ts +16 -4
- package/dist/advanced/ImageGallery/ImageGallery.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/ImageGallery.js +1 -1
- package/dist/advanced/ImageGallery/snapStrip.d.ts +6 -0
- package/dist/advanced/ImageGallery/snapStrip.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/snapStrip.js +1 -1
- package/dist/atomic/Accordion/AccordionPrimitive.d.ts +7 -0
- package/dist/atomic/Accordion/AccordionPrimitive.d.ts.map +1 -1
- package/dist/atomic/Accordion/AccordionPrimitive.js +1 -1
- package/dist/atomic/Accordion/index.d.ts +18 -2
- package/dist/atomic/Accordion/index.d.ts.map +1 -1
- package/dist/atomic/Accordion/index.js +1 -1
- package/dist/atomic/ActionBar/index.d.ts +66 -0
- package/dist/atomic/ActionBar/index.d.ts.map +1 -0
- package/dist/atomic/ActionBar/index.js +1 -0
- package/dist/atomic/Button/IconBadge.d.ts +18 -0
- package/dist/atomic/Button/IconBadge.d.ts.map +1 -0
- package/dist/atomic/Button/IconBadge.js +1 -0
- package/dist/atomic/Button/index.d.ts +10 -7
- package/dist/atomic/Button/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.js +1 -1
- package/dist/atomic/Card/cover.d.ts +11 -3
- package/dist/atomic/Card/cover.d.ts.map +1 -1
- package/dist/atomic/Card/cover.js +1 -1
- package/dist/atomic/Card/index.d.ts +16 -1
- package/dist/atomic/Card/index.d.ts.map +1 -1
- package/dist/atomic/Card/index.js +1 -1
- package/dist/atomic/Collapsible/CollapsiblePrimitive.d.ts +6 -0
- package/dist/atomic/Collapsible/CollapsiblePrimitive.d.ts.map +1 -1
- package/dist/atomic/Collapsible/CollapsiblePrimitive.js +1 -1
- package/dist/atomic/Collapsible/index.d.ts +3 -1
- package/dist/atomic/Collapsible/index.d.ts.map +1 -1
- package/dist/atomic/Collapsible/index.js +1 -1
- package/dist/atomic/Floating/index.d.ts +67 -0
- package/dist/atomic/Floating/index.d.ts.map +1 -0
- package/dist/atomic/Floating/index.js +1 -0
- package/dist/atomic/Grid/index.d.ts +12 -0
- package/dist/atomic/Grid/index.d.ts.map +1 -1
- package/dist/atomic/Grid/index.js +1 -1
- package/dist/atomic/List/index.d.ts +10 -1
- package/dist/atomic/List/index.d.ts.map +1 -1
- package/dist/atomic/List/index.js +1 -1
- package/dist/atomic/QuantityStepper/index.d.ts +42 -4
- package/dist/atomic/QuantityStepper/index.d.ts.map +1 -1
- package/dist/atomic/QuantityStepper/index.js +1 -1
- package/dist/atomic/Section/index.d.ts +15 -1
- package/dist/atomic/Section/index.d.ts.map +1 -1
- package/dist/atomic/Section/index.js +1 -1
- package/dist/atomic/Text/index.d.ts +15 -2
- package/dist/atomic/Text/index.d.ts.map +1 -1
- package/dist/atomic/Text/index.js +2 -2
- package/dist/atomic/Tooltip/TooltipPrimitive.d.ts +5 -0
- package/dist/atomic/Tooltip/TooltipPrimitive.d.ts.map +1 -1
- package/dist/atomic/Tooltip/TooltipPrimitive.js +1 -1
- package/dist/atomic/index.d.ts +4 -2
- package/dist/atomic/index.d.ts.map +1 -1
- package/dist/atomic/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/index.css +575 -97
- package/dist/symbol-index.json +1 -1
- package/dist/utils/flights.d.ts +30 -0
- package/dist/utils/flights.d.ts.map +1 -0
- package/dist/utils/flights.js +1 -0
- package/dist/utils/flyTo.d.ts +45 -0
- package/dist/utils/flyTo.d.ts.map +1 -0
- package/dist/utils/flyTo.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/responsiveImage.d.ts +64 -9
- package/dist/utils/responsiveImage.d.ts.map +1 -1
- package/dist/utils/responsiveImage.js +1 -1
- package/guidelines/API_REFERENCE.md +5 -2
- package/guidelines/COMPONENTS.md +13 -9
- package/guidelines/QUANTITY_STEPPER.md +25 -3
- package/package.json +1 -1
- package/dist/atomic/PortalButton/index.d.ts +0 -32
- package/dist/atomic/PortalButton/index.d.ts.map +0 -1
- package/dist/atomic/PortalButton/index.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactElement } from 'react';
|
|
1
|
+
import type { ReactElement, Ref } from 'react';
|
|
2
2
|
import type { MediaBackground } from '../../types';
|
|
3
3
|
import './ImageGallery.css';
|
|
4
4
|
/** Image source data for ImageGallery. */
|
|
@@ -14,7 +14,11 @@ export type ImageFit = 'cover' | 'contain';
|
|
|
14
14
|
export interface ImageGalleryProps {
|
|
15
15
|
/** Array of images - can be objects with fullUrl/thumbUrl or plain strings */
|
|
16
16
|
images: Array<ImageData | string>;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Aspect ratio of the main image, as a CSS ratio (`'16/9'`, `'1/1'`). Kept when the
|
|
19
|
+
* viewport bounds the gallery: it then narrows (centred) instead of growing taller.
|
|
20
|
+
* @default '16/9'
|
|
21
|
+
*/
|
|
18
22
|
aspectRatio?: string;
|
|
19
23
|
/** Alt text prefix for images */
|
|
20
24
|
altPrefix?: string;
|
|
@@ -39,6 +43,11 @@ export interface ImageGalleryProps {
|
|
|
39
43
|
* @default 'transparent'
|
|
40
44
|
*/
|
|
41
45
|
background?: MediaBackground;
|
|
46
|
+
/**
|
|
47
|
+
* Ref to the `<img>` of the image in view in the main frame (it moves with the current
|
|
48
|
+
* slide), e.g. the source of a fly-to-cart ({@link flyTo}).
|
|
49
|
+
*/
|
|
50
|
+
imageRef?: Ref<HTMLImageElement>;
|
|
42
51
|
}
|
|
43
52
|
/**
|
|
44
53
|
* ImageGallery - Full-featured image gallery component
|
|
@@ -46,7 +55,10 @@ export interface ImageGalleryProps {
|
|
|
46
55
|
* Features:
|
|
47
56
|
* - Main view swipes natively (CSS scroll-snap, browser-driven scrolling)
|
|
48
57
|
* - Previous/Next buttons, keyboard navigation (← → Home End)
|
|
49
|
-
* -
|
|
58
|
+
* - One-row thumbnail strip (swipe / scroll when it overflows; the selected one stays in view)
|
|
59
|
+
* - Viewport-bounded: main image + thumbnail row never exceed the viewport height below the
|
|
60
|
+
* app header (`--header-height`) minus the page spacing (`--gap-lg` above and below); the
|
|
61
|
+
* gallery narrows and centres, keeping `aspectRatio`
|
|
50
62
|
* - Lightbox on main image click (opt out with `nobox`): the image morphs into it and
|
|
51
63
|
* back (view transition); swipe to page, swipe up/down to close, pinch / double-tap /
|
|
52
64
|
* ctrl+wheel to zoom, drag to pan with momentum and elastic edges
|
|
@@ -63,6 +75,6 @@ export interface ImageGalleryProps {
|
|
|
63
75
|
* />
|
|
64
76
|
* ```
|
|
65
77
|
*/
|
|
66
|
-
export declare function ImageGallery({ images, aspectRatio, altPrefix, onImageChange, nobox, fit, background, }: ImageGalleryProps): ReactElement;
|
|
78
|
+
export declare function ImageGallery({ images, aspectRatio, altPrefix, onImageChange, nobox, fit, background, imageRef, }: ImageGalleryProps): ReactElement;
|
|
67
79
|
export default ImageGallery;
|
|
68
80
|
//# 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;
|
|
1
|
+
{"version":3,"file":"ImageGallery.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/ImageGallery.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAA6B,YAAY,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAI1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAcnD,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;;;;OAIG;IACH,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;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAClC;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,WAAoB,EACpB,SAAmB,EACnB,aAAa,EACb,KAAK,EACL,GAAa,EACb,UAA0B,EAC1B,QAAQ,GACT,EAAE,iBAAiB,GAAG,YAAY,CAiPlC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useEffect as p,useMemo as U,useRef as M,useState as k}from"react";import{flushSync as F}from"react-dom";import $ from"../../atomic/Dialog/index.js";import{withCssVars as V}from"../../utils/cssVars.js";import{handleImageError as E}from"../../utils/imageRetry.js";import{ResponsiveImg as A}from"../../utils/responsiveImage.js";import{GalleryArrows as G}from"./GalleryArrows.js";import{LightboxViewer as K,prepareFrame as O}from"./LightboxViewer.js";import{blockContextMenu as z}from"./protectImages.js";import{arrowStep as B,isNearSlide as q,revealInStrip as J,scrollToSlide as Q,useCurrentSlide as W}from"./snapStrip.js";import{jsx as n,jsxs as N}from"react/jsx-runtime";var C="image-gallery-image";function X(){return typeof document.startViewTransition=="function"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Y(i,s){return typeof i=="string"?{full:i,thumb:i,fit:s}:{full:i.fullUrl||i.thumbUrl||"",thumb:i.thumbUrl||i.fullUrl||"",fit:i.fit??s}}function Z({images:i,aspectRatio:s="16/9",altPrefix:T="Image",onImageChange:R,nobox:m,fit:w="cover",background:L="transparent",imageRef:x}){let[b,D]=k(0),[v,u]=k(!1),c=M(null),f=M(null),_=M(null),d=U(()=>i.map(e=>Y(e,w)),[i,w]),a=d.length,y=a>1,l=Math.min(b,Math.max(a-1,0));p(()=>{a>0&&b>=a&&D(a-1)},[a,b]);let H=e=>{e!==l&&(D(e),R?.(e))},g=(e,t=!1)=>{let r=(e+a)%a;return H(r),c.current&&Q(c.current,r,t),r};W(c,a,H);let I=e=>{if(e===v)return;let t=c.current?.children[l],r=e?t:_.current;if(!X()||!(r instanceof HTMLElement)){u(e);return}r.style.viewTransitionName=C;let o=null;document.startViewTransition(async()=>{r.style.viewTransitionName="",F(()=>u(e));let h=e?_.current:t;h instanceof HTMLElement&&(e&&await O(h),h.style.viewTransitionName=C,o=h)}).finished.then(()=>{o&&(o.style.viewTransitionName="")})},S=e=>{m||e.target.closest(".image-gallery__nav")||I(!0)};p(()=>{a===0&&u(!1)},[a]),p(()=>{f.current&&J(f.current,l)},[l]),p(()=>{m&&u(!1)},[m]);let P=e=>{if(!y||v)return;let t=B(e),r;if(t!==0)r=l+t;else if(e.key==="Home")r=0;else if(e.key==="End")r=a-1;else return;e.preventDefault();let o=f.current?.children[g(r)];o instanceof HTMLElement&&o.focus()};return a===0?n("div",{className:"image-gallery image-gallery--empty",style:{aspectRatio:s},children:n("span",{className:"image-gallery__placeholder",children:"No images"})}):N("div",{className:`image-gallery${y?" image-gallery--thumbnails":""}`,style:V({"--image-gallery-ratio":s}),onKeyDown:P,onContextMenu:z,tabIndex:0,role:"region","aria-label":"Image gallery","aria-roledescription":"carousel",children:[N("div",{className:`image-gallery__main${m?"":" image-gallery__main--lightbox"}`,"data-background":L,onClick:S,children:[n("div",{ref:c,className:"image-gallery__strip",children:d.map((e,t)=>{let r=q(t,l,a)?"eager":"lazy",o=t===0?"high":void 0;return N("div",{className:"image-gallery__slide","aria-hidden":t===l?void 0:!0,children:[e.fit==="cover"&&e.full!==e.thumb&&n("img",{src:e.thumb,alt:"",className:"image-gallery__slide-img image-gallery__slide-placeholder",loading:r,fetchPriority:o,decoding:"async",draggable:!1,onError:E}),n(A,{ref:t===l?x:void 0,image:{fullUrl:e.full,thumbUrl:e.thumb},alt:`${T} ${t+1} of ${a}`,className:"image-gallery__slide-img","data-fit":e.fit,loading:r,fetchPriority:o,decoding:"async",draggable:!1,onError:E})]},t)})}),y&&n(G,{onPrev:()=>g(l-1),onNext:()=>g(l+1)})]}),y&&n("div",{ref:f,className:"image-gallery__thumbnails",role:"tablist","aria-label":"Image thumbnails",children:d.map((e,t)=>n("button",{type:"button",role:"tab","aria-selected":t===l,"aria-label":`View image ${t+1}`,className:`image-gallery__thumbnail ${t===l?"image-gallery__thumbnail--selected":""}`,onClick:()=>g(t),children:n("img",{src:e.thumb,alt:"",className:"image-gallery__thumbnail-image","data-fit":e.fit,"data-background":L,draggable:!1,onError:E})},t))}),!m&&n($,{open:v,onOpenChange:I,showClose:!0,noSwipe:!0,className:"image-gallery__lightbox",children:n(K,{images:d,index:l,onIndexChange:e=>g(e,!0),onClose:()=>I(!1),altPrefix:T,frameRef:_})})]})}var ce=Z;export{Z as ImageGallery,ce as default};
|
|
@@ -12,6 +12,12 @@ export declare function isNearSlide(index: number, current: number, count: numbe
|
|
|
12
12
|
* (the strip is the slides' offset parent).
|
|
13
13
|
*/
|
|
14
14
|
export declare function scrollToSlide(strip: HTMLElement, index: number, instant?: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* Scrolls a strip by the least amount that brings child `index` fully into view; no-op
|
|
17
|
+
* when it already is. Only the strip scrolls, never the page (unlike `scrollIntoView`).
|
|
18
|
+
* Direction-agnostic: the delta is physical (rects), as `scrollBy` expects in LTR and RTL.
|
|
19
|
+
*/
|
|
20
|
+
export declare function revealInStrip(strip: HTMLElement, index: number): void;
|
|
15
21
|
/**
|
|
16
22
|
* Logical paging step of a physical arrow key: `1` (next) or `-1` (previous), `0` for
|
|
17
23
|
* any other key. In RTL, ArrowLeft is next.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapStrip.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/snapStrip.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAGT;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,UAAQ,GACd,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,MAAM,CAI/D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACvC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAChC,IAAI,CAoBN"}
|
|
1
|
+
{"version":3,"file":"snapStrip.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/snapStrip.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAGT;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,UAAQ,GACd,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAYrE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,MAAM,CAI/D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACvC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAChC,IAAI,CAoBN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as u,useEffectEvent as a}from"react";var
|
|
1
|
+
"use client";import{useEffect as u,useEffectEvent as a}from"react";var f=.6;function b(e,r,o){let t=Math.abs(e-r);return Math.min(t,o-t)<=1}function m(e,r,o=!1){let t=e.children[r];if(!(t instanceof HTMLElement))return;let n=t.offsetLeft,i=Math.abs(n-e.scrollLeft)<=e.clientWidth+1;e.scrollTo({left:n,behavior:o||!i?"instant":"auto"})}function h(e,r){let o=e.children[r];if(!(o instanceof HTMLElement))return;let t=e.getBoundingClientRect(),n=o.getBoundingClientRect(),i=n.left<t.left?n.left-t.left:n.right>t.right?n.right-t.right:0;i!==0&&e.scrollBy({left:i,behavior:"auto"})}function v(e){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight")return 0;let r=getComputedStyle(e.currentTarget).direction==="rtl";return e.key==="ArrowRight"===r?-1:1}function E(e,r,o){let t=a(o);u(()=>{let n=e.current;if(!n||r<2)return;let i=Array.from(n.children),l=new IntersectionObserver(c=>{for(let s of c)s.intersectionRatio>=f&&t(i.indexOf(s.target))},{root:n,threshold:f});for(let c of i)l.observe(c);return()=>l.disconnect()},[e,r])}export{v as arrowStep,b as isNearSlide,h as revealInStrip,m as scrollToSlide,E as useCurrentSlide};
|
|
@@ -19,6 +19,13 @@ declare const AccordionTriggerPrimitive: ({ className, children, asChild, titleA
|
|
|
19
19
|
/** Heading element wrapping the trigger. @default 'h3' */
|
|
20
20
|
titleAs?: AccordionTitleAs;
|
|
21
21
|
}) => import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Accordion item content. Always mounted (`forceMount`): closed content stays
|
|
24
|
+
* in the server HTML (crawlable) and `.dndev-accordion-content[data-state='closed']`
|
|
25
|
+
* hides it (`display: none`: not visible, focusable or announced). Children
|
|
26
|
+
* mount (and run their effects) while closed. Opening fades in (no height
|
|
27
|
+
* slide); closing is instant.
|
|
28
|
+
*/
|
|
22
29
|
declare const AccordionContentPrimitive: ({ className, children, asChild, ...rest }: ComponentProps<typeof RadixAccordion.Content> & {
|
|
23
30
|
asChild?: boolean;
|
|
24
31
|
}) => import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionPrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/Accordion/AccordionPrimitive.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAG5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,oDAAoD;AACpD,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhE,QAAA,MAAM,kBAAkB,0KAAsB,CAAC;AAE/C,QAAA,MAAM,sBAAsB,GAAI,kCAI7B,cAAc,CAAC,OAAO,cAAc,CAAC,IA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G;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,gCAgBA,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,GAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as o from"@radix-ui/react-accordion";import{Slot as c}from"@radix-ui/react-slot";import"lucide-react";import{cn as
|
|
1
|
+
"use client";import*as o from"@radix-ui/react-accordion";import{Slot as c}from"@radix-ui/react-slot";import"lucide-react";import{cn as d}from"../../utils/helpers.js";import{jsx as e}from"react/jsx-runtime";var f=o.Root,x=({className:i,asChild:t=!1,...n})=>e(t?c:o.Item,{className:d(i),...n}),g=({className:i,children:t,asChild:n=!1,titleAs:r="h3",...a})=>e(o.Header,{asChild:!0,children:e(r,{children:e(n?c:o.Trigger,{className:d(i),"data-role":"accordion-trigger",...a,children:t})})}),h=({className:i,children:t,asChild:n=!1,...r})=>e(n?c:o.Content,{className:d("dndev-accordion-content","data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",i),...r,forceMount:n?void 0:!0,children:e("div",{className:"dndev-accordion-content-inner",children:t})});export{h as AccordionContentPrimitive,x as AccordionItemPrimitive,f as AccordionPrimitive,g as AccordionTriggerPrimitive};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { AccordionTitleAs } from './AccordionPrimitive';
|
|
3
|
+
import { type GridCols } from '../Grid';
|
|
3
4
|
/** Single item within an Accordion. */
|
|
4
5
|
export interface AccordionItemType {
|
|
5
6
|
/** The unique value for the accordion item */
|
|
@@ -35,12 +36,23 @@ export interface AccordionProps {
|
|
|
35
36
|
* @default 'h3'
|
|
36
37
|
*/
|
|
37
38
|
titleAs?: AccordionTitleAs;
|
|
39
|
+
/**
|
|
40
|
+
* Lay the items out in a responsive grid (items flow in order, cells align to
|
|
41
|
+
* the start so opening one does not stretch its row neighbour). Same type and
|
|
42
|
+
* breakpoints as `Section`'s `gridCols` / `<Grid cols>`: number, string
|
|
43
|
+
* template or a `[mobile, tablet, laptop, desktop]` tuple. Absent = one column.
|
|
44
|
+
* @example [1, 1, 2, 2] - 1 column on mobile/tablet, 2 on laptop/desktop
|
|
45
|
+
*/
|
|
46
|
+
gridCols?: GridCols;
|
|
38
47
|
/** Additional CSS classes */
|
|
39
48
|
className?: string;
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
51
|
* A vertically stacked set of interactive headings that each reveal a section of content.
|
|
43
|
-
* Built on Radix UI Accordion.
|
|
52
|
+
* Built on Radix UI Accordion. Closed items stay mounted (in the server HTML,
|
|
53
|
+
* crawlable) and are hidden with `display: none` (not visible, focusable or
|
|
54
|
+
* announced); their effects run while closed. Opening fades in (no height
|
|
55
|
+
* slide); collapsing is instant.
|
|
44
56
|
*
|
|
45
57
|
* @component
|
|
46
58
|
* @example
|
|
@@ -52,10 +64,14 @@ export interface AccordionProps {
|
|
|
52
64
|
* ]}
|
|
53
65
|
* />
|
|
54
66
|
* ```
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <Accordion items={items} gridCols={[1, 1, 2, 2]} />
|
|
70
|
+
* ```
|
|
55
71
|
* @param {AccordionProps} props - The props for the accordion
|
|
56
72
|
* @returns {JSX.Element} The rendered accordion
|
|
57
73
|
*/
|
|
58
|
-
declare const Accordion: ({ type, collapsible, defaultValue, value, onValueChange, items, titleAs, className, }: AccordionProps) => import("react").JSX.Element;
|
|
74
|
+
declare const Accordion: ({ type, collapsible, defaultValue, value, onValueChange, items, titleAs, gridCols, className, }: AccordionProps) => import("react").JSX.Element;
|
|
59
75
|
export default Accordion;
|
|
60
76
|
export type { AccordionTitleAs };
|
|
61
77
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Accordion/index.tsx"],"names":[],"mappings":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AACH,QAAA,MAAM,SAAS,GAAI,iGAUhB,cAAc,gCAoFhB,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{ChevronDown as
|
|
1
|
+
"use client";import{ChevronDown as v}from"lucide-react";import{AccordionPrimitive as m,AccordionItemPrimitive as g,AccordionTriggerPrimitive as p,AccordionContentPrimitive as u}from"./AccordionPrimitive.js";import{cn as C}from"../../utils/helpers.js";import{getGridColsProps as T}from"../Grid/index.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var h=({type:A="single",collapsible:f=!1,defaultValue:r,value:t,onValueChange:d,items:c,titleAs:a="h3",gridCols:o,className:N})=>{let s=o?(()=>{let{style:e,responsive:P,responsiveTpl:y}=T(o);return{style:{display:"grid",width:"100%",...e},"data-gap":"medium","data-align":"start","data-responsive":P?"true":void 0,"data-responsive-tpl":y?"true":void 0}})():void 0,l=C("dndev-accordion",o&&"dndev-grid-component",N);return A==="multiple"?i(m,{type:"multiple",defaultValue:r,value:t,onValueChange:d,className:l,...s,children:c.map(e=>n(g,{value:e.value,className:"dndev-accordion-item",children:[n(p,{titleAs:a,className:"dndev-interactive dndev-accordion-header",children:[e.trigger,i(v,{className:"dndev-accordion-trigger-icon"})]}),i(u,{className:"dndev-accordion-content",children:i("div",{className:"dndev-accordion-content-inner",children:e.content})})]},e.value))}):i(m,{type:"single",collapsible:f,defaultValue:r,value:t,onValueChange:d,className:l,...s,children:c.map(e=>n(g,{value:e.value,className:"dndev-accordion-item",children:[n(p,{titleAs:a,className:"dndev-interactive dndev-accordion-header",children:[e.trigger,i(v,{className:"dndev-accordion-trigger-icon"})]}),i(u,{className:"dndev-accordion-content",children:i("div",{className:"dndev-accordion-content-inner",children:e.content})})]},e.value))})},G=h;export{G as default};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
2
|
+
import './ActionBar.css';
|
|
3
|
+
/**
|
|
4
|
+
* Breakpoint from which ActionBar is not shown (framework breakpoints: tablet >= 768px,
|
|
5
|
+
* laptop >= 1024px, desktop >= 1440px). `mobile` is excluded: it would never show.
|
|
6
|
+
*/
|
|
7
|
+
export type ActionBarBreakpoint = 'tablet' | 'laptop' | 'desktop';
|
|
8
|
+
/** Props for ActionBar. Other div attributes (`aria-label`, `role`, `id`, ...) go to the bar. */
|
|
9
|
+
export interface ActionBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/** Bar content, composed by the app (Stack, Text, Button, QuantityStepper...). */
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Breakpoint from which the bar is not shown (CSS media query, no JS).
|
|
14
|
+
* @example 'laptop' - phones and tablets only
|
|
15
|
+
* @default undefined - shown at every width
|
|
16
|
+
*/
|
|
17
|
+
hideFrom?: ActionBarBreakpoint;
|
|
18
|
+
/**
|
|
19
|
+
* Ref to a reference element (e.g. the buy card). The bar shows only while that element
|
|
20
|
+
* has scrolled up out of view (above the visible area), and hides while any part of it is
|
|
21
|
+
* visible or while it is still below the visible area (not reached yet).
|
|
22
|
+
* The element must be mounted when ActionBar mounts.
|
|
23
|
+
* @default undefined - always shown
|
|
24
|
+
*/
|
|
25
|
+
revealAfter?: RefObject<Element | null>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Bar fixed to the bottom of the viewport, portalled to `<body>` (a `contain: layout` or
|
|
29
|
+
* scrolling ancestor such as the layout `<main>` would otherwise capture `position: fixed`).
|
|
30
|
+
*
|
|
31
|
+
* - Reserved space: while shown, its measured height (ResizeObserver) is set as
|
|
32
|
+
* `--action-bar-height` on `<html>`, removed when it hides, unmounts or is `display: none`
|
|
33
|
+
* (`hideFrom`). DnDevLayout pads its bottom with it, so the end of the page and the footer
|
|
34
|
+
* scroll above the bar instead of under it; content above the reading position does not
|
|
35
|
+
* move. A custom scroll container outside DnDevLayout reserves it the same way:
|
|
36
|
+
* `padding-block-end: var(--action-bar-height, 0px)`. Above page chrome (`--z-header`),
|
|
37
|
+
* below sheets, modals, floating menus and toasts. Bottom safe area (iOS home indicator)
|
|
38
|
+
* is padded when the app sets `viewport-fit=cover`.
|
|
39
|
+
* - One shown bar per page: bars share the bottom edge and the reserved-space property.
|
|
40
|
+
* - SSR: renders nothing on the server and on the hydration render (no mismatch, property
|
|
41
|
+
* absent); mounts after hydration, hidden when `revealAfter` is set (nothing reserved at
|
|
42
|
+
* load, no layout shift).
|
|
43
|
+
* - Hidden state: slid below the viewport, `visibility: hidden`, `inert` and `aria-hidden`
|
|
44
|
+
* (not focusable, not announced). The slide is off under `prefers-reduced-motion`.
|
|
45
|
+
* - Not a landmark by default: pass `role="region"` and a translated `aria-label` to make it one.
|
|
46
|
+
*
|
|
47
|
+
* Visibility uses one IntersectionObserver: it reacts when the reference element enters or
|
|
48
|
+
* leaves the visible area, so an instant jump from "scrolled past" to "not reached yet" with no
|
|
49
|
+
* frame where the element is visible keeps the bar shown until the element next crosses an edge.
|
|
50
|
+
*
|
|
51
|
+
* @component
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const buyCard = useRef<HTMLDivElement>(null);
|
|
55
|
+
* <Card ref={buyCard}>...</Card>
|
|
56
|
+
* <ActionBar hideFrom="laptop" revealAfter={buyCard}>
|
|
57
|
+
* <Stack direction="row" align="center" justify="between">
|
|
58
|
+
* <Text weight="bold">{price}</Text>
|
|
59
|
+
* <Button onClick={add}>{t('cart.add')}</Button>
|
|
60
|
+
* </Stack>
|
|
61
|
+
* </ActionBar>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare function ActionBar({ children, hideFrom, revealAfter, className, ...props }: ActionBarProps): import("react").JSX.Element;
|
|
65
|
+
export default ActionBar;
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/ActionBar/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlE,OAAO,iBAAiB,CAAC;AAKzB;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElE,iGAAiG;AACjG,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,cAAc,CAAC;IACpE,kFAAkF;IAClF,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,iBAAS,SAAS,CAAC,EACjB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,+BA2DhB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useEffect as a,useState as d}from"react";import{cn as h}from"../../utils/helpers.js";import{PortalPrimitive as v}from"../Portal/PortalPrimitive.js";import{jsx as u}from"react/jsx-runtime";var c="--action-bar-height";function P({children:l,hideFrom:m,revealAfter:o,className:p,...f}){let[r,s]=d(!o),[i,b]=d(null);return a(()=>{if(!o){s(!0);return}s(!1);let e=o.current;if(!e)return;let n=new IntersectionObserver(([t])=>{t&&s(!t.isIntersecting&&t.boundingClientRect.bottom<window.innerHeight/2)});return n.observe(e),()=>n.disconnect()},[o]),a(()=>{if(!r||!i)return;let e=document.documentElement.style,n=new ResizeObserver(()=>{let t=i.offsetHeight;t?e.setProperty(c,`${t}px`):e.removeProperty(c)});return n.observe(i),()=>{n.disconnect(),e.removeProperty(c)}},[r,i]),u(v,{asChild:!0,children:u("div",{...f,ref:b,className:h("dndev-action-bar",p),"data-hide-from":m,"data-open":r?"":void 0,"aria-hidden":r?void 0:!0,inert:!r,children:l})})}var R=P;export{R as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import Icon from '../Icons/Icon';
|
|
3
|
+
/**
|
|
4
|
+
* Icon of a Button with `badge`, and the count bubble on its corner unless the shown value
|
|
5
|
+
* is `0` or empty. A numeric increase pops the bubble (0 → 1 too); the first render (server
|
|
6
|
+
* or hydration), a decrease or a text value never does.
|
|
7
|
+
*
|
|
8
|
+
* Increase while a {@link flyTo} flight heads to the button (its target contains this
|
|
9
|
+
* icon): the previous value stays shown (no bubble if it was 0) until the flight ends;
|
|
10
|
+
* landed → the latest badge value, with the pop; cancelled → the latest value, no pop.
|
|
11
|
+
* Several flights: each landing shows the latest value and pops. Without a flight the value
|
|
12
|
+
* shows (and pops) at once. The anchor is always rendered, so a flight can be found at 0.
|
|
13
|
+
*/
|
|
14
|
+
export default function IconBadge({ icon, badge }: {
|
|
15
|
+
icon: ComponentProps<typeof Icon>['icon'];
|
|
16
|
+
badge: number | string;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=IconBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconBadge.d.ts","sourceRoot":"","sources":["../../../src/atomic/Button/IconBadge.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,IAAI,MAAM,eAAe,CAAC;AAoBjC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,+BA+CvH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useEffect as v,useLayoutEffect as l,useRef as c,useState as h}from"react";import y from"../Icons/Icon.js";import{landing as M}from"../../utils/flights.js";import{jsx as p,jsxs as N}from"react/jsx-runtime";var S=[{transform:"scale(1)"},{transform:"scale(1.35)",offset:.4},{transform:"scale(1)"}],w={duration:320,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)"},m=e=>typeof e=="number"?e:e.trim()===""?NaN:Number(e);function E({icon:e,badge:n}){let a=c(null),s=c(null),o=c(n),u=c(!1),[r,i]=h({value:n,pop:!1});return v(()=>(u.current=!0,()=>{u.current=!1}),[]),l(()=>{if(n===o.current)return;let t=m(n)>m(o.current);o.current=n;let f=t&&a.current?M(a.current):null;if(!f){i({value:n,pop:t});return}f.then(d=>{u.current&&i({value:o.current,pop:d==="landed"})})},[n]),l(()=>{let t=s.current;!r.pop||!t||typeof t.animate!="function"||window.matchMedia("(prefers-reduced-motion: reduce)").matches||t.animate(S,w)},[r]),N("span",{ref:a,className:"dndev-interactive-icon-anchor",children:[p(y,{icon:e}),r.value!==0&&r.value!==""&&p("span",{ref:s,className:"dndev-interactive-badge","aria-hidden":"true",children:r.value})]})}export{E as default};
|
|
@@ -66,7 +66,6 @@ export interface ButtonRenderProps {
|
|
|
66
66
|
'aria-describedby'?: string;
|
|
67
67
|
'data-variant'?: string;
|
|
68
68
|
'data-display'?: string;
|
|
69
|
-
'data-floating'?: string;
|
|
70
69
|
'data-full-width'?: string;
|
|
71
70
|
role?: string;
|
|
72
71
|
tabIndex?: number;
|
|
@@ -115,17 +114,19 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, Va
|
|
|
115
114
|
/**
|
|
116
115
|
* Count bubble on the icon's corner (cart items, notifications). Rendered only with an
|
|
117
116
|
* icon; `0`, empty or undefined hides it. Decorative: put the count in `aria-label`.
|
|
117
|
+
* When a numeric value increases after mount (including 0 → 1), the bubble plays a short
|
|
118
|
+
* pop (scale, Web Animations API, compositor-only, no layout shift); never on the first
|
|
119
|
+
* render or hydration, on a decrease or a non-numeric value ("99+"), nor under
|
|
120
|
+
* `prefers-reduced-motion: reduce`. While a `flyTo` flight heads to this button (e.g.
|
|
121
|
+
* `ref={flyTarget('cart')}`), an increase waits for it: the previous value stays shown
|
|
122
|
+
* until the image lands, then the new value shows and pops; a cancelled flight shows it
|
|
123
|
+
* without a pop.
|
|
118
124
|
*/
|
|
119
125
|
badge?: number | string;
|
|
120
126
|
/** Tooltip text to show on hover */
|
|
121
127
|
tooltip?: string;
|
|
122
128
|
/** Force tooltip to stay open (e.g., after copy action) */
|
|
123
129
|
tooltipForceOpen?: boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Whether the button floats (e.g., FAB).
|
|
126
|
-
* @default false
|
|
127
|
-
*/
|
|
128
|
-
floating?: boolean;
|
|
129
130
|
/**
|
|
130
131
|
* Whether the button takes full width of container.
|
|
131
132
|
* @default false
|
|
@@ -133,7 +134,9 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, Va
|
|
|
133
134
|
fullWidth?: boolean;
|
|
134
135
|
/**
|
|
135
136
|
* Whether the button is in a loading state.
|
|
136
|
-
*
|
|
137
|
+
* The spinner replaces the icon and the button is disabled, with the disabled look:
|
|
138
|
+
* muted background (filled variants) or transparent (ghost, link, outline,
|
|
139
|
+
* destructive), label and spinner in `--muted-foreground`, no fade.
|
|
137
140
|
* @default false
|
|
138
141
|
*/
|
|
139
142
|
loading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Button/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,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Z,Trash as j,Trash2 as tt,Upload as et,X as nt}from"lucide-react";import{forwardRef as rt}from"react";import{DISPLAY as f}from"../../styles/componentConstants.js";import{THEME_VARIANT as t}from"../../utils/constants.js";import{cn as ot,getVariantDataAttrs as at}from"../../utils/helpers.js";import it from"../Icons/Icon.js";import st from"../Spinner/index.js";import h from"../Tooltip/index.js";import dt from"./IconBadge.js";import{Fragment as L,jsx as e,jsxs as b}from"react/jsx-runtime";var T={...t,GHOST:"ghost",OUTLINE:"outline",LINK:"link"},pt=X("dndev-interactive dndev-button",{variants:{variant:{[t.DEFAULT]:"",[t.MUTED]:"",[t.PRIMARY]:"",[t.SECONDARY]:"",[t.ACCENT]:"",[t.SUCCESS]:"",[t.WARNING]:"",[t.DESTRUCTIVE]:"",[T.GHOST]:"",[T.OUTLINE]:"",[T.LINK]:""}},defaultVariants:{variant:t.DEFAULT}}),ct={SAVE:"save",PUBLISH:"publish",UNPUBLISH:"unpublish",REMOVE:"remove",DELETE:"delete",PREVIEW:"preview",RELOAD:"reload",ADD:"add",EDIT:"edit",CANCEL:"cancel"},lt={save:Z,publish:et,unpublish:q,remove:j,delete:tt,preview:$,reload:Q,add:J,edit:z,cancel:nt},R=rt(({className:D,variant:C,intent:i,render:m,display:U=f.AUTO,icon:O,iconEnd:y=!1,badge:E,children:x,tooltip:s,tooltipForceOpen:N,fullWidth:S=!1,loading:o=!1,loadingText:V,progress:d,disabled:k,"aria-label":v,"aria-describedby":M,...I},w)=>{let a=O??(i?lt[i]:void 0),p=C??(i===ct.DELETE?t.DESTRUCTIVE:void 0),n=x,H=!!a,c=!!n,r=U,l=k||o,_=o&&d!==void 0&&d<100,W=o?V??n:n,A=E!==void 0?e(dt,{icon:a,badge:E}):e(it,{icon:a}),g=o?b(L,{children:[_?e("span",{className:"dndev-button-progress","aria-hidden":"true",children:b("svg",{viewBox:"0 0 20 20",className:"dndev-progress-ring",children:[e("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2",opacity:"0.2"}),e("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:`${d/100*50.27} 50.27`,strokeLinecap:"round",transform:"rotate(-90 10 10)"})]})}):e(st,{className:"dndev-button-spinner","aria-hidden":"true"}),c&&e("span",{className:"dndev-interactive-label","data-display":r,children:W})]}):b(L,{children:[a&&!y&&A,c&&e("span",{className:"dndev-interactive-label","data-display":r,children:n}),a&&y&&A]}),B=()=>v||(typeof n=="string"?n:typeof n=="number"?String(n):H&&!c?"Button":void 0),Y=p===t.DEFAULT?t.PRIMARY:p,F=at({variant:Y}),G=I.type||"button",{type:ut,...K}=I,P={children:g,className:ot(pt({variant:p,className:D}),"touch-manipulation"),"aria-label":B(),"aria-describedby":M,...F,...S&&{"data-full-width":"true"},...r&&{"data-display":r},...o&&{"data-loading":"true","aria-busy":"true"},...K},u=m?m(P):e("button",{ref:w,type:G,role:"button",tabIndex:l?-1:0,disabled:l,"aria-disabled":l||void 0,...P,children:g});return r===f.COMPACT||r===f.AUTO?e(h,{content:s||B()||"Button",forceOpen:N,children:u}):s?e(h,{content:s,forceOpen:N,children:u}):u});R.displayName="Button";var gt=R;export{ct as BUTTON_INTENT,T as BUTTON_VARIANT,pt as buttonVariants,gt as default};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @fileoverview Card cover region
|
|
3
3
|
* @description Cover media for Card: fit, alt, hover view and loading priority.
|
|
4
4
|
*/
|
|
5
|
-
import type { CSSProperties, ReactNode } from 'react';
|
|
5
|
+
import type { CSSProperties, ReactNode, Ref } from 'react';
|
|
6
6
|
import type { MediaBackground } from '../../types';
|
|
7
|
-
import type { ResponsiveImage } from '../../utils/responsiveImage';
|
|
7
|
+
import type { ImageRenditions, ResponsiveImage } from '../../utils/responsiveImage';
|
|
8
8
|
/** An image cover: a URL, or a full + thumbnail pair (CRUD `Picture`). */
|
|
9
9
|
export type CardCoverImage = string | ResponsiveImage;
|
|
10
10
|
/**
|
|
@@ -21,10 +21,17 @@ export interface CardCoverMedia {
|
|
|
21
21
|
fit?: 'cover' | 'contain';
|
|
22
22
|
/** Alt text. Empty (default) marks the cover as decorative. */
|
|
23
23
|
alt?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Size-based rendition picking for the cover and hover image (see
|
|
26
|
+
* {@link ImageRenditions}).
|
|
27
|
+
*/
|
|
28
|
+
renditions?: ImageRenditions;
|
|
24
29
|
/** Second image revealed on hover / focus-within (always `fit: cover`). */
|
|
25
30
|
hover?: CardCoverImage;
|
|
26
31
|
/** Load eagerly with high fetch priority (above-the-fold covers). @default false */
|
|
27
32
|
eager?: boolean;
|
|
33
|
+
/** Ref to the image `<img>` (not the hover view), e.g. a {@link flyTo} source. */
|
|
34
|
+
imageRef?: Ref<HTMLImageElement>;
|
|
28
35
|
/**
|
|
29
36
|
* Opt-in background behind the media. `'transparent'` paints nothing.
|
|
30
37
|
* @default 'transparent'
|
|
@@ -44,7 +51,8 @@ export interface CardCoverMedia {
|
|
|
44
51
|
* `loading="lazy"`, `decoding="async"`, `referrerpolicy="no-referrer"`;
|
|
45
52
|
* `media` sets fit, alt (decorative by default), a hover view and eager
|
|
46
53
|
* loading. An image pair shows the thumbnail on phones, the full image above
|
|
47
|
-
* ({@link ResponsiveImg})
|
|
54
|
+
* ({@link ResponsiveImg}); with `renditions` the browser picks by
|
|
55
|
+
* displayed size instead.
|
|
48
56
|
* - `ReactNode` cover → passthrough; child `<img>`/`<video>` auto-fill via CSS.
|
|
49
57
|
*
|
|
50
58
|
* Overlay is absolutely positioned over the cover AND over the body slot,
|
|
@@ -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;
|
|
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,GAAG,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEpF,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;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,oFAAoF;IACpF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAOD;;;;;;;;;;;;;;;;;;;GAmBG;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,CA4DX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isResponsiveImage as p,ResponsiveImg as
|
|
1
|
+
import{isResponsiveImage as p,ResponsiveImg as d}from"../../utils/responsiveImage.js";import{jsx as o,jsxs as u}from"react/jsx-runtime";function s(e){return typeof e=="string"?{fullUrl:e}:e}function R(e,g,n,c={}){if(!e)return null;let r=typeof e=="string"||p(e)?e:null,{fit:f="cover",alt:l="",hover:a,eager:i=!1,background:m="transparent",imageRef:v,renditions:t}=c;return u("div",{className:"dndev-card-cover","data-has-body":n?"true":void 0,"data-fit":f,"data-background":m,"data-has-hover":r&&a?"true":void 0,style:n?{aspectRatio:g??"4 / 5"}:{},children:[r?o(d,{ref:v,renditions:t,image:s(r),alt:l,loading:i?"eager":"lazy",fetchPriority:i?"high":void 0,decoding:"async",referrerPolicy:"no-referrer"}):o("div",{className:"dndev-card-cover-media",children:e}),r&&a&&o(d,{className:"dndev-card-cover-hover",renditions:t,image:s(a),alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"})]})}export{R as renderCardCover};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import type { VariantProps } from 'class-variance-authority';
|
|
10
10
|
import type { CSSProperties, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
11
11
|
import type { IconType, MediaBackground } from '../../types';
|
|
12
|
+
import type { ImageRenditions } from '../../utils/responsiveImage';
|
|
12
13
|
import { surfaceVariants } from '../../utils/variants';
|
|
13
14
|
import type { CardCoverImage, CardCoverMedia } from './cover';
|
|
14
15
|
export { renderCardCover } from './cover';
|
|
@@ -185,12 +186,26 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
185
186
|
* e.g. a lifestyle shot behind a packshot.
|
|
186
187
|
*/
|
|
187
188
|
coverHover?: CardCoverImage;
|
|
189
|
+
/**
|
|
190
|
+
* Pick the rendition of a {@link CardCoverImage} pair cover by displayed size
|
|
191
|
+
* x pixel ratio (`srcset` + `sizes`) instead of by viewport. Takes the frame
|
|
192
|
+
* widths of the image field's upload config and the `sizes` string (see
|
|
193
|
+
* {@link ImageRenditions}; declared, not measured). Applies to the cover and
|
|
194
|
+
* `coverHover`. Absent: unchanged (thumbnail on phones, full above).
|
|
195
|
+
*/
|
|
196
|
+
coverRenditions?: ImageRenditions;
|
|
188
197
|
/**
|
|
189
198
|
* Load a string `cover` eagerly with high fetch priority. Set on above-the-fold
|
|
190
199
|
* cards only (hero tiles, first row); others stay lazy.
|
|
191
200
|
* @default false
|
|
192
201
|
*/
|
|
193
202
|
coverEager?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Ref to the `<img>` of an image `cover` (string or {@link CardCoverImage} pair; not the
|
|
205
|
+
* `coverHover` view, not a ReactNode cover), e.g. the source of a fly-to-cart
|
|
206
|
+
* ({@link flyTo}) fired from a control in the card's footer.
|
|
207
|
+
*/
|
|
208
|
+
coverRef?: Ref<HTMLImageElement>;
|
|
194
209
|
/**
|
|
195
210
|
* Optional content absolutely positioned on top of the cover.
|
|
196
211
|
* Anchored by `overlayPosition` with theme-token inset. Overlay sits above
|
|
@@ -284,6 +299,6 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
284
299
|
* @param {CardProps} props - The props for the card
|
|
285
300
|
* @returns {JSX.Element} The rendered card
|
|
286
301
|
*/
|
|
287
|
-
declare const Card: ({ className, variant, asChild, icon, title, subtitle, titleAs, 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;
|
|
302
|
+
declare const Card: ({ className, variant, asChild, icon, title, subtitle, titleAs, content, footer, children, tooltip, onClick, onKeyDown, href, clickable, elevated, cover, coverAspect, coverFit, coverBackground, coverAlt, coverHover, coverEager, coverRef, coverRenditions, overlay, overlayPosition, fullOverlay, bodyBackground, style, ref, ...props }: CardProps) => import("react").JSX.Element;
|
|
288
303
|
export default Card;
|
|
289
304
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Card/index.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC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B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACnC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IACjC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACjC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;IACzC,sCAAsC;IACtC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,QAAA,MAAM,IAAI,GAAI,6UAiCX,SAAS,gCAiIX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{SURFACE_VARIANT as
|
|
1
|
+
"use client";import{SURFACE_VARIANT as $}from"../../utils/constants.js";import{cn as H,getVariantDataAttrs as j}from"../../utils/helpers.js";import{useLinkRenderer as ee}from"../../utils/linkComponent.js";import{surfaceVariants as V}from"../../utils/variants.js";import E from"../Icons/Icon.js";import re from"../List/index.js";import te from"../Slot/index.js";import ae from"../Stack/index.js";import i from"../Text/index.js";import{renderCardCover as oe}from"./cover.js";import{renderCardCover as xe}from"./cover.js";import{jsx as r,jsxs as s}from"react/jsx-runtime";function de(e){return e?typeof e=="string"?r(i,{as:"p",level:"small",children:e}):Array.isArray(e)?e.length===1&&typeof e[0]=="string"?r(i,{as:"p",level:"small",children:e[0]}):r(re,{items:e,gap:"tight",style:{listStyle:"none",paddingInlineStart:0}}):e:null}function ne(e,t,o,l="div"){return!e&&!t&&!o?null:s("div",{className:"dndev-card-header",children:[e&&t?s(ae,{direction:"row",align:"center",gap:"tight",children:[r(E,{icon:e,ariaHidden:!0}),r(i,{as:l,level:"h3",className:"dndev-card-title",children:t})]}):t?r(i,{as:l,level:"h3",className:"dndev-card-title",children:t}):e?r(E,{icon:e,ariaHidden:!0}):null,o&&r(i,{as:"div",level:"h4",className:"dndev-card-subtitle",children:o})]})}var he=$,ie=({className:e,variant:t,asChild:o=!1,icon:l,title:c,subtitle:D,titleAs:w,content:K,footer:f,children:u,tooltip:N,onClick:d,onKeyDown:R,href:p,clickable:h,elevated:b,cover:m,coverAspect:T,coverFit:O,coverBackground:F="transparent",coverAlt:_,coverHover:U,coverEager:q,coverRef:z,coverRenditions:G,overlay:C,overlayPosition:J="top-left",fullOverlay:y,bodyBackground:Q="transparent",style:W,ref:k,...g})=>{let x=o?te:"div",X=j({variant:t}),Y=h!==void 0?h:!!d||!!p,A=ee(),n=!!p&&!o,I=!!d&&!n?{role:"button",tabIndex:0,onKeyDown:a=>{R?.(a),!(a.defaultPrevented||!d)&&a.target===a.currentTarget&&(a.key==="Enter"||a.key===" ")&&(a.key===" "&&a.preventDefault(),d())}}:{onKeyDown:R},S=ne(l,n&&c?r(A,{href:p,className:"dndev-card-link",children:c}):c,D,w),P=de(K),L=!!(P||u),v=!!(S||L||f),Z=oe(m,T,v,{fit:O,background:F,alt:_,hover:U,eager:q,imageRef:z,renditions:G}),M={...X,"data-role":"card",...b!==void 0&&{"data-elevated":b?"true":"false"},...Y&&{"data-clickable":"true"},...n&&{"data-has-link":"true"},...m!==void 0&&{"data-has-cover":"true"},...m!==void 0&&!v&&{"data-cover-only":"true"},...C!==void 0&&{"data-overlay-position":J},...y!==void 0&&{"data-has-full-overlay":"true"}},B={width:"100%",...!!m&&!v?{aspectRatio:T??"4 / 5"}:{height:"100%"},...W};return o?r(x,{ref:k,className:H("dndev-card",V({variant:t}),e),style:B,...M,onClick:d,...I,title:N,...g,children:u}):s(x,{ref:k,className:H("dndev-card",V({variant:t}),e),style:B,...M,onClick:n?void 0:d,...I,title:N,...g,children:[n&&!c&&r(A,{href:p,className:"dndev-card-link","aria-label":g["aria-label"]}),Z,y&&r("div",{className:"dndev-card-full-overlay",children:y}),C&&r("div",{className:"dndev-card-overlay",children:C}),v&&s("div",{className:"dndev-card-body","data-body-background":Q,children:[S,L&&s("div",{className:"dndev-card-content",children:[P,u]}),f&&r("div",{className:"dndev-card-footer",children:f})]})]})},be=ie;export{he as CARD_VARIANT,be as default,de as renderCardContent,xe as renderCardCover,ne as renderCardHeader};
|
|
@@ -13,6 +13,12 @@ declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<Radi
|
|
|
13
13
|
/**
|
|
14
14
|
* The content wrapper for Collapsible.
|
|
15
15
|
*
|
|
16
|
+
* Always mounted (`forceMount`): closed content stays in the server HTML
|
|
17
|
+
* (crawlable). The wrapper always sets the `dndev-collapsible-content` class,
|
|
18
|
+
* whose CSS hides closed content (`[data-state='closed'] { display: none }`),
|
|
19
|
+
* so it is not visible, focusable or announced. Children mount (and run their
|
|
20
|
+
* effects) while closed. Opening fades in (no height slide); closing is instant.
|
|
21
|
+
*
|
|
16
22
|
* @component
|
|
17
23
|
* @param {ComponentProps<typeof RadixCollapsible.CollapsibleContent>} props
|
|
18
24
|
* @returns {JSX.Element}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsiblePrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/Collapsible/CollapsiblePrimitive.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,gBAAgB,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,QAAA,MAAM,oBAAoB,8HAAwB,CAAC;AACnD,QAAA,MAAM,kBAAkB,wIAAsC,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"CollapsiblePrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/Collapsible/CollapsiblePrimitive.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,gBAAgB,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,QAAA,MAAM,oBAAoB,8HAAwB,CAAC;AACnD,QAAA,MAAM,kBAAkB,wIAAsC,CAAC;AAE/D;;;;;;;;;;;;GAYG;AAEH,QAAA,MAAM,kBAAkB,GAAI,yBAGzB,cAAc,CAAC,OAAO,gBAAgB,CAAC,kBAAkB,CAAC,gCAQ5D,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as l from"@radix-ui/react-collapsible";import{cn as i}from"../../utils/helpers.js";import{jsx as
|
|
1
|
+
"use client";import*as l from"@radix-ui/react-collapsible";import{cn as i}from"../../utils/helpers.js";import{jsx as t}from"react/jsx-runtime";var a=l.Root,s=l.CollapsibleTrigger,n=({className:o,...e})=>t(l.CollapsibleContent,{className:i("dndev-collapsible-content",o),...e,forceMount:!0});export{n as CollapsibleContent,a as CollapsiblePrimitive,s as CollapsibleTrigger};
|
|
@@ -35,7 +35,9 @@ export interface CollapsibleProps {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Accessible collapsible component.
|
|
38
|
-
*
|
|
38
|
+
* Fades in on open (no height slide); collapses instantly. Closed content stays
|
|
39
|
+
* mounted (in the server HTML, crawlable) and is hidden with `display: none`
|
|
40
|
+
* (not visible, focusable or announced); its effects run while closed.
|
|
39
41
|
*
|
|
40
42
|
* @component
|
|
41
43
|
* @example
|