@donotdev/components 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CarouselContent-W2TS6Y5R.js → CarouselContent-UJARFDSE.js} +1 -1
- package/dist/{CodeContent-4RJHYJO7.js → CodeContent-JP5FNGFV.js} +1 -1
- package/dist/advanced/Carousel/CarouselContent.d.ts +1 -0
- package/dist/advanced/Carousel/CarouselContent.d.ts.map +1 -1
- package/dist/advanced/Carousel/CarouselSkeleton.d.ts +1 -0
- package/dist/advanced/Carousel/CarouselSkeleton.d.ts.map +1 -1
- package/dist/advanced/Code/CodeContent.d.ts +1 -0
- package/dist/advanced/Code/CodeContent.d.ts.map +1 -1
- package/dist/advanced/Code/CodeSkeleton.d.ts +1 -0
- package/dist/advanced/Code/CodeSkeleton.d.ts.map +1 -1
- package/dist/advanced/Crawl/Crawl.d.ts +1 -0
- package/dist/advanced/Crawl/Crawl.d.ts.map +1 -1
- package/dist/advanced/Crawl/CrawlContent.d.ts +1 -0
- package/dist/advanced/Crawl/CrawlContent.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/ImageGallery.d.ts +2 -0
- package/dist/advanced/ImageGallery/ImageGallery.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/ImageGallery.js +4 -3
- package/dist/advanced/JsonViewer/JsonViewer.d.ts +1 -0
- package/dist/advanced/JsonViewer/JsonViewer.d.ts.map +1 -1
- package/dist/advanced/Marquee/MarqueeContent.d.ts +1 -0
- package/dist/advanced/Marquee/MarqueeContent.d.ts.map +1 -1
- package/dist/advanced/Marquee/MarqueeSkeleton.d.ts +1 -0
- package/dist/advanced/Marquee/MarqueeSkeleton.d.ts.map +1 -1
- package/dist/advanced/Reveal/Reveal.d.ts +1 -0
- package/dist/advanced/Reveal/Reveal.d.ts.map +1 -1
- package/dist/advanced/Roadmap/RoadmapContent.d.ts +2 -0
- package/dist/advanced/Roadmap/RoadmapContent.d.ts.map +1 -1
- package/dist/advanced/Roadmap/RoadmapContent.js +7 -1
- package/dist/atomic/Accordion/index.d.ts +2 -0
- package/dist/atomic/Accordion/index.d.ts.map +1 -1
- package/dist/atomic/ActionButton/index.d.ts +1 -0
- package/dist/atomic/ActionButton/index.d.ts.map +1 -1
- package/dist/atomic/ActionButton/useAction.d.ts +2 -0
- package/dist/atomic/ActionButton/useAction.d.ts.map +1 -1
- package/dist/atomic/Alert/index.d.ts +3 -1
- package/dist/atomic/Alert/index.d.ts.map +1 -1
- package/dist/atomic/AlertDialog/index.d.ts +1 -0
- package/dist/atomic/AlertDialog/index.d.ts.map +1 -1
- package/dist/atomic/Avatar/index.d.ts +1 -0
- package/dist/atomic/Avatar/index.d.ts.map +1 -1
- package/dist/atomic/Badge/index.d.ts +2 -1
- package/dist/atomic/Badge/index.d.ts.map +1 -1
- package/dist/atomic/Blockquote/index.d.ts +2 -0
- package/dist/atomic/Blockquote/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.d.ts +4 -1
- package/dist/atomic/Button/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.js +3 -3
- package/dist/atomic/ButtonGroup/index.d.ts +2 -0
- package/dist/atomic/ButtonGroup/index.d.ts.map +1 -1
- package/dist/atomic/Calendar/index.d.ts +1 -0
- package/dist/atomic/Calendar/index.d.ts.map +1 -1
- package/dist/atomic/Card/index.d.ts +1 -0
- package/dist/atomic/Card/index.d.ts.map +1 -1
- package/dist/atomic/Checkbox/index.d.ts +1 -0
- package/dist/atomic/Checkbox/index.d.ts.map +1 -1
- package/dist/atomic/Collapsible/index.d.ts +1 -0
- package/dist/atomic/Collapsible/index.d.ts.map +1 -1
- package/dist/atomic/ColorPicker/index.d.ts +2 -0
- package/dist/atomic/ColorPicker/index.d.ts.map +1 -1
- package/dist/atomic/Combobox/index.d.ts +2 -0
- package/dist/atomic/Combobox/index.d.ts.map +1 -1
- package/dist/atomic/Combobox/index.js +6 -2
- package/dist/atomic/Command/index.d.ts +2 -0
- package/dist/atomic/Command/index.d.ts.map +1 -1
- package/dist/atomic/CommandDialog/index.d.ts +1 -0
- package/dist/atomic/CommandDialog/index.d.ts.map +1 -1
- package/dist/atomic/ContextMenu/index.d.ts +1 -0
- package/dist/atomic/ContextMenu/index.d.ts.map +1 -1
- package/dist/atomic/CopyToClipboard/index.d.ts +1 -0
- package/dist/atomic/CopyToClipboard/index.d.ts.map +1 -1
- package/dist/atomic/CopyToClipboard/index.js +2 -1
- package/dist/atomic/DescriptionList/index.d.ts +2 -0
- package/dist/atomic/DescriptionList/index.d.ts.map +1 -1
- package/dist/atomic/Dialog/index.d.ts +3 -0
- package/dist/atomic/Dialog/index.d.ts.map +1 -1
- package/dist/atomic/DropdownMenu/index.d.ts +2 -0
- package/dist/atomic/DropdownMenu/index.d.ts.map +1 -1
- package/dist/atomic/DualCard/index.d.ts +2 -0
- package/dist/atomic/DualCard/index.d.ts.map +1 -1
- package/dist/atomic/FeatureFallback/index.d.ts +1 -0
- package/dist/atomic/FeatureFallback/index.d.ts.map +1 -1
- package/dist/atomic/FileButton/index.d.ts +1 -0
- package/dist/atomic/FileButton/index.d.ts.map +1 -1
- package/dist/atomic/HeroSection/index.d.ts +7 -0
- package/dist/atomic/HeroSection/index.d.ts.map +1 -1
- package/dist/atomic/HeroSection/index.js +11 -4
- package/dist/atomic/HoverCard/index.d.ts +1 -0
- package/dist/atomic/HoverCard/index.d.ts.map +1 -1
- package/dist/atomic/Icons/Icon.d.ts +1 -0
- package/dist/atomic/Icons/Icon.d.ts.map +1 -1
- package/dist/atomic/Icons/Partner/SupabaseIcon.d.ts +17 -0
- package/dist/atomic/Icons/Partner/SupabaseIcon.d.ts.map +1 -0
- package/dist/atomic/Icons/Partner/SupabaseIcon.js +16 -0
- package/dist/atomic/Icons/Partner/index.d.ts +1 -0
- package/dist/atomic/Icons/Partner/index.d.ts.map +1 -1
- package/dist/atomic/Icons/Partner/index.js +1 -0
- package/dist/atomic/Icons/Partner/providerIcons.d.ts +3 -0
- package/dist/atomic/Icons/Partner/providerIcons.d.ts.map +1 -1
- package/dist/atomic/Icons/Partner/providerIcons.js +2 -0
- package/dist/atomic/InfiniteScroll/index.d.ts +1 -0
- package/dist/atomic/InfiniteScroll/index.d.ts.map +1 -1
- package/dist/atomic/Input/index.d.ts +1 -0
- package/dist/atomic/Input/index.d.ts.map +1 -1
- package/dist/atomic/Label/FloatingLabel.d.ts +1 -0
- package/dist/atomic/Label/FloatingLabel.d.ts.map +1 -1
- package/dist/atomic/Label/index.d.ts +1 -0
- package/dist/atomic/Label/index.d.ts.map +1 -1
- package/dist/atomic/List/index.d.ts +3 -0
- package/dist/atomic/List/index.d.ts.map +1 -1
- package/dist/atomic/NavigationMenu/index.d.ts +2 -0
- package/dist/atomic/NavigationMenu/index.d.ts.map +1 -1
- package/dist/atomic/Pagination/index.d.ts +1 -0
- package/dist/atomic/Pagination/index.d.ts.map +1 -1
- package/dist/atomic/PasswordInput/index.d.ts +1 -0
- package/dist/atomic/PasswordInput/index.d.ts.map +1 -1
- package/dist/atomic/Popover/index.d.ts +1 -0
- package/dist/atomic/Popover/index.d.ts.map +1 -1
- package/dist/atomic/PortalButton/index.d.ts +1 -0
- package/dist/atomic/PortalButton/index.d.ts.map +1 -1
- package/dist/atomic/RadioGroup/RadioGroupPrimitive.d.ts +1 -0
- package/dist/atomic/RadioGroup/RadioGroupPrimitive.d.ts.map +1 -1
- package/dist/atomic/RadioGroup/index.d.ts +1 -0
- package/dist/atomic/RadioGroup/index.d.ts.map +1 -1
- package/dist/atomic/RangeInput/index.d.ts +1 -0
- package/dist/atomic/RangeInput/index.d.ts.map +1 -1
- package/dist/atomic/Rating/index.d.ts +2 -1
- package/dist/atomic/Rating/index.d.ts.map +1 -1
- package/dist/atomic/ScrollArea/index.d.ts +1 -0
- package/dist/atomic/ScrollArea/index.d.ts.map +1 -1
- package/dist/atomic/Section/index.d.ts +37 -16
- package/dist/atomic/Section/index.d.ts.map +1 -1
- package/dist/atomic/Section/index.js +22 -9
- package/dist/atomic/Select/SelectPrimitive.d.ts +6 -1
- package/dist/atomic/Select/SelectPrimitive.d.ts.map +1 -1
- package/dist/atomic/Select/SelectPrimitive.js +6 -1
- package/dist/atomic/Select/index.d.ts +2 -0
- package/dist/atomic/Select/index.d.ts.map +1 -1
- package/dist/atomic/Separator/index.d.ts +1 -0
- package/dist/atomic/Separator/index.d.ts.map +1 -1
- package/dist/atomic/Sheet/index.d.ts +1 -0
- package/dist/atomic/Sheet/index.d.ts.map +1 -1
- package/dist/atomic/Skeleton/index.d.ts +1 -0
- package/dist/atomic/Skeleton/index.d.ts.map +1 -1
- package/dist/atomic/SkipLink/index.d.ts +2 -0
- package/dist/atomic/SkipLink/index.d.ts.map +1 -1
- package/dist/atomic/Slider/index.d.ts +1 -0
- package/dist/atomic/Slider/index.d.ts.map +1 -1
- package/dist/atomic/Slot/index.d.ts +1 -0
- package/dist/atomic/Slot/index.d.ts.map +1 -1
- package/dist/atomic/Spinner/index.d.ts +1 -0
- package/dist/atomic/Spinner/index.d.ts.map +1 -1
- package/dist/atomic/Stack/index.d.ts +1 -0
- package/dist/atomic/Stack/index.d.ts.map +1 -1
- package/dist/atomic/Stepper/index.d.ts +4 -1
- package/dist/atomic/Stepper/index.d.ts.map +1 -1
- package/dist/atomic/Switch/index.d.ts +1 -0
- package/dist/atomic/Switch/index.d.ts.map +1 -1
- package/dist/atomic/Tabs/index.d.ts +4 -1
- package/dist/atomic/Tabs/index.d.ts.map +1 -1
- package/dist/atomic/Tag/index.d.ts +2 -1
- package/dist/atomic/Tag/index.d.ts.map +1 -1
- package/dist/atomic/Text/index.d.ts +1 -0
- package/dist/atomic/Text/index.d.ts.map +1 -1
- package/dist/atomic/Textarea/index.d.ts +1 -0
- package/dist/atomic/Textarea/index.d.ts.map +1 -1
- package/dist/atomic/Toaster/ToastPrimitive.d.ts +1 -1
- package/dist/atomic/Toggle/index.d.ts +2 -1
- package/dist/atomic/Toggle/index.d.ts.map +1 -1
- package/dist/atomic/ToggleGroup/index.d.ts +2 -0
- package/dist/atomic/ToggleGroup/index.d.ts.map +1 -1
- package/dist/atomic/Tooltip/index.d.ts +4 -1
- package/dist/atomic/Tooltip/index.d.ts.map +1 -1
- package/dist/atomic/Tooltip/index.js +4 -2
- package/dist/atomic/TreeView/index.d.ts +1 -0
- package/dist/atomic/TreeView/index.d.ts.map +1 -1
- package/dist/atomic/VisuallyHidden/index.d.ts +1 -0
- package/dist/atomic/VisuallyHidden/index.d.ts.map +1 -1
- package/dist/chunk-ZCLMEZ46.js +3 -0
- package/dist/hooks/useSwipeToClose.d.ts +2 -0
- package/dist/hooks/useSwipeToClose.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/styles/index.css +165 -17
- package/dist/symbol-index.json +1 -0
- package/dist/utils/constants.d.ts +7 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +1 -0
- package/dist/utils/imageRetry.d.ts +24 -0
- package/dist/utils/imageRetry.d.ts.map +1 -0
- package/dist/utils/imageRetry.js +35 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/initRipple.d.ts +22 -0
- package/dist/utils/initRipple.d.ts.map +1 -0
- package/dist/utils/initRipple.js +77 -0
- package/dist/utils/variants.d.ts +2 -1
- package/dist/utils/variants.d.ts.map +1 -1
- package/guidelines/API_REFERENCE.md +195 -0
- package/guidelines/COMPONENTS.md +176 -0
- package/package.json +29 -28
- package/dist/chunk-FM52VMY6.js +0 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Image retry utility for failed loads
|
|
3
|
+
* @description Ref-based retry handler for <img> elements. When an image fails
|
|
4
|
+
* to load (rate limit, timeout, transient error), retries with exponential
|
|
5
|
+
* backoff and cache-busting. No React state - works via DOM data attributes.
|
|
6
|
+
*
|
|
7
|
+
* Browser-only: only invoked from onError (never fires during SSR).
|
|
8
|
+
*
|
|
9
|
+
* @version 0.1.0
|
|
10
|
+
* @since 0.0.26
|
|
11
|
+
* @author AMBROISE PARK Consulting
|
|
12
|
+
*/
|
|
13
|
+
import type { SyntheticEvent } from 'react';
|
|
14
|
+
/**
|
|
15
|
+
* onError handler for <img> elements. Retries loading with exponential backoff.
|
|
16
|
+
* Uses `data-retry` attribute on the element to track attempts (no React state needed).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <img src={url} onError={handleImageError} />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function handleImageError(e: SyntheticEvent<HTMLImageElement>): void;
|
|
24
|
+
//# sourceMappingURL=imageRetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageRetry.d.ts","sourceRoot":"","sources":["../../src/utils/imageRetry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAW5C;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,GAClC,IAAI,CAkBN"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// packages/components/src/utils/imageRetry.ts
|
|
2
|
+
/** Maximum retry attempts per image */
|
|
3
|
+
const MAX_RETRIES = 2;
|
|
4
|
+
/** Base delay between retries in ms (multiplied by attempt number) */
|
|
5
|
+
const BASE_DELAY_MS = 1500;
|
|
6
|
+
/** Protocols that are local/inline and won't benefit from retry */
|
|
7
|
+
const SKIP_PROTOCOLS = ['blob:', 'data:'];
|
|
8
|
+
/**
|
|
9
|
+
* onError handler for <img> elements. Retries loading with exponential backoff.
|
|
10
|
+
* Uses `data-retry` attribute on the element to track attempts (no React state needed).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <img src={url} onError={handleImageError} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function handleImageError(e) {
|
|
18
|
+
const img = e.currentTarget;
|
|
19
|
+
if (SKIP_PROTOCOLS.some((p) => img.src.startsWith(p)))
|
|
20
|
+
return;
|
|
21
|
+
const retry = parseInt(img.dataset.retry || '0', 10);
|
|
22
|
+
if (retry >= MAX_RETRIES)
|
|
23
|
+
return;
|
|
24
|
+
const nextRetry = retry + 1;
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
// Guard: element may have been removed from DOM during the delay
|
|
27
|
+
if (!img.isConnected)
|
|
28
|
+
return;
|
|
29
|
+
img.dataset.retry = String(nextRetry);
|
|
30
|
+
// Build clean base URL, then append cache-bust param
|
|
31
|
+
const url = new URL(img.src);
|
|
32
|
+
url.searchParams.set('_r', String(nextRetry));
|
|
33
|
+
img.src = url.toString();
|
|
34
|
+
}, BASE_DELAY_MS * nextRetry);
|
|
35
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export * from './constants';
|
|
10
10
|
export * from './eventListener';
|
|
11
|
+
export * from './initRipple';
|
|
11
12
|
export * from './intersectionObserver';
|
|
12
13
|
export * from './isDark';
|
|
13
14
|
export * from './helpers';
|
|
@@ -15,4 +16,5 @@ export * from './measurement';
|
|
|
15
16
|
export * from './rtl';
|
|
16
17
|
export * from './viewportDetection';
|
|
17
18
|
export * from './variants';
|
|
19
|
+
export * from './imageRetry';
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export * from './constants';
|
|
11
11
|
export * from './eventListener';
|
|
12
|
+
export * from './initRipple';
|
|
12
13
|
export * from './intersectionObserver';
|
|
13
14
|
export * from './isDark';
|
|
14
15
|
export * from './helpers';
|
|
@@ -16,3 +17,4 @@ export * from './measurement';
|
|
|
16
17
|
export * from './rtl';
|
|
17
18
|
export * from './viewportDetection';
|
|
18
19
|
export * from './variants';
|
|
20
|
+
export * from './imageRetry';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize ripple effect for all .dndev-interactive elements.
|
|
3
|
+
* Uses event delegation - only one listener for the entire document.
|
|
4
|
+
* Safe to call multiple times (no-op after first call).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // In your app root/provider
|
|
9
|
+
* import { initRipple } from '@donotdev/components';
|
|
10
|
+
*
|
|
11
|
+
* useEffect(() => {
|
|
12
|
+
* initRipple();
|
|
13
|
+
* }, []);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function initRipple(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Cleanup ripple event listener.
|
|
19
|
+
* Call when unmounting if needed (typically not required).
|
|
20
|
+
*/
|
|
21
|
+
export declare function destroyRipple(): void;
|
|
22
|
+
//# sourceMappingURL=initRipple.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initRipple.d.ts","sourceRoot":"","sources":["../../src/utils/initRipple.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAMjC;AA+CD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAMpC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// packages/components/src/utils/initRipple.ts
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Ripple effect initialization
|
|
4
|
+
* @description Event delegation for ripple effect on all .dndev-interactive elements.
|
|
5
|
+
* Call once at app startup. Uses CSS variable --ripple-opacity (0 = disabled).
|
|
6
|
+
*
|
|
7
|
+
* @version 0.1.0
|
|
8
|
+
* @since 0.1.0
|
|
9
|
+
* @author AMBROISE PARK Consulting
|
|
10
|
+
*/
|
|
11
|
+
let initialized = false;
|
|
12
|
+
/**
|
|
13
|
+
* Initialize ripple effect for all .dndev-interactive elements.
|
|
14
|
+
* Uses event delegation - only one listener for the entire document.
|
|
15
|
+
* Safe to call multiple times (no-op after first call).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // In your app root/provider
|
|
20
|
+
* import { initRipple } from '@donotdev/components';
|
|
21
|
+
*
|
|
22
|
+
* useEffect(() => {
|
|
23
|
+
* initRipple();
|
|
24
|
+
* }, []);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function initRipple() {
|
|
28
|
+
if (typeof document === 'undefined')
|
|
29
|
+
return;
|
|
30
|
+
if (initialized)
|
|
31
|
+
return;
|
|
32
|
+
initialized = true;
|
|
33
|
+
document.addEventListener('pointerdown', handleRipple, { passive: true });
|
|
34
|
+
}
|
|
35
|
+
function handleRipple(event) {
|
|
36
|
+
const target = event.target?.closest?.('.dndev-interactive');
|
|
37
|
+
if (!target)
|
|
38
|
+
return;
|
|
39
|
+
// Check if ripple is disabled via CSS variable
|
|
40
|
+
const styles = getComputedStyle(target);
|
|
41
|
+
const rippleOpacity = parseFloat(styles.getPropertyValue('--ripple-opacity').trim() || '0.2');
|
|
42
|
+
if (rippleOpacity <= 0)
|
|
43
|
+
return;
|
|
44
|
+
// Get click position relative to target
|
|
45
|
+
const rect = target.getBoundingClientRect();
|
|
46
|
+
const x = event.clientX - rect.left;
|
|
47
|
+
const y = event.clientY - rect.top;
|
|
48
|
+
// Calculate ripple size (diagonal of element)
|
|
49
|
+
const size = Math.max(rect.width, rect.height);
|
|
50
|
+
// Create ripple element
|
|
51
|
+
const ripple = document.createElement('span');
|
|
52
|
+
ripple.className = 'dndev-ripple';
|
|
53
|
+
ripple.style.cssText = `
|
|
54
|
+
width: ${size}px;
|
|
55
|
+
height: ${size}px;
|
|
56
|
+
left: ${x}px;
|
|
57
|
+
top: ${y}px;
|
|
58
|
+
`;
|
|
59
|
+
// Add to target
|
|
60
|
+
target.appendChild(ripple);
|
|
61
|
+
// Remove after animation completes
|
|
62
|
+
ripple.addEventListener('animationend', () => {
|
|
63
|
+
ripple.remove();
|
|
64
|
+
}, { once: true });
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Cleanup ripple event listener.
|
|
68
|
+
* Call when unmounting if needed (typically not required).
|
|
69
|
+
*/
|
|
70
|
+
export function destroyRipple() {
|
|
71
|
+
if (typeof document === 'undefined')
|
|
72
|
+
return;
|
|
73
|
+
if (!initialized)
|
|
74
|
+
return;
|
|
75
|
+
document.removeEventListener('pointerdown', handleRipple);
|
|
76
|
+
initialized = false;
|
|
77
|
+
}
|
package/dist/utils/variants.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
9
9
|
* Used by: Card, DualCard, StackedCards, Dialog, Sheet, Alert
|
|
10
10
|
*/
|
|
11
11
|
export declare const surfaceVariants: (props?: ({
|
|
12
|
-
variant?: "default" | "
|
|
12
|
+
variant?: "default" | "muted" | "accent" | "primary" | "destructive" | "outline" | "success" | "warning" | "secondary" | "glass" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
+
/** CVA variant props for surface components (Card, DualCard, etc.). */
|
|
14
15
|
export type SurfaceVariantProps = VariantProps<typeof surfaceVariants>;
|
|
15
16
|
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/utils/variants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;;GAIG;AACH,eAAO,MAAM,eAAe;;8EAkB1B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/utils/variants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;;GAIG;AACH,eAAO,MAAM,eAAe;;8EAkB1B,CAAC;AAEH,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Component API Reference
|
|
2
|
+
|
|
3
|
+
**SOURCE OF TRUTH. If prop not listed here, it does not exist.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Button
|
|
8
|
+
```tsx
|
|
9
|
+
<Button>Label</Button>
|
|
10
|
+
<Button variant="primary">Label</Button>
|
|
11
|
+
<Button onClick={fn}>Label</Button>
|
|
12
|
+
```
|
|
13
|
+
| Prop | Type | Default |
|
|
14
|
+
|------|------|---------|
|
|
15
|
+
| variant | `'default'` \| `'primary'` \| `'secondary'` \| `'accent'` \| `'destructive'` \| `'ghost'` \| `'outline'` \| `'link'` | `'default'` |
|
|
16
|
+
| icon | `LucideIcon` \| `ReactNode` | - |
|
|
17
|
+
| iconEnd | `boolean` | `false` |
|
|
18
|
+
| display | `'auto'` \| `'compact'` \| `'full'` | `'auto'` |
|
|
19
|
+
| tooltip | `string` | - |
|
|
20
|
+
| floating | `boolean` | `false` |
|
|
21
|
+
| fullWidth | `boolean` | `false` |
|
|
22
|
+
| loading | `boolean` | `false` |
|
|
23
|
+
| loadingText | `string` | - |
|
|
24
|
+
| progress | `number` (0-100) | - |
|
|
25
|
+
| disabled | `boolean` | `false` |
|
|
26
|
+
| render | `(props) => ReactNode` | - |
|
|
27
|
+
|
|
28
|
+
**NO: size, tone, gap**
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Text
|
|
33
|
+
```tsx
|
|
34
|
+
<Text>Content</Text>
|
|
35
|
+
<Text level="h1">Heading</Text>
|
|
36
|
+
<Text as="p">Paragraph</Text>
|
|
37
|
+
```
|
|
38
|
+
| Prop | Type | Default |
|
|
39
|
+
|------|------|---------|
|
|
40
|
+
| as | `'h1'`-`'h6'` \| `'p'` \| `'span'` \| `'div'` \| `'li'` \| `'label'` \| `'code'` | `'div'` |
|
|
41
|
+
| level | `'h1'`-`'h6'` \| `'body'` \| `'small'` \| `'caption'` | auto from `as` |
|
|
42
|
+
| variant | `'default'` \| `'muted'` \| `'primary'` \| `'secondary'` \| `'accent'` \| `'success'` \| `'warning'` \| `'destructive'` \| `'code'` | `'default'` |
|
|
43
|
+
| align | `'start'` \| `'center'` \| `'end'` | `'start'` |
|
|
44
|
+
| weight | `'normal'` \| `'medium'` \| `'semibold'` \| `'bold'` | - |
|
|
45
|
+
|
|
46
|
+
**NO: size, tone, color**
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Stack
|
|
51
|
+
```tsx
|
|
52
|
+
<Stack>children</Stack>
|
|
53
|
+
<Stack direction="row">children</Stack>
|
|
54
|
+
```
|
|
55
|
+
| Prop | Type | Default |
|
|
56
|
+
|------|------|---------|
|
|
57
|
+
| as | `ElementType` | `'div'` |
|
|
58
|
+
| direction | `'row'` \| `'column'` \| `'row-reverse'` \| `'column-reverse'` | `'column'` |
|
|
59
|
+
| align | `'start'` \| `'center'` \| `'end'` \| `'stretch'` \| `'baseline'` | `'stretch'` |
|
|
60
|
+
| justify | `'start'` \| `'center'` \| `'end'` \| `'between'` \| `'around'` \| `'evenly'` | `'start'` |
|
|
61
|
+
| gap | `'none'` \| `'tight'` \| `'medium'` \| `'large'` | `'medium'` |
|
|
62
|
+
| wrap | `'nowrap'` \| `'wrap'` \| `'wrap-reverse'` | `'nowrap'` |
|
|
63
|
+
| width | `'full'` \| `'fit'` \| `'auto'` | `'full'` |
|
|
64
|
+
| centered | `boolean` | `false` |
|
|
65
|
+
|
|
66
|
+
**NO: spacing, size**
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Card
|
|
71
|
+
```tsx
|
|
72
|
+
<Card>children</Card>
|
|
73
|
+
<Card title="Title">children</Card>
|
|
74
|
+
<Card onClick={fn}>children</Card>
|
|
75
|
+
```
|
|
76
|
+
| Prop | Type | Default |
|
|
77
|
+
|------|------|---------|
|
|
78
|
+
| variant | `'default'` \| `'muted'` \| `'primary'` \| `'secondary'` \| `'accent'` | `'default'` |
|
|
79
|
+
| title | `string` \| `ReactNode` | - |
|
|
80
|
+
| subtitle | `string` \| `ReactNode` | - |
|
|
81
|
+
| icon | `LucideIcon` | - |
|
|
82
|
+
| content | `string` \| `string[]` \| `ReactNode` | - |
|
|
83
|
+
| footer | `ReactNode` | - |
|
|
84
|
+
| onClick | `() => void` | - |
|
|
85
|
+
| clickable | `boolean` | auto from onClick |
|
|
86
|
+
| elevated | `boolean` | `false` |
|
|
87
|
+
| asChild | `boolean` | `false` |
|
|
88
|
+
|
|
89
|
+
**NO: size, padding, margin**
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Grid
|
|
94
|
+
```tsx
|
|
95
|
+
<Grid>children</Grid>
|
|
96
|
+
<Grid cols={3}>children</Grid>
|
|
97
|
+
<Grid cols={[1, 1, 2, 3]}>children</Grid>
|
|
98
|
+
```
|
|
99
|
+
| Prop | Type | Default |
|
|
100
|
+
|------|------|---------|
|
|
101
|
+
| as | `ElementType` | `'div'` |
|
|
102
|
+
| cols | `number` \| `[mobile, tablet, laptop, desktop]` | `1` |
|
|
103
|
+
| gap | `'none'` \| `'tight'` \| `'medium'` \| `'large'` | `'medium'` |
|
|
104
|
+
| align | `'start'` \| `'center'` \| `'end'` \| `'stretch'` | `'stretch'` |
|
|
105
|
+
| justify | `'start'` \| `'center'` \| `'end'` \| `'stretch'` | `'stretch'` |
|
|
106
|
+
|
|
107
|
+
**NO: spacing, columns (use cols)**
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Section
|
|
112
|
+
```tsx
|
|
113
|
+
<Section title="Title">children</Section>
|
|
114
|
+
```
|
|
115
|
+
| Prop | Type | Default |
|
|
116
|
+
|------|------|---------|
|
|
117
|
+
| as | `'section'` \| `'article'` \| `'aside'` \| `'div'` \| `'main'` | `'section'` |
|
|
118
|
+
| title | `string` | - |
|
|
119
|
+
| separator | `boolean` | `false` |
|
|
120
|
+
| tone | `'base'` \| `'muted'` \| `'elevated'` \| `'contrast'` \| `'accent'` | `'base'` |
|
|
121
|
+
| align | `'start'` \| `'center'` \| `'end'` | `'center'` |
|
|
122
|
+
| gridCols | `number` \| `[mobile, tablet, laptop, desktop]` | - |
|
|
123
|
+
| gridGap | `'none'` \| `'tight'` \| `'medium'` \| `'large'` | `'medium'` |
|
|
124
|
+
| collapsible | `boolean` | `false` |
|
|
125
|
+
| defaultOpen | `boolean` | `false` |
|
|
126
|
+
|
|
127
|
+
**NO: padding, margin, background**
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Badge
|
|
132
|
+
```tsx
|
|
133
|
+
<Badge>Label</Badge>
|
|
134
|
+
<Badge variant="primary">Label</Badge>
|
|
135
|
+
```
|
|
136
|
+
| Prop | Type | Default |
|
|
137
|
+
|------|------|---------|
|
|
138
|
+
| as | `'div'` \| `'span'` \| `'mark'` | `'div'` |
|
|
139
|
+
| variant | `'default'` \| `'muted'` \| `'primary'` \| `'secondary'` \| `'accent'` \| `'success'` \| `'warning'` \| `'destructive'` \| `'outline'` | `'default'` |
|
|
140
|
+
| tooltip | `string` | - |
|
|
141
|
+
|
|
142
|
+
**NO: size, color**
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Spinner
|
|
147
|
+
```tsx
|
|
148
|
+
<Spinner />
|
|
149
|
+
<Spinner overlay />
|
|
150
|
+
```
|
|
151
|
+
| Prop | Type | Default |
|
|
152
|
+
|------|------|---------|
|
|
153
|
+
| overlay | `boolean` | `false` |
|
|
154
|
+
| variant | `'default'` \| `'primary'` \| `'secondary'` \| `'accent'` \| `'success'` \| `'warning'` \| `'destructive'` | `'primary'` |
|
|
155
|
+
|
|
156
|
+
**NO: size**
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Separator
|
|
161
|
+
```tsx
|
|
162
|
+
<Separator />
|
|
163
|
+
```
|
|
164
|
+
| Prop | Type | Default |
|
|
165
|
+
|------|------|---------|
|
|
166
|
+
| orientation | `'horizontal'` \| `'vertical'` | `'horizontal'` |
|
|
167
|
+
| variant | `'default'` \| `'muted'` \| `'accent'` | `'default'` |
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## EntityFormRenderer
|
|
172
|
+
```tsx
|
|
173
|
+
<EntityFormRenderer entity={entity} operation="create" onSubmit={fn} />
|
|
174
|
+
```
|
|
175
|
+
| Prop | Type | Default |
|
|
176
|
+
|------|------|---------|
|
|
177
|
+
| entity | `Entity` | required |
|
|
178
|
+
| operation | `'create'` \| `'edit'` | `'create'` |
|
|
179
|
+
| onSubmit | `(data) => void` | required |
|
|
180
|
+
| defaultValues | `Record<string, unknown>` | - |
|
|
181
|
+
| loading | `boolean` | `false` |
|
|
182
|
+
| submitText | `string` | - |
|
|
183
|
+
| cancelText | `string` | - |
|
|
184
|
+
| onCancel | `() => void` | - |
|
|
185
|
+
| viewerRole | `string` | `'guest'` |
|
|
186
|
+
|
|
187
|
+
**NO: fields (renders all editable fields automatically)**
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## BEFORE WRITING JSX
|
|
192
|
+
|
|
193
|
+
1. Check this file
|
|
194
|
+
2. If prop not listed - don't use it
|
|
195
|
+
3. When in doubt - use defaults only
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Atomic Components Reference
|
|
2
|
+
|
|
3
|
+
**Check JSDoc in your IDE** - Hover over any component import to see props, types, and examples.
|
|
4
|
+
|
|
5
|
+
**Import from:** `@donotdev/components` (atomic UI)
|
|
6
|
+
|
|
7
|
+
**This is your GOTO Semantic React package**
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Layout Components
|
|
12
|
+
|
|
13
|
+
These are the only ways one should handle layout to get to quick results functionality wide.
|
|
14
|
+
- **Section** - Layout section with title, grid, tone system, and `bleed` prop for full-viewport-width content (images, maps, galleries).
|
|
15
|
+
- **Grid** - CSS Grid layout primitive with responsive column control.
|
|
16
|
+
- **Stack** - Flexbox layout for arranging items in rows or columns.
|
|
17
|
+
- **HeroSection** - Hero banner with title, subtitle, gradient backgrounds, `bleed` for full-width, and `backgroundImage` for cover images with overlay.
|
|
18
|
+
- **CallToAction** - Conversion-focused section with actions, `bleed` for full-width, and `backgroundImage` for cover images with overlay.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Content Components
|
|
23
|
+
|
|
24
|
+
- **Card** - Premium card component with title, content, footer, and elevation variants.
|
|
25
|
+
- **Navigation with middle-click support:** Wrap Card in Link component for navigation that supports middle-click (opens in new tab). See navigation section below.
|
|
26
|
+
- **DualCard** - Side-by-side card layout for comparison or feature showcases.
|
|
27
|
+
- **Text** - Typography component with semantic text variants.
|
|
28
|
+
- **Blockquote** - Styled blockquote for citations and testimonials.
|
|
29
|
+
- **List** - Bullet points, numbered lists, and feature lists with zero CSS. Use `icon` prop for custom icons, `icon={null}` for plain bullets.
|
|
30
|
+
- **DescriptionList** - Key-value pairs and metadata using semantic HTML (dl, dt, dd).
|
|
31
|
+
- **Separator** - Visual separator with semantic styling variants.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Action Components
|
|
36
|
+
|
|
37
|
+
- **Button** - Accessible button with variants, icons, tooltips, and render prop composition.
|
|
38
|
+
- **ActionButton** - Button with async action handling and loading states.
|
|
39
|
+
- **FileButton** - Button that triggers file input selection.
|
|
40
|
+
- **PortalButton** - Button that opens content in a portal overlay.
|
|
41
|
+
- **ButtonGroup** - Visual grouping of buttons with joined borders. Supports horizontal/vertical orientation, variant propagation, and items-based API.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Form Components
|
|
46
|
+
|
|
47
|
+
- **Input** - Accessible input with mobile-friendly touch targets and key state styling.
|
|
48
|
+
- **PasswordInput** - Password field with show/hide toggle functionality.
|
|
49
|
+
- **Textarea** - Multi-line text input component.
|
|
50
|
+
- **Label** - Accessible label with icon support and various positions.
|
|
51
|
+
- **Checkbox** - Accessible checkbox with custom styling.
|
|
52
|
+
- **RadioGroup** - Accessible radio group with multiple visual variants.
|
|
53
|
+
- **Select** - Accessible select dropdown with search and multi-select support.
|
|
54
|
+
- **Combobox** - Searchable combobox with autocomplete functionality.
|
|
55
|
+
- **Switch** - Toggle switch component.
|
|
56
|
+
- **Slider** - Range slider for numeric input.
|
|
57
|
+
- **ColorPicker** - Color selection with preset swatch grid, native color input, and ARIA radiogroup pattern. Built-in palettes: basic, material, pastel.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Feedback Components
|
|
62
|
+
|
|
63
|
+
- **Alert** - Attention-grabbing alert with semantic variants and icons.
|
|
64
|
+
- **AlertDialog** - Modal dialog that interrupts with important content expecting a response.
|
|
65
|
+
- **Dialog** - Accessible modal dialog with custom content sizes and actions.
|
|
66
|
+
- **Toast** - Toast notifications via Toaster component with ToastProvider.
|
|
67
|
+
- **Skeleton** - Loading state skeleton with multiple animation variants.
|
|
68
|
+
- **Spinner** - Loading spinner with multiple sizes and theme-aware colors.
|
|
69
|
+
- **Progress** - Progress bar component for task completion.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Navigation Components
|
|
74
|
+
|
|
75
|
+
- **Tabs** - Tabbed interface with props-based API and full keyboard navigation.
|
|
76
|
+
- **Accordion** - Vertically stacked headings that reveal content sections.
|
|
77
|
+
- **NavigationMenu** - Props-based navigation menu with nested menus and rich content.
|
|
78
|
+
- **Pagination** - Accessible pagination with page number generation and ellipsis.
|
|
79
|
+
- **Command** - Command palette component for keyboard navigation and search.
|
|
80
|
+
- **CommandDialog** - Command palette dialog optimized for Cmd+K navigation.
|
|
81
|
+
- **TreeView** - Hierarchical tree component with WAI-ARIA TreeView pattern. Supports expand/collapse, single/multi selection, keyboard navigation, type-ahead search, and connector lines.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Overlay Components
|
|
86
|
+
|
|
87
|
+
- **Popover** - Accessible popover displaying rich content in a portal.
|
|
88
|
+
- **Tooltip** - Tooltip component with positioning and delay controls.
|
|
89
|
+
- **HoverCard** - Card that appears on hover with rich content.
|
|
90
|
+
- **Sheet** - Slide-out panel for sidebars, mobile navigation, or editing panels.
|
|
91
|
+
- **ContextMenu** - Right-click context menu with nested submenus.
|
|
92
|
+
- **DropdownMenu** - Professional dropdown menu with props-based API.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Data Display Components
|
|
97
|
+
|
|
98
|
+
- **Table** - Accessible table component with sorting and selection.
|
|
99
|
+
- **DataTable** - High-level table with built-in sorting, filtering, search, and pagination.
|
|
100
|
+
- **Avatar** - Accessible avatar with image and fallback support.
|
|
101
|
+
- **Badge** - Status indicator with semantic variants (polymorphic: div, span, mark).
|
|
102
|
+
- **Tag** - Tag component for labels and categories.
|
|
103
|
+
- **Calendar** - Accessible date picker built on react-day-picker.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Utility Components
|
|
108
|
+
|
|
109
|
+
- **Collapsible** - Collapsible content component.
|
|
110
|
+
- **Toggle** - Toggle button component.
|
|
111
|
+
- **ToggleGroup** - Group of toggle buttons.
|
|
112
|
+
- **ScrollArea** - Scrollable area with custom scrollbars.
|
|
113
|
+
- **Portal** - Portal component for rendering outside DOM hierarchy.
|
|
114
|
+
- **VisuallyHidden** - Screen reader-only content component.
|
|
115
|
+
- **Slot** - Slot component for composition patterns.
|
|
116
|
+
- **SkipLink** - Accessibility skip-to-content links, visible only on keyboard focus. Supports multiple targets with smooth scroll and focus management.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Advanced Components
|
|
121
|
+
|
|
122
|
+
- **InfiniteScroll** - Infinite scroll component with load more functionality.
|
|
123
|
+
- **Stepper** - Step-by-step workflow component with navigation controls.
|
|
124
|
+
- **CopyToClipboard** - Copy to clipboard with visual feedback.
|
|
125
|
+
- **VideoPlayer** - Video player component with controls.
|
|
126
|
+
- **FeatureFallback** - Fallback UI when features are unavailable.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Icons
|
|
131
|
+
|
|
132
|
+
- **Icons** - Icon components from lucide-react and custom partner icons.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Navigation with Card Component
|
|
137
|
+
|
|
138
|
+
**For clickable cards with navigation support (including middle-click):**
|
|
139
|
+
|
|
140
|
+
Wrap Card in Link component from `@donotdev/ui`:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { Card } from '@donotdev/components';
|
|
144
|
+
import { Link } from '@donotdev/ui';
|
|
145
|
+
|
|
146
|
+
// Card with navigation (supports middle-click)
|
|
147
|
+
<Link
|
|
148
|
+
path="/about"
|
|
149
|
+
style={{ display: 'block', textDecoration: 'none', height: '100%' }}
|
|
150
|
+
aria-label="Learn more about About"
|
|
151
|
+
>
|
|
152
|
+
<Card
|
|
153
|
+
title="About"
|
|
154
|
+
subtitle="Learn more about us"
|
|
155
|
+
content="Click to navigate"
|
|
156
|
+
/>
|
|
157
|
+
</Link>
|
|
158
|
+
|
|
159
|
+
// Card with onClick only (no middle-click support)
|
|
160
|
+
<Card
|
|
161
|
+
title="Action Card"
|
|
162
|
+
onClick={() => handleAction()}
|
|
163
|
+
/>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Why wrap in Link?**
|
|
167
|
+
- Card component is standalone and not routing-aware
|
|
168
|
+
- Link wrapper provides framework navigation (SPA routing, keeps outlet context)
|
|
169
|
+
- Native browser middle-click support (opens in new tab)
|
|
170
|
+
- CSR/SSR safe
|
|
171
|
+
|
|
172
|
+
**Alternative:** Use FeatureCard from `@donotdev/ui` which handles this automatically when `href` prop is provided.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
**All props documented in JSDoc** - Hover in IDE for complete reference.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Styled UI components for DoNotDev",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
21
|
+
"guidelines",
|
|
21
22
|
"package.json",
|
|
22
23
|
"README.md",
|
|
23
24
|
"LICENSE.md"
|
|
@@ -48,33 +49,33 @@
|
|
|
48
49
|
"type-check": "bunx tsc --noEmit"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
52
|
-
"@radix-ui/react-alert-dialog": "^1.1.
|
|
53
|
-
"@radix-ui/react-avatar": "^1.1.
|
|
54
|
-
"@radix-ui/react-checkbox": "^1.
|
|
55
|
-
"@radix-ui/react-collapsible": "^1.1.
|
|
56
|
-
"@radix-ui/react-context-menu": "^2.2.
|
|
57
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
58
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
59
|
-
"@radix-ui/react-hover-card": "^1.1.
|
|
60
|
-
"@radix-ui/react-label": "^2.1.
|
|
61
|
-
"@radix-ui/react-navigation-menu": "^1.2.
|
|
62
|
-
"@radix-ui/react-popover": "^1.1.
|
|
63
|
-
"@radix-ui/react-portal": "^1.1.
|
|
64
|
-
"@radix-ui/react-progress": "^1.1.
|
|
65
|
-
"@radix-ui/react-radio-group": "^1.
|
|
66
|
-
"@radix-ui/react-scroll-area": "^1.2.
|
|
67
|
-
"@radix-ui/react-select": "^2.
|
|
68
|
-
"@radix-ui/react-separator": "^1.1.
|
|
69
|
-
"@radix-ui/react-slider": "^1.
|
|
70
|
-
"@radix-ui/react-slot": "^1.
|
|
71
|
-
"@radix-ui/react-switch": "^1.
|
|
72
|
-
"@radix-ui/react-tabs": "^1.1.
|
|
73
|
-
"@radix-ui/react-toast": "^1.2.
|
|
74
|
-
"@radix-ui/react-toggle": "^1.1.
|
|
75
|
-
"@radix-ui/react-toggle-group": "^1.1.
|
|
76
|
-
"@radix-ui/react-tooltip": "^1.
|
|
77
|
-
"@radix-ui/react-visually-hidden": "^1.2.
|
|
52
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
53
|
+
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
54
|
+
"@radix-ui/react-avatar": "^1.1.11",
|
|
55
|
+
"@radix-ui/react-checkbox": "^1.3.3",
|
|
56
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
57
|
+
"@radix-ui/react-context-menu": "^2.2.16",
|
|
58
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
59
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
60
|
+
"@radix-ui/react-hover-card": "^1.1.15",
|
|
61
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
62
|
+
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
63
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
64
|
+
"@radix-ui/react-portal": "^1.1.10",
|
|
65
|
+
"@radix-ui/react-progress": "^1.1.8",
|
|
66
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
67
|
+
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
68
|
+
"@radix-ui/react-select": "^2.2.6",
|
|
69
|
+
"@radix-ui/react-separator": "^1.1.8",
|
|
70
|
+
"@radix-ui/react-slider": "^1.3.6",
|
|
71
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
72
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
73
|
+
"@radix-ui/react-tabs": "^1.1.13",
|
|
74
|
+
"@radix-ui/react-toast": "^1.2.15",
|
|
75
|
+
"@radix-ui/react-toggle": "^1.1.10",
|
|
76
|
+
"@radix-ui/react-toggle-group": "^1.1.11",
|
|
77
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
78
|
+
"@radix-ui/react-visually-hidden": "^1.2.4",
|
|
78
79
|
"class-variance-authority": "^0.7.1",
|
|
79
80
|
"clsx": "^2.1.1",
|
|
80
81
|
"react-day-picker": "^9.13.2"
|