@donotdev/components 0.3.1 → 0.3.2
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/Bento/Bento.js +1 -37
- package/dist/advanced/Bento/index.js +1 -2
- package/dist/advanced/Carousel/Carousel.js +1 -36
- package/dist/advanced/Carousel/CarouselContent.d.ts.map +1 -1
- package/dist/advanced/Carousel/CarouselContent.js +1 -653
- package/dist/advanced/Carousel/CarouselSkeleton.js +1 -51
- package/dist/advanced/Carousel/index.js +1 -2
- package/dist/advanced/Code/Code.js +2 -35
- package/dist/advanced/Code/CodeContent.d.ts.map +1 -1
- package/dist/advanced/Code/CodeContent.js +2 -182
- package/dist/advanced/Code/CodeSkeleton.js +1 -51
- package/dist/advanced/Code/index.js +1 -2
- package/dist/advanced/Crawl/Crawl.d.ts.map +1 -1
- package/dist/advanced/Crawl/Crawl.js +1 -84
- package/dist/advanced/Crawl/CrawlContent.d.ts.map +1 -1
- package/dist/advanced/Crawl/CrawlContent.js +1 -118
- package/dist/advanced/Crawl/index.js +1 -3
- package/dist/advanced/Crawl/utils/parseHtml.js +1 -159
- package/dist/advanced/ImageGallery/GalleryArrows.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/GalleryArrows.js +1 -13
- package/dist/advanced/ImageGallery/ImageGallery.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/ImageGallery.js +1 -181
- package/dist/advanced/ImageGallery/LightboxViewer.js +1 -138
- package/dist/advanced/ImageGallery/index.js +1 -2
- package/dist/advanced/ImageGallery/lightboxGestures.js +1 -425
- package/dist/advanced/ImageGallery/protectImages.js +1 -10
- package/dist/advanced/ImageGallery/snapStrip.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/snapStrip.js +1 -74
- package/dist/advanced/JsonViewer/JsonViewer.js +1 -141
- package/dist/advanced/JsonViewer/index.js +1 -3
- package/dist/advanced/Marquee/Marquee.js +1 -35
- package/dist/advanced/Marquee/MarqueeContent.d.ts.map +1 -1
- package/dist/advanced/Marquee/MarqueeContent.js +1 -193
- package/dist/advanced/Marquee/MarqueeSkeleton.js +1 -36
- package/dist/advanced/Marquee/index.js +1 -3
- package/dist/advanced/Reveal/Reveal.d.ts.map +1 -1
- package/dist/advanced/Reveal/Reveal.js +1 -60
- package/dist/advanced/Reveal/index.js +1 -3
- package/dist/advanced/Roadmap/Roadmap.js +1 -6
- package/dist/advanced/Roadmap/RoadmapContent.d.ts.map +1 -1
- package/dist/advanced/Roadmap/RoadmapContent.js +1 -59
- package/dist/advanced/Roadmap/index.js +1 -3
- package/dist/advanced/SplitReveal/SplitReveal.js +1 -34
- package/dist/advanced/SplitReveal/index.js +1 -2
- package/dist/advanced/StackedCards/StackedCards.js +1 -22
- package/dist/advanced/StackedCards/StackedCardsContent.d.ts.map +1 -1
- package/dist/advanced/StackedCards/StackedCardsContent.js +1 -42
- package/dist/advanced/StackedCards/index.js +1 -3
- package/dist/advanced/index.js +1 -20
- package/dist/atomic/Accordion/AccordionPrimitive.d.ts +5 -1
- package/dist/atomic/Accordion/AccordionPrimitive.d.ts.map +1 -1
- package/dist/atomic/Accordion/AccordionPrimitive.js +1 -29
- package/dist/atomic/Accordion/index.d.ts +9 -1
- package/dist/atomic/Accordion/index.d.ts.map +1 -1
- package/dist/atomic/Accordion/index.js +1 -38
- package/dist/atomic/ActionButton/index.js +1 -70
- package/dist/atomic/ActionButton/useAction.d.ts.map +1 -1
- package/dist/atomic/ActionButton/useAction.js +1 -64
- package/dist/atomic/Alert/index.d.ts +1 -1
- package/dist/atomic/Alert/index.js +1 -78
- package/dist/atomic/AlertDialog/AlertDialogPrimitive.d.ts.map +1 -1
- package/dist/atomic/AlertDialog/AlertDialogPrimitive.js +1 -25
- package/dist/atomic/AlertDialog/index.d.ts.map +1 -1
- package/dist/atomic/AlertDialog/index.js +1 -36
- package/dist/atomic/Avatar/AvatarPrimitive.d.ts.map +1 -1
- package/dist/atomic/Avatar/AvatarPrimitive.js +1 -16
- package/dist/atomic/Avatar/index.js +1 -17
- package/dist/atomic/Badge/index.d.ts +1 -1
- package/dist/atomic/Badge/index.js +1 -84
- package/dist/atomic/Blockquote/index.js +1 -72
- package/dist/atomic/Button/index.d.ts +1 -1
- package/dist/atomic/Button/index.js +1 -173
- package/dist/atomic/ButtonGroup/index.d.ts.map +1 -1
- package/dist/atomic/ButtonGroup/index.js +1 -57
- package/dist/atomic/Calendar/CalendarPrimitive.d.ts.map +1 -1
- package/dist/atomic/Calendar/CalendarPrimitive.js +1 -10
- package/dist/atomic/Calendar/LazyCalendar.d.ts +38 -0
- package/dist/atomic/Calendar/LazyCalendar.d.ts.map +1 -0
- package/dist/atomic/Calendar/LazyCalendar.js +1 -0
- package/dist/atomic/Calendar/index.d.ts.map +1 -1
- package/dist/atomic/Calendar/index.js +1 -74
- package/dist/atomic/CallToAction/index.js +1 -78
- package/dist/atomic/Card/cover.js +1 -40
- package/dist/atomic/Card/index.d.ts +12 -2
- package/dist/atomic/Card/index.d.ts.map +1 -1
- package/dist/atomic/Card/index.js +1 -190
- package/dist/atomic/Checkbox/CheckboxPrimitive.d.ts.map +1 -1
- package/dist/atomic/Checkbox/CheckboxPrimitive.js +1 -26
- package/dist/atomic/Checkbox/index.js +1 -69
- package/dist/atomic/Collapsible/CollapsiblePrimitive.d.ts.map +1 -1
- package/dist/atomic/Collapsible/CollapsiblePrimitive.js +1 -25
- package/dist/atomic/Collapsible/index.d.ts.map +1 -1
- package/dist/atomic/Collapsible/index.js +1 -61
- package/dist/atomic/ColorPicker/index.d.ts.map +1 -1
- package/dist/atomic/ColorPicker/index.js +1 -196
- package/dist/atomic/Combobox/index.d.ts.map +1 -1
- package/dist/atomic/Combobox/index.js +1 -278
- package/dist/atomic/Command/index.d.ts.map +1 -1
- package/dist/atomic/Command/index.js +1 -115
- package/dist/atomic/CommandDialog/index.d.ts.map +1 -1
- package/dist/atomic/CommandDialog/index.js +1 -34
- package/dist/atomic/ContextMenu/ContextMenuPrimitive.d.ts.map +1 -1
- package/dist/atomic/ContextMenu/ContextMenuPrimitive.js +1 -32
- package/dist/atomic/ContextMenu/index.d.ts.map +1 -1
- package/dist/atomic/ContextMenu/index.js +1 -52
- package/dist/atomic/CopyToClipboard/index.d.ts.map +1 -1
- package/dist/atomic/CopyToClipboard/index.js +1 -61
- package/dist/atomic/DatePicker/index.d.ts +3 -1
- package/dist/atomic/DatePicker/index.d.ts.map +1 -1
- package/dist/atomic/DatePicker/index.js +1 -377
- package/dist/atomic/DateTimePicker/index.d.ts +3 -1
- package/dist/atomic/DateTimePicker/index.d.ts.map +1 -1
- package/dist/atomic/DateTimePicker/index.js +1 -460
- package/dist/atomic/DescriptionList/index.js +1 -30
- package/dist/atomic/Dialog/DialogPrimitive.d.ts.map +1 -1
- package/dist/atomic/Dialog/DialogPrimitive.js +1 -20
- package/dist/atomic/Dialog/index.d.ts.map +1 -1
- package/dist/atomic/Dialog/index.js +1 -63
- package/dist/atomic/DropdownMenu/DropdownMenuPrimitive.d.ts.map +1 -1
- package/dist/atomic/DropdownMenu/DropdownMenuPrimitive.js +1 -34
- package/dist/atomic/DropdownMenu/index.d.ts.map +1 -1
- package/dist/atomic/DropdownMenu/index.js +1 -121
- package/dist/atomic/DualCard/index.d.ts.map +1 -1
- package/dist/atomic/DualCard/index.js +1 -42
- package/dist/atomic/FeatureFallback/index.js +1 -32
- package/dist/atomic/FileButton/index.d.ts.map +1 -1
- package/dist/atomic/FileButton/index.js +1 -35
- package/dist/atomic/Grid/GridArea.js +1 -70
- package/dist/atomic/Grid/index.js +1 -118
- package/dist/atomic/HeroSection/index.d.ts +1 -1
- package/dist/atomic/HeroSection/index.js +1 -138
- package/dist/atomic/HoverCard/HoverCardPrimitive.d.ts.map +1 -1
- package/dist/atomic/HoverCard/HoverCardPrimitive.js +1 -19
- package/dist/atomic/HoverCard/index.d.ts.map +1 -1
- package/dist/atomic/HoverCard/index.js +1 -57
- package/dist/atomic/Icons/Icon.js +1 -37
- package/dist/atomic/Icons/IconBox.js +1 -49
- package/dist/atomic/Icons/Partner/AppleIcon.js +1 -31
- package/dist/atomic/Icons/Partner/DiscordIcon.js +1 -15
- package/dist/atomic/Icons/Partner/FacebookIcon.js +1 -15
- package/dist/atomic/Icons/Partner/GitHubIcon.js +1 -15
- package/dist/atomic/Icons/Partner/GoogleIcon.js +1 -15
- package/dist/atomic/Icons/Partner/InstagramIcon.js +1 -29
- package/dist/atomic/Icons/Partner/LinkedinIcon.js +1 -20
- package/dist/atomic/Icons/Partner/MastodonIcon.js +1 -19
- package/dist/atomic/Icons/Partner/MediumIcon.js +1 -19
- package/dist/atomic/Icons/Partner/MicrosoftIcon.js +1 -15
- package/dist/atomic/Icons/Partner/NotionIcon.js +1 -15
- package/dist/atomic/Icons/Partner/RedditIcon.js +1 -15
- package/dist/atomic/Icons/Partner/SlackIcon.js +1 -15
- package/dist/atomic/Icons/Partner/SpotifyIcon.js +1 -15
- package/dist/atomic/Icons/Partner/SupabaseIcon.js +1 -16
- package/dist/atomic/Icons/Partner/TwitchIcon.js +1 -15
- package/dist/atomic/Icons/Partner/XIcon.js +1 -15
- package/dist/atomic/Icons/Partner/YahooIcon.js +1 -15
- package/dist/atomic/Icons/Partner/YouTubeIcon.js +1 -19
- package/dist/atomic/Icons/Partner/index.js +1 -25
- package/dist/atomic/Icons/Partner/providerIcons.js +1 -98
- package/dist/atomic/Icons/index.js +1 -8
- package/dist/atomic/InfiniteScroll/index.d.ts.map +1 -1
- package/dist/atomic/InfiniteScroll/index.js +1 -53
- package/dist/atomic/Input/index.d.ts.map +1 -1
- package/dist/atomic/Input/index.js +1 -63
- package/dist/atomic/Label/FieldInfo.js +1 -34
- package/dist/atomic/Label/FloatingLabel.js +1 -35
- package/dist/atomic/Label/LabelPrimitive.d.ts.map +1 -1
- package/dist/atomic/Label/LabelPrimitive.js +1 -16
- package/dist/atomic/Label/index.js +1 -23
- package/dist/atomic/List/index.js +1 -48
- package/dist/atomic/NavigationMenu/NavigationMenuPrimitive.d.ts.map +1 -1
- package/dist/atomic/NavigationMenu/NavigationMenuPrimitive.js +1 -28
- package/dist/atomic/NavigationMenu/index.js +1 -72
- package/dist/atomic/Pagination/index.d.ts.map +1 -1
- package/dist/atomic/Pagination/index.js +1 -107
- package/dist/atomic/PasswordInput/index.d.ts.map +1 -1
- package/dist/atomic/PasswordInput/index.js +1 -66
- package/dist/atomic/PinInput/index.d.ts.map +1 -1
- package/dist/atomic/PinInput/index.js +1 -155
- package/dist/atomic/Popover/PopoverPrimitive.d.ts.map +1 -1
- package/dist/atomic/Popover/PopoverPrimitive.js +1 -29
- package/dist/atomic/Popover/index.d.ts.map +1 -1
- package/dist/atomic/Popover/index.js +1 -38
- package/dist/atomic/Portal/PortalPrimitive.d.ts.map +1 -1
- package/dist/atomic/Portal/PortalPrimitive.js +1 -21
- package/dist/atomic/Portal/index.js +1 -10
- package/dist/atomic/PortalButton/index.js +1 -33
- package/dist/atomic/Progress/ProgressPrimitive.d.ts.map +1 -1
- package/dist/atomic/Progress/ProgressPrimitive.js +1 -28
- package/dist/atomic/Progress/index.js +1 -15
- package/dist/atomic/QuantityStepper/index.js +1 -239
- package/dist/atomic/QuantityStepper/quantity.js +1 -35
- package/dist/atomic/RadioGroup/RadioGroupPrimitive.d.ts.map +1 -1
- package/dist/atomic/RadioGroup/RadioGroupPrimitive.js +1 -17
- package/dist/atomic/RadioGroup/index.js +1 -63
- package/dist/atomic/RangeInput/index.d.ts.map +1 -1
- package/dist/atomic/RangeInput/index.js +1 -62
- package/dist/atomic/Rating/index.d.ts +1 -1
- package/dist/atomic/Rating/index.d.ts.map +1 -1
- package/dist/atomic/Rating/index.js +1 -115
- package/dist/atomic/ScrollArea/ScrollAreaPrimitive.d.ts.map +1 -1
- package/dist/atomic/ScrollArea/ScrollAreaPrimitive.js +1 -18
- package/dist/atomic/ScrollArea/index.js +1 -22
- package/dist/atomic/Section/index.d.ts +6 -0
- package/dist/atomic/Section/index.d.ts.map +1 -1
- package/dist/atomic/Section/index.js +1 -119
- package/dist/atomic/Select/SelectPrimitive.d.ts.map +1 -1
- package/dist/atomic/Select/SelectPrimitive.js +1 -27
- package/dist/atomic/Select/index.d.ts.map +1 -1
- package/dist/atomic/Select/index.js +1 -58
- package/dist/atomic/Separator/SeparatorPrimitive.d.ts.map +1 -1
- package/dist/atomic/Separator/SeparatorPrimitive.js +1 -15
- package/dist/atomic/Separator/index.js +1 -47
- package/dist/atomic/Sheet/SheetPrimitive.d.ts.map +1 -1
- package/dist/atomic/Sheet/SheetPrimitive.js +1 -24
- package/dist/atomic/Sheet/index.d.ts.map +1 -1
- package/dist/atomic/Sheet/index.js +1 -66
- package/dist/atomic/Skeleton/index.js +1 -73
- package/dist/atomic/SkipLink/index.d.ts.map +1 -1
- package/dist/atomic/SkipLink/index.js +1 -45
- package/dist/atomic/Slider/SliderPrimitive.d.ts.map +1 -1
- package/dist/atomic/Slider/SliderPrimitive.js +1 -35
- package/dist/atomic/Slider/index.d.ts +11 -2
- package/dist/atomic/Slider/index.d.ts.map +1 -1
- package/dist/atomic/Slider/index.js +1 -59
- package/dist/atomic/Slot/SlotPrimitive.d.ts.map +1 -1
- package/dist/atomic/Slot/SlotPrimitive.js +1 -10
- package/dist/atomic/Slot/index.js +1 -21
- package/dist/atomic/Spinner/index.js +1 -72
- package/dist/atomic/Stack/index.js +1 -84
- package/dist/atomic/Stepper/index.d.ts +1 -1
- package/dist/atomic/Stepper/index.d.ts.map +1 -1
- package/dist/atomic/Stepper/index.js +1 -100
- package/dist/atomic/SwipeAction/index.js +1 -62
- package/dist/atomic/Switch/SwitchPrimitive.d.ts.map +1 -1
- package/dist/atomic/Switch/SwitchPrimitive.js +1 -28
- package/dist/atomic/Switch/index.d.ts.map +1 -1
- package/dist/atomic/Switch/index.js +1 -82
- package/dist/atomic/Table/editing.d.ts.map +1 -1
- package/dist/atomic/Table/editing.js +4 -173
- package/dist/atomic/Table/index.d.ts.map +1 -1
- package/dist/atomic/Table/index.js +3 -419
- package/dist/atomic/Tabs/TabsPrimitive.d.ts.map +1 -1
- package/dist/atomic/Tabs/TabsPrimitive.js +1 -17
- package/dist/atomic/Tabs/index.d.ts +1 -1
- package/dist/atomic/Tabs/index.d.ts.map +1 -1
- package/dist/atomic/Tabs/index.js +1 -124
- package/dist/atomic/Tag/index.d.ts.map +1 -1
- package/dist/atomic/Tag/index.js +1 -60
- package/dist/atomic/Text/index.js +3 -116
- package/dist/atomic/Textarea/index.js +1 -20
- package/dist/atomic/Toaster/Toast.types.js +0 -2
- package/dist/atomic/Toaster/ToastPrimitive.d.ts +1 -1
- package/dist/atomic/Toaster/ToastPrimitive.d.ts.map +1 -1
- package/dist/atomic/Toaster/ToastPrimitive.js +1 -68
- package/dist/atomic/Toaster/index.d.ts.map +1 -1
- package/dist/atomic/Toaster/index.js +1 -30
- package/dist/atomic/Toggle/TogglePrimitive.d.ts.map +1 -1
- package/dist/atomic/Toggle/TogglePrimitive.js +1 -16
- package/dist/atomic/Toggle/index.d.ts +1 -1
- package/dist/atomic/Toggle/index.js +1 -41
- package/dist/atomic/ToggleGroup/ToggleGroupPrimitive.d.ts.map +1 -1
- package/dist/atomic/ToggleGroup/ToggleGroupPrimitive.js +1 -36
- package/dist/atomic/ToggleGroup/index.js +1 -64
- package/dist/atomic/Tooltip/TooltipPrimitive.d.ts.map +1 -1
- package/dist/atomic/Tooltip/TooltipPrimitive.js +1 -20
- package/dist/atomic/Tooltip/index.js +1 -84
- package/dist/atomic/TreeView/index.d.ts.map +1 -1
- package/dist/atomic/TreeView/index.js +1 -316
- package/dist/atomic/VideoPlayer/index.d.ts.map +1 -1
- package/dist/atomic/VideoPlayer/index.js +1 -204
- package/dist/atomic/VisuallyHidden/VisuallyHiddenPrimitive.d.ts.map +1 -1
- package/dist/atomic/VisuallyHidden/VisuallyHiddenPrimitive.js +1 -10
- package/dist/atomic/VisuallyHidden/index.js +1 -4
- package/dist/atomic/index.js +1 -124
- package/dist/hooks/index.js +1 -14
- package/dist/hooks/useClickOutside.d.ts.map +1 -1
- package/dist/hooks/useClickOutside.js +1 -128
- package/dist/hooks/useIntersectionObserver.d.ts.map +1 -1
- package/dist/hooks/useIntersectionObserver.js +1 -222
- package/dist/hooks/useSwipeToClose.d.ts.map +1 -1
- package/dist/hooks/useSwipeToClose.js +1 -280
- package/dist/hooks/useToast.d.ts +1 -1
- package/dist/hooks/useToast.d.ts.map +1 -1
- package/dist/hooks/useToast.js +1 -419
- package/dist/hooks/useViewportVisibility.d.ts.map +1 -1
- package/dist/hooks/useViewportVisibility.js +1 -110
- package/dist/index.js +1 -12
- package/dist/rsc.d.ts +47 -0
- package/dist/rsc.d.ts.map +1 -0
- package/dist/rsc.js +1 -0
- package/dist/styles/componentConstants.js +1 -184
- package/dist/styles/index.css +25 -4
- package/dist/styles/index.js +1 -10
- package/dist/symbol-index.json +1 -1
- package/dist/types.js +0 -2
- package/dist/utils/constants.js +1 -62
- package/dist/utils/cssVars.js +1 -10
- package/dist/utils/date.js +1 -130
- package/dist/utils/eventListener.js +1 -57
- package/dist/utils/helpers.js +1 -58
- package/dist/utils/imageRetry.js +1 -35
- package/dist/utils/index.js +1 -24
- package/dist/utils/initRipple.js +6 -84
- package/dist/utils/intersectionObserver.js +1 -184
- package/dist/utils/isDark.d.ts.map +1 -1
- package/dist/utils/isDark.js +1 -69
- package/dist/utils/linkComponent.d.ts.map +1 -1
- package/dist/utils/linkComponent.js +1 -37
- package/dist/utils/measurement.js +1 -197
- package/dist/utils/responsiveImage.js +1 -45
- package/dist/utils/rtl.js +1 -56
- package/dist/utils/sanitizeHtml.js +1 -43
- package/dist/utils/variants.d.ts +1 -1
- package/dist/utils/variants.js +1 -31
- package/dist/utils/viewportDetection.js +1 -86
- package/guidelines/API_REFERENCE.md +34 -0
- package/guidelines/COMPONENTS.md +1 -1
- package/package.json +5 -1
- package/dist/CarouselContent-5W2E2F2I.js +0 -1
- package/dist/CarouselContent-EELYAALW.js +0 -1
- package/dist/CarouselContent-KLQY6OVW.css +0 -1
- package/dist/CarouselContent-MQPZBYOS.js +0 -1
- package/dist/CodeContent-265AM7HO.css +0 -1
- package/dist/CodeContent-64D4U3NM.js +0 -2
- package/dist/CodeContent-7FWYPAB3.js +0 -2
- package/dist/CodeContent-E3HLW6BW.js +0 -2
- package/dist/CrawlContent-5Z6AVDDW.js +0 -1
- package/dist/MarqueeContent-7BVN7TX3.css +0 -1
- package/dist/MarqueeContent-KAYCOUNM.js +0 -1
- package/dist/atomic/SwipeAction/gesture.d.ts +0 -5
- package/dist/atomic/SwipeAction/gesture.d.ts.map +0 -1
- package/dist/atomic/SwipeAction/gesture.js +0 -10
- package/dist/chunk-3WHSDDVJ.js +0 -1
- package/dist/chunk-CIBFOOWV.js +0 -1
- package/dist/chunk-IFHHPSKN.js +0 -1
- package/dist/chunk-JAV36ZQC.js +0 -3
- package/dist/chunk-O2XFH626.js +0 -1
- package/dist/chunk-SZNEXFUZ.js +0 -3
- package/dist/chunk-UTPWB5VD.js +0 -1
- package/dist/chunk-XK52GUFA.js +0 -3
|
@@ -1,72 +1 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
// packages/components/src/atomic/Blockquote/index.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview Blockquote component
|
|
5
|
-
* @description Semantic blockquote component for quotes and testimonials
|
|
6
|
-
*
|
|
7
|
-
* @version 0.1.0
|
|
8
|
-
* @since 0.0.1
|
|
9
|
-
* @author AMBROISE PARK Consulting
|
|
10
|
-
*/
|
|
11
|
-
import { forwardRef } from 'react';
|
|
12
|
-
import { cn } from '../../utils/helpers';
|
|
13
|
-
import Stack from '../Stack';
|
|
14
|
-
import Text, { TEXT_VARIANT } from '../Text';
|
|
15
|
-
/**
|
|
16
|
-
* Blockquote variant constants - Industry-standard patterns
|
|
17
|
-
*
|
|
18
|
-
* @version 0.1.0
|
|
19
|
-
* @since 0.0.1
|
|
20
|
-
* @author AMBROISE PARK Consulting
|
|
21
|
-
*/
|
|
22
|
-
export const BLOCKQUOTE_VARIANT = {
|
|
23
|
-
/** Documentation style - Left border, subtle bg, optimized for technical content */
|
|
24
|
-
DEFAULT: 'default',
|
|
25
|
-
/** Editorial style - Serif, italic, optimized for long-form articles */
|
|
26
|
-
EDITORIAL: 'editorial',
|
|
27
|
-
/** Testimonial style - Elevated card with decorative quote, optimized for marketing */
|
|
28
|
-
TESTIMONIAL: 'testimonial',
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Semantic blockquote component for quotes and testimonials.
|
|
32
|
-
* Uses accessible <figure> + <blockquote> + <figcaption> pattern.
|
|
33
|
-
*
|
|
34
|
-
* Three variants optimized for different use cases:
|
|
35
|
-
* - default: Documentation style - technical content, tutorials
|
|
36
|
-
* - editorial: Editorial style - long-form articles and blogs
|
|
37
|
-
* - testimonial: Marketing style - landing pages and testimonials
|
|
38
|
-
*
|
|
39
|
-
* @component
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* // Documentation quote (default)
|
|
43
|
-
* <Blockquote>
|
|
44
|
-
* The web is inclusive by default.
|
|
45
|
-
* </Blockquote>
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```tsx
|
|
50
|
-
* // Editorial quote with attribution
|
|
51
|
-
* <Blockquote variant="editorial" author="Technology Leader">
|
|
52
|
-
* The best way to predict the future is to invent it.
|
|
53
|
-
* </Blockquote>
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```tsx
|
|
58
|
-
* // Testimonial with source link
|
|
59
|
-
* <Blockquote variant="testimonial" author="Customer Name" source="Company" cite="https://example.com">
|
|
60
|
-
* This framework saved us weeks of development time.
|
|
61
|
-
* </Blockquote>
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @param {BlockquoteProps} props - The props for the blockquote
|
|
65
|
-
* @returns {JSX.Element} The rendered blockquote
|
|
66
|
-
*/
|
|
67
|
-
const Blockquote = forwardRef(function Blockquote({ children, author, source, cite, variant = BLOCKQUOTE_VARIANT.DEFAULT, className, ...props }, ref) {
|
|
68
|
-
const hasAttribution = author || source;
|
|
69
|
-
return (_jsxs("figure", { ref: ref, className: cn('dndev-blockquote', className), "data-variant": variant, ...props, children: [_jsx("blockquote", { cite: cite, children: _jsx("p", { className: "dndev-blockquote-content", children: children }) }), hasAttribution && (_jsxs("figcaption", { className: "dndev-blockquote-caption", children: [author && _jsx("cite", { className: "dndev-blockquote-author", children: author }), source && (_jsx(Text, { as: "span", variant: TEXT_VARIANT.MUTED, className: "dndev-blockquote-source", children: author ? `, ${source}` : source }))] }))] }));
|
|
70
|
-
});
|
|
71
|
-
Blockquote.displayName = 'Blockquote';
|
|
72
|
-
export default Blockquote;
|
|
1
|
+
import{forwardRef as f}from"react";import{cn as d}from"../../utils/helpers.js";import"../Stack/index.js";import m,{TEXT_VARIANT as u}from"../Text/index.js";import{jsx as o,jsxs as a}from"react/jsx-runtime";var A={DEFAULT:"default",EDITORIAL:"editorial",TESTIMONIAL:"testimonial"},c=f(function({children:i,author:t,source:e,cite:r,variant:n=A.DEFAULT,className:l,...s},T){let p=t||e;return a("figure",{ref:T,className:d("dndev-blockquote",l),"data-variant":n,...s,children:[o("blockquote",{cite:r,children:o("p",{className:"dndev-blockquote-content",children:i})}),p&&a("figcaption",{className:"dndev-blockquote-caption",children:[t&&o("cite",{className:"dndev-blockquote-author",children:t}),e&&o(m,{as:"span",variant:u.MUTED,className:"dndev-blockquote-source",children:t?`, ${e}`:e})]})]})});c.displayName="Blockquote";var B=c;export{A as BLOCKQUOTE_VARIANT,B as default};
|
|
@@ -21,7 +21,7 @@ export declare const BUTTON_VARIANT: {
|
|
|
21
21
|
readonly DESTRUCTIVE: "destructive";
|
|
22
22
|
};
|
|
23
23
|
declare const buttonVariants: (props?: ({
|
|
24
|
-
variant?: "default" | "
|
|
24
|
+
variant?: "default" | "link" | "ghost" | "muted" | "accent" | "primary" | "destructive" | "outline" | "success" | "warning" | "secondary" | null | undefined;
|
|
25
25
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
26
26
|
/**
|
|
27
27
|
* Button variant type - derived from buttonVariants to ensure type safety
|
|
@@ -1,173 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// packages/components/src/atomic/Button/index.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview Button component
|
|
5
|
-
* @description Accessible, type-safe button component with behavioral variants
|
|
6
|
-
*
|
|
7
|
-
* @version 0.1.0
|
|
8
|
-
* @since 0.0.1
|
|
9
|
-
* @author AMBROISE PARK Consulting
|
|
10
|
-
*/
|
|
11
|
-
import { cva } from 'class-variance-authority';
|
|
12
|
-
import { Eye, EyeOff, Pencil, Plus, RefreshCw, Save, Trash, Trash2, Upload, X } from 'lucide-react';
|
|
13
|
-
import { forwardRef } from 'react';
|
|
14
|
-
import { DISPLAY } from '../../styles/componentConstants';
|
|
15
|
-
import { THEME_VARIANT } from '../../utils/constants';
|
|
16
|
-
import { cn, getVariantDataAttrs } from '../../utils/helpers';
|
|
17
|
-
import Icon from '../Icons/Icon';
|
|
18
|
-
import Spinner from '../Spinner';
|
|
19
|
-
import Tooltip from '../Tooltip';
|
|
20
|
-
import './Button.css';
|
|
21
|
-
/**
|
|
22
|
-
* Button variant constants - THEME_VARIANT + Button-specific variants
|
|
23
|
-
* Used for button styling via data-variant attribute
|
|
24
|
-
*/
|
|
25
|
-
export const BUTTON_VARIANT = {
|
|
26
|
-
...THEME_VARIANT,
|
|
27
|
-
GHOST: 'ghost',
|
|
28
|
-
OUTLINE: 'outline',
|
|
29
|
-
LINK: 'link',
|
|
30
|
-
};
|
|
31
|
-
const buttonVariants = cva('dndev-interactive', {
|
|
32
|
-
variants: {
|
|
33
|
-
variant: {
|
|
34
|
-
[THEME_VARIANT.DEFAULT]: '',
|
|
35
|
-
[THEME_VARIANT.MUTED]: '',
|
|
36
|
-
[THEME_VARIANT.PRIMARY]: '',
|
|
37
|
-
[THEME_VARIANT.SECONDARY]: '',
|
|
38
|
-
[THEME_VARIANT.ACCENT]: '',
|
|
39
|
-
[THEME_VARIANT.SUCCESS]: '',
|
|
40
|
-
[THEME_VARIANT.WARNING]: '',
|
|
41
|
-
[THEME_VARIANT.DESTRUCTIVE]: '',
|
|
42
|
-
[BUTTON_VARIANT.GHOST]: '',
|
|
43
|
-
[BUTTON_VARIANT.OUTLINE]: '',
|
|
44
|
-
[BUTTON_VARIANT.LINK]: '',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
defaultVariants: {
|
|
48
|
-
variant: THEME_VARIANT.DEFAULT,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* What a button does. Each intent brings its icon (and `delete` the destructive
|
|
53
|
-
* variant), so every form shows the same action the same way.
|
|
54
|
-
*/
|
|
55
|
-
export const BUTTON_INTENT = {
|
|
56
|
-
SAVE: 'save',
|
|
57
|
-
PUBLISH: 'publish',
|
|
58
|
-
UNPUBLISH: 'unpublish',
|
|
59
|
-
/** Logical delete (`remove`, status `deleted`) */
|
|
60
|
-
REMOVE: 'remove',
|
|
61
|
-
/** Hard delete (`delete`) */
|
|
62
|
-
DELETE: 'delete',
|
|
63
|
-
PREVIEW: 'preview',
|
|
64
|
-
RELOAD: 'reload',
|
|
65
|
-
ADD: 'add',
|
|
66
|
-
EDIT: 'edit',
|
|
67
|
-
CANCEL: 'cancel',
|
|
68
|
-
};
|
|
69
|
-
/** Icon of each intent. */
|
|
70
|
-
const INTENT_ICON = {
|
|
71
|
-
save: Save,
|
|
72
|
-
publish: Upload,
|
|
73
|
-
unpublish: EyeOff,
|
|
74
|
-
remove: Trash,
|
|
75
|
-
delete: Trash2,
|
|
76
|
-
preview: Eye,
|
|
77
|
-
reload: RefreshCw,
|
|
78
|
-
add: Plus,
|
|
79
|
-
edit: Pencil,
|
|
80
|
-
cancel: X,
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Accessible, type-safe button component with behavioral variants.
|
|
84
|
-
* Supports icons, tooltips, responsive layouts, and render prop composition.
|
|
85
|
-
*
|
|
86
|
-
* React 19: Forwards refs to the native button element for compatibility with form libraries.
|
|
87
|
-
*
|
|
88
|
-
* @component
|
|
89
|
-
* @example
|
|
90
|
-
* ```tsx
|
|
91
|
-
* // Standard button
|
|
92
|
-
* <Button variant="primary" icon={Mail}>Send Email</Button>
|
|
93
|
-
*
|
|
94
|
-
* // Common action: icon (and variant for delete) from the intent
|
|
95
|
-
* <Button intent="save" variant="primary">Save</Button>
|
|
96
|
-
*
|
|
97
|
-
* // With Link (render prop pattern - React 19 compatible)
|
|
98
|
-
* <Button
|
|
99
|
-
* icon={Home}
|
|
100
|
-
* render={({ children, ...props }) => (
|
|
101
|
-
* <Link path="/" {...props}>{children}</Link>
|
|
102
|
-
* )}
|
|
103
|
-
* >
|
|
104
|
-
* Home
|
|
105
|
-
* </Button>
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* @param {ButtonProps} props - The props for the button
|
|
109
|
-
* @returns {JSX.Element} The rendered button
|
|
110
|
-
*/
|
|
111
|
-
const Button = forwardRef(({ className, variant: variantProp, intent, render, display = DISPLAY.AUTO, icon: iconProp, iconEnd = false, badge, children, tooltip, tooltipForceOpen, floating = false, fullWidth = false, loading = false, loadingText, progress, disabled, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
|
|
112
|
-
const icon = iconProp ?? (intent ? INTENT_ICON[intent] : undefined);
|
|
113
|
-
const variant = variantProp ?? (intent === BUTTON_INTENT.DELETE ? THEME_VARIANT.DESTRUCTIVE : undefined);
|
|
114
|
-
const buttonText = children;
|
|
115
|
-
const hasIcon = !!icon;
|
|
116
|
-
const hasText = !!buttonText;
|
|
117
|
-
// Display mode - AUTO stays AUTO (CSS-driven), no auto-detection
|
|
118
|
-
const effectiveDisplay = display;
|
|
119
|
-
// Loading state handling
|
|
120
|
-
const isDisabled = disabled || loading;
|
|
121
|
-
const showProgress = loading && progress !== undefined && progress < 100;
|
|
122
|
-
const displayText = loading ? (loadingText ?? buttonText) : buttonText;
|
|
123
|
-
// Icon, with the count bubble on its corner when `badge` is set
|
|
124
|
-
const showBadge = badge !== undefined && badge !== 0 && badge !== '';
|
|
125
|
-
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 }));
|
|
126
|
-
// Build button content - Icon handles all types automatically
|
|
127
|
-
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] }));
|
|
128
|
-
// Extract text for aria-label (simple string extraction)
|
|
129
|
-
const getAriaLabel = () => {
|
|
130
|
-
if (ariaLabel)
|
|
131
|
-
return ariaLabel;
|
|
132
|
-
if (typeof buttonText === 'string')
|
|
133
|
-
return buttonText;
|
|
134
|
-
if (typeof buttonText === 'number')
|
|
135
|
-
return String(buttonText);
|
|
136
|
-
// Icon-only buttons need fallback
|
|
137
|
-
return hasIcon && !hasText ? 'Button' : undefined;
|
|
138
|
-
};
|
|
139
|
-
// Map 'default' variant to 'primary' for data-variant (same styling)
|
|
140
|
-
const variantForDataAttr = variant === THEME_VARIANT.DEFAULT ? THEME_VARIANT.PRIMARY : variant;
|
|
141
|
-
const variantAttrs = getVariantDataAttrs({ variant: variantForDataAttr });
|
|
142
|
-
// Extract type from props before spreading (to ensure it's not overridden)
|
|
143
|
-
const buttonType = props.type || 'button';
|
|
144
|
-
const { type: _type, ...restProps } = props;
|
|
145
|
-
// Build all props that should be passed to element (button or render prop)
|
|
146
|
-
const elementProps = {
|
|
147
|
-
children: buttonContent,
|
|
148
|
-
className: cn(buttonVariants({ variant, className }), 'touch-manipulation'),
|
|
149
|
-
'aria-label': getAriaLabel(),
|
|
150
|
-
'aria-describedby': ariaDescribedBy,
|
|
151
|
-
...variantAttrs,
|
|
152
|
-
...(floating && { 'data-floating': 'true' }),
|
|
153
|
-
...(fullWidth && { 'data-full-width': 'true' }),
|
|
154
|
-
...(effectiveDisplay && { 'data-display': effectiveDisplay }),
|
|
155
|
-
...(loading && { 'data-loading': 'true', 'aria-busy': 'true' }),
|
|
156
|
-
...restProps,
|
|
157
|
-
};
|
|
158
|
-
// Render prop pattern - no cloneElement needed (React 19 compatible)
|
|
159
|
-
const buttonElement = render ? (render(elementProps)) : (_jsx("button", { ref: ref, type: buttonType, role: "button", tabIndex: isDisabled ? -1 : 0, disabled: isDisabled, "aria-disabled": isDisabled || undefined, ...elementProps, children: buttonContent }));
|
|
160
|
-
// Tooltip: COMPACT/AUTO (may be icon-only when collapsed), others only if explicit
|
|
161
|
-
// Don't specify side - let CSS --tooltip-side take priority (RTL-aware in sidebars)
|
|
162
|
-
if (effectiveDisplay === DISPLAY.COMPACT ||
|
|
163
|
-
effectiveDisplay === DISPLAY.AUTO) {
|
|
164
|
-
return (_jsx(Tooltip, { content: tooltip || getAriaLabel() || 'Button', forceOpen: tooltipForceOpen, children: buttonElement }));
|
|
165
|
-
}
|
|
166
|
-
if (tooltip) {
|
|
167
|
-
return (_jsx(Tooltip, { content: tooltip, forceOpen: tooltipForceOpen, children: buttonElement }));
|
|
168
|
-
}
|
|
169
|
-
return buttonElement;
|
|
170
|
-
});
|
|
171
|
-
Button.displayName = 'Button';
|
|
172
|
-
export default Button;
|
|
173
|
-
export { buttonVariants };
|
|
1
|
+
import{cva as q}from"class-variance-authority";import{Eye as z,EyeOff as J,Pencil as Q,Plus as Z,RefreshCw as j,Save as tt,Trash as et,Trash2 as nt,Upload as at,X as rt}from"lucide-react";import{forwardRef as ot}from"react";import{DISPLAY as m}from"../../styles/componentConstants.js";import{THEME_VARIANT as t}from"../../utils/constants.js";import{cn as it,getVariantDataAttrs as st}from"../../utils/helpers.js";import P from"../Icons/Icon.js";import dt from"../Spinner/index.js";import L from"../Tooltip/index.js";import{Fragment as R,jsx as e,jsxs as s}from"react/jsx-runtime";var b={...t,GHOST:"ghost",OUTLINE:"outline",LINK:"link"},ct=q("dndev-interactive",{variants:{variant:{[t.DEFAULT]:"",[t.MUTED]:"",[t.PRIMARY]:"",[t.SECONDARY]:"",[t.ACCENT]:"",[t.SUCCESS]:"",[t.WARNING]:"",[t.DESTRUCTIVE]:"",[b.GHOST]:"",[b.OUTLINE]:"",[b.LINK]:""}},defaultVariants:{variant:t.DEFAULT}}),pt={SAVE:"save",PUBLISH:"publish",UNPUBLISH:"unpublish",REMOVE:"remove",DELETE:"delete",PREVIEW:"preview",RELOAD:"reload",ADD:"add",EDIT:"edit",CANCEL:"cancel"},lt={save:tt,publish:at,unpublish:J,remove:et,delete:nt,preview:z,reload:j,add:Z,edit:Q,cancel:rt},D=ot(({className:C,variant:U,intent:d,render:y,display:O=m.AUTO,icon:x,iconEnd:N=!1,badge:i,children:S,tooltip:c,tooltipForceOpen:E,floating:V=!1,fullWidth:k=!1,loading:r=!1,loadingText:w,progress:p,disabled:M,"aria-label":v,"aria-describedby":H,...g},_)=>{let o=x??(d?lt[d]:void 0),l=U??(d===pt.DELETE?t.DESTRUCTIVE:void 0),n=S,W=!!o,u=!!n,a=O,f=M||r,Y=r&&p!==void 0&&p<100,F=r?w??n:n,I=i!==void 0&&i!==0&&i!==""?s("span",{className:"dndev-interactive-icon-anchor",children:[e(P,{icon:o}),e("span",{className:"dndev-interactive-badge","aria-hidden":"true",children:i})]}):e(P,{icon:o}),h=r?s(R,{children:[Y?e("span",{className:"dndev-button-progress","aria-hidden":"true",children:s("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:`${p/100*50.27} 50.27`,strokeLinecap:"round",transform:"rotate(-90 10 10)"})]})}):e(dt,{className:"dndev-button-spinner","aria-hidden":"true"}),u&&e("span",{className:"dndev-interactive-label","data-display":a,children:F})]}):s(R,{children:[o&&!N&&I,u&&e("span",{className:"dndev-interactive-label","data-display":a,children:n}),o&&N&&I]}),A=()=>v||(typeof n=="string"?n:typeof n=="number"?String(n):W&&!u?"Button":void 0),G=l===t.DEFAULT?t.PRIMARY:l,K=st({variant:G}),X=g.type||"button",{type:ft,...$}=g,B={children:h,className:it(ct({variant:l,className:C}),"touch-manipulation"),"aria-label":A(),"aria-describedby":H,...K,...V&&{"data-floating":"true"},...k&&{"data-full-width":"true"},...a&&{"data-display":a},...r&&{"data-loading":"true","aria-busy":"true"},...$},T=y?y(B):e("button",{ref:_,type:X,role:"button",tabIndex:f?-1:0,disabled:f,"aria-disabled":f||void 0,...B,children:h});return a===m.COMPACT||a===m.AUTO?e(L,{content:c||A()||"Button",forceOpen:E,children:T}):c?e(L,{content:c,forceOpen:E,children:T}):T});D.displayName="Button";var ht=D;export{pt as BUTTON_INTENT,b as BUTTON_VARIANT,ct as buttonVariants,ht as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/ButtonGroup/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/ButtonGroup/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,mBAAmB,CAAC;AAE3B,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEvD,6FAA6F;AAC7F,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,cAAc,CAAC,cAAc,CAAC,EAC9B,MAAM,CACP;IACC;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,QAAA,MAAM,WAAW,6GA6ChB,CAAC;AAIF,eAAe,WAAW,CAAC"}
|
|
@@ -1,57 +1 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
// packages/components/src/atomic/ButtonGroup/index.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview ButtonGroup component
|
|
5
|
-
* @description Visual grouping of buttons with joined borders. Supports horizontal and vertical
|
|
6
|
-
* orientation, variant/size propagation, and both items-based and children-based APIs.
|
|
7
|
-
* NOT a toggle group — no state management.
|
|
8
|
-
*
|
|
9
|
-
* @version 0.1.0
|
|
10
|
-
* @since 0.0.1
|
|
11
|
-
* @author AMBROISE PARK Consulting
|
|
12
|
-
*/
|
|
13
|
-
import { forwardRef } from 'react';
|
|
14
|
-
import { cn, getVariantDataAttrs } from '../../utils/helpers';
|
|
15
|
-
import Button from '../Button';
|
|
16
|
-
import './ButtonGroup.css';
|
|
17
|
-
/**
|
|
18
|
-
* Visual grouping of buttons with joined borders and shared radius.
|
|
19
|
-
* NOT a toggle group — provides no selection state.
|
|
20
|
-
*
|
|
21
|
-
* Uses `role="group"` with `aria-label` for accessibility.
|
|
22
|
-
* Each button remains an independent tab stop.
|
|
23
|
-
*
|
|
24
|
-
* @component
|
|
25
|
-
* @example
|
|
26
|
-
* ```tsx
|
|
27
|
-
* // Items API (recommended)
|
|
28
|
-
* <ButtonGroup
|
|
29
|
-
* aria-label="Text formatting"
|
|
30
|
-
* variant="outline"
|
|
31
|
-
* items={[
|
|
32
|
-
* { key: 'bold', label: 'Bold', icon: Bold },
|
|
33
|
-
* { key: 'italic', label: 'Italic', icon: Italic },
|
|
34
|
-
* { key: 'underline', label: 'Underline', icon: Underline },
|
|
35
|
-
* ]}
|
|
36
|
-
* />
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* // Children API
|
|
42
|
-
* <ButtonGroup aria-label="Actions" orientation="vertical">
|
|
43
|
-
* <Button variant="primary" onClick={handleSave}>Save</Button>
|
|
44
|
-
* <Button variant="outline" onClick={handleCancel}>Cancel</Button>
|
|
45
|
-
* </ButtonGroup>
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @param {ButtonGroupProps} props - The props for the button group
|
|
49
|
-
* @returns {JSX.Element} The rendered button group
|
|
50
|
-
*/
|
|
51
|
-
const ButtonGroup = forwardRef(function ButtonGroup({ className, variant = 'primary', orientation = 'horizontal', disabled = false, items, children, 'aria-label': ariaLabel, ...props }, ref) {
|
|
52
|
-
const variantAttrs = getVariantDataAttrs({ variant });
|
|
53
|
-
return (_jsxs("div", { ref: ref, role: "group", "aria-label": ariaLabel, "aria-orientation": orientation, "aria-disabled": disabled || undefined, "data-orientation": orientation, className: cn('dndev-button-group', className), ...variantAttrs, ...props, children: [children, items &&
|
|
54
|
-
items.map((item) => (_jsx(Button, { variant: item.variant ?? variant, icon: item.icon, onClick: item.onClick, disabled: item.disabled ?? disabled, "aria-label": item['aria-label'], children: item.label }, item.key)))] }));
|
|
55
|
-
});
|
|
56
|
-
ButtonGroup.displayName = 'ButtonGroup';
|
|
57
|
-
export default ButtonGroup;
|
|
1
|
+
"use client";import{forwardRef as c}from"react";import{cn as b,getVariantDataAttrs as B}from"../../utils/helpers.js";import f from"../Button/index.js";import{jsx as m,jsxs as v}from"react/jsx-runtime";var e=c(function({className:i,variant:o="primary",orientation:a="horizontal",disabled:r=!1,items:n,children:l,"aria-label":u,...p},s){let d=B({variant:o});return v("div",{ref:s,role:"group","aria-label":u,"aria-orientation":a,"aria-disabled":r||void 0,"data-orientation":a,className:b("dndev-button-group",i),...d,...p,children:[l,n&&n.map(t=>m(f,{variant:t.variant??o,icon:t.icon,onClick:t.onClick,disabled:t.disabled??r,"aria-label":t["aria-label"],children:t.label},t.key))]})});e.displayName="ButtonGroup";var N=e;export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarPrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/Calendar/CalendarPrimitive.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CalendarPrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/Calendar/CalendarPrimitive.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Calendar Primitive
|
|
4
|
-
* @description Low-level react-day-picker wrapper, internal use only
|
|
5
|
-
*
|
|
6
|
-
* @version 0.1.0
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
export { DayPicker as CalendarPrimitive } from 'react-day-picker';
|
|
1
|
+
"use client";import{DayPicker as a}from"react-day-picker";export{a as CalendarPrimitive};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CalendarProps } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* Start loading the calendar chunk (idempotent). Pickers call it when the visitor
|
|
4
|
+
* points at or focuses the calendar trigger. A failed load is not lost: opening the
|
|
5
|
+
* calendar loads it again and LazyCalendar shows the error there.
|
|
6
|
+
*
|
|
7
|
+
* @version 0.2.0
|
|
8
|
+
* @since 0.3.1
|
|
9
|
+
* @author AMBROISE PARK Consulting
|
|
10
|
+
*/
|
|
11
|
+
export declare function preloadCalendar(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Preload the calendar once per page when the browser is idle after a picker mounts
|
|
14
|
+
* (`requestIdleCallback` where the browser has it): a touch visitor, whose first
|
|
15
|
+
* pointer event is the tap itself, gets the calendar without waiting.
|
|
16
|
+
*
|
|
17
|
+
* @version 0.1.0
|
|
18
|
+
* @since 0.3.1
|
|
19
|
+
* @author AMBROISE PARK Consulting
|
|
20
|
+
*/
|
|
21
|
+
export declare function useIdlePreloadCalendar(): void;
|
|
22
|
+
/** Props for LazyCalendar: Calendar props plus the load-error text. */
|
|
23
|
+
export type LazyCalendarProps = CalendarProps & {
|
|
24
|
+
/** Text shown in the popover when the calendar cannot be loaded */
|
|
25
|
+
errorLabel: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Calendar loaded on first render, with a placeholder of the calendar's size and a
|
|
29
|
+
* visible error when the chunk cannot be loaded.
|
|
30
|
+
*
|
|
31
|
+
* @param props - Calendar props plus `errorLabel`
|
|
32
|
+
*
|
|
33
|
+
* @version 0.2.0
|
|
34
|
+
* @since 0.3.1
|
|
35
|
+
* @author AMBROISE PARK Consulting
|
|
36
|
+
*/
|
|
37
|
+
export default function LazyCalendar({ errorLabel, ...props }: LazyCalendarProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=LazyCalendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyCalendar.d.ts","sourceRoot":"","sources":["../../../src/atomic/Calendar/LazyCalendar.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAS7C;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAU7C;AA8BD,uEAAuE;AACvE,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,UAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAenB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";var s=Object.defineProperty;var i=(r,e,d)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[e]=d;var n=(r,e,d)=>i(r,typeof e!="symbol"?e+"":e,d);import{Component as c,lazy as p,Suspense as f,useEffect as u}from"react";import{jsx as a}from"react/jsx-runtime";var t=()=>import("./index.js"),C=p(t),o=!1;function v(){t().catch(()=>{})}function L(){u(()=>{o||typeof window.requestIdleCallback!="function"||(o=!0,window.requestIdleCallback(v))},[])}var l=class extends c{constructor(){super(...arguments);n(this,"state",{failed:!1})}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?a("div",{className:"dndev-calendar dndev-calendar-error",role:"alert",children:this.props.errorLabel}):this.props.children}};function y({errorLabel:r,...e}){return a(l,{errorLabel:r,children:a(f,{fallback:a("div",{className:"dndev-calendar dndev-control dndev-calendar-fallback","aria-busy":!0}),children:a(C,{...e})})})}export{y as default,v as preloadCalendar,L as useIdlePreloadCalendar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Calendar/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Calendar/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIlE,wFAAwF;AACxF,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAiFnD,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,UAAU,EACV,eAAsB,EACtB,YAAgB,EAChB,aAA0B,EAC1B,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,+BAsEf;AAKD,eAAe,QAAQ,CAAC"}
|
|
@@ -1,74 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// packages/components/src/atomic/Calendar/index.tsx
|
|
3
|
-
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
4
|
-
import { CalendarPrimitive } from './CalendarPrimitive';
|
|
5
|
-
import { cn } from '../../utils/helpers';
|
|
6
|
-
import Button from '../Button';
|
|
7
|
-
import DropdownMenu from '../DropdownMenu';
|
|
8
|
-
import { DropdownMenuItemPrimitive } from '../DropdownMenu/DropdownMenuPrimitive';
|
|
9
|
-
import Icon from '../Icons/Icon';
|
|
10
|
-
function CalendarChevron(props) {
|
|
11
|
-
const icon = props.orientation === 'left' ? ChevronLeft : ChevronRight;
|
|
12
|
-
return _jsx(Icon, { icon: icon, className: props.className });
|
|
13
|
-
}
|
|
14
|
-
function CalendarDropdown({ options = [], value, onChange, 'aria-label': ariaLabel, }) {
|
|
15
|
-
const selectedOption = options.find((opt) => String(opt.value) === String(value));
|
|
16
|
-
const isMonth = options.length === 12;
|
|
17
|
-
const isYear = !isMonth;
|
|
18
|
-
const gridStyle = {
|
|
19
|
-
display: 'grid',
|
|
20
|
-
gridTemplateColumns: isMonth ? 'repeat(3, 1fr)' : 'repeat(5, 1fr)',
|
|
21
|
-
gap: 'var(--gap-sm)',
|
|
22
|
-
padding: '0',
|
|
23
|
-
};
|
|
24
|
-
const handleSelect = (newValue) => {
|
|
25
|
-
// why: react-day-picker's DropdownProps.onChange wants a native select ChangeEvent; it only reads target.value
|
|
26
|
-
onChange?.({
|
|
27
|
-
target: { value: newValue },
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
return (_jsx(DropdownMenu, { trigger: _jsx(Button, { variant: "outline", className: "dndev-calendar-dropdown-trigger dndev-interactive", "aria-label": ariaLabel, children: selectedOption?.label || value }), contentWidth: isYear ? '300px' : 'auto', contentAlign: "center", children: _jsx("div", { className: "dndev-calendar-dropdown-grid", style: isYear ? { maxHeight: '300px', overflowY: 'auto' } : undefined, children: _jsx("div", { style: gridStyle, children: options.map((option) => (_jsx(DropdownMenuItemPrimitive, { className: cn('dndev-interactive dndev-justify-center dndev-text-center', String(option.value) === String(value) &&
|
|
31
|
-
'dndev-calendar-dropdown-selected'), "data-selected": String(option.value) === String(value) ? 'true' : undefined, style: {
|
|
32
|
-
cursor: 'pointer',
|
|
33
|
-
fontSize: 'var(--font-size-sm)',
|
|
34
|
-
padding: 'var(--gap-sm)',
|
|
35
|
-
}, onSelect: () => handleSelect(String(option.value)), disabled: option.disabled, children: option.label }, option.value))) }) }) }));
|
|
36
|
-
}
|
|
37
|
-
function Calendar({ className, classNames, showOutsideDays = true, weekStartsOn = 1, captionLayout = 'dropdown', startMonth, endMonth, ...props }) {
|
|
38
|
-
const currentYear = new Date().getFullYear();
|
|
39
|
-
const defaultStartMonth = startMonth || new Date(currentYear - 10, 0);
|
|
40
|
-
const defaultEndMonth = endMonth || new Date(currentYear + 10, 11);
|
|
41
|
-
return (_jsx(CalendarPrimitive, { showOutsideDays: showOutsideDays, weekStartsOn: weekStartsOn, captionLayout: captionLayout, startMonth: defaultStartMonth, endMonth: defaultEndMonth, className: cn('dndev-calendar dndev-control', className), classNames: {
|
|
42
|
-
months: cn('dndev-calendar-months', classNames?.months),
|
|
43
|
-
month: cn('dndev-calendar-month', classNames?.month),
|
|
44
|
-
caption: cn('dndev-calendar-caption', classNames?.caption),
|
|
45
|
-
caption_label: cn('dndev-calendar-caption-label', classNames?.caption_label),
|
|
46
|
-
dropdowns: cn('dndev-calendar-dropdowns', classNames?.dropdowns),
|
|
47
|
-
dropdown_month: cn('dndev-calendar-dropdown-month', classNames?.dropdown_month),
|
|
48
|
-
dropdown_year: cn('dndev-calendar-dropdown-year', classNames?.dropdown_year),
|
|
49
|
-
nav: cn('dndev-calendar-nav', classNames?.nav),
|
|
50
|
-
button_previous: cn('dndev-calendar-nav-button dndev-calendar-nav-previous dndev-interactive', classNames?.button_previous),
|
|
51
|
-
button_next: cn('dndev-calendar-nav-button dndev-calendar-nav-next dndev-interactive', classNames?.button_next),
|
|
52
|
-
month_grid: cn('dndev-calendar-table', classNames?.month_grid),
|
|
53
|
-
weekdays: cn('dndev-calendar-weekdays', classNames?.weekdays),
|
|
54
|
-
weekday: cn('dndev-calendar-weekday', classNames?.weekday),
|
|
55
|
-
week: cn('dndev-calendar-week', classNames?.week),
|
|
56
|
-
day: cn('dndev-calendar-day', classNames?.day),
|
|
57
|
-
day_button: cn('dndev-calendar-day-button dndev-interactive', classNames?.day_button),
|
|
58
|
-
selected: cn('dndev-calendar-day-selected', classNames?.selected),
|
|
59
|
-
today: cn('dndev-calendar-day-today', classNames?.today),
|
|
60
|
-
outside: cn('dndev-calendar-day-outside', classNames?.outside),
|
|
61
|
-
disabled: cn('dndev-calendar-day-disabled', classNames?.disabled),
|
|
62
|
-
range_middle: cn('dndev-calendar-day-range-middle', classNames?.range_middle),
|
|
63
|
-
range_start: cn('dndev-calendar-day-range-start', classNames?.range_start),
|
|
64
|
-
range_end: cn('dndev-calendar-day-range-end', classNames?.range_end),
|
|
65
|
-
hidden: cn('dndev-calendar-day-hidden', classNames?.hidden),
|
|
66
|
-
...classNames,
|
|
67
|
-
}, components: {
|
|
68
|
-
Dropdown: CalendarDropdown,
|
|
69
|
-
Chevron: CalendarChevron,
|
|
70
|
-
}, ...props }));
|
|
71
|
-
}
|
|
72
|
-
// Re-export CustomCaption logic (defined below to avoid hoisting issues, or move above)
|
|
73
|
-
// I will keep CustomCaption defined in the file scope as before.
|
|
74
|
-
export default Calendar;
|
|
1
|
+
"use client";import{ChevronLeft as g,ChevronRight as y}from"lucide-react";import{CalendarPrimitive as w}from"./CalendarPrimitive.js";import{cn as n}from"../../utils/helpers.js";import h from"../Button/index.js";import m from"../DropdownMenu/index.js";import{DropdownMenuItemPrimitive as f}from"../DropdownMenu/DropdownMenuPrimitive.js";import b from"../Icons/Icon.js";import{jsx as r}from"react/jsx-runtime";function _(t){let e=t.orientation==="left"?g:y;return r(b,{icon:e,className:t.className})}function C({options:t=[],value:e,onChange:l,"aria-label":v}){let c=t.find(d=>String(d.value)===String(e)),a=t.length===12,o=!a,p={display:"grid",gridTemplateColumns:a?"repeat(3, 1fr)":"repeat(5, 1fr)",gap:"var(--gap-sm)",padding:"0"},i=d=>{l?.({target:{value:d}})};return r(m,{trigger:r(h,{variant:"outline",className:"dndev-calendar-dropdown-trigger dndev-interactive","aria-label":v,children:c?.label||e}),contentWidth:o?"300px":"auto",contentAlign:"center",children:r("div",{className:"dndev-calendar-dropdown-grid",style:o?{maxHeight:"300px",overflowY:"auto"}:void 0,children:r("div",{style:p,children:t.map(d=>r(f,{className:n("dndev-interactive dndev-justify-center dndev-text-center",String(d.value)===String(e)&&"dndev-calendar-dropdown-selected"),"data-selected":String(d.value)===String(e)?"true":void 0,style:{cursor:"pointer",fontSize:"var(--font-size-sm)",padding:"var(--gap-sm)"},onSelect:()=>i(String(d.value)),disabled:d.disabled,children:d.label},d.value))})})})}function P({className:t,classNames:e,showOutsideDays:l=!0,weekStartsOn:v=1,captionLayout:c="dropdown",startMonth:a,endMonth:o,...p}){let i=new Date().getFullYear(),d=a||new Date(i-10,0),u=o||new Date(i+10,11);return r(w,{showOutsideDays:l,weekStartsOn:v,captionLayout:c,startMonth:d,endMonth:u,className:n("dndev-calendar dndev-control",t),classNames:{months:n("dndev-calendar-months",e?.months),month:n("dndev-calendar-month",e?.month),caption:n("dndev-calendar-caption",e?.caption),caption_label:n("dndev-calendar-caption-label",e?.caption_label),dropdowns:n("dndev-calendar-dropdowns",e?.dropdowns),dropdown_month:n("dndev-calendar-dropdown-month",e?.dropdown_month),dropdown_year:n("dndev-calendar-dropdown-year",e?.dropdown_year),nav:n("dndev-calendar-nav",e?.nav),button_previous:n("dndev-calendar-nav-button dndev-calendar-nav-previous dndev-interactive",e?.button_previous),button_next:n("dndev-calendar-nav-button dndev-calendar-nav-next dndev-interactive",e?.button_next),month_grid:n("dndev-calendar-table",e?.month_grid),weekdays:n("dndev-calendar-weekdays",e?.weekdays),weekday:n("dndev-calendar-weekday",e?.weekday),week:n("dndev-calendar-week",e?.week),day:n("dndev-calendar-day",e?.day),day_button:n("dndev-calendar-day-button dndev-interactive",e?.day_button),selected:n("dndev-calendar-day-selected",e?.selected),today:n("dndev-calendar-day-today",e?.today),outside:n("dndev-calendar-day-outside",e?.outside),disabled:n("dndev-calendar-day-disabled",e?.disabled),range_middle:n("dndev-calendar-day-range-middle",e?.range_middle),range_start:n("dndev-calendar-day-range-start",e?.range_start),range_end:n("dndev-calendar-day-range-end",e?.range_end),hidden:n("dndev-calendar-day-hidden",e?.hidden),...e},components:{Dropdown:C,Chevron:_},...p})}var E=P;export{E as default};
|
|
@@ -1,78 +1 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
// packages/components/src/atomic/CallToAction/index.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview Call To Action Component
|
|
5
|
-
* @description Simple, conversion-focused CTA section with title, subtitle, and actions.
|
|
6
|
-
* Content width is automatically constrained by PageContainer's --content-width variable.
|
|
7
|
-
*
|
|
8
|
-
* **Polymorphic Component**: Can render as `section`, `aside`, or `div` based on semantic needs.
|
|
9
|
-
* Defaults to `section` for semantic HTML. Use `aside` for sidebar promotional CTAs.
|
|
10
|
-
*
|
|
11
|
-
* **Bleed mode:** When `bleed` is set, the CTA breaks out of `PageContainer`
|
|
12
|
-
* content constraints to span the full viewport width — ideal for immersive CTAs.
|
|
13
|
-
*
|
|
14
|
-
* **Background image:** When `backgroundImage` is set, a cover image fills the CTA
|
|
15
|
-
* with a dark gradient overlay for text readability. Text automatically turns white.
|
|
16
|
-
* Combine with `bleed` for edge-to-edge CTA banners.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* // Standard CTA section (default)
|
|
21
|
-
* <CallToAction
|
|
22
|
-
* title="Ready to launch?"
|
|
23
|
-
* subtitle="Get started in minutes."
|
|
24
|
-
* primaryAction={<Button>Sign Up</Button>}
|
|
25
|
-
* secondaryAction={<Button variant="outline">Learn More</Button>}
|
|
26
|
-
* />
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* // Full-width CTA with background image
|
|
32
|
-
* <CallToAction
|
|
33
|
-
* bleed
|
|
34
|
-
* backgroundImage="/images/cta-bg.jpg"
|
|
35
|
-
* title="Ready to move in?"
|
|
36
|
-
* subtitle="Book a viewing today"
|
|
37
|
-
* primaryAction={<Button>Contact Us</Button>}
|
|
38
|
-
* />
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```tsx
|
|
43
|
-
* // Sidebar promotional CTA
|
|
44
|
-
* <CallToAction
|
|
45
|
-
* as="aside"
|
|
46
|
-
* title="Try Premium"
|
|
47
|
-
* subtitle="Unlock all features"
|
|
48
|
-
* primaryAction={<Button>Upgrade</Button>}
|
|
49
|
-
* />
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @version 0.1.0
|
|
53
|
-
* @since 0.0.1
|
|
54
|
-
* @author AMBROISE PARK Consulting
|
|
55
|
-
*/
|
|
56
|
-
import { createElement, forwardRef, } from 'react';
|
|
57
|
-
import { TONE } from '../../utils/constants';
|
|
58
|
-
import { cn } from '../../utils/helpers';
|
|
59
|
-
import Text, { TEXT_VARIANT } from '../Text';
|
|
60
|
-
import './CallToAction.css';
|
|
61
|
-
const CallToAction = forwardRef(function CallToAction({ as = 'section', title, subtitle, primaryAction, secondaryAction, thirdAction, textAlign = 'center', align = 'center', justify, tone = TONE.GHOST, bleed = false, backgroundImage, children, className, ...props }, ref) {
|
|
62
|
-
const Component = as;
|
|
63
|
-
return createElement(Component, {
|
|
64
|
-
ref,
|
|
65
|
-
'aria-label': props['aria-label'] || 'Call to Action',
|
|
66
|
-
className: cn('dndev-cta', bleed && 'dndev-cta--bleed', backgroundImage && 'dndev-cta--bg-image', className),
|
|
67
|
-
'data-tone': tone,
|
|
68
|
-
style: {
|
|
69
|
-
...(backgroundImage
|
|
70
|
-
? { backgroundImage: `url(${backgroundImage})` }
|
|
71
|
-
: {}),
|
|
72
|
-
...props.style,
|
|
73
|
-
},
|
|
74
|
-
...props,
|
|
75
|
-
}, _jsxs("div", { className: "dndev-cta-content", "data-text-align": textAlign, "data-align": align, "data-justify": justify || undefined, children: [title && (_jsx(Text, { as: "div", level: "h2", style: { fontSize: 'var(--font-size-2xl)' }, children: title })), subtitle && (_jsx(Text, { as: "span", level: "h4", children: subtitle })), (primaryAction || secondaryAction || thirdAction) && (_jsxs("div", { className: "dndev-cta-actions", children: [primaryAction, secondaryAction, thirdAction] })), children] }));
|
|
76
|
-
});
|
|
77
|
-
CallToAction.displayName = 'CallToAction';
|
|
78
|
-
export default CallToAction;
|
|
1
|
+
import{createElement as x,forwardRef as N}from"react";import{TONE as R}from"../../utils/constants.js";import{cn as b}from"../../utils/helpers.js";import c from"../Text/index.js";import{jsx as d,jsxs as r}from"react/jsx-runtime";var s=N(function({as:p="section",title:n,subtitle:o,primaryAction:a,secondaryAction:l,thirdAction:i,textAlign:T="center",align:m="center",justify:f,tone:y=R.GHOST,bleed:v=!1,backgroundImage:e,children:A,className:C,...t},g){return x(p,{ref:g,"aria-label":t["aria-label"]||"Call to Action",className:b("dndev-cta",v&&"dndev-cta--bleed",e&&"dndev-cta--bg-image",C),"data-tone":y,style:{...e?{backgroundImage:`url(${e})`}:{},...t.style},...t},r("div",{className:"dndev-cta-content","data-text-align":T,"data-align":m,"data-justify":f||void 0,children:[n&&d(c,{as:"div",level:"h2",style:{fontSize:"var(--font-size-2xl)"},children:n}),o&&d(c,{as:"span",level:"h4",children:o}),(a||l||i)&&r("div",{className:"dndev-cta-actions",children:[a,l,i]}),A]}))});s.displayName="CallToAction";var H=s;export{H as default};
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isResponsiveImage, ResponsiveImg } from '../../utils/responsiveImage';
|
|
3
|
-
/** Image pair for a URL (one rendition) or a {@link ResponsiveImage}. */
|
|
4
|
-
function toImage(image) {
|
|
5
|
-
return typeof image === 'string' ? { fullUrl: image } : image;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Renders the card cover region with optional overlay.
|
|
9
|
-
*
|
|
10
|
-
* Architecture: cover is a relative-positioned header region that sits flush
|
|
11
|
-
* to the card's rounded corners (no negative-margin hack). When the card has
|
|
12
|
-
* body content, the cover's height comes from `coverAspect`. When the card is
|
|
13
|
-
* cover-only (no body), the cover stretches to fill the card — the card
|
|
14
|
-
* itself picks up `coverAspect` via its container.
|
|
15
|
-
*
|
|
16
|
-
* - `string` or {@link ResponsiveImage} cover → renders a safe `<img>` with
|
|
17
|
-
* `loading="lazy"`, `decoding="async"`, `referrerpolicy="no-referrer"`;
|
|
18
|
-
* `media` sets fit, alt (decorative by default), a hover view and eager
|
|
19
|
-
* loading. An image pair shows the thumbnail on phones, the full image above
|
|
20
|
-
* ({@link ResponsiveImg}).
|
|
21
|
-
* - `ReactNode` cover → passthrough; child `<img>`/`<video>` auto-fill via CSS.
|
|
22
|
-
*
|
|
23
|
-
* Overlay is absolutely positioned over the cover AND over the body slot,
|
|
24
|
-
* anchored by `overlayPosition` with a theme-token inset.
|
|
25
|
-
*/
|
|
26
|
-
export function renderCardCover(cover, coverAspect, hasBody, media = {}) {
|
|
27
|
-
if (!cover)
|
|
28
|
-
return null;
|
|
29
|
-
const image = typeof cover === 'string' || isResponsiveImage(cover) ? cover : null;
|
|
30
|
-
const { fit = 'cover', alt = '', hover, eager = false, background = 'transparent', } = media;
|
|
31
|
-
// When body is present the cover owns the top region sized by coverAspect.
|
|
32
|
-
// When body is absent the cover fills the card (card owns the aspect-ratio).
|
|
33
|
-
const coverStyle = hasBody
|
|
34
|
-
? { aspectRatio: coverAspect ?? '4 / 5' }
|
|
35
|
-
: {};
|
|
36
|
-
return (_jsxs("div", { className: "dndev-card-cover", "data-has-body": hasBody ? 'true' : undefined, "data-fit": fit, "data-background": background, "data-has-hover": image && hover ? 'true' : undefined, style: coverStyle, children: [image ? (_jsx(ResponsiveImg, { image: toImage(image), alt: alt, loading: eager ? 'eager' : 'lazy', fetchPriority: eager ? 'high' : undefined, decoding: "async", referrerPolicy: "no-referrer" })) : (_jsx("div", { className: "dndev-card-cover-media", children: cover })), image && hover && (
|
|
37
|
-
// Decorative second view (e.g. lifestyle shot behind a packshot):
|
|
38
|
-
// revealed on hover / keyboard focus, hidden from assistive tech.
|
|
39
|
-
_jsx(ResponsiveImg, { className: "dndev-card-cover-hover", image: toImage(hover), alt: "", "aria-hidden": "true", loading: "lazy", decoding: "async", referrerPolicy: "no-referrer" }))] }));
|
|
40
|
-
}
|
|
1
|
+
import{isResponsiveImage as p,ResponsiveImg as n}from"../../utils/responsiveImage.js";import{jsx as o,jsxs as f}from"react/jsx-runtime";function i(e){return typeof e=="string"?{fullUrl:e}:e}function C(e,s,t,c={}){if(!e)return null;let r=typeof e=="string"||p(e)?e:null,{fit:g="cover",alt:l="",hover:a,eager:d=!1,background:v="transparent"}=c;return f("div",{className:"dndev-card-cover","data-has-body":t?"true":void 0,"data-fit":g,"data-background":v,"data-has-hover":r&&a?"true":void 0,style:t?{aspectRatio:s??"4 / 5"}:{},children:[r?o(n,{image:i(r),alt:l,loading:d?"eager":"lazy",fetchPriority:d?"high":void 0,decoding:"async",referrerPolicy:"no-referrer"}):o("div",{className:"dndev-card-cover-media",children:e}),r&&a&&o(n,{className:"dndev-card-cover-hover",image:i(a),alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"})]})}export{C as renderCardCover};
|