@getgreenline/blaze-ui 1.0.3-3.0-beta → 1.0.4-5.01-beta
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/breadcrumb.js +1 -1
- package/dist/components/carousel.js +1 -1
- package/dist/components/chart.d.ts +34 -12
- package/dist/components/chart.d.ts.map +1 -1
- package/dist/components/chart.js +3 -3
- package/dist/components/checkbox.js +1 -1
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.d.ts.map +1 -1
- package/dist/components/collapsible.js +3 -2
- package/dist/components/data-table.d.ts +6 -4
- package/dist/components/data-table.d.ts.map +1 -1
- package/dist/components/data-table.js +43 -10
- package/dist/components/field.js +2 -2
- package/dist/components/form.js +1 -1
- package/dist/components/header-app-switcher.d.ts +19 -16
- package/dist/components/header-app-switcher.d.ts.map +1 -1
- package/dist/components/header-app-switcher.js +44 -44
- package/dist/components/hierarchical-select.d.ts +14 -4
- package/dist/components/hierarchical-select.d.ts.map +1 -1
- package/dist/components/hierarchical-select.js +57 -10
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/input-group.d.ts.map +1 -1
- package/dist/components/input-group.js +18 -16
- package/dist/components/input-otp.d.ts.map +1 -1
- package/dist/components/input.d.ts +5 -1
- package/dist/components/input.d.ts.map +1 -1
- package/dist/components/input.js +9 -2
- package/dist/components/label.js +1 -1
- package/dist/components/login-screen.js +1 -1
- package/dist/components/multi-search-select.d.ts +17 -0
- package/dist/components/multi-search-select.d.ts.map +1 -0
- package/dist/components/multi-search-select.js +40 -0
- package/dist/components/multi-select.d.ts +19 -0
- package/dist/components/multi-select.d.ts.map +1 -0
- package/dist/components/multi-select.js +87 -0
- package/dist/components/page-header/actions.d.ts +9 -0
- package/dist/components/page-header/actions.d.ts.map +1 -0
- package/dist/components/page-header/actions.js +21 -0
- package/dist/components/page-header/types.d.ts +33 -0
- package/dist/components/page-header/types.d.ts.map +1 -0
- package/dist/components/page-header/utils.d.ts +4 -0
- package/dist/components/page-header/utils.d.ts.map +1 -0
- package/dist/components/page-header/utils.js +17 -0
- package/dist/components/page-header.d.ts +4 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/page-header.js +12 -0
- package/dist/components/pagination.js +1 -1
- package/dist/components/resizable.d.ts +4 -4
- package/dist/components/resizable.d.ts.map +1 -1
- package/dist/components/resizable.js +4 -4
- package/dist/components/segmented-control.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/selection-panel.d.ts.map +1 -1
- package/dist/components/selection-panel.js +3 -3
- package/dist/components/separator.d.ts.map +1 -1
- package/dist/components/separator.js +3 -1
- package/dist/components/slider.d.ts +1 -1
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +6 -2
- package/dist/components/spinner.d.ts +2 -1
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/textarea.d.ts +5 -1
- package/dist/components/textarea.d.ts.map +1 -1
- package/dist/components/textarea.js +9 -2
- package/dist/components/toggle.js +3 -3
- package/dist/globals.css +88 -15
- package/dist/hooks/use-invalid-attention.d.ts +20 -0
- package/dist/hooks/use-invalid-attention.d.ts.map +1 -0
- package/dist/hooks/use-invalid-attention.js +65 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/svgs/header-app-switcher-logos.d.ts +15 -0
- package/dist/svgs/header-app-switcher-logos.d.ts.map +1 -0
- package/dist/svgs/header-app-switcher-logos.js +22 -0
- package/package.json +28 -27
- package/dist/svgs/blaze-dispatch-logo.js +0 -7
- package/dist/svgs/blaze-ecom-logo.js +0 -7
- package/dist/svgs/blaze-insights-logo.js +0 -7
- package/dist/svgs/blaze-lighthouse-logo.js +0 -7
- package/dist/svgs/blaze-pay-logo.js +0 -7
- package/dist/svgs/blaze-pos-logo.js +0 -7
- package/dist/svgs/blaze-retail-logo.js +0 -7
- package/dist/svgs/blaze-sites-logo.js +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import {
|
|
3
|
+
import { MoreHorizontal, ChevronRight } from 'lucide-react';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
|
|
6
6
|
function Breadcrumb({ ...props }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
-
import {
|
|
4
|
+
import { ArrowRight, ArrowLeft } from 'lucide-react';
|
|
5
5
|
import { cn } from '../lib/utils.js';
|
|
6
6
|
import { Button } from './button.js';
|
|
7
7
|
|
|
@@ -16,6 +16,37 @@ export type ChartConfig = {
|
|
|
16
16
|
theme: Record<keyof typeof THEMES, string>;
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
+
type ChartPayloadItem = {
|
|
20
|
+
color?: string;
|
|
21
|
+
dataKey?: string | number;
|
|
22
|
+
name?: string | number;
|
|
23
|
+
payload?: (Record<string, unknown> & {
|
|
24
|
+
fill?: string;
|
|
25
|
+
}) | null;
|
|
26
|
+
type?: string;
|
|
27
|
+
value?: string | number;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
};
|
|
30
|
+
type ChartTooltipContentProps = React.ComponentProps<"div"> & {
|
|
31
|
+
active?: boolean;
|
|
32
|
+
color?: string;
|
|
33
|
+
formatter?: (value: NonNullable<ChartPayloadItem["value"]>, name: NonNullable<ChartPayloadItem["name"]>, item: ChartPayloadItem, index: number, payload: ChartPayloadItem["payload"]) => React.ReactNode;
|
|
34
|
+
hideIndicator?: boolean;
|
|
35
|
+
hideLabel?: boolean;
|
|
36
|
+
indicator?: "line" | "dot" | "dashed";
|
|
37
|
+
label?: React.ReactNode;
|
|
38
|
+
labelClassName?: string;
|
|
39
|
+
labelFormatter?: (value: React.ReactNode, payload: ChartPayloadItem[]) => React.ReactNode;
|
|
40
|
+
labelKey?: string;
|
|
41
|
+
nameKey?: string;
|
|
42
|
+
payload?: ChartPayloadItem[];
|
|
43
|
+
};
|
|
44
|
+
type ChartLegendContentProps = React.ComponentProps<"div"> & {
|
|
45
|
+
hideIcon?: boolean;
|
|
46
|
+
nameKey?: string;
|
|
47
|
+
payload?: ChartPayloadItem[];
|
|
48
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
49
|
+
};
|
|
19
50
|
declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<"div"> & {
|
|
20
51
|
config: ChartConfig;
|
|
21
52
|
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
@@ -25,17 +56,8 @@ declare const ChartStyle: ({ id, config }: {
|
|
|
25
56
|
config: ChartConfig;
|
|
26
57
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
27
58
|
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
28
|
-
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
indicator?: "line" | "dot" | "dashed";
|
|
32
|
-
nameKey?: string;
|
|
33
|
-
labelKey?: string;
|
|
34
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
35
|
-
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
36
|
-
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<"div"> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
37
|
-
hideIcon?: boolean;
|
|
38
|
-
nameKey?: string;
|
|
39
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
59
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: ChartTooltipContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
60
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
61
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: ChartLegendContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
40
62
|
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
41
63
|
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/components/chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAA;AAK7C,QAAA,MAAM,MAAM;;;CAAwC,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG;KACvB,CAAC,IAAI,MAAM,GAAG;QACb,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;QACvB,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;KAC3B,GAAG,CACA;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,GACjC;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAChE;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/components/chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAA;AAK7C,QAAA,MAAM,MAAM;;;CAAwC,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG;KACvB,CAAC,IAAI,MAAM,GAAG;QACb,KAAK,CAAC,EAAE,KAAK,CAAC,SAA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,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,GACT,EAAE,wBAAwB,kDA2H1B;AAED,QAAA,MAAM,WAAW,sGAA2B,CAAA;AAE5C,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,QAAgB,EAChB,OAAO,EACP,aAAwB,EACxB,OAAO,GACR,EAAE,uBAAuB,kDA4CzB;AAyCD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,UAAU,GACX,CAAA"}
|
package/dist/components/chart.js
CHANGED
|
@@ -77,7 +77,7 @@ function ChartTooltipContent({ active, payload, className, indicator = "dot", hi
|
|
|
77
77
|
.map((item, index) => {
|
|
78
78
|
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
79
79
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
80
|
-
const indicatorColor = color || item.payload
|
|
80
|
+
const indicatorColor = color || item.payload?.fill || item.color;
|
|
81
81
|
return (jsx("div", { className: cn("[&>svg]:tw:text-muted-foreground tw:flex tw:w-full tw:flex-wrap tw:items-stretch tw:gap-2 [&>svg]:tw:h-2.5 [&>svg]:tw:w-2.5", indicator === "dot" && "tw:items-center"), children: formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (jsxs(Fragment, { children: [itemConfig?.icon ? (jsx(itemConfig.icon, {})) : (!hideIndicator && (jsx("div", { className: cn("tw:shrink-0 tw:rounded-[2px] tw:border-(--color-border) tw:bg-(--color-bg)", {
|
|
82
82
|
"tw:h-2.5 tw:w-2.5": indicator === "dot",
|
|
83
83
|
"tw:w-1": indicator === "line",
|
|
@@ -86,7 +86,7 @@ function ChartTooltipContent({ active, payload, className, indicator = "dot", hi
|
|
|
86
86
|
}), style: {
|
|
87
87
|
"--color-bg": indicatorColor,
|
|
88
88
|
"--color-border": indicatorColor,
|
|
89
|
-
} }))), jsxs("div", { className: cn("tw:flex tw:flex-1 tw:justify-between tw:leading-none", nestLabel ? "tw:items-end" : "tw:items-center"), children: [jsxs("div", { className: "tw:grid tw:gap-1.5", children: [nestLabel ? tooltipLabel : null, jsx("span", { className: "tw:text-muted-foreground", children: itemConfig?.label || item.name })] }), item.value && (jsx("span", { className: "tw:text-foreground tw:font-mono tw:font-medium tw:tabular-nums", children: item.value.toLocaleString() }))] })] })) }, item.dataKey));
|
|
89
|
+
} }))), jsxs("div", { className: cn("tw:flex tw:flex-1 tw:justify-between tw:leading-none", nestLabel ? "tw:items-end" : "tw:items-center"), children: [jsxs("div", { className: "tw:grid tw:gap-1.5", children: [nestLabel ? tooltipLabel : null, jsx("span", { className: "tw:text-muted-foreground", children: itemConfig?.label || item.name })] }), item.value && (jsx("span", { className: "tw:text-foreground tw:font-mono tw:font-medium tw:tabular-nums", children: item.value.toLocaleString() }))] })] })) }, String(item.dataKey ?? item.name ?? index)));
|
|
90
90
|
}) })] }));
|
|
91
91
|
}
|
|
92
92
|
const ChartLegend = RechartsPrimitive.Legend;
|
|
@@ -102,7 +102,7 @@ function ChartLegendContent({ className, hideIcon = false, payload, verticalAlig
|
|
|
102
102
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
103
103
|
return (jsxs("div", { className: cn("[&>svg]:tw:text-muted-foreground tw:flex tw:items-center tw:gap-1.5 [&>svg]:tw:h-3 [&>svg]:tw:w-3"), children: [itemConfig?.icon && !hideIcon ? (jsx(itemConfig.icon, {})) : (jsx("div", { className: "tw:h-2 tw:w-2 tw:shrink-0 tw:rounded-[2px]", style: {
|
|
104
104
|
backgroundColor: item.color,
|
|
105
|
-
} })), itemConfig?.label] }, item.value));
|
|
105
|
+
} })), itemConfig?.label] }, String(item.value ?? item.dataKey ?? item.name)));
|
|
106
106
|
}) }));
|
|
107
107
|
}
|
|
108
108
|
// Helper to extract item config from a payload.
|
|
@@ -4,7 +4,7 @@ import { CheckIcon } from 'lucide-react';
|
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
|
|
6
6
|
function Checkbox({ className, ...props }) {
|
|
7
|
-
return (jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn("tw
|
|
7
|
+
return (jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn("tw:peer tw:!border-border tw:dark:!bg-input/30 tw:data-[state=checked]:!bg-primary tw:data-[state=checked]:!text-primary-foreground tw:dark:data-[state=checked]:!bg-primary tw:data-[state=checked]:!border-primary tw:focus-visible:!border-ring tw:focus-visible:!ring-ring/50 tw:aria-invalid:!ring-destructive/20 tw:dark:aria-invalid:!ring-destructive/40 tw:aria-invalid:!border-destructive tw:!size-4 tw:!shrink-0 tw:!rounded-[4px] tw:!border tw:!shadow-xs tw:!transition-shadow tw:!outline-none tw:focus-visible:!ring-[3px] tw:disabled:!cursor-not-allowed tw:disabled:!opacity-50 tw:data-[disabled]:!cursor-not-allowed tw:data-[disabled]:!opacity-50 tw:aria-disabled:!cursor-not-allowed tw:aria-disabled:!opacity-50 tw:!align-middle", className), ...props, children: jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "tw:flex tw:items-center tw:justify-center tw:text-current tw:transition-none", children: jsx(CheckIcon, { className: "tw:size-[80%]" }) }) }));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export { Checkbox };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
2
2
|
declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function CollapsibleTrigger({ className, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
6
6
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../src/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../src/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAA;AAInE,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,2CAExD;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAWtE;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAOtE;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
3
4
|
|
|
4
5
|
function Collapsible({ ...props }) {
|
|
5
6
|
return jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
6
7
|
}
|
|
7
|
-
function CollapsibleTrigger({ ...props }) {
|
|
8
|
-
return (jsx(CollapsiblePrimitive.CollapsibleTrigger, { "data-slot": "collapsible-trigger", ...props }));
|
|
8
|
+
function CollapsibleTrigger({ className, ...props }) {
|
|
9
|
+
return (jsx(CollapsiblePrimitive.CollapsibleTrigger, { "data-slot": "collapsible-trigger", className: cn("tw:cursor-pointer tw:transition-colors tw:hover:bg-accent/60", className), ...props }));
|
|
9
10
|
}
|
|
10
11
|
function CollapsibleContent({ ...props }) {
|
|
11
12
|
return (jsx(CollapsiblePrimitive.CollapsibleContent, { "data-slot": "collapsible-content", ...props }));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CheckIcon, XIcon } from "lucide-react";
|
|
3
3
|
export type SortDirection = "asc" | "desc" | null;
|
|
4
|
+
export type DataTableCellValue = React.ReactNode | Record<string, unknown> | DataTableRow[];
|
|
4
5
|
export interface DataTableColumn<T> {
|
|
5
6
|
key: string;
|
|
6
7
|
label: string;
|
|
@@ -8,14 +9,14 @@ export interface DataTableColumn<T> {
|
|
|
8
9
|
align?: "left" | "center" | "right";
|
|
9
10
|
width?: string;
|
|
10
11
|
className?: string;
|
|
11
|
-
render?: (value:
|
|
12
|
+
render?: (value: DataTableCellValue, row: T, index: number, depth: number) => React.ReactNode;
|
|
12
13
|
}
|
|
13
14
|
export interface DataTableRow {
|
|
14
15
|
id: string;
|
|
15
16
|
children?: DataTableRow[];
|
|
16
|
-
[key: string]:
|
|
17
|
+
[key: string]: DataTableCellValue;
|
|
17
18
|
}
|
|
18
|
-
export interface IClickableField<T =
|
|
19
|
+
export interface IClickableField<T = DataTableRow> {
|
|
19
20
|
field: string;
|
|
20
21
|
onClick: (row: T) => void;
|
|
21
22
|
}
|
|
@@ -44,6 +45,7 @@ export interface DataTablePaginationProps {
|
|
|
44
45
|
export interface DataTableProps<T extends DataTableRow> {
|
|
45
46
|
columns: DataTableColumn<T>[];
|
|
46
47
|
data: T[];
|
|
48
|
+
onRowClick?: (row: T) => void;
|
|
47
49
|
onSelectionChange?: (selectedIds: string[]) => void;
|
|
48
50
|
selectedRowIds?: string[];
|
|
49
51
|
onSort?: (key: string, direction: SortDirection) => void;
|
|
@@ -78,6 +80,6 @@ export interface DataTableProps<T extends DataTableRow> {
|
|
|
78
80
|
selectContentClassName?: string;
|
|
79
81
|
menuPopupClassName?: string;
|
|
80
82
|
}
|
|
81
|
-
export declare function DataTable<T extends DataTableRow>({ columns, data, onSelectionChange, selectedRowIds, onSort, sortState, expandable, renderExpandedRow, actions, className, pagination, treeData, reorderable, onReorder, onDragReorder, customFilterColumnsWhiteList, loading, loadingRows, emptyState, clickableFields, showColumnVisibility, footerContent, expandedRowIds, onExpandedChange, reservePaginationSpace, striped, selectContentClassName, menuPopupClassName, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
export declare function DataTable<T extends DataTableRow>({ columns, data, onRowClick, onSelectionChange, selectedRowIds, onSort, sortState, expandable, renderExpandedRow, actions, className, pagination, treeData, reorderable, onReorder, onDragReorder, customFilterColumnsWhiteList, loading, loadingRows, emptyState, clickableFields, showColumnVisibility, footerContent, expandedRowIds, onExpandedChange, reservePaginationSpace, striped, selectContentClassName, menuPopupClassName, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
82
84
|
export { CheckIcon, XIcon };
|
|
83
85
|
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/components/data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAOL,SAAS,EAKT,KAAK,EACN,MAAM,cAAc,CAAA;AAuBrB,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/components/data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAOL,SAAS,EAKT,KAAK,EACN,MAAM,cAAc,CAAA;AAuBrB,MAA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ACjB,OAAO,EACP,SAAS,EACT,UAAU,EACV,QAAgB,EAChB,WAAmB,EACnB,SAAS,EACT,aAAa,EACb,4BAA4B,EAC5B,OAAe,EACf,WAAe,EACf,UAAU,EACV,eAAe,EACf,oBAA2B,EAC3B,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,sBAA8B,EAC9B,OAAc,EACd,sBAAsB,EACtB,kBAAkB,GACnB,EAAE,cAAc,CAAC,CAAC,CAAC,2CAi9BnB;AAED,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -10,7 +10,16 @@ import { Button } from './button.js';
|
|
|
10
10
|
import { Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationNext, PaginationLink, PaginationEllipsis } from './pagination.js';
|
|
11
11
|
|
|
12
12
|
const DEFAULT_PAGE_SIZE_OPTIONS = [5, 10, 25, 50];
|
|
13
|
-
function
|
|
13
|
+
function renderCellValue(value) {
|
|
14
|
+
if (value == null || React.isValidElement(value))
|
|
15
|
+
return value;
|
|
16
|
+
if (typeof value !== "object")
|
|
17
|
+
return value;
|
|
18
|
+
if (Array.isArray(value))
|
|
19
|
+
return value.length;
|
|
20
|
+
return String(value);
|
|
21
|
+
}
|
|
22
|
+
function DataTable({ columns, data, onRowClick, onSelectionChange, selectedRowIds, onSort, sortState, expandable = false, renderExpandedRow, actions, className, pagination, treeData = false, reorderable = false, onReorder, onDragReorder, customFilterColumnsWhiteList, loading = false, loadingRows = 5, emptyState, clickableFields, showColumnVisibility = true, footerContent, expandedRowIds, onExpandedChange, reservePaginationSpace = false, striped = true, selectContentClassName, menuPopupClassName, }) {
|
|
14
23
|
const [internalSelectedRows, setInternalSelectedRows] = React.useState(new Set());
|
|
15
24
|
const [internalExpandedRows, setInternalExpandedRows] = React.useState(new Set());
|
|
16
25
|
const [internalSortConfig, setInternalSortConfig] = React.useState({ key: "", direction: null });
|
|
@@ -108,15 +117,19 @@ function DataTable({ columns, data, onSelectionChange, selectedRowIds, onSort, s
|
|
|
108
117
|
}
|
|
109
118
|
onSort?.(key, direction);
|
|
110
119
|
};
|
|
111
|
-
React.useMemo(() => {
|
|
112
|
-
|
|
120
|
+
const processedData = React.useMemo(() => {
|
|
121
|
+
const result = [...data];
|
|
113
122
|
if (!onSort && sortConfig.key && sortConfig.direction) {
|
|
114
123
|
result.sort((a, b) => {
|
|
115
124
|
const aValue = a[sortConfig.key];
|
|
116
125
|
const bValue = b[sortConfig.key];
|
|
117
126
|
if (aValue === bValue)
|
|
118
127
|
return 0;
|
|
119
|
-
const comparison = aValue
|
|
128
|
+
const comparison = typeof aValue === "number" && typeof bValue === "number"
|
|
129
|
+
? aValue - bValue
|
|
130
|
+
: String(aValue ?? "").localeCompare(String(bValue ?? ""), undefined, {
|
|
131
|
+
numeric: true,
|
|
132
|
+
});
|
|
120
133
|
return sortConfig.direction === "asc" ? comparison : -comparison;
|
|
121
134
|
});
|
|
122
135
|
}
|
|
@@ -172,6 +185,22 @@ function DataTable({ columns, data, onSelectionChange, selectedRowIds, onSort, s
|
|
|
172
185
|
const isDragging = draggedRowId === row.id;
|
|
173
186
|
const isDragOver = dragOverRowId === row.id;
|
|
174
187
|
const totalSiblings = siblingCount ?? data.length;
|
|
188
|
+
const isRowClickable = !!onRowClick;
|
|
189
|
+
const handleRowClick = (event) => {
|
|
190
|
+
const target = event.target;
|
|
191
|
+
if (target?.closest('button, a, input, select, textarea, [role="button"], [role="checkbox"], [role="menuitem"]')) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
onRowClick?.(row);
|
|
195
|
+
};
|
|
196
|
+
const handleRowKeyDown = (event) => {
|
|
197
|
+
if (event.target !== event.currentTarget)
|
|
198
|
+
return;
|
|
199
|
+
if (event.key !== "Enter" && event.key !== " ")
|
|
200
|
+
return;
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
onRowClick?.(row);
|
|
203
|
+
};
|
|
175
204
|
const handleDragStart = (e) => {
|
|
176
205
|
setDraggedRowId(row.id);
|
|
177
206
|
e.dataTransfer.effectAllowed = "move";
|
|
@@ -200,11 +229,12 @@ function DataTable({ columns, data, onSelectionChange, selectedRowIds, onSort, s
|
|
|
200
229
|
setDraggedRowId(null);
|
|
201
230
|
setDragOverRowId(null);
|
|
202
231
|
};
|
|
203
|
-
return (jsxs(React.Fragment, { children: [jsxs("tr", { className: cn("tw:border-b tw:transition-colors hover:tw:bg-accent/50",
|
|
232
|
+
return (jsxs(React.Fragment, { children: [jsxs("tr", { className: cn("tw:border-b tw:transition-colors hover:tw:bg-accent/50", isRowClickable &&
|
|
233
|
+
"tw:cursor-pointer tw:focus-visible:outline-none tw:focus-visible:ring-2 tw:focus-visible:ring-ring tw:focus-visible:ring-inset", rowBgClass, isDragging && "tw:opacity-50", isDragOver && "tw:ring-2 tw:ring-primary tw:ring-inset"), tabIndex: isRowClickable ? 0 : undefined, onClick: isRowClickable ? handleRowClick : undefined, onKeyDown: isRowClickable ? handleRowKeyDown : undefined, draggable: reorderable, onDragStart: reorderable ? handleDragStart : undefined, onDragEnd: reorderable ? handleDragEnd : undefined, onDragOver: reorderable ? handleDragOver : undefined, onDragLeave: reorderable ? handleDragLeave : undefined, onDrop: reorderable ? handleDrop : undefined, children: [isExpandable && (jsx("td", { className: cn("tw:p-2 tw:w-12", rowBgClass), onClick: (event) => event.stopPropagation(), children: jsx("div", { style: { paddingLeft: indentPadding }, children: canExpand ? (jsx("button", { onClick: () => toggleRowExpansion(row.id), className: "tw:flex tw:items-center tw:justify-center hover:tw:bg-accent tw:rounded tw:p-1", "aria-label": isExpanded ? "Collapse row" : "Expand row", "aria-expanded": isExpanded, children: isExpanded ? (jsx(ChevronDownIcon, { className: "tw:text-muted-foreground tw:size-4 tw:shrink-0 tw:transition-transform tw:duration-200" })) : (jsx(ChevronRightIcon, { className: "tw:text-muted-foreground tw:size-4 tw:shrink-0 tw:transition-transform tw:duration-200" })) })) : (jsx("span", { className: "tw:w-6" })) }) })), hasRowSelection && (jsx("td", { className: cn("tw:p-2 tw:w-12", rowBgClass), onClick: (event) => event.stopPropagation(), children: jsx("div", { className: "tw:flex tw:items-center tw:justify-center", children: jsx(Checkbox, { checked: selectedRows.has(row.id), onCheckedChange: () => toggleRowSelection(row.id), "aria-label": `Select row ${rowIndex + 1}`, className: "tw:h-[22px] tw:w-[22px]" }) }) })), reorderable && (jsx("td", { className: cn("tw:p-2 tw:w-12", rowBgClass), onClick: (event) => event.stopPropagation(), children: jsxs("div", { className: "tw:flex tw:flex-col tw:items-center tw:gap-0.5", children: [jsx("button", { onClick: () => onReorder?.(row.id, "up", parentRow?.id), className: "tw:flex tw:items-center tw:justify-center hover:tw:bg-accent tw:rounded tw:p-0.5 tw:text-muted-foreground hover:tw:text-foreground tw:transition-colors", disabled: rowIndex === 0, "aria-label": "Move row up", children: jsx(ChevronUpIcon, { className: cn("tw:size-4", rowIndex === 0 && "tw:opacity-30") }) }), jsx("button", { onClick: () => onReorder?.(row.id, "down", parentRow?.id), className: "tw:flex tw:items-center tw:justify-center hover:tw:bg-accent tw:rounded tw:p-0.5 tw:text-muted-foreground hover:tw:text-foreground tw:transition-colors", disabled: rowIndex === totalSiblings - 1, "aria-label": "Move row down", children: jsx(ChevronDownIcon, { className: cn("tw:size-4", rowIndex === totalSiblings - 1 && "tw:opacity-30") }) })] }) })), visibleColumns.map((column, colIndex) => {
|
|
204
234
|
const clickableField = getClickableField(column.key);
|
|
205
235
|
const cellContent = column.render
|
|
206
236
|
? column.render(row[column.key], row, rowIndex, depth)
|
|
207
|
-
: row[column.key];
|
|
237
|
+
: renderCellValue(row[column.key]);
|
|
208
238
|
return (jsx("td", { className: cn("tw:p-4 tw:align-middle tw:max-w-0 tw:overflow-hidden", column.align === "center" && "tw:text-center", column.align === "right" && "tw:text-right", column.className, rowBgClass), children: jsx("div", { className: cn("tw:truncate", clickableField && "tw:!text-primary"), style: {
|
|
209
239
|
paddingLeft: colIndex === 0
|
|
210
240
|
? isExpandable
|
|
@@ -213,8 +243,11 @@ function DataTable({ columns, data, onSelectionChange, selectedRowIds, onSort, s
|
|
|
213
243
|
: 0
|
|
214
244
|
: indentPadding
|
|
215
245
|
: 0,
|
|
216
|
-
}, children: clickableField ? (jsx("
|
|
217
|
-
|
|
246
|
+
}, children: clickableField ? (jsx("button", { type: "button", onClick: (event) => {
|
|
247
|
+
event.stopPropagation();
|
|
248
|
+
clickableField.onClick(row);
|
|
249
|
+
}, className: "tw:inline tw:cursor-pointer tw:appearance-none tw:border-0 tw:bg-transparent tw:p-0 tw:text-inherit tw:font-[inherit] tw:transition-colors hover:tw:!text-primary/80 hover:tw:underline", children: cellContent })) : (cellContent) }) }, column.key));
|
|
250
|
+
}), showActionsColumn && (jsx("td", { className: cn("tw:p-2 tw:text-right tw:sticky tw:right-0", rowBgClass), onClick: (event) => event.stopPropagation(), children: visibleActionsForRow.length > 0 && (jsxs(Menu.Root, { modal: false, children: [jsx(Menu.Trigger, { id: `base-ui-row-action-${row.id}`, render: (props) => (jsx(Button, { variant: "ghost", size: "icon", className: "tw:h-8 tw:w-8", "aria-label": "Row actions", ...props, id: `base-ui-row-action-${row.id}`, children: jsx(MoreHorizontalIcon, { className: "tw:size-4" }) })) }), jsx(Menu.Portal, { children: jsx(Menu.Positioner, { side: "bottom", align: "end", sideOffset: 4, collisionPadding: 8, children: jsx(Menu.Popup, { "aria-labelledby": "base-ui-toggle-columns-trigger", className: cn("tw:bg-popover tw:font-sans tw:text-popover-foreground tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out tw:data-[state=closed]:fade-out-0 tw:data-[state=open]:fade-in-0 tw:data-[state=closed]:zoom-out-95 tw:data-[state=open]:zoom-in-95 tw:data-[side=bottom]:slide-in-from-top-2 tw:data-[side=left]:slide-in-from-right-2 tw:data-[side=right]:slide-in-from-left-2 tw:data-[side=top]:slide-in-from-bottom-2 tw:z-50 tw:min-w-[8rem] tw:overflow-x-hidden tw:overflow-y-auto tw:rounded-md tw:border tw:p-1 tw:shadow-md"), children: visibleActionsForRow.map((action, index) => (jsxs(Menu.Item, { onClick: () => action.onClick(row), className: cn("tw:focus:bg-accent tw:focus:text-accent-foreground tw:relative tw:flex tw:cursor-default tw:items-center tw:gap-2 tw:rounded-sm tw:px-2 tw:py-1.5 tw:text-[14px] tw:outline-hidden tw:select-none tw:data-[disabled]:pointer-events-none tw:data-[disabled]:opacity-50", action.variant === "destructive" &&
|
|
218
251
|
"tw:text-destructive focus:tw:text-destructive"), children: [action.icon && (jsx("span", { className: "tw:mr-2", children: action.icon })), action.label] }, index))) }) }) })] })) }))] }), expandable && !treeData && isExpanded && renderExpandedRow && (jsx("tr", { className: "tw:border-b tw:bg-muted/30", children: jsx("td", { colSpan: visibleColumns.length +
|
|
219
252
|
(showActionsColumn ? 1 : 0) +
|
|
220
253
|
(hasRowSelection ? 1 : 0) +
|
|
@@ -302,7 +335,7 @@ function DataTable({ columns, data, onSelectionChange, selectedRowIds, onSort, s
|
|
|
302
335
|
: sortConfig.direction === "desc"
|
|
303
336
|
? "descending"
|
|
304
337
|
: "none"
|
|
305
|
-
: undefined, className: cn("tw:!h-[40px] tw:px-4 tw:text-left tw:align-middle tw:font-medium tw:text-foreground tw:whitespace-nowrap", column.align === "center" && "tw:text-center", column.align === "right" && "tw:text-right"), style: { width: column.width }, children: column.sortable
|
|
338
|
+
: undefined, className: cn("tw:!h-[40px] tw:px-4 tw:text-left tw:align-middle tw:font-medium tw:text-foreground tw:whitespace-nowrap", column.align === "center" && "tw:text-center", column.align === "right" && "tw:text-right"), style: { width: column.width }, children: column.sortable ? (jsxs("button", { onClick: () => !loading && handleSort(column.key), disabled: loading, "aria-label": `Sort by ${column.label}${sortConfig.key === column.key
|
|
306
339
|
? sortConfig.direction === "asc"
|
|
307
340
|
? ", currently sorted ascending"
|
|
308
341
|
: sortConfig.direction === "desc"
|
|
@@ -316,7 +349,7 @@ function DataTable({ columns, data, onSelectionChange, selectedRowIds, onSort, s
|
|
|
316
349
|
(hasRowSelection ? 1 : 0) +
|
|
317
350
|
(isExpandable ? 1 : 0) +
|
|
318
351
|
(reorderable ? 1 : 0), className: "tw:h-48", children: jsxs("div", { className: "tw:flex tw:flex-col tw:items-center tw:justify-center tw:h-full tw:text-center", children: [emptyState?.icon || (jsx("div", { className: "tw:h-12 tw:w-12 tw:rounded-full tw:bg-muted tw:flex tw:items-center tw:justify-center tw:mb-3", children: jsx(InboxIcon, { className: "tw:size-6 tw:text-muted-foreground" }) })), jsx("p", { className: "tw:text-base tw:font-medium tw:text-foreground", children: emptyState?.title || "No results found" }), jsx("p", { className: "tw:text-sm tw:text-muted-foreground tw:mt-1", children: emptyState?.description ||
|
|
319
|
-
"There are no items to display." })] }) }) })) : (
|
|
352
|
+
"There are no items to display." })] }) }) })) : (processedData.map((row, rowIndex) => renderRow(row, rowIndex, 0))) })] }) }), loading && (jsx("div", { className: "tw:absolute tw:inset-0 tw:z-20 tw:flex tw:items-center tw:justify-center tw:bg-card/50 tw:backdrop-blur-[1px]", children: jsxs("div", { className: "tw:flex tw:flex-col tw:items-center", children: [jsx(Loader2Icon, { className: "tw:size-8 tw:animate-spin tw:text-primary" }), data.length === 0 && (jsx("p", { className: "tw:text-sm tw:text-muted-foreground tw:mt-3", children: "Loading..." }))] }) }))] }), footerContent && (jsx("div", { className: "tw:border-t tw:px-4 tw:py-3 tw:bg-card", children: footerContent })), pagination &&
|
|
320
353
|
(pagination.totalPages > 1 ||
|
|
321
354
|
pagination.mode === "cursor" ||
|
|
322
355
|
pagination.showTotalItems ||
|
package/dist/components/field.js
CHANGED
|
@@ -41,10 +41,10 @@ function FieldContent({ className, ...props }) {
|
|
|
41
41
|
return (jsx("div", { "data-slot": "field-content", className: cn("group/field-content tw:flex tw:flex-1 tw:flex-col tw:gap-1.5 tw:leading-snug", className), ...props }));
|
|
42
42
|
}
|
|
43
43
|
function FieldLabel({ className, ...props }) {
|
|
44
|
-
return (jsx(Label, { "data-slot": "field-label", className: cn("group/field-label peer/field-label tw:flex tw:w-fit tw:gap-2 tw:leading-snug group-data-[disabled=true]/field:tw:opacity-50", "has-[>[data-slot=field]]:tw:w-full has-[>[data-slot=field]]:tw:flex-col has-[>[data-slot=field]]:tw:rounded-md has-[>[data-slot=field]]:tw:border [&>*]:data-[slot=field]:tw:p-4", "has-data-[state=checked]:tw:bg-primary/5 has-data-[state=checked]:tw:border-primary dark:has-data-[state=checked]:tw:bg-primary/10", className), ...props }));
|
|
44
|
+
return (jsx(Label, { "data-slot": "field-label", className: cn("group/field-label peer/field-label tw:flex tw:w-fit tw:gap-2 tw:leading-snug group-data-[disabled=true]/field:tw:!cursor-not-allowed group-data-[disabled=true]/field:tw:!opacity-50", "has-[>[data-slot=field]]:tw:w-full has-[>[data-slot=field]]:tw:flex-col has-[>[data-slot=field]]:tw:rounded-md has-[>[data-slot=field]]:tw:border [&>*]:data-[slot=field]:tw:p-4", "has-data-[state=checked]:tw:bg-primary/5 has-data-[state=checked]:tw:border-primary dark:has-data-[state=checked]:tw:bg-primary/10", className), ...props }));
|
|
45
45
|
}
|
|
46
46
|
function FieldTitle({ className, ...props }) {
|
|
47
|
-
return (jsx("div", { "data-slot": "field-label", className: cn("tw:flex tw:w-fit tw:items-center tw:gap-2 tw:text-sm tw:leading-snug tw:font-medium group-data-[disabled=true]/field:tw:opacity-50", className), ...props }));
|
|
47
|
+
return (jsx("div", { "data-slot": "field-label", className: cn("tw:flex tw:w-fit tw:items-center tw:gap-2 tw:text-sm tw:leading-snug tw:font-medium group-data-[disabled=true]/field:tw:!cursor-not-allowed group-data-[disabled=true]/field:tw:!opacity-50", className), ...props }));
|
|
48
48
|
}
|
|
49
49
|
function FieldDescription({ className, ...props }) {
|
|
50
50
|
return (jsx("p", { "data-slot": "field-description", className: cn("tw:text-muted-foreground tw:text-sm tw:leading-normal tw:font-normal group-has-[[data-orientation=horizontal]]/field:tw:text-balance", "last:tw:mt-0 nth-last-2:tw:-mt-1 [[data-variant=legend]+&]:tw:-mt-1.5", "[&>a:hover]:tw:text-primary [&>a]:tw:underline [&>a]:tw:underline-offset-4", className), ...props }));
|
package/dist/components/form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
-
import { FormProvider, useFormContext, useFormState
|
|
4
|
+
import { FormProvider, Controller, useFormContext, useFormState } from 'react-hook-form';
|
|
5
5
|
import { cn } from '../lib/utils.js';
|
|
6
6
|
import { Label } from './label.js';
|
|
7
7
|
|
|
@@ -10,32 +10,29 @@ declare const AppsConfig: readonly [{
|
|
|
10
10
|
readonly name: "Ecom";
|
|
11
11
|
readonly logo: import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
readonly subdomain: "ecom-beta";
|
|
13
|
-
}, {
|
|
14
|
-
readonly name: "Lighthouse";
|
|
15
|
-
readonly logo: import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
readonly subdomain: "lighthouse";
|
|
17
13
|
}, {
|
|
18
14
|
readonly name: "Sites";
|
|
19
15
|
readonly logo: import("react/jsx-runtime").JSX.Element;
|
|
20
16
|
readonly subdomain: "cms";
|
|
21
17
|
}, {
|
|
22
|
-
readonly name: "
|
|
18
|
+
readonly name: "Lighthouse";
|
|
19
|
+
readonly logo: import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
readonly subdomain: "lighthouse";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "Growth";
|
|
23
23
|
readonly logo: import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
readonly
|
|
25
|
-
readonly disabled: true;
|
|
26
|
-
readonly subdomain: null;
|
|
24
|
+
readonly subdomain: "growth";
|
|
27
25
|
}, {
|
|
28
|
-
readonly name: "
|
|
26
|
+
readonly name: "Billing";
|
|
29
27
|
readonly logo: import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
readonly
|
|
31
|
-
readonly subdomain: null;
|
|
28
|
+
readonly subdomain: "billing";
|
|
32
29
|
}, {
|
|
33
|
-
readonly name: "
|
|
30
|
+
readonly name: "Settings";
|
|
34
31
|
readonly logo: import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
readonly
|
|
36
|
-
readonly subdomain: null;
|
|
32
|
+
readonly subdomain: "settings";
|
|
37
33
|
}];
|
|
38
34
|
type AppName = (typeof AppsConfig)[number]["name"];
|
|
35
|
+
type AppSubdomain = NonNullable<(typeof AppsConfig)[number]["subdomain"]>;
|
|
39
36
|
type HeaderAppSwitcherProps = {
|
|
40
37
|
/**
|
|
41
38
|
* Optional base host string (e.g. "https://blaze.me" or "staging.blaze.me").
|
|
@@ -44,7 +41,13 @@ type HeaderAppSwitcherProps = {
|
|
|
44
41
|
commonHost?: string;
|
|
45
42
|
/** Which app is currently active. Defaults to "Retail". */
|
|
46
43
|
currentApp?: AppName;
|
|
44
|
+
/** Filter apps by subdomain. When omitted, all apps are shown. */
|
|
45
|
+
visibleApps?: AppSubdomain[];
|
|
46
|
+
/** Number of grid columns. Defaults to 3. */
|
|
47
|
+
columns?: 1 | 2 | 3 | 4;
|
|
48
|
+
/** When true, appends ?sso=true to all app URLs to trigger SSO login on the target app. */
|
|
49
|
+
ssoRedirect?: boolean;
|
|
47
50
|
};
|
|
48
|
-
declare function HeaderAppSwitcher({ commonHost, currentApp, }: HeaderAppSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
-
export { HeaderAppSwitcher, type HeaderAppSwitcherProps, type AppName };
|
|
51
|
+
declare function HeaderAppSwitcher({ commonHost, currentApp, visibleApps, columns, ssoRedirect, }: HeaderAppSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export { HeaderAppSwitcher, type HeaderAppSwitcherProps, type AppName, type AppSubdomain, };
|
|
50
53
|
//# sourceMappingURL=header-app-switcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-app-switcher.d.ts","sourceRoot":"","sources":["../../src/components/header-app-switcher.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header-app-switcher.d.ts","sourceRoot":"","sources":["../../src/components/header-app-switcher.tsx"],"names":[],"mappings":"AAsBA,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBN,CAAA;AAEV,KAAK,OAAO,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAClD,KAAK,YAAY,GAAG,WAAW,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA;AAiGzE,KAAK,sBAAsB,GAAG;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kEAAkE;IAClE,WAAW,CAAC,EAAE,YAAY,EAAE,CAAA;IAC5B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACvB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAmBD,iBAAS,iBAAiB,CAAC,EACzB,UAAU,EACV,UAAqB,EACrB,WAAW,EACX,OAAO,EACP,WAAW,GACZ,EAAE,sBAAsB,2CA+FxB;AAED,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,OAAO,EACZ,KAAK,YAAY,GAClB,CAAA"}
|
|
@@ -1,45 +1,35 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { TrendingUp, CreditCard, Settings } from 'lucide-react';
|
|
3
4
|
import { Button } from './button.js';
|
|
4
5
|
import { Popover, PopoverTrigger, PopoverContent } from './popover.js';
|
|
5
|
-
import {
|
|
6
|
-
import { BlazeRetailLogo } from '../svgs/blaze-retail-logo.js';
|
|
7
|
-
import { BlazePosLogo } from '../svgs/blaze-pos-logo.js';
|
|
8
|
-
import { BlazeEcomLogo } from '../svgs/blaze-ecom-logo.js';
|
|
9
|
-
import { BlazeLighthouseLogo } from '../svgs/blaze-lighthouse-logo.js';
|
|
10
|
-
import { BlazeSitesLogo } from '../svgs/blaze-sites-logo.js';
|
|
11
|
-
import { BlazePayLogo } from '../svgs/blaze-pay-logo.js';
|
|
12
|
-
import { BlazeInsightsLogo } from '../svgs/blaze-insights-logo.js';
|
|
6
|
+
import { RetailLogo, PosLogo, EcomLogo, SitesLogo, PlaceholderAppIcon, AppsGridIcon } from '../svgs/header-app-switcher-logos.js';
|
|
13
7
|
import { cn } from '../lib/utils.js';
|
|
14
8
|
|
|
15
9
|
const AppsConfig = [
|
|
16
|
-
{ name: "Retail", logo: jsx(
|
|
17
|
-
{ name: "POS", logo: jsx(
|
|
18
|
-
{ name: "Ecom", logo: jsx(
|
|
10
|
+
{ name: "Retail", logo: jsx(RetailLogo, {}), subdomain: "retail-beta" },
|
|
11
|
+
{ name: "POS", logo: jsx(PosLogo, {}), subdomain: "pos" },
|
|
12
|
+
{ name: "Ecom", logo: jsx(EcomLogo, {}), subdomain: "ecom-beta" },
|
|
13
|
+
{ name: "Sites", logo: jsx(SitesLogo, {}), subdomain: "cms" },
|
|
19
14
|
{
|
|
20
15
|
name: "Lighthouse",
|
|
21
|
-
logo: jsx(
|
|
16
|
+
logo: jsx(PosLogo, {}),
|
|
22
17
|
subdomain: "lighthouse",
|
|
23
18
|
},
|
|
24
|
-
{ name: "Sites", logo: jsx(BlazeSitesLogo, {}), subdomain: "cms" },
|
|
25
19
|
{
|
|
26
|
-
name: "
|
|
27
|
-
logo: jsx(
|
|
28
|
-
|
|
29
|
-
disabled: true,
|
|
30
|
-
subdomain: null,
|
|
20
|
+
name: "Growth",
|
|
21
|
+
logo: jsx(PlaceholderAppIcon, { icon: TrendingUp }),
|
|
22
|
+
subdomain: "growth",
|
|
31
23
|
},
|
|
32
24
|
{
|
|
33
|
-
name: "
|
|
34
|
-
logo: jsx(
|
|
35
|
-
|
|
36
|
-
subdomain: null,
|
|
25
|
+
name: "Billing",
|
|
26
|
+
logo: jsx(PlaceholderAppIcon, { icon: CreditCard }),
|
|
27
|
+
subdomain: "billing",
|
|
37
28
|
},
|
|
38
29
|
{
|
|
39
|
-
name: "
|
|
40
|
-
logo: jsx(
|
|
41
|
-
|
|
42
|
-
subdomain: null,
|
|
30
|
+
name: "Settings",
|
|
31
|
+
logo: jsx(PlaceholderAppIcon, { icon: Settings }),
|
|
32
|
+
subdomain: "settings",
|
|
43
33
|
},
|
|
44
34
|
];
|
|
45
35
|
const trimSlashes = (value) => value.trim().replace(/\/+$/, "");
|
|
@@ -105,43 +95,53 @@ const resolveHostInfo = (commonHost) => {
|
|
|
105
95
|
host: "blaze.me",
|
|
106
96
|
};
|
|
107
97
|
};
|
|
108
|
-
const buildAppUrl = (subdomain, base) => {
|
|
98
|
+
const buildAppUrl = (subdomain, base, ssoRedirect) => {
|
|
109
99
|
if (!subdomain)
|
|
110
100
|
return "#";
|
|
111
|
-
|
|
101
|
+
const url = new URL(`${base.protocol}//${subdomain}.${base.host}`);
|
|
102
|
+
if (ssoRedirect)
|
|
103
|
+
url.searchParams.set("sso", "true");
|
|
104
|
+
return url.toString();
|
|
112
105
|
};
|
|
113
|
-
function AppsGridIcon() {
|
|
114
|
-
return (jsxs("svg", { "aria-hidden": true, viewBox: "0 0 24 24", fill: "currentColor", className: "tw:h-5 tw:w-5", children: [jsx("circle", { cx: "5", cy: "5", r: "1.5" }), jsx("circle", { cx: "12", cy: "5", r: "1.5" }), jsx("circle", { cx: "19", cy: "5", r: "1.5" }), jsx("circle", { cx: "5", cy: "12", r: "1.5" }), jsx("circle", { cx: "12", cy: "12", r: "1.5" }), jsx("circle", { cx: "19", cy: "12", r: "1.5" }), jsx("circle", { cx: "5", cy: "19", r: "1.5" }), jsx("circle", { cx: "12", cy: "19", r: "1.5" }), jsx("circle", { cx: "19", cy: "19", r: "1.5" })] }));
|
|
115
|
-
}
|
|
116
106
|
const getTileClassName = (isCurrent, isDisabled) => {
|
|
117
|
-
if (isCurrent) {
|
|
118
|
-
return "tw:bg-primary/10 tw:ring-2 tw:ring-primary/20";
|
|
119
|
-
}
|
|
120
107
|
if (isDisabled) {
|
|
121
108
|
return "tw:cursor-not-allowed tw:opacity-60";
|
|
122
109
|
}
|
|
110
|
+
if (isCurrent) {
|
|
111
|
+
return "tw:cursor-default";
|
|
112
|
+
}
|
|
123
113
|
return "hover:tw:bg-accent tw:cursor-pointer";
|
|
124
114
|
};
|
|
125
|
-
|
|
115
|
+
const gridColsClass = {
|
|
116
|
+
1: "tw:grid-cols-1",
|
|
117
|
+
2: "tw:grid-cols-2",
|
|
118
|
+
3: "tw:grid-cols-3",
|
|
119
|
+
4: "tw:grid-cols-4",
|
|
120
|
+
};
|
|
121
|
+
function HeaderAppSwitcher({ commonHost, currentApp = "Retail", visibleApps, columns, ssoRedirect, }) {
|
|
126
122
|
const apps = React.useMemo(() => {
|
|
127
123
|
const base = resolveHostInfo(commonHost);
|
|
128
|
-
|
|
124
|
+
const filtered = visibleApps
|
|
125
|
+
? AppsConfig.filter((app) => app.subdomain && visibleApps.includes(app.subdomain))
|
|
126
|
+
: AppsConfig;
|
|
127
|
+
return filtered.map((app) => ({
|
|
129
128
|
...app,
|
|
130
129
|
isCurrent: currentApp === app.name,
|
|
131
|
-
href: buildAppUrl(app.subdomain, base),
|
|
130
|
+
href: buildAppUrl(app.subdomain, base, ssoRedirect),
|
|
132
131
|
}));
|
|
133
|
-
}, [commonHost, currentApp]);
|
|
134
|
-
|
|
132
|
+
}, [commonHost, currentApp, visibleApps, ssoRedirect]);
|
|
133
|
+
const resolvedColumns = columns ?? 3;
|
|
134
|
+
return (jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button, { variant: "ghost", size: "icon", children: [jsx(AppsGridIcon, {}), jsx("span", { className: "tw:sr-only", children: "Switch apps" })] }) }), jsxs(PopoverContent, { align: "end", sideOffset: 8, className: "tw:!w-[286px] tw:!rounded tw:!border-border tw:!p-4 tw:!font-sans tw:!shadow-xl", children: [jsx("p", { className: "tw:mb-5 tw:text-sm tw:font-medium tw:leading-5 tw:text-popover-foreground", children: "Blaze Apps" }), jsx("div", { className: cn("tw:grid tw:gap-x-5 tw:gap-y-7", gridColsClass[resolvedColumns]), children: apps.map((app) => {
|
|
135
135
|
const isDisabled = Boolean(app.disabled);
|
|
136
136
|
const isCurrent = Boolean(app.isCurrent);
|
|
137
137
|
const tileClassName = getTileClassName(isCurrent, isDisabled);
|
|
138
|
-
const tileContent = (jsxs(Fragment, { children: [app.badge ? (jsx("span", { className: "tw:absolute tw:right-1 tw:top-1 tw:rounded-full tw:bg-primary tw:px-1.5 tw:py-0.5 tw:text-[10px] tw:font-semibold tw:leading-none tw:text-primary-foreground", children: app.badge })) : null, app.logo, jsx("span", { className: cn("tw:text-center tw:text-
|
|
139
|
-
|
|
140
|
-
: "tw:text-foreground"), children: app.name })] }));
|
|
141
|
-
const baseClassName = `tw:relative tw:flex tw:flex-col tw:items-center tw:gap-2 tw:rounded-lg tw:p-3 tw:transition-colors ${tileClassName}`;
|
|
138
|
+
const tileContent = (jsxs(Fragment, { children: [app.badge ? (jsx("span", { className: "tw:absolute tw:right-1 tw:top-1 tw:rounded-full tw:bg-primary tw:px-1.5 tw:py-0.5 tw:text-[10px] tw:font-semibold tw:leading-none tw:text-primary-foreground", children: app.badge })) : null, jsx("span", { className: "tw:flex tw:size-9 tw:items-center tw:justify-center tw:[&>svg]:tw:size-9 tw:[&>svg]:tw:shrink-0", children: app.logo }), jsx("span", { className: cn("tw:text-center tw:text-xs tw:font-normal tw:leading-4 tw:text-popover-foreground", isDisabled && "tw:text-muted-foreground"), children: app.name })] }));
|
|
139
|
+
const baseClassName = `tw:relative tw:flex tw:min-h-14 tw:flex-col tw:items-center tw:gap-2 tw:rounded-md tw:p-0 tw:transition-colors ${tileClassName}`;
|
|
142
140
|
const Wrapper = isDisabled || isCurrent ? "div" : "a";
|
|
143
141
|
const wrapperProps = isDisabled || isCurrent
|
|
144
|
-
?
|
|
142
|
+
? isCurrent
|
|
143
|
+
? { "aria-current": "page" }
|
|
144
|
+
: {}
|
|
145
145
|
: {
|
|
146
146
|
href: app.href,
|
|
147
147
|
target: "_blank",
|