@schandlergarcia/sf-web-components 1.6.0 → 1.8.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/dist/components/library/cards/ActionList.d.ts +10 -10
- package/dist/components/library/cards/ActionList.js +2 -3
- package/dist/components/library/cards/ActionList.js.map +1 -1
- package/dist/components/library/cards/ActivityCard.d.ts +18 -5
- package/dist/components/library/cards/ActivityCard.js +3 -4
- package/dist/components/library/cards/ActivityCard.js.map +1 -1
- package/dist/components/library/cards/BaseCard.d.ts +30 -24
- package/dist/components/library/cards/BaseCard.js +2 -3
- package/dist/components/library/cards/BaseCard.js.map +1 -1
- package/dist/components/library/cards/CalloutCard.d.ts +11 -9
- package/dist/components/library/cards/CalloutCard.js +2 -3
- package/dist/components/library/cards/CalloutCard.js.map +1 -1
- package/dist/components/library/cards/ChartCard.d.ts +29 -17
- package/dist/components/library/cards/ChartCard.js +13 -14
- package/dist/components/library/cards/ChartCard.js.map +1 -1
- package/dist/components/library/cards/FeedPanel.d.ts +12 -11
- package/dist/components/library/cards/FeedPanel.js +3 -4
- package/dist/components/library/cards/FeedPanel.js.map +1 -1
- package/dist/components/library/cards/ListCard.d.ts +33 -20
- package/dist/components/library/cards/ListCard.js +35 -35
- package/dist/components/library/cards/ListCard.js.map +1 -1
- package/dist/components/library/cards/MetricCard.d.ts +23 -17
- package/dist/components/library/cards/MetricCard.js +10 -11
- package/dist/components/library/cards/MetricCard.js.map +1 -1
- package/dist/components/library/cards/MetricsStrip.d.ts +11 -11
- package/dist/components/library/cards/MetricsStrip.js +1 -1
- package/dist/components/library/cards/MetricsStrip.js.map +1 -1
- package/dist/components/library/cards/SectionCard.d.ts +17 -12
- package/dist/components/library/cards/SectionCard.js +18 -19
- package/dist/components/library/cards/SectionCard.js.map +1 -1
- package/dist/components/library/cards/SemanticMetricCard.d.ts +15 -20
- package/dist/components/library/cards/SemanticMetricCardWithLoading.d.ts +8 -7
- package/dist/components/library/cards/SemanticTableCard.d.ts +13 -18
- package/dist/components/library/cards/SemanticTableCardWithLoading.d.ts +8 -7
- package/dist/components/library/cards/StatusCard.d.ts +29 -15
- package/dist/components/library/cards/StatusCard.js +16 -17
- package/dist/components/library/cards/StatusCard.js.map +1 -1
- package/dist/components/library/cards/TableCard.d.ts +40 -23
- package/dist/components/library/cards/TableCard.js +59 -59
- package/dist/components/library/cards/TableCard.js.map +1 -1
- package/dist/components/library/cards/WidgetCard.d.ts +19 -11
- package/dist/components/library/cards/WidgetCard.js.map +1 -1
- package/dist/components/library/charts/D3Chart.d.ts +23 -16
- package/dist/components/library/charts/D3Chart.js.map +1 -1
- package/dist/components/library/charts/D3ChartTemplates.d.ts +33 -3
- package/dist/components/library/charts/D3ChartTemplates.js +7 -7
- package/dist/components/library/charts/D3ChartTemplates.js.map +1 -1
- package/dist/components/library/charts/GeoMap.d.ts +81 -18
- package/dist/components/library/charts/GeoMap.js +28 -26
- package/dist/components/library/charts/GeoMap.js.map +1 -1
- package/dist/components/library/filters/FilterBar.d.ts +18 -8
- package/dist/components/library/filters/FilterBar.js +2 -3
- package/dist/components/library/filters/FilterBar.js.map +1 -1
- package/dist/components/library/filters/SearchFilter.d.ts +7 -6
- package/dist/components/library/filters/SearchFilter.js +2 -3
- package/dist/components/library/filters/SearchFilter.js.map +1 -1
- package/dist/components/library/filters/SelectFilter.d.ts +13 -7
- package/dist/components/library/filters/SelectFilter.js +2 -3
- package/dist/components/library/filters/SelectFilter.js.map +1 -1
- package/dist/components/library/filters/ToggleFilter.d.ts +7 -5
- package/dist/components/library/filters/ToggleFilter.js +2 -3
- package/dist/components/library/filters/ToggleFilter.js.map +1 -1
- package/dist/components/library/forms/FormField.d.ts +10 -8
- package/dist/components/library/forms/FormField.js +3 -4
- package/dist/components/library/forms/FormField.js.map +1 -1
- package/dist/components/library/forms/FormModal.d.ts +23 -14
- package/dist/components/library/forms/FormModal.js.map +1 -1
- package/dist/components/library/forms/FormRenderer.d.ts +29 -9
- package/dist/components/library/forms/FormRenderer.js +6 -7
- package/dist/components/library/forms/FormRenderer.js.map +1 -1
- package/dist/components/library/forms/FormSection.d.ts +10 -8
- package/dist/components/library/forms/FormSection.js +2 -3
- package/dist/components/library/forms/FormSection.js.map +1 -1
- package/dist/components/library/forms/index.d.ts +5 -0
- package/dist/components/library/forms/useFormState.d.ts +23 -15
- package/dist/components/library/forms/useFormState.js +53 -47
- package/dist/components/library/forms/useFormState.js.map +1 -1
- package/dist/components/library/heroui/Accordion.d.ts +6 -5
- package/dist/components/library/heroui/Accordion.js +7 -8
- package/dist/components/library/heroui/Accordion.js.map +1 -1
- package/dist/components/library/heroui/Breadcrumbs.d.ts +5 -2
- package/dist/components/library/heroui/Breadcrumbs.js +4 -5
- package/dist/components/library/heroui/Breadcrumbs.js.map +1 -1
- package/dist/components/library/heroui/Collapsible.d.ts +19 -30
- package/dist/components/library/heroui/Collapsible.js +13 -13
- package/dist/components/library/heroui/Collapsible.js.map +1 -1
- package/dist/components/library/heroui/DatePicker.d.ts +24 -52
- package/dist/components/library/heroui/DatePicker.js +5 -6
- package/dist/components/library/heroui/DatePicker.js.map +1 -1
- package/dist/components/library/heroui/Dialog.d.ts +18 -32
- package/dist/components/library/heroui/Dialog.js +6 -7
- package/dist/components/library/heroui/Dialog.js.map +1 -1
- package/dist/components/library/heroui/Drawer.d.ts +6 -2
- package/dist/components/library/heroui/Drawer.js +2 -3
- package/dist/components/library/heroui/Drawer.js.map +1 -1
- package/dist/components/library/heroui/Dropdown.d.ts +6 -2
- package/dist/components/library/heroui/Dropdown.js +2 -3
- package/dist/components/library/heroui/Dropdown.js.map +1 -1
- package/dist/components/library/heroui/Field.d.ts +19 -38
- package/dist/components/library/heroui/Field.js +9 -10
- package/dist/components/library/heroui/Field.js.map +1 -1
- package/dist/components/library/heroui/Meter.d.ts +7 -5
- package/dist/components/library/heroui/Meter.js +4 -5
- package/dist/components/library/heroui/Meter.js.map +1 -1
- package/dist/components/library/heroui/Popover.d.ts +23 -38
- package/dist/components/library/heroui/Popover.js +12 -12
- package/dist/components/library/heroui/Popover.js.map +1 -1
- package/dist/components/library/heroui/Select.d.ts +31 -37
- package/dist/components/library/heroui/Select.js +3 -4
- package/dist/components/library/heroui/Select.js.map +1 -1
- package/dist/components/library/layout/PageContainer.d.ts +6 -4
- package/dist/components/library/layout/PageContainer.js +4 -5
- package/dist/components/library/layout/PageContainer.js.map +1 -1
- package/package.json +4 -1
- package/src/components/library/cards/{ActionList.jsx → ActionList.tsx} +13 -9
- package/src/components/library/cards/{ActivityCard.jsx → ActivityCard.tsx} +33 -4
- package/src/components/library/cards/{BaseCard.jsx → BaseCard.tsx} +33 -6
- package/src/components/library/cards/{CalloutCard.jsx → CalloutCard.tsx} +12 -10
- package/src/components/library/cards/{ChartCard.jsx → ChartCard.tsx} +32 -6
- package/src/components/library/cards/{FeedPanel.jsx → FeedPanel.tsx} +13 -2
- package/src/components/library/cards/{ListCard.jsx → ListCard.tsx} +43 -7
- package/src/components/library/cards/{MetricCard.jsx → MetricCard.tsx} +25 -6
- package/src/components/library/cards/{MetricsStrip.jsx → MetricsStrip.tsx} +22 -12
- package/src/components/library/cards/{SectionCard.jsx → SectionCard.tsx} +27 -8
- package/src/components/library/cards/{SemanticMetricCard.jsx → SemanticMetricCard.tsx} +17 -5
- package/src/components/library/cards/{SemanticMetricCardWithLoading.jsx → SemanticMetricCardWithLoading.tsx} +9 -3
- package/src/components/library/cards/{SemanticTableCard.jsx → SemanticTableCard.tsx} +14 -3
- package/src/components/library/cards/{SemanticTableCardWithLoading.jsx → SemanticTableCardWithLoading.tsx} +9 -5
- package/src/components/library/cards/{StatusCard.jsx → StatusCard.tsx} +61 -12
- package/src/components/library/cards/{TableCard.jsx → TableCard.tsx} +51 -12
- package/src/components/library/cards/{WidgetCard.jsx → WidgetCard.tsx} +28 -5
- package/src/components/library/charts/{D3Chart.jsx → D3Chart.tsx} +27 -7
- package/src/components/library/charts/{D3ChartTemplates.jsx → D3ChartTemplates.tsx} +60 -28
- package/src/components/library/charts/{GeoMap.jsx → GeoMap.tsx} +106 -17
- package/src/components/library/filters/{FilterBar.jsx → FilterBar.tsx} +21 -11
- package/src/components/library/filters/{SearchFilter.jsx → SearchFilter.tsx} +8 -2
- package/src/components/library/filters/{SelectFilter.jsx → SelectFilter.tsx} +15 -8
- package/src/components/library/filters/{ToggleFilter.jsx → ToggleFilter.tsx} +7 -6
- package/src/components/library/forms/{FormField.jsx → FormField.tsx} +91 -45
- package/src/components/library/forms/{FormModal.jsx → FormModal.tsx} +21 -20
- package/src/components/library/forms/{FormRenderer.jsx → FormRenderer.tsx} +32 -10
- package/src/components/library/forms/{FormSection.jsx → FormSection.tsx} +13 -7
- package/src/components/library/forms/index.tsx +11 -0
- package/src/components/library/forms/{useFormState.jsx → useFormState.tsx} +43 -23
- package/src/components/library/heroui/{Accordion.jsx → Accordion.tsx} +8 -3
- package/src/components/library/heroui/{Breadcrumbs.jsx → Breadcrumbs.tsx} +5 -2
- package/src/components/library/heroui/Collapsible.tsx +62 -0
- package/src/components/library/heroui/{DatePicker.jsx → DatePicker.tsx} +28 -4
- package/src/components/library/heroui/Dialog.tsx +43 -0
- package/src/components/library/heroui/{Drawer.jsx → Drawer.tsx} +6 -2
- package/src/components/library/heroui/{Dropdown.jsx → Dropdown.tsx} +6 -2
- package/src/components/library/heroui/{Field.jsx → Field.tsx} +23 -6
- package/src/components/library/heroui/Meter.tsx +13 -0
- package/src/components/library/heroui/{Popover.jsx → Popover.tsx} +29 -8
- package/src/components/library/heroui/Select.tsx +73 -0
- package/src/components/library/layout/{PageContainer.jsx → PageContainer.tsx} +6 -3
- package/src/components/library/forms/index.jsx +0 -5
- package/src/components/library/heroui/Collapsible.jsx +0 -42
- package/src/components/library/heroui/Dialog.jsx +0 -37
- package/src/components/library/heroui/Meter.jsx +0 -8
- package/src/components/library/heroui/Select.jsx +0 -37
- /package/src/components/library/filters/{index.jsx → index.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../src/components/library/heroui/Field.
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../src/components/library/heroui/Field.tsx"],"sourcesContent":["import * as React from \"react\";\n\n/**\n * HeroUI v3 Field components — simple wrappers for form field layout.\n *\n * @example\n * import { Field, FieldLabel, FieldError } from \"@/components/library\";\n * <Field>\n * <FieldLabel>Name</FieldLabel>\n * <Input />\n * <FieldError>Required</FieldError>\n * </Field>\n */\nexport interface HeroUIFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n}\n\nexport default function HeroUIField({ className = \"\", children, ...props }: HeroUIFieldProps) {\n return (\n <div className={`flex flex-col gap-1.5 ${className}`} {...props}>\n {children}\n </div>\n );\n}\n\nexport const Field = HeroUIField;\n\nexport interface FieldLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n children?: React.ReactNode;\n}\n\nexport const FieldLabel = ({ className = \"\", htmlFor, children, ...props }: FieldLabelProps) => (\n <label\n htmlFor={htmlFor}\n className={`text-sm font-medium text-slate-700 dark:text-slate-200 ${className}`}\n {...props}\n >\n {children}\n </label>\n);\n\nexport interface FieldDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n children?: React.ReactNode;\n}\n\nexport const FieldDescription = ({ className = \"\", children, ...props }: FieldDescriptionProps) => (\n <p className={`text-xs text-slate-500 dark:text-slate-400 ${className}`} {...props}>\n {children}\n </p>\n);\n\nexport interface FieldErrorProps extends React.HTMLAttributes<HTMLParagraphElement> {\n errors?: string[];\n children?: React.ReactNode;\n}\n\nexport const FieldError = ({ className = \"\", errors, children, ...props }: FieldErrorProps) => {\n // Support both children and errors prop\n const errorContent = errors && errors.length > 0 ? errors.join(\", \") : children;\n\n if (!errorContent) return null;\n\n return (\n <p className={`text-xs text-red-600 dark:text-red-400 ${className}`} {...props}>\n {errorContent}\n </p>\n );\n};\n"],"names":["HeroUIField","className","children","props","jsx","Field","FieldLabel","htmlFor","FieldDescription","FieldError","errors","errorContent"],"mappings":";AAiBA,SAAwBA,EAAY,EAAE,WAAAC,IAAY,IAAI,UAAAC,GAAU,GAAGC,KAA2B;AAC5F,SACE,gBAAAC,EAAC,SAAI,WAAW,yBAAyBH,CAAS,IAAK,GAAGE,GACvD,UAAAD,GACH;AAEJ;AAEO,MAAMG,IAAQL,GAMRM,IAAa,CAAC,EAAE,WAAAL,IAAY,IAAI,SAAAM,GAAS,UAAAL,GAAU,GAAGC,EAAA,MACjE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAAG;AAAA,IACA,WAAW,0DAA0DN,CAAS;AAAA,IAC7E,GAAGE;AAAA,IAEH,UAAAD;AAAA,EAAA;AACH,GAOWM,IAAmB,CAAC,EAAE,WAAAP,IAAY,IAAI,UAAAC,GAAU,GAAGC,EAAA,MAC9D,gBAAAC,EAAC,OAAE,WAAW,8CAA8CH,CAAS,IAAK,GAAGE,GAC1E,UAAAD,EAAA,CACH,GAQWO,IAAa,CAAC,EAAE,WAAAR,IAAY,IAAI,QAAAS,GAAQ,UAAAR,GAAU,GAAGC,QAA6B;AAE7F,QAAMQ,IAAeD,KAAUA,EAAO,SAAS,IAAIA,EAAO,KAAK,IAAI,IAAIR;AAEvE,SAAKS,IAGH,gBAAAP,EAAC,OAAE,WAAW,0CAA0CH,CAAS,IAAK,GAAGE,GACtE,UAAAQ,EAAA,CACH,IALwB;AAO5B;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
children: any;
|
|
4
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export { Meter };
|
|
1
|
+
import * as React from "react";
|
|
6
2
|
import { Meter } from "@heroui/react";
|
|
3
|
+
export interface HeroUIMeterProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export default function HeroUIMeter({ children, ...props }: HeroUIMeterProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { Meter };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
2
|
import { Meter as o } from "@heroui/react";
|
|
4
|
-
import { Meter as
|
|
5
|
-
function
|
|
3
|
+
import { Meter as u } from "@heroui/react";
|
|
4
|
+
function p({ children: r, ...e }) {
|
|
6
5
|
return /* @__PURE__ */ t(o, { ...e, children: r });
|
|
7
6
|
}
|
|
8
7
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
u as Meter,
|
|
9
|
+
p as default
|
|
11
10
|
};
|
|
12
11
|
//# sourceMappingURL=Meter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Meter.js","sources":["../../../../src/components/library/heroui/Meter.
|
|
1
|
+
{"version":3,"file":"Meter.js","sources":["../../../../src/components/library/heroui/Meter.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Meter } from \"@heroui/react\";\n\nexport interface HeroUIMeterProps {\n children?: React.ReactNode;\n [key: string]: any;\n}\n\nexport default function HeroUIMeter({ children, ...props }: HeroUIMeterProps) {\n return <Meter {...props}>{children}</Meter>;\n}\n\nexport { Meter };\n"],"names":["HeroUIMeter","children","props","jsx","Meter"],"mappings":";;;AAQA,SAAwBA,EAAY,EAAE,UAAAC,GAAU,GAAGC,KAA2B;AAC5E,SAAO,gBAAAC,EAACC,GAAA,EAAO,GAAGF,GAAQ,UAAAD,EAAA,CAAS;AACrC;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
/**
|
|
2
3
|
* HeroUI v3 Popover — simple popover for shadcn compatibility.
|
|
3
4
|
* Using native HTML/CSS since HeroUI v3 doesn't have a Popover component.
|
|
@@ -9,41 +10,25 @@
|
|
|
9
10
|
* <PopoverContent>Content</PopoverContent>
|
|
10
11
|
* </Popover>
|
|
11
12
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
open:
|
|
16
|
-
|
|
17
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
export function PopoverTrigger({ children, open, onOpenChange, asChild, ...props }: {
|
|
36
|
-
[x: string]: any;
|
|
37
|
-
children: any;
|
|
38
|
-
open: any;
|
|
39
|
-
onOpenChange: any;
|
|
40
|
-
asChild: any;
|
|
41
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
export function PopoverContent({ children, open, className, align, sideOffset, ...props }: {
|
|
43
|
-
[x: string]: any;
|
|
44
|
-
children: any;
|
|
45
|
-
open: any;
|
|
46
|
-
className?: string | undefined;
|
|
47
|
-
align?: string | undefined;
|
|
48
|
-
sideOffset?: number | undefined;
|
|
49
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export interface HeroUIPopoverProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
open?: boolean;
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
export default function HeroUIPopover({ children, open, onOpenChange, ...props }: HeroUIPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const Popover: typeof HeroUIPopover;
|
|
20
|
+
export interface PopoverTriggerProps {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
asChild?: boolean;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export declare const PopoverTrigger: ({ children, open, onOpenChange, asChild, ...props }: PopoverTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
align?: "start" | "center" | "end";
|
|
32
|
+
sideOffset?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const PopoverContent: ({ children, open, className, align, sideOffset, ...props }: PopoverContentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import a from "react";
|
|
3
|
-
function m({ children: e, open: t, onOpenChange:
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
function m({ children: e, open: t, onOpenChange: s, ...l }) {
|
|
4
4
|
const [n, r] = a.useState(!1), i = t !== void 0, d = i ? t : n, u = (o) => {
|
|
5
|
-
i || r(o),
|
|
5
|
+
i || r(o), s?.(o);
|
|
6
6
|
};
|
|
7
|
-
return /* @__PURE__ */ c("div", { className: "relative inline-block", ...
|
|
7
|
+
return /* @__PURE__ */ c("div", { className: "relative inline-block", ...l, children: a.Children.map(e, (o) => a.isValidElement(o) ? a.cloneElement(o, { open: d, onOpenChange: u }) : o) });
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
const r = () =>
|
|
11
|
-
return
|
|
9
|
+
const f = m, b = ({ children: e, open: t, onOpenChange: s, asChild: l, ...n }) => {
|
|
10
|
+
const r = () => s?.(!t);
|
|
11
|
+
return l && a.isValidElement(e) ? a.cloneElement(e, {
|
|
12
12
|
...n,
|
|
13
13
|
onClick: r
|
|
14
14
|
}) : /* @__PURE__ */ c("button", { type: "button", onClick: r, ...n, children: e });
|
|
15
|
-
},
|
|
15
|
+
}, C = ({ children: e, open: t, className: s = "", align: l = "center", sideOffset: n = 4, ...r }) => {
|
|
16
16
|
if (!t) return null;
|
|
17
17
|
const i = {
|
|
18
18
|
start: "left-0",
|
|
@@ -22,16 +22,16 @@ const b = m, C = ({ children: e, open: t, onOpenChange: l, asChild: s, ...n }) =
|
|
|
22
22
|
return /* @__PURE__ */ c(
|
|
23
23
|
"div",
|
|
24
24
|
{
|
|
25
|
-
className: `absolute z-50 mt-${n} w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-900 shadow-md dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 ${i[
|
|
25
|
+
className: `absolute z-50 mt-${n} w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-900 shadow-md dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 ${i[l] || i.center} ${s}`,
|
|
26
26
|
...r,
|
|
27
27
|
children: e
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
f as Popover,
|
|
33
|
+
C as PopoverContent,
|
|
34
|
+
b as PopoverTrigger,
|
|
35
35
|
m as default
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=Popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../../src/components/library/heroui/Popover.
|
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../../src/components/library/heroui/Popover.tsx"],"sourcesContent":["import * as React from \"react\";\n\n/**\n * HeroUI v3 Popover — simple popover for shadcn compatibility.\n * Using native HTML/CSS since HeroUI v3 doesn't have a Popover component.\n *\n * @example\n * import { Popover, PopoverTrigger, PopoverContent } from \"@/components/library\";\n * <Popover>\n * <PopoverTrigger>Open</PopoverTrigger>\n * <PopoverContent>Content</PopoverContent>\n * </Popover>\n */\nexport interface HeroUIPopoverProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nexport default function HeroUIPopover({ children, open, onOpenChange, ...props }: HeroUIPopoverProps) {\n const [isOpen, setIsOpen] = React.useState(false);\n const isControlled = open !== undefined;\n const actualOpen = isControlled ? open : isOpen;\n\n const handleOpenChange = (newOpen: boolean) => {\n if (!isControlled) setIsOpen(newOpen);\n onOpenChange?.(newOpen);\n };\n\n return (\n <div className=\"relative inline-block\" {...props}>\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, { open: actualOpen, onOpenChange: handleOpenChange } as any);\n }\n return child;\n })}\n </div>\n );\n}\n\nexport const Popover = HeroUIPopover;\n\nexport interface PopoverTriggerProps {\n children?: React.ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n asChild?: boolean;\n [key: string]: any;\n}\n\nexport const PopoverTrigger = ({ children, open, onOpenChange, asChild, ...props }: PopoverTriggerProps) => {\n const handleClick = () => onOpenChange?.(!open);\n\n // If asChild is true, clone the child element with the props\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(children, {\n ...props,\n onClick: handleClick,\n } as any);\n }\n\n // Otherwise, wrap in a button\n return (\n <button type=\"button\" onClick={handleClick} {...props}>\n {children}\n </button>\n );\n};\n\nexport interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n open?: boolean;\n align?: \"start\" | \"center\" | \"end\";\n sideOffset?: number;\n}\n\nexport const PopoverContent = ({ children, open, className = \"\", align = \"center\", sideOffset = 4, ...props }: PopoverContentProps) => {\n if (!open) return null;\n\n const alignClasses: Record<string, string> = {\n start: \"left-0\",\n center: \"left-1/2 -translate-x-1/2\",\n end: \"right-0\"\n };\n\n return (\n <div\n className={`absolute z-50 mt-${sideOffset} w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-900 shadow-md dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 ${alignClasses[align] || alignClasses.center} ${className}`}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":["HeroUIPopover","children","open","onOpenChange","props","isOpen","setIsOpen","React","isControlled","actualOpen","handleOpenChange","newOpen","jsx","child","Popover","PopoverTrigger","asChild","handleClick","PopoverContent","className","align","sideOffset","alignClasses"],"mappings":";;AAmBA,SAAwBA,EAAc,EAAE,UAAAC,GAAU,MAAAC,GAAM,cAAAC,GAAc,GAAGC,KAA6B;AACpG,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAM,SAAS,EAAK,GAC1CC,IAAeN,MAAS,QACxBO,IAAaD,IAAeN,IAAOG,GAEnCK,IAAmB,CAACC,MAAqB;AAC7C,IAAKH,KAAcF,EAAUK,CAAO,GACpCR,IAAeQ,CAAO;AAAA,EACxB;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAU,yBAAyB,GAAGR,GACxC,UAAAG,EAAM,SAAS,IAAIN,GAAU,CAACY,MACzBN,EAAM,eAAeM,CAAK,IACrBN,EAAM,aAAaM,GAAO,EAAE,MAAMJ,GAAY,cAAcC,GAAyB,IAEvFG,CACR,EAAA,CACH;AAEJ;AAEO,MAAMC,IAAUd,GAUVe,IAAiB,CAAC,EAAE,UAAAd,GAAU,MAAAC,GAAM,cAAAC,GAAc,SAAAa,GAAS,GAAGZ,QAAiC;AAC1G,QAAMa,IAAc,MAAMd,IAAe,CAACD,CAAI;AAG9C,SAAIc,KAAWT,EAAM,eAAeN,CAAQ,IACnCM,EAAM,aAAaN,GAAU;AAAA,IAClC,GAAGG;AAAA,IACH,SAASa;AAAA,EAAA,CACH,IAKR,gBAAAL,EAAC,YAAO,MAAK,UAAS,SAASK,GAAc,GAAGb,GAC7C,UAAAH,GACH;AAEJ,GASaiB,IAAiB,CAAC,EAAE,UAAAjB,GAAU,MAAAC,GAAM,WAAAiB,IAAY,IAAI,OAAAC,IAAQ,UAAU,YAAAC,IAAa,GAAG,GAAGjB,QAAiC;AACrI,MAAI,CAACF,EAAM,QAAO;AAElB,QAAMoB,IAAuC;AAAA,IAC3C,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,KAAK;AAAA,EAAA;AAGP,SACE,gBAAAV;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,oBAAoBS,CAAU,6IAA6IC,EAAaF,CAAK,KAAKE,EAAa,MAAM,IAAIH,CAAS;AAAA,MAC5O,GAAGf;AAAA,MAEH,UAAAH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
/**
|
|
2
3
|
* HeroUI v3 Select wrapper with shadcn compatibility.
|
|
3
4
|
*
|
|
@@ -5,40 +6,33 @@
|
|
|
5
6
|
* - onValueChange -> onSelectionChange
|
|
6
7
|
* - value -> selectedKeys
|
|
7
8
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
value:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
children: any;
|
|
39
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
40
|
-
export function SelectItem({ value, children, ...props }: {
|
|
41
|
-
[x: string]: any;
|
|
42
|
-
value: any;
|
|
43
|
-
children: any;
|
|
44
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export interface HeroUISelectProps {
|
|
10
|
+
value?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
export default function HeroUISelect({ value, onValueChange, children, ...props }: HeroUISelectProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const Select: typeof HeroUISelect;
|
|
17
|
+
export interface SelectTriggerProps {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
size?: string;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export declare const SelectTrigger: ({ children }: SelectTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export interface SelectValueProps {
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export declare const SelectValue: ({ placeholder }: SelectValueProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export interface SelectContentProps {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export declare const SelectContent: ({ children }: SelectContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export interface SelectItemProps {
|
|
34
|
+
value: string;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
export declare const SelectItem: ({ value, children, ...props }: SelectItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
2
|
import { Select as s } from "@heroui/react";
|
|
4
|
-
function h({ value: e, onValueChange: t, children:
|
|
3
|
+
function h({ value: e, onValueChange: t, children: n, ...o }) {
|
|
5
4
|
return /* @__PURE__ */ l(
|
|
6
5
|
s,
|
|
7
6
|
{
|
|
@@ -10,8 +9,8 @@ function h({ value: e, onValueChange: t, children: o, ...n }) {
|
|
|
10
9
|
const r = Array.from(c)[0];
|
|
11
10
|
t?.(r || "");
|
|
12
11
|
},
|
|
13
|
-
...
|
|
14
|
-
children:
|
|
12
|
+
...o,
|
|
13
|
+
children: n
|
|
15
14
|
}
|
|
16
15
|
);
|
|
17
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../src/components/library/heroui/Select.
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../src/components/library/heroui/Select.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Select as HeroSelect } from \"@heroui/react\";\n\n/**\n * HeroUI v3 Select wrapper with shadcn compatibility.\n *\n * Translates shadcn API to HeroUI:\n * - onValueChange -> onSelectionChange\n * - value -> selectedKeys\n */\nexport interface HeroUISelectProps {\n value?: string;\n onValueChange?: (value: string) => void;\n children?: React.ReactNode;\n [key: string]: any;\n}\n\nexport default function HeroUISelect({ value, onValueChange, children, ...props }: HeroUISelectProps) {\n // Translate shadcn API to HeroUI API\n const selectedKeys = value ? [value] : [];\n const handleSelectionChange = (keys: any) => {\n const selected = Array.from(keys)[0] as string;\n onValueChange?.(selected || \"\");\n };\n\n const HeroSelectAny = HeroSelect as any;\n return (\n <HeroSelectAny\n selectedKeys={selectedKeys}\n onSelectionChange={handleSelectionChange}\n {...props}\n >\n {children}\n </HeroSelectAny>\n );\n}\n\n// For direct HeroUI usage\nexport const Select = HeroUISelect;\n\n// Shadcn-compatible subcomponents that just pass through children\nexport interface SelectTriggerProps {\n children?: React.ReactNode;\n size?: string;\n [key: string]: any;\n}\n\nexport const SelectTrigger = ({ children }: SelectTriggerProps) => <>{children}</>;\n\nexport interface SelectValueProps {\n placeholder?: string;\n [key: string]: any;\n}\n\nexport const SelectValue = ({ placeholder }: SelectValueProps) => <span>{placeholder}</span>;\n\nexport interface SelectContentProps {\n children?: React.ReactNode;\n [key: string]: any;\n}\n\nexport const SelectContent = ({ children }: SelectContentProps) => <>{children}</>;\n\nexport interface SelectItemProps {\n value: string;\n children?: React.ReactNode;\n [key: string]: any;\n}\n\nexport const SelectItem = ({ value, children, ...props }: SelectItemProps) => {\n const HeroSelectAny = HeroSelect as any;\n return <HeroSelectAny.Item key={value} {...props}>{children}</HeroSelectAny.Item>;\n};\n"],"names":["HeroUISelect","value","onValueChange","children","props","jsx","HeroSelect","keys","selected"],"mappings":";;AAiBA,SAAwBA,EAAa,EAAE,OAAAC,GAAO,eAAAC,GAAe,UAAAC,GAAU,GAAGC,KAA4B;AASpG,SACE,gBAAAC;AAAA,IAFoBC;AAAAA,IAEnB;AAAA,MACC,cATiBL,IAAQ,CAACA,CAAK,IAAI,CAAA;AAAA,MAUnC,mBAT0B,CAACM,MAAc;AAC3C,cAAMC,IAAW,MAAM,KAAKD,CAAI,EAAE,CAAC;AACnC,QAAAL,IAAgBM,KAAY,EAAE;AAAA,MAChC;AAAA,MAOK,GAAGJ;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PageContainerProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export default function PageContainer({ className, children }: PageContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return /* @__PURE__ */ t("div", { className: ["mx-auto w-full max-w-6xl px-4 sm:px-6", o].filter(Boolean).join(" "), children: a });
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function l({ className: a = "", children: o }) {
|
|
3
|
+
return /* @__PURE__ */ e("div", { className: ["mx-auto w-full max-w-6xl px-4 sm:px-6", a].filter(Boolean).join(" "), children: o });
|
|
5
4
|
}
|
|
6
5
|
export {
|
|
7
|
-
|
|
6
|
+
l as default
|
|
8
7
|
};
|
|
9
8
|
//# sourceMappingURL=PageContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageContainer.js","sources":["../../../../src/components/library/layout/PageContainer.
|
|
1
|
+
{"version":3,"file":"PageContainer.js","sources":["../../../../src/components/library/layout/PageContainer.tsx"],"sourcesContent":["import React from \"react\";\n\nexport interface PageContainerProps {\n className?: string;\n children: React.ReactNode;\n}\n\nexport default function PageContainer({ className = \"\", children }: PageContainerProps) {\n return (\n <div className={[\"mx-auto w-full max-w-6xl px-4 sm:px-6\", className].filter(Boolean).join(\" \")}>\n {children}\n </div>\n );\n}\n"],"names":["PageContainer","className","children","jsx"],"mappings":";AAOA,SAAwBA,EAAc,EAAE,WAAAC,IAAY,IAAI,UAAAC,KAAgC;AACtF,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAW,CAAC,yCAAyCF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAC1F,UAAAC,EAAA,CACH;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schandlergarcia/sf-web-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Reusable Salesforce web components library with Tailwind CSS v4 and shadcn/ui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -75,8 +75,11 @@
|
|
|
75
75
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
76
76
|
"@radix-ui/react-popover": "^1.1.15",
|
|
77
77
|
"@radix-ui/react-select": "^2.2.6",
|
|
78
|
+
"@types/d3": "^7.4.3",
|
|
78
79
|
"@types/react": "^19.2.5",
|
|
79
80
|
"@types/react-dom": "^19.2.3",
|
|
81
|
+
"@types/topojson-client": "^3.1.5",
|
|
82
|
+
"@types/topojson-specification": "^1.0.5",
|
|
80
83
|
"@vitejs/plugin-react": "^5.1.1",
|
|
81
84
|
"date-fns": "^4.0.0",
|
|
82
85
|
"react-day-picker": "^9.14.0",
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import UIButton from "../ui/UIButton";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export interface Action {
|
|
4
|
+
label: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ActionListProps {
|
|
9
|
+
actions?: (Action | string)[];
|
|
10
|
+
title?: string;
|
|
11
|
+
onAction?: (action: Action | string) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
export default function ActionList({
|
|
12
16
|
actions = [],
|
|
13
17
|
title,
|
|
14
18
|
onAction,
|
|
15
19
|
className = "",
|
|
16
|
-
}) {
|
|
20
|
+
}: ActionListProps) {
|
|
17
21
|
return (
|
|
18
22
|
<div className={`rounded-2xl border border-slate-200 bg-white p-4 dark:border-slate-800 dark:bg-slate-900 ${className}`}>
|
|
19
23
|
{title && (
|
|
@@ -3,14 +3,37 @@ import { motion, AnimatePresence } from "framer-motion";
|
|
|
3
3
|
import { ArrowPathIcon, CheckCircleIcon, ExclamationCircleIcon, ClockIcon } from "@heroicons/react/24/outline";
|
|
4
4
|
import UIText from "../ui/Text";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type ActionStatus = "working" | "pending" | "complete" | "error";
|
|
7
|
+
|
|
8
|
+
interface StatusIconConfig {
|
|
9
|
+
Icon: React.ComponentType<{ className?: string }>;
|
|
10
|
+
color: string;
|
|
11
|
+
spin: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const STATUS_ICON: Record<ActionStatus, StatusIconConfig> = {
|
|
7
15
|
working: { Icon: ArrowPathIcon, color: "text-indigo-500", spin: true },
|
|
8
16
|
pending: { Icon: ClockIcon, color: "text-slate-400", spin: false },
|
|
9
17
|
complete: { Icon: CheckCircleIcon, color: "text-emerald-500", spin: false },
|
|
10
18
|
error: { Icon: ExclamationCircleIcon, color: "text-red-500", spin: false },
|
|
11
19
|
};
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
export interface ActivityAction {
|
|
22
|
+
id: string;
|
|
23
|
+
status: ActionStatus;
|
|
24
|
+
title?: string;
|
|
25
|
+
action?: string;
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
traveler?: string;
|
|
28
|
+
timestamp?: string;
|
|
29
|
+
startedAt?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface ActionItemProps {
|
|
33
|
+
action: ActivityAction;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function ActionItem({ action }: ActionItemProps) {
|
|
14
37
|
const s = STATUS_ICON[action.status] ?? STATUS_ICON.pending;
|
|
15
38
|
return (
|
|
16
39
|
<motion.div
|
|
@@ -34,13 +57,19 @@ function ActionItem({ action }) {
|
|
|
34
57
|
);
|
|
35
58
|
}
|
|
36
59
|
|
|
37
|
-
export
|
|
60
|
+
export interface ActivityCardProps {
|
|
61
|
+
title?: string;
|
|
62
|
+
actions?: ActivityAction[];
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default function ActivityCard({ title = "Activity", actions = [], className = "" }: ActivityCardProps) {
|
|
38
67
|
if (actions.length === 0) return null;
|
|
39
68
|
|
|
40
69
|
return (
|
|
41
70
|
<div className={className}>
|
|
42
71
|
{title && (
|
|
43
|
-
<UIText as="div" size="xs" weight="
|
|
72
|
+
<UIText as="div" size="xs" weight="medium" muted className="mb-2 uppercase tracking-wider">
|
|
44
73
|
{title}
|
|
45
74
|
</UIText>
|
|
46
75
|
)}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Variant = "default" | "metric" | "chart" | "table" | "widget" | "status";
|
|
4
|
+
type Size = "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
5
|
+
type Padding = "none" | "xs" | "sm" | "default" | "lg" | "xl";
|
|
6
|
+
type Radius = "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
7
|
+
|
|
8
|
+
const VARIANT_CLASSES: Record<Variant, string> = {
|
|
4
9
|
default: "",
|
|
5
10
|
metric: "",
|
|
6
11
|
chart: "",
|
|
@@ -9,7 +14,7 @@ const VARIANT_CLASSES = {
|
|
|
9
14
|
status: ""
|
|
10
15
|
};
|
|
11
16
|
|
|
12
|
-
const SIZE_CLASSES = {
|
|
17
|
+
const SIZE_CLASSES: Record<Size, string> = {
|
|
13
18
|
xs: "",
|
|
14
19
|
sm: "min-h-[80px]",
|
|
15
20
|
md: "min-h-[120px]",
|
|
@@ -18,7 +23,7 @@ const SIZE_CLASSES = {
|
|
|
18
23
|
full: ""
|
|
19
24
|
};
|
|
20
25
|
|
|
21
|
-
const PADDING_CLASSES = {
|
|
26
|
+
const PADDING_CLASSES: Record<Padding, string> = {
|
|
22
27
|
none: "p-0",
|
|
23
28
|
xs: "p-2",
|
|
24
29
|
sm: "p-3",
|
|
@@ -27,6 +32,30 @@ const PADDING_CLASSES = {
|
|
|
27
32
|
xl: "p-8"
|
|
28
33
|
};
|
|
29
34
|
|
|
35
|
+
export interface BaseCardProps extends Omit<React.HTMLAttributes<HTMLDivElement | HTMLButtonElement>, "onPress"> {
|
|
36
|
+
header?: React.ReactNode;
|
|
37
|
+
body?: React.ReactNode;
|
|
38
|
+
footer?: React.ReactNode;
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
variant?: Variant;
|
|
41
|
+
size?: Size;
|
|
42
|
+
padding?: Padding;
|
|
43
|
+
shadow?: boolean;
|
|
44
|
+
radius?: Radius;
|
|
45
|
+
border?: boolean;
|
|
46
|
+
isHoverable?: boolean;
|
|
47
|
+
isPressable?: boolean;
|
|
48
|
+
isLoading?: boolean;
|
|
49
|
+
isDisabled?: boolean;
|
|
50
|
+
isSelected?: boolean;
|
|
51
|
+
className?: string;
|
|
52
|
+
headerClassName?: string;
|
|
53
|
+
bodyClassName?: string;
|
|
54
|
+
footerClassName?: string;
|
|
55
|
+
onPress?: () => void;
|
|
56
|
+
onHover?: () => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
30
59
|
export default function BaseCard({
|
|
31
60
|
header,
|
|
32
61
|
body,
|
|
@@ -50,7 +79,7 @@ export default function BaseCard({
|
|
|
50
79
|
onPress,
|
|
51
80
|
onHover,
|
|
52
81
|
...rest
|
|
53
|
-
}) {
|
|
82
|
+
}: BaseCardProps) {
|
|
54
83
|
const Comp = isPressable ? "button" : "div";
|
|
55
84
|
|
|
56
85
|
const radiusClass = radius ? `rounded-${radius}` : "rounded-2xl";
|
|
@@ -105,5 +134,3 @@ export default function BaseCard({
|
|
|
105
134
|
</Comp>
|
|
106
135
|
);
|
|
107
136
|
}
|
|
108
|
-
|
|
109
|
-
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Tone = "neutral" | "success" | "warning" | "danger" | "info";
|
|
4
|
+
|
|
5
|
+
const TONE_CLASSES: Record<Tone, string> = {
|
|
4
6
|
neutral: "border-slate-200 bg-slate-50 text-slate-700 dark:border-slate-800 dark:bg-slate-950/30 dark:text-slate-200",
|
|
5
7
|
success: "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/20 dark:text-emerald-200",
|
|
6
8
|
warning: "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900/40 dark:bg-amber-950/20 dark:text-amber-200",
|
|
@@ -8,21 +10,21 @@ const TONE_CLASSES = {
|
|
|
8
10
|
info: "border-blue-200 bg-blue-50 text-blue-800 dark:border-blue-900/40 dark:bg-blue-950/20 dark:text-blue-200",
|
|
9
11
|
};
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
export interface CalloutCardProps {
|
|
14
|
+
title?: string;
|
|
15
|
+
message: string | React.ReactNode;
|
|
16
|
+
tone?: Tone;
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
19
21
|
export default function CalloutCard({
|
|
20
22
|
title,
|
|
21
23
|
message,
|
|
22
24
|
tone = "neutral",
|
|
23
25
|
icon,
|
|
24
26
|
className = "",
|
|
25
|
-
}) {
|
|
27
|
+
}: CalloutCardProps) {
|
|
26
28
|
return (
|
|
27
29
|
<div className={`rounded-xl border p-4 ${TONE_CLASSES[tone] ?? TONE_CLASSES.neutral} ${className}`}>
|
|
28
30
|
<div className="flex gap-3">
|
|
@@ -1,8 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import BaseCard from "./BaseCard";
|
|
2
|
+
import BaseCard, { BaseCardProps } from "./BaseCard";
|
|
3
3
|
import UIText from "../ui/Text";
|
|
4
4
|
import UIChip from "../ui/Chip";
|
|
5
5
|
|
|
6
|
+
interface TimeRangeOption {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface TimeRange {
|
|
12
|
+
current: string;
|
|
13
|
+
options?: (TimeRangeOption | string)[];
|
|
14
|
+
onChange?: (value: string) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ChartCardProps extends Omit<BaseCardProps, "variant" | "header" | "body"> {
|
|
18
|
+
chart: React.ReactNode;
|
|
19
|
+
chartType?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
subtitle?: string;
|
|
22
|
+
filters?: React.ReactNode;
|
|
23
|
+
timeRange?: TimeRange;
|
|
24
|
+
actions?: React.ReactNode;
|
|
25
|
+
legend?: React.ReactNode;
|
|
26
|
+
height?: number;
|
|
27
|
+
showGrid?: boolean;
|
|
28
|
+
showAxes?: boolean;
|
|
29
|
+
data?: unknown[];
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
error?: string | Error;
|
|
32
|
+
}
|
|
33
|
+
|
|
6
34
|
export default function ChartCard({
|
|
7
35
|
chart,
|
|
8
36
|
chartType,
|
|
@@ -19,7 +47,7 @@ export default function ChartCard({
|
|
|
19
47
|
loading = false,
|
|
20
48
|
error,
|
|
21
49
|
...cardProps
|
|
22
|
-
}) {
|
|
50
|
+
}: ChartCardProps) {
|
|
23
51
|
const header = (
|
|
24
52
|
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
|
25
53
|
<div className="min-w-0">
|
|
@@ -44,8 +72,8 @@ export default function ChartCard({
|
|
|
44
72
|
aria-label="Time range"
|
|
45
73
|
>
|
|
46
74
|
{timeRange.options?.map((opt) => (
|
|
47
|
-
<option key={opt
|
|
48
|
-
{opt
|
|
75
|
+
<option key={typeof opt === "string" ? opt : opt.value} value={typeof opt === "string" ? opt : opt.value}>
|
|
76
|
+
{typeof opt === "string" ? opt : opt.label}
|
|
49
77
|
</option>
|
|
50
78
|
))}
|
|
51
79
|
</select>
|
|
@@ -101,5 +129,3 @@ export default function ChartCard({
|
|
|
101
129
|
/>
|
|
102
130
|
);
|
|
103
131
|
}
|
|
104
|
-
|
|
105
|
-
|