@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,252 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ChartContainer,
|
|
4
|
+
cartesianAxisProps
|
|
5
|
+
} from "./chunk-NOFXVRWL.js";
|
|
6
|
+
import {
|
|
7
|
+
SizeProvider,
|
|
8
|
+
useComponentSize
|
|
9
|
+
} from "./chunk-HL3ZSYES.js";
|
|
10
|
+
import {
|
|
11
|
+
cn
|
|
12
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
13
|
+
|
|
14
|
+
// src/scatter-chart.tsx
|
|
15
|
+
import {
|
|
16
|
+
CartesianGrid,
|
|
17
|
+
Scatter,
|
|
18
|
+
ScatterChart as ScatterChartPrimitive,
|
|
19
|
+
XAxis,
|
|
20
|
+
YAxis
|
|
21
|
+
} from "recharts";
|
|
22
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
var SCATTER_CHART_PALETTE = [
|
|
24
|
+
"var(--color-chart-1)",
|
|
25
|
+
"var(--color-chart-2)",
|
|
26
|
+
"var(--color-chart-3)"
|
|
27
|
+
];
|
|
28
|
+
var DEFAULT_SERIES_COLOR = SCATTER_CHART_PALETTE[0];
|
|
29
|
+
var SCATTER_CHART_LAYOUT = {
|
|
30
|
+
sm: {
|
|
31
|
+
height: 220,
|
|
32
|
+
margin: { top: 16, right: 12, bottom: 0, left: 0 },
|
|
33
|
+
tickFontSize: 10,
|
|
34
|
+
tickMargin: 6,
|
|
35
|
+
yAxisWidth: 32,
|
|
36
|
+
dotRadius: 4,
|
|
37
|
+
activeDotRadius: 6
|
|
38
|
+
},
|
|
39
|
+
md: {
|
|
40
|
+
height: 260,
|
|
41
|
+
margin: { top: 20, right: 16, bottom: 0, left: 0 },
|
|
42
|
+
tickFontSize: 11,
|
|
43
|
+
tickMargin: 8,
|
|
44
|
+
yAxisWidth: 36,
|
|
45
|
+
dotRadius: 5,
|
|
46
|
+
activeDotRadius: 7
|
|
47
|
+
},
|
|
48
|
+
lg: {
|
|
49
|
+
height: 320,
|
|
50
|
+
margin: { top: 24, right: 20, bottom: 0, left: 0 },
|
|
51
|
+
tickFontSize: 12,
|
|
52
|
+
tickMargin: 10,
|
|
53
|
+
yAxisWidth: 40,
|
|
54
|
+
dotRadius: 6,
|
|
55
|
+
activeDotRadius: 8
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
function ScatterChart({
|
|
59
|
+
config = {},
|
|
60
|
+
size,
|
|
61
|
+
className,
|
|
62
|
+
children,
|
|
63
|
+
...props
|
|
64
|
+
}) {
|
|
65
|
+
const resolvedSize = useComponentSize(size);
|
|
66
|
+
const layout = SCATTER_CHART_LAYOUT[resolvedSize];
|
|
67
|
+
return /* @__PURE__ */ jsx(SizeProvider, { size: resolvedSize, children: /* @__PURE__ */ jsx(
|
|
68
|
+
ChartContainer,
|
|
69
|
+
{
|
|
70
|
+
config,
|
|
71
|
+
className: cn("aspect-auto w-full", className),
|
|
72
|
+
style: { height: layout.height },
|
|
73
|
+
children: /* @__PURE__ */ jsx(
|
|
74
|
+
ScatterChartPrimitive,
|
|
75
|
+
{
|
|
76
|
+
accessibilityLayer: true,
|
|
77
|
+
margin: layout.margin,
|
|
78
|
+
...props,
|
|
79
|
+
children
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
) });
|
|
84
|
+
}
|
|
85
|
+
function ScatterChartGrid(props) {
|
|
86
|
+
return /* @__PURE__ */ jsx(CartesianGrid, { stroke: "var(--color-line)", ...props });
|
|
87
|
+
}
|
|
88
|
+
function ScatterChartXAxis({
|
|
89
|
+
size,
|
|
90
|
+
type = "number",
|
|
91
|
+
tick,
|
|
92
|
+
...props
|
|
93
|
+
}) {
|
|
94
|
+
const layout = SCATTER_CHART_LAYOUT[useComponentSize(size)];
|
|
95
|
+
const axes = cartesianAxisProps(layout);
|
|
96
|
+
const defaultTick = {
|
|
97
|
+
...axes.xAxis.tick,
|
|
98
|
+
fill: "var(--color-fg-caption-placeholder)"
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
XAxis,
|
|
102
|
+
{
|
|
103
|
+
type,
|
|
104
|
+
tickLine: axes.xAxis.tickLine,
|
|
105
|
+
axisLine: axes.xAxis.axisLine,
|
|
106
|
+
tickMargin: axes.xAxis.tickMargin,
|
|
107
|
+
tick: tick ?? defaultTick,
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function ScatterChartYAxis({
|
|
113
|
+
size,
|
|
114
|
+
type = "number",
|
|
115
|
+
tick,
|
|
116
|
+
...props
|
|
117
|
+
}) {
|
|
118
|
+
const layout = SCATTER_CHART_LAYOUT[useComponentSize(size)];
|
|
119
|
+
const axes = cartesianAxisProps(layout);
|
|
120
|
+
const defaultTick = {
|
|
121
|
+
...axes.yAxis.tick,
|
|
122
|
+
fill: "var(--color-fg-caption-placeholder)"
|
|
123
|
+
};
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
YAxis,
|
|
126
|
+
{
|
|
127
|
+
type,
|
|
128
|
+
tickLine: axes.yAxis.tickLine,
|
|
129
|
+
axisLine: axes.yAxis.axisLine,
|
|
130
|
+
width: axes.yAxis.width,
|
|
131
|
+
tick: tick ?? defaultTick,
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
function ScatterChartTooltipContent({
|
|
137
|
+
active,
|
|
138
|
+
payload,
|
|
139
|
+
className
|
|
140
|
+
}) {
|
|
141
|
+
if (!active || !payload?.length) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const points = payload.filter(
|
|
145
|
+
(entry) => entry.type !== "none" && entry.value != null
|
|
146
|
+
);
|
|
147
|
+
if (!points.length) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const dotColor = points[0]?.color ?? points[0]?.fill ?? DEFAULT_SERIES_COLOR;
|
|
151
|
+
return /* @__PURE__ */ jsxs(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
className: cn(
|
|
155
|
+
"flex flex-col gap-1 rounded-lg border border-line-subtle bg-surface-overlay p-3 shadow-2",
|
|
156
|
+
className
|
|
157
|
+
),
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ jsx(
|
|
160
|
+
"span",
|
|
161
|
+
{
|
|
162
|
+
"aria-hidden": "true",
|
|
163
|
+
className: "size-2.5 shrink-0 rounded-full",
|
|
164
|
+
style: { backgroundColor: dotColor }
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
points.map((point, index) => /* @__PURE__ */ jsxs(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: "flex items-baseline justify-between gap-3 text-gdt-sm",
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg-secondary", children: point.name }),
|
|
173
|
+
/* @__PURE__ */ jsxs("span", { className: "font-extrabold text-fg-primary tabular-nums", children: [
|
|
174
|
+
point.value,
|
|
175
|
+
point.unit != null && point.unit !== "" && /* @__PURE__ */ jsx("span", { className: "ml-1 font-normal text-fg-caption-placeholder", children: point.unit })
|
|
176
|
+
] })
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
`${point.dataKey ?? point.name ?? index}`
|
|
180
|
+
))
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function ScatterPoint({
|
|
186
|
+
cx,
|
|
187
|
+
cy,
|
|
188
|
+
r,
|
|
189
|
+
color,
|
|
190
|
+
ringed
|
|
191
|
+
}) {
|
|
192
|
+
if (cx == null || cy == null) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
return /* @__PURE__ */ jsx(
|
|
196
|
+
"circle",
|
|
197
|
+
{
|
|
198
|
+
cx,
|
|
199
|
+
cy,
|
|
200
|
+
r,
|
|
201
|
+
fill: color,
|
|
202
|
+
stroke: ringed ? "var(--color-surface-raised)" : "none",
|
|
203
|
+
strokeWidth: ringed ? 2 : 0
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
function ScatterChartSeries({
|
|
208
|
+
color = DEFAULT_SERIES_COLOR,
|
|
209
|
+
size,
|
|
210
|
+
shape,
|
|
211
|
+
activeShape,
|
|
212
|
+
...props
|
|
213
|
+
}) {
|
|
214
|
+
const layout = SCATTER_CHART_LAYOUT[useComponentSize(size)];
|
|
215
|
+
return /* @__PURE__ */ jsx(
|
|
216
|
+
Scatter,
|
|
217
|
+
{
|
|
218
|
+
shape: shape ?? ((shapeProps) => /* @__PURE__ */ jsx(
|
|
219
|
+
ScatterPoint,
|
|
220
|
+
{
|
|
221
|
+
cx: shapeProps.cx,
|
|
222
|
+
cy: shapeProps.cy,
|
|
223
|
+
r: layout.dotRadius,
|
|
224
|
+
color
|
|
225
|
+
}
|
|
226
|
+
)),
|
|
227
|
+
activeShape: activeShape ?? ((shapeProps) => /* @__PURE__ */ jsx(
|
|
228
|
+
ScatterPoint,
|
|
229
|
+
{
|
|
230
|
+
cx: shapeProps.cx,
|
|
231
|
+
cy: shapeProps.cy,
|
|
232
|
+
r: layout.activeDotRadius,
|
|
233
|
+
color,
|
|
234
|
+
ringed: true
|
|
235
|
+
}
|
|
236
|
+
)),
|
|
237
|
+
fill: color,
|
|
238
|
+
...props
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
export {
|
|
243
|
+
SCATTER_CHART_LAYOUT,
|
|
244
|
+
SCATTER_CHART_PALETTE,
|
|
245
|
+
ScatterChart,
|
|
246
|
+
ScatterChartGrid,
|
|
247
|
+
ScatterChartSeries,
|
|
248
|
+
ScatterChartTooltipContent,
|
|
249
|
+
ScatterChartXAxis,
|
|
250
|
+
ScatterChartYAxis
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=scatter-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scatter-chart.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport {\n\tCartesianGrid,\n\tScatter,\n\tScatterChart as ScatterChartPrimitive,\n\tXAxis,\n\tYAxis,\n} from \"recharts\";\nimport type { Payload } from \"recharts/types/component/DefaultTooltipContent\";\nimport type { ScatterShapeProps } from \"recharts/types/util/ScatterUtils\";\nimport { type ChartConfig, ChartContainer, cartesianAxisProps } from \"./chart\";\nimport { cn } from \"./lib/cn\";\nimport {\n\ttype ComponentSize,\n\tSizeProvider,\n\tuseComponentSize,\n} from \"./size-context\";\n\n/**\n * Scatter charts are composable wrappers over the recharts cartesian\n * primitives. recharts 3 registers graphical items through context when they\n * render, so the primitives CAN be wrapped in our own components. Each\n * wrapper bakes in the giddaa defaults (tokens, size-scaled type, mark specs)\n * and forwards every recharts prop, so anything can be overridden in place or\n * replaced with the raw recharts element.\n *\n * Anatomy: `ScatterChart` is the plot root (frame + responsive box + recharts\n * chart); compose the grid, axes, series, and the shared overlays from\n * `./chart` as children. Unlike `BarChart`/`RadarChart`, each series carries\n * its own `data` (an array of `{ x, y }` pairs) rather than sharing one row\n * per category.\n *\n * @example\n * <ChartCard size=\"md\">\n * <ChartHeader>\n * <ChartTitle>Price vs. size</ChartTitle>\n * <ChartDescription>Lekki listings · ₦m by sqm</ChartDescription>\n * </ChartHeader>\n * <ScatterChart config={config}>\n * <ScatterChartGrid />\n * <ScatterChartXAxis dataKey=\"size\" name=\"Size\" unit=\"sqm\" />\n * <ScatterChartYAxis dataKey=\"price\" name=\"Price\" unit=\"₦m\" />\n * <ChartTooltip content={<ScatterChartTooltipContent />} />\n * <ScatterChartSeries data={data} name=\"Lekki\" />\n * </ScatterChart>\n * </ChartCard>\n */\n\n/**\n * Categorical series palette — the theme-aware `chart-1`…`chart-3` tokens.\n * Assign colours in this fixed order, never cycled: a fourth series folds into\n * \"Other\" or becomes a second chart.\n */\nconst SCATTER_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 = SCATTER_CHART_PALETTE[0];\n\ntype ScatterChartLayout = {\n\t/** Plot height in px. Width stays fluid via the ResponsiveContainer. */\n\theight: number;\n\t/** Outer margin around the plot. */\n\tmargin: { top: number; right: number; bottom: number; left: number };\n\t/** Axis tick label font size. */\n\ttickFontSize: number;\n\t/** Space between an axis and its tick labels. */\n\ttickMargin: number;\n\t/** Reserved width for the value axis. */\n\tyAxisWidth: number;\n\t/** Radius of a resting point, in px (r ≥ 4 keeps the ≥8px marker floor). */\n\tdotRadius: number;\n\t/** Radius of the active (hover) point. */\n\tactiveDotRadius: number;\n};\n\nconst SCATTER_CHART_LAYOUT: Record<ComponentSize, ScatterChartLayout> = {\n\tsm: {\n\t\theight: 220,\n\t\tmargin: { top: 16, right: 12, bottom: 0, left: 0 },\n\t\ttickFontSize: 10,\n\t\ttickMargin: 6,\n\t\tyAxisWidth: 32,\n\t\tdotRadius: 4,\n\t\tactiveDotRadius: 6,\n\t},\n\tmd: {\n\t\theight: 260,\n\t\tmargin: { top: 20, right: 16, bottom: 0, left: 0 },\n\t\ttickFontSize: 11,\n\t\ttickMargin: 8,\n\t\tyAxisWidth: 36,\n\t\tdotRadius: 5,\n\t\tactiveDotRadius: 7,\n\t},\n\tlg: {\n\t\theight: 320,\n\t\tmargin: { top: 24, right: 20, bottom: 0, left: 0 },\n\t\ttickFontSize: 12,\n\t\ttickMargin: 10,\n\t\tyAxisWidth: 40,\n\t\tdotRadius: 6,\n\t\tactiveDotRadius: 8,\n\t},\n};\n\ntype ScatterChartProps = Omit<\n\tReact.ComponentProps<typeof ScatterChartPrimitive>,\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 `ScatterChart` with a size-scaled\n * height and margin. `size` also flows to the child primitives through\n * `SizeProvider`. Extra props reach the recharts chart (`data`, `syncId`,\n * `margin`, …).\n */\nfunction ScatterChart({\n\tconfig = {},\n\tsize,\n\tclassName,\n\tchildren,\n\t...props\n}: ScatterChartProps) {\n\tconst resolvedSize = useComponentSize(size);\n\tconst layout = SCATTER_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<ScatterChartPrimitive\n\t\t\t\t\taccessibilityLayer\n\t\t\t\t\tmargin={layout.margin}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</ScatterChartPrimitive>\n\t\t\t</ChartContainer>\n\t\t</SizeProvider>\n\t);\n}\n\ntype ScatterChartGridProps = React.ComponentProps<typeof CartesianGrid>;\n\n/**\n * Value reference lines — recharts `CartesianGrid` painted with the `line`\n * token (`line-subtle` matches the chart card surface in both themes, so it\n * would vanish). Both axes are quantitative in a scatter plot, so horizontal\n * and vertical lines render by default; pass `vertical={false}` to thin it out.\n */\nfunction ScatterChartGrid(props: ScatterChartGridProps) {\n\treturn <CartesianGrid stroke=\"var(--color-line)\" {...props} />;\n}\n\ntype ScatterChartXAxisProps = React.ComponentProps<typeof XAxis> & {\n\t/** Explicit axis scale; otherwise inherited from the chart's `size`. */\n\tsize?: ComponentSize;\n};\n\n/**\n * Value axis — recharts `XAxis` defaulting to `type=\"number\"` (a scatter axis\n * is continuous, not categorical), with no axis/tick lines, size-scaled tick\n * margin, and caption-placeholder tick ink. Pass `name`/`unit` to label this\n * axis in the tooltip. Passing your own `tick` replaces the default styling\n * entirely.\n */\nfunction ScatterChartXAxis({\n\tsize,\n\ttype = \"number\",\n\ttick,\n\t...props\n}: ScatterChartXAxisProps) {\n\tconst layout = SCATTER_CHART_LAYOUT[useComponentSize(size)];\n\tconst axes = cartesianAxisProps(layout);\n\tconst defaultTick = {\n\t\t...axes.xAxis.tick,\n\t\tfill: \"var(--color-fg-caption-placeholder)\",\n\t};\n\n\treturn (\n\t\t<XAxis\n\t\t\ttype={type}\n\t\t\ttickLine={axes.xAxis.tickLine}\n\t\t\taxisLine={axes.xAxis.axisLine}\n\t\t\ttickMargin={axes.xAxis.tickMargin}\n\t\t\ttick={tick ?? defaultTick}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype ScatterChartYAxisProps = React.ComponentProps<typeof YAxis> & {\n\t/** Explicit axis scale; otherwise inherited from the chart's `size`. */\n\tsize?: ComponentSize;\n};\n\n/**\n * Value axis — recharts `YAxis` defaulting to `type=\"number\"`, with no\n * axis/tick lines, size-scaled tick type, and reserved width for value\n * labels. Pass `name`/`unit` to label this axis in the tooltip. Override\n * `width` for long tick labels.\n */\nfunction ScatterChartYAxis({\n\tsize,\n\ttype = \"number\",\n\ttick,\n\t...props\n}: ScatterChartYAxisProps) {\n\tconst layout = SCATTER_CHART_LAYOUT[useComponentSize(size)];\n\tconst axes = cartesianAxisProps(layout);\n\tconst defaultTick = {\n\t\t...axes.yAxis.tick,\n\t\tfill: \"var(--color-fg-caption-placeholder)\",\n\t};\n\n\treturn (\n\t\t<YAxis\n\t\t\ttype={type}\n\t\t\ttickLine={axes.yAxis.tickLine}\n\t\t\taxisLine={axes.yAxis.axisLine}\n\t\t\twidth={axes.yAxis.width}\n\t\t\ttick={tick ?? defaultTick}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype ScatterChartTooltipContentProps = {\n\tactive?: boolean;\n\tpayload?: ReadonlyArray<Payload<string | number, string | number>>;\n\tclassName?: string;\n};\n\n/**\n * Hover tooltip for a scatter point. Unlike the shared `ChartTooltipContent`\n * (built for a single hero value), a scatter point carries one value per\n * axis, so this lists every axis entry — each labelled by its `XAxis`/\n * `YAxis` `name` and `unit` — under one series dot, on the same elevated\n * overlay (bg-surface-overlay, shadow-2, border-subtle) as the rest of the\n * chart library.\n */\nfunction ScatterChartTooltipContent({\n\tactive,\n\tpayload,\n\tclassName,\n}: ScatterChartTooltipContentProps) {\n\tif (!active || !payload?.length) {\n\t\treturn null;\n\t}\n\n\tconst points = payload.filter(\n\t\t(entry) => entry.type !== \"none\" && entry.value != null,\n\t);\n\n\tif (!points.length) {\n\t\treturn null;\n\t}\n\n\tconst dotColor = points[0]?.color ?? points[0]?.fill ?? DEFAULT_SERIES_COLOR;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"flex flex-col gap-1 rounded-lg border border-line-subtle bg-surface-overlay p-3 shadow-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName=\"size-2.5 shrink-0 rounded-full\"\n\t\t\t\tstyle={{ backgroundColor: dotColor }}\n\t\t\t/>\n\t\t\t{points.map((point, index) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={`${point.dataKey ?? point.name ?? index}`}\n\t\t\t\t\tclassName=\"flex items-baseline justify-between gap-3 text-gdt-sm\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"text-fg-secondary\">{point.name}</span>\n\t\t\t\t\t<span className=\"font-extrabold text-fg-primary tabular-nums\">\n\t\t\t\t\t\t{point.value}\n\t\t\t\t\t\t{point.unit != null && point.unit !== \"\" && (\n\t\t\t\t\t\t\t<span className=\"ml-1 font-normal text-fg-caption-placeholder\">\n\t\t\t\t\t\t\t\t{point.unit}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n}\n\n/** Renders one resting or active point as a plain filled/ringed circle. */\nfunction ScatterPoint({\n\tcx,\n\tcy,\n\tr,\n\tcolor,\n\tringed,\n}: {\n\tcx?: number;\n\tcy?: number;\n\tr: number;\n\tcolor: string;\n\tringed?: boolean;\n}) {\n\tif (cx == null || cy == null) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<circle\n\t\t\tcx={cx}\n\t\t\tcy={cy}\n\t\t\tr={r}\n\t\t\tfill={color}\n\t\t\tstroke={ringed ? \"var(--color-surface-raised)\" : \"none\"}\n\t\t\tstrokeWidth={ringed ? 2 : 0}\n\t\t/>\n\t);\n}\n\ntype ScatterChartSeriesProps = React.ComponentProps<typeof Scatter> & {\n\t/** Series colour for the points. Defaults to the first categorical chart token. */\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 `Scatter` with the giddaa mark spec: solid\n * resting points at a size-scaled radius (r ≥ 4, the ≥8px marker floor) and a\n * larger active point ringed in `surface-raised` so overlapping series stay\n * separable. `color` drives both shapes at once; `shape`/`activeShape` still\n * win when passed directly.\n */\nfunction ScatterChartSeries({\n\tcolor = DEFAULT_SERIES_COLOR,\n\tsize,\n\tshape,\n\tactiveShape,\n\t...props\n}: ScatterChartSeriesProps) {\n\tconst layout = SCATTER_CHART_LAYOUT[useComponentSize(size)];\n\n\treturn (\n\t\t<Scatter\n\t\t\tshape={\n\t\t\t\tshape ??\n\t\t\t\t((shapeProps: ScatterShapeProps) => (\n\t\t\t\t\t<ScatterPoint\n\t\t\t\t\t\tcx={shapeProps.cx}\n\t\t\t\t\t\tcy={shapeProps.cy}\n\t\t\t\t\t\tr={layout.dotRadius}\n\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t/>\n\t\t\t\t))\n\t\t\t}\n\t\t\tactiveShape={\n\t\t\t\tactiveShape ??\n\t\t\t\t((shapeProps: ScatterShapeProps) => (\n\t\t\t\t\t<ScatterPoint\n\t\t\t\t\t\tcx={shapeProps.cx}\n\t\t\t\t\t\tcy={shapeProps.cy}\n\t\t\t\t\t\tr={layout.activeDotRadius}\n\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\tringed\n\t\t\t\t\t/>\n\t\t\t\t))\n\t\t\t}\n\t\t\tfill={color}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tSCATTER_CHART_LAYOUT,\n\tSCATTER_CHART_PALETTE,\n\tScatterChart,\n\tScatterChartGrid,\n\tScatterChartSeries,\n\tScatterChartTooltipContent,\n\tScatterChartXAxis,\n\tScatterChartYAxis,\n};\nexport type {\n\tScatterChartGridProps,\n\tScatterChartLayout,\n\tScatterChartProps,\n\tScatterChartSeriesProps,\n\tScatterChartTooltipContentProps,\n\tScatterChartXAxisProps,\n\tScatterChartYAxisProps,\n};\n"],"mappings":"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","names":[]}
|
package/dist/search-input.d.ts
CHANGED
package/dist/search-input.js
CHANGED
|
@@ -1,320 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
InputGroup,
|
|
3
|
+
InputGroupAddon,
|
|
4
|
+
InputGroupButton,
|
|
5
|
+
InputGroupInput
|
|
6
|
+
} from "./chunk-6ZSGQHH2.js";
|
|
7
|
+
import "./chunk-KSMDANKI.js";
|
|
8
|
+
import "./chunk-MEKCCOP5.js";
|
|
9
|
+
import "./chunk-3ACQVT7A.js";
|
|
10
|
+
import "./chunk-B4H6RNDH.js";
|
|
11
|
+
import "./chunk-HL3ZSYES.js";
|
|
12
|
+
import {
|
|
13
|
+
cn
|
|
14
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
15
|
+
|
|
16
|
+
// src/search-input.tsx
|
|
2
17
|
import { Search, X } from "lucide-react";
|
|
3
18
|
import * as React from "react";
|
|
4
|
-
|
|
5
|
-
// src/lib/cn.ts
|
|
6
|
-
import { clsx } from "clsx";
|
|
7
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
8
|
-
var twMerge = extendTailwindMerge({
|
|
9
|
-
extend: {
|
|
10
|
-
classGroups: {
|
|
11
|
-
"font-size": [
|
|
12
|
-
{
|
|
13
|
-
text: [
|
|
14
|
-
"gdt-display",
|
|
15
|
-
"gdt-h1",
|
|
16
|
-
"gdt-h2",
|
|
17
|
-
"gdt-h3",
|
|
18
|
-
"gdt-h4",
|
|
19
|
-
"gdt-h5",
|
|
20
|
-
"gdt-xl",
|
|
21
|
-
"gdt-lg",
|
|
22
|
-
"gdt-md",
|
|
23
|
-
"gdt-sm",
|
|
24
|
-
"gdt-xs",
|
|
25
|
-
"gdt-subtext",
|
|
26
|
-
"gdt-capitalized"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
function cn(...inputs) {
|
|
34
|
-
return twMerge(clsx(inputs));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// src/components/ui/input-group.tsx
|
|
38
|
-
import { cva as cva3 } from "class-variance-authority";
|
|
39
|
-
|
|
40
|
-
// src/components/ui/button.tsx
|
|
41
|
-
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
42
|
-
import { cva } from "class-variance-authority";
|
|
43
|
-
import { Loader } from "lucide-react";
|
|
44
|
-
|
|
45
|
-
// src/components/ui/size-context.tsx
|
|
46
|
-
import { createContext, useContext } from "react";
|
|
47
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
48
|
-
var SizeContext = createContext(void 0);
|
|
49
|
-
function SizeProvider({
|
|
50
|
-
children,
|
|
51
|
-
size
|
|
52
|
-
}) {
|
|
53
|
-
if (!size) {
|
|
54
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
55
|
-
}
|
|
56
|
-
return /* @__PURE__ */ jsx(SizeContext.Provider, { value: size, children });
|
|
57
|
-
}
|
|
58
|
-
function useComponentSize(size, fallback = "md") {
|
|
59
|
-
const inheritedSize = useContext(SizeContext);
|
|
60
|
-
return size ?? inheritedSize ?? fallback;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/components/ui/button.tsx
|
|
64
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
65
|
-
var buttonVariants = cva(
|
|
66
|
-
"group/button inline-flex shrink-0 items-center justify-center rounded-full bg-clip-padding whitespace-nowrap font-bold transition-[background-color,color,border-color,box-shadow,transform] outline-none select-none focus-visible:border-line-focus focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)] active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-invalid:border-line-danger aria-invalid:ring-3 aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
67
|
-
{
|
|
68
|
-
variants: {
|
|
69
|
-
variant: {
|
|
70
|
-
primary: "bg-action-primary text-fg-on-brand hover:bg-action-primary-hover active:bg-action-primary-pressed",
|
|
71
|
-
"primary-outline": "border-2 border-action-primary bg-transparent text-fg-brand hover:bg-surface-brand-subtle active:bg-surface-brand-subtle data-focused:bg-surface-brand-subtle data-pressed:bg-surface-brand-subtle",
|
|
72
|
-
secondary: "bg-surface-brand-subtle text-fg-brand hover:bg-action-primary-hover hover:text-fg-on-brand active:bg-action-primary-pressed active:text-fg-on-brand data-focused:bg-action-primary-hover data-pressed:bg-action-primary-pressed data-focused:text-fg-on-brand data-pressed:text-fg-on-brand",
|
|
73
|
-
"secondary-outline": "border-2 border-action-secondary bg-transparent text-fg-brand hover:bg-surface-brand-subtle active:bg-surface-brand-subtle data-focused:bg-surface-brand-subtle data-pressed:bg-surface-brand-subtle",
|
|
74
|
-
tertiary: "bg-action-tertiary text-fg-primary hover:bg-action-tertiary-hover active:bg-action-tertiary-pressed data-focused:bg-action-tertiary-hover data-pressed:bg-action-tertiary-pressed",
|
|
75
|
-
"tertiary-outline": "border border-line-strong bg-transparent text-fg-primary hover:bg-surface active:bg-surface-raised data-focused:bg-surface data-pressed:bg-surface-raised",
|
|
76
|
-
ghost: "bg-transparent text-fg-primary hover:bg-surface active:bg-surface-raised data-focused:bg-surface data-pressed:bg-surface-raised",
|
|
77
|
-
danger: "bg-action-danger text-fg-on-brand hover:bg-action-danger-hover active:bg-action-danger-pressed data-focused:bg-action-danger-hover data-pressed:bg-action-danger-pressed",
|
|
78
|
-
"glass-overlay": "bg-surface-glass-overlay-button text-fg-on-brand",
|
|
79
|
-
"link-brand": "border-transparent bg-transparent px-0 text-fg-brand hover:underline active:underline active:opacity-70",
|
|
80
|
-
"link-neutral": "border-transparent bg-transparent px-0 text-fg-secondary hover:underline active:underline active:opacity-70"
|
|
81
|
-
},
|
|
82
|
-
size: {
|
|
83
|
-
sm: "h-8 gap-2 px-3.5 text-gdt-xs has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg:not([class*='size-'])]:size-3.5",
|
|
84
|
-
md: "h-10 gap-2 px-4.5 text-gdt-sm has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4",
|
|
85
|
-
lg: "h-12.5 gap-2.5 px-5.5 text-gdt-md has-data-[icon=inline-end]:pr-5 has-data-[icon=inline-start]:pl-5 [&_svg:not([class*='size-'])]:size-4.5",
|
|
86
|
-
xl: "h-14 gap-3 px-6.5 text-gdt-lg has-data-[icon=inline-end]:pr-6 has-data-[icon=inline-start]:pl-6 [&_svg:not([class*='size-'])]:size-5",
|
|
87
|
-
icon: "size-10",
|
|
88
|
-
"icon-xs": "size-6 text-gdt-xs [&_svg:not([class*='size-'])]:size-3",
|
|
89
|
-
"icon-sm": "size-8 text-gdt-sm [&_svg:not([class*='size-'])]:size-3.5",
|
|
90
|
-
"icon-lg": "size-12.5 text-gdt-md [&_svg:not([class*='size-'])]:size-4.5",
|
|
91
|
-
"icon-xl": "size-14 text-gdt-lg [&_svg:not([class*='size-'])]:size-5"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
defaultVariants: {
|
|
95
|
-
variant: "primary",
|
|
96
|
-
size: "md"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
function Button({
|
|
101
|
-
className,
|
|
102
|
-
variant = "primary",
|
|
103
|
-
size,
|
|
104
|
-
isLoading = false,
|
|
105
|
-
children,
|
|
106
|
-
disabled = false,
|
|
107
|
-
...props
|
|
108
|
-
}) {
|
|
109
|
-
const inheritedSize = useComponentSize();
|
|
110
|
-
const resolvedSize = size ?? inheritedSize;
|
|
111
|
-
const _disabled = disabled || isLoading;
|
|
112
|
-
return /* @__PURE__ */ jsxs(
|
|
113
|
-
ButtonPrimitive,
|
|
114
|
-
{
|
|
115
|
-
"data-slot": "button",
|
|
116
|
-
className: cn(buttonVariants({ variant, size: resolvedSize, className })),
|
|
117
|
-
disabled: _disabled,
|
|
118
|
-
...props,
|
|
119
|
-
children: [
|
|
120
|
-
isLoading && /* @__PURE__ */ jsx2(Loader, { className: "size-4 animate-spin" }),
|
|
121
|
-
" ",
|
|
122
|
-
children
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// src/components/ui/input.tsx
|
|
129
|
-
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
130
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
131
|
-
|
|
132
|
-
// src/components/ui/input-size-context.tsx
|
|
133
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
134
|
-
import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
|
|
135
|
-
var InputSizeContext = createContext2(
|
|
136
|
-
void 0
|
|
137
|
-
);
|
|
138
|
-
function InputSizeProvider({
|
|
139
|
-
children,
|
|
140
|
-
size
|
|
141
|
-
}) {
|
|
142
|
-
if (!size) {
|
|
143
|
-
return /* @__PURE__ */ jsx3(Fragment2, { children });
|
|
144
|
-
}
|
|
145
|
-
return /* @__PURE__ */ jsx3(InputSizeContext.Provider, { value: size, children });
|
|
146
|
-
}
|
|
147
|
-
function useInputComponentSize(size, fallback = "md") {
|
|
148
|
-
const inheritedSize = useContext2(InputSizeContext);
|
|
149
|
-
return size ?? inheritedSize ?? fallback;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// src/components/ui/input.tsx
|
|
153
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
154
|
-
var inputVariants = cva2(
|
|
155
|
-
"flex w-full min-w-0 rounded-full border border-line bg-canvas text-fg-primary transition-[background-color,border-color,box-shadow,color] outline-none file:inline-flex file:border-0 file:bg-transparent file:font-normal file:text-fg-primary placeholder:text-fg-muted hover:border-line-strong focus-visible:border-line-focus focus-visible:inset-ring-1 inset-ring-line-focus disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-line-subtle disabled:bg-surface disabled:text-fg-muted disabled:placeholder:text-fg-muted aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:placeholder:text-fg-danger aria-invalid:shadow-none",
|
|
156
|
-
{
|
|
157
|
-
variants: {
|
|
158
|
-
size: {
|
|
159
|
-
sm: "h-8 px-3 text-gdt-xs font-normal file:text-gdt-xs",
|
|
160
|
-
md: "h-10 px-3.5 text-gdt-sm font-normal file:text-gdt-sm",
|
|
161
|
-
lg: "h-12 px-4 text-gdt-md font-normal file:text-gdt-md",
|
|
162
|
-
xl: "h-14 px-4.5 text-gdt-lg font-normal file:text-gdt-lg"
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
defaultVariants: {
|
|
166
|
-
size: "md"
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
function Input({ className, size, type, ...props }) {
|
|
171
|
-
const resolvedSize = useInputComponentSize(size);
|
|
172
|
-
return /* @__PURE__ */ jsx4(
|
|
173
|
-
InputPrimitive,
|
|
174
|
-
{
|
|
175
|
-
type,
|
|
176
|
-
"data-slot": "input",
|
|
177
|
-
"data-size": resolvedSize,
|
|
178
|
-
className: cn(inputVariants({ size: resolvedSize }), className),
|
|
179
|
-
...props
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// src/components/ui/input-group.tsx
|
|
185
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
186
|
-
var inputGroupVariants = cva3(
|
|
187
|
-
"group/input-group relative flex w-full min-w-0 items-center rounded-full has-[textarea]:rounded-xl has-data-[align=block-end]:rounded-xl has-data-[align=block-start]:rounded-xl border border-line bg-canvas transition-[background-color,border-color,box-shadow,color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:border-line-subtle has-disabled:bg-surface has-disabled:text-fg-muted focus-within:border-line-focus focus-within:inset-ring-1 inset-ring-line-focus has-[[data-slot][aria-invalid=true]]:border-line-danger has-[[data-slot][aria-invalid=true]]:inset-shadow-none has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=sm]/input-group:pl-2 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=md]/input-group:pl-2.5 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=lg]/input-group:pl-3 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=xl]/input-group:pl-3 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=sm]/input-group:pr-2 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=md]/input-group:pr-2.5 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=lg]/input-group:pr-3 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=xl]/input-group:pr-3",
|
|
188
|
-
{
|
|
189
|
-
variants: {
|
|
190
|
-
size: {
|
|
191
|
-
sm: "h-8",
|
|
192
|
-
md: "h-10",
|
|
193
|
-
lg: "h-12",
|
|
194
|
-
xl: "h-14"
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
defaultVariants: {
|
|
198
|
-
size: "md"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
function InputGroup({
|
|
203
|
-
className,
|
|
204
|
-
size,
|
|
205
|
-
...props
|
|
206
|
-
}) {
|
|
207
|
-
const inheritedSize = useComponentSize();
|
|
208
|
-
const resolvedSize = size ?? inheritedSize;
|
|
209
|
-
const componentSize = resolvedSize === "xl" ? void 0 : resolvedSize;
|
|
210
|
-
return /* @__PURE__ */ jsx5(SizeProvider, { size: componentSize, children: /* @__PURE__ */ jsx5(InputSizeProvider, { size: resolvedSize, children: /* @__PURE__ */ jsx5(
|
|
211
|
-
"div",
|
|
212
|
-
{
|
|
213
|
-
"data-slot": "input-group",
|
|
214
|
-
"data-size": resolvedSize,
|
|
215
|
-
role: "group",
|
|
216
|
-
className: cn(inputGroupVariants({ size: resolvedSize }), className),
|
|
217
|
-
...props
|
|
218
|
-
}
|
|
219
|
-
) }) });
|
|
220
|
-
}
|
|
221
|
-
var inputGroupAddonVariants = cva3(
|
|
222
|
-
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-gdt-sm font-normal text-fg-secondary select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[size=lg]/input-group:[&>svg:not([class*='size-'])]:size-4.5 group-data-[size=xl]/input-group:[&>svg:not([class*='size-'])]:size-5 [&>svg:not([class*='size-'])]:size-4",
|
|
223
|
-
{
|
|
224
|
-
variants: {
|
|
225
|
-
align: {
|
|
226
|
-
"inline-start": "order-first group-data-[size=sm]/input-group:pl-3 group-data-[size=md]/input-group:pl-3.5 group-data-[size=lg]/input-group:pl-4 group-data-[size=xl]/input-group:pl-4.5 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]",
|
|
227
|
-
"inline-end": "order-last group-data-[size=sm]/input-group:pr-3 group-data-[size=md]/input-group:pr-3.5 group-data-[size=lg]/input-group:pr-4 group-data-[size=xl]/input-group:pr-4.5 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]",
|
|
228
|
-
"block-start": "order-first w-full justify-start px-3 group-data-[size=md]/input-group:px-3.5 group-data-[size=lg]/input-group:px-4 group-data-[size=xl]/input-group:px-4.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
229
|
-
"block-end": "order-last w-full justify-start px-3 group-data-[size=md]/input-group:px-3.5 group-data-[size=lg]/input-group:px-4 group-data-[size=xl]/input-group:px-4.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
defaultVariants: {
|
|
233
|
-
align: "inline-start"
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
function InputGroupAddon({
|
|
238
|
-
className,
|
|
239
|
-
align = "inline-start",
|
|
240
|
-
...props
|
|
241
|
-
}) {
|
|
242
|
-
return (
|
|
243
|
-
// biome-ignore lint/a11y/useSemanticElements: addon is a structural wrapper for grouped input affordances.
|
|
244
|
-
// biome-ignore lint/a11y/useKeyWithClickEvents: click only forwards focus to the sibling input and is not a standalone action target.
|
|
245
|
-
/* @__PURE__ */ jsx5(
|
|
246
|
-
"div",
|
|
247
|
-
{
|
|
248
|
-
role: "group",
|
|
249
|
-
"data-slot": "input-group-addon",
|
|
250
|
-
"data-align": align,
|
|
251
|
-
className: cn(inputGroupAddonVariants({ align }), className),
|
|
252
|
-
onClick: (e) => {
|
|
253
|
-
if (e.target.closest("button")) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
257
|
-
},
|
|
258
|
-
...props
|
|
259
|
-
}
|
|
260
|
-
)
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
var inputGroupButtonVariants = cva3(
|
|
264
|
-
"flex items-center gap-2 text-sm shadow-none rounded-full",
|
|
265
|
-
{
|
|
266
|
-
variants: {
|
|
267
|
-
size: {
|
|
268
|
-
xs: "h-6 gap-1 px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
269
|
-
sm: "",
|
|
270
|
-
"icon-xs": "size-6 p-0 has-[>svg]:p-0",
|
|
271
|
-
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
defaultVariants: {
|
|
275
|
-
size: "xs"
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
);
|
|
279
|
-
function InputGroupButton({
|
|
280
|
-
className,
|
|
281
|
-
type = "button",
|
|
282
|
-
variant = "ghost",
|
|
283
|
-
size = "xs",
|
|
284
|
-
...props
|
|
285
|
-
}) {
|
|
286
|
-
return /* @__PURE__ */ jsx5(
|
|
287
|
-
Button,
|
|
288
|
-
{
|
|
289
|
-
type,
|
|
290
|
-
"data-size": size,
|
|
291
|
-
variant,
|
|
292
|
-
className: cn(inputGroupButtonVariants({ size }), className),
|
|
293
|
-
...props
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
function InputGroupInput({
|
|
298
|
-
className,
|
|
299
|
-
size,
|
|
300
|
-
...props
|
|
301
|
-
}) {
|
|
302
|
-
return /* @__PURE__ */ jsx5(
|
|
303
|
-
Input,
|
|
304
|
-
{
|
|
305
|
-
"data-slot": "input-group-control",
|
|
306
|
-
size,
|
|
307
|
-
className: cn(
|
|
308
|
-
"flex-1 rounded-none border-0 bg-transparent shadow-none inset-shadow-none inset-ring-0 focus:border-transparent focus:shadow-none focus:inset-shadow-none focus-visible:border-transparent focus-visible:shadow-none focus-visible:ring-0 focus-visible:inset-ring-0 focus-visible:inset-shadow-none disabled:bg-transparent aria-invalid:ring-0 aria-invalid:inset-ring-0 dark:bg-transparent dark:disabled:bg-transparent",
|
|
309
|
-
className
|
|
310
|
-
),
|
|
311
|
-
...props
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// src/components/ui/search-input.tsx
|
|
317
|
-
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
318
20
|
function hasValue(value) {
|
|
319
21
|
if (Array.isArray(value)) {
|
|
320
22
|
return value.length > 0;
|
|
@@ -367,7 +69,7 @@ var SearchInput = React.forwardRef(
|
|
|
367
69
|
input.focus();
|
|
368
70
|
onClear?.();
|
|
369
71
|
}
|
|
370
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ jsxs(
|
|
371
73
|
InputGroup,
|
|
372
74
|
{
|
|
373
75
|
size,
|
|
@@ -376,7 +78,7 @@ var SearchInput = React.forwardRef(
|
|
|
376
78
|
wrapperClassName
|
|
377
79
|
),
|
|
378
80
|
children: [
|
|
379
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
380
82
|
InputGroupInput,
|
|
381
83
|
{
|
|
382
84
|
ref: inputRef,
|
|
@@ -390,14 +92,14 @@ var SearchInput = React.forwardRef(
|
|
|
390
92
|
onChange: handleChange
|
|
391
93
|
}
|
|
392
94
|
),
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
showClearButton ? /* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Search, {}) }),
|
|
96
|
+
showClearButton ? /* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx(
|
|
395
97
|
InputGroupButton,
|
|
396
98
|
{
|
|
397
99
|
"aria-label": "Clear search",
|
|
398
100
|
disabled: disabled || readOnly,
|
|
399
101
|
onClick: handleClear,
|
|
400
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3" })
|
|
401
103
|
}
|
|
402
104
|
) }) : null
|
|
403
105
|
]
|