@giddaa-housing/ui 0.1.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 +41 -0
- package/dist/accordion.d.ts +11 -0
- package/dist/accordion.js +124 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.d.ts +18 -0
- package/dist/alert.js +152 -0
- package/dist/alert.js.map +1 -0
- package/dist/avatar.d.ts +14 -0
- package/dist/avatar.js +152 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.d.ts +14 -0
- package/dist/badge.js +119 -0
- package/dist/badge.js.map +1 -0
- package/dist/bar-chart.d.ts +136 -0
- package/dist/bar-chart.js +302 -0
- package/dist/bar-chart.js.map +1 -0
- package/dist/base.css +32 -0
- package/dist/breadcrumb.d.ts +12 -0
- package/dist/breadcrumb.js +161 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/bullet-chart.d.ts +98 -0
- package/dist/bullet-chart.js +189 -0
- package/dist/bullet-chart.js.map +1 -0
- package/dist/button-group.d.ts +18 -0
- package/dist/button-group.js +170 -0
- package/dist/button-group.js.map +1 -0
- package/dist/button.d.ts +19 -0
- package/dist/button.js +146 -0
- package/dist/button.js.map +1 -0
- package/dist/calendar.d.ts +9 -0
- package/dist/calendar.js +293 -0
- package/dist/calendar.js.map +1 -0
- package/dist/card.d.ts +18 -0
- package/dist/card.js +186 -0
- package/dist/card.js.map +1 -0
- package/dist/carousel.d.ts +53 -0
- package/dist/carousel.js +396 -0
- package/dist/carousel.js.map +1 -0
- package/dist/chart.d.ts +122 -0
- package/dist/chart.js +494 -0
- package/dist/chart.js.map +1 -0
- package/dist/checkbox.d.ts +73 -0
- package/dist/checkbox.js +87 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/collapsible.d.ts +8 -0
- package/dist/collapsible.js +82 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/combobox.d.ts +30 -0
- package/dist/combobox.js +713 -0
- package/dist/combobox.js.map +1 -0
- package/dist/date-picker.d.ts +22 -0
- package/dist/date-picker.js +528 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/dialog.d.ts +30 -0
- package/dist/dialog.js +339 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dropdown-menu.d.ts +35 -0
- package/dist/dropdown-menu.js +376 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/dropzone.d.ts +128 -0
- package/dist/dropzone.js +490 -0
- package/dist/dropzone.js.map +1 -0
- package/dist/empty-state.d.ts +17 -0
- package/dist/empty-state.js +146 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/field.d.ts +29 -0
- package/dist/field.js +345 -0
- package/dist/field.js.map +1 -0
- 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/funnel-chart.d.ts +84 -0
- package/dist/funnel-chart.js +569 -0
- package/dist/funnel-chart.js.map +1 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +10448 -0
- package/dist/index.js.map +1 -0
- package/dist/input-group.d.ts +31 -0
- package/dist/input-group.js +380 -0
- package/dist/input-group.js.map +1 -0
- package/dist/input-size-context.d.ts +11 -0
- package/dist/input-size-context.js +24 -0
- package/dist/input-size-context.js.map +1 -0
- package/dist/input.d.ts +13 -0
- package/dist/input.js +83 -0
- package/dist/input.js.map +1 -0
- package/dist/item.d.ts +8 -0
- package/dist/item.js +93 -0
- package/dist/item.js.map +1 -0
- package/dist/kpi-card.d.ts +24 -0
- package/dist/kpi-card.js +243 -0
- package/dist/kpi-card.js.map +1 -0
- package/dist/label.d.ts +8 -0
- package/dist/label.js +68 -0
- package/dist/label.js.map +1 -0
- package/dist/line-chart.d.ts +155 -0
- package/dist/line-chart.js +269 -0
- package/dist/line-chart.js.map +1 -0
- package/dist/logo.d.ts +6 -0
- package/dist/logo.js +146 -0
- package/dist/logo.js.map +1 -0
- package/dist/number-input.d.ts +41 -0
- package/dist/number-input.js +418 -0
- package/dist/number-input.js.map +1 -0
- package/dist/page-header.d.ts +13 -0
- package/dist/page-header.js +113 -0
- package/dist/page-header.js.map +1 -0
- package/dist/pagination.d.ts +35 -0
- package/dist/pagination.js +352 -0
- package/dist/pagination.js.map +1 -0
- package/dist/password-input.d.ts +13 -0
- package/dist/password-input.js +356 -0
- package/dist/password-input.js.map +1 -0
- package/dist/phone-input.d.ts +21 -0
- package/dist/phone-input.js +573 -0
- package/dist/phone-input.js.map +1 -0
- package/dist/photo-gallery.d.ts +42 -0
- package/dist/photo-gallery.js +756 -0
- package/dist/photo-gallery.js.map +1 -0
- package/dist/pie-chart.d.ts +125 -0
- package/dist/pie-chart.js +192 -0
- package/dist/pie-chart.js.map +1 -0
- package/dist/popover.d.ts +20 -0
- package/dist/popover.js +169 -0
- package/dist/popover.js.map +1 -0
- package/dist/progress.d.ts +28 -0
- package/dist/progress.js +315 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio-group.d.ts +32 -0
- package/dist/radio-group.js +100 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/red-hat-display.css +2 -0
- package/dist/rich-text-editor.d.ts +16 -0
- package/dist/rich-text-editor.js +1000 -0
- package/dist/rich-text-editor.js.map +1 -0
- package/dist/search-input.d.ts +19 -0
- package/dist/search-input.js +411 -0
- package/dist/search-input.js.map +1 -0
- package/dist/select.d.ts +21 -0
- package/dist/select.js +305 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.d.ts +10 -0
- package/dist/separator.js +72 -0
- package/dist/separator.js.map +1 -0
- package/dist/sheet.d.ts +24 -0
- package/dist/sheet.js +282 -0
- package/dist/sheet.js.map +1 -0
- package/dist/sidebar.d.ts +70 -0
- package/dist/sidebar.js +1078 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/size-context.d.ts +11 -0
- package/dist/size-context.js +22 -0
- package/dist/size-context.js.map +1 -0
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.js +48 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/sparkline.d.ts +94 -0
- package/dist/sparkline.js +568 -0
- package/dist/sparkline.js.map +1 -0
- package/dist/stepper.d.ts +43 -0
- package/dist/stepper.js +296 -0
- package/dist/stepper.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/switch.d.ts +29 -0
- package/dist/switch.js +108 -0
- package/dist/switch.js.map +1 -0
- package/dist/tab-list.d.ts +38 -0
- package/dist/tab-list.js +394 -0
- package/dist/tab-list.js.map +1 -0
- package/dist/table.d.ts +69 -0
- package/dist/table.js +197 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.d.ts +18 -0
- package/dist/tabs.js +159 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tag.d.ts +25 -0
- package/dist/tag.js +160 -0
- package/dist/tag.js.map +1 -0
- package/dist/textarea.d.ts +12 -0
- package/dist/textarea.js +78 -0
- package/dist/textarea.js.map +1 -0
- package/dist/theme/giddaa.css +2 -0
- package/dist/time-picker.d.ts +13 -0
- package/dist/time-picker.js +472 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/toast.d.ts +23 -0
- package/dist/toast.js +330 -0
- package/dist/toast.js.map +1 -0
- package/dist/tooltip.d.ts +11 -0
- package/dist/tooltip.js +96 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/tree-map.d.ts +127 -0
- package/dist/tree-map.js +652 -0
- package/dist/tree-map.js.map +1 -0
- package/package.json +328 -0
package/dist/item.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// src/components/ui/item.tsx
|
|
2
|
+
import { mergeProps, useRender } from "@base-ui/react";
|
|
3
|
+
|
|
4
|
+
// src/lib/cn.ts
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
7
|
+
var twMerge = extendTailwindMerge({
|
|
8
|
+
extend: {
|
|
9
|
+
classGroups: {
|
|
10
|
+
"font-size": [
|
|
11
|
+
{
|
|
12
|
+
text: [
|
|
13
|
+
"gdt-display",
|
|
14
|
+
"gdt-h1",
|
|
15
|
+
"gdt-h2",
|
|
16
|
+
"gdt-h3",
|
|
17
|
+
"gdt-h4",
|
|
18
|
+
"gdt-h5",
|
|
19
|
+
"gdt-xl",
|
|
20
|
+
"gdt-lg",
|
|
21
|
+
"gdt-md",
|
|
22
|
+
"gdt-sm",
|
|
23
|
+
"gdt-xs",
|
|
24
|
+
"gdt-subtext",
|
|
25
|
+
"gdt-capitalized"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
function cn(...inputs) {
|
|
33
|
+
return twMerge(clsx(inputs));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/components/ui/item.tsx
|
|
37
|
+
function Item({
|
|
38
|
+
className,
|
|
39
|
+
render,
|
|
40
|
+
...props
|
|
41
|
+
}) {
|
|
42
|
+
return useRender({
|
|
43
|
+
defaultTagName: "div",
|
|
44
|
+
props: mergeProps(
|
|
45
|
+
{
|
|
46
|
+
className: cn("flex flex-col gap-1", className)
|
|
47
|
+
},
|
|
48
|
+
props
|
|
49
|
+
),
|
|
50
|
+
render
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function ItemLabel({
|
|
54
|
+
className,
|
|
55
|
+
render,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
return useRender({
|
|
59
|
+
defaultTagName: "div",
|
|
60
|
+
props: mergeProps(
|
|
61
|
+
{
|
|
62
|
+
className: cn("text-gdt-sm text-fg-secondary", className)
|
|
63
|
+
},
|
|
64
|
+
props
|
|
65
|
+
),
|
|
66
|
+
render
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function ItemValue({
|
|
70
|
+
className,
|
|
71
|
+
render,
|
|
72
|
+
...props
|
|
73
|
+
}) {
|
|
74
|
+
return useRender({
|
|
75
|
+
defaultTagName: "div",
|
|
76
|
+
props: mergeProps(
|
|
77
|
+
{
|
|
78
|
+
className: cn(
|
|
79
|
+
"text-gdt-sm font-semibold text-fg-primary [a]:text-fg-brand [&_a]:text-fg-brand",
|
|
80
|
+
className
|
|
81
|
+
)
|
|
82
|
+
},
|
|
83
|
+
props
|
|
84
|
+
),
|
|
85
|
+
render
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
Item,
|
|
90
|
+
ItemLabel,
|
|
91
|
+
ItemValue
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=item.js.map
|
package/dist/item.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/item.tsx","../src/lib/cn.ts"],"sourcesContent":["import { mergeProps, useRender } from \"@base-ui/react\";\nimport { cn } from \"../../lib/cn\";\n\nfunction Item({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"div\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\tprops: mergeProps<\"div\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\"flex flex-col gap-1\", className),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction ItemLabel({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"div\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\tprops: mergeProps<\"div\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\"text-gdt-sm text-fg-secondary\", className),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction ItemValue({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"div\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\tprops: mergeProps<\"div\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"text-gdt-sm font-semibold text-fg-primary [a]:text-fg-brand [&_a]:text-fg-brand\",\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});\n}\n\nexport { Item, ItemLabel, ItemValue };\n","import { type ClassValue, clsx } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n\textend: {\n\t\tclassGroups: {\n\t\t\t\"font-size\": [\n\t\t\t\t{\n\t\t\t\t\ttext: [\n\t\t\t\t\t\t\"gdt-display\",\n\t\t\t\t\t\t\"gdt-h1\",\n\t\t\t\t\t\t\"gdt-h2\",\n\t\t\t\t\t\t\"gdt-h3\",\n\t\t\t\t\t\t\"gdt-h4\",\n\t\t\t\t\t\t\"gdt-h5\",\n\t\t\t\t\t\t\"gdt-xl\",\n\t\t\t\t\t\t\"gdt-lg\",\n\t\t\t\t\t\t\"gdt-md\",\n\t\t\t\t\t\t\"gdt-sm\",\n\t\t\t\t\t\t\"gdt-xs\",\n\t\t\t\t\t\t\"gdt-subtext\",\n\t\t\t\t\t\t\"gdt-capitalized\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n});\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n"],"mappings":";AAAA,SAAS,YAAY,iBAAiB;;;ACAtC,SAA0B,YAAY;AACtC,SAAS,2BAA2B;AAEpC,IAAM,UAAU,oBAAoB;AAAA,EACnC,QAAQ;AAAA,IACP,aAAa;AAAA,MACZ,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAEM,SAAS,MAAM,QAAsB;AAC3C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC5B;;;AD5BA,SAAS,KAAK;AAAA,EACb;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAoC;AACnC,SAAO,UAAU;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACN;AAAA,QACC,WAAW,GAAG,uBAAuB,SAAS;AAAA,MAC/C;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,EACD,CAAC;AACF;AAEA,SAAS,UAAU;AAAA,EAClB;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAoC;AACnC,SAAO,UAAU;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACN;AAAA,QACC,WAAW,GAAG,kCAAkC,SAAS;AAAA,MAC1D;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,EACD,CAAC;AACF;AAEA,SAAS,UAAU;AAAA,EAClB;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAoC;AACnC,SAAO,UAAU;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACN;AAAA,QACC,WAAW;AAAA,UACV;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { Skeleton } from './skeleton.js';
|
|
6
|
+
|
|
7
|
+
declare function KpiCard({ className, loading, render, ...props }: useRender.ComponentProps<"article"> & {
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
}): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
10
|
+
declare function KpiCardTitle({ className, render, ...props }: useRender.ComponentProps<"h3">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
11
|
+
declare function KpiCardLinkOutIcon({ children, className, render, ...props }: useRender.ComponentProps<"span">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
12
|
+
declare function KpiCardValue({ className, render, ...props }: useRender.ComponentProps<"p">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
13
|
+
declare function KpiCardValueSkeleton({ className, ...props }: React.ComponentProps<typeof Skeleton>): React$1.JSX.Element;
|
|
14
|
+
declare const kpiCardTrendVariants: (props?: ({
|
|
15
|
+
direction?: "up" | "down" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
type KpiCardTrendProps = useRender.ComponentProps<"p"> & VariantProps<typeof kpiCardTrendVariants> & {
|
|
18
|
+
showIcon?: boolean;
|
|
19
|
+
};
|
|
20
|
+
declare function KpiCardTrend({ children, className, direction, render, showIcon, ...props }: KpiCardTrendProps): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
21
|
+
declare function KpiCardTrendValue({ className, render, ...props }: useRender.ComponentProps<"span">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
22
|
+
declare function KpiCardTrendCaption({ className, render, ...props }: useRender.ComponentProps<"span">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
23
|
+
|
|
24
|
+
export { KpiCard, KpiCardLinkOutIcon, KpiCardTitle, KpiCardTrend, KpiCardTrendCaption, KpiCardTrendValue, KpiCardValue, KpiCardValueSkeleton, kpiCardTrendVariants };
|
package/dist/kpi-card.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// src/components/ui/kpi-card.tsx
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { ArrowDown, ArrowUp, ArrowUpRight } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
// src/lib/cn.ts
|
|
8
|
+
import { clsx } from "clsx";
|
|
9
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
10
|
+
var twMerge = extendTailwindMerge({
|
|
11
|
+
extend: {
|
|
12
|
+
classGroups: {
|
|
13
|
+
"font-size": [
|
|
14
|
+
{
|
|
15
|
+
text: [
|
|
16
|
+
"gdt-display",
|
|
17
|
+
"gdt-h1",
|
|
18
|
+
"gdt-h2",
|
|
19
|
+
"gdt-h3",
|
|
20
|
+
"gdt-h4",
|
|
21
|
+
"gdt-h5",
|
|
22
|
+
"gdt-xl",
|
|
23
|
+
"gdt-lg",
|
|
24
|
+
"gdt-md",
|
|
25
|
+
"gdt-sm",
|
|
26
|
+
"gdt-xs",
|
|
27
|
+
"gdt-subtext",
|
|
28
|
+
"gdt-capitalized"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
function cn(...inputs) {
|
|
36
|
+
return twMerge(clsx(inputs));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/components/ui/skeleton.tsx
|
|
40
|
+
import { jsx } from "react/jsx-runtime";
|
|
41
|
+
function Skeleton({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
"data-slot": "skeleton",
|
|
46
|
+
className: cn("animate-pulse rounded-md bg-line", className),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/components/ui/kpi-card.tsx
|
|
53
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
54
|
+
function KpiCard({
|
|
55
|
+
className,
|
|
56
|
+
loading = false,
|
|
57
|
+
render,
|
|
58
|
+
...props
|
|
59
|
+
}) {
|
|
60
|
+
return useRender({
|
|
61
|
+
defaultTagName: "article",
|
|
62
|
+
props: mergeProps(
|
|
63
|
+
{
|
|
64
|
+
"aria-busy": loading || void 0,
|
|
65
|
+
className: cn(
|
|
66
|
+
"group/kpi-card relative flex w-full min-w-0 flex-col gap-4 rounded-xl p-5 text-fg-primary transition-[background-color,border-color,box-shadow,transform] outline-none border border-line-subtle shadow-1",
|
|
67
|
+
className
|
|
68
|
+
)
|
|
69
|
+
},
|
|
70
|
+
props
|
|
71
|
+
),
|
|
72
|
+
render,
|
|
73
|
+
state: {
|
|
74
|
+
slot: "kpi-card",
|
|
75
|
+
loading
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function KpiCardTitle({
|
|
80
|
+
className,
|
|
81
|
+
render,
|
|
82
|
+
...props
|
|
83
|
+
}) {
|
|
84
|
+
return useRender({
|
|
85
|
+
defaultTagName: "h3",
|
|
86
|
+
props: mergeProps(
|
|
87
|
+
{
|
|
88
|
+
className: cn(
|
|
89
|
+
"min-w-0 pr-gdt-xl text-gdt-sm font-semibold capitalized text-fg-secondary",
|
|
90
|
+
className
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
props
|
|
94
|
+
),
|
|
95
|
+
render
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function KpiCardLinkOutIcon({
|
|
99
|
+
children,
|
|
100
|
+
className,
|
|
101
|
+
render,
|
|
102
|
+
...props
|
|
103
|
+
}) {
|
|
104
|
+
return useRender({
|
|
105
|
+
defaultTagName: "span",
|
|
106
|
+
props: mergeProps(
|
|
107
|
+
{
|
|
108
|
+
"aria-hidden": true,
|
|
109
|
+
className: cn(
|
|
110
|
+
"pointer-events-none absolute right-gdt-md top-gdt-md inline-flex size-4 shrink-0 items-center justify-center text-fg-secondary [&>svg]:size-4 [&>svg]:shrink-0",
|
|
111
|
+
className
|
|
112
|
+
),
|
|
113
|
+
children: children ?? /* @__PURE__ */ jsx2(ArrowUpRight, { "aria-hidden": "true" })
|
|
114
|
+
},
|
|
115
|
+
props
|
|
116
|
+
),
|
|
117
|
+
render
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function KpiCardValue({
|
|
121
|
+
className,
|
|
122
|
+
render,
|
|
123
|
+
...props
|
|
124
|
+
}) {
|
|
125
|
+
return useRender({
|
|
126
|
+
defaultTagName: "p",
|
|
127
|
+
props: mergeProps(
|
|
128
|
+
{
|
|
129
|
+
className: cn(
|
|
130
|
+
"text-gdt-h3 font-extrabold text-fg-primary group-aria-busy/kpi-card:hidden",
|
|
131
|
+
className
|
|
132
|
+
)
|
|
133
|
+
},
|
|
134
|
+
props
|
|
135
|
+
),
|
|
136
|
+
render
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function KpiCardValueSkeleton({
|
|
140
|
+
className,
|
|
141
|
+
...props
|
|
142
|
+
}) {
|
|
143
|
+
return /* @__PURE__ */ jsx2(
|
|
144
|
+
Skeleton,
|
|
145
|
+
{
|
|
146
|
+
className: cn(
|
|
147
|
+
"hidden h-8 mt-2 md:mt-3 w-24 rounded-md group-aria-busy/kpi-card:block",
|
|
148
|
+
className
|
|
149
|
+
),
|
|
150
|
+
...props
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
var kpiCardTrendVariants = cva(
|
|
155
|
+
"flex min-w-0 items-center gap-1.5 text-gdt-capitalized",
|
|
156
|
+
{
|
|
157
|
+
variants: {
|
|
158
|
+
direction: {
|
|
159
|
+
up: "text-status-success",
|
|
160
|
+
down: "text-status-danger"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
defaultVariants: {
|
|
164
|
+
direction: "up"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
function KpiCardTrend({
|
|
169
|
+
children,
|
|
170
|
+
className,
|
|
171
|
+
direction = "up",
|
|
172
|
+
render,
|
|
173
|
+
showIcon = true,
|
|
174
|
+
...props
|
|
175
|
+
}) {
|
|
176
|
+
const Icon = direction === "down" ? ArrowDown : ArrowUp;
|
|
177
|
+
return useRender({
|
|
178
|
+
defaultTagName: "p",
|
|
179
|
+
props: mergeProps(
|
|
180
|
+
{
|
|
181
|
+
className: cn(kpiCardTrendVariants({ direction }), className),
|
|
182
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
183
|
+
showIcon ? /* @__PURE__ */ jsx2(Icon, { "aria-hidden": "true", className: "size-3 shrink-0" }) : null,
|
|
184
|
+
children
|
|
185
|
+
] })
|
|
186
|
+
},
|
|
187
|
+
props
|
|
188
|
+
),
|
|
189
|
+
render,
|
|
190
|
+
state: {
|
|
191
|
+
direction,
|
|
192
|
+
showIcon,
|
|
193
|
+
slot: "kpi-card-trend"
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function KpiCardTrendValue({
|
|
198
|
+
className,
|
|
199
|
+
render,
|
|
200
|
+
...props
|
|
201
|
+
}) {
|
|
202
|
+
return useRender({
|
|
203
|
+
defaultTagName: "span",
|
|
204
|
+
props: mergeProps(
|
|
205
|
+
{
|
|
206
|
+
className: cn("text-gdt-sm text-current font-semibold", className)
|
|
207
|
+
},
|
|
208
|
+
props
|
|
209
|
+
),
|
|
210
|
+
render
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function KpiCardTrendCaption({
|
|
214
|
+
className,
|
|
215
|
+
render,
|
|
216
|
+
...props
|
|
217
|
+
}) {
|
|
218
|
+
return useRender({
|
|
219
|
+
defaultTagName: "span",
|
|
220
|
+
props: mergeProps(
|
|
221
|
+
{
|
|
222
|
+
className: cn(
|
|
223
|
+
"min-w-0 truncate text-gdt-xs text-fg-secondary font-normal",
|
|
224
|
+
className
|
|
225
|
+
)
|
|
226
|
+
},
|
|
227
|
+
props
|
|
228
|
+
),
|
|
229
|
+
render
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
KpiCard,
|
|
234
|
+
KpiCardLinkOutIcon,
|
|
235
|
+
KpiCardTitle,
|
|
236
|
+
KpiCardTrend,
|
|
237
|
+
KpiCardTrendCaption,
|
|
238
|
+
KpiCardTrendValue,
|
|
239
|
+
KpiCardValue,
|
|
240
|
+
KpiCardValueSkeleton,
|
|
241
|
+
kpiCardTrendVariants
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=kpi-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/kpi-card.tsx","../src/lib/cn.ts","../src/components/ui/skeleton.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 { ArrowDown, ArrowUp, ArrowUpRight } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Skeleton } from \"./skeleton\";\n\nfunction KpiCard({\n\tclassName,\n\tloading = false,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"article\"> & { loading?: boolean }) {\n\treturn useRender({\n\t\tdefaultTagName: \"article\",\n\t\tprops: mergeProps<\"article\">(\n\t\t\t{\n\t\t\t\t\"aria-busy\": loading || undefined,\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"group/kpi-card relative flex w-full min-w-0 flex-col gap-4 rounded-xl p-5 text-fg-primary transition-[background-color,border-color,box-shadow,transform] outline-none border border-line-subtle shadow-1\",\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: \"kpi-card\",\n\t\t\tloading,\n\t\t},\n\t});\n}\n\nfunction KpiCardTitle({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"h3\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"h3\",\n\t\tprops: mergeProps<\"h3\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"min-w-0 pr-gdt-xl text-gdt-sm font-semibold capitalized text-fg-secondary\",\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});\n}\n\nfunction KpiCardLinkOutIcon({\n\tchildren,\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"span\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"span\",\n\t\tprops: mergeProps<\"span\">(\n\t\t\t{\n\t\t\t\t\"aria-hidden\": true,\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"pointer-events-none absolute right-gdt-md top-gdt-md inline-flex size-4 shrink-0 items-center justify-center text-fg-secondary [&>svg]:size-4 [&>svg]:shrink-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t\tchildren: children ?? <ArrowUpRight aria-hidden=\"true\" />,\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction KpiCardValue({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"p\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"p\",\n\t\tprops: mergeProps<\"p\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"text-gdt-h3 font-extrabold text-fg-primary group-aria-busy/kpi-card:hidden\",\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});\n}\n\nfunction KpiCardValueSkeleton({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof Skeleton>) {\n\treturn (\n\t\t<Skeleton\n\t\t\tclassName={cn(\n\t\t\t\t\"hidden h-8 mt-2 md:mt-3 w-24 rounded-md group-aria-busy/kpi-card:block\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst kpiCardTrendVariants = cva(\n\t\"flex min-w-0 items-center gap-1.5 text-gdt-capitalized\",\n\t{\n\t\tvariants: {\n\t\t\tdirection: {\n\t\t\t\tup: \"text-status-success\",\n\t\t\t\tdown: \"text-status-danger\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tdirection: \"up\",\n\t\t},\n\t},\n);\n\ntype KpiCardTrendProps = useRender.ComponentProps<\"p\"> &\n\tVariantProps<typeof kpiCardTrendVariants> & {\n\t\tshowIcon?: boolean;\n\t};\n\nfunction KpiCardTrend({\n\tchildren,\n\tclassName,\n\tdirection = \"up\",\n\trender,\n\tshowIcon = true,\n\t...props\n}: KpiCardTrendProps) {\n\tconst Icon = direction === \"down\" ? ArrowDown : ArrowUp;\n\n\treturn useRender({\n\t\tdefaultTagName: \"p\",\n\t\tprops: mergeProps<\"p\">(\n\t\t\t{\n\t\t\t\tclassName: cn(kpiCardTrendVariants({ direction }), className),\n\t\t\t\tchildren: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{showIcon ? (\n\t\t\t\t\t\t\t<Icon aria-hidden=\"true\" className=\"size-3 shrink-0\" />\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</>\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\tdirection,\n\t\t\tshowIcon,\n\t\t\tslot: \"kpi-card-trend\",\n\t\t},\n\t});\n}\n\nfunction KpiCardTrendValue({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"span\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"span\",\n\t\tprops: mergeProps<\"span\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\"text-gdt-sm text-current font-semibold\", className),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction KpiCardTrendCaption({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"span\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"span\",\n\t\tprops: mergeProps<\"span\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"min-w-0 truncate text-gdt-xs text-fg-secondary font-normal\",\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});\n}\n\n/**\n * Composition examples:\n *\n * <KpiCard>\n * <KpiCardTitle>Total Revenue</KpiCardTitle>\n * <KpiCardValue>$1.25M</KpiCardValue>\n * <KpiCardTrend>\n * <KpiCardTrendValue>+12.5%</KpiCardTrendValue>\n * <KpiCardTrendCaption>vs last month</KpiCardTrendCaption>\n * </KpiCardTrend>\n * </KpiCard>\n *\n * <KpiCard interactive render={<a href=\"/reports\" aria-label=\"View revenue report\" />}>\n * <KpiCardLinkOutIcon />\n * <KpiCardTitle>Total Revenue</KpiCardTitle>\n * <KpiCardValue>$1.25M</KpiCardValue>\n * </KpiCard>\n *\n * <KpiCard loading>\n * <KpiCardTitle>Total Revenue</KpiCardTitle>\n * <KpiCardValue>$1.25M</KpiCardValue>\n * <KpiCardValueSkeleton />\n * </KpiCard>\n */\nexport {\n\tKpiCard,\n\tKpiCardLinkOutIcon,\n\tKpiCardTitle,\n\tKpiCardTrend,\n\tKpiCardTrendCaption,\n\tKpiCardTrendValue,\n\tKpiCardValue,\n\tKpiCardValueSkeleton,\n\tkpiCardTrendVariants,\n};\n","import { type ClassValue, clsx } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n\textend: {\n\t\tclassGroups: {\n\t\t\t\"font-size\": [\n\t\t\t\t{\n\t\t\t\t\ttext: [\n\t\t\t\t\t\t\"gdt-display\",\n\t\t\t\t\t\t\"gdt-h1\",\n\t\t\t\t\t\t\"gdt-h2\",\n\t\t\t\t\t\t\"gdt-h3\",\n\t\t\t\t\t\t\"gdt-h4\",\n\t\t\t\t\t\t\"gdt-h5\",\n\t\t\t\t\t\t\"gdt-xl\",\n\t\t\t\t\t\t\"gdt-lg\",\n\t\t\t\t\t\t\"gdt-md\",\n\t\t\t\t\t\t\"gdt-sm\",\n\t\t\t\t\t\t\"gdt-xs\",\n\t\t\t\t\t\t\"gdt-subtext\",\n\t\t\t\t\t\t\"gdt-capitalized\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n});\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import { cn } from \"../../lib/cn\";\n\nfunction Skeleton({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"skeleton\"\n\t\t\tclassName={cn(\"animate-pulse rounded-md bg-line\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Skeleton };\n"],"mappings":"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","names":["jsx"]}
|
package/dist/label.d.ts
ADDED
package/dist/label.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/lib/cn.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
|
+
var twMerge = extendTailwindMerge({
|
|
5
|
+
extend: {
|
|
6
|
+
classGroups: {
|
|
7
|
+
"font-size": [
|
|
8
|
+
{
|
|
9
|
+
text: [
|
|
10
|
+
"gdt-display",
|
|
11
|
+
"gdt-h1",
|
|
12
|
+
"gdt-h2",
|
|
13
|
+
"gdt-h3",
|
|
14
|
+
"gdt-h4",
|
|
15
|
+
"gdt-h5",
|
|
16
|
+
"gdt-xl",
|
|
17
|
+
"gdt-lg",
|
|
18
|
+
"gdt-md",
|
|
19
|
+
"gdt-sm",
|
|
20
|
+
"gdt-xs",
|
|
21
|
+
"gdt-subtext",
|
|
22
|
+
"gdt-capitalized"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
function cn(...inputs) {
|
|
30
|
+
return twMerge(clsx(inputs));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/components/ui/label.tsx
|
|
34
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
+
function Label({
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
withAsterisk = false,
|
|
39
|
+
showOptionalText = false,
|
|
40
|
+
...props
|
|
41
|
+
}) {
|
|
42
|
+
const labelClassName = cn(
|
|
43
|
+
"flex w-fit max-w-full items-center gap-1 text-gdt-sm leading-none font-semibold text-fg-primary select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
44
|
+
className
|
|
45
|
+
);
|
|
46
|
+
if (withAsterisk) {
|
|
47
|
+
return (
|
|
48
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: association is supplied by callers through htmlFor or nesting patterns.
|
|
49
|
+
/* @__PURE__ */ jsxs("label", { "data-slot": "label", className: labelClassName, ...props, children: [
|
|
50
|
+
/* @__PURE__ */ jsx("div", { className: "inline-flex", children }),
|
|
51
|
+
withAsterisk && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 text-fg-danger", children: "*" }),
|
|
52
|
+
showOptionalText && /* @__PURE__ */ jsx("span", { className: "text-gdt-xs font-normal italic", children: "(optional)" })
|
|
53
|
+
] })
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return (
|
|
57
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: association is supplied by callers through htmlFor or nesting patterns.
|
|
58
|
+
/* @__PURE__ */ jsx("label", { "data-slot": "label", className: labelClassName, ...props, children: /* @__PURE__ */ jsxs("div", { children: [
|
|
59
|
+
children,
|
|
60
|
+
" ",
|
|
61
|
+
showOptionalText && /* @__PURE__ */ jsx("span", { className: "text-gdt-xs font-normal italic", children: "(optional)" })
|
|
62
|
+
] }) })
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
Label
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/cn.ts","../src/components/ui/label.tsx"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n\textend: {\n\t\tclassGroups: {\n\t\t\t\"font-size\": [\n\t\t\t\t{\n\t\t\t\t\ttext: [\n\t\t\t\t\t\t\"gdt-display\",\n\t\t\t\t\t\t\"gdt-h1\",\n\t\t\t\t\t\t\"gdt-h2\",\n\t\t\t\t\t\t\"gdt-h3\",\n\t\t\t\t\t\t\"gdt-h4\",\n\t\t\t\t\t\t\"gdt-h5\",\n\t\t\t\t\t\t\"gdt-xl\",\n\t\t\t\t\t\t\"gdt-lg\",\n\t\t\t\t\t\t\"gdt-md\",\n\t\t\t\t\t\t\"gdt-sm\",\n\t\t\t\t\t\t\"gdt-xs\",\n\t\t\t\t\t\t\"gdt-subtext\",\n\t\t\t\t\t\t\"gdt-capitalized\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n});\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport type * as React from \"react\";\n\nimport { cn } from \"../../lib/cn\";\n\nfunction Label({\n\tclassName,\n\tchildren,\n\twithAsterisk = false,\n\tshowOptionalText = false,\n\t...props\n}: React.ComponentProps<\"label\"> & {\n\twithAsterisk?: boolean;\n\tshowOptionalText?: boolean;\n}) {\n\tconst labelClassName = cn(\n\t\t\"flex w-fit max-w-full items-center gap-1 text-gdt-sm leading-none font-semibold text-fg-primary select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n\t\tclassName,\n\t);\n\n\tif (withAsterisk) {\n\t\treturn (\n\t\t\t// biome-ignore lint/a11y/noLabelWithoutControl: association is supplied by callers through htmlFor or nesting patterns.\n\t\t\t<label data-slot=\"label\" className={labelClassName} {...props}>\n\t\t\t\t<div className=\"inline-flex\">{children}</div>\n\t\t\t\t{withAsterisk && (\n\t\t\t\t\t<span className=\"inline-flex shrink-0 text-fg-danger\">*</span>\n\t\t\t\t)}\n\t\t\t\t{showOptionalText && (\n\t\t\t\t\t<span className=\"text-gdt-xs font-normal italic\">(optional)</span>\n\t\t\t\t)}\n\t\t\t</label>\n\t\t);\n\t}\n\n\treturn (\n\t\t// biome-ignore lint/a11y/noLabelWithoutControl: association is supplied by callers through htmlFor or nesting patterns.\n\t\t<label data-slot=\"label\" className={labelClassName} {...props}>\n\t\t\t<div>\n\t\t\t\t{children}{\" \"}\n\t\t\t\t{showOptionalText && (\n\t\t\t\t\t<span className=\"text-gdt-xs font-normal italic\">(optional)</span>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</label>\n\t);\n}\n\nexport { Label };\n"],"mappings":";AAAA,SAA0B,YAAY;AACtC,SAAS,2BAA2B;AAEpC,IAAM,UAAU,oBAAoB;AAAA,EACnC,QAAQ;AAAA,IACP,aAAa;AAAA,MACZ,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAEM,SAAS,MAAM,QAAsB;AAC3C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC5B;;;ACPG,SACC,KADD;AAlBH,SAAS,MAAM;AAAA,EACd;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,GAAG;AACJ,GAGG;AACF,QAAM,iBAAiB;AAAA,IACtB;AAAA,IACA;AAAA,EACD;AAEA,MAAI,cAAc;AACjB;AAAA;AAAA,MAEC,qBAAC,WAAM,aAAU,SAAQ,WAAW,gBAAiB,GAAG,OACvD;AAAA,4BAAC,SAAI,WAAU,eAAe,UAAS;AAAA,QACtC,gBACA,oBAAC,UAAK,WAAU,uCAAsC,eAAC;AAAA,QAEvD,oBACA,oBAAC,UAAK,WAAU,kCAAiC,wBAAU;AAAA,SAE7D;AAAA;AAAA,EAEF;AAEA;AAAA;AAAA,IAEC,oBAAC,WAAM,aAAU,SAAQ,WAAW,gBAAiB,GAAG,OACvD,+BAAC,SACC;AAAA;AAAA,MAAU;AAAA,MACV,oBACA,oBAAC,UAAK,WAAU,kCAAiC,wBAAU;AAAA,OAE7D,GACD;AAAA;AAEF;","names":[]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { ComponentSize } from './size-context.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Line charts are composed from recharts plot primitives directly — recharts
|
|
6
|
+
* identifies `Line`, `Area`, `XAxis`, `YAxis`, and `CartesianGrid` by component
|
|
7
|
+
* identity and cannot be wrapped. This module supplies giddaa-specific defaults
|
|
8
|
+
* that would otherwise be copy-pasted into every line chart: per-size layout
|
|
9
|
+
* numbers. Pair them with the shared frame and overlays from `./chart`.
|
|
10
|
+
*
|
|
11
|
+
* Five sizes (sm → huge) extend the three `ComponentSize` values used elsewhere.
|
|
12
|
+
* xl and huge must be passed explicitly — they cannot be inherited from
|
|
13
|
+
* `SizeProvider` since `ComponentSize` only carries sm/md/lg.
|
|
14
|
+
*
|
|
15
|
+
* Tokens:
|
|
16
|
+
* - Primary series stroke + dots + area fill: `var(--color-surface-brand)`
|
|
17
|
+
* - Comparison series: `var(--color-surface-accent)`
|
|
18
|
+
* - Gridlines: `var(--color-line-subtle)`
|
|
19
|
+
* - Area wash: primary series colour at 15 % opacity (`fillOpacity={0.15}`)
|
|
20
|
+
* - Active-dot ring: `var(--color-surface-raised)` stroke (matches card bg)
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const chart = useLineChartLayout();
|
|
24
|
+
* <ChartCard size="md">
|
|
25
|
+
* <ChartHeader>
|
|
26
|
+
* <ChartTitle>Revenue Overview</ChartTitle>
|
|
27
|
+
* <ChartDescription>Monthly revenue · Jan–Jul</ChartDescription>
|
|
28
|
+
* </ChartHeader>
|
|
29
|
+
* <ChartContainer config={config} {...chart.container}>
|
|
30
|
+
* <AreaChart data={data} {...chart.chart}>
|
|
31
|
+
* <CartesianGrid vertical={false} stroke="var(--color-line-subtle)" />
|
|
32
|
+
* <XAxis dataKey="month" {...chart.xAxis} />
|
|
33
|
+
* <YAxis {...chart.yAxis} />
|
|
34
|
+
* <ChartLegend verticalAlign="top" content={<ChartLegendContent marker="line" />} />
|
|
35
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
36
|
+
* <Area dataKey="revenue" {...chart.area("var(--color-revenue)")} />
|
|
37
|
+
* </AreaChart>
|
|
38
|
+
* </ChartContainer>
|
|
39
|
+
* </ChartCard>
|
|
40
|
+
*/
|
|
41
|
+
/** Five sizes for line charts — extends ComponentSize with xl and huge. */
|
|
42
|
+
type LineChartSize = "sm" | "md" | "lg" | "xl" | "huge";
|
|
43
|
+
type LineChartLayout = {
|
|
44
|
+
/** Plot height in px. Width stays fluid via ResponsiveContainer. */
|
|
45
|
+
height: number;
|
|
46
|
+
/** Outer margin. Top leaves room above the highest data point. */
|
|
47
|
+
margin: {
|
|
48
|
+
top: number;
|
|
49
|
+
right: number;
|
|
50
|
+
bottom: number;
|
|
51
|
+
left: number;
|
|
52
|
+
};
|
|
53
|
+
/** Line stroke width in px. */
|
|
54
|
+
strokeWidth: number;
|
|
55
|
+
/** Radius of the resting data-point dot. */
|
|
56
|
+
dotRadius: number;
|
|
57
|
+
/** Radius of the active (hover) dot. */
|
|
58
|
+
activeDotRadius: number;
|
|
59
|
+
/** Axis tick label font size. */
|
|
60
|
+
tickFontSize: number;
|
|
61
|
+
/** Reserved width for the value (Y) axis. */
|
|
62
|
+
yAxisWidth: number;
|
|
63
|
+
/** Space between an axis and its tick labels. */
|
|
64
|
+
tickMargin: number;
|
|
65
|
+
};
|
|
66
|
+
declare const LINE_CHART_LAYOUT: Record<LineChartSize, LineChartLayout>;
|
|
67
|
+
/** Map the 5 line-chart sizes to the 3 ComponentSize values for ChartCard. */
|
|
68
|
+
declare function toComponentSize(size: LineChartSize): ComponentSize;
|
|
69
|
+
/**
|
|
70
|
+
* Resolve the line-chart layout for an explicit or inherited component size. The
|
|
71
|
+
* returned object groups the giddaa defaults by the recharts component they
|
|
72
|
+
* belong to. `line(color)`/`area(color)` return the full series props for a
|
|
73
|
+
* given colour — spread each onto its element, then pass the data-specific props
|
|
74
|
+
* (`config`, `data`, `dataKey`, …) directly afterwards to add or override:
|
|
75
|
+
*
|
|
76
|
+
* const chart = useLineChartLayout(size);
|
|
77
|
+
* <ChartContainer config={config} {...chart.container}>
|
|
78
|
+
* <AreaChart data={data} {...chart.chart}>
|
|
79
|
+
* <XAxis dataKey="month" {...chart.xAxis} />
|
|
80
|
+
* <YAxis {...chart.yAxis} />
|
|
81
|
+
* <Area dataKey="revenue" {...chart.area("var(--color-revenue)")} />
|
|
82
|
+
*/
|
|
83
|
+
declare function useLineChartLayout(size?: LineChartSize): {
|
|
84
|
+
container: {
|
|
85
|
+
className: string;
|
|
86
|
+
style: {
|
|
87
|
+
height: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
chart: {
|
|
91
|
+
accessibilityLayer: boolean;
|
|
92
|
+
margin: {
|
|
93
|
+
top: number;
|
|
94
|
+
right: number;
|
|
95
|
+
bottom: number;
|
|
96
|
+
left: number;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
xAxis: {
|
|
100
|
+
readonly tickLine: false;
|
|
101
|
+
readonly axisLine: false;
|
|
102
|
+
readonly tickMargin: number;
|
|
103
|
+
readonly tick: {
|
|
104
|
+
fontSize: number;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
yAxis: {
|
|
108
|
+
readonly tickLine: false;
|
|
109
|
+
readonly axisLine: false;
|
|
110
|
+
readonly width: number;
|
|
111
|
+
readonly tick: {
|
|
112
|
+
fontSize: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
line: (color: string) => {
|
|
116
|
+
type: "linear";
|
|
117
|
+
stroke: string;
|
|
118
|
+
strokeWidth: number;
|
|
119
|
+
strokeLinejoin: "round";
|
|
120
|
+
strokeLinecap: "round";
|
|
121
|
+
dot: {
|
|
122
|
+
r: number;
|
|
123
|
+
fill: string;
|
|
124
|
+
strokeWidth: number;
|
|
125
|
+
};
|
|
126
|
+
activeDot: {
|
|
127
|
+
r: number;
|
|
128
|
+
fill: string;
|
|
129
|
+
stroke: string;
|
|
130
|
+
strokeWidth: number;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
area: (color: string) => {
|
|
134
|
+
fill: string;
|
|
135
|
+
fillOpacity: number;
|
|
136
|
+
type: "linear";
|
|
137
|
+
stroke: string;
|
|
138
|
+
strokeWidth: number;
|
|
139
|
+
strokeLinejoin: "round";
|
|
140
|
+
strokeLinecap: "round";
|
|
141
|
+
dot: {
|
|
142
|
+
r: number;
|
|
143
|
+
fill: string;
|
|
144
|
+
strokeWidth: number;
|
|
145
|
+
};
|
|
146
|
+
activeDot: {
|
|
147
|
+
r: number;
|
|
148
|
+
fill: string;
|
|
149
|
+
stroke: string;
|
|
150
|
+
strokeWidth: number;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export { LINE_CHART_LAYOUT, type LineChartLayout, type LineChartSize, toComponentSize, useLineChartLayout };
|