@giddaa-housing/ui 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -6
- package/css/base.css +37 -0
- package/css/components.css +135 -0
- package/css/generated/shared.css +1 -0
- package/css/giddaa.css +402 -0
- package/css/preset.css +77 -0
- package/css/styles.css +2 -0
- package/css/theme.css +255 -0
- package/dist/accordion.js +5 -35
- package/dist/accordion.js.map +1 -1
- package/dist/activity-timeline.d.ts +33 -0
- package/dist/activity-timeline.js +212 -0
- package/dist/activity-timeline.js.map +1 -0
- package/dist/alert.js +5 -35
- package/dist/alert.js.map +1 -1
- package/dist/auth-layout.d.ts +23 -0
- package/dist/auth-layout.js +304 -0
- package/dist/auth-layout.js.map +1 -0
- package/dist/avatar.js +10 -142
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +6 -114
- package/dist/badge.js.map +1 -1
- package/dist/bar-chart.d.ts +101 -77
- package/dist/bar-chart.js +142 -220
- package/dist/bar-chart.js.map +1 -1
- package/dist/breadcrumb.js +5 -35
- package/dist/breadcrumb.js.map +1 -1
- package/dist/bullet-chart.js +15 -48
- package/dist/bullet-chart.js.map +1 -1
- package/dist/button-group.js +14 -90
- package/dist/button-group.js.map +1 -1
- package/dist/button.d.ts +5 -5
- package/dist/button.js +7 -140
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +12 -287
- package/dist/calendar.js.map +1 -1
- package/dist/card.js +5 -35
- package/dist/card.js.map +1 -1
- package/dist/carousel.js +12 -386
- package/dist/carousel.js.map +1 -1
- package/dist/chart.js +16 -480
- package/dist/chart.js.map +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +13 -48
- package/dist/checkbox.js.map +1 -1
- package/dist/chunk-322YCNVL.js +278 -0
- package/dist/chunk-322YCNVL.js.map +1 -0
- package/dist/chunk-3ACQVT7A.js +25 -0
- package/dist/chunk-3ACQVT7A.js.map +1 -0
- package/dist/chunk-3T65TLJX.js +334 -0
- package/dist/chunk-3T65TLJX.js.map +1 -0
- package/dist/chunk-6ZSGQHH2.js +192 -0
- package/dist/chunk-6ZSGQHH2.js.map +1 -0
- package/dist/chunk-7TBMLFGW.js +41 -0
- package/dist/chunk-7TBMLFGW.js.map +1 -0
- package/dist/chunk-B4H6RNDH.js +135 -0
- package/dist/chunk-B4H6RNDH.js.map +1 -0
- package/dist/chunk-BUXCGZ6X.js +219 -0
- package/dist/chunk-BUXCGZ6X.js.map +1 -0
- package/dist/chunk-CHII2QHH.js +58 -0
- package/dist/chunk-CHII2QHH.js.map +1 -0
- package/dist/chunk-DMNOXRRW.js +147 -0
- package/dist/chunk-DMNOXRRW.js.map +1 -0
- package/dist/chunk-EFSOSSIC.js +130 -0
- package/dist/chunk-EFSOSSIC.js.map +1 -0
- package/dist/chunk-FZDSVMKY.js +363 -0
- package/dist/chunk-FZDSVMKY.js.map +1 -0
- package/dist/chunk-GJOFIJS3.js +246 -0
- package/dist/chunk-GJOFIJS3.js.map +1 -0
- package/dist/chunk-HL3ZSYES.js +23 -0
- package/dist/chunk-HL3ZSYES.js.map +1 -0
- package/dist/chunk-JVLUBAPB.js +129 -0
- package/dist/chunk-JVLUBAPB.js.map +1 -0
- package/dist/chunk-KDPYSOYZ.js +64 -0
- package/dist/chunk-KDPYSOYZ.js.map +1 -0
- package/dist/chunk-KSMDANKI.js +43 -0
- package/dist/chunk-KSMDANKI.js.map +1 -0
- package/dist/chunk-MEKCCOP5.js +46 -0
- package/dist/chunk-MEKCCOP5.js.map +1 -0
- package/dist/chunk-NOFXVRWL.js +451 -0
- package/dist/chunk-NOFXVRWL.js.map +1 -0
- package/dist/chunk-PC5MHNVA.js +171 -0
- package/dist/chunk-PC5MHNVA.js.map +1 -0
- package/dist/chunk-QKAQZ2GU.js +122 -0
- package/dist/chunk-QKAQZ2GU.js.map +1 -0
- package/dist/chunk-QZHSHSVV.js +26 -0
- package/dist/chunk-QZHSHSVV.js.map +1 -0
- package/dist/chunk-RBMK26XD.js +19 -0
- package/dist/chunk-RBMK26XD.js.map +1 -0
- package/dist/chunk-SFNJGF6M.js +262 -0
- package/dist/chunk-SFNJGF6M.js.map +1 -0
- package/dist/chunk-UJJNLGTM.js +112 -0
- package/dist/chunk-UJJNLGTM.js.map +1 -0
- package/dist/chunk-VGR4ZWJ3.js +418 -0
- package/dist/chunk-VGR4ZWJ3.js.map +1 -0
- package/dist/chunk-XG47P6D4.js +99 -0
- package/dist/chunk-XG47P6D4.js.map +1 -0
- package/dist/chunk-XZZAHNVM.js +21 -0
- package/dist/chunk-XZZAHNVM.js.map +1 -0
- package/dist/chunk-Y4TTYVNE.js +36 -0
- package/dist/chunk-Y4TTYVNE.js.map +1 -0
- package/dist/chunk-YDWIHW6Q.js +69 -0
- package/dist/chunk-YDWIHW6Q.js.map +1 -0
- package/dist/collapsible.js +6 -35
- package/dist/collapsible.js.map +1 -1
- package/dist/combobox.js +26 -694
- package/dist/combobox.js.map +1 -1
- package/dist/cta.d.ts +66 -0
- package/dist/cta.js +358 -0
- package/dist/cta.js.map +1 -0
- package/dist/currency-selector.d.ts +42 -0
- package/dist/currency-selector.js +192 -0
- package/dist/currency-selector.js.map +1 -0
- package/dist/date-picker.d.ts +18 -10
- package/dist/date-picker.js +105 -430
- package/dist/date-picker.js.map +1 -1
- package/dist/details-card.d.ts +19 -0
- package/dist/details-card.js +267 -0
- package/dist/details-card.js.map +1 -0
- package/dist/dialog.js +36 -146
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +20 -358
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/dropzone.js +13 -40
- package/dist/dropzone.js.map +1 -1
- package/dist/editorial-card.d.ts +29 -0
- package/dist/editorial-card.js +311 -0
- package/dist/editorial-card.js.map +1 -0
- package/dist/empty-state.js +5 -35
- package/dist/empty-state.js.map +1 -1
- package/dist/field.js +30 -135
- package/dist/field.js.map +1 -1
- package/dist/footer.d.ts +47 -0
- package/dist/footer.js +430 -0
- package/dist/footer.js.map +1 -0
- package/dist/funnel-chart.js +42 -415
- package/dist/funnel-chart.js.map +1 -1
- package/dist/gallery-indicator.d.ts +18 -0
- package/dist/gallery-indicator.js +12 -0
- package/dist/gallery-indicator.js.map +1 -0
- package/dist/heatmap-chart.d.ts +98 -0
- package/dist/heatmap-chart.js +248 -0
- package/dist/heatmap-chart.js.map +1 -0
- package/dist/infotip.d.ts +11 -0
- package/dist/infotip.js +66 -0
- package/dist/infotip.js.map +1 -0
- package/dist/input-group.d.ts +2 -1
- package/dist/input-group.js +15 -371
- package/dist/input-group.js.map +1 -1
- package/dist/input-size-context.js +5 -19
- package/dist/input-size-context.js.map +1 -1
- package/dist/input.js +6 -78
- package/dist/input.js.map +1 -1
- package/dist/item.js +5 -35
- package/dist/item.js.map +1 -1
- package/dist/kpi-card.js +12 -52
- package/dist/kpi-card.js.map +1 -1
- package/dist/label.js +5 -64
- package/dist/label.js.map +1 -1
- package/dist/line-chart.js +9 -166
- package/dist/line-chart.js.map +1 -1
- package/dist/logo.js +4 -141
- package/dist/logo.js.map +1 -1
- package/dist/map-indicator.d.ts +13 -0
- package/dist/map-indicator.js +109 -0
- package/dist/map-indicator.js.map +1 -0
- package/dist/match.d.ts +16 -0
- package/dist/match.js +113 -0
- package/dist/match.js.map +1 -0
- package/dist/media-gallery-hero.d.ts +60 -0
- package/dist/media-gallery-hero.js +362 -0
- package/dist/media-gallery-hero.js.map +1 -0
- package/dist/media-player.d.ts +60 -0
- package/dist/media-player.js +1394 -0
- package/dist/media-player.js.map +1 -0
- package/dist/number-input.js +30 -325
- package/dist/number-input.js.map +1 -1
- package/dist/page-header.js +4 -32
- package/dist/page-header.js.map +1 -1
- package/dist/pagination.d.ts +1 -0
- package/dist/pagination.js +27 -161
- package/dist/pagination.js.map +1 -1
- package/dist/password-input.d.ts +1 -0
- package/dist/password-input.js +21 -319
- package/dist/password-input.js.map +1 -1
- package/dist/phone-input.d.ts +2 -1
- package/dist/phone-input.js +148 -359
- package/dist/phone-input.js.map +1 -1
- package/dist/photo-gallery.d.ts +1 -1
- package/dist/photo-gallery.js +97 -393
- package/dist/photo-gallery.js.map +1 -1
- package/dist/pie-chart.js +17 -52
- package/dist/pie-chart.js.map +1 -1
- package/dist/popover.js +13 -158
- package/dist/popover.js.map +1 -1
- package/dist/price-tag.d.ts +35 -0
- package/dist/price-tag.js +178 -0
- package/dist/price-tag.js.map +1 -0
- package/dist/progress.d.ts +5 -2
- package/dist/progress.js +14 -303
- package/dist/progress.js.map +1 -1
- package/dist/property-listing-card.d.ts +32 -0
- package/dist/property-listing-card.js +235 -0
- package/dist/property-listing-card.js.map +1 -0
- package/dist/radar-chart.d.ts +110 -0
- package/dist/radar-chart.js +147 -0
- package/dist/radar-chart.js.map +1 -0
- package/dist/radio-group.js +15 -50
- package/dist/radio-group.js.map +1 -1
- package/dist/review-block.d.ts +20 -0
- package/dist/review-block.js +10 -0
- package/dist/review-block.js.map +1 -0
- package/dist/rich-text-editor.js +172 -433
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/scatter-chart.d.ts +142 -0
- package/dist/scatter-chart.js +252 -0
- package/dist/scatter-chart.js.map +1 -0
- package/dist/search-input.d.ts +1 -0
- package/dist/search-input.js +22 -320
- package/dist/search-input.js.map +1 -1
- package/dist/select.js +15 -292
- package/dist/select.js.map +1 -1
- package/dist/separator.js +5 -68
- package/dist/separator.js.map +1 -1
- package/dist/sheet.js +14 -271
- package/dist/sheet.js.map +1 -1
- package/dist/sidebar.d.ts +1 -1
- package/dist/sidebar.js +89 -494
- package/dist/sidebar.js.map +1 -1
- package/dist/size-context.js +5 -17
- package/dist/size-context.js.map +1 -1
- package/dist/skeleton.js +4 -44
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.d.ts +28 -0
- package/dist/slider.js +152 -0
- package/dist/slider.js.map +1 -0
- package/dist/sparkline.js +33 -341
- package/dist/sparkline.js.map +1 -1
- package/dist/stepper.js +5 -35
- package/dist/stepper.js.map +1 -1
- package/dist/styles.css +9593 -2
- package/dist/switch.js +13 -48
- package/dist/switch.js.map +1 -1
- package/dist/tab-list.js +35 -306
- package/dist/tab-list.js.map +1 -1
- package/dist/table.js +5 -32
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +10 -150
- package/dist/tabs.js.map +1 -1
- package/dist/tag.d.ts +7 -6
- package/dist/tag.js +101 -97
- package/dist/tag.js.map +1 -1
- package/dist/testimonial-block.d.ts +34 -0
- package/dist/testimonial-block.js +377 -0
- package/dist/testimonial-block.js.map +1 -0
- package/dist/textarea.js +6 -73
- package/dist/textarea.js.map +1 -1
- package/dist/time-picker.js +119 -279
- package/dist/time-picker.js.map +1 -1
- package/dist/toast.js +27 -132
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.d.ts +5 -5
- package/dist/tooltip.js +7 -90
- package/dist/tooltip.js.map +1 -1
- package/dist/tree-map.js +41 -414
- package/dist/tree-map.js.map +1 -1
- package/dist/waterfall-chart.d.ts +129 -0
- package/dist/waterfall-chart.js +577 -0
- package/dist/waterfall-chart.js.map +1 -0
- package/package.json +98 -28
- package/dist/base.css +0 -32
- package/dist/files/red-hat-display-latin-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff2 +0 -0
- package/dist/index.d.ts +0 -87
- package/dist/index.js +0 -10448
- package/dist/index.js.map +0 -1
- package/dist/red-hat-display.css +0 -2
- package/dist/theme/giddaa.css +0 -2
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
ButtonLink
|
|
4
|
+
} from "./chunk-B4H6RNDH.js";
|
|
5
|
+
import {
|
|
6
|
+
Carousel,
|
|
7
|
+
CarouselContent,
|
|
8
|
+
CarouselIndicator,
|
|
9
|
+
CarouselItem
|
|
10
|
+
} from "./chunk-FZDSVMKY.js";
|
|
11
|
+
import "./chunk-HL3ZSYES.js";
|
|
12
|
+
import {
|
|
13
|
+
cn
|
|
14
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
15
|
+
|
|
16
|
+
// src/property-listing-card.tsx
|
|
17
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
18
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
19
|
+
import { cva } from "class-variance-authority";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
var propertyListingCardVariants = cva(
|
|
22
|
+
"relative flex w-full min-w-0 flex-col overflow-hidden text-fg-primary",
|
|
23
|
+
{
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
default: "rounded-none border-0 shadow-none",
|
|
27
|
+
elevated: "rounded-2xl bg-surface-overlay border border-line-subtle shadow-1"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "default"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
function PropertyListingCard({
|
|
36
|
+
className,
|
|
37
|
+
variant,
|
|
38
|
+
...props
|
|
39
|
+
}) {
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"article",
|
|
42
|
+
{
|
|
43
|
+
className: cn(propertyListingCardVariants({ variant }), className),
|
|
44
|
+
...props
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function PropertyListingCardMedia({
|
|
49
|
+
className,
|
|
50
|
+
images = [],
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}) {
|
|
54
|
+
const hasMultipleImages = images.length > 1;
|
|
55
|
+
return /* @__PURE__ */ jsxs(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: cn(
|
|
59
|
+
"relative isolate min-h-70 overflow-hidden rounded-t-2xl bg-surface text-fg-primary",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
...props,
|
|
63
|
+
children: [
|
|
64
|
+
hasMultipleImages ? /* @__PURE__ */ jsxs(
|
|
65
|
+
Carousel,
|
|
66
|
+
{
|
|
67
|
+
imageSize: "full",
|
|
68
|
+
opts: { loop: true },
|
|
69
|
+
className: "absolute inset-0 -z-10 size-full rounded-none bg-surface",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(CarouselContent, { children: images.map((carouselImage, index) => /* @__PURE__ */ jsx(
|
|
72
|
+
CarouselItem,
|
|
73
|
+
{
|
|
74
|
+
className: "relative h-full",
|
|
75
|
+
children: /* @__PURE__ */ jsx(PropertyListingCardImage, { image: carouselImage })
|
|
76
|
+
},
|
|
77
|
+
carouselImage.id ?? carouselImage.src ?? carouselImage.alt ?? index
|
|
78
|
+
)) }),
|
|
79
|
+
/* @__PURE__ */ jsx(CarouselIndicator, { size: "sm", className: "bottom-16" })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
) : images[0]?.src ? /* @__PURE__ */ jsx(
|
|
83
|
+
PropertyListingCardImage,
|
|
84
|
+
{
|
|
85
|
+
image: images[0],
|
|
86
|
+
className: "absolute inset-0 -z-10"
|
|
87
|
+
}
|
|
88
|
+
) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 -z-10 grid place-items-center bg-surface-raised text-gdt-sm font-bold text-fg-caption-placeholder", children: "Property Image" }),
|
|
89
|
+
children
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function PropertyListingCardImage({
|
|
95
|
+
image,
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
"img",
|
|
101
|
+
{
|
|
102
|
+
src: image.src,
|
|
103
|
+
alt: image.alt ?? "Property image",
|
|
104
|
+
className: cn("size-full object-cover", className),
|
|
105
|
+
...props
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
function PropertyListingCardMediaTop({
|
|
110
|
+
className,
|
|
111
|
+
...props
|
|
112
|
+
}) {
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: cn(
|
|
117
|
+
"absolute inset-x-2 top-2 z-10 flex items-start justify-between gap-3",
|
|
118
|
+
className
|
|
119
|
+
),
|
|
120
|
+
...props
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function PropertyListingCardOptionsBar({
|
|
125
|
+
className,
|
|
126
|
+
render,
|
|
127
|
+
...props
|
|
128
|
+
}) {
|
|
129
|
+
return useRender({
|
|
130
|
+
defaultTagName: "a",
|
|
131
|
+
props: mergeProps(
|
|
132
|
+
{
|
|
133
|
+
className: cn(
|
|
134
|
+
"absolute inset-x-0 bottom-0 z-10 flex min-h-9.5 items-center justify-center gap-1 bg-black/80 px-4 py-1.5 text-center text-gdt-subtext font-extrabold tracking-wide text-white uppercase transition-[background-color] hover:bg-black/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-focus",
|
|
135
|
+
className
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
props
|
|
139
|
+
),
|
|
140
|
+
render,
|
|
141
|
+
state: {
|
|
142
|
+
slot: "property-listing-card-options-bar"
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function PropertyListingCardDetails({
|
|
147
|
+
className,
|
|
148
|
+
...props
|
|
149
|
+
}) {
|
|
150
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-4 pt-4", className), ...props });
|
|
151
|
+
}
|
|
152
|
+
function PropertyListingCardTitle({
|
|
153
|
+
className,
|
|
154
|
+
...props
|
|
155
|
+
}) {
|
|
156
|
+
return /* @__PURE__ */ jsx(
|
|
157
|
+
"h3",
|
|
158
|
+
{
|
|
159
|
+
className: cn("text-gdt-md font-bold text-fg-primary", className),
|
|
160
|
+
...props
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function PropertyListingCardOverview({
|
|
165
|
+
className,
|
|
166
|
+
...props
|
|
167
|
+
}) {
|
|
168
|
+
return /* @__PURE__ */ jsx("p", { className: cn("text-gdt-sm text-fg-secondary", className), ...props });
|
|
169
|
+
}
|
|
170
|
+
function PropertyListingCardBadges({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}) {
|
|
174
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-wrap gap-3", className), ...props });
|
|
175
|
+
}
|
|
176
|
+
function PropertyListingCardActions({
|
|
177
|
+
className,
|
|
178
|
+
...props
|
|
179
|
+
}) {
|
|
180
|
+
return /* @__PURE__ */ jsx(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
className: cn(
|
|
184
|
+
"flex items-center gap-5 border-line-subtle border-t pt-4 mt-4",
|
|
185
|
+
className
|
|
186
|
+
),
|
|
187
|
+
...props
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
function PropertyListingCardActionButton({
|
|
192
|
+
className,
|
|
193
|
+
type = "button",
|
|
194
|
+
...props
|
|
195
|
+
}) {
|
|
196
|
+
return /* @__PURE__ */ jsx(
|
|
197
|
+
Button,
|
|
198
|
+
{
|
|
199
|
+
type,
|
|
200
|
+
variant: "tertiary",
|
|
201
|
+
size: "md",
|
|
202
|
+
className: cn("flex-1 bg-action-tertiary text-fg-primary", className),
|
|
203
|
+
...props
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
function PropertyListingCardActionButtonLink({
|
|
208
|
+
className,
|
|
209
|
+
...props
|
|
210
|
+
}) {
|
|
211
|
+
return /* @__PURE__ */ jsx(
|
|
212
|
+
ButtonLink,
|
|
213
|
+
{
|
|
214
|
+
variant: "tertiary",
|
|
215
|
+
size: "md",
|
|
216
|
+
className: cn("flex-1 bg-action-tertiary text-fg-primary", className),
|
|
217
|
+
...props
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
export {
|
|
222
|
+
PropertyListingCard,
|
|
223
|
+
PropertyListingCardActionButton,
|
|
224
|
+
PropertyListingCardActionButtonLink,
|
|
225
|
+
PropertyListingCardActions,
|
|
226
|
+
PropertyListingCardBadges,
|
|
227
|
+
PropertyListingCardDetails,
|
|
228
|
+
PropertyListingCardMedia,
|
|
229
|
+
PropertyListingCardMediaTop,
|
|
230
|
+
PropertyListingCardOptionsBar,
|
|
231
|
+
PropertyListingCardOverview,
|
|
232
|
+
PropertyListingCardTitle,
|
|
233
|
+
propertyListingCardVariants
|
|
234
|
+
};
|
|
235
|
+
//# sourceMappingURL=property-listing-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/property-listing-card.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { Button, ButtonLink } from \"./button\";\nimport {\n\tCarousel,\n\tCarouselContent,\n\tCarouselIndicator,\n\tCarouselItem,\n} from \"./carousel\";\n\nimport { cn } from \"./lib/cn\";\n\nconst propertyListingCardVariants = cva(\n\t\"relative flex w-full min-w-0 flex-col overflow-hidden text-fg-primary\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"rounded-none border-0 shadow-none\",\n\t\t\t\televated:\n\t\t\t\t\t\"rounded-2xl bg-surface-overlay border border-line-subtle shadow-1\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t},\n\t},\n);\n\ntype PropertyListingImage = {\n\tid?: string;\n\tsrc?: string;\n\talt?: string;\n};\n\ninterface PropertyListingCardProps\n\textends React.ComponentProps<\"article\">,\n\t\tVariantProps<typeof propertyListingCardVariants> {}\n\nfunction PropertyListingCard({\n\tclassName,\n\tvariant,\n\t...props\n}: PropertyListingCardProps) {\n\treturn (\n\t\t<article\n\t\t\tclassName={cn(propertyListingCardVariants({ variant }), className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PropertyListingCardMedia({\n\tclassName,\n\timages = [],\n\tchildren,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\timages?: PropertyListingImage[];\n}) {\n\tconst hasMultipleImages = images.length > 1;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"relative isolate min-h-70 overflow-hidden rounded-t-2xl bg-surface text-fg-primary\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{hasMultipleImages ? (\n\t\t\t\t<Carousel\n\t\t\t\t\timageSize=\"full\"\n\t\t\t\t\topts={{ loop: true }}\n\t\t\t\t\tclassName=\"absolute inset-0 -z-10 size-full rounded-none bg-surface\"\n\t\t\t\t>\n\t\t\t\t\t<CarouselContent>\n\t\t\t\t\t\t{images.map((carouselImage, index) => (\n\t\t\t\t\t\t\t<CarouselItem\n\t\t\t\t\t\t\t\tkey={\n\t\t\t\t\t\t\t\t\tcarouselImage.id ??\n\t\t\t\t\t\t\t\t\tcarouselImage.src ??\n\t\t\t\t\t\t\t\t\tcarouselImage.alt ??\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName=\"relative h-full\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PropertyListingCardImage image={carouselImage} />\n\t\t\t\t\t\t\t</CarouselItem>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</CarouselContent>\n\t\t\t\t\t<CarouselIndicator size=\"sm\" className=\"bottom-16\" />\n\t\t\t\t</Carousel>\n\t\t\t) : images[0]?.src ? (\n\t\t\t\t<PropertyListingCardImage\n\t\t\t\t\timage={images[0]}\n\t\t\t\t\tclassName=\"absolute inset-0 -z-10\"\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div className=\"absolute inset-0 -z-10 grid place-items-center bg-surface-raised text-gdt-sm font-bold text-fg-caption-placeholder\">\n\t\t\t\t\tProperty Image\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\nfunction PropertyListingCardImage({\n\timage,\n\tclassName,\n\t...props\n}: React.ComponentProps<\"img\"> & {\n\timage: PropertyListingImage;\n}) {\n\treturn (\n\t\t<img\n\t\t\tsrc={image.src}\n\t\t\talt={image.alt ?? \"Property image\"}\n\t\t\tclassName={cn(\"size-full object-cover\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PropertyListingCardMediaTop({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"absolute inset-x-2 top-2 z-10 flex items-start justify-between gap-3\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PropertyListingCardOptionsBar({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"a\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"a\",\n\t\tprops: mergeProps<\"a\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"absolute inset-x-0 bottom-0 z-10 flex min-h-9.5 items-center justify-center gap-1 bg-black/80 px-4 py-1.5 text-center text-gdt-subtext font-extrabold tracking-wide text-white uppercase transition-[background-color] hover:bg-black/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-focus\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: \"property-listing-card-options-bar\",\n\t\t},\n\t});\n}\n\nfunction PropertyListingCardDetails({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div className={cn(\"flex flex-col gap-4 pt-4\", className)} {...props} />\n\t);\n}\n\nfunction PropertyListingCardTitle({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"h3\">) {\n\treturn (\n\t\t<h3\n\t\t\tclassName={cn(\"text-gdt-md font-bold text-fg-primary\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PropertyListingCardOverview({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"p\">) {\n\treturn (\n\t\t<p className={cn(\"text-gdt-sm text-fg-secondary\", className)} {...props} />\n\t);\n}\n\nfunction PropertyListingCardBadges({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"div\">) {\n\treturn <div className={cn(\"flex flex-wrap gap-3\", className)} {...props} />;\n}\n\nfunction PropertyListingCardActions({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"flex items-center gap-5 border-line-subtle border-t pt-4 mt-4\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PropertyListingCardActionButton({\n\tclassName,\n\ttype = \"button\",\n\t...props\n}: React.ComponentProps<typeof Button>) {\n\treturn (\n\t\t<Button\n\t\t\ttype={type}\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"md\"\n\t\t\tclassName={cn(\"flex-1 bg-action-tertiary text-fg-primary\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PropertyListingCardActionButtonLink({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof ButtonLink>) {\n\treturn (\n\t\t<ButtonLink\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"md\"\n\t\t\tclassName={cn(\"flex-1 bg-action-tertiary text-fg-primary\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tPropertyListingCard,\n\tPropertyListingCardActionButton,\n\tPropertyListingCardActionButtonLink,\n\tPropertyListingCardActions,\n\tPropertyListingCardBadges,\n\tPropertyListingCardDetails,\n\tPropertyListingCardMedia,\n\tPropertyListingCardMediaTop,\n\tPropertyListingCardOptionsBar,\n\tPropertyListingCardOverview,\n\tPropertyListingCardTitle,\n\tpropertyListingCardVariants,\n};\nexport type { PropertyListingCardProps, PropertyListingImage };\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RadarChart as RadarChart$1, PolarAngleAxis, PolarGrid, Radar, PolarRadiusAxis } from 'recharts';
|
|
3
|
+
import { ChartConfig } from './chart.js';
|
|
4
|
+
import { ComponentSize } from './size-context.js';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Radar charts are composable wrappers over the recharts polar primitives.
|
|
10
|
+
* recharts 3 registers graphical items through context when they render, so —
|
|
11
|
+
* unlike the recharts 2 era that shaped `bar-chart`/`line-chart` — the
|
|
12
|
+
* primitives CAN be wrapped in our own components. Each wrapper bakes in the
|
|
13
|
+
* giddaa defaults (tokens, size-scaled type, mark specs) and forwards every
|
|
14
|
+
* recharts prop, so anything can be overridden in place or replaced with the
|
|
15
|
+
* raw recharts element.
|
|
16
|
+
*
|
|
17
|
+
* Anatomy: `RadarChart` is the plot root (frame + responsive box + recharts
|
|
18
|
+
* chart); compose the grid, axes, series, and the shared overlays from
|
|
19
|
+
* `./chart` as children:
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <ChartCard size="md">
|
|
23
|
+
* <ChartHeader>
|
|
24
|
+
* <ChartTitle>Listing scorecard</ChartTitle>
|
|
25
|
+
* <ChartDescription>How this listing scores per criterion</ChartDescription>
|
|
26
|
+
* </ChartHeader>
|
|
27
|
+
* <RadarChart config={config} data={data}>
|
|
28
|
+
* <RadarChartGrid />
|
|
29
|
+
* <RadarChartAngleAxis dataKey="criterion" />
|
|
30
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
31
|
+
* <RadarChartSeries dataKey="score" name="This listing" />
|
|
32
|
+
* </RadarChart>
|
|
33
|
+
* </ChartCard>
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Categorical series palette — the theme-aware `chart-1`…`chart-3` tokens
|
|
37
|
+
* (each theme's steps are validated against that theme's chart surface; see
|
|
38
|
+
* `styles/giddaa.css`). Assign colours in this fixed order, never cycled: a
|
|
39
|
+
* fourth series folds into "Other" or becomes a second chart.
|
|
40
|
+
*/
|
|
41
|
+
declare const RADAR_CHART_PALETTE: readonly ["var(--color-chart-1)", "var(--color-chart-2)", "var(--color-chart-3)"];
|
|
42
|
+
type RadarChartLayout = {
|
|
43
|
+
/** Plot height in px. Width stays fluid via the ResponsiveContainer. */
|
|
44
|
+
height: number;
|
|
45
|
+
/** Category (angle) and value (radius) tick label font size. */
|
|
46
|
+
tickFontSize: number;
|
|
47
|
+
/** Series outline stroke width in px. */
|
|
48
|
+
strokeWidth: number;
|
|
49
|
+
/** Radius of the resting data-point dot. */
|
|
50
|
+
dotRadius: number;
|
|
51
|
+
/** Radius of the active (hover) dot. */
|
|
52
|
+
activeDotRadius: number;
|
|
53
|
+
};
|
|
54
|
+
declare const RADAR_CHART_LAYOUT: Record<ComponentSize, RadarChartLayout>;
|
|
55
|
+
type RadarChartProps = Omit<React.ComponentProps<typeof RadarChart$1>, "width" | "height"> & {
|
|
56
|
+
/** Series labels/icons for the shared tooltip and legend (see `ChartConfig`). */
|
|
57
|
+
config?: ChartConfig;
|
|
58
|
+
/** Plot scale; inherited from the nearest `SizeProvider` when omitted. */
|
|
59
|
+
size?: ComponentSize;
|
|
60
|
+
/** Applied to the responsive plot box, e.g. to override its height. */
|
|
61
|
+
className?: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Plot root — wraps the shared `ChartContainer` (tooltip/legend theming,
|
|
65
|
+
* responsive box) around the recharts `RadarChart` with a size-scaled height.
|
|
66
|
+
* `size` also flows to the child primitives through `SizeProvider`. Extra
|
|
67
|
+
* props reach the recharts chart (`outerRadius`, `startAngle`, `margin`, …).
|
|
68
|
+
*/
|
|
69
|
+
declare function RadarChart({ config, size, className, children, ...props }: RadarChartProps): React.JSX.Element;
|
|
70
|
+
/**
|
|
71
|
+
* Polygon web behind the series — recharts `PolarGrid` on the recessive
|
|
72
|
+
* `line` token (`line-subtle` matches the ChartCard surface in both themes,
|
|
73
|
+
* so it would vanish). Pass `gridType="circle"` for rings or
|
|
74
|
+
* `radialLines={false}` to keep only the concentric outlines.
|
|
75
|
+
*/
|
|
76
|
+
declare function RadarChartGrid(props: React.ComponentProps<typeof PolarGrid>): React.JSX.Element;
|
|
77
|
+
/**
|
|
78
|
+
* Category labels around the rim — recharts `PolarAngleAxis` with no tick
|
|
79
|
+
* lines and size-scaled secondary-ink labels. Passing your own `tick`
|
|
80
|
+
* replaces the default styling entirely.
|
|
81
|
+
*/
|
|
82
|
+
declare function RadarChartAngleAxis({ size, tick, ...props }: React.ComponentProps<typeof PolarAngleAxis> & {
|
|
83
|
+
size?: ComponentSize;
|
|
84
|
+
}): React.JSX.Element;
|
|
85
|
+
/**
|
|
86
|
+
* Value scale along one spoke — recharts `PolarRadiusAxis`, muted and
|
|
87
|
+
* line-free. Radars are usually read comparatively, so this is opt-in;
|
|
88
|
+
* include it (often with an explicit `domain={[0, max]}`) when the absolute
|
|
89
|
+
* scale matters. If the tick labels collide with a category label, move the
|
|
90
|
+
* scale between two spokes with `angle`.
|
|
91
|
+
*/
|
|
92
|
+
declare function RadarChartValueAxis({ size, tick, ...props }: React.ComponentProps<typeof PolarRadiusAxis> & {
|
|
93
|
+
size?: ComponentSize;
|
|
94
|
+
}): React.JSX.Element;
|
|
95
|
+
type RadarChartSeriesProps = React.ComponentProps<typeof Radar> & {
|
|
96
|
+
/** Series colour for the outline, wash, and dots. Defaults to brand. */
|
|
97
|
+
color?: string;
|
|
98
|
+
/** Explicit mark scale; otherwise inherited from the chart's `size`. */
|
|
99
|
+
size?: ComponentSize;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* One data series — recharts `Radar` with the giddaa mark spec: a 2px outline,
|
|
103
|
+
* the series colour washed to 15% inside the shape (matches the line-chart
|
|
104
|
+
* area wash), solid resting dots, and a hover dot ringed in `surface-raised`
|
|
105
|
+
* so overlapping series stay separable. `color` drives all of them at once;
|
|
106
|
+
* `stroke`/`fill`/`dot` still win when passed directly.
|
|
107
|
+
*/
|
|
108
|
+
declare function RadarChartSeries({ color, size, dot, activeDot, ...props }: RadarChartSeriesProps): React.JSX.Element;
|
|
109
|
+
|
|
110
|
+
export { RADAR_CHART_LAYOUT, RADAR_CHART_PALETTE, RadarChart, RadarChartAngleAxis, RadarChartGrid, type RadarChartLayout, type RadarChartProps, RadarChartSeries, type RadarChartSeriesProps, RadarChartValueAxis };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ChartContainer
|
|
4
|
+
} from "./chunk-NOFXVRWL.js";
|
|
5
|
+
import {
|
|
6
|
+
SizeProvider,
|
|
7
|
+
useComponentSize
|
|
8
|
+
} from "./chunk-HL3ZSYES.js";
|
|
9
|
+
import {
|
|
10
|
+
cn
|
|
11
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
12
|
+
|
|
13
|
+
// src/radar-chart.tsx
|
|
14
|
+
import {
|
|
15
|
+
PolarAngleAxis,
|
|
16
|
+
PolarGrid,
|
|
17
|
+
PolarRadiusAxis,
|
|
18
|
+
Radar,
|
|
19
|
+
RadarChart as RadarChartPrimitive
|
|
20
|
+
} from "recharts";
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
var RADAR_CHART_PALETTE = [
|
|
23
|
+
"var(--color-chart-1)",
|
|
24
|
+
"var(--color-chart-2)",
|
|
25
|
+
"var(--color-chart-3)"
|
|
26
|
+
];
|
|
27
|
+
var DEFAULT_SERIES_COLOR = RADAR_CHART_PALETTE[0];
|
|
28
|
+
var RADAR_CHART_LAYOUT = {
|
|
29
|
+
sm: {
|
|
30
|
+
height: 180,
|
|
31
|
+
tickFontSize: 10,
|
|
32
|
+
strokeWidth: 2,
|
|
33
|
+
dotRadius: 2.5,
|
|
34
|
+
activeDotRadius: 4
|
|
35
|
+
},
|
|
36
|
+
md: {
|
|
37
|
+
height: 240,
|
|
38
|
+
tickFontSize: 11,
|
|
39
|
+
strokeWidth: 2,
|
|
40
|
+
dotRadius: 3,
|
|
41
|
+
activeDotRadius: 4.5
|
|
42
|
+
},
|
|
43
|
+
lg: {
|
|
44
|
+
height: 300,
|
|
45
|
+
tickFontSize: 12,
|
|
46
|
+
strokeWidth: 2,
|
|
47
|
+
dotRadius: 3.5,
|
|
48
|
+
activeDotRadius: 5
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function RadarChart({
|
|
52
|
+
config = {},
|
|
53
|
+
size,
|
|
54
|
+
className,
|
|
55
|
+
children,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
const resolvedSize = useComponentSize(size);
|
|
59
|
+
const layout = RADAR_CHART_LAYOUT[resolvedSize];
|
|
60
|
+
return /* @__PURE__ */ jsx(SizeProvider, { size: resolvedSize, children: /* @__PURE__ */ jsx(
|
|
61
|
+
ChartContainer,
|
|
62
|
+
{
|
|
63
|
+
config,
|
|
64
|
+
className: cn("aspect-auto w-full", className),
|
|
65
|
+
style: { height: layout.height },
|
|
66
|
+
children: /* @__PURE__ */ jsx(RadarChartPrimitive, { accessibilityLayer: true, ...props, children })
|
|
67
|
+
}
|
|
68
|
+
) });
|
|
69
|
+
}
|
|
70
|
+
function RadarChartGrid(props) {
|
|
71
|
+
return /* @__PURE__ */ jsx(PolarGrid, { stroke: "var(--color-line)", ...props });
|
|
72
|
+
}
|
|
73
|
+
function RadarChartAngleAxis({
|
|
74
|
+
size,
|
|
75
|
+
tick,
|
|
76
|
+
...props
|
|
77
|
+
}) {
|
|
78
|
+
const layout = RADAR_CHART_LAYOUT[useComponentSize(size)];
|
|
79
|
+
const defaultTick = {
|
|
80
|
+
fontSize: layout.tickFontSize,
|
|
81
|
+
fill: "var(--color-fg-secondary)"
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ jsx(PolarAngleAxis, { tickLine: false, tick: tick ?? defaultTick, ...props });
|
|
84
|
+
}
|
|
85
|
+
function RadarChartValueAxis({
|
|
86
|
+
size,
|
|
87
|
+
tick,
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
const layout = RADAR_CHART_LAYOUT[useComponentSize(size)];
|
|
91
|
+
const defaultTick = {
|
|
92
|
+
fontSize: layout.tickFontSize,
|
|
93
|
+
fill: "var(--color-fg-caption-placeholder)"
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
PolarRadiusAxis,
|
|
97
|
+
{
|
|
98
|
+
axisLine: false,
|
|
99
|
+
tickLine: false,
|
|
100
|
+
tick: tick ?? defaultTick,
|
|
101
|
+
...props
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function RadarChartSeries({
|
|
106
|
+
color = DEFAULT_SERIES_COLOR,
|
|
107
|
+
size,
|
|
108
|
+
dot,
|
|
109
|
+
activeDot,
|
|
110
|
+
...props
|
|
111
|
+
}) {
|
|
112
|
+
const layout = RADAR_CHART_LAYOUT[useComponentSize(size)];
|
|
113
|
+
const defaultDot = {
|
|
114
|
+
r: layout.dotRadius,
|
|
115
|
+
fill: color,
|
|
116
|
+
fillOpacity: 1,
|
|
117
|
+
strokeWidth: 0
|
|
118
|
+
};
|
|
119
|
+
const defaultActiveDot = {
|
|
120
|
+
r: layout.activeDotRadius,
|
|
121
|
+
fill: color,
|
|
122
|
+
stroke: "var(--color-surface-raised)",
|
|
123
|
+
strokeWidth: 2
|
|
124
|
+
};
|
|
125
|
+
return /* @__PURE__ */ jsx(
|
|
126
|
+
Radar,
|
|
127
|
+
{
|
|
128
|
+
stroke: color,
|
|
129
|
+
fill: color,
|
|
130
|
+
fillOpacity: 0.15,
|
|
131
|
+
strokeWidth: layout.strokeWidth,
|
|
132
|
+
dot: dot ?? defaultDot,
|
|
133
|
+
activeDot: activeDot ?? defaultActiveDot,
|
|
134
|
+
...props
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
RADAR_CHART_LAYOUT,
|
|
140
|
+
RADAR_CHART_PALETTE,
|
|
141
|
+
RadarChart,
|
|
142
|
+
RadarChartAngleAxis,
|
|
143
|
+
RadarChartGrid,
|
|
144
|
+
RadarChartSeries,
|
|
145
|
+
RadarChartValueAxis
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=radar-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/radar-chart.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport {\n\tPolarAngleAxis,\n\tPolarGrid,\n\tPolarRadiusAxis,\n\tRadar,\n\tRadarChart as RadarChartPrimitive,\n} from \"recharts\";\nimport { type ChartConfig, ChartContainer } from \"./chart\";\nimport { cn } from \"./lib/cn\";\nimport {\n\ttype ComponentSize,\n\tSizeProvider,\n\tuseComponentSize,\n} from \"./size-context\";\n\n/**\n * Radar charts are composable wrappers over the recharts polar primitives.\n * recharts 3 registers graphical items through context when they render, so —\n * unlike the recharts 2 era that shaped `bar-chart`/`line-chart` — the\n * primitives CAN be wrapped in our own components. Each wrapper bakes in the\n * giddaa defaults (tokens, size-scaled type, mark specs) and forwards every\n * recharts prop, so anything can be overridden in place or replaced with the\n * raw recharts element.\n *\n * Anatomy: `RadarChart` is the plot root (frame + responsive box + recharts\n * chart); compose the grid, axes, series, and the shared overlays from\n * `./chart` as children:\n *\n * @example\n * <ChartCard size=\"md\">\n * <ChartHeader>\n * <ChartTitle>Listing scorecard</ChartTitle>\n * <ChartDescription>How this listing scores per criterion</ChartDescription>\n * </ChartHeader>\n * <RadarChart config={config} data={data}>\n * <RadarChartGrid />\n * <RadarChartAngleAxis dataKey=\"criterion\" />\n * <ChartTooltip content={<ChartTooltipContent />} />\n * <RadarChartSeries dataKey=\"score\" name=\"This listing\" />\n * </RadarChart>\n * </ChartCard>\n */\n\n/**\n * Categorical series palette — the theme-aware `chart-1`…`chart-3` tokens\n * (each theme's steps are validated against that theme's chart surface; see\n * `styles/giddaa.css`). Assign colours in this fixed order, never cycled: a\n * fourth series folds into \"Other\" or becomes a second chart.\n */\nconst RADAR_CHART_PALETTE = [\n\t\"var(--color-chart-1)\",\n\t\"var(--color-chart-2)\",\n\t\"var(--color-chart-3)\",\n] as const;\n\nconst DEFAULT_SERIES_COLOR = RADAR_CHART_PALETTE[0];\n\ntype RadarChartLayout = {\n\t/** Plot height in px. Width stays fluid via the ResponsiveContainer. */\n\theight: number;\n\t/** Category (angle) and value (radius) tick label font size. */\n\ttickFontSize: number;\n\t/** Series outline stroke width in px. */\n\tstrokeWidth: number;\n\t/** Radius of the resting data-point dot. */\n\tdotRadius: number;\n\t/** Radius of the active (hover) dot. */\n\tactiveDotRadius: number;\n};\n\nconst RADAR_CHART_LAYOUT: Record<ComponentSize, RadarChartLayout> = {\n\tsm: {\n\t\theight: 180,\n\t\ttickFontSize: 10,\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 2.5,\n\t\tactiveDotRadius: 4,\n\t},\n\tmd: {\n\t\theight: 240,\n\t\ttickFontSize: 11,\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3,\n\t\tactiveDotRadius: 4.5,\n\t},\n\tlg: {\n\t\theight: 300,\n\t\ttickFontSize: 12,\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3.5,\n\t\tactiveDotRadius: 5,\n\t},\n};\n\ntype RadarChartProps = Omit<\n\tReact.ComponentProps<typeof RadarChartPrimitive>,\n\t\"width\" | \"height\"\n> & {\n\t/** Series labels/icons for the shared tooltip and legend (see `ChartConfig`). */\n\tconfig?: ChartConfig;\n\t/** Plot scale; inherited from the nearest `SizeProvider` when omitted. */\n\tsize?: ComponentSize;\n\t/** Applied to the responsive plot box, e.g. to override its height. */\n\tclassName?: string;\n};\n\n/**\n * Plot root — wraps the shared `ChartContainer` (tooltip/legend theming,\n * responsive box) around the recharts `RadarChart` with a size-scaled height.\n * `size` also flows to the child primitives through `SizeProvider`. Extra\n * props reach the recharts chart (`outerRadius`, `startAngle`, `margin`, …).\n */\nfunction RadarChart({\n\tconfig = {},\n\tsize,\n\tclassName,\n\tchildren,\n\t...props\n}: RadarChartProps) {\n\tconst resolvedSize = useComponentSize(size);\n\tconst layout = RADAR_CHART_LAYOUT[resolvedSize];\n\n\treturn (\n\t\t<SizeProvider size={resolvedSize}>\n\t\t\t<ChartContainer\n\t\t\t\tconfig={config}\n\t\t\t\tclassName={cn(\"aspect-auto w-full\", className)}\n\t\t\t\tstyle={{ height: layout.height }}\n\t\t\t>\n\t\t\t\t<RadarChartPrimitive accessibilityLayer {...props}>\n\t\t\t\t\t{children}\n\t\t\t\t</RadarChartPrimitive>\n\t\t\t</ChartContainer>\n\t\t</SizeProvider>\n\t);\n}\n\n/**\n * Polygon web behind the series — recharts `PolarGrid` on the recessive\n * `line` token (`line-subtle` matches the ChartCard surface in both themes,\n * so it would vanish). Pass `gridType=\"circle\"` for rings or\n * `radialLines={false}` to keep only the concentric outlines.\n */\nfunction RadarChartGrid(props: React.ComponentProps<typeof PolarGrid>) {\n\treturn <PolarGrid stroke=\"var(--color-line)\" {...props} />;\n}\n\n/**\n * Category labels around the rim — recharts `PolarAngleAxis` with no tick\n * lines and size-scaled secondary-ink labels. Passing your own `tick`\n * replaces the default styling entirely.\n */\nfunction RadarChartAngleAxis({\n\tsize,\n\ttick,\n\t...props\n}: React.ComponentProps<typeof PolarAngleAxis> & { size?: ComponentSize }) {\n\tconst layout = RADAR_CHART_LAYOUT[useComponentSize(size)];\n\tconst defaultTick = {\n\t\tfontSize: layout.tickFontSize,\n\t\tfill: \"var(--color-fg-secondary)\",\n\t};\n\n\treturn (\n\t\t<PolarAngleAxis tickLine={false} tick={tick ?? defaultTick} {...props} />\n\t);\n}\n\n/**\n * Value scale along one spoke — recharts `PolarRadiusAxis`, muted and\n * line-free. Radars are usually read comparatively, so this is opt-in;\n * include it (often with an explicit `domain={[0, max]}`) when the absolute\n * scale matters. If the tick labels collide with a category label, move the\n * scale between two spokes with `angle`.\n */\nfunction RadarChartValueAxis({\n\tsize,\n\ttick,\n\t...props\n}: React.ComponentProps<typeof PolarRadiusAxis> & { size?: ComponentSize }) {\n\tconst layout = RADAR_CHART_LAYOUT[useComponentSize(size)];\n\tconst defaultTick = {\n\t\tfontSize: layout.tickFontSize,\n\t\tfill: \"var(--color-fg-caption-placeholder)\",\n\t};\n\n\treturn (\n\t\t<PolarRadiusAxis\n\t\t\taxisLine={false}\n\t\t\ttickLine={false}\n\t\t\ttick={tick ?? defaultTick}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype RadarChartSeriesProps = React.ComponentProps<typeof Radar> & {\n\t/** Series colour for the outline, wash, and dots. Defaults to brand. */\n\tcolor?: string;\n\t/** Explicit mark scale; otherwise inherited from the chart's `size`. */\n\tsize?: ComponentSize;\n};\n\n/**\n * One data series — recharts `Radar` with the giddaa mark spec: a 2px outline,\n * the series colour washed to 15% inside the shape (matches the line-chart\n * area wash), solid resting dots, and a hover dot ringed in `surface-raised`\n * so overlapping series stay separable. `color` drives all of them at once;\n * `stroke`/`fill`/`dot` still win when passed directly.\n */\nfunction RadarChartSeries({\n\tcolor = DEFAULT_SERIES_COLOR,\n\tsize,\n\tdot,\n\tactiveDot,\n\t...props\n}: RadarChartSeriesProps) {\n\tconst layout = RADAR_CHART_LAYOUT[useComponentSize(size)];\n\tconst defaultDot = {\n\t\tr: layout.dotRadius,\n\t\tfill: color,\n\t\tfillOpacity: 1,\n\t\tstrokeWidth: 0,\n\t};\n\tconst defaultActiveDot = {\n\t\tr: layout.activeDotRadius,\n\t\tfill: color,\n\t\tstroke: \"var(--color-surface-raised)\",\n\t\tstrokeWidth: 2,\n\t};\n\n\treturn (\n\t\t<Radar\n\t\t\tstroke={color}\n\t\t\tfill={color}\n\t\t\tfillOpacity={0.15}\n\t\t\tstrokeWidth={layout.strokeWidth}\n\t\t\tdot={dot ?? defaultDot}\n\t\t\tactiveDot={activeDot ?? defaultActiveDot}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tRADAR_CHART_LAYOUT,\n\tRADAR_CHART_PALETTE,\n\tRadarChart,\n\tRadarChartAngleAxis,\n\tRadarChartGrid,\n\tRadarChartSeries,\n\tRadarChartValueAxis,\n};\nexport type { RadarChartLayout, RadarChartProps, RadarChartSeriesProps };\n"],"mappings":";;;;;;;;;;;;;AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,OACR;AA2HH;AAhFJ,IAAM,sBAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAM,uBAAuB,oBAAoB,CAAC;AAelD,IAAM,qBAA8D;AAAA,EACnE,IAAI;AAAA,IACH,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,aAAa;AAAA,IACb,WAAW;AAAA,IACX,iBAAiB;AAAA,EAClB;AAAA,EACA,IAAI;AAAA,IACH,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,aAAa;AAAA,IACb,WAAW;AAAA,IACX,iBAAiB;AAAA,EAClB;AAAA,EACA,IAAI;AAAA,IACH,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,aAAa;AAAA,IACb,WAAW;AAAA,IACX,iBAAiB;AAAA,EAClB;AACD;AAoBA,SAAS,WAAW;AAAA,EACnB,SAAS,CAAC;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAoB;AACnB,QAAM,eAAe,iBAAiB,IAAI;AAC1C,QAAM,SAAS,mBAAmB,YAAY;AAE9C,SACC,oBAAC,gBAAa,MAAM,cACnB;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAW,GAAG,sBAAsB,SAAS;AAAA,MAC7C,OAAO,EAAE,QAAQ,OAAO,OAAO;AAAA,MAE/B,8BAAC,uBAAoB,oBAAkB,MAAE,GAAG,OAC1C,UACF;AAAA;AAAA,EACD,GACD;AAEF;AAQA,SAAS,eAAe,OAA+C;AACtE,SAAO,oBAAC,aAAU,QAAO,qBAAqB,GAAG,OAAO;AACzD;AAOA,SAAS,oBAAoB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAA2E;AAC1E,QAAM,SAAS,mBAAmB,iBAAiB,IAAI,CAAC;AACxD,QAAM,cAAc;AAAA,IACnB,UAAU,OAAO;AAAA,IACjB,MAAM;AAAA,EACP;AAEA,SACC,oBAAC,kBAAe,UAAU,OAAO,MAAM,QAAQ,aAAc,GAAG,OAAO;AAEzE;AASA,SAAS,oBAAoB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAA4E;AAC3E,QAAM,SAAS,mBAAmB,iBAAiB,IAAI,CAAC;AACxD,QAAM,cAAc;AAAA,IACnB,UAAU,OAAO;AAAA,IACjB,MAAM;AAAA,EACP;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAU;AAAA,MACV,UAAU;AAAA,MACV,MAAM,QAAQ;AAAA,MACb,GAAG;AAAA;AAAA,EACL;AAEF;AAgBA,SAAS,iBAAiB;AAAA,EACzB,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAA0B;AACzB,QAAM,SAAS,mBAAmB,iBAAiB,IAAI,CAAC;AACxD,QAAM,aAAa;AAAA,IAClB,GAAG,OAAO;AAAA,IACV,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,EACd;AACA,QAAM,mBAAmB;AAAA,IACxB,GAAG,OAAO;AAAA,IACV,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,EACd;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,MACb,aAAa,OAAO;AAAA,MACpB,KAAK,OAAO;AAAA,MACZ,WAAW,aAAa;AAAA,MACvB,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
|
package/dist/radio-group.js
CHANGED
|
@@ -1,53 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useComponentSize
|
|
4
|
+
} from "./chunk-HL3ZSYES.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
8
|
+
|
|
9
|
+
// src/radio-group.tsx
|
|
2
10
|
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
3
11
|
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
|
|
4
12
|
import { cva } from "class-variance-authority";
|
|
5
|
-
|
|
6
|
-
// src/lib/cn.ts
|
|
7
|
-
import { clsx } from "clsx";
|
|
8
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
9
|
-
var twMerge = extendTailwindMerge({
|
|
10
|
-
extend: {
|
|
11
|
-
classGroups: {
|
|
12
|
-
"font-size": [
|
|
13
|
-
{
|
|
14
|
-
text: [
|
|
15
|
-
"gdt-display",
|
|
16
|
-
"gdt-h1",
|
|
17
|
-
"gdt-h2",
|
|
18
|
-
"gdt-h3",
|
|
19
|
-
"gdt-h4",
|
|
20
|
-
"gdt-h5",
|
|
21
|
-
"gdt-xl",
|
|
22
|
-
"gdt-lg",
|
|
23
|
-
"gdt-md",
|
|
24
|
-
"gdt-sm",
|
|
25
|
-
"gdt-xs",
|
|
26
|
-
"gdt-subtext",
|
|
27
|
-
"gdt-capitalized"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
function cn(...inputs) {
|
|
35
|
-
return twMerge(clsx(inputs));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/components/ui/size-context.tsx
|
|
39
|
-
import { createContext, useContext } from "react";
|
|
40
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
41
|
-
var SizeContext = createContext(void 0);
|
|
42
|
-
function useComponentSize(size, fallback = "md") {
|
|
43
|
-
const inheritedSize = useContext(SizeContext);
|
|
44
|
-
return size ?? inheritedSize ?? fallback;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/components/ui/radio-group.tsx
|
|
48
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
49
14
|
function RadioGroup({ className, ...props }) {
|
|
50
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
51
16
|
RadioGroupPrimitive,
|
|
52
17
|
{
|
|
53
18
|
"data-slot": "radio-group",
|
|
@@ -57,7 +22,7 @@ function RadioGroup({ className, ...props }) {
|
|
|
57
22
|
);
|
|
58
23
|
}
|
|
59
24
|
var radioVariants = cva(
|
|
60
|
-
"group/radio-group-item peer relative flex aspect-square shrink-0 rounded-full border bg-transparent text-transparent outline-none transition-[background-color,border-color,box-shadow,color] after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-line-focus focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)] aria-invalid:border-line-danger aria-invalid:ring-3 aria-invalid:ring-destructive/20 border-line-strong data-checked:border-action-primary data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder size-5 [--radio-dot-size:0.75rem] group-data-[size=sm]/field:size-4 group-data-[size=sm]/field:[--radio-dot-size:0.625rem] group-data-[size=md]/field:size-5 group-data-[size=md]/field:[--radio-dot-size:0.75rem] group-data-[size=lg]/field:size-6 group-data-[size=lg]/field:[--radio-dot-size:0.875rem]",
|
|
25
|
+
"group/radio-group-item peer relative flex aspect-square shrink-0 rounded-full border-2 bg-transparent text-transparent outline-none transition-[background-color,border-color,box-shadow,color] after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-line-focus focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)] aria-invalid:border-line-danger aria-invalid:ring-3 aria-invalid:ring-destructive/20 border-line-strong data-checked:border-action-primary data-checked:text-action-primary data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder size-5 [--radio-dot-size:0.75rem] group-data-[size=sm]/field:size-4 group-data-[size=sm]/field:[--radio-dot-size:0.625rem] group-data-[size=md]/field:size-5 group-data-[size=md]/field:[--radio-dot-size:0.75rem] group-data-[size=lg]/field:size-6 group-data-[size=lg]/field:[--radio-dot-size:0.875rem]",
|
|
61
26
|
{
|
|
62
27
|
variants: {
|
|
63
28
|
size: {
|
|
@@ -74,19 +39,19 @@ function RadioGroupItem({
|
|
|
74
39
|
...props
|
|
75
40
|
}) {
|
|
76
41
|
const resolvedSize = useComponentSize(size);
|
|
77
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
78
43
|
RadioPrimitive.Root,
|
|
79
44
|
{
|
|
80
45
|
"data-slot": "radio-group-item",
|
|
81
46
|
"data-size": resolvedSize,
|
|
82
47
|
className: cn(radioVariants({ size: resolvedSize }), className),
|
|
83
48
|
...props,
|
|
84
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ jsx(
|
|
85
50
|
RadioPrimitive.Indicator,
|
|
86
51
|
{
|
|
87
52
|
"data-slot": "radio-group-indicator",
|
|
88
53
|
className: "flex size-full items-center justify-center",
|
|
89
|
-
children: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ jsx("span", { className: "absolute top-1/2 left-1/2 size-(--radio-dot-size) -translate-x-1/2 -translate-y-1/2 rounded-full bg-current" })
|
|
90
55
|
}
|
|
91
56
|
)
|
|
92
57
|
}
|
package/dist/radio-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/radio-group.tsx"],"sourcesContent":["\"use client\";\n\nimport { Radio as RadioPrimitive } from \"@base-ui/react/radio\";\nimport { RadioGroup as RadioGroupPrimitive } from \"@base-ui/react/radio-group\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./lib/cn\";\nimport { useComponentSize } from \"./size-context\";\n\nfunction RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {\n\treturn (\n\t\t<RadioGroupPrimitive\n\t\t\tdata-slot=\"radio-group\"\n\t\t\tclassName={cn(\"grid w-full gap-2\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst radioVariants = cva(\n\t\"group/radio-group-item peer relative flex aspect-square shrink-0 rounded-full border-2 bg-transparent text-transparent outline-none transition-[background-color,border-color,box-shadow,color] after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-line-focus focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)] aria-invalid:border-line-danger aria-invalid:ring-3 aria-invalid:ring-destructive/20 border-line-strong data-checked:border-action-primary data-checked:text-action-primary data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder size-5 [--radio-dot-size:0.75rem] group-data-[size=sm]/field:size-4 group-data-[size=sm]/field:[--radio-dot-size:0.625rem] group-data-[size=md]/field:size-5 group-data-[size=md]/field:[--radio-dot-size:0.75rem] group-data-[size=lg]/field:size-6 group-data-[size=lg]/field:[--radio-dot-size:0.875rem]\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: \"size-4 [--radio-dot-size:0.625rem]\",\n\t\t\t\tmd: \"size-5 [--radio-dot-size:0.75rem]\",\n\t\t\t\tlg: \"size-6 [--radio-dot-size:0.875rem]\",\n\t\t\t},\n\t\t},\n\t},\n);\n\ntype RadioGroupItemSize = NonNullable<\n\tVariantProps<typeof radioVariants>[\"size\"]\n>;\ntype RadioGroupItemProps<Value = unknown> = RadioPrimitive.Root.Props<Value> & {\n\tsize?: RadioGroupItemSize;\n};\n\n/**\n * Compose each radio item with the shared field primitives.\n *\n * ```tsx\n * <RadioGroup defaultValue=\"option-1\">\n * <Field orientation=\"horizontal\" size=\"md\">\n * <RadioGroupItem id=\"option-1\" value=\"option-1\" />\n * <FieldContent>\n * <FieldLabel htmlFor=\"option-1\">Radio label</FieldLabel>\n * <FieldDescription>Optional helper description for context.</FieldDescription>\n * </FieldContent>\n * </Field>\n * </RadioGroup>\n * ```\n */\nfunction RadioGroupItem<Value = unknown>({\n\tclassName,\n\tsize,\n\t...props\n}: RadioGroupItemProps<Value>) {\n\tconst resolvedSize = useComponentSize(size);\n\n\treturn (\n\t\t<RadioPrimitive.Root\n\t\t\tdata-slot=\"radio-group-item\"\n\t\t\tdata-size={resolvedSize}\n\t\t\tclassName={cn(radioVariants({ size: resolvedSize }), className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<RadioPrimitive.Indicator\n\t\t\t\tdata-slot=\"radio-group-indicator\"\n\t\t\t\tclassName=\"flex size-full items-center justify-center\"\n\t\t\t>\n\t\t\t\t<span className=\"absolute top-1/2 left-1/2 size-(--radio-dot-size) -translate-x-1/2 -translate-y-1/2 rounded-full bg-current\" />\n\t\t\t</RadioPrimitive.Indicator>\n\t\t</RadioPrimitive.Root>\n\t);\n}\n\nexport { RadioGroup, RadioGroupItem, radioVariants };\n"],"mappings":";;;;;;;;;AAEA,SAAS,SAAS,sBAAsB;AACxC,SAAS,cAAc,2BAA2B;AAClD,SAAS,WAA8B;AAOrC;AAFF,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAA8B;AACvE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,aAAU;AAAA,MACV,WAAW,GAAG,qBAAqB,SAAS;AAAA,MAC3C,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,IAAM,gBAAgB;AAAA,EACrB;AAAA,EACA;AAAA,IACC,UAAU;AAAA,MACT,MAAM;AAAA,QACL,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MACL;AAAA,IACD;AAAA,EACD;AACD;AAwBA,SAAS,eAAgC;AAAA,EACxC;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAA+B;AAC9B,QAAM,eAAe,iBAAiB,IAAI;AAE1C,SACC;AAAA,IAAC,eAAe;AAAA,IAAf;AAAA,MACA,aAAU;AAAA,MACV,aAAW;AAAA,MACX,WAAW,GAAG,cAAc,EAAE,MAAM,aAAa,CAAC,GAAG,SAAS;AAAA,MAC7D,GAAG;AAAA,MAEJ;AAAA,QAAC,eAAe;AAAA,QAAf;AAAA,UACA,aAAU;AAAA,UACV,WAAU;AAAA,UAEV,8BAAC,UAAK,WAAU,+GAA8G;AAAA;AAAA,MAC/H;AAAA;AAAA,EACD;AAEF;","names":[]}
|