@donotdev/components 0.1.45 → 0.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/dist/CodeContent-7KN6DQT2.js +2 -0
- package/dist/advanced/ImageGallery/ImageGallery.d.ts +10 -1
- package/dist/advanced/ImageGallery/ImageGallery.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/ImageGallery.js +14 -7
- package/dist/advanced/ImageGallery/index.d.ts +1 -1
- package/dist/advanced/ImageGallery/index.d.ts.map +1 -1
- package/dist/advanced/index.d.ts +1 -1
- package/dist/advanced/index.d.ts.map +1 -1
- package/dist/atomic/Badge/index.d.ts +1 -1
- package/dist/atomic/Badge/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.d.ts +5 -0
- package/dist/atomic/Button/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.js +5 -2
- package/dist/atomic/CallToAction/index.d.ts +1 -1
- package/dist/atomic/CallToAction/index.d.ts.map +1 -1
- package/dist/atomic/Card/cover.d.ts +42 -0
- package/dist/atomic/Card/cover.d.ts.map +1 -0
- package/dist/atomic/Card/cover.js +33 -0
- package/dist/atomic/Card/index.d.ts +23 -18
- package/dist/atomic/Card/index.d.ts.map +1 -1
- package/dist/atomic/Card/index.js +9 -29
- package/dist/atomic/Grid/GridArea.d.ts +1 -1
- package/dist/atomic/Grid/GridArea.d.ts.map +1 -1
- package/dist/atomic/Grid/index.d.ts +2 -2
- package/dist/atomic/Grid/index.d.ts.map +1 -1
- package/dist/atomic/HeroSection/index.d.ts +46 -1
- package/dist/atomic/HeroSection/index.d.ts.map +1 -1
- package/dist/atomic/HeroSection/index.js +44 -6
- package/dist/atomic/QuantityStepper/index.d.ts +52 -0
- package/dist/atomic/QuantityStepper/index.d.ts.map +1 -0
- package/dist/atomic/QuantityStepper/index.js +36 -0
- package/dist/atomic/Section/index.d.ts +1 -1
- package/dist/atomic/Section/index.d.ts.map +1 -1
- package/dist/atomic/Sheet/index.d.ts +7 -1
- package/dist/atomic/Sheet/index.d.ts.map +1 -1
- package/dist/atomic/Sheet/index.js +2 -2
- package/dist/atomic/Stack/index.d.ts +1 -1
- package/dist/atomic/Stack/index.d.ts.map +1 -1
- package/dist/atomic/Text/index.d.ts +1 -1
- package/dist/atomic/Text/index.d.ts.map +1 -1
- package/dist/atomic/index.d.ts +10 -8
- package/dist/atomic/index.d.ts.map +1 -1
- package/dist/atomic/index.js +1 -0
- package/dist/chunk-E7SJFHOC.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/styles/index.css +173 -13
- package/dist/symbol-index.json +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/sanitizeHtml.d.ts +21 -0
- package/dist/utils/sanitizeHtml.d.ts.map +1 -0
- package/dist/utils/sanitizeHtml.js +42 -0
- package/package.json +34 -33
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as l,w as S,x as w,z as T}from"./chunk-E7SJFHOC.js";import{k as d}from"./chunk-EOCKFSHC.js";import"./chunk-O2XFH626.js";import{useEffect as H,useMemo as V,useState as m}from"react";import{jsx as e,jsxs as n}from"react/jsx-runtime";function O({children:i,language:p="tsx",className:P,showLineNumbers:x=!0,wrapLines:f=!1,showCopyButton:E=!0,onCopy:L,compact:h=!1}){let[r,_]=m(!1),[c,D]=m(null),[v,N]=m(!0),[k,A]=m(!1),y=T(),s=i.trim().split(`
|
|
2
|
+
`);H(()=>{if(!r)return;let t=!0;return(async()=>{try{let[{createHighlighterCore:a},{createJavaScriptRegexEngine:b},...C]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript"),import("shiki/themes/github-dark.mjs"),import("shiki/themes/github-light.mjs"),import("shiki/langs/typescript.mjs"),import("shiki/langs/tsx.mjs"),import("shiki/langs/javascript.mjs"),import("shiki/langs/jsx.mjs"),import("shiki/langs/json.mjs"),import("shiki/langs/css.mjs"),import("shiki/langs/html.mjs"),import("shiki/langs/bash.mjs"),import("shiki/langs/sql.mjs"),import("shiki/langs/yaml.mjs"),import("shiki/langs/markdown.mjs")]),F=C.slice(0,2).map(u=>u.default),I=C.slice(2).map(u=>u.default),M=await a({themes:F,langs:I,engine:b()});t&&(D(M),N(!1))}catch(a){a instanceof Error&&(a.message.includes("Cannot find module 'shiki'")||a.message.includes("Failed to fetch dynamically imported module")),t&&(A(!0),N(!1))}})(),()=>{t=!1}},[r]);let g=V(()=>{if(!r||!i||k||!c||v)return null;try{let t=y?"github-dark":"github-light",o=p||"text";return c.getLoadedLanguages().includes(o)?c.codeToHtml(i,{lang:o,theme:t}).replace(/^<pre[^>]*><code[^>]*>/,"").replace(/<\/code><\/pre>$/,"").replace(/\n/g,""):null}catch{return null}},[i,p,r,c,v,y,k]);return H(()=>{_(!0)},[]),n(d,{gap:"none",className:"dndev-code dndev-surface","data-glow":"blank","data-compact":h,children:[!h&&e("div",{className:"dndev-code-header",children:n(d,{direction:"row",align:"center",justify:"between",children:[n(d,{direction:"row",align:"center",gap:"tight",children:[n("div",{className:"dndev-code-traffic-lights",children:[e("div",{className:"dndev-code-traffic-light","data-color":"red"}),e("div",{className:"dndev-code-traffic-light","data-color":"yellow"}),e("div",{className:"dndev-code-traffic-light","data-color":"green"})]}),e(l,{as:"span",className:"dndev-code-language",children:p}),n(l,{as:"span",className:"dndev-code-line-count",children:[s.length," line",s.length!==1?"s":""]})]}),E&&r&&e(w,{text:i,onCopy:L})]})}),e(S,{className:"dndev-code-content",showHorizontal:!f,showVertical:!0,children:e("pre",{className:"dndev-code-pre","data-wrap":f,"data-compact":h,children:x?n(d,{direction:"row",gap:"none",children:[e("div",{className:"dndev-code-line-numbers",children:s.map((t,o)=>e("div",{className:"dndev-code-line-number",children:String(o+1).padStart(2," ")},o))}),g?e("code",{className:"dndev-code-code",dangerouslySetInnerHTML:{__html:g}}):e("code",{className:"dndev-code-code",children:s.map((t,o)=>e(l,{as:"code",variant:"code",style:{display:"block",background:"transparent",padding:0,lineHeight:1.5},children:t||"\xA0"},o))})]}):g?e("code",{className:"dndev-code-code",dangerouslySetInnerHTML:{__html:g}}):e("code",{className:"dndev-code-code",children:s.map((t,o)=>e(l,{as:"code",variant:"code",style:{display:"block",background:"transparent",padding:0},children:t||"\xA0"},o))})})})]})}var j=O;export{j as default};
|
|
@@ -4,7 +4,11 @@ import './ImageGallery.css';
|
|
|
4
4
|
export interface ImageData {
|
|
5
5
|
fullUrl?: string;
|
|
6
6
|
thumbUrl?: string;
|
|
7
|
+
/** Per-image override of the gallery `fit` (e.g. `'contain'` for a cut-out packshot). */
|
|
8
|
+
fit?: ImageFit;
|
|
7
9
|
}
|
|
10
|
+
/** `'cover'` crops to fill the frame; `'contain'` shows the whole image on the muted frame. */
|
|
11
|
+
export type ImageFit = 'cover' | 'contain';
|
|
8
12
|
/** Props for the ImageGallery component -- thumbnail strip with main image preview. */
|
|
9
13
|
export interface ImageGalleryProps {
|
|
10
14
|
/** Array of images - can be objects with fullUrl/thumbUrl or plain strings */
|
|
@@ -20,6 +24,11 @@ export interface ImageGalleryProps {
|
|
|
20
24
|
* Omit for default behavior (lightbox on).
|
|
21
25
|
*/
|
|
22
26
|
nobox?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* How images fill the main frame and thumbnails. Overridden per image by `ImageData.fit`.
|
|
29
|
+
* @default 'cover'
|
|
30
|
+
*/
|
|
31
|
+
fit?: ImageFit;
|
|
23
32
|
}
|
|
24
33
|
/**
|
|
25
34
|
* ImageGallery - Full-featured image gallery component
|
|
@@ -42,6 +51,6 @@ export interface ImageGalleryProps {
|
|
|
42
51
|
* />
|
|
43
52
|
* ```
|
|
44
53
|
*/
|
|
45
|
-
export declare function ImageGallery({ images, aspectRatio, altPrefix, onImageChange, nobox, }: ImageGalleryProps): ReactElement;
|
|
54
|
+
export declare function ImageGallery({ images, aspectRatio, altPrefix, onImageChange, nobox, fit, }: ImageGalleryProps): ReactElement;
|
|
46
55
|
export default ImageGallery;
|
|
47
56
|
//# sourceMappingURL=ImageGallery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageGallery.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/ImageGallery.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ImageGallery.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/ImageGallery.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAIV,YAAY,EACb,MAAM,OAAO,CAAC;AAIf,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;AAuBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,WAAoB,EACpB,SAAmB,EACnB,aAAa,EACb,KAAK,EACL,GAAa,GACd,EAAE,iBAAiB,GAAG,YAAY,CAgYlC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -16,13 +16,14 @@ import './ImageGallery.css';
|
|
|
16
16
|
/**
|
|
17
17
|
* Normalize image data to consistent format
|
|
18
18
|
*/
|
|
19
|
-
function normalizeImage(img) {
|
|
19
|
+
function normalizeImage(img, fit) {
|
|
20
20
|
if (typeof img === 'string') {
|
|
21
|
-
return { full: img, thumb: img };
|
|
21
|
+
return { full: img, thumb: img, fit };
|
|
22
22
|
}
|
|
23
23
|
return {
|
|
24
24
|
full: img.fullUrl || img.thumbUrl || '',
|
|
25
25
|
thumb: img.thumbUrl || img.fullUrl || '',
|
|
26
|
+
fit: img.fit ?? fit,
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
@@ -46,7 +47,7 @@ function normalizeImage(img) {
|
|
|
46
47
|
* />
|
|
47
48
|
* ```
|
|
48
49
|
*/
|
|
49
|
-
export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image', onImageChange, nobox, }) {
|
|
50
|
+
export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image', onImageChange, nobox, fit = 'cover', }) {
|
|
50
51
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
51
52
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
52
53
|
const [loadedFullUrls, setLoadedFullUrls] = useState(new Set());
|
|
@@ -55,7 +56,7 @@ export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image'
|
|
|
55
56
|
const thumbnailRefs = useRef([]);
|
|
56
57
|
// Track whether the index changed via user navigation (not initial mount)
|
|
57
58
|
const isUserNavigationRef = useRef(false);
|
|
58
|
-
const normalizedImages = images.map(normalizeImage);
|
|
59
|
+
const normalizedImages = images.map((img) => normalizeImage(img, fit));
|
|
59
60
|
const hasMultiple = normalizedImages.length > 1;
|
|
60
61
|
// Trim stale refs when the image list shrinks
|
|
61
62
|
thumbnailRefs.current = thumbnailRefs.current.slice(0, normalizedImages.length);
|
|
@@ -163,12 +164,17 @@ export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image'
|
|
|
163
164
|
}
|
|
164
165
|
const clampedIndex = Math.min(selectedIndex, normalizedImages.length - 1);
|
|
165
166
|
const currentImage = normalizedImages[clampedIndex];
|
|
167
|
+
// Contained images (cut-out packshots) sit inset from the frame edges.
|
|
168
|
+
const containInset = currentImage.fit === 'contain'
|
|
169
|
+
? { boxSizing: 'border-box', padding: '6%' }
|
|
170
|
+
: {};
|
|
166
171
|
return (_jsxs("div", { ref: containerRef, className: "image-gallery", onKeyDown: handleKeyDown, 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: [currentImage.full !== currentImage.thumb && (_jsx("img", { src: currentImage.thumb, alt: "", className: "image-gallery__main-image", onError: handleImageError, style: {
|
|
167
172
|
position: 'absolute',
|
|
168
173
|
inset: 0,
|
|
169
174
|
width: '100%',
|
|
170
175
|
height: '100%',
|
|
171
|
-
objectFit:
|
|
176
|
+
objectFit: currentImage.fit,
|
|
177
|
+
...containInset,
|
|
172
178
|
opacity: loadedFullUrls.has(clampedIndex) ? 0 : 1,
|
|
173
179
|
transition: 'opacity 0.3s ease',
|
|
174
180
|
zIndex: 1,
|
|
@@ -179,7 +185,8 @@ export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image'
|
|
|
179
185
|
inset: 0,
|
|
180
186
|
width: '100%',
|
|
181
187
|
height: '100%',
|
|
182
|
-
objectFit:
|
|
188
|
+
objectFit: currentImage.fit,
|
|
189
|
+
...containInset,
|
|
183
190
|
opacity: loadedFullUrls.has(clampedIndex) ||
|
|
184
191
|
currentImage.full === currentImage.thumb
|
|
185
192
|
? 1
|
|
@@ -194,7 +201,7 @@ export function ImageGallery({ images, aspectRatio = '16/9', altPrefix = 'Image'
|
|
|
194
201
|
thumbnailRefs.current[index] = el;
|
|
195
202
|
}, type: "button", role: "tab", "aria-selected": index === clampedIndex, "aria-label": `View image ${index + 1}`, className: `image-gallery__thumbnail ${index === clampedIndex
|
|
196
203
|
? 'image-gallery__thumbnail--selected'
|
|
197
|
-
: ''}`, onClick: () => goToImage(index), children: _jsx("img", { src: img.thumb, alt: "", className: "image-gallery__thumbnail-image", onError: handleImageError }) }, index))) })), !nobox && (_jsx(Dialog, { open: lightboxOpen, onOpenChange: setLightboxOpen, showClose: true, className: "image-gallery__lightbox", children: _jsxs("div", { ref: lightboxPanelRef, className: "image-gallery__lightbox-body", onKeyDown: handleLightboxKeyDown, tabIndex: -1, children: [_jsx("img", { src: currentImage.full, alt: `${altPrefix} ${clampedIndex + 1} of ${normalizedImages.length}`, className: "image-gallery__lightbox-img", onError: handleImageError }), hasMultiple && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "image-gallery__nav image-gallery__nav--prev image-gallery__lightbox-nav", onClick: (e) => {
|
|
204
|
+
: ''}`, onClick: () => goToImage(index), children: _jsx("img", { src: img.thumb, alt: "", className: "image-gallery__thumbnail-image", "data-fit": img.fit, onError: handleImageError }) }, index))) })), !nobox && (_jsx(Dialog, { open: lightboxOpen, onOpenChange: setLightboxOpen, showClose: true, className: "image-gallery__lightbox", children: _jsxs("div", { ref: lightboxPanelRef, className: "image-gallery__lightbox-body", onKeyDown: handleLightboxKeyDown, tabIndex: -1, children: [_jsx("img", { src: currentImage.full, alt: `${altPrefix} ${clampedIndex + 1} of ${normalizedImages.length}`, className: "image-gallery__lightbox-img", onError: handleImageError }), hasMultiple && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "image-gallery__nav image-gallery__nav--prev image-gallery__lightbox-nav", onClick: (e) => {
|
|
198
205
|
e.stopPropagation();
|
|
199
206
|
goPrev();
|
|
200
207
|
}, "aria-label": "Previous image", children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "15 18 9 12 15 6" }) }) }), _jsx("button", { type: "button", className: "image-gallery__nav image-gallery__nav--next image-gallery__lightbox-nav", onClick: (e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/advanced/ImageGallery/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/advanced/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { default as Code } from './Code';
|
|
|
12
12
|
export type { CodeProps } from './Code';
|
|
13
13
|
export { default as JsonViewer } from './JsonViewer';
|
|
14
14
|
export { default as ImageGallery } from './ImageGallery';
|
|
15
|
-
export type { ImageGalleryProps, ImageData } from './ImageGallery';
|
|
15
|
+
export type { ImageGalleryProps, ImageData, ImageFit } from './ImageGallery';
|
|
16
16
|
export { default as Carousel } from './Carousel';
|
|
17
17
|
export type { CarouselProps, CarouselRef } from './Carousel';
|
|
18
18
|
export { default as Crawl } from './Crawl';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/advanced/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EACV,UAAU,EACV,aAAa,EACb,QAAQ,EACR,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,OAAO,IAAI,IAAI,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AY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -31,7 +31,7 @@ export type BadgeVariant = VariantProps<typeof badgeVariants>['variant'];
|
|
|
31
31
|
/**
|
|
32
32
|
* Badge-specific props (styling directives)
|
|
33
33
|
*/
|
|
34
|
-
interface BadgeOwnProps extends VariantProps<typeof badgeVariants> {
|
|
34
|
+
export interface BadgeOwnProps extends VariantProps<typeof badgeVariants> {
|
|
35
35
|
/**
|
|
36
36
|
* Element type to render as
|
|
37
37
|
* @default 'div'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Badge/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,OAAO,CAAC;AAKf;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAGhB,CAAC;AAEX,QAAA,MAAM,aAAa;;8EAiBjB,CAAC;AAEH,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC;AAEzE;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Badge/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,OAAO,CAAC;AAKf;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAGhB,CAAC;AAEX,QAAA,MAAM,aAAa;;8EAiBjB,CAAC;AAEH,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,YAAY,CAAC,OAAO,aAAa,CAAC;IACvE;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,aAAa,GACnE,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,KAAK,wHAcT,CAAC;AAIH,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -86,6 +86,11 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, Va
|
|
|
86
86
|
* @default false
|
|
87
87
|
*/
|
|
88
88
|
iconEnd?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Count bubble on the icon's corner (cart items, notifications). Rendered only with an
|
|
91
|
+
* icon; `0`, empty or undefined hides it. Decorative: put the count in `aria-label`.
|
|
92
|
+
*/
|
|
93
|
+
badge?: number | string;
|
|
89
94
|
/** Tooltip text to show on hover */
|
|
90
95
|
tooltip?: string;
|
|
91
96
|
/** Force tooltip to stay open (e.g., after copy action) */
|
|
@@ -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;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAM1D,OAAO,cAAc,CAAC;AAEtB;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;CAKjB,CAAC;AAEX,QAAA,MAAM,cAAc;;8EAmBlB,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC;AAE3E;;;;;;GAMG;AACH,qEAAqE;AACrE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,sCAAsC;AACtC,MAAM,WAAW,WACf,SACE,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,YAAY,CAAC,OAAO,cA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AAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,MAAM,2GAuLX,CAAC;AAIF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -73,7 +73,7 @@ const buttonVariants = cva('dndev-interactive', {
|
|
|
73
73
|
* @param {ButtonProps} props - The props for the button
|
|
74
74
|
* @returns {JSX.Element} The rendered button
|
|
75
75
|
*/
|
|
76
|
-
const Button = forwardRef(({ className, variant, render, display = DISPLAY.AUTO, icon, iconEnd = false, children, tooltip, tooltipForceOpen, floating = false, fullWidth = false, loading = false, loadingText, progress, disabled, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
|
|
76
|
+
const Button = forwardRef(({ className, variant, render, display = DISPLAY.AUTO, icon, iconEnd = false, badge, children, tooltip, tooltipForceOpen, floating = false, fullWidth = false, loading = false, loadingText, progress, disabled, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
|
|
77
77
|
const buttonText = children;
|
|
78
78
|
const hasIcon = !!icon;
|
|
79
79
|
const hasText = !!buttonText;
|
|
@@ -83,8 +83,11 @@ const Button = forwardRef(({ className, variant, render, display = DISPLAY.AUTO,
|
|
|
83
83
|
const isDisabled = disabled || loading;
|
|
84
84
|
const showProgress = loading && progress !== undefined && progress < 100;
|
|
85
85
|
const displayText = loading ? (loadingText ?? buttonText) : buttonText;
|
|
86
|
+
// Icon, with the count bubble on its corner when `badge` is set
|
|
87
|
+
const showBadge = badge !== undefined && badge !== 0 && badge !== '';
|
|
88
|
+
const iconWithBadge = showBadge ? (_jsxs("span", { className: "dndev-interactive-icon-anchor", children: [_jsx(Icon, { icon: icon }), _jsx("span", { className: "dndev-interactive-badge", "aria-hidden": "true", children: badge })] })) : (_jsx(Icon, { icon: icon }));
|
|
86
89
|
// Build button content - Icon handles all types automatically
|
|
87
|
-
const buttonContent = loading ? (_jsxs(_Fragment, { children: [showProgress ? (_jsx("span", { className: "dndev-button-progress", "aria-hidden": "true", children: _jsxs("svg", { viewBox: "0 0 20 20", className: "dndev-progress-ring", children: [_jsx("circle", { cx: "10", cy: "10", r: "8", fill: "none", stroke: "currentColor", strokeWidth: "2", opacity: "0.2" }), _jsx("circle", { cx: "10", cy: "10", r: "8", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: `${(progress / 100) * 50.27} 50.27`, strokeLinecap: "round", transform: "rotate(-90 10 10)" })] }) })) : (_jsx(Spinner, { className: "dndev-button-spinner", "aria-hidden": "true" })), hasText && (_jsx("span", { className: "dndev-interactive-label", "data-display": effectiveDisplay, children: displayText }))] })) : (_jsxs(_Fragment, { children: [icon && !iconEnd &&
|
|
90
|
+
const buttonContent = loading ? (_jsxs(_Fragment, { children: [showProgress ? (_jsx("span", { className: "dndev-button-progress", "aria-hidden": "true", children: _jsxs("svg", { viewBox: "0 0 20 20", className: "dndev-progress-ring", children: [_jsx("circle", { cx: "10", cy: "10", r: "8", fill: "none", stroke: "currentColor", strokeWidth: "2", opacity: "0.2" }), _jsx("circle", { cx: "10", cy: "10", r: "8", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: `${(progress / 100) * 50.27} 50.27`, strokeLinecap: "round", transform: "rotate(-90 10 10)" })] }) })) : (_jsx(Spinner, { className: "dndev-button-spinner", "aria-hidden": "true" })), hasText && (_jsx("span", { className: "dndev-interactive-label", "data-display": effectiveDisplay, children: displayText }))] })) : (_jsxs(_Fragment, { children: [icon && !iconEnd && iconWithBadge, hasText && (_jsx("span", { className: "dndev-interactive-label", "data-display": effectiveDisplay, children: buttonText })), icon && iconEnd && iconWithBadge] }));
|
|
88
91
|
// Extract text for aria-label (simple string extraction)
|
|
89
92
|
const getAriaLabel = () => {
|
|
90
93
|
if (ariaLabel)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/CallToAction/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAQ,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIxE,OAAO,oBAAoB,CAAC;AAE5B;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/CallToAction/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAQ,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIxE,OAAO,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IAEjC,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,qEAAqE;IACrE,aAAa,CAAC,EAAE,SAAS,CAAC;IAE1B,uEAAuE;IACvE,eAAe,CAAC,EAAE,SAAS,CAAC;IAE5B,sFAAsF;IACtF,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAE/C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAEvE;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,wFAAwF;IACxF,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,SAAS,IAC7D,oBAAoB,GAClB,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,oBAAoB,CAAC,CAAC;AAE/D,QAAA,MAAM,YAAY,mIA6EjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Card cover region
|
|
3
|
+
* @description Cover media for Card: fit, alt, hover view and loading priority.
|
|
4
|
+
*/
|
|
5
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* How a string `cover` is displayed. Ignored for ReactNode covers (the consumer
|
|
8
|
+
* owns the media element).
|
|
9
|
+
*/
|
|
10
|
+
export interface CardCoverMedia {
|
|
11
|
+
/**
|
|
12
|
+
* `'cover'` fills the region and crops (photography). `'contain'` shows the whole
|
|
13
|
+
* image on the muted cover background (cut-out packshots, logos).
|
|
14
|
+
* @default 'cover'
|
|
15
|
+
*/
|
|
16
|
+
fit?: 'cover' | 'contain';
|
|
17
|
+
/** Alt text. Empty (default) marks the cover as decorative. */
|
|
18
|
+
alt?: string;
|
|
19
|
+
/** Second image URL revealed on hover / focus-within (always `fit: cover`). */
|
|
20
|
+
hover?: string;
|
|
21
|
+
/** Load eagerly with high fetch priority (above-the-fold covers). @default false */
|
|
22
|
+
eager?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Renders the card cover region with optional overlay.
|
|
26
|
+
*
|
|
27
|
+
* Architecture: cover is a relative-positioned header region that sits flush
|
|
28
|
+
* to the card's rounded corners (no negative-margin hack). When the card has
|
|
29
|
+
* body content, the cover's height comes from `coverAspect`. When the card is
|
|
30
|
+
* cover-only (no body), the cover stretches to fill the card — the card
|
|
31
|
+
* itself picks up `coverAspect` via its container.
|
|
32
|
+
*
|
|
33
|
+
* - `string` cover → renders a safe `<img>` with `loading="lazy"`,
|
|
34
|
+
* `decoding="async"`, `referrerpolicy="no-referrer"`; `media` sets fit,
|
|
35
|
+
* alt (decorative by default), a hover view and eager loading.
|
|
36
|
+
* - `ReactNode` cover → passthrough; child `<img>`/`<video>` auto-fill via CSS.
|
|
37
|
+
*
|
|
38
|
+
* Overlay is absolutely positioned over the cover AND over the body slot,
|
|
39
|
+
* anchored by `overlayPosition` with a theme-token inset.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderCardCover(cover: string | ReactNode | undefined, coverAspect: CSSProperties['aspectRatio'] | undefined, hasBody: boolean, media?: CardCoverMedia): ReactNode;
|
|
42
|
+
//# sourceMappingURL=cover.d.ts.map
|
|
@@ -0,0 +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;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,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EACrC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,SAAS,EACrD,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,cAAmB,GACzB,SAAS,CA+CX"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Renders the card cover region with optional overlay.
|
|
4
|
+
*
|
|
5
|
+
* Architecture: cover is a relative-positioned header region that sits flush
|
|
6
|
+
* to the card's rounded corners (no negative-margin hack). When the card has
|
|
7
|
+
* body content, the cover's height comes from `coverAspect`. When the card is
|
|
8
|
+
* cover-only (no body), the cover stretches to fill the card — the card
|
|
9
|
+
* itself picks up `coverAspect` via its container.
|
|
10
|
+
*
|
|
11
|
+
* - `string` cover → renders a safe `<img>` with `loading="lazy"`,
|
|
12
|
+
* `decoding="async"`, `referrerpolicy="no-referrer"`; `media` sets fit,
|
|
13
|
+
* alt (decorative by default), a hover view and eager loading.
|
|
14
|
+
* - `ReactNode` cover → passthrough; child `<img>`/`<video>` auto-fill via CSS.
|
|
15
|
+
*
|
|
16
|
+
* Overlay is absolutely positioned over the cover AND over the body slot,
|
|
17
|
+
* anchored by `overlayPosition` with a theme-token inset.
|
|
18
|
+
*/
|
|
19
|
+
export function renderCardCover(cover, coverAspect, hasBody, media = {}) {
|
|
20
|
+
if (!cover)
|
|
21
|
+
return null;
|
|
22
|
+
const isStringCover = typeof cover === 'string';
|
|
23
|
+
const { fit = 'cover', alt = '', hover, eager = false } = media;
|
|
24
|
+
// When body is present the cover owns the top region sized by coverAspect.
|
|
25
|
+
// When body is absent the cover fills the card (card owns the aspect-ratio).
|
|
26
|
+
const coverStyle = hasBody
|
|
27
|
+
? { aspectRatio: coverAspect ?? '4 / 5' }
|
|
28
|
+
: {};
|
|
29
|
+
return (_jsxs("div", { className: "dndev-card-cover", "data-has-body": hasBody ? 'true' : undefined, "data-fit": fit, "data-has-hover": isStringCover && hover ? 'true' : undefined, style: coverStyle, children: [isStringCover ? (_jsx("img", { src: cover, alt: alt, loading: eager ? 'eager' : 'lazy', fetchPriority: eager ? 'high' : undefined, decoding: "async", referrerPolicy: "no-referrer" })) : (_jsx("div", { className: "dndev-card-cover-media", children: cover })), isStringCover && hover && (
|
|
30
|
+
// Decorative second view (e.g. lifestyle shot behind a packshot):
|
|
31
|
+
// revealed on hover / keyboard focus, hidden from assistive tech.
|
|
32
|
+
_jsx("img", { className: "dndev-card-cover-hover", src: hover, alt: "", "aria-hidden": "true", loading: "lazy", decoding: "async", referrerPolicy: "no-referrer" }))] }));
|
|
33
|
+
}
|
|
@@ -10,6 +10,9 @@ import type { VariantProps } from 'class-variance-authority';
|
|
|
10
10
|
import type { CSSProperties, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
11
11
|
import type { IconType } from '../../types';
|
|
12
12
|
import { surfaceVariants } from '../../utils/variants';
|
|
13
|
+
import type { CardCoverMedia } from './cover';
|
|
14
|
+
export { renderCardCover } from './cover';
|
|
15
|
+
export type { CardCoverMedia } from './cover';
|
|
13
16
|
/** Corner anchor for the overlay element layered on the card cover. */
|
|
14
17
|
export type CardOverlayPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
15
18
|
/**
|
|
@@ -57,23 +60,6 @@ export declare function renderCardContent(content: CardContent | undefined): Rea
|
|
|
57
60
|
* ```
|
|
58
61
|
*/
|
|
59
62
|
export declare function renderCardHeader(icon?: IconType, title?: string | ReactNode, subtitle?: string | ReactNode): ReactNode;
|
|
60
|
-
/**
|
|
61
|
-
* Renders the card cover region with optional overlay.
|
|
62
|
-
*
|
|
63
|
-
* Architecture: cover is a relative-positioned header region that sits flush
|
|
64
|
-
* to the card's rounded corners (no negative-margin hack). When the card has
|
|
65
|
-
* body content, the cover's height comes from `coverAspect`. When the card is
|
|
66
|
-
* cover-only (no body), the cover stretches to fill the card — the card
|
|
67
|
-
* itself picks up `coverAspect` via its container.
|
|
68
|
-
*
|
|
69
|
-
* - `string` cover → renders a safe `<img>` with `loading="lazy"`,
|
|
70
|
-
* `decoding="async"`, `referrerpolicy="no-referrer"`, `alt=""` (decorative).
|
|
71
|
-
* - `ReactNode` cover → passthrough; child `<img>`/`<video>` auto-fill via CSS.
|
|
72
|
-
*
|
|
73
|
-
* Overlay is absolutely positioned over the cover AND over the body slot,
|
|
74
|
-
* anchored by `overlayPosition` with a theme-token inset.
|
|
75
|
-
*/
|
|
76
|
-
export declare function renderCardCover(cover: string | ReactNode | undefined, coverAspect: CSSProperties['aspectRatio'] | undefined, hasBody: boolean): ReactNode;
|
|
77
63
|
/**
|
|
78
64
|
* Card variant constants - re-exported from shared SURFACE_VARIANT
|
|
79
65
|
* Matches .dndev-surface CSS class
|
|
@@ -152,6 +138,25 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
152
138
|
* @default '4 / 5'
|
|
153
139
|
*/
|
|
154
140
|
coverAspect?: CSSProperties['aspectRatio'];
|
|
141
|
+
/**
|
|
142
|
+
* How a string `cover` fits its region: `'cover'` crops to fill (default),
|
|
143
|
+
* `'contain'` shows the whole image (cut-out packshots).
|
|
144
|
+
* @default 'cover'
|
|
145
|
+
*/
|
|
146
|
+
coverFit?: CardCoverMedia['fit'];
|
|
147
|
+
/** Alt text for a string `cover`. Omit for a decorative cover. */
|
|
148
|
+
coverAlt?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Second image URL crossfaded in on hover / keyboard focus (string covers only),
|
|
151
|
+
* e.g. a lifestyle shot behind a packshot.
|
|
152
|
+
*/
|
|
153
|
+
coverHover?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Load a string `cover` eagerly with high fetch priority. Set on above-the-fold
|
|
156
|
+
* cards only (hero tiles, first row); others stay lazy.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
coverEager?: boolean;
|
|
155
160
|
/**
|
|
156
161
|
* Optional content absolutely positioned on top of the cover.
|
|
157
162
|
* Anchored by `overlayPosition` with theme-token inset. Overlay sits above
|
|
@@ -245,6 +250,6 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
245
250
|
* @param {CardProps} props - The props for the card
|
|
246
251
|
* @returns {JSX.Element} The rendered card
|
|
247
252
|
*/
|
|
248
|
-
declare const Card: ({ className, variant, asChild, icon, title, subtitle, content, footer, children, tooltip, onClick, clickable, elevated, cover, coverAspect, overlay, overlayPosition, fullOverlay, bodyBackground, style, ref, ...props }: CardProps) => import("react").JSX.Element;
|
|
253
|
+
declare const Card: ({ className, variant, asChild, icon, title, subtitle, content, footer, children, tooltip, onClick, clickable, elevated, cover, coverAspect, coverFit, coverAlt, coverHover, coverEager, overlay, overlayPosition, fullOverlay, bodyBackground, style, ref, ...props }: CardProps) => import("react").JSX.Element;
|
|
249
254
|
export default Card;
|
|
250
255
|
//# 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,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,C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3B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IACjC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;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,uQA2BX,SAAS,gCAwFX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -7,6 +7,8 @@ import List from '../List';
|
|
|
7
7
|
import Slot from '../Slot';
|
|
8
8
|
import Stack from '../Stack';
|
|
9
9
|
import Text from '../Text';
|
|
10
|
+
import { renderCardCover } from './cover';
|
|
11
|
+
export { renderCardCover } from './cover';
|
|
10
12
|
/**
|
|
11
13
|
* Converts CardContent to ReactNode.
|
|
12
14
|
* Use this when rendering CardContent outside of Card component.
|
|
@@ -62,33 +64,6 @@ export function renderCardHeader(icon, title, subtitle) {
|
|
|
62
64
|
return null;
|
|
63
65
|
return (_jsxs("div", { className: "dndev-card-header", children: [icon && title ? (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Icon, { icon: icon, ariaHidden: true }), _jsx(Text, { as: "div", level: "h3", className: "dndev-card-title", children: title })] })) : title ? (_jsx(Text, { as: "div", level: "h3", className: "dndev-card-title", children: title })) : icon ? (_jsx(Icon, { icon: icon, ariaHidden: true })) : null, subtitle && (_jsx(Text, { as: "div", level: "h4", className: "dndev-card-subtitle", children: subtitle }))] }));
|
|
64
66
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Renders the card cover region with optional overlay.
|
|
67
|
-
*
|
|
68
|
-
* Architecture: cover is a relative-positioned header region that sits flush
|
|
69
|
-
* to the card's rounded corners (no negative-margin hack). When the card has
|
|
70
|
-
* body content, the cover's height comes from `coverAspect`. When the card is
|
|
71
|
-
* cover-only (no body), the cover stretches to fill the card — the card
|
|
72
|
-
* itself picks up `coverAspect` via its container.
|
|
73
|
-
*
|
|
74
|
-
* - `string` cover → renders a safe `<img>` with `loading="lazy"`,
|
|
75
|
-
* `decoding="async"`, `referrerpolicy="no-referrer"`, `alt=""` (decorative).
|
|
76
|
-
* - `ReactNode` cover → passthrough; child `<img>`/`<video>` auto-fill via CSS.
|
|
77
|
-
*
|
|
78
|
-
* Overlay is absolutely positioned over the cover AND over the body slot,
|
|
79
|
-
* anchored by `overlayPosition` with a theme-token inset.
|
|
80
|
-
*/
|
|
81
|
-
export function renderCardCover(cover, coverAspect, hasBody) {
|
|
82
|
-
if (!cover)
|
|
83
|
-
return null;
|
|
84
|
-
const isStringCover = typeof cover === 'string';
|
|
85
|
-
// When body is present the cover owns the top region sized by coverAspect.
|
|
86
|
-
// When body is absent the cover fills the card (card owns the aspect-ratio).
|
|
87
|
-
const coverStyle = hasBody
|
|
88
|
-
? { aspectRatio: coverAspect ?? '4 / 5' }
|
|
89
|
-
: {};
|
|
90
|
-
return (_jsx("div", { className: "dndev-card-cover", "data-has-body": hasBody ? 'true' : undefined, style: coverStyle, children: isStringCover ? (_jsx("img", { src: cover, alt: "", loading: "lazy", decoding: "async", referrerPolicy: "no-referrer" })) : (_jsx("div", { className: "dndev-card-cover-media", children: cover })) }));
|
|
91
|
-
}
|
|
92
67
|
/**
|
|
93
68
|
* Card variant constants - re-exported from shared SURFACE_VARIANT
|
|
94
69
|
* Matches .dndev-surface CSS class
|
|
@@ -148,7 +123,7 @@ export const CARD_VARIANT = SURFACE_VARIANT;
|
|
|
148
123
|
* @param {CardProps} props - The props for the card
|
|
149
124
|
* @returns {JSX.Element} The rendered card
|
|
150
125
|
*/
|
|
151
|
-
const Card = ({ className, variant, asChild = false, icon, title, subtitle, content, footer, children, tooltip, onClick, clickable, elevated, cover, coverAspect, overlay, overlayPosition = 'top-left', fullOverlay, bodyBackground = 'transparent', style, ref, ...props }) => {
|
|
126
|
+
const Card = ({ className, variant, asChild = false, icon, title, subtitle, content, footer, children, tooltip, onClick, clickable, elevated, cover, coverAspect, coverFit, coverAlt, coverHover, coverEager, overlay, overlayPosition = 'top-left', fullOverlay, bodyBackground = 'transparent', style, ref, ...props }) => {
|
|
152
127
|
const Comp = asChild ? Slot : 'div';
|
|
153
128
|
const variantAttrs = getVariantDataAttrs({ variant });
|
|
154
129
|
const isClickable = clickable !== undefined ? clickable : !!onClick;
|
|
@@ -156,7 +131,12 @@ const Card = ({ className, variant, asChild = false, icon, title, subtitle, cont
|
|
|
156
131
|
const contentNode = renderCardContent(content);
|
|
157
132
|
const hasContent = Boolean(contentNode || children);
|
|
158
133
|
const hasBody = Boolean(header || hasContent || footer);
|
|
159
|
-
const coverNode = renderCardCover(cover, coverAspect, hasBody
|
|
134
|
+
const coverNode = renderCardCover(cover, coverAspect, hasBody, {
|
|
135
|
+
fit: coverFit,
|
|
136
|
+
alt: coverAlt,
|
|
137
|
+
hover: coverHover,
|
|
138
|
+
eager: coverEager,
|
|
139
|
+
});
|
|
160
140
|
const cardAttrs = {
|
|
161
141
|
...variantAttrs,
|
|
162
142
|
'data-role': 'card',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridArea.d.ts","sourceRoot":"","sources":["../../../src/atomic/Grid/GridArea.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;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;;;GAMG;AACH,QAAA,MAAM,QAAQ,2HA+Cb,CAAC;AAIF,eAAe,QAAQ,CAAC"}
|
|
@@ -59,7 +59,7 @@ export type GridCols = number | string | ResponsiveCols | ResponsiveTemplate;
|
|
|
59
59
|
/**
|
|
60
60
|
* Grid-specific props (layout directives)
|
|
61
61
|
*/
|
|
62
|
-
interface GridOwnProps {
|
|
62
|
+
export interface GridOwnProps {
|
|
63
63
|
/**
|
|
64
64
|
* Element type to render as
|
|
65
65
|
* @default 'div'
|
|
@@ -124,6 +124,6 @@ export type GridProps<T extends ElementType = 'div'> = GridOwnProps & Omit<Compo
|
|
|
124
124
|
*/
|
|
125
125
|
declare const Grid: import("react").ForwardRefExoticComponent<Omit<GridProps<"div">, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
126
126
|
export { default as GridArea } from './GridArea';
|
|
127
|
-
export type { GridAreaProps } from './GridArea';
|
|
127
|
+
export type { GridAreaProps, GridAreaOwnProps } from './GridArea';
|
|
128
128
|
export default Grid;
|
|
129
129
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Grid/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAElE;;GAEG;AAC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,MAAM,GAAG,kBAAkB,CAAC;IAEpC,cAAc;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,YAAY,GACjE,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC;AAErD;;;;;GAKG;AACH,QAAA,MAAM,IAAI,uHAgFT,CAAC;AAIF,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE,eAAe,IAAI,CAAC"}
|
|
@@ -46,7 +46,8 @@ import './HeroSection.css';
|
|
|
46
46
|
declare const heroSectionVariants: (props?: ({
|
|
47
47
|
variant?: "accent" | "primary" | "subtle" | null | undefined;
|
|
48
48
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
49
|
-
|
|
49
|
+
/** HeroSection-specific props (merged with the native props of the `as` element). */
|
|
50
|
+
export interface HeroSectionOwnProps extends VariantProps<typeof heroSectionVariants> {
|
|
50
51
|
/** Element type to render as @default 'section' */
|
|
51
52
|
as?: 'section' | 'header' | 'div';
|
|
52
53
|
/** Badge text */
|
|
@@ -89,6 +90,20 @@ interface HeroSectionOwnProps extends VariantProps<typeof heroSectionVariants> {
|
|
|
89
90
|
* @default 'cover'
|
|
90
91
|
*/
|
|
91
92
|
backgroundFit?: 'cover' | 'contain';
|
|
93
|
+
/**
|
|
94
|
+
* Focal point of a `cover` background image (CSS `object-position`), so the
|
|
95
|
+
* subject stays in frame when the hero crops on narrow screens, e.g. `'70% 30%'`.
|
|
96
|
+
* @default 'center'
|
|
97
|
+
*/
|
|
98
|
+
backgroundPosition?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Readability scrim over a `cover` background image.
|
|
101
|
+
* - `'full'` — dark gradient over the whole image (default)
|
|
102
|
+
* - `'soft'` — light gradient at the bottom only, for bright editorial photography
|
|
103
|
+
* with text placed at the bottom (`justify="end"`)
|
|
104
|
+
* @default 'full'
|
|
105
|
+
*/
|
|
106
|
+
scrim?: 'full' | 'soft';
|
|
92
107
|
/** Content */
|
|
93
108
|
children?: ReactNode;
|
|
94
109
|
}
|
|
@@ -97,6 +112,36 @@ interface HeroSectionOwnProps extends VariantProps<typeof heroSectionVariants> {
|
|
|
97
112
|
* Combines HeroSection-specific props with native element props based on 'as' prop
|
|
98
113
|
*/
|
|
99
114
|
export type HeroSectionProps<T extends ElementType = 'section'> = HeroSectionOwnProps & Omit<ComponentPropsWithRef<T>, keyof HeroSectionOwnProps>;
|
|
115
|
+
/**
|
|
116
|
+
* Hero section: h1 title, subtitle, optional badge and children (actions).
|
|
117
|
+
* `bleed` spans the viewport width; `backgroundImage` fills it with a cover photo
|
|
118
|
+
* under a readability scrim (text turns white).
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* <HeroSection title="Build Faster" subtitle="The ultimate framework">
|
|
123
|
+
* <Button>Get Started</Button>
|
|
124
|
+
* </HeroSection>
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```tsx
|
|
129
|
+
* // Editorial photo hero: subject kept in frame on phones, text at the bottom
|
|
130
|
+
* <HeroSection
|
|
131
|
+
* bleed
|
|
132
|
+
* fullHeight
|
|
133
|
+
* backgroundImage="/images/campaign.webp"
|
|
134
|
+
* backgroundPosition="70% 30%"
|
|
135
|
+
* scrim="soft"
|
|
136
|
+
* justify="end"
|
|
137
|
+
* textAlign="start"
|
|
138
|
+
* align="start"
|
|
139
|
+
* title="Spring collection"
|
|
140
|
+
* >
|
|
141
|
+
* <Button>Discover</Button>
|
|
142
|
+
* </HeroSection>
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
100
145
|
declare const HeroSection: import("react").ForwardRefExoticComponent<Omit<HeroSectionProps<"section">, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
101
146
|
export default HeroSection;
|
|
102
147
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/HeroSection/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAQ,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMxE,OAAO,mBAAmB,CAAC;AAE3B,QAAA,MAAM,mBAAmB;;8EAWvB,CAAC;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/HeroSection/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAQ,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMxE,OAAO,mBAAmB,CAAC;AAE3B,QAAA,MAAM,mBAAmB;;8EAWvB,CAAC;AAEH,qFAAqF;AACrF,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CACvD,OAAO,mBAAmB,CAC3B;IACC,mDAAmD;IACnD,EAAE,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClC,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,KAAK,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